update 20.10.2025
This commit is contained in:
parent
8c11130b5d
commit
a939cd51ef
616 changed files with 84821 additions and 4121 deletions
|
|
@ -131,92 +131,13 @@
|
|||
<a href="{{ route('admin.dhl.cockpit') }}" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-sync"></i> Zurücksetzen
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Quick Actions -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">
|
||||
<i class="fas fa-bolt text-warning"></i>
|
||||
Schnellaktionen
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="card bg-light border-primary h-100">
|
||||
<div class="card-body text-center">
|
||||
<i class="fas fa-plus-circle fa-3x text-primary mb-3"></i>
|
||||
<h5 class="card-title">Neue Sendung erstellen</h5>
|
||||
<p class="card-text text-muted">
|
||||
Erstellen Sie eine neue DHL-Sendung basierend auf einer bestehenden Bestellung.
|
||||
</p>
|
||||
<button type="button" class="btn btn-primary"
|
||||
data-toggle="modal"
|
||||
data-id="new"
|
||||
data-target="#modals-load-content"
|
||||
data-action="create-dhl-shipment"
|
||||
data-route="{{ route('modal_load') }}">
|
||||
<i class="fas fa-shipping-fast"></i> Sendung erstellen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="card bg-light border-info h-100">
|
||||
<div class="card-body text-center">
|
||||
<i class="fas fa-search fa-3x text-info mb-3"></i>
|
||||
<h5 class="card-title">Sendung anzeigen</h5>
|
||||
<p class="card-text text-muted">
|
||||
Suchen und anzeigen einer bestimmten Sendung nach ID oder Tracking-Nummer.
|
||||
</p>
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-info dropdown-toggle" type="button" id="showDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fas fa-eye"></i> Sendung anzeigen
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="showDropdown">
|
||||
<h6 class="dropdown-header">Sendung finden:</h6>
|
||||
<a class="dropdown-item" href="#" onclick="promptShipmentId()">
|
||||
<i class="fas fa-hashtag"></i> Sendungs-ID eingeben
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" onclick="promptTrackingNumber()">
|
||||
<i class="fas fa-barcode"></i> Tracking-Nummer eingeben
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" onclick="$('#search').focus();">
|
||||
<i class="fas fa-filter"></i> Filter verwenden
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="card bg-light border-secondary h-100">
|
||||
<div class="card-body text-center">
|
||||
<i class="fas fa-plug fa-3x text-secondary mb-3"></i>
|
||||
<h5 class="card-title">API Login Test</h5>
|
||||
<p class="card-text text-muted">
|
||||
Überprüfen Sie, ob die in der <code>.env</code>-Datei hinterlegten DHL-Zugangsdaten korrekt sind.
|
||||
</p>
|
||||
<button type="button" class="btn btn-secondary" id="test-dhl-login-btn">
|
||||
<span class="spinner-border spinner-border-sm" role="status" style="display: none;"></span>
|
||||
<i class="fas fa-key"></i> Login testen
|
||||
</button>
|
||||
<div id="dhl-test-result" class="mt-3 text-left"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Batch Actions -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
|
|
@ -224,11 +145,23 @@
|
|||
<i class="fas fa-list text-primary"></i>
|
||||
Sendungsübersicht
|
||||
</h5>
|
||||
<div class="float-right">
|
||||
<button type="button" class="btn btn-sm btn-primary"
|
||||
data-toggle="modal"
|
||||
data-id="new"
|
||||
data-target="#modals-load-content"
|
||||
data-action="create-dhl-shipment"
|
||||
data-route="{{ route('modal_load') }}">
|
||||
<i class="fas fa-shipping-fast"></i> Sendung erstellen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="batch-actions" style="display: none;">
|
||||
{{-- Todo: Add cancel button
|
||||
<button type="button" class="btn btn-sm btn-warning batch-action-btn" data-action="cancel">
|
||||
<i class="fas fa-ban"></i> Ausgewählte stornieren
|
||||
</button>
|
||||
--}}
|
||||
<button type="button" class="btn btn-sm btn-info batch-action-btn" data-action="update_tracking">
|
||||
<i class="fas fa-sync"></i> Tracking aktualisieren
|
||||
</button>
|
||||
|
|
@ -278,6 +211,8 @@ $(document).ready(function() {
|
|||
var dhlTable = $('#dhl-shipments-table').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
searching: false,
|
||||
pageLength: 50,
|
||||
ajax: {
|
||||
url: "{{ route('admin.dhl.datatable') }}",
|
||||
type: "POST",
|
||||
|
|
@ -316,6 +251,8 @@ $(document).ready(function() {
|
|||
// Handle filter form submission
|
||||
$('#dhl-filter-form').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
console.log(('#date_from').val());
|
||||
console.log(('#date_to').val());
|
||||
dhlTable.draw();
|
||||
});
|
||||
|
||||
|
|
@ -327,54 +264,7 @@ $(document).ready(function() {
|
|||
// Tooltip initialization for static elements
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
|
||||
// --- DHL LOGIN TEST ---
|
||||
$('#test-dhl-login-btn').click(function() {
|
||||
var btn = $(this);
|
||||
var spinner = btn.find('.spinner-border');
|
||||
var resultContainer = $('#dhl-test-result');
|
||||
|
||||
btn.prop('disabled', true);
|
||||
spinner.show();
|
||||
resultContainer.html('');
|
||||
|
||||
$.ajax({
|
||||
url: '{{ route("admin.dhl.test_login") }}',
|
||||
method: 'POST',
|
||||
data: {
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
var alertClass = response.success ? 'alert-success' : 'alert-danger';
|
||||
var icon = response.success ? 'fas fa-check-circle' : 'fas fa-times-circle';
|
||||
var resultHtml = `
|
||||
<div class="alert ${alertClass} d-flex align-items-center" role="alert">
|
||||
<i class="${icon} mr-2"></i>
|
||||
<div>
|
||||
${response.message}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
resultContainer.html(resultHtml);
|
||||
},
|
||||
error: function(xhr) {
|
||||
var errorHtml = `
|
||||
<div class="alert alert-danger d-flex align-items-center" role="alert">
|
||||
<i class="fas fa-server mr-2"></i>
|
||||
<div>
|
||||
Ein Serverfehler ist aufgetreten. Prüfen Sie die Browser-Konsole und die Laravel-Logs.
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
resultContainer.html(errorHtml);
|
||||
},
|
||||
complete: function() {
|
||||
btn.prop('disabled', false);
|
||||
spinner.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// --- BATCH & ROW ACTIONS ---
|
||||
|
||||
// Select All functionality
|
||||
$('#dhl-shipments-table').on('change', '#select-all', function() {
|
||||
|
|
@ -417,28 +307,81 @@ $(document).ready(function() {
|
|||
if (!confirm('Möchten Sie diese Aktion für ' + selectedIds.length + ' Sendung(en) ausführen?')) {
|
||||
return;
|
||||
}
|
||||
console.log(selectedIds);
|
||||
console.log(action);
|
||||
|
||||
// Perform batch action
|
||||
$.ajax({
|
||||
url: '{{ route("admin.dhl.batch-action") }}',
|
||||
method: 'POST',
|
||||
data: {
|
||||
action: action,
|
||||
shipment_ids: selectedIds,
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showAlert('success', response.message);
|
||||
location.reload();
|
||||
} else {
|
||||
showAlert('error', response.message);
|
||||
if (action === 'download_labels') {
|
||||
// Handle file download differently
|
||||
$.ajax({
|
||||
url: '{{ route("admin.dhl.batch-action") }}',
|
||||
method: 'POST',
|
||||
data: {
|
||||
action: action,
|
||||
shipment_ids: selectedIds,
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
xhrFields: {
|
||||
responseType: 'blob'
|
||||
},
|
||||
success: function(data, status, xhr) {
|
||||
// Check if it's actually a JSON error response
|
||||
if (xhr.getResponseHeader('content-type') && xhr.getResponseHeader('content-type').indexOf('application/json') !== -1) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function() {
|
||||
try {
|
||||
var response = JSON.parse(reader.result);
|
||||
if (response.success) {
|
||||
showAlert('success', response.message);
|
||||
} else {
|
||||
showAlert('error', response.message);
|
||||
}
|
||||
} catch (e) {
|
||||
showAlert('error', 'Fehler beim Verarbeiten der Antwort.');
|
||||
}
|
||||
};
|
||||
reader.readAsText(data);
|
||||
} else {
|
||||
// It's a file download
|
||||
var blob = new Blob([data]);
|
||||
var url = window.URL.createObjectURL(blob);
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = 'dhl_labels_' + new Date().toISOString().slice(0,19).replace(/:/g, '-') + '.zip';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
window.URL.revokeObjectURL(url);
|
||||
showAlert('success', 'Labels werden heruntergeladen...');
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
showAlert('error', 'Fehler beim Download der Labels.');
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
showAlert('error', 'Fehler bei der Stapelverarbeitung.');
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// Handle other batch actions normally
|
||||
$.ajax({
|
||||
url: '{{ route("admin.dhl.batch-action") }}',
|
||||
method: 'POST',
|
||||
data: {
|
||||
action: action,
|
||||
shipment_ids: selectedIds,
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showAlert('success', response.message);
|
||||
location.reload();
|
||||
} else {
|
||||
showAlert('error', response.message);
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
showAlert('error', 'Fehler bei der Stapelverarbeitung.');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Individual action buttons (delegated events)
|
||||
|
|
@ -528,31 +471,6 @@ $(document).ready(function() {
|
|||
});
|
||||
*/
|
||||
|
||||
function promptShipmentId() {
|
||||
var shipmentId = prompt('Bitte geben Sie die Sendungs-ID ein:');
|
||||
if (shipmentId && shipmentId.trim()) {
|
||||
shipmentId = shipmentId.trim();
|
||||
if (!isNaN(shipmentId) && shipmentId > 0) {
|
||||
window.location.href = '{{ route("admin.dhl.show", ":shipmentId") }}'.replace(':shipmentId', shipmentId);
|
||||
} else {
|
||||
alert('Bitte geben Sie eine gültige Sendungs-ID (Zahl) ein.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function promptTrackingNumber() {
|
||||
var trackingNumber = prompt('Bitte geben Sie die Tracking-Nummer ein:');
|
||||
if (trackingNumber && trackingNumber.trim()) {
|
||||
trackingNumber = trackingNumber.trim();
|
||||
if (trackingNumber.length >= 10) {
|
||||
// Use search functionality to find by tracking number
|
||||
$('#search').val(trackingNumber);
|
||||
$('#dhl-filter-form').submit();
|
||||
} else {
|
||||
alert('Bitte geben Sie eine gültige Tracking-Nummer ein (mindestens 10 Zeichen).');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Alert helper function
|
||||
function showAlert(type, message) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue