@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 --}}
{{-- 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
| User |
Action |
Date |
@forelse ($logs as $log)
| {{ $log->user->name ?? 'System' }} |
{{ $log->details }} |
{{ $log->created_at->format('Y-m-d H:i') }} |
@empty
| No logs yet. |
@endforelse
{{ $logs->links() }}
{{-- Depletion Data Items (Products visible) --}}
Depletion Data Items
{{ $depletion_job_details->total() }} outlets
| # |
Outlet |
RT Code |
Dist. Point |
Market |
Channel |
Products & Quantities |
Total Qty |
@forelse ($depletion_job_details as $i => $detail)
| {{ $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) }}
|
@empty
| No data found. |
@endforelse
{{ $depletion_job_details->appends(request()->query())->links() }}
{{-- Shipments (if any) --}}
@if(count($shipments) > 0)
Generated Shipments
{{ count($shipments) }}
| Ref No |
Supplier |
Product |
QTY |
Dist. Center |
Status |
Scanned At |
@foreach ($shipments as $shipment)
| {{ $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') : '—' }} |
@endforeach
@endif
@endsection
@push("js")
@endpush