update 20.10.2025
This commit is contained in:
parent
8c11130b5d
commit
a939cd51ef
616 changed files with 84821 additions and 4121 deletions
|
|
@ -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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue