@php use Modules\POSM\Models\PosmDepletionJobDetailsProduct; @endphp @extends('layouts.app') @section('title', 'POSM Depletion Job Details') @section('content')
POSM Job Details — {{ $depletion_job->job_no }}
@if($depletion_job->status == 'pending') @endif @if($depletion_job->qr_status == 'Printed') @endif
{{-- Job Status Banner --}}
QR Status: {{ $depletion_job->qr_status }}  |  Shipment: {{ strtolower($depletion_job->shipment_status) === 'received' ? 'Received to Distribution Point' : str_replace('_', ' ', ucfirst($depletion_job->shipment_status)) }}  |  Created By: {{ $depletion_job->user->name ?? 'System' }}  |  Date: {{ $depletion_job->created_at->format('d M Y') }}
{{-- Job Summary Card --}}
Job Summary
Job No: {{ $depletion_job->job_no }}
Date: {{ $depletion_job->created_at->format('Y-m-d H:i') }}
Created By: {{ $depletion_job->user->name ?? 'System' }}
QR Status: {{ $depletion_job->qr_status }}
Shipment Status: @php $shipmentClass = match(strtolower($depletion_job->shipment_status)) { 'received', 'delivered' => 'success', 'partially delivered' => 'info', 'approved_for_dispatch', 'ready_to_dispatch', 'dispatched' => 'primary', 'pending' => 'warning', default => 'secondary' }; $shipmentText = strtolower($depletion_job->shipment_status) === 'received' ? 'Received to Distribution Point' : str_replace('_', ' ', ucfirst($depletion_job->shipment_status)); @endphp {{ $shipmentText }}
Total Outlets: {{ $depletion_job_details->total() }}
Total Shipments: {{ count($shipments) }}
{{-- Activity Log --}}
Activity Logs
@forelse ($logs as $log) @empty @endforelse
User Action Date
{{ $log->user->name ?? 'System' }} {{ $log->details }} {{ $log->created_at->format('Y-m-d H:i') }}
No logs yet.
{{ $logs->links() }}
{{-- Depletion Data Items (Products visible) --}}
Depletion Data Items {{ $depletion_job_details->total() }} outlets
@forelse ($depletion_job_details as $i => $detail) @empty @endforelse
# Outlet RT Code Dist. Point Market Channel Products & Quantities Total Qty
{{ $depletion_job_details->firstItem() + $i }} {{ $detail->outlet }} {{ $detail->rt_code }} @if($detail->outlet_info && $detail->outlet_info->distributionPoint) {{ $detail->outlet_info->distributionPoint->name }} @else Not Assigned @endif {{ $detail->market }} {{ $detail->channel ?? '—' }} @foreach ($detail->products as $product_qty) {{ $product_qty->product->name ?? 'Unknown Product' }}: {{ number_format($product_qty->qty, 0) }} @endforeach {{ number_format($detail->products->sum('qty'), 0) }}
No data found.
{{ $depletion_job_details->appends(request()->query())->links() }}
{{-- Shipments (if any) --}} @if(count($shipments) > 0)
Generated Shipments {{ count($shipments) }}
@foreach ($shipments as $shipment) @endforeach
Ref No Supplier Product QTY Dist. Center Status Scanned At
{{ $shipment->ref_no }} {{ $shipment->supplier->name ?? '—' }} @if($shipment->product) {{ $shipment->product->name }} @else — @endif {{ number_format($shipment->qty, 0) }} {{ $shipment->distribution->name ?? '—' }} {{ $shipment->shipment_status }} {{ $shipment->scanned_at ? \Carbon\Carbon::parse($shipment->scanned_at)->format('Y-m-d H:i') : '—' }}
@endif
@endsection @push("js") @endpush