Request Information
@php
$priorityColors = ['Critical' => 'bg-red-50 text-red-700 ring-red-200', 'High' => 'bg-orange-50 text-orange-700 ring-orange-200', 'Medium' => 'bg-blue-50 text-blue-700 ring-blue-200', 'Low' => 'bg-gray-50 text-gray-700 ring-gray-200'];
$priorityIcons = ['Critical' => 'fa-circle-exclamation', 'High' => 'fa-triangle-exclamation', 'Medium' => 'fa-circle-info', 'Low' => 'fa-circle-check'];
$pc = $itServiceRequest->priority ?? 'Low';
@endphp
-
Requested By
- {{ $itServiceRequest->name ?? 'N/A' }}
-
Department
- {{ $itServiceRequest->department ?? 'N/A' }}
@if ($itServiceRequest->request_number)
-
Request No
- {{ $itServiceRequest->request_number }}
@endif
-
Priority
-
{{ $pc }}
-
Status
-
$itServiceRequest->req_status === 'Submitted',
'bg-green-50 text-green-700 ring-green-200' => $itServiceRequest->req_status === 'Approved',
'bg-red-50 text-red-700 ring-red-200' => $itServiceRequest->req_status === 'Rejected',
'bg-gray-50 text-gray-700 ring-gray-200' => $itServiceRequest->req_status === 'Cancelled',
])>
{{ $itServiceRequest->req_status }}
@if ($itServiceRequest->request_type)
-
Request Type
- {{ ucfirst($itServiceRequest->request_type) }}
@endif
@if ($itServiceRequest->request_category)
-
Category
- {{ ucfirst($itServiceRequest->request_category) }}
@endif
@if ($itServiceRequest->site)
-
Site
- {{ $itServiceRequest->site }}
@endif
-
Assigned To
- {{ $itServiceRequest->approver2_name ?? 'Not Assigned Yet' }}
-
Created At
- {{ $itServiceRequest->created_at->format('d M Y H:i') }}
@if ($itServiceRequest->detail)
Request Detail
{{ $itServiceRequest->detail }}
@endif
@if (in_array($itServiceRequest->req_status, ['Submitted', 'Approved']))
Problem Analysis
{{ $itServiceRequest->problem_analysis ?? 'N/A' }}
Solution
{{ $itServiceRequest->solution ?? 'N/A' }}
@endif
@if ($itServiceRequest->rating)
Rating
@for ($i = 1; $i <= 5; $i++)
@endfor
({{ $itServiceRequest->rating }}/5)
@endif
@if ($itServiceRequest->attachments && count(json_decode($itServiceRequest->attachments)) > 0)
@endif
@if ($itServiceRequest->related_assets && count($itServiceRequest->related_assets) > 0)
Related Assets
| No |
Name |
Serial |
Model |
Tag |
Category |
Location |
@forelse ($itServiceRequest->related_assets as $index => $asset)
|
{{ $index + 1 }}
|
{{ $asset['name'] }} |
{{ $asset['serial'] ?? 'N/A' }} |
{{ $asset['model_name'] ?? 'N/A' }} |
{{ $asset['asset_tag'] ?? 'N/A' }} |
{{ $asset['category_name'] ?? 'N/A' }} |
{{ $asset['location_name'] ?? 'N/A' }} |
@empty
|
No related assets found.
|
@endforelse
@endif
@if ($itServiceRequest->approvals->isNotEmpty())
Activity Log
@foreach ($itServiceRequest->approvals->sortByDesc('created_at') as $approval)
@php
$statusStyles = [
'Approved' => ['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'],
'Cancelled' => ['bg-blue-50 text-blue-700 ring-blue-200', 'bg-blue-500'],
'Initiated' => ['bg-blue-50 text-blue-700 ring-blue-200', 'bg-blue-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 }}
@if ($approval->comment && trim($approval->comment))
{{ $approval->comment }}
@else
No comment provided.
@endif
@if ($approval->attachments)
@php $atts = is_array($approval->attachments) ? $approval->attachments : json_decode($approval->attachments, true); @endphp
@if (!empty($atts))
@endif
@endif
@endforeach
@else
{{--
No approval history found
--}}
@endif
Request Progress
@php
$flowSteps = [
[
'label' => $itServiceRequest->approver1_name ?? 'Dispatcher',
'sub' => $itServiceRequest->approver2 ? 'Assigned' : 'Waiting',
'status' => $itServiceRequest->approver2
? 'Completed'
: ($itServiceRequest->req_status === 'Approved' ? 'Completed' : 'Active'),
],
[
'label' => $itServiceRequest->approver2_name ?? 'In Progress',
'sub' => $itServiceRequest->req_status === 'Submitted' ? 'Solved' : ($itServiceRequest->approver2 ? 'Working' : '-'),
'status' => $itServiceRequest->req_status === 'Approved' ? 'Completed' : ($itServiceRequest->req_status === 'Submitted' ? 'Completed' : ($itServiceRequest->approver2 ? 'Active' : 'Pending')),
],
[
'label' => 'Rating',
'sub' => $itServiceRequest->rating ? $itServiceRequest->rating . '/5' : ($itServiceRequest->req_status === 'Submitted' ? 'Pending' : '-'),
'status' => $itServiceRequest->req_status === 'Approved' ? 'Completed' : ($itServiceRequest->req_status === 'Submitted' ? 'Active' : 'Pending'),
],
];
@endphp
@foreach ($flowSteps as $step)
@php
$bgColor = $step['status'] === 'Completed' ? '#dcfce7' : ($step['status'] === 'Active' ? '#dbeafe' : '#f3f4f6');
$borderColor = $step['status'] === 'Completed' ? '#22c55e' : ($step['status'] === 'Active' ? '#3b82f6' : '#d1d5db');
$textColor = $step['status'] === 'Completed' ? '#15803d' : ($step['status'] === 'Active' ? '#1d4ed8' : '#9ca3af');
@endphp
{{ $loop->index + 1 }}
{{ $step['label'] }}
{{ $step['sub'] }}
@endforeach
@if ($itServiceRequest->user_id === auth()->id() && in_array($itServiceRequest->req_status, ['Initiated', 'Rejected']))
Edit
@endif
@php $action = $itServiceRequest->getApproverAction(Auth::user()); @endphp
@if ($action === 'approve')
@if ((int) $itServiceRequest->approver1 === (int) Auth::id() && $itServiceRequest->req_status === 'Initiated')
@elseif ((int) $itServiceRequest->approver2 === (int) Auth::id() && $itServiceRequest->req_status === 'In process' && $itServiceRequest->solved_at === null)
@elseif ((int) $itServiceRequest->user_id === (int) Auth::id() && $itServiceRequest->req_status === 'Submitted' && $itServiceRequest->rating === null)
@endif
@endif
@if ($itServiceRequest->user_id === auth()->id() && in_array($itServiceRequest->req_status, ['Initiated', 'Rejected']))
@endif