@extends('admin.layouts.app') @section('page-title', 'Orders') @section('content')
Orders Management
@php $totalOrders = $orders->count(); $paidInvoices = $orders->filter(function($order) { $status = $order->invoice?->status ?? 'pending'; return strtolower($status) === 'paid'; })->count(); $pendingInvoices = $orders->filter(function($order) { $status = $order->invoice?->status ?? 'pending'; return strtolower($status) === 'pending'; })->count(); $overdueInvoices = $orders->filter(function($order) { $status = $order->invoice?->status ?? 'pending'; return strtolower($status) === 'overdue'; })->count(); @endphp
{{ $totalOrders }}
Total Orders
{{ $pendingInvoices }}
Pending Invoices
{{ $overdueInvoices }}
Overdue Invoices
From: To:
@if(isset($orders) && $orders->count() > 0)
@foreach($orders as $order) @php $mark = $order->markList ?? null; $invoice = $order->invoice ?? null; $shipment = $order->shipments->first() ?? null; // Normalized status values for consistent CSS classes $invoiceStatus = strtolower($invoice?->status ?? 'pending'); $shipmentStatus = strtolower($shipment?->status ?? 'pending'); $shipmentStatusForCss = str_replace([' ', '-'], '_', $shipmentStatus); @endphp @endforeach
Order ID Shipment ID Customer ID Company Origin Destination Order Date Invoice No Invoice Date Amount Amount + GST Invoice Status Shipment Status Action
{{ $order->order_id ?? '-' }} {{ $shipment?->shipment_id ?? '-' }} {{ $mark?->customer_id ?? '-' }} {{ $mark?->company_name ?? '-' }} {{ $mark?->origin ?? $order->origin ?? '-' }} {{ $mark?->destination ?? $order->destination ?? '-' }} {{ $order->created_at ? $order->created_at->format('d-m-Y') : '-' }} {{ $invoice?->invoice_number ?? '-' }} {{ $invoice?->invoice_date ? date('d-m-Y', strtotime($invoice->invoice_date)) : '-' }} {{ $invoice?->final_amount ? '₹'.number_format($invoice->final_amount, 2) : '-' }} {{ $invoice?->final_amount_with_gst ? '₹'.number_format($invoice->final_amount_with_gst, 2) : '-' }} {{ ucfirst($invoiceStatus) }} {{ ucfirst($shipmentStatus) }}
{{-- End table-wrapper --}}
Showing 1 to {{ min(10, count($orders)) }} of {{ count($orders) }} entries
@else
No orders found

There are currently no orders in the system.

@endif
@endsection