@extends('layouts.app') @section('title', 'My Assigned Tickets') @section('content')

My Assigned Tickets

View all tickets assigned to you

{{ $stats['total'] }}

Total Assigned

{{ $stats['open'] }}

Open

{{ $stats['in_progress'] }}

In Progress

{{ $stats['resolved'] }}

Resolved

{{ $stats['closed'] }}

Closed

Reset
My Assigned Tickets ({{ $stats['total'] }})
@forelse($assignedTickets as $ticket) @php // Current active assignment for this employee $currentAssignment = DB::table('reseller_ticket_employee_assignments') ->where('reseller_ticket_id', $ticket->id) ->where('employee_id', $currentEmployee->id) ->where('is_active', true) ->first(); // Was it forwarded (previous inactive assignment exists for someone else)? $hasPreviousAssignment = DB::table('reseller_ticket_employee_assignments') ->where('reseller_ticket_id', $ticket->id) ->where('employee_id', '!=', $currentEmployee->id) ->where('is_active', false) ->exists(); $assignedBy = null; if ($currentAssignment && $currentAssignment->assigned_by) { $assignedByUser = \App\Models\User::find($currentAssignment->assigned_by); $assignedBy = $assignedByUser ? $assignedByUser->name : 'N/A'; } @endphp @empty @endforelse
Ticket # Reseller Subject Category Sub Category Priority Status Assign To Assigned At Created At Actions
{{ $ticket->ticket_number }} @if($ticket->user) @if($ticket->user->reseller && $ticket->user->reseller->name) {{ $ticket->user->reseller->name }} @elseif($ticket->user->company_name) {{ $ticket->user->company_name }} @else {{ $ticket->user->name ?? 'N/A' }} @endif @else N/A @endif {{ Str::limit($ticket->subject ?? $ticket->description, 50) }} {{ $ticket->category->name ?? 'N/A' }} {{ $ticket->subcategory->name ?? 'N/A' }} @php $priorityColors = [ 'low' => '#6c757d', 'medium' => '#17a2b8', 'high' => '#ffc107', 'urgent' => '#dc3545' ]; $priorityColor = $priorityColors[$ticket->priority] ?? '#6c757d'; @endphp {{ ucfirst($ticket->priority) }} @php $statusLabel = in_array($ticket->status, ['resolved', 'closed']) ? 'Solved' : ucfirst(str_replace('_', ' ', $ticket->status)); $clickableStatuses = ['in_progress', 'upstream_issues', 'pop_issues', 'transmission_issues']; $isClickable = in_array($ticket->status, $clickableStatuses); $isSolved = $ticket->resolved_at || $ticket->status === 'resolved' || $ticket->status === 'closed'; $statusColors = [ 'in_progress' => '#ffc107', 'upstream_issues' => '#007bff', 'pop_issues' => '#fd7e14', 'transmission_issues' => '#6f42c1' ]; $statusColor = $statusColors[$ticket->status] ?? '#6c757d'; @endphp @if($isClickable && !$isSolved) {{ $statusLabel }} @elseif($isClickable && $isSolved) {{ $statusLabel }} @else {{ $statusLabel }} @endif @if($currentAssignment) @if($ticket->resolved_at) {{-- Ticket is solved, show Solved instead of Forwarded --}} @elseif($hasPreviousAssignment) @else @endif @else N/A @endif @if($currentAssignment && $currentAssignment->assigned_at) {{ \Carbon\Carbon::parse($currentAssignment->assigned_at)->format('Y-m-d H:i') }}
{{ \Carbon\Carbon::parse($currentAssignment->assigned_at)->diffForHumans() }} @else N/A @endif
{{ $ticket->created_at->format('Y-m-d H:i') }}
{{ $ticket->created_at->diffForHumans() }}
View Edit
No assigned tickets found
{{ $assignedTickets->links() }}
@foreach($assignedTickets as $ticket) @php $clickableStatuses = ['in_progress', 'upstream_issues', 'pop_issues', 'transmission_issues']; $shouldShowModal = in_array($ticket->status, $clickableStatuses); @endphp @if($shouldShowModal) @endif @endforeach @foreach($assignedTickets as $ticket) @php // Current assignment details for preselects $currentAssignment = DB::table('reseller_ticket_employee_assignments') ->where('reseller_ticket_id', $ticket->id) ->where('is_active', true) ->first(); $currentDepartmentId = $currentAssignment ? $currentAssignment->department_id : null; $currentEmployeeId = $currentAssignment ? $currentAssignment->employee_id : null; $hasExistingAssignment = DB::table('reseller_ticket_employee_assignments') ->where('reseller_ticket_id', $ticket->id) ->exists(); // Department options $currentUser = auth()->user(); $checkSuperAdmin = $currentUser->role === 'super_admin' || in_array(strtolower($currentUser->role), ['super_admin', 'super-admin', 'super admin']) || in_array($currentUser->email, ['mkzwasim@gmail.com', 'sahrior@gmail.com', 'wasim@mkz.com.bd']); if ($checkSuperAdmin || (isset($isSuperAdmin) && $isSuperAdmin)) { $departments = \App\Models\Department::where('is_active', true) ->orderBy('name') ->get(); } else { if ($currentUser->branch_id) { $departments = \App\Models\Department::where('is_active', true) ->where('isp_id', '=', $currentUser->branch_id) ->whereNotNull('isp_id') ->orderBy('name') ->get(); } else { $departments = collect(); } if ($departments->isEmpty() && !empty($ticket->isp_id)) { $departments = \App\Models\Department::where('is_active', true) ->where('isp_id', '=', $ticket->isp_id) ->whereNotNull('isp_id') ->orderBy('name') ->get(); } if ($departments->isEmpty()) { $departments = \App\Models\Department::where('is_active', true) ->orderBy('name') ->get(); } } $employees = $currentDepartmentId ? \App\Models\Employee::where('department_id', $currentDepartmentId)->where('status', true)->orderBy('name')->get() : collect(); @endphp @endforeach @endsection @section('styles') @endsection @push('scripts') @endpush