@extends('employee.layouts.app') @section('title', get_setting('site_name').' | '.__('Asset Requisition')) @section('content') @php use App\Support\Asset\AssetType; @endphp

{{ __('Asset requisition') }}

{{ __('Request assets and track assignment status.') }}

@if (session()->has('message'))
{{ session('message') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif
{{ (int) ($assetStats['total'] ?? 0) }}
{{ __('Total') }}
{{ (int) ($assetStats['pending'] ?? 0) }}
{{ __('Pending') }}
{{ (int) ($assetStats['assigned'] ?? 0) }}
{{ __('Assigned') }}
{{ (int) ($assetStats['rejected'] ?? 0) }}
{{ __('Rejected') }}
{{ __('My asset requests') }} @if($requisitions->total() > 0) {{ __('Showing') }} {{ $requisitions->firstItem() }}–{{ $requisitions->lastItem() }} {{ __('of') }} {{ $requisitions->total() }} @endif
@forelse($requisitions as $visit) @php $parentCategory = $visit->category?->parentCategory; $categoryName = $parentCategory?->name ?? $visit->category?->name ?? '—'; $assetName = $parentCategory ? ($visit->category?->name ?? '—') : '—'; $statusLabel = $visit->statusLabel(); $statusClass = match((int)$visit->status) { \App\Models\AssetRequisition::STATUS_REJECTED => 'rejected', \App\Models\AssetRequisition::STATUS_FULFILLED => 'assigned', \App\Models\AssetRequisition::STATUS_APPROVAL_APPROVED => 'pending', default => 'pending', }; @endphp @empty @endforelse
# {{ __('Apply date') }} {{ __('Asset category') }} {{ __('Asset name') }} {{ __('Identity') }} {{ __('Qty') }} {{ __('Description') }} {{ __('Status') }}
{{ $requisitions->firstItem() + $loop->index }} {{ optional($visit->created_at)->format('Y-m-d') }} {{ $categoryName }} {{ $assetName }} {{ $visit->qty }} {{ $visit->description ?: '—' }} {{ $statusLabel }}
{{ __('No asset requests yet.') }}
@if($requisitions->hasPages()) @endif
{{ __('My assigned assets') }} @if($assignments->total() > 0) {{ __('Showing') }} {{ $assignments->firstItem() }}–{{ $assignments->lastItem() }} {{ __('of') }} {{ $assignments->total() }} @endif
@forelse($assignments as $assignment) @php $parentCategory = $assignment->asset_category?->parentCategory; $categoryName = $parentCategory?->name ?? $assignment->asset_category?->name ?? '—'; $assetName = $assignment->asset_item?->name ?? ($parentCategory ? ($assignment->asset_category?->name ?? '—') : '—'); $identity = $assignment->asset_item?->identity ?? $assignment->asset_item?->code ?? $assignment->issue_barcode ?? '—'; $assetType = $assignment->asset_item?->asset_type ?? $assignment->asset_category?->asset_type ?? AssetType::FIXED; $qtyLabel = (float) $assignment->qty; $qtyFormatted = fmod($qtyLabel, 1.0) === 0.0 ? (string) (int) $qtyLabel : number_format($qtyLabel, 2); $unitLabel = $assignment->asset_item?->qtyUnitLabel() ?? ''; $qtyDisplay = $unitLabel !== '' ? trim($qtyFormatted.' '.$unitLabel) : $qtyFormatted; $isActive = (int) $assignment->status === 1 && (int) $assignment->return === 0; $isReturned = (int) $assignment->return === 1; $isDamaged = (int) $assignment->status === 4; $isAck = (bool) $assignment->staff_acknowledgement; $consumed = $assignment->qtyConsumed(); $remaining = $assignment->qtyRemaining(); $usagePct = $qtyLabel > 0 ? min(100, round(($consumed / $qtyLabel) * 100)) : 0; @endphp @if($assignment->isConsumable() && $assignment->usageLogs->isNotEmpty()) @endif @empty @endforelse
# {{ __('Assigned date') }} {{ __('Type') }} {{ __('Asset category') }} {{ __('Asset name') }} {{ __('Identity') }} {{ __('Qty') }} {{ __('Acknowledgment') }} {{ __('Usage') }} {{ __('Status') }} {{ __('Actions') }}
{{ $assignments->firstItem() + $loop->index }} {{ optional($assignment->assign_date)->format('Y-m-d') ?? optional($assignment->created_at)->format('Y-m-d') }} {{ AssetType::label($assetType) }} {{ $categoryName }} {{ $assetName }} {{ $identity }} {{ $qtyDisplay }} @if($isAck) {{ __('Received') }} @if($assignment->acknowledged_at)
{{ $assignment->acknowledged_at->format('Y-m-d') }}
@endif @elseif($isActive) {{ __('Pending') }} @else @endif
@if($assignment->isConsumable() && $isActive)
{{ __('Used') }}: {{ number_format($consumed, 2) }} {{ $unitLabel }}
{{ __('Left') }}: {{ number_format($remaining, 2) }} {{ $unitLabel }}
@else @endif
@if($isActive) {{ __('Assigned') }} @elseif($isDamaged) {{ __('Damaged') }} @elseif($isReturned) {{ __('Returned') }} @else {{ __('Inactive') }} @endif @if($isActive) @if(! $isAck) @endif @if($assignment->isConsumable() && $remaining > 0) @endif @if($assignment->isConsumable() && $assignment->usageLogs->isNotEmpty()) @endif @else @endif
@if(($assignTab ?? 'active') === 'returned') {{ __('No returned assets yet.') }} @elseif(($assignTab ?? 'active') === 'all') {{ __('No assigned assets yet.') }} @else {{ __('No active assigned assets.') }} @endif
@if($assignments->hasPages()) @endif
@endsection @section('modal') @endsection @section('script') @endsection