@extends('admin.layouts.app') @section('page-title', 'Order Details') @section('content')
{{-- ===================================================== HEADER WITH CLOSE BUTTON ====================================================== --}}
Order #{{ $orderData['order_id'] }}
{{-- ===================================================== TABS NAVIGATION ====================================================== --}}
{{-- ===================================================== ORDER DETAILS TAB ====================================================== --}}
{{-- Order Summary --}}

{{ $orderData['order_id'] }}

{{ ucfirst($orderData['status']) }} {{ $order->created_at?->format('d-m-Y') }}
Total Orders
{{ $order->shipments->sum(function($shipment) { return $shipment->orders->count(); }) ?: 1 }}
Origin
{{ $order->origin ?? 'N/A' }}
Destination
{{ $order->destination ?? 'N/A' }}
Mark No
{{ $order->mark_no ?? 'N/A' }}
{{-- Order Items Table --}}
Order Items {{ count($orderData['items']) }} items
@if(count($orderData['items']) > 0) @foreach($orderData['items'] as $index => $item) @endforeach
# Description CTN QTY TTL/QTY Unit Price (₹) TTL Amount (₹) CBM TTL CBM KG TTL KG Shop No
{{ $index + 1 }} {{ $item->description }} {{ $item->ctn }} {{ $item->qty }} {{ $item->ttl_qty }} {{ $item->unit }} ₹{{ number_format($item->price ?? 0, 2) }} ₹{{ number_format($item->ttl_amount ?? 0, 2) }} {{ number_format($item->cbm ?? 0, 3) }} {{ number_format($item->ttl_cbm ?? 0, 3) }} {{ number_format($item->kg ?? 0, 3) }} {{ number_format($item->ttl_kg ?? 0, 3) }} {{ $item->shop_no ?? '-' }}
@else

No order items found.

@endif
{{-- Order Totals --}}
Total CTN
{{ $orderData['totals']['ctn'] }}
Total QTY
{{ $orderData['totals']['qty'] }}
Total TTL/QTY
{{ $orderData['totals']['ttl_qty'] }}
Total TTL KG
{{ number_format($orderData['totals']['ttl_kg'], 3) }}
Total Amount
₹{{ number_format($orderData['totals']['amount'], 2) }}
Total CBM
{{ number_format($orderData['totals']['cbm'], 3) }}
Total TTL CBM
{{ number_format($orderData['totals']['ttl_cbm'], 3) }}
Total KG
{{ number_format($orderData['totals']['kg'], 3) }}
{{-- ===================================================== SHIPMENT DETAILS TAB - CORRECTED ====================================================== --}}
@if(count($shipmentsData) > 0) @foreach($shipmentsData as $shipment)

{{ $shipment['shipment_id'] }}

Orders in Shipment
{{ $shipment['total_orders'] }}
{{ ucfirst($shipment['status']) }}
Shipment Date
@if($shipment['date']) {{ \Carbon\Carbon::parse($shipment['date'])->format('d-m-Y') }} @else N/A @endif
Orders in Shipment
{{ $shipment['total_orders'] }}
Total CTN
{{ $shipment['totals']['ctn'] }}
Total Amount
₹{{ number_format($shipment['totals']['amount'], 2) }}
{{-- Show ONLY orders that are ACTUALLY in this shipment --}} @if(count($shipment['orders']) > 0)
Orders in This Shipment {{ count($shipment['orders']) }} orders
@foreach($shipment['orders'] as $index => $orderItem) @endforeach
# Order ID Origin Destination Description CTN QTY TTL/QTY Amount (₹) Status
{{ $index + 1 }} {{ $orderItem['order_id'] ?? '-' }} @if($orderItem['order_id'] == $orderData['order_id']) Current @endif {{ $orderItem['origin'] ?? '-' }} {{ $orderItem['destination'] ?? '-' }} {{ $orderItem['description'] ?? '-' }} {{ $orderItem['ctn'] ?? '-' }} {{ $orderItem['qty'] ?? '-' }} {{ $orderItem['ttl_qty'] ?? '-' }} ₹{{ number_format($orderItem['amount'] ?? 0, 2) }} In Shipment
@else
No orders found in this shipment.
@endif {{-- Shipment Totals --}}
Total CTN in Shipment
{{ $shipment['totals']['ctn'] }}
Total QTY in Shipment
{{ $shipment['totals']['qty'] }}
Total TTL/QTY
{{ $shipment['totals']['ttl_qty'] }}
Total CBM
{{ number_format($shipment['totals']['cbm'], 3) }}
Total KG
{{ number_format($shipment['totals']['kg'], 3) }}
Total TTL CBM
{{ number_format($shipment['totals']['ttl_cbm'], 3) }}
Total TTL KG
{{ number_format($shipment['totals']['ttl_kg'], 3) }}
Total Amount
₹{{ number_format($shipment['totals']['amount'], 2) }}
@endforeach @else

This order is not part of any shipment.

@endif
{{-- ===================================================== INVOICE DETAILS TAB ====================================================== --}}
@if($invoiceData)

TAX INVOICE

INVOICE NO: {{ $invoiceData['invoice_no'] }}

From:

Kent Logistic
123 Logistics Street
Mumbai, Maharashtra 400001
Email: support@kentlogistic.com
Phone: +91 1234567890

To:

{{ $invoiceData['customer']['name'] }}
{{ $invoiceData['customer']['address'] }}
Pincode: {{ $invoiceData['customer']['pincode'] }}
Email: {{ $invoiceData['customer']['email'] }}
Phone: {{ $invoiceData['customer']['mobile'] }}

Invoice ID
{{ $invoiceData['invoice_no'] }}
Status
{{ ucfirst($invoiceData['status']) }}
Belongs to Shipment
{{ $order->invoice->shipment_id ?? 'N/A' }}
Order ID
{{ $orderData['order_id'] }}
Invoice Date
@if($invoiceData['invoice_date']) {{ \Carbon\Carbon::parse($invoiceData['invoice_date'])->format('d-m-Y') }} @else N/A @endif
Due Date
@if($invoiceData['due_date']) {{ \Carbon\Carbon::parse($invoiceData['due_date'])->format('d-m-Y') }} @else N/A @endif
{{-- Invoice Items Table --}}
Invoice Items {{ count($invoiceData['items']) }} items
@foreach($invoiceData['items'] as $index => $item) @endforeach
# Description CTN QTY TTL/QTY Unit Price (₹) TTL Amount (₹) CBM TTL CBM KG TTL KG Shop No
{{ $index + 1 }} {{ $item->description }} {{ $item->ctn ?? '-' }} {{ $item->qty }} {{ $item->qty }} {{ $item->unit ?? '-' }} ₹{{ number_format($item->rate, 2) }} ₹{{ number_format($item->amount, 2) }} {{ number_format($item->cbm ?? 0, 3) }} {{ number_format(($item->cbm ?? 0) * $item->qty, 3) }} {{ number_format($item->kg ?? 0, 3) }} {{ number_format(($item->kg ?? 0) * $item->qty, 3) }} {{ $item->shop_no ?? '-' }}
{{-- Invoice Totals --}}
Amount:
₹{{ number_format($invoiceData['summary']['amount'], 2) }}
CGST (0%):
₹{{ number_format($invoiceData['summary']['cgst'], 2) }}
SGST (0%):
₹{{ number_format($invoiceData['summary']['sgst'], 2) }}
Total Payable:
₹{{ number_format($invoiceData['summary']['total'], 2) }}
@else

No invoice generated for this order.

An invoice can be generated from the orders list.

@endif
@endsection