@extends('admin.layouts.inventory') @section('title', 'Purchase orders') @section('content') @php $fmt = fn ($n) => '₹'.number_format((float) ($n ?? 0), 2); @endphp @include('admin.inventory.partials.filter_bar', ['filters' => $filters])
@if ($purchaseOrders->isEmpty())

@if ($filters->isActive()) No purchase orders match these filters. @else No purchase orders yet. Create one. @endif

@else @foreach ($purchaseOrders as $order) @php $status = $order->status?->value ?? $order->status; $totals = \App\Support\InventoryDocumentTotals::for($order); @endphp @endforeach
Document Supplier Date Status Total amount Action
{{ $order->document_number }} {{ $order->supplier->name ?? '—' }} {{ $order->transaction_date?->format('Y-m-d') ?? '—' }} {{ $status }} {{ $fmt($totals['total']) }} @include('admin.inventory.partials.action_icons', [ 'view' => route('admin.inventory.purchase-orders.show', $order), 'download' => $status === 'completed' ? route('admin.inventory.purchase-orders.pdf', $order) : null, 'downloadTooltip' => 'Download PDF', ])
@include('admin.inventory.partials.pagination', ['paginator' => $purchaseOrders]) @endif
@endsection