@extends('layouts.app') @section('content')
Ticket Details

@php // ✅ Controller se $isAdmin pass karna recommended, fallback: $isAdmin = $isAdmin ?? auth()->user()->hasAnyRole(['admin','super admin','super-admin','super_admin']); @endphp
Ticket Information
@if($ticket->checklistItem) @endif
Mosque: {{ $ticket->mosque->name }} @if($ticket->mosque->location)
{{ $ticket->mosque->location }} @endif
Raised By: @if($ticket->raiser) {{ $ticket->raiser->name }} @else System @endif
Urgency: @php $urgencyColors = [ 'LOW' => 'success', 'NORMAL' => 'info', 'HIGH' => 'warning', 'URGENT' => 'danger' ]; @endphp {{ $ticket->urgency }}
Category: @if($ticket->category) {{ $ticket->category }} @else N/A @endif
Status: @php $statusColors = [ 'OPEN' => 'danger', 'ASSIGNED' => 'warning', 'IN_PROGRESS' => 'primary', 'RESOLVED' => 'info', 'CLOSED' => 'success' ]; $isOverdue = $ticket->sla_due && $ticket->sla_due->isPast() && !in_array($ticket->status, ['RESOLVED', 'CLOSED']); @endphp {{ $ticket->status }} @if($isOverdue) OVERDUE @endif
SLA Due Date: @if($ticket->sla_due) \Carbon\Carbon::parse($ticket->sla_due)->format('d M Y, h:i A') @if($isOverdue)
Overdue by {{ $ticket->sla_due->diffForHumans(null, true) }} @else
Due in {{ $ticket->sla_due->diffForHumans() }} @endif @else Not set @endif
Assigned To: @if($ticket->assignee) {{ $ticket->assignee->name }} @else Unassigned @endif
Related Checklist Item: {{ $ticket->checklistItem->task_title }}
Created At: {{ $ticket->created_at->format('d M Y, h:i A') }}
Last Updated: {{ $ticket->updated_at->format('d M Y, h:i A') }}
Message

{{ $ticket->message }}

@canany(['update tickets', 'delete tickets'])
Actions
@can('update tickets') Edit Ticket @endcan @can('delete tickets')
@csrf @method('DELETE')
@endcan
@endcanany
@if($ticket->resolution_note)
Resolution Note

{{ $ticket->resolution_note }}

@endif
Quick Actions
@can('update tickets')
@endcan
Mosque Information
Moulvi: @if($ticket->mosque->moulvi) {{ $ticket->mosque->moulvi->name }} @else Not Assigned @endif
Location: {{ $ticket->mosque->location ?? 'N/A' }}
Active Checklists: {{ $ticket->mosque->checklists->where('status', '!=', 'CLOSED')->count() }} / {{ $ticket->mosque->checklists->count() }}
Open Tickets: {{ $ticket->mosque->tickets->whereIn('status', ['OPEN', 'ASSIGNED', 'IN_PROGRESS'])->count() }} / {{ $ticket->mosque->tickets->count() }}
@if($ticket->checklistItem)
Checklist Item Details
Task: {{ $ticket->checklistItem->task_title }}
Status: @php $itemStatusColors = [ 'NOT_STARTED' => 'secondary', 'IN_PROGRESS' => 'warning', 'COMPLETED' => 'success', 'PENDING_PROOF' => 'primary' ]; @endphp {{ $ticket->checklistItem->status }}
Proof Required: @if($ticket->checklistItem->proof_required) Yes @else No @endif
Checklist Date: {{ \Carbon\Carbon::parse( $ticket->checklistItem->checklist->date)->format('d M Y') }}
@endif
@can('update tickets') @endcan @endsection @push('script') @endpush