@extends('layouts.app') @section('title', 'Payment Details') @push('styles') @endpush @section('content')

💳 Payment Details

View shipment payment information

{{ $backText ?? 'Back to Dashboard' }}

Shipment Payment Details

@php $firstShipment = $allShipments->first(); $latestTrackingStatus = $payment->latestTrackingStatus; $currentDisplayStatus = $latestTrackingStatus ? $latestTrackingStatus->display_status : 'Unknown'; @endphp
Payment ID #{{ $payment->id }}
Tracking Number {{ $payment->tracking_number ?? 'N/A' }} @if($payment->additionalAmounts && $payment->additionalAmounts->count() > 0 || $payment->additionalServices && $payment->additionalServices->count() > 0) Additional Services @endif
Suite Number {{ $firstShipment ? $firstShipment->suite_number ?? 'N/A' : 'N/A' }}
Customer {{ $payment->kuser ? $payment->kuser->name : 'N/A' }}
Payment Amount {{ $payment->currency ?? 'USD' }}{{ number_format($payment->amount, 2) }}
Payment Status @if($payment->payment_status === 'paid' || $payment->payment_status === 'success' || $payment->payment_status === 'completed') {{ ucfirst($payment->payment_status) }} @elseif($payment->payment_status === 'failed') {{ ucfirst($payment->payment_status) }} @else {{ ucfirst($payment->payment_status ?? 'pending') }} @endif
Current Status {{ $currentDisplayStatus }}
Payment Date {{ $payment->paid_at ? $payment->paid_at->format('d M Y, h:i A') : ($payment->created_at ? $payment->created_at->format('d M Y, h:i A') : 'N/A') }}
Payment Method {{ ucfirst(str_replace('_', ' ', $payment->payment_method ?? 'N/A')) }}
Currency {{ $payment->currency ?? 'USD' }}
@if($allShipments && $allShipments->count() > 0)
Packages ({{ $allShipments->count() }}):
@foreach($allShipments as $index => $shipment) @endforeach
Package # Sender Item Name Item Description Declared Value (USD)
Package #{{ $index + 1 }} {{ $shipment->sender_name ?? '-' }} {{ $shipment->item_name ?? '-' }} {{ $shipment->item_description ?? '-' }} @if($shipment->declared_value) ${{ number_format($shipment->declared_value, 2) }} @else - @endif
@endif @php // Get services from both tables: // 1. Original payment services (from shipment_payment_services table) $originalServices = $payment->services ?? collect(); // 2. Additional charge services (from shipment_payment_additional_services table) $additionalServices = $payment->additionalServices ?? collect(); $hasAnyServices = $originalServices->count() > 0 || $additionalServices->count() > 0; @endphp @if($hasAnyServices)
Services (Original: {{ $originalServices->count() }}, Additional: {{ $additionalServices->count() }})
@if($originalServices->count() > 0)
Original Services:
@foreach($originalServices as $index => $service) @endforeach
# Service Name Service Type Amount
{{ $index + 1 }} {{ $service->service_name ?? 'N/A' }} {{ ucfirst(str_replace('_', ' ', $service->service_type ?? 'N/A')) }} {{ $payment->currency ?? 'USD' }}{{ number_format($service->service_amount ?? 0, 2) }}
@endif @if($additionalServices->count() > 0)
Additional Services:
@foreach($additionalServices as $index => $service) @endforeach
# Service Name Service Type Amount
{{ $index + 1 }} {{ $service->service_name ?? 'N/A' }} {{ ucfirst(str_replace('_', ' ', $service->service_type ?? 'N/A')) }} {{ $payment->currency ?? 'USD' }}{{ number_format($service->service_amount ?? 0, 2) }}
@endif
@endif @if($payment->trackingStatuses && $payment->trackingStatuses->count() > 0)
Tracking History:
@foreach($payment->trackingStatuses->sortBy('status_date') as $status) @endforeach
Status Description Date Location
{{ $status->display_status ?? $status->status }} {{ $status->description ?? '-' }} {{ $status->status_date ? $status->status_date->format('d M Y, h:i A') : '-' }} {{ $status->location ?? '-' }}
@endif
@endsection