@extends('layouts.admin-simple') @section('title', 'Material Issue Decision Center') {{-- Force cache refresh --}} @section('breadcrumb') @endsection @section('page-title')

Material Issue Decision Center

Process material requests and decide issue method

@endsection @section('content')
filter_list Filters
assignment Material Requests
@if($pendingRequests->count() > 0)
@foreach($pendingRequests as $request) @endforeach
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($pendingRequests->hasPages())
{{ $pendingRequests->links('pagination::bootstrap-4') }}
@endif @else
assignment_turned_in
No Pending Requests

All material requests have been processed

@endif
info Material Issue Process
inventory Inventory Dispatch
  • Issue materials from warehouse stock
  • Direct inventory deduction
  • Immediate project allocation
local_shipping Direct Delivery
  • Order directly from supplier
  • Direct site delivery
  • Purchase order management
swap_horiz Project Transfer
  • Transfer from another project
  • Inter-project material sharing
  • Requires source project approval
@endsection @push('styles') @endpush @push('scripts') @endpush