@extends('layouts.admin-simple') @section('title', 'Material Issue Decision Center') {{-- Force cache refresh --}} @section('breadcrumb')
Process material requests and decide issue method
| Request # | Request Date | Project | Requested By | Items Count | Priority | Dispatch Status | Actions |
|---|---|---|---|---|---|---|---|
| {{ $request->material_request_number ?: 'MR-' . str_pad($request->id, 6, '0', STR_PAD_LEFT) }} | {{ $request->transaction_date->format('d-M-Y') }} |
{{ $request->project->project_name ?? 'N/A' }}
@if($request->division)
{{ $request->division->name }} @endif |
{{ $request->requester->name ?? 'N/A' }} | {{ $request->items->count() }} items |
@php
$daysSince = round($request->transaction_date->diffInDays(now()));
if ($daysSince > 7) {
$priority = 'High';
$priorityClass = 'danger';
} elseif ($daysSince > 3) {
$priority = 'Medium';
$priorityClass = 'warning';
} else {
$priority = 'Normal';
$priorityClass = 'success';
}
@endphp
{{ $priority }}
{{ $daysSince }} day{{ $daysSince != 1 ? 's' : '' }} |
@php // Calculate dispatch status based on actual quantities from fulfillments $totalRequested = $request->items->sum('quantity_requested'); $totalFulfilled = \App\Models\Warehouse\OutgoingFulfillment::where('outgoing_transaction_id', $request->id) ->sum('quantity_fulfilled'); // Debug - remove after testing \Log::info('Material Issue Dispatch Debug', [ 'request_id' => $request->id, 'request_number' => $request->material_request_number, 'status' => $request->status, 'items_count' => $request->items->count(), 'total_requested' => $totalRequested, 'total_fulfilled' => $totalFulfilled, 'total_released_old' => $request->items->sum('quantity_released'), ]); if (in_array($request->status, ['canceled', 'cancelled']) || $totalFulfilled == 0) { $dispatchStatus = 'pending'; $dispatchClass = 'badge-light'; $dispatchIcon = 'hourglass_empty'; $dispatchLabel = 'Pending'; } elseif ($totalFulfilled >= $totalRequested) { $dispatchStatus = 'fully_dispatched'; $dispatchClass = 'badge-success'; $dispatchIcon = 'check_circle'; $dispatchLabel = 'Fully Dispatched'; } else { $dispatchStatus = 'partially_dispatched'; $dispatchClass = 'badge-warning'; $dispatchIcon = 'schedule'; $dispatchLabel = 'Partially Dispatched'; } @endphp {{ $dispatchIcon }} {{ $dispatchLabel }} |
@if($dispatchStatus !== 'fully_dispatched')
assignment
Process
@endif
visibility
@if($dispatchStatus === 'fully_dispatched')
View Details
@else
View
@endif
|
All material requests have been processed