929 lines
No EOL
44 KiB
PHP
929 lines
No EOL
44 KiB
PHP
@extends('layouts.layout-2')
|
||
|
||
@section('content')
|
||
|
||
<div class="d-flex justify-content-between align-items-center py-2 mb-4">
|
||
<h4 class="font-weight-bold mb-0">
|
||
<i class="fas fa-box {{ $shipment->type == 'return' ? 'text-warning' : 'text-primary' }}"></i>
|
||
DHL Sendung #{{ $shipment->id }}
|
||
@if($shipment->type == 'return')
|
||
<span class="badge badge-warning ml-2" style="font-size: 1rem; font-weight: 700; padding: 0.5rem 1rem;">
|
||
<i class="fas fa-undo"></i> RETOURE
|
||
</span>
|
||
@endif
|
||
</h4>
|
||
<div>
|
||
<a href="{{ route('admin.dhl.cockpit') }}" class="btn btn-outline-secondary">
|
||
<i class="fas fa-arrow-left"></i> Zurück zum Cockpit
|
||
</a>
|
||
@if($shipment->shoppingOrder)
|
||
<a href="{{ route('admin_sales_customers_detail', $shipment->shoppingOrder->id) }}"
|
||
class="btn btn-outline-primary ml-2">
|
||
<i class="fas fa-shopping-cart"></i> Bestellung anzeigen
|
||
</a>
|
||
@endif
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Status & Key Info Row -->
|
||
<div class="row mb-4">
|
||
<div class="col-xl-3 col-md-6 mb-3">
|
||
<div class="card border-left-primary">
|
||
<div class="card-body">
|
||
<div class="d-flex justify-content-between">
|
||
<div>
|
||
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Status</div>
|
||
@switch($shipment->status)
|
||
@case('pending')
|
||
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
||
<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">{{ __('dhl.status.created') }}</span>
|
||
</div>
|
||
@break
|
||
@case('shipped')
|
||
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
||
<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">{{ __('dhl.status.delivered') }}</span>
|
||
</div>
|
||
@break
|
||
@case('canceled')
|
||
@case('cancelled')
|
||
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
||
<span class="badge badge-secondary">{{ __('dhl.status.canceled') }}</span>
|
||
</div>
|
||
@break
|
||
@case('failed')
|
||
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
||
<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->getStatusTranslation() }}</span>
|
||
</div>
|
||
@endswitch
|
||
</div>
|
||
<div class="col-auto">
|
||
<i class="fas fa-flag fa-2x text-gray-300"></i>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-xl-3 col-md-6 mb-3">
|
||
<div class="card border-left-success">
|
||
<div class="card-body">
|
||
<div class="d-flex justify-content-between">
|
||
<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->dhl_shipment_no)
|
||
<code class="text-success">{{ $shipment->dhl_shipment_no }}</code>
|
||
@else
|
||
<span class="text-muted">Nicht verfügbar</span>
|
||
@endif
|
||
</div>
|
||
</div>
|
||
<div class="col-auto">
|
||
<i class="fas fa-hashtag fa-2x text-gray-300"></i>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-xl-3 col-md-6 mb-3">
|
||
<div class="card border-left-info">
|
||
<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</div>
|
||
<div class="h6 mb-0 font-weight-bold text-gray-800">
|
||
@if(false)
|
||
<code class="text-info">{{ $shipment->dhl_shipment_no }}</code>
|
||
<br>
|
||
<a href="{{ route('public.tracking') }}?tracking_number={{ $shipment->dhl_shipment_no }}"
|
||
target="_blank" class="text-muted small">
|
||
<i class="fas fa-external-link-alt"></i> Verfolgen
|
||
</a>
|
||
@else
|
||
<span class="text-muted">Nicht verfügbar</span>
|
||
@endif
|
||
</div>
|
||
</div>
|
||
<div class="col-auto">
|
||
<i class="fas fa-search fa-2x text-gray-300"></i>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-xl-3 col-md-6 mb-3">
|
||
<div class="card border-left-warning">
|
||
<div class="card-body">
|
||
<div class="d-flex justify-content-between">
|
||
<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_kg, 2, ',', '.') }} kg
|
||
</div>
|
||
</div>
|
||
<div class="col-auto">
|
||
<i class="fas fa-weight fa-2x text-gray-300"></i>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Action Buttons -->
|
||
@if(!in_array($shipment->status, ['canceled', 'cancelled']))
|
||
<div class="card mb-4">
|
||
<div class="card-body">
|
||
<div class="d-flex flex-wrap gap-2">
|
||
@if($shipment->label_path)
|
||
<a href="{{ route('admin.dhl.download-label', $shipment) }}"
|
||
class="btn btn-success mr-2">
|
||
<i class="fas fa-download"></i> Label herunterladen
|
||
</a>
|
||
@endif
|
||
|
||
@if($shipment->type == 'outbound' && !$shipment->returns->count())
|
||
<button type="button"
|
||
class="btn btn-info mr-2"
|
||
id="create-return-btn"
|
||
data-shipment-id="{{ $shipment->id }}">
|
||
<i class="fas fa-undo"></i> Retourenlabel erstellen
|
||
</button>
|
||
@endif
|
||
@if($shipment->dhl_shipment_no)
|
||
<button type="button"
|
||
class="btn btn-secondary mr-2"
|
||
id="update-tracking-btn"
|
||
data-shipment-id="{{ $shipment->id }}">
|
||
<i class="fas fa-sync"></i> Tracking aktualisieren
|
||
</button>
|
||
|
||
@if($shipment->canSendTrackingEmail())
|
||
<button type="button"
|
||
class="btn {{ $shipment->wasTrackingEmailSent() ? 'btn-success' : 'btn-info' }} mr-2"
|
||
id="send-tracking-email-btn"
|
||
data-shipment-id="{{ $shipment->id }}">
|
||
<i class="fas fa-envelope"></i>
|
||
{{ $shipment->wasTrackingEmailSent() ? 'Tracking-E-Mail erneut senden' : 'Tracking-E-Mail senden' }}
|
||
</button>
|
||
@endif
|
||
@endif
|
||
</div>
|
||
</div>
|
||
</div>
|
||
@endif
|
||
|
||
<!-- Shipment Details -->
|
||
<div class="row">
|
||
<!-- Left Column -->
|
||
<div class="col-lg-8">
|
||
<!-- Shipment Information -->
|
||
<div class="card mb-4">
|
||
<div class="card-header">
|
||
<h5 class="mb-0">
|
||
<i class="fas fa-info-circle text-primary"></i>
|
||
Sendungsinformationen
|
||
</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">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">Referenz:</td>
|
||
<td>
|
||
@if($shipment->reference)
|
||
<code class="text-dark">{{ $shipment->reference }}</code>
|
||
@else
|
||
<span class="text-muted">Nicht gesetzt</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> {{ __('dhl.type.outbound') }}
|
||
</span>
|
||
@else
|
||
<span class="badge badge-info">
|
||
<i class="fas fa-undo"></i> {{ __('dhl.type.return') }}
|
||
</span>
|
||
@if($shipment->relatedShipment)
|
||
<br>
|
||
<small class="text-muted">
|
||
Bezieht sich auf Sendung
|
||
<a href="{{ route('admin.dhl.show', $shipment->relatedShipment) }}">
|
||
#{{ $shipment->relatedShipment->id }}
|
||
</a>
|
||
</small>
|
||
@endif
|
||
@endif
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<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>
|
||
|
||
</table>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<table class="table table-sm">
|
||
<tr>
|
||
<td class="font-weight-semibold">Erstellt:</td>
|
||
<td>{{ $shipment->created_at->format('d.m.Y H:i:s') }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="font-weight-semibold">Letzte Änderung:</td>
|
||
<td>{{ $shipment->updated_at->format('d.m.Y H:i:s') }}</td>
|
||
</tr>
|
||
@if($shipment->last_tracked_at)
|
||
<tr>
|
||
<td class="font-weight-semibold">Letztes Tracking:</td>
|
||
<td>{{ $shipment->last_tracked_at->format('d.m.Y H:i:s') }}</td>
|
||
</tr>
|
||
@endif
|
||
@if($shipment->length || $shipment->width || $shipment->height)
|
||
<tr>
|
||
<td class="font-weight-semibold">Abmessungen:</td>
|
||
<td>
|
||
{{ $shipment->length }}×{{ $shipment->width }}×{{ $shipment->height }} cm
|
||
</td>
|
||
</tr>
|
||
@endif
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</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
|
||
@if($shipment->recipient && isset($shipment->recipient['postnumber']))
|
||
<tr>
|
||
<td class="font-weight-semibold">Postnummer:</td>
|
||
<td>
|
||
{{ $shipment->recipient['postnumber'] }}
|
||
</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">
|
||
<div class="card-header">
|
||
<h5 class="mb-0">
|
||
<i class="fas fa-shopping-cart text-success"></i>
|
||
Bestellinformationen
|
||
</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">Bestellungs-ID:</td>
|
||
<td>
|
||
<a href="{{ route('admin_sales_customers_detail', $shipment->shoppingOrder->id) }}" class="text-primary">
|
||
#{{ $shipment->shoppingOrder->id }}
|
||
</a>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="font-weight-semibold">Kunde:</td>
|
||
<td>
|
||
@if($shipment->shoppingOrder->shopping_user)
|
||
{{ $shipment->shoppingOrder->shopping_user->billing_firstname }} {{ $shipment->shoppingOrder->shopping_user->billing_lastname }}
|
||
<br>
|
||
<small class="text-muted">{{ $shipment->shoppingOrder->shopping_user->billing_email }}</small>
|
||
@else
|
||
<span class="text-muted">Unbekannt</span>
|
||
@endif
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="font-weight-semibold">Bestelldatum:</td>
|
||
<td>{{ $shipment->shoppingOrder->created_at->format('d.m.Y H:i') }}</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<table class="table table-sm">
|
||
<tr>
|
||
<td class="font-weight-semibold">Bestellwert:</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-pill badge-{{ $shipment->shoppingOrder->getShippedColor() }}">{{ $shipment->shoppingOrder->getShippedType() }}</span>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="font-weight-semibold">Artikel:</td>
|
||
<td>{{ $shipment->shoppingOrder->shopping_order_items->count() ?? 0 }} Artikel</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
@endif
|
||
|
||
</div>
|
||
|
||
<!-- Right Column -->
|
||
<div class="col-lg-4">
|
||
|
||
|
||
<!-- Email Status -->
|
||
@if($shipment->dhl_shipment_no)
|
||
<div class="card mb-4">
|
||
<div class="card-header">
|
||
<h5 class="mb-0">
|
||
<i class="fas fa-envelope text-{{ $shipment->wasTrackingEmailSent() ? 'success' : 'secondary' }}"></i>
|
||
Tracking-E-Mail Status
|
||
</h5>
|
||
</div>
|
||
<div class="card-body">
|
||
@if($shipment->wasTrackingEmailSent())
|
||
<div class="alert alert-success">
|
||
<i class="fas fa-check-circle"></i>
|
||
<strong>Zuletzt gesendet</strong><br>
|
||
<small>
|
||
Am {{ $shipment->tracking_email_sent_at->format('d.m.Y \u\m H:i') }} Uhr
|
||
({{ $shipment->tracking_email_type === 'auto' ? 'automatisch' : 'manuell' }})
|
||
</small>
|
||
</div>
|
||
|
||
@php($trackingEmailHistory = $shipment->getTrackingEmailHistory())
|
||
@if(!empty($trackingEmailHistory))
|
||
<div class="table-responsive">
|
||
<table class="table table-sm mb-0">
|
||
<thead>
|
||
<tr>
|
||
<th>Zeitpunkt</th>
|
||
<th>Typ</th>
|
||
<th>Status</th>
|
||
<th>Empfänger</th>
|
||
<th>Sendungen</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
@foreach($trackingEmailHistory as $entry)
|
||
<tr>
|
||
<td>
|
||
@if(!empty($entry['sent_at']))
|
||
{{ \Carbon\Carbon::parse($entry['sent_at'])->format('d.m.Y H:i') }}
|
||
@else
|
||
<span class="text-muted">-</span>
|
||
@endif
|
||
</td>
|
||
<td>
|
||
<span class="badge badge-{{ ($entry['type'] ?? '') === 'auto' ? 'info' : 'secondary' }}">
|
||
{{ ($entry['type'] ?? '') === 'auto' ? 'Automatisch' : 'Manuell' }}
|
||
</span>
|
||
</td>
|
||
<td>
|
||
<span class="badge badge-{{ \Acme\Dhl\Models\DhlShipment::getStatusBadgeClassFor($entry['status'] ?? 'unknown') }}">
|
||
{{ \Acme\Dhl\Models\DhlShipment::getStatusTranslationFor($entry['status'] ?? 'unknown') }}
|
||
</span>
|
||
@if(!empty($entry['tracking_status']))
|
||
<br><small class="text-muted">{{ $entry['tracking_status'] }}</small>
|
||
@endif
|
||
</td>
|
||
<td>
|
||
@if(!empty($entry['recipient_email']))
|
||
<small>{{ $entry['recipient_email'] }}</small>
|
||
@else
|
||
<span class="text-muted">-</span>
|
||
@endif
|
||
</td>
|
||
<td>
|
||
@if(!empty($entry['included_shipment_ids']))
|
||
<small>#{{ implode(', #', $entry['included_shipment_ids']) }}</small>
|
||
@else
|
||
<span class="text-muted">-</span>
|
||
@endif
|
||
</td>
|
||
</tr>
|
||
@endforeach
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
@endif
|
||
@else
|
||
<div class="alert alert-secondary mb-0">
|
||
<i class="fas fa-clock"></i>
|
||
<strong>Noch nicht gesendet</strong><br>
|
||
<small>
|
||
@if($shipment->canSendTrackingEmail())
|
||
Klicken Sie auf "Tracking-E-Mail senden" um den Kunden zu benachrichtigen.
|
||
@else
|
||
E-Mail kann nicht gesendet werden (keine Empfänger-E-Mail verfügbar).
|
||
@endif
|
||
</small>
|
||
</div>
|
||
@endif
|
||
</div>
|
||
</div>
|
||
@endif
|
||
|
||
<!-- Tracking Information -->
|
||
@if($shipment->tracking_status || $shipment->dhl_shipment_no)
|
||
<div class="card mb-4">
|
||
<div class="card-header d-flex justify-content-between align-items-center">
|
||
<h5 class="mb-0">
|
||
<i class="fas fa-route text-info"></i>
|
||
Tracking-Informationen
|
||
</h5>
|
||
@if($shipment->dhl_shipment_no)
|
||
<a href="https://www.dhl.de/de/privatkunden/pakete-empfangen/verfolgen.html?lang=de&idc={{ $shipment->dhl_shipment_no }}"
|
||
target="_blank"
|
||
class="btn btn-sm btn-warning">
|
||
<i class="fas fa-external-link-alt"></i>
|
||
Bei DHL verfolgen
|
||
</a>
|
||
@endif
|
||
</div>
|
||
<div class="card-body">
|
||
@if($shipment->tracking_status)
|
||
<div class="alert alert-info mb-4">
|
||
<h6 class="alert-heading mb-1">
|
||
<i class="fas fa-map-marker-alt"></i>
|
||
Aktueller Status: {{ $shipment->tracking_status }}
|
||
</h6>
|
||
@if($shipment->last_tracked_at)
|
||
<small class="text-muted">
|
||
Zuletzt aktualisiert: {{ $shipment->last_tracked_at->format('d.m.Y H:i') }}
|
||
</small>
|
||
@endif
|
||
</div>
|
||
@endif
|
||
|
||
{{-- Tracking Events Timeline --}}
|
||
@if($shipment->trackingEvents && $shipment->trackingEvents->count() > 0)
|
||
<div class="tracking-timeline">
|
||
@foreach($shipment->trackingEvents as $index => $event)
|
||
<div class="d-flex mb-3 {{ $index === 0 ? '' : 'text-muted' }}">
|
||
<div class="mr-3 text-center" style="min-width: 40px;">
|
||
@if($index === 0)
|
||
@if($event->status_code === 'delivered')
|
||
<i class="fas fa-check-circle fa-lg text-success"></i>
|
||
@elseif($event->status_code === 'transit')
|
||
<i class="fas fa-truck fa-lg text-primary"></i>
|
||
@elseif($event->status_code === 'out-for-delivery')
|
||
<i class="fas fa-shipping-fast fa-lg text-warning"></i>
|
||
@elseif($event->status_code === 'failure' || $event->status_code === 'exception')
|
||
<i class="fas fa-exclamation-circle fa-lg text-danger"></i>
|
||
@elseif($event->status_code === 'returned')
|
||
<i class="fas fa-undo fa-lg text-secondary"></i>
|
||
@else
|
||
<i class="fas fa-circle fa-lg text-info"></i>
|
||
@endif
|
||
@else
|
||
<i class="fas fa-circle text-muted" style="font-size: 0.6rem; margin-top: 6px;"></i>
|
||
@endif
|
||
</div>
|
||
<div class="flex-grow-1">
|
||
<div class="{{ $index === 0 ? 'font-weight-bold' : '' }}">
|
||
{{ $event->status_text }}
|
||
</div>
|
||
<small class="text-muted">
|
||
{{ $event->event_time->format('d.m.Y H:i') }} Uhr
|
||
@if($event->location)
|
||
· {{ $event->location }}
|
||
@endif
|
||
</small>
|
||
</div>
|
||
</div>
|
||
@if(!$loop->last)
|
||
<div class="ml-3 border-left" style="height: 8px; margin-left: 19px;"></div>
|
||
@endif
|
||
@endforeach
|
||
</div>
|
||
@elseif(!$shipment->tracking_status)
|
||
<div class="text-center text-muted py-3">
|
||
<i class="fas fa-info-circle"></i>
|
||
Noch keine Tracking-Daten vorhanden. Klicken Sie auf "Tracking aktualisieren" um die Daten abzurufen.
|
||
</div>
|
||
@endif
|
||
</div>
|
||
</div>
|
||
@endif
|
||
|
||
<!-- Related Shipments -->
|
||
@if($shipment->type == 'outbound' && $shipment->relatedShipments && $shipment->relatedShipments->count() > 0)
|
||
<div class="card mb-4">
|
||
<div class="card-header">
|
||
<h5 class="mb-0">
|
||
<i class="fas fa-link text-warning"></i>
|
||
Verknüpfte Retouren
|
||
</h5>
|
||
</div>
|
||
<div class="card-body">
|
||
@foreach($shipment->relatedShipments as $relatedShipment)
|
||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||
<div>
|
||
<a href="{{ route('admin.dhl.show', $relatedShipment) }}" class="text-primary">
|
||
Retoure #{{ $relatedShipment->id }}
|
||
</a>
|
||
<br>
|
||
<small class="text-muted">{{ $relatedShipment->created_at->format('d.m.Y H:i') }}</small>
|
||
</div>
|
||
<span class="badge badge-{{ $relatedShipment->status == 'created' ? 'success' : 'warning' }}">
|
||
{{ $relatedShipment->status }}
|
||
</span>
|
||
</div>
|
||
@endforeach
|
||
</div>
|
||
</div>
|
||
@endif
|
||
|
||
<!-- Additional Services -->
|
||
@if($shipment->services)
|
||
<div class="card mb-4">
|
||
<div class="card-header">
|
||
<h5 class="mb-0">
|
||
<i class="fas fa-plus-circle text-success"></i>
|
||
Zusatzleistungen
|
||
</h5>
|
||
</div>
|
||
<div class="card-body">
|
||
@foreach($shipment->services as $service => $enabled)
|
||
@if($enabled)
|
||
<div class="badge badge-success mr-1 mb-1">{{ $service }}</div>
|
||
@endif
|
||
@endforeach
|
||
</div>
|
||
</div>
|
||
@endif
|
||
|
||
<!-- API Response Data -->
|
||
@if($shipment->api_response_data && auth()->user()->isSuperAdmin())
|
||
<div class="card">
|
||
<div class="card-header">
|
||
<h5 class="mb-0">
|
||
<i class="fas fa-code text-muted"></i>
|
||
API Response (Debug)
|
||
</h5>
|
||
</div>
|
||
<div class="card-body">
|
||
<pre class="small text-muted" style="max-height: 300px; overflow-y: auto;">{{ json_encode($shipment->api_response_data, JSON_PRETTY_PRINT) }}</pre>
|
||
</div>
|
||
</div>
|
||
@endif
|
||
</div>
|
||
</div>
|
||
|
||
@endsection
|
||
|
||
@section('scripts')
|
||
<script>
|
||
$(document).ready(function() {
|
||
// Cancel shipment
|
||
$('#cancel-shipment-btn').click(function() {
|
||
var shipmentId = $(this).data('shipment-id');
|
||
|
||
if (!confirm('Möchten Sie diese Sendung wirklich stornieren?\n\nDieser Vorgang kann nicht rückgängig gemacht werden.')) {
|
||
return;
|
||
}
|
||
|
||
var btn = $(this);
|
||
btn.prop('disabled', true).html('<i class="fas fa-spinner fa-spin"></i> Wird storniert...');
|
||
|
||
$.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);
|
||
resetButton(btn, '<i class="fas fa-ban"></i> Sendung stornieren');
|
||
}
|
||
},
|
||
error: function(xhr) {
|
||
showAlert('error', 'Fehler beim Stornieren der Sendung.');
|
||
resetButton(btn, '<i class="fas fa-ban"></i> Sendung stornieren');
|
||
}
|
||
});
|
||
});
|
||
|
||
// Create return label
|
||
$('#create-return-btn').click(function() {
|
||
var shipmentId = $(this).data('shipment-id');
|
||
|
||
if (!confirm('Möchten Sie ein Retourenlabel für diese Sendung erstellen?')) {
|
||
return;
|
||
}
|
||
|
||
var btn = $(this);
|
||
btn.prop('disabled', true).html('<i class="fas fa-spinner fa-spin"></i> Wird erstellt...');
|
||
|
||
$.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);
|
||
resetButton(btn, '<i class="fas fa-undo"></i> Retourenlabel erstellen');
|
||
}
|
||
},
|
||
error: function(xhr) {
|
||
showAlert('error', 'Fehler beim Erstellen des Retourenlabels.');
|
||
resetButton(btn, '<i class="fas fa-undo"></i> Retourenlabel erstellen');
|
||
}
|
||
});
|
||
});
|
||
|
||
// Update tracking
|
||
$('#update-tracking-btn').click(function() {
|
||
var shipmentId = $(this).data('shipment-id');
|
||
var btn = $(this);
|
||
|
||
btn.prop('disabled', true).html('<i class="fas fa-spinner fa-spin"></i> Wird aktualisiert...');
|
||
|
||
$.ajax({
|
||
url: `/admin/dhl/shipment/${shipmentId}/update-tracking`,
|
||
method: 'POST',
|
||
data: {
|
||
_token: '{{ csrf_token() }}'
|
||
},
|
||
success: function(response) {
|
||
if (response.success) {
|
||
showAlert('success', response.message);
|
||
setTimeout(function() {
|
||
location.reload();
|
||
}, 3000);
|
||
} else {
|
||
showAlert('error', response.message);
|
||
resetButton(btn, '<i class="fas fa-sync"></i> Tracking aktualisieren');
|
||
}
|
||
},
|
||
error: function(xhr) {
|
||
showAlert('error', 'Fehler beim Aktualisieren der Tracking-Informationen.');
|
||
resetButton(btn, '<i class="fas fa-sync"></i> Tracking aktualisieren');
|
||
}
|
||
});
|
||
});
|
||
|
||
// Send tracking email
|
||
$('#send-tracking-email-btn').click(function() {
|
||
var shipmentId = $(this).data('shipment-id');
|
||
var btn = $(this);
|
||
|
||
if (!confirm('Tracking-E-Mail an den Kunden senden?')) {
|
||
return;
|
||
}
|
||
|
||
btn.prop('disabled', true).html('<i class="fas fa-spinner fa-spin"></i> Wird gesendet...');
|
||
|
||
$.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);
|
||
setTimeout(function() {
|
||
location.reload();
|
||
}, 2000);
|
||
} else {
|
||
showAlert('error', response.message);
|
||
resetButton(btn, '<i class="fas fa-envelope"></i> Tracking-E-Mail senden');
|
||
}
|
||
},
|
||
error: function(xhr) {
|
||
var errorMsg = xhr.responseJSON ? xhr.responseJSON.message : 'Fehler beim Senden der Tracking-E-Mail.';
|
||
showAlert('error', errorMsg);
|
||
resetButton(btn, '<i class="fas fa-envelope"></i> Tracking-E-Mail senden');
|
||
}
|
||
});
|
||
});
|
||
|
||
// Helper functions
|
||
function resetButton(btn, originalText) {
|
||
btn.prop('disabled', false).html(originalText);
|
||
}
|
||
|
||
function showAlert(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>
|
||
`;
|
||
|
||
$('.py-2.mb-4').after(alertHtml);
|
||
|
||
// Scroll to top
|
||
$('html, body').animate({ scrollTop: 0 }, 500);
|
||
|
||
// Auto-hide success alerts after 5 seconds
|
||
if (type === 'success') {
|
||
setTimeout(function() {
|
||
$('.alert-success').alert('close');
|
||
}, 5000);
|
||
}
|
||
}
|
||
});
|
||
</script>
|
||
@endsection |