@include('sidebar')
{{ $title ?? 'Ticket' }}
@php $role = $role ?? null; $user_id = $user_id ?? null; @endphp @foreach($ticket_details as $i => $ticket) @php // Role-based filtering $allowed = true; // Role 4 or 5: only show own tickets if ($role == 4 || $role == 5) { if ($user_id != $ticket->user_id) { $allowed = false; } } // Role 3, 6, or 7: show only assigned tickets elseif ($role == 3 || $role == 6 || $role == 7) { $assigned_staff_ids = explode(',', $ticket->assigned_staff_id ?? ''); $user_assigned = false; foreach ($assigned_staff_ids as $assigned_staff_id) { if ($user_id == trim($assigned_staff_id)) { $user_assigned = true; break; } } if (!$user_assigned) { $allowed = false; } } // Status filter if (isset($_REQUEST['status']) && !empty($_REQUEST['status'])) { $requestStatus = $_REQUEST['status']; if ($ticket->issue_status != $requestStatus && $ticket->issue_status != '4' && $ticket->issue_status != 'null') { $allowed = false; } } @endphp @if($allowed) @endif @endforeach
Ticket No Assigned to Contact No Created Date Modified Date Turn arround time Modified User Status Actions
{{ $ticket->ticket_number }} @php $technicianName = ''; $technician = $ticket->technician; // Role 1 or 2 if ($role == 1 || $role == 2) { $users = \Illuminate\Support\Facades\DB::table('users') ->whereIn('role', [3, 6, 7]) ->where('user_id', $technician) ->first(); if ($users) { $technicianName = $users->user_name; } } // Role 4, 3, 6, or 5 if ($role == 4 || $role == 3 || $role == 6 || $role == 5) { $users = \Illuminate\Support\Facades\DB::table('users') ->where('role', 3) ->where('user_id', $technician) ->first(); if ($users) { $technicianName = $users->user_name; } } // Role 5, 6, or 7 if ($role == 5 || $role == 6 || $role == 7) { $users = \Illuminate\Support\Facades\DB::table('users') ->whereIn('role', [6, 7]) ->where('user_id', $technician) ->first(); if ($users) { $technicianName = $users->user_name; } } @endphp {{ $technicianName }} {{ $ticket->contact_number }} {{ $ticket->created_at }} {{ date('Y-m-d H:i:s', strtotime($ticket->updated_at)) }} @php $startDateString = $ticket->created_at; $endDateString = $ticket->updated_at; $startDate = new DateTime($startDateString); $endDate = new DateTime($endDateString); $dateInterval = $startDate->diff($endDate); $totalDays = $dateInterval->days; $totalSeconds = $dateInterval->s + ($dateInterval->i * 60) + ($dateInterval->h * 3600) + ($dateInterval->days * 86400); // Calculate total hours, minutes, and seconds $totalHours = floor($totalSeconds / 3600); $totalMinutes = floor(($totalSeconds % 3600) / 60); $totalSeconds = $totalSeconds % 60; @endphp {{ $totalDays }} days - {{ $totalHours }}:{{ str_pad($totalMinutes, 2, '0', STR_PAD_LEFT) }}:{{ str_pad($totalSeconds, 2, '0', STR_PAD_LEFT) }} {{ $ticket->updated_by }} @if($ticket->issue_status == 1) Acknowledged @elseif($ticket->issue_status == 2) Return with query @elseif($ticket->issue_status == 3) Mark Resolved @elseif($ticket->issue_status == 4) Return @elseif($ticket->issue_status == 5) cancel @endif @if($ticket->issue_status != 5) @endif @if($role == 2) @endif