@extends('dashboard.layouts.app') @section('content')
{{-- Left Side: Identity & Status --}}

PO #{{ $purchase->purchase_number }}

{{-- Compact Status Badge next to title --}} {{ $purchase->status }}

Created on {{ $purchase->created_at->format('M d, Y') }}

{{-- Right Side: Action Group --}}
{{-- Secondary Action: Back --}} Back
{{-- Vertical Divider --}} {{-- Primary Action: Update --}}

{{-- SECTION 2: FINANCE & STAFF --}}

Subtotal

${{ number_format($purchase->sub_total, 2) }}

Shipping Cost

${{ number_format($purchase->shipping_cost, 2) }}

Total Order Value

${{ number_format($purchase->total, 2) }}

{{-- SECTION 1: HEADER DETAILS --}}

Order Name

{{ $purchase->name }}

Assigned Staff

@forelse ($purchase->requestedStaffs as $staff) {{ $staff->first_name }} {{$staff->last_name}} @empty

No staff members have been assigned to this purchase order.

@endforelse

Required By

{{ $purchase->required_by ? \Carbon\Carbon::parse($purchase->required_by)->format('M d, Y') : '--' }}

{{-- STAFF DETAILS - NOW IN A CARD --}}
{{-- SECTION 3: VENDOR DETAILS - NOW IN A CARD --}}
Vendor Information
@php $vendors = $purchase->vendors; @endphp
@if (count($vendors) > 0) @foreach ($vendors as $vendor) @endforeach
# Vendor Name Phone Location Tax Shipping Cost
{{ $loop->iteration }} {{ $vendor->name }} {{ $vendor->phone }} {{ $vendor->location }} {{ $vendor->tax }} {{ $vendor->shipping_cost }}
@else @endif

{{-- SECTION 4: ITEMS --}}
Purchased Items
@foreach ($purchase->details as $detail) @endforeach
# Product Category Serial Part No Price Qty Amount Tax %
{{ $loop->iteration }} {{ $detail->product_name }} {{ $detail->category_name }} {{ $detail->serial_number }} {{ $detail->part_no }} ${{ number_format($detail->price, 2) }} {{ $detail->quantity }} ${{ number_format($detail->amount, 2) }} {{ $detail->tax_rate }}%
{{-- SUMMARY / FOOTER --}}
Subtotal: ${{ number_format($purchase->sub_total, 2) }}
Shipping: ${{ number_format($purchase->shipping_cost, 2) }}

Grand Total: ${{ number_format($purchase->total, 2) }}
{{-- SECTION 5: ATTACHMENTS --}}
Attachments
@forelse ($purchase->attachments as $attachment) @php $path = $attachment->file_path; $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); $isImage = in_array($ext, ['jpg', 'jpeg', 'png', 'gif', 'webp','jfif']); @endphp
{{-- Show image preview --}} @if ($isImage) Attachment @else {{-- Show file icon --}} @endif

{{ basename($path) }}

View / Download
@empty
No attachments available for this purchase.
@endforelse
@endsection