|
1 | 1 | <x-app-layout> |
2 | 2 | <x-slot name="header"> |
3 | 3 | <div class="flex justify-between items-center"> |
4 | | - <h2 class="text-2xl font-bold text-gray-900">Mijn Dashboard</h2> |
| 4 | + <h2 class="text-2xl font-bold text-gray-900">{{ auth()->user()->isAdmin() ? 'Admin Dashboard' : 'Mijn Dashboard' }}</h2> |
5 | 5 | <button onclick="window.location='{{ route('tickets.index') }}'" class="bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-4 rounded">Mijn tickets</button> |
6 | 6 | </div> |
7 | 7 | </x-slot> |
|
39 | 39 | </div> |
40 | 40 | </div> |
41 | 41 | </div> |
| 42 | + |
| 43 | + @if(auth()->user()->isAdmin()) |
| 44 | + <div class="py-8"> |
| 45 | + <div class="max-w-6xl mx-auto sm:px-6 lg:px-8"> |
| 46 | + <h3 class="text-xl font-bold text-gray-900 mb-6">Alle tickets</h3> |
| 47 | + |
| 48 | + @forelse($allTickets ?? collect() as $ticket) |
| 49 | + <div class="bg-white border border-gray-200 rounded-lg shadow-sm mb-4" x-data="{ open: false }"> |
| 50 | + <div class="p-5 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"> |
| 51 | + <div class="flex-1 min-w-0"> |
| 52 | + <div class="flex flex-wrap items-center gap-2 mb-1"> |
| 53 | + <span class="text-xs font-semibold px-2 py-0.5 rounded-full |
| 54 | + {{ $ticket->status === 'open' ? 'bg-yellow-100 text-yellow-800' : '' }} |
| 55 | + {{ $ticket->status === 'in_progress' ? 'bg-blue-100 text-blue-800' : '' }} |
| 56 | + {{ $ticket->status === 'closed' ? 'bg-green-100 text-green-800' : '' }} |
| 57 | + {{ !in_array($ticket->status, ['open','in_progress','closed']) ? 'bg-gray-100 text-gray-600' : '' }} |
| 58 | + "> |
| 59 | + {{ ucfirst(str_replace('_', ' ', $ticket->status ?? 'open')) }} |
| 60 | + </span> |
| 61 | + |
| 62 | + @if($ticket->priority) |
| 63 | + <span class="text-xs px-2 py-0.5 rounded-full |
| 64 | + {{ $ticket->priority === 'high' ? 'bg-red-100 text-red-700' : '' }} |
| 65 | + {{ $ticket->priority === 'medium' ? 'bg-orange-100 text-orange-700' : '' }} |
| 66 | + {{ $ticket->priority === 'low' ? 'bg-gray-100 text-gray-600' : '' }} |
| 67 | + ">{{ ucfirst($ticket->priority) }}</span> |
| 68 | + @endif |
| 69 | + |
| 70 | + @if($ticket->labels) |
| 71 | + @foreach(explode(',', $ticket->labels) as $label) |
| 72 | + <span class="text-xs bg-indigo-100 text-indigo-700 px-2 py-0.5 rounded-full">{{ trim($label) }}</span> |
| 73 | + @endforeach |
| 74 | + @endif |
| 75 | + </div> |
| 76 | + |
| 77 | + <a href="{{ route('tickets.show', $ticket) }}" class="font-semibold text-gray-900 hover:text-blue-600 truncate block"> |
| 78 | + #{{ $ticket->id }} — {{ $ticket->title }} |
| 79 | + </a> |
| 80 | + <p class="text-xs text-gray-400 mt-0.5">Door {{ $ticket->user->name }} · {{ $ticket->created_at->diffForHumans() }}</p> |
| 81 | + </div> |
| 82 | + |
| 83 | + <button @click="open = !open" |
| 84 | + class="flex items-center gap-1 text-sm text-blue-600 hover:text-blue-800 font-medium shrink-0"> |
| 85 | + <span x-text="open ? 'Verberg' : 'Reacties'"></span> |
| 86 | + <span class="text-xs bg-blue-100 text-blue-700 rounded-full px-2 py-0.5">{{ $ticket->comments->count() }}</span> |
| 87 | + <svg class="w-4 h-4 transition-transform" :class="open ? 'rotate-180' : ''" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 88 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/> |
| 89 | + </svg> |
| 90 | + </button> |
| 91 | + </div> |
| 92 | + |
| 93 | + <div x-show="open" x-cloak class="border-t border-gray-100 px-5 py-4 space-y-3 bg-gray-50 rounded-b-lg"> |
| 94 | + @forelse($ticket->comments as $comment) |
| 95 | + <div class="flex gap-3"> |
| 96 | + <div class="flex-shrink-0 w-8 h-8 rounded-full bg-blue-600 text-white flex items-center justify-center text-xs font-bold"> |
| 97 | + {{ strtoupper(substr($comment->user->name, 0, 1)) }} |
| 98 | + </div> |
| 99 | + <div class="flex-1"> |
| 100 | + <p class="text-xs font-semibold text-gray-700">{{ $comment->user->name }} |
| 101 | + <span class="font-normal text-gray-400 ml-1">{{ $comment->created_at->diffForHumans() }}</span> |
| 102 | + </p> |
| 103 | + <p class="text-sm text-gray-800 mt-0.5">{{ $comment->body }}</p> |
| 104 | + </div> |
| 105 | + </div> |
| 106 | + @empty |
| 107 | + <p class="text-sm text-gray-400">Nog geen reacties.</p> |
| 108 | + @endforelse |
| 109 | + |
| 110 | + <form action="{{ route('comments.store', $ticket) }}" method="POST" class="pt-2"> |
| 111 | + @csrf |
| 112 | + <div class="flex gap-2"> |
| 113 | + <input type="text" name="body" required placeholder="Schrijf een reactie..." |
| 114 | + class="flex-1 text-sm border border-gray-300 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> |
| 115 | + <button type="submit" |
| 116 | + class="bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium px-4 py-2 rounded"> |
| 117 | + Stuur |
| 118 | + </button> |
| 119 | + </div> |
| 120 | + </form> |
| 121 | + </div> |
| 122 | + </div> |
| 123 | + @empty |
| 124 | + <p class="text-gray-500">Er zijn nog geen tickets.</p> |
| 125 | + @endforelse |
| 126 | + </div> |
| 127 | + </div> |
| 128 | + @endif |
42 | 129 | </x-app-layout> |
43 | 130 |
|
44 | 131 | <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> |
|
0 commit comments