@extends('user.layouts.app') @section('title', 'Detail Tiket') @section('content') @include('user.partials.notification')
Kembali Ke Daftar Tiket

Detail Tiket

@if($ticket->status === 'closed' && !$ticket->user_confirmation)
@csrf
@csrf
@endif @if($ticket->status === 'open') Edit Tiket @endif @if(in_array($ticket->status, ['open', 'pending']))
@csrf @method('DELETE')
@endif
{{ $ticket->status === 'open' ? 'Dibuka' : ($ticket->status === 'in_progress' ? 'Dalam Proses' : ($ticket->status === 'pending' ? 'Menunggu' : ($ticket->status === 'closed' ? 'Ditutup' : 'Selesai'))) }} Prioritas {{ $ticket->priority === 'low' ? 'Rendah' : ($ticket->priority === 'medium' ? 'Sedang' : 'Tinggi') }} Tiket #{{ $ticket->ticket_number }}
Dibuat: {{ $ticket->created_at->format('d M Y H:i') }}

Kategori

{{ ucfirst($ticket->category) }}

Departemen

{{ $ticket->department }}

Gedung

@if($ticket->buildingRelation) {{ $ticket->buildingRelation->name }} ({{ $ticket->building }}) @else {{ $ticket->building }} @endif

Lokasi

{{ $ticket->location }}

Informasi Tiket

Foto Tiket

@if($ticket->initialPhoto) @php $photoPath = $ticket->initialPhoto->photo_path; $fullPath = storage_path('app/public/' . $photoPath); $publicPath = public_path('storage/' . $photoPath); // Debug information $debug = [ 'photo_exists_storage' => file_exists($fullPath), 'photo_exists_public' => file_exists($publicPath), 'storage_path' => $fullPath, 'public_path' => $publicPath, 'is_readable_storage' => is_readable($fullPath), 'is_readable_public' => is_readable($publicPath), ]; @endphp @if($debug['photo_exists_storage'] || $debug['photo_exists_public']) Foto Tiket @else

Tidak ada foto

@endif @else

Tidak ada foto

@endif

Deskripsi Masalah

{{ $ticket->description }}
@if($ticket->admin_notes)

Catatan Admin

{{ $ticket->admin_notes }}

@endif

Riwayat Status Tiket

Dibuat

{{ $ticket->created_at->format('d M Y H:i') }}

@if($ticket->in_progress_at || $ticket->closed_at || $ticket->user_confirmed_at)
@endif
@if($ticket->in_progress_at)

Dalam Proses

{{ $ticket->in_progress_at->format('d M Y H:i') }}

@if($ticket->closed_at || $ticket->user_confirmed_at)
@endif
@endif @if($ticket->closed_at)

Ditutup

{{ $ticket->closed_at->format('d M Y H:i') }}

@if($ticket->user_confirmed_at)
@endif
@endif @if($ticket->user_confirmed_at)

Dikonfirmasi

{{ $ticket->user_confirmed_at->format('d M Y H:i') }}

@endif

Riwayat Percakapan

@php // Check if responses are already arrays $adminResponses = is_array($ticket->admin_responses) ? $ticket->admin_responses : (json_decode($ticket->admin_responses, true) ?? []); $userReplies = is_array($ticket->user_replies) ? $ticket->user_replies : (json_decode($ticket->user_replies, true) ?? []); // Combine both arrays and sort by timestamp $allResponses = []; foreach($adminResponses as $response) { $response['type'] = 'admin'; $allResponses[] = $response; } foreach($userReplies as $reply) { $reply['type'] = 'user'; $allResponses[] = $reply; } // Sort by timestamp (newest first) usort($allResponses, function($a, $b) { return strtotime($b['timestamp']) - strtotime($a['timestamp']); }); @endphp @if(count($allResponses) > 0) @foreach($allResponses as $response)
@if($response['type'] === 'admin')
Admin
{{ \Carbon\Carbon::parse($response['timestamp'])->format('d M Y H:i') }}

{{ $response['notes'] ?? '' }}

@if(isset($response['photo'])) @endif
@else
Anda
{{ \Carbon\Carbon::parse($response['timestamp'])->format('d M Y H:i') }}
@if(isset($response['message']))

{{ $response['message'] }}

@elseif(isset($response['notes']))

@if(isset($response['type']) && $response['type'] === 'confirm') Dikonfirmasi selesai @elseif(isset($response['type']) && $response['type'] === 'reject') Masih ada masalah @endif {{ $response['notes'] }}

@endif @if(isset($response['photo']) && !empty($response['photo'])) @endif
@endif
@endforeach @else

Belum Ada Respon

Tiket ini belum memiliki balasan dari admin atau pengguna

@endif
@if(in_array($ticket->status, ['in_progress', 'pending']))

Balas Tiket

@csrf
Maks 5MB
@endif
@endsection