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) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,13 @@
|
|||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
<i class="fas fa-shipping-fast text-primary"></i>
|
||||
DHL Sendung erstellen
|
||||
@if($modalMode === 'search')
|
||||
DHL Sendung erstellen
|
||||
@elseif($modalMode === 'info')
|
||||
DHL Sendungen - Bestellung #{{ $order->id }}
|
||||
@elseif($modalMode === 'create')
|
||||
DHL Sendung erstellen - Bestellung #{{ $order->id }}
|
||||
@endif
|
||||
</h5>
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
|
|
@ -42,293 +48,18 @@
|
|||
</div>
|
||||
@endif
|
||||
|
||||
@if($order)
|
||||
<form id="modal-create-shipment-form" method="POST" action="{{ route('admin.dhl.store') }}">
|
||||
@csrf
|
||||
<input type="hidden" name="order_id" value="{{ $order->id }}">
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
{{-- Left Column: Order Info --}}
|
||||
<div class="col-md-6">
|
||||
<h6 class="text-primary mb-3">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
Bestellinformationen
|
||||
</h6>
|
||||
|
||||
<div class="card bg-light">
|
||||
<div class="card-body">
|
||||
<h6 class="card-title">Bestellung #{{ $order->id }}</h6>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<small class="text-muted d-block">Kunde:</small>
|
||||
<strong>{{ $order->shopping_user->billing_firstname ?? '' }} {{ $order->shopping_user->billing_lastname ?? '' }}</strong>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<small class="text-muted d-block">Datum:</small>
|
||||
<strong>{{ $order->created_at->format('d.m.Y') }}</strong>
|
||||
</div>
|
||||
<div class="col-6 mt-2">
|
||||
<small class="text-muted d-block">Wert:</small>
|
||||
<strong>{{ number_format($order->total, 2) }} €</strong>
|
||||
</div>
|
||||
<div class="col-6 mt-2">
|
||||
<small class="text-muted d-block">Artikel:</small>
|
||||
<strong>{{ $order->shopping_order_items->count() }} Stück</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Right Column: Shipment Config --}}
|
||||
<div class="col-md-6">
|
||||
<h6 class="text-primary mb-3">
|
||||
<i class="fas fa-cog"></i>
|
||||
Sendungskonfiguration
|
||||
</h6>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="modal-weight" class="font-weight-semibold">
|
||||
<i class="fas fa-weight"></i>
|
||||
Gewicht (kg) <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input type="number"
|
||||
class="form-control"
|
||||
id="modal-weight"
|
||||
name="weight"
|
||||
min="0.1"
|
||||
max="31.5"
|
||||
step="0.1"
|
||||
value="{{ number_format($orderWeight, 1) }}"
|
||||
required>
|
||||
<small class="form-text text-muted">
|
||||
Berechnet: {{ number_format($orderWeight, 1) }} kg
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="modal-product-code" class="font-weight-semibold">
|
||||
<i class="fas fa-cube"></i>
|
||||
Produktcode
|
||||
</label>
|
||||
<select class="form-control custom-select" id="modal-product-code" name="product_code">
|
||||
@foreach($productCodes as $code => $name)
|
||||
<option value="{{ $code }}">{{ $code }} - {{ $name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="modal-priority" class="font-weight-semibold">
|
||||
<i class="fas fa-exclamation-triangle"></i>
|
||||
Priorität
|
||||
</label>
|
||||
<select class="form-control custom-select" id="modal-priority" name="priority">
|
||||
<option value="normal">Normal</option>
|
||||
<option value="high">Hoch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox"
|
||||
class="custom-control-input"
|
||||
id="modal-auto-track"
|
||||
name="auto_track"
|
||||
value="1"
|
||||
checked>
|
||||
<label class="custom-control-label" for="modal-auto-track">
|
||||
Automatisches Tracking
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
{{-- Shipping Address Section --}}
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h6 class="text-primary mb-3">
|
||||
<i class="fas fa-map-marker-alt"></i>
|
||||
Lieferadresse
|
||||
@if(!empty($warnings))
|
||||
<small class="text-warning">(Bitte Adresse prüfen)</small>
|
||||
@else
|
||||
<small class="text-muted">(zur Not anpassbar)</small>
|
||||
@endif
|
||||
</h6>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="shipping_firstname">Vorname <span class="text-danger">*</span></label>
|
||||
<input type="text"
|
||||
class="form-control {{ empty($shippingAddress['firstname']) ? 'is-invalid' : '' }}"
|
||||
name="shipping_firstname"
|
||||
id="shipping_firstname"
|
||||
value="{{ $shippingAddress['firstname'] ?? '' }}"
|
||||
required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="shipping_lastname">Nachname <span class="text-danger">*</span></label>
|
||||
<input type="text"
|
||||
class="form-control {{ empty($shippingAddress['lastname']) ? 'is-invalid' : '' }}"
|
||||
name="shipping_lastname"
|
||||
id="shipping_lastname"
|
||||
value="{{ $shippingAddress['lastname'] ?? '' }}"
|
||||
required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="shipping_company">Firma <small class="text-muted">(optional)</small></label>
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="shipping_company"
|
||||
id="shipping_company"
|
||||
value="{{ $shippingAddress['company'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="shipping_address">Straße <span class="text-danger">*</span></label>
|
||||
<input type="text"
|
||||
class="form-control {{ empty($shippingAddress['address']) ? 'is-invalid' : '' }}"
|
||||
name="shipping_address"
|
||||
id="shipping_address"
|
||||
value="{{ $shippingAddress['address'] ?? '' }}"
|
||||
required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="shipping_houseNumber">Nr./Zusatz <span class="text-danger">*</span></label>
|
||||
<input type="text"
|
||||
class="form-control {{ empty($shippingAddress['houseNumber']) ? 'border-warning' : '' }}"
|
||||
name="shipping_houseNumber"
|
||||
id="shipping_houseNumber"
|
||||
value="{{ $shippingAddress['houseNumber'] ?? '' }}"
|
||||
required>
|
||||
@if(empty($shippingAddress['houseNumber']))
|
||||
<small class="text-warning">Hausnummer benötigt</small>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="shipping_zipcode">PLZ <span class="text-danger">*</span></label>
|
||||
<input type="text"
|
||||
class="form-control {{ empty($shippingAddress['zipcode']) ? 'is-invalid' : '' }}"
|
||||
name="shipping_zipcode"
|
||||
id="shipping_zipcode"
|
||||
value="{{ $shippingAddress['zipcode'] ?? '' }}"
|
||||
required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="shipping_city">Ort <span class="text-danger">*</span></label>
|
||||
<input type="text"
|
||||
class="form-control {{ empty($shippingAddress['city']) ? 'is-invalid' : '' }}"
|
||||
name="shipping_city"
|
||||
id="shipping_city"
|
||||
value="{{ $shippingAddress['city'] ?? '' }}"
|
||||
required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="shipping_country">Land <span class="text-danger">*</span></label>
|
||||
<select class="form-control custom-select" name="shipping_country_id" id="shipping_country" required>
|
||||
@foreach($availableCountries as $countryOption)
|
||||
<option value="{{ $countryOption->id }}"
|
||||
{{ $shippingAddress['country'] && $shippingAddress['country']->id == $countryOption->id ? 'selected' : '' }}>
|
||||
{{ $countryOption->getLocated() }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="shipping_phone">Telefon <small class="text-muted">(empfohlen)</small></label>
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="shipping_phone"
|
||||
id="shipping_phone"
|
||||
value="{{ $shippingAddress['phone'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">
|
||||
<i class="fas fa-times"></i> Abbrechen
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary" id="create-shipment-btn" {{ !empty($errors) ? 'disabled' : '' }}>
|
||||
<i class="fas fa-shipping-fast"></i> Sendung erstellen
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@else
|
||||
{{-- Order Selection when no order ID provided --}}
|
||||
<div class="modal-body">
|
||||
<div class="text-center">
|
||||
<i class="fas fa-search fa-3x text-primary mb-4"></i>
|
||||
<h4>Bestellung auswählen</h4>
|
||||
<p class="text-muted mb-4">Geben Sie eine Bestellungs-ID ein, um eine DHL-Sendung zu erstellen.</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8 mx-auto">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">#</span>
|
||||
</div>
|
||||
<input type="number"
|
||||
class="form-control form-control-lg"
|
||||
id="order-id-input"
|
||||
placeholder="z.B. 12345"
|
||||
min="1">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary" type="button" id="load-order-btn">
|
||||
<i class="fas fa-search"></i> Laden
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-3">
|
||||
<div class="mb-3">oder</div>
|
||||
<a href="{{ route('admin_sales_customers') }}"
|
||||
target="_blank"
|
||||
class="btn btn-outline-secondary">
|
||||
<i class="fas fa-external-link-alt"></i>
|
||||
In Bestellverwaltung suchen
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">
|
||||
<i class="fas fa-times"></i> Abbrechen
|
||||
</button>
|
||||
</div>
|
||||
@if($modalMode === 'search')
|
||||
@include('admin.dhl.modal_in_search_shipment')
|
||||
@elseif($modalMode === 'info')
|
||||
@include('admin.dhl.modal_in_shipment_info')
|
||||
@elseif($modalMode === 'create')
|
||||
@include('admin.dhl.modal_in_order_shipment')
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
@if(!$order)
|
||||
@if($modalMode === 'search')
|
||||
// Load order functionality
|
||||
$('#load-order-btn').click(function() {
|
||||
var orderId = $('#order-id-input').val();
|
||||
|
|
@ -363,7 +94,7 @@ $(document).ready(function() {
|
|||
});
|
||||
@endif
|
||||
|
||||
@if($order)
|
||||
@if($modalMode === 'create')
|
||||
// Form submission with improved validation
|
||||
$('#modal-create-shipment-form').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
|
@ -387,20 +118,47 @@ $(document).ready(function() {
|
|||
data: formData,
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
// Close modal
|
||||
$('#modals-load-content').modal('hide');
|
||||
console.log(response);
|
||||
|
||||
// Show success message and reload
|
||||
// Show success message
|
||||
if (typeof showAlert === 'function') {
|
||||
showAlert('success', response.message);
|
||||
} else {
|
||||
alert(response.message);
|
||||
}
|
||||
|
||||
// Reload page after 2 seconds
|
||||
// Switch to info mode instead of closing modal
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 2000);
|
||||
// Show loading indicator
|
||||
var loadingHtml = `
|
||||
<div class="modal-body text-center py-5">
|
||||
<div class="spinner-border text-primary mb-3" role="status">
|
||||
<span class="sr-only">Laden...</span>
|
||||
</div>
|
||||
<h5>Sendung erfolgreich erstellt!</h5>
|
||||
<p class="text-muted">Lade Sendungsinformationen...</p>
|
||||
</div>
|
||||
`;
|
||||
$('#modals-load-content .modal-dialog').html(loadingHtml);
|
||||
|
||||
// Reload modal in info mode to show the created shipment
|
||||
$.post('{{ route('modal_load') }}', {
|
||||
action: 'create-dhl-shipment',
|
||||
id: {{ $order->id }},
|
||||
_token: '{{ csrf_token() }}'
|
||||
}).done(function(response) {
|
||||
$('#modals-load-content .modal-dialog').html(response.html);
|
||||
|
||||
// Show success message in the new modal content
|
||||
setTimeout(function() {
|
||||
if (typeof showAlert === 'function') {
|
||||
showAlert('success', 'Sendung erfolgreich erstellt! Die Sendungsinformationen werden angezeigt.');
|
||||
}
|
||||
}, 100);
|
||||
}).fail(function() {
|
||||
alert('Fehler beim Laden der Sendungsinformationen.');
|
||||
});
|
||||
}, 1000); // Wait 1 seconds to show success message
|
||||
} else {
|
||||
alert(response.message || 'Fehler beim Erstellen der Sendung.');
|
||||
submitBtn.prop('disabled', false).html('<i class="fas fa-shipping-fast"></i> Sendung erstellen');
|
||||
|
|
@ -494,5 +252,30 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
@endif
|
||||
|
||||
// Helper function for showing alerts
|
||||
window.showAlert = function(type, message) {
|
||||
var alertClass = type === 'success' ? 'alert-success' : 'alert-danger';
|
||||
var iconClass = type === 'success' ? 'fas fa-check-circle' : 'fas fa-exclamation-circle';
|
||||
|
||||
var alertHtml = `
|
||||
<div class="alert ${alertClass} alert-dismissible fade show" role="alert">
|
||||
<i class="${iconClass}"></i>
|
||||
${message}
|
||||
<button type="button" class="close" data-dismiss="alert">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
$('.modal-body').prepend(alertHtml);
|
||||
|
||||
// Auto-hide success alerts after 5 seconds
|
||||
if (type === 'success') {
|
||||
setTimeout(function() {
|
||||
$('.alert-success').alert('close');
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
207
resources/views/admin/dhl/modal_in_order_shipment.blade.php
Normal file
207
resources/views/admin/dhl/modal_in_order_shipment.blade.php
Normal file
|
|
@ -0,0 +1,207 @@
|
|||
<form id="modal-create-shipment-form" method="POST" action="{{ route('admin.dhl.store') }}">
|
||||
@csrf
|
||||
<input type="hidden" name="order_id" value="{{ $order->id }}">
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
{{-- Left Column: Order Info --}}
|
||||
<div class="col-md-6">
|
||||
<h6 class="text-primary mb-3">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
Bestellinformationen
|
||||
</h6>
|
||||
|
||||
<div class="card bg-light">
|
||||
<div class="card-body">
|
||||
<h6 class="card-title">Bestellung #{{ $order->id }}</h6>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<small class="text-muted d-block">Kunde:</small>
|
||||
<strong>{{ $order->shopping_user->billing_firstname ?? '' }}
|
||||
{{ $order->shopping_user->billing_lastname ?? '' }}</strong>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<small class="text-muted d-block">Datum:</small>
|
||||
<strong>{{ $order->created_at->format('d.m.Y') }}</strong>
|
||||
</div>
|
||||
<div class="col-6 mt-2">
|
||||
<small class="text-muted d-block">Wert:</small>
|
||||
<strong>{{ number_format($order->total, 2, ',', '.') }} €</strong>
|
||||
</div>
|
||||
<div class="col-6 mt-2">
|
||||
<small class="text-muted d-block">Artikel:</small>
|
||||
<strong>{{ $order->shopping_order_items->count() }} Stück</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Right Column: Shipment Config --}}
|
||||
<div class="col-md-6">
|
||||
<h6 class="text-primary mb-3">
|
||||
<i class="fas fa-cog"></i>
|
||||
Sendungskonfiguration
|
||||
</h6>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="modal-weight" class="font-weight-semibold">
|
||||
<i class="fas fa-weight"></i>
|
||||
Gewicht (kg) <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input type="number" class="form-control" id="modal-weight" name="weight" min="0.1"
|
||||
max="31.5" step="0.1" value="{{ number_format($orderWeight, 1) }}" required>
|
||||
<small class="form-text text-muted">
|
||||
Berechnet: {{ number_format($orderWeight, 1) }} kg
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="modal-product-code" class="font-weight-semibold">
|
||||
<i class="fas fa-cube"></i>
|
||||
Produktcode
|
||||
</label>
|
||||
<select class="form-control custom-select" id="modal-product-code" name="product_code">
|
||||
@foreach ($productCodes as $code => $name)
|
||||
<option value="{{ $code }}">{{ $code }} - {{ $name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="modal-priority" class="font-weight-semibold">
|
||||
<i class="fas fa-exclamation-triangle"></i>
|
||||
Priorität
|
||||
</label>
|
||||
<select class="form-control custom-select" id="modal-priority" name="priority">
|
||||
<option value="normal">Normal</option>
|
||||
<option value="high">Hoch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="modal-auto-track" name="auto_track"
|
||||
value="1" checked>
|
||||
<label class="custom-control-label" for="modal-auto-track">
|
||||
Automatisches Tracking
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
{{-- Shipping Address Section --}}
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h6 class="text-primary mb-3">
|
||||
<i class="fas fa-map-marker-alt"></i>
|
||||
Lieferadresse
|
||||
@if (!empty($warnings))
|
||||
<small class="text-warning">(Bitte Adresse prüfen)</small>
|
||||
@else
|
||||
<small class="text-muted">(zur Not anpassbar)</small>
|
||||
@endif
|
||||
</h6>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="shipping_firstname">Vorname <span class="text-danger">*</span></label>
|
||||
<input type="text"
|
||||
class="form-control {{ empty($shippingAddress['firstname']) ? 'is-invalid' : '' }}"
|
||||
name="shipping_firstname" id="shipping_firstname"
|
||||
value="{{ $shippingAddress['firstname'] ?? '' }}" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="shipping_lastname">Nachname <span class="text-danger">*</span></label>
|
||||
<input type="text"
|
||||
class="form-control {{ empty($shippingAddress['lastname']) ? 'is-invalid' : '' }}"
|
||||
name="shipping_lastname" id="shipping_lastname"
|
||||
value="{{ $shippingAddress['lastname'] ?? '' }}" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="shipping_company">Firma <small class="text-muted">(optional)</small></label>
|
||||
<input type="text" class="form-control" name="shipping_company" id="shipping_company"
|
||||
value="{{ $shippingAddress['company'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="shipping_address">Straße <span class="text-danger">*</span></label>
|
||||
<input type="text"
|
||||
class="form-control {{ empty($shippingAddress['address']) ? 'is-invalid' : '' }}"
|
||||
name="shipping_address" id="shipping_address"
|
||||
value="{{ $shippingAddress['address'] ?? '' }}" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="shipping_houseNumber">Nr./Zusatz <span class="text-danger">*</span></label>
|
||||
<input type="text"
|
||||
class="form-control {{ empty($shippingAddress['houseNumber']) ? 'border-warning' : '' }}"
|
||||
name="shipping_houseNumber" id="shipping_houseNumber"
|
||||
value="{{ $shippingAddress['houseNumber'] ?? '' }}" required>
|
||||
@if (empty($shippingAddress['houseNumber']))
|
||||
<small class="text-warning">Hausnummer benötigt</small>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="shipping_zipcode">PLZ <span class="text-danger">*</span></label>
|
||||
<input type="text"
|
||||
class="form-control {{ empty($shippingAddress['zipcode']) ? 'is-invalid' : '' }}"
|
||||
name="shipping_zipcode" id="shipping_zipcode"
|
||||
value="{{ $shippingAddress['zipcode'] ?? '' }}" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="shipping_city">Ort <span class="text-danger">*</span></label>
|
||||
<input type="text"
|
||||
class="form-control {{ empty($shippingAddress['city']) ? 'is-invalid' : '' }}"
|
||||
name="shipping_city" id="shipping_city" value="{{ $shippingAddress['city'] ?? '' }}"
|
||||
required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="shipping_country">Land <span class="text-danger">*</span></label>
|
||||
<select class="form-control custom-select" name="shipping_country_id"
|
||||
id="shipping_country" required>
|
||||
@foreach ($availableCountries as $countryOption)
|
||||
<option value="{{ $countryOption->id }}"
|
||||
{{ $shippingAddress['country'] && $shippingAddress['country']->id == $countryOption->id ? 'selected' : '' }}>
|
||||
{{ $countryOption->getLocated() }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="shipping_phone">Telefon <small class="text-muted">(empfohlen)</small></label>
|
||||
<input type="text" class="form-control" name="shipping_phone" id="shipping_phone"
|
||||
value="{{ $shippingAddress['phone'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">
|
||||
<i class="fas fa-times"></i> Abbrechen
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary" id="create-shipment-btn"
|
||||
{{ !empty($errors) ? 'disabled' : '' }}>
|
||||
<i class="fas fa-shipping-fast"></i> Sendung erstellen
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
46
resources/views/admin/dhl/modal_in_search_shipment.blade.php
Normal file
46
resources/views/admin/dhl/modal_in_search_shipment.blade.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{{-- Order Selection when no order ID provided --}}
|
||||
<div class="modal-body">
|
||||
<div class="text-center">
|
||||
<i class="fas fa-search fa-3x text-primary mb-4"></i>
|
||||
<h4>Bestellung auswählen</h4>
|
||||
<p class="text-muted mb-4">Geben Sie eine Bestellungs-ID ein, um eine DHL-Sendung zu erstellen.</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8 mx-auto">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">#</span>
|
||||
</div>
|
||||
<input type="number"
|
||||
class="form-control form-control-lg"
|
||||
id="order-id-input"
|
||||
placeholder="z.B. 12345"
|
||||
min="1">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary" type="button" id="load-order-btn">
|
||||
<i class="fas fa-search"></i> Laden
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-3">
|
||||
<div class="mb-3">oder</div>
|
||||
<a href="{{ route('admin_sales_customers') }}"
|
||||
target="_blank"
|
||||
class="btn btn-outline-secondary">
|
||||
<i class="fas fa-external-link-alt"></i>
|
||||
In Bestellverwaltung suchen
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">
|
||||
<i class="fas fa-times"></i> Abbrechen
|
||||
</button>
|
||||
</div>
|
||||
306
resources/views/admin/dhl/modal_in_shipment_info.blade.php
Normal file
306
resources/views/admin/dhl/modal_in_shipment_info.blade.php
Normal file
|
|
@ -0,0 +1,306 @@
|
|||
{{-- Shipment Information Display when shipments already exist --}}
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
{{-- Left Column: Order Info --}}
|
||||
<div class="col-md-6">
|
||||
<h6 class="text-primary mb-3">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
Bestellinformationen
|
||||
</h6>
|
||||
|
||||
<div class="card bg-light">
|
||||
<div class="card-body">
|
||||
<h6 class="card-title">Bestellung #{{ $order->id }}</h6>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<small class="text-muted d-block">Kunde:</small>
|
||||
<strong>{{ $order->shopping_user->billing_firstname ?? '' }}
|
||||
{{ $order->shopping_user->billing_lastname ?? '' }}</strong>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<small class="text-muted d-block">Datum:</small>
|
||||
<strong>{{ $order->created_at->format('d.m.Y') }}</strong>
|
||||
</div>
|
||||
<div class="col-6 mt-2">
|
||||
<small class="text-muted d-block">Wert:</small>
|
||||
<strong>{{ number_format($order->total, 2, ',', '.') }} €</strong>
|
||||
</div>
|
||||
<div class="col-6 mt-2">
|
||||
<small class="text-muted d-block">Artikel:</small>
|
||||
<strong>{{ $order->shopping_order_items->count() }} Stück</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Right Column: Shipment Summary --}}
|
||||
<div class="col-md-6">
|
||||
<h6 class="text-primary mb-3">
|
||||
<i class="fas fa-shipping-fast"></i>
|
||||
Sendungsübersicht
|
||||
</h6>
|
||||
|
||||
<div class="card bg-light">
|
||||
<div class="card-body">
|
||||
<div class="text-center mb-3">
|
||||
<i class="fas fa-box fa-2x text-success"></i>
|
||||
<h5 class="mt-2">{{ count($existingShipments) }} Sendung(en) erstellt</h5>
|
||||
</div>
|
||||
|
||||
<div class="row text-center">
|
||||
<div class="col-6">
|
||||
<small class="text-muted d-block">Letzte Sendung:</small>
|
||||
<strong>{{ date('d.m.Y H:i', strtotime($existingShipments[0]['created_at'])) }}</strong>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<small class="text-muted d-block">Status:</small>
|
||||
<span class="badge badge-{{ $existingShipments[0]['status'] == 'created' ? 'success' : 'warning' }}">
|
||||
{{ $existingShipments[0]['status_translated'] }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
{{-- Shipment Details --}}
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h6 class="text-primary mb-3">
|
||||
<i class="fas fa-list"></i>
|
||||
Sendungsdetails
|
||||
</h6>
|
||||
|
||||
@foreach($existingShipments as $index => $shipment)
|
||||
<div class="card mb-3 {{ $shipment['type'] == 'outbound' ? 'border-primary' : 'border-info' }}">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="d-flex justify-content-between align-items-start mb-2">
|
||||
<h6 class="mb-0">
|
||||
@if($shipment['type'] == 'outbound')
|
||||
<i class="fas fa-arrow-right text-primary"></i>
|
||||
Ausgehende Sendung
|
||||
@else
|
||||
<i class="fas fa-undo text-info"></i>
|
||||
Retoure
|
||||
@endif
|
||||
@if($index === 0)
|
||||
<span class="badge badge-primary ml-2">Neueste</span>
|
||||
@endif
|
||||
</h6>
|
||||
<span class="badge badge-{{ $shipment['status'] == 'created' ? 'success' : 'warning' }}">
|
||||
{{ $shipment['status_translated'] }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<small class="text-muted d-block">Sendungsnummer:</small>
|
||||
@if($shipment['shipment_number'])
|
||||
<code class="text-success">{{ $shipment['shipment_number'] }}</code>
|
||||
@else
|
||||
<span class="text-muted">Nicht verfügbar</span>
|
||||
@endif
|
||||
</div>
|
||||
{{--
|
||||
<div class="col-sm-6">
|
||||
<small class="text-muted d-block">Tracking-Nummer:</small>
|
||||
@if($shipment['tracking_number'])
|
||||
<code class="text-info">{{ $shipment['tracking_number'] }}</code>
|
||||
@else
|
||||
<span class="text-muted">Nicht verfügbar</span>
|
||||
@endif
|
||||
</div>
|
||||
--}}
|
||||
<div class="col-sm-6 mt-2">
|
||||
<small class="text-muted d-block">Produktcode:</small>
|
||||
<code>{{ $shipment['product_code'] }}</code>
|
||||
</div>
|
||||
<div class="col-sm-6 mt-2">
|
||||
<small class="text-muted d-block">Gewicht:</small>
|
||||
<strong>{{ number_format($shipment['weight'], 2) }} kg</strong>
|
||||
</div>
|
||||
<div class="col-sm-6 mt-2">
|
||||
<small class="text-muted d-block">Erstellt:</small>
|
||||
<strong>{{ date('d.m.Y H:i', strtotime($shipment['created_at'])) }}</strong>
|
||||
</div>
|
||||
@if($shipment['tracking_status'])
|
||||
<div class="col-sm-6 mt-2">
|
||||
<small class="text-muted d-block">Tracking-Status:</small>
|
||||
<span class="badge badge-info">{{ $shipment['tracking_status_translated'] }}</span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 text-right">
|
||||
<div class="btn-group-vertical w-100">
|
||||
@if($shipment['label_path'])
|
||||
<a href="{{ route('admin.dhl.download-label', $shipment['id']) }}"
|
||||
class="btn btn-success btn-sm mb-2">
|
||||
<i class="fas fa-download"></i> Label herunterladen
|
||||
</a>
|
||||
@endif
|
||||
|
||||
<a href="{{ route('admin.dhl.show', $shipment['id']) }}"
|
||||
class="btn btn-outline-primary btn-sm mb-2" target="_blank">
|
||||
<i class="fas fa-eye"></i> Details anzeigen
|
||||
</a>
|
||||
{{-- Todo: Add tracking button
|
||||
@if($shipment['can_cancel'])
|
||||
<button type="button"
|
||||
class="btn btn-outline-warning btn-sm mb-2"
|
||||
onclick="cancelShipment({{ $shipment['id'] }})">
|
||||
<i class="fas fa-ban"></i> Stornieren
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@if($shipment['type'] == 'outbound' && !$shipment['is_delivered'])
|
||||
<button type="button"
|
||||
class="btn btn-outline-info btn-sm"
|
||||
onclick="createReturnLabel({{ $shipment['id'] }})">
|
||||
<i class="fas fa-undo"></i> Retoure erstellen
|
||||
</button>
|
||||
@endif
|
||||
--}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Action Buttons --}}
|
||||
<div class="row mt-4">
|
||||
<div class="col-12 text-center">
|
||||
<div class="alert alert-info">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
<strong>Hinweis:</strong> Für diese Bestellung wurden bereits DHL-Sendungen erstellt.
|
||||
Sie können weitere Sendungen erstellen oder bestehende verwalten.
|
||||
</div>
|
||||
|
||||
<button type="button"
|
||||
class="btn btn-primary mr-2"
|
||||
onclick="createAdditionalShipment()">
|
||||
<i class="fas fa-plus"></i> Weitere Sendung erstellen
|
||||
</button>
|
||||
|
||||
<a href="{{ route('admin.dhl.cockpit') }}"
|
||||
class="btn btn-outline-secondary">
|
||||
<i class="fas fa-list"></i> Zum DHL-Cockpit
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">
|
||||
<i class="fas fa-times"></i> Schließen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function cancelShipment(shipmentId) {
|
||||
if (!confirm('Möchten Sie diese Sendung wirklich stornieren?\n\nDieser Vorgang kann nicht rückgängig gemacht werden.')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: `/admin/dhl/shipment/${shipmentId}/cancel`,
|
||||
method: 'DELETE',
|
||||
data: {
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showAlert('success', response.message);
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 2000);
|
||||
} else {
|
||||
showAlert('error', response.message);
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
showAlert('error', 'Fehler beim Stornieren der Sendung.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createReturnLabel(shipmentId) {
|
||||
if (!confirm('Möchten Sie ein Retourenlabel für diese Sendung erstellen?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: `/admin/dhl/shipment/${shipmentId}/return-label`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showAlert('success', response.message);
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 2000);
|
||||
} else {
|
||||
showAlert('error', response.message);
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
showAlert('error', 'Fehler beim Erstellen des Retourenlabels.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createAdditionalShipment() {
|
||||
// Reload modal in create mode
|
||||
$.post('{{ route('modal_load') }}', {
|
||||
action: 'create-dhl-shipment',
|
||||
id: {{ $order->id }},
|
||||
force_create: true,
|
||||
_token: '{{ csrf_token() }}'
|
||||
}).done(function(response) {
|
||||
$('#modals-load-content .modal-dialog').html(response.html);
|
||||
}).fail(function() {
|
||||
alert('Fehler beim Laden des Erstellungsformulars.');
|
||||
});
|
||||
}
|
||||
|
||||
window.showAlert = function(type, message) {
|
||||
var alertClass = type === 'success' ? 'alert-success' : 'alert-danger';
|
||||
var iconClass = type === 'success' ? 'fas fa-check-circle' : 'fas fa-exclamation-circle';
|
||||
|
||||
var alertHtml = `
|
||||
<div class="alert ${alertClass} alert-dismissible fade show" role="alert">
|
||||
<i class="${iconClass}"></i>
|
||||
${message}
|
||||
<button type="button" class="close" data-dismiss="alert">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
$('.modal-body').prepend(alertHtml);
|
||||
|
||||
// Auto-hide success alerts after 5 seconds
|
||||
if (type === 'success') {
|
||||
setTimeout(function() {
|
||||
$('.alert-success').alert('close');
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize modal
|
||||
$(document).ready(function() {
|
||||
// Modal is ready for interaction
|
||||
});
|
||||
</script>
|
||||
|
|
@ -36,37 +36,37 @@
|
|||
@switch($shipment->status)
|
||||
@case('pending')
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
||||
<span class="badge badge-warning">Wartend</span>
|
||||
<span class="badge badge-warning">{{ __('dhl.status.pending') }}</span>
|
||||
</div>
|
||||
@break
|
||||
@case('created')
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
||||
<span class="badge badge-success">Erstellt</span>
|
||||
<span class="badge badge-success">{{ __('dhl.status.created') }}</span>
|
||||
</div>
|
||||
@break
|
||||
@case('shipped')
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
||||
<span class="badge badge-primary">Versendet</span>
|
||||
<span class="badge badge-primary">{{ __('dhl.status.shipped') }}</span>
|
||||
</div>
|
||||
@break
|
||||
@case('delivered')
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
||||
<span class="badge badge-info">Zugestellt</span>
|
||||
<span class="badge badge-info">{{ __('dhl.status.delivered') }}</span>
|
||||
</div>
|
||||
@break
|
||||
@case('cancelled')
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
||||
<span class="badge badge-secondary">Storniert</span>
|
||||
<span class="badge badge-secondary">{{ __('dhl.status.cancelled') }}</span>
|
||||
</div>
|
||||
@break
|
||||
@case('failed')
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
||||
<span class="badge badge-danger">Fehler</span>
|
||||
<span class="badge badge-danger">{{ __('dhl.status.failed') }}</span>
|
||||
</div>
|
||||
@break
|
||||
@default
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
||||
<span class="badge badge-light">{{ $shipment->status }}</span>
|
||||
<span class="badge badge-light">{{ $shipment->getStatusTranslation() }}</span>
|
||||
</div>
|
||||
@endswitch
|
||||
</div>
|
||||
|
|
@ -85,8 +85,8 @@
|
|||
<div>
|
||||
<div class="text-xs font-weight-bold text-success text-uppercase mb-1">Sendungsnummer</div>
|
||||
<div class="h6 mb-0 font-weight-bold text-gray-800">
|
||||
@if($shipment->shipment_number)
|
||||
<code class="text-success">{{ $shipment->shipment_number }}</code>
|
||||
@if($shipment->dhl_shipment_no)
|
||||
<code class="text-success">{{ $shipment->dhl_shipment_no }}</code>
|
||||
@else
|
||||
<span class="text-muted">Nicht verfügbar</span>
|
||||
@endif
|
||||
|
|
@ -105,12 +105,12 @@
|
|||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">Tracking-Nummer</div>
|
||||
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">Tracking</div>
|
||||
<div class="h6 mb-0 font-weight-bold text-gray-800">
|
||||
@if($shipment->tracking_number)
|
||||
<code class="text-info">{{ $shipment->tracking_number }}</code>
|
||||
@if(false)
|
||||
<code class="text-info">{{ $shipment->dhl_shipment_no }}</code>
|
||||
<br>
|
||||
<a href="{{ route('public.tracking') }}?tracking_number={{ $shipment->tracking_number }}"
|
||||
<a href="{{ route('public.tracking') }}?dhl_shipment_no={{ $shipment->dhl_shipment_no }}"
|
||||
target="_blank" class="text-muted small">
|
||||
<i class="fas fa-external-link-alt"></i> Verfolgen
|
||||
</a>
|
||||
|
|
@ -134,7 +134,7 @@
|
|||
<div>
|
||||
<div class="text-xs font-weight-bold text-warning text-uppercase mb-1">Gewicht</div>
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
||||
{{ number_format($shipment->weight, 2) }} kg
|
||||
{{ number_format($shipment->weight_kg, 2, ',', '.') }} kg
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
|
|
@ -157,7 +157,7 @@
|
|||
<i class="fas fa-download"></i> Label herunterladen
|
||||
</a>
|
||||
@endif
|
||||
|
||||
{{-- Todo: Add tracking button
|
||||
@if($shipment->canCancel())
|
||||
<button type="button"
|
||||
class="btn btn-warning mr-2"
|
||||
|
|
@ -175,8 +175,8 @@
|
|||
<i class="fas fa-undo"></i> Retourenlabel erstellen
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@if($shipment->tracking_number)
|
||||
--}}
|
||||
@if($shipment->dhl_shipment_no)
|
||||
<button type="button"
|
||||
class="btn btn-secondary mr-2"
|
||||
id="update-tracking-btn"
|
||||
|
|
@ -209,16 +209,49 @@
|
|||
<td class="font-weight-semibold">ID:</td>
|
||||
<td>#{{ $shipment->id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-weight-semibold">DHL Sendungsnummer:</td>
|
||||
<td>
|
||||
@if($shipment->dhl_shipment_no)
|
||||
<code class="text-success">{{ $shipment->dhl_shipment_no }}</code>
|
||||
@else
|
||||
<span class="text-muted">Nicht verfügbar</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
{{--
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Routing-Code:</td>
|
||||
<td>
|
||||
@if($shipment->routing_code)
|
||||
<code class="text-info">{{ $shipment->routing_code }}</code>
|
||||
@else
|
||||
<span class="text-muted">Nicht verfügbar</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
--}}
|
||||
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Rechnungsnummer:</td>
|
||||
<td>
|
||||
@if($shipment->billing_number)
|
||||
<code class="text-dark">{{ $shipment->billing_number }}</code>
|
||||
@else
|
||||
<span class="text-muted">Nicht verfügbar</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Typ:</td>
|
||||
<td>
|
||||
@if($shipment->type == 'outbound')
|
||||
<span class="badge badge-primary">
|
||||
<i class="fas fa-arrow-right"></i> Ausgehend
|
||||
<i class="fas fa-arrow-right"></i> {{ __('dhl.type.outbound') }}
|
||||
</span>
|
||||
@else
|
||||
<span class="badge badge-info">
|
||||
<i class="fas fa-undo"></i> Retoure
|
||||
<i class="fas fa-undo"></i> {{ __('dhl.type.return') }}
|
||||
</span>
|
||||
@if($shipment->relatedShipment)
|
||||
<br>
|
||||
|
|
@ -233,23 +266,14 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Produktcode:</td>
|
||||
<td><code>{{ $shipment->product_code }}</code></td>
|
||||
<td class="font-weight-semibold">{{ __('dhl.fields.product_code') }}:</td>
|
||||
<td><code>{{ $shipment->product_code }}</code> - {{ $shipment->getProductCodeTranslation() }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Label-Format:</td>
|
||||
<td>{{ strtoupper($shipment->label_format) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Label gedruckt:</td>
|
||||
<td>
|
||||
@if($shipment->label_printed)
|
||||
<span class="badge badge-success">Ja</span>
|
||||
@else
|
||||
<span class="badge badge-secondary">Nein</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
|
|
@ -282,6 +306,124 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Recipient Information -->
|
||||
@if($shipment->firstname || $shipment->lastname || $shipment->company || $shipment->recipient)
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">
|
||||
<i class="fas fa-user text-warning"></i>
|
||||
Empfängerinformationen
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<table class="table table-sm">
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Name:</td>
|
||||
<td>
|
||||
@if($shipment->firstname || $shipment->lastname)
|
||||
{{ $shipment->firstname }} {{ $shipment->lastname }}
|
||||
@elseif($shipment->recipient && isset($shipment->recipient['firstname']))
|
||||
{{ $shipment->recipient['firstname'] }} {{ $shipment->recipient['lastname'] }}
|
||||
@else
|
||||
<span class="text-muted">Nicht verfügbar</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@if($shipment->company)
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Firma:</td>
|
||||
<td>
|
||||
@if($shipment->company)
|
||||
{{ $shipment->company }}
|
||||
@elseif($shipment->recipient && isset($shipment->recipient['company']))
|
||||
{{ $shipment->recipient['company'] }}
|
||||
@else
|
||||
<span class="text-muted">-</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Straße:</td>
|
||||
<td>
|
||||
@if($shipment->recipient && isset($shipment->recipient['street']))
|
||||
{{ $shipment->recipient['street'] }}
|
||||
@if(isset($shipment->recipient['houseNumber']))
|
||||
{{ $shipment->recipient['houseNumber'] }}
|
||||
@endif
|
||||
@else
|
||||
<span class="text-muted">Nicht verfügbar</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-weight-semibold">PLZ:</td>
|
||||
<td>
|
||||
@if($shipment->recipient && isset($shipment->recipient['postalCode']))
|
||||
{{ $shipment->recipient['postalCode'] }}
|
||||
@else
|
||||
<span class="text-muted">Nicht verfügbar</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Stadt:</td>
|
||||
<td>
|
||||
@if($shipment->recipient && isset($shipment->recipient['city']))
|
||||
{{ $shipment->recipient['city'] }}
|
||||
@else
|
||||
<span class="text-muted">Nicht verfügbar</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<table class="table table-sm">
|
||||
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Land:</td>
|
||||
<td>
|
||||
@if($shipment->recipient && isset($shipment->recipient['country']))
|
||||
{{ $shipment->recipient['country'] }}
|
||||
@else
|
||||
<span class="text-muted">Nicht verfügbar</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-weight-semibold">E-Mail:</td>
|
||||
<td>
|
||||
@if($shipment->recipient && isset($shipment->recipient['email']))
|
||||
<a href="mailto:{{ $shipment->recipient['email'] }}" class="text-primary">
|
||||
{{ $shipment->recipient['email'] }}
|
||||
</a>
|
||||
@else
|
||||
<span class="text-muted">Nicht verfügbar</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Telefon:</td>
|
||||
<td>
|
||||
@if($shipment->recipient && isset($shipment->recipient['phone']))
|
||||
<a href="tel:{{ $shipment->recipient['phone'] }}" class="text-primary">
|
||||
{{ $shipment->recipient['phone'] }}
|
||||
</a>
|
||||
@else
|
||||
<span class="text-muted">Nicht verfügbar</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Order Information -->
|
||||
@if($shipment->shoppingOrder)
|
||||
<div class="card mb-4">
|
||||
|
|
@ -325,14 +467,12 @@
|
|||
<table class="table table-sm">
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Bestellwert:</td>
|
||||
<td><strong>{{ number_format($shipment->shoppingOrder->total, 2) }} €</strong></td>
|
||||
<td><strong>{{ number_format($shipment->shoppingOrder->total, 2, ',', '.') }} €</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-weight-semibold">Status:</td>
|
||||
<td>
|
||||
<span class="badge badge-{{ $shipment->shoppingOrder->status == 'completed' ? 'success' : 'warning' }}">
|
||||
{{ $shipment->shoppingOrder->status }}
|
||||
</span>
|
||||
<span class="badge badge-pill badge-{{ $shipment->shoppingOrder->getShippedColor() }}">{{ $shipment->shoppingOrder->getShippedType() }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -345,9 +485,15 @@
|
|||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Right Column -->
|
||||
<div class="col-lg-4">
|
||||
|
||||
|
||||
<!-- Tracking Information -->
|
||||
@if($shipment->tracking_status || $shipment->tracking_number)
|
||||
@if($shipment->tracking_status || $shipment->dhl_shipment_no)
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">
|
||||
|
|
@ -370,30 +516,29 @@
|
|||
</div>
|
||||
@endif
|
||||
|
||||
@if($shipment->tracking_number)
|
||||
@if($shipment->dhl_shipment_no)
|
||||
<div class="text-center">
|
||||
<p>Verfolgen Sie diese Sendung direkt bei DHL:</p>
|
||||
<a href="https://www.dhl.de/de/privatkunden/pakete-empfangen/verfolgen.html?lang=de&idc={{ $shipment->tracking_number }}"
|
||||
<a href="https://www.dhl.de/de/privatkunden/pakete-empfangen/verfolgen.html?lang=de&idc={{ $shipment->dhl_shipment_no }}"
|
||||
target="_blank"
|
||||
class="btn btn-outline-warning">
|
||||
class="btn btn-warning">
|
||||
<i class="fas fa-external-link-alt"></i>
|
||||
Bei DHL verfolgen
|
||||
</a>
|
||||
<a href="{{ route('public.tracking') }}?tracking_number={{ $shipment->tracking_number }}"
|
||||
{{-- TODO: Tracking-Nummer ist nicht mehr verfügbar
|
||||
<a href="{{ route('public.tracking') }}?tracking_number={{ $shipment->dhl_shipment_no }}"
|
||||
target="_blank"
|
||||
class="btn btn-outline-info ml-2">
|
||||
<i class="fas fa-search"></i>
|
||||
Lokales Tracking
|
||||
</a>
|
||||
--}}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- Right Column -->
|
||||
<div class="col-lg-4">
|
||||
|
||||
<!-- Related Shipments -->
|
||||
@if($shipment->type == 'outbound' && $shipment->relatedShipments && $shipment->relatedShipments->count() > 0)
|
||||
<div class="card mb-4">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue