@php $action = $itemLoan->getApproverAction(Auth::user()); @endphp
@if (session('success'))
{{ session('success') }}
@endif
@if (session('error'))
{{ session('error') }}
@endif
Request Information
-
Nama Peminjam
- {{ $itemLoan->nama_peminjam }}
-
Departemen
- {{ $itemLoan->departemen }}
-
Jenis Kegiatan
- {{ $itemLoan->jenis_kegiatan }}
-
Status
-
$itemLoan->status === 'Initiated',
'bg-yellow-50 text-yellow-700 ring-1 ring-yellow-200' =>
$itemLoan->status === 'In Process',
'bg-green-50 text-green-700 ring-1 ring-green-200' =>
$itemLoan->status === 'Approved',
'bg-gray-50 text-gray-700 ring-1 ring-gray-200' =>
$itemLoan->status === 'Completed',
'bg-red-50 text-red-700 ring-1 ring-red-200' =>
$itemLoan->status === 'Rejected',
'bg-gray-50 text-gray-700 ring-1 ring-gray-200' =>
$itemLoan->status === 'Cancelled',
])>
{{ $itemLoan->status }}
-
Tanggal Peminjaman
-
{{ $itemLoan->tanggal_peminjaman->format('d-m-Y') }}
-
Waktu Pengambilan
-
{{ $itemLoan->waktu_pengambilan ?? '-' }}
-
Tanggal Pengembalian
-
{{ $itemLoan->tanggal_pengembalian->format('d-m-Y') }}
-
Estimasi Waktu Pengembalian
-
{{ $itemLoan->waktu_pengembalian ?? '-' }}
-
Created At
-
{{ $itemLoan->created_at->format('d M Y H:i') }}
@if ($itemLoan->keterangan)
Keterangan
{{ $itemLoan->keterangan }}
@endif
@php $isApprover2Editing = $action === 'approve' && $itemLoan->getCurrentStepIndex() === 1; @endphp
@if ($itemLoan->items && count($itemLoan->items) > 0)
@if ($isApprover2Editing)
@else
Requested Items
|
No |
Item |
Qty |
Notes |
@foreach ($itemLoan->items as $index => $item)
|
{{ $index + 1 }}
|
{{ $item['item_name'] }} |
{{ $item['quantity'] }} |
{{ $item['notes'] ?? '-' }} |
@endforeach
@endif
@endif
@php $hasConditionData = collect($itemLoan->items)->filter(fn($i) => !empty($i['condition_status']))->isNotEmpty(); @endphp
@if ($hasConditionData)
Condition Check
@foreach ($itemLoan->items as $item)
@if (!empty($item['condition_status']))
{{ $item['item_name'] }}
-
Condition
-
($item['condition_status'] ?? '') === '',
'bg-red-100 text-red-800' => ($item['condition_status'] ?? '') === 'Rusak',
'bg-yellow-100 text-yellow-800' => ($item['condition_status'] ?? '') === 'Hilang',
'bg-gray-100 text-gray-800' => ($item['condition_status'] ?? '') === 'Lain-lain',
])>
{{ $item['condition_status'] ?? 'No Issues' }}
@if (!empty($item['condition_details']))
-
Details
- {{ $item['condition_details'] }}
@endif
@if (!empty($item['resolution']))
-
Resolution
- {{ $item['resolution'] }}
@endif
@if (!empty($item['resolution_details']))
-
Resolution Details
- {{ $item['resolution_details'] }}
@endif
@endif
@endforeach
@endif
@if ($itemLoan->approvals->isNotEmpty())
Activity Log
@foreach ($itemLoan->approvals->sortByDesc('created_at') as $approval)
@php
$statusStyles = [
'Approved' => ['bg-green-50 text-green-700 ring-green-200', 'bg-green-500'],
'Completed' => ['bg-green-50 text-green-700 ring-green-200', 'bg-green-500'],
'Rejected' => ['bg-red-50 text-red-700 ring-red-200', 'bg-red-500'],
'Returned' => ['bg-blue-50 text-blue-700 ring-blue-200', 'bg-blue-500'],
'Items Modified' => ['bg-yellow-50 text-yellow-700 ring-yellow-200', 'bg-yellow-500'],
];
[$pillClass, $dotClass] = $statusStyles[$approval->status] ?? ['bg-gray-50 text-gray-700 ring-gray-200', 'bg-gray-400'];
@endphp
{{ strtoupper(substr($approval->user->name ?? '?', 0, 1)) }}
{{ $approval->user->name }}
{{ $approval->created_at->format('d M Y H:i') }}
{{ $approval->status }}
@php $approvalComment = $approval->comment ?? $approval->remarks ?? null; @endphp
@if ($approvalComment && trim($approvalComment))
{{ $approvalComment }}
@else
No comment provided.
@endif
@endforeach
@else
{{--
No approval history found
Approval records will appear here once processed.
--}}
@endif
Approval Workflow
@php
$steps = [
[
'name' => $itemLoan->user->name,
'status' => $itemLoan->status === 'Rejected' ? 'Needs Edit' : 'Approved',
],
['name' => $itemLoan->approver1_name, 'status' => $itemLoan->appstatus1],
['name' => $itemLoan->approver2_name, 'status' => $itemLoan->appstatus2],
[
'name' => 'Return',
'status' => in_array($itemLoan->status, ['Returned', 'Completed'])
? 'Approved'
: ($itemLoan->status === 'Approved'
? 'Initiated'
: 'Pending'),
],
[
'name' => 'GA Check',
'status' =>
$itemLoan->status === 'Completed'
? 'Approved'
: ($itemLoan->status === 'Returned'
? 'Initiated'
: 'Pending'),
],
];
@endphp
@foreach ($steps as $index => $step)
@php
$bgColor =
$step['status'] === 'Approved'
? '#dcfce7'
: ($step['status'] === 'Rejected'
? '#fef9c3'
: ($step['status'] === 'Initiated'
? '#dbeafe'
: '#f3f4f6'));
$borderColor =
$step['status'] === 'Approved'
? '#22c55e'
: ($step['status'] === 'Rejected'
? '#eab308'
: ($step['status'] === 'Initiated'
? '#3b82f6'
: '#d1d5db'));
$textColor =
$step['status'] === 'Approved'
? '#15803d'
: ($step['status'] === 'Rejected'
? '#a16207'
: ($step['status'] === 'Initiated'
? '#1d4ed8'
: '#9ca3af'));
$icon = $step['status'] === 'Approved' ? '✓' : $index + 1;
@endphp
{{ $icon }}
{{ $step['name'] ?? 'N/A' }}
{{ $step['status'] }}
@endforeach
@if ($action === 'approve')
@if ($isApprover2Editing)
@else
Actions
@endif
@elseif ($action === 'return')
@elseif ($action === 'check')
Condition Check
@endif
@if ($itemLoan->user_id === Auth::user()->id && in_array($itemLoan->status, ['Initiated', 'Rejected']))
@if ($itemLoan->status === 'Rejected')
Edit
@endif
@endif