23-01-2026
This commit is contained in:
parent
a939cd51ef
commit
a8b395e20d
248 changed files with 29342 additions and 4805 deletions
|
|
@ -205,6 +205,16 @@
|
|||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<style>
|
||||
/* Highlight return shipments */
|
||||
#dhl-shipments-table tbody tr.return-shipment {
|
||||
background-color: rgba(255, 193, 7, 0.08) !important;
|
||||
border-left: 3px solid #ffc107;
|
||||
}
|
||||
#dhl-shipments-table tbody tr.return-shipment:hover {
|
||||
background-color: rgba(255, 193, 7, 0.15) !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// DataTable initialization
|
||||
|
|
@ -245,6 +255,7 @@ $(document).ready(function() {
|
|||
// Re-initialize tooltips on each table draw
|
||||
drawCallback: function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
// Row classes are now added automatically by DataTables via DT_RowClass
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -414,11 +425,15 @@ $(document).ready(function() {
|
|||
|
||||
$('#dhl-shipments-table').on('click', '.create-return-btn', function() {
|
||||
var shipmentId = $(this).data('shipment-id');
|
||||
var btn = $(this);
|
||||
|
||||
if (!confirm('Möchten Sie ein Retourenlabel für diese Sendung erstellen?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable button to prevent double-click
|
||||
btn.prop('disabled', true).html('<i class="fas fa-spinner fa-spin"></i>');
|
||||
|
||||
$.ajax({
|
||||
url: `/admin/dhl/shipment/${shipmentId}/return-label`,
|
||||
method: 'POST',
|
||||
|
|
@ -428,20 +443,25 @@ $(document).ready(function() {
|
|||
success: function(response) {
|
||||
if (response.success) {
|
||||
showAlert('success', response.message);
|
||||
location.reload();
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 1500);
|
||||
} else {
|
||||
showAlert('error', response.message);
|
||||
btn.prop('disabled', false).html('<i class="fas fa-undo"></i>');
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
showAlert('error', 'Fehler beim Erstellen des Retourenlabels.');
|
||||
var errorMsg = xhr.responseJSON ? xhr.responseJSON.message : 'Fehler beim Erstellen des Retourenlabels.';
|
||||
showAlert('error', errorMsg);
|
||||
btn.prop('disabled', false).html('<i class="fas fa-undo"></i>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#dhl-shipments-table').on('click', '.update-tracking-btn', function() {
|
||||
var shipmentId = $(this).data('shipment-id');
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: `/admin/dhl/shipment/${shipmentId}/update-tracking`,
|
||||
method: 'POST',
|
||||
|
|
@ -463,6 +483,114 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Send tracking email button
|
||||
$('#dhl-shipments-table').on('click', '.send-tracking-email-btn', function() {
|
||||
var shipmentId = $(this).data('shipment-id');
|
||||
var btn = $(this);
|
||||
|
||||
if (!confirm('Möchten Sie die Tracking-E-Mail an den Kunden senden?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
btn.prop('disabled', true).html('<i class="fas fa-spinner fa-spin"></i>');
|
||||
|
||||
$.ajax({
|
||||
url: `/admin/dhl/shipment/${shipmentId}/send-tracking-email`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showAlert('success', response.message);
|
||||
btn.removeClass('btn-outline-info').addClass('btn-success');
|
||||
btn.html('<i class="fas fa-envelope"></i>');
|
||||
btn.attr('title', 'E-Mail gesendet: ' + response.sent_at);
|
||||
} else {
|
||||
showAlert('error', response.message);
|
||||
btn.prop('disabled', false).html('<i class="fas fa-envelope"></i>');
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
var errorMsg = xhr.responseJSON ? xhr.responseJSON.message : 'Fehler beim Senden der E-Mail.';
|
||||
showAlert('error', errorMsg);
|
||||
btn.prop('disabled', false).html('<i class="fas fa-envelope"></i>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Cancel shipment button
|
||||
$('#dhl-shipments-table').on('click', '.cancel-shipment-btn', function() {
|
||||
var shipmentId = $(this).data('shipment-id');
|
||||
var btn = $(this);
|
||||
|
||||
if (!confirm('Möchten Sie diese Sendung wirklich stornieren?\n\nDas Label wird bei DHL ungültig und kann nicht mehr verwendet werden.')) {
|
||||
return;
|
||||
}
|
||||
|
||||
btn.prop('disabled', true).html('<i class="fas fa-spinner fa-spin"></i>');
|
||||
|
||||
$.ajax({
|
||||
url: `/admin/dhl/shipment/${shipmentId}/cancel`,
|
||||
method: 'DELETE',
|
||||
data: {
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showAlert('success', response.message || 'Sendung wird storniert...');
|
||||
setTimeout(function() {
|
||||
table.ajax.reload();
|
||||
}, 2000);
|
||||
} else {
|
||||
showAlert('error', response.message);
|
||||
btn.prop('disabled', false).html('<i class="fas fa-ban"></i>');
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
var errorMsg = xhr.responseJSON ? xhr.responseJSON.message : 'Fehler beim Stornieren der Sendung.';
|
||||
showAlert('error', errorMsg);
|
||||
btn.prop('disabled', false).html('<i class="fas fa-ban"></i>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Create return label button
|
||||
$('#dhl-shipments-table').on('click', '.create-return-btn', function() {
|
||||
var shipmentId = $(this).data('shipment-id');
|
||||
var btn = $(this);
|
||||
|
||||
if (!confirm('Möchten Sie ein Retourenlabel für diese Sendung erstellen?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
btn.prop('disabled', true).html('<i class="fas fa-spinner fa-spin"></i>');
|
||||
|
||||
$.ajax({
|
||||
url: `/admin/dhl/shipment/${shipmentId}/return-label`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showAlert('success', response.message || 'Retourenlabel wird erstellt...');
|
||||
setTimeout(function() {
|
||||
table.ajax.reload();
|
||||
}, 2000);
|
||||
} else {
|
||||
showAlert('error', response.message);
|
||||
btn.prop('disabled', false).html('<i class="fas fa-undo"></i>');
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
var errorMsg = xhr.responseJSON ? xhr.responseJSON.message : 'Fehler beim Erstellen des Retourenlabels.';
|
||||
showAlert('error', errorMsg);
|
||||
btn.prop('disabled', false).html('<i class="fas fa-undo"></i>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Remove old auto-submit logic
|
||||
/*
|
||||
|
|
@ -474,6 +602,9 @@ $(document).ready(function() {
|
|||
|
||||
// Alert helper function
|
||||
function showAlert(type, message) {
|
||||
// Remove any existing alerts first to prevent duplicates
|
||||
$('.alert.alert-dismissible').remove();
|
||||
|
||||
var alertClass = type === 'success' ? 'alert-success' : 'alert-danger';
|
||||
var alertHtml = `
|
||||
<div class="alert ${alertClass} alert-dismissible fade show" role="alert">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue