{{-- resources/views/purchases/orders/show.blade.php --}} @extends('layouts.app') @section('title', 'PO ' . $po->po_number) @section('page_title', $po->po_number) @section('page_subtitle', 'Purchase Order · ' . $po->supplier?->name) @section('content') @php $sc = [ 'pending' => ['bg'=>'#fef3c7','color'=>'#92400e'], 'approved' => ['bg'=>'#dbeafe','color'=>'#1e40af'], 'partially_received' => ['bg'=>'#e0f2fe','color'=>'#0369a1'], 'fully_received' => ['bg'=>'#d1fae5','color'=>'#065f46'], 'cancelled' => ['bg'=>'#fee2e2','color'=>'#991b1b'], 'rejected' => ['bg'=>'#fee2e2','color'=>'#991b1b'], ][$po->status] ?? ['bg'=>'#f1f5f9','color'=>'#475569']; @endphp {{-- Action bar --}}
← Orders {{ strtoupper(str_replace('_', ' ', $po->status)) }}
@if($po->status === 'pending')
@csrf
Edit @endif @if(in_array($po->status, ['approved', 'partially_received'])) Receive Goods @endif @if(in_array($po->status, ['approved','partially_received','fully_received']) && $po->payment_status !== 'paid') @endif @if(!in_array($po->status, ['fully_received','cancelled','rejected']))
@csrf
@endif PDF @if(!in_array($po->status, ['fully_received','cancelled']))
@csrf
@endif
{{-- Left --}}
{{-- Items --}}
Order Items
@foreach($po->items as $item) @php $remaining = $item->quantity_ordered - $item->quantity_received; $fullyReceived = $remaining <= 0; @endphp @endforeach
Description Unit Ordered Received Unit Price Total
{{ $item->description }} {{ $item->unit ?? '—' }} {{ $item->quantity_ordered }} {{ $item->quantity_received }} @if(!$fullyReceived && $item->quantity_received > 0) ({{ $remaining }} remaining) @endif @if($fullyReceived) @endif {{ $po->currency }} {{ number_format($item->unit_price, 2) }} {{ $po->currency }} {{ number_format($item->total_price, 2) }}
TOTAL {{ $po->currency }} {{ number_format($po->total_amount, 2) }}
{{-- GRNs --}} @if($po->goodsReceivedNotes->count() > 0)
Goods Received Notes
@foreach($po->goodsReceivedNotes as $grn) @endforeach
GRN # Date Items Status
{{ $grn->grn_number }} {{ $grn->received_date->format('d M Y') }} {{ $grn->items->count() }} {{ Str::plural('item', $grn->items->count()) }} {{ ucfirst($grn->status) }} View →
@endif {{-- Payments --}} @if($po->supplierPayments->count() > 0)
Payments Made
@foreach($po->supplierPayments as $payment) @endforeach
Reference Method Amount Date
{{ $payment->reference }} {{ ucfirst(str_replace('_', ' ', $payment->payment_method)) }} {{ $payment->currency }} {{ number_format($payment->amount, 2) }} {{ $payment->paid_at->format('d M Y') }}
@endif
{{-- Right --}}
{{-- Supplier --}}
Supplier Profile →
{{ $po->supplier?->name }}
@if($po->supplier?->contact_person)
{{ $po->supplier->contact_person }}
@endif @if($po->supplier?->email)
{{ $po->supplier->email }}
@endif @if($po->supplier?->phone)
{{ $po->supplier->phone }}
@endif
{{-- Financials --}}
Financials
Subtotal {{ $po->currency }} {{ number_format($po->subtotal, 2) }}
@if($po->tax_amount > 0)
Tax {{ $po->currency }} {{ number_format($po->tax_amount, 2) }}
@endif
TOTAL {{ $po->currency }} {{ number_format($po->total_amount, 2) }}
Paid {{ $po->currency }} {{ number_format($po->amount_paid, 2) }}
BALANCE DUE {{ $po->currency }} {{ number_format($po->balance_due, 2) }}
{{-- PO Info --}}
Order Info
PO Number {{ $po->po_number }}
Order Date {{ $po->order_date->format('d M Y') }}
@if($po->expected_date)
Expected {{ $po->expected_date->format('d M Y') }}
@endif @if($po->sent_at)
Sent {{ $po->sent_at->format('d M Y') }}
@endif
Created By {{ $po->createdBy?->name ?? '—' }}
@if($po->approvedBy)
Approved By {{ $po->approvedBy->name }}
@endif @if($po->delivery_address)
Delivery Address
{{ $po->delivery_address }}
@endif @if($po->notes)
Notes
{{ $po->notes }}
@endif
{{-- Reject Modal --}} {{-- Payment Modal --}} @if(in_array($po->status, ['approved','partially_received','fully_received']) && $po->payment_status !== 'paid') @endif @endsection