started to add indexes and fixed N+1 issue

This commit is contained in:
Mark Gregory
2026-06-12 14:28:25 +01:00
parent e79a029bed
commit 49340d42af
9 changed files with 469 additions and 255 deletions
@@ -1,23 +1,16 @@
<div class="mx-auto max-w-7xl space-y-6" dusk="helpdesk-kanban-board">
<div class="mx-auto max-w-[1800px] space-y-6" dusk="helpdesk-kanban-board">
<div class="overflow-hidden rounded-3xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="bg-gradient-to-br from-slate-950 via-slate-900 to-blue-950 px-6 py-7 text-white">
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
<div>
<p class="text-xs font-semibold uppercase tracking-[0.28em] text-blue-200">Helpdesk workflow</p>
<h1 class="mt-2 text-3xl font-semibold tracking-tight">Kanban board</h1>
<p class="mt-2 max-w-3xl text-sm text-blue-100/90">
Move tickets through your configured statuses, keep priorities visible and trigger workflow notifications when work changes state.
</p>
<p class="mt-2 max-w-3xl text-sm text-blue-100/90">Drag tickets between configured statuses. Add, rename and order boards from Helpdesk Settings → Statuses.</p>
</div>
<div class="flex flex-wrap gap-2">
<flux:button :href="route('helpdesk.tickets.create')" wire:navigate variant="primary" icon="plus">
New ticket
</flux:button>
<flux:button :href="route('helpdesk.tickets.index')" wire:navigate variant="ghost" icon="list-bullet">
List view
</flux:button>
<flux:button :href="route('helpdesk.tickets.create')" wire:navigate variant="primary" icon="plus">New ticket</flux:button>
<flux:button :href="route('helpdesk.settings')" wire:navigate variant="ghost" icon="cog-6-tooth">Configure boards</flux:button>
<flux:button :href="route('helpdesk.tickets.index')" wire:navigate variant="ghost" icon="list-bullet">List view</flux:button>
</div>
</div>
</div>
@@ -29,130 +22,120 @@
</div>
@endif
<div class="grid gap-4 overflow-x-auto lg:grid-cols-{{ max(1, min(5, $statuses->count())) }}">
<div
class="flex gap-4 overflow-x-auto pb-4"
x-data="{
draggedTicketId: null,
draggingOverStatusId: null,
dragStart(event) {
this.draggedTicketId = event.currentTarget.dataset.ticketId;
event.dataTransfer.effectAllowed = 'move';
event.dataTransfer.setData('text/plain', this.draggedTicketId);
event.currentTarget.classList.add('opacity-60', 'rotate-1');
},
dragEnd(event) {
event.currentTarget.classList.remove('opacity-60', 'rotate-1');
this.draggedTicketId = null;
this.draggingOverStatusId = null;
},
dragOver(event, statusId) {
event.preventDefault();
this.draggingOverStatusId = String(statusId);
event.dataTransfer.dropEffect = 'move';
},
dragLeave(statusId) {
if (this.draggingOverStatusId === String(statusId)) {
this.draggingOverStatusId = null;
}
},
drop(event, statusId) {
event.preventDefault();
const ticketId = event.dataTransfer.getData('text/plain') || this.draggedTicketId;
this.draggingOverStatusId = null;
if (!ticketId) {
return;
}
$wire.moveTicket(parseInt(ticketId, 10), parseInt(statusId, 10));
}
}"
>
@foreach ($statuses as $status)
@php($tickets = $ticketsByStatus[$status->id] ?? collect())
<section
class="min-w-[280px] rounded-2xl border border-zinc-200 bg-zinc-50 shadow-sm dark:border-zinc-700 dark:bg-zinc-950"
class="flex min-h-[640px] w-[340px] shrink-0 flex-col overflow-hidden rounded-2xl border border-zinc-200 bg-zinc-100 shadow-sm dark:border-zinc-700 dark:bg-zinc-950"
x-bind:class="draggingOverStatusId === '{{ $status->id }}' ? 'ring-2 ring-blue-500 ring-offset-2 dark:ring-offset-zinc-950' : ''"
x-on:dragover="dragOver($event, {{ $status->id }})"
x-on:dragleave="dragLeave({{ $status->id }})"
x-on:drop="drop($event, {{ $status->id }})"
dusk="kanban-column-{{ $status->slug }}"
>
<header class="flex items-center justify-between border-b border-zinc-200 bg-white px-4 py-3 dark:border-zinc-800 dark:bg-zinc-900">
<div>
<h2 class="text-sm font-semibold text-zinc-900 dark:text-zinc-100">{{ $status->name }}</h2>
<p class="text-xs text-zinc-500">{{ $tickets->count() }} tickets</p>
<header class="border-b border-zinc-200 bg-white px-4 py-4 dark:border-zinc-800 dark:bg-zinc-900">
<div class="flex items-start justify-between gap-3">
<div>
<div class="flex items-center gap-2">
<span class="inline-flex h-3 w-3 rounded-full" style="background-color: {{ $status->color }}"></span>
<h2 class="text-sm font-semibold text-zinc-900 dark:text-zinc-100">{{ $status->name }}</h2>
</div>
<p class="mt-1 text-xs text-zinc-500">{{ $tickets->count() }} tickets</p>
</div>
@if ($status->is_closed)
<span class="rounded-full bg-emerald-100 px-2 py-1 text-xs font-semibold text-emerald-700 dark:bg-emerald-950 dark:text-emerald-200">Closed</span>
@endif
</div>
<span class="inline-flex h-3 w-3 rounded-full" style="background-color: {{ $status->color }}"></span>
</header>
<div
class="min-h-[180px] space-y-3 p-3"
data-helpdesk-kanban-column
data-status-id="{{ $status->id }}"
>
<div class="flex-1 space-y-3 overflow-y-auto p-3">
@forelse ($tickets as $ticket)
<article
class="cursor-grab rounded-xl border border-zinc-200 bg-white p-4 shadow-sm active:cursor-grabbing dark:border-zinc-800 dark:bg-zinc-900"
data-helpdesk-kanban-ticket
wire:key="kanban-ticket-{{ $ticket->id }}"
draggable="true"
x-on:dragstart="dragStart($event)"
x-on:dragend="dragEnd($event)"
class="group cursor-grab rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm transition hover:-translate-y-0.5 hover:shadow-md active:cursor-grabbing dark:border-zinc-800 dark:bg-zinc-900"
data-ticket-id="{{ $ticket->id }}"
dusk="kanban-ticket-{{ $ticket->id }}"
>
<div class="flex items-start justify-between gap-3">
<div>
<a
href="{{ route('helpdesk.tickets.show', $ticket) }}"
wire:navigate
class="text-sm font-semibold text-blue-700 hover:underline dark:text-blue-300"
>
{{ $ticket->reference }}
</a>
<h3 class="mt-1 line-clamp-2 text-sm font-medium text-zinc-900 dark:text-zinc-100">
{{ $ticket->subject }}
</h3>
<div class="min-w-0">
<div class="flex items-center gap-2">
<span class="font-mono text-xs font-semibold text-blue-700 dark:text-blue-300">{{ $ticket->reference }}</span>
<span class="text-xs text-zinc-400">⋮⋮</span>
</div>
<h3 class="mt-2 line-clamp-3 text-sm font-semibold text-zinc-900 dark:text-zinc-100">{{ $ticket->subject }}</h3>
</div>
@if ($ticket->priority)
<span class="rounded-full px-2 py-1 text-xs font-semibold text-white" style="background-color: {{ $ticket->priority->color }}">
{{ $ticket->priority->name }}
</span>
<span class="shrink-0 rounded-full px-2 py-1 text-xs font-semibold text-white" style="background-color: {{ $ticket->priority->color }}">{{ $ticket->priority->name }}</span>
@endif
</div>
<div class="mt-3 space-y-1 text-xs text-zinc-500 dark:text-zinc-400">
<div>Owner: {{ $ticket->owner?->name ?? 'Unknown' }}</div>
<div>Agent: {{ $ticket->agent?->name ?? 'Unassigned' }}</div>
@if ($ticket->project)
<div>Project: {{ $ticket->project->title }}</div>
@endif
@if ($ticket->team)
<div>Team: {{ $ticket->team->name }}</div>
@endif
</div>
<div class="mt-4 grid grid-cols-2 gap-2">
@foreach ($statuses as $targetStatus)
@continue($targetStatus->id === $status->id)
<button
type="button"
wire:click="moveTicket({{ $ticket->id }}, {{ $targetStatus->id }})"
class="rounded-lg border border-zinc-200 px-2 py-1 text-xs font-medium text-zinc-700 hover:bg-zinc-100 dark:border-zinc-700 dark:text-zinc-200 dark:hover:bg-zinc-800"
>
{{ $targetStatus->name }}
</button>
@endforeach
<div class="mt-4 flex items-center justify-between gap-2 border-t border-zinc-100 pt-3 dark:border-zinc-800">
<a href="{{ route('helpdesk.tickets.show', $ticket) }}" wire:navigate class="rounded-lg bg-blue-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-blue-700">Open</a>
@can('update', $ticket)
<a href="{{ route('helpdesk.tickets.edit', $ticket) }}" wire:navigate class="rounded-lg bg-emerald-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-emerald-700">Edit</a>
@endcan
</div>
</article>
@empty
<div class="rounded-xl border border-dashed border-zinc-300 bg-white p-6 text-center text-sm text-zinc-500 dark:border-zinc-700 dark:bg-zinc-900">
No tickets in {{ $status->name }}.
Drop tickets here to move them to {{ $status->name }}.
</div>
@endforelse
</div>
</section>
@endforeach
</div>
@script
<script>
const initialiseHelpdeskKanban = function () {
if (!window.Sortable) {
return;
}
document.querySelectorAll('[data-helpdesk-kanban-column]').forEach(function (column) {
if (column.dataset.sortableReady === '1') {
return;
}
column.dataset.sortableReady = '1';
new window.Sortable(column, {
group: 'helpdesk-kanban',
animation: 150,
draggable: '[data-helpdesk-kanban-ticket]',
filter: 'a, button',
preventOnFilter: false,
onEnd: function (event) {
const ticketId = event.item.dataset.ticketId;
const statusId = event.to.dataset.statusId;
if (!ticketId || !statusId) {
return;
}
$wire.moveTicket(ticketId, statusId);
},
});
});
};
initialiseHelpdeskKanban();
document.addEventListener('livewire:navigated', initialiseHelpdeskKanban);
</script>
@endscript
</div>
@@ -1,105 +0,0 @@
<div class="space-y-6">
@include('helpdesk::partials.page-header', [
'eyebrow' => 'Helpdesk',
'title' => 'Create Ticket',
'subtitle' => 'Raise a new support request with priority, project, category, team and full details.',
])
<form method="POST" action="{{ route('helpdesk.tickets.store') }}" enctype="multipart/form-data" wire:submit.prevent="save" class="space-y-6">
@csrf
<div class="rounded-2xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="border-b border-zinc-200 px-6 py-4 dark:border-zinc-700">
<h2 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100">Ticket details</h2>
<p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Capture the request clearly so the support workflow can route and notify correctly.</p>
</div>
<div class="grid gap-6 p-6 lg:grid-cols-2">
<div class="lg:col-span-2">
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="subject">Subject</label>
<input id="subject" name="subject" type="text" wire:model.defer="subject" value="{{ old('subject', $subject) }}" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-subject">
@error('subject') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
@if($companies->isNotEmpty())
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="company_id">Company</label>
<select id="company_id" name="company_id" wire:model.defer="company_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
<option value="">Select company</option>
@foreach ($companies as $company)
<option value="{{ $company->id }}">{{ $company->name }}</option>
@endforeach
</select>
@error('company_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
@endif
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="priority_id">Priority</label>
<select id="priority_id" name="priority_id" wire:model.defer="priority_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-priority">
<option value="">Select priority</option>
@foreach ($priorities as $priority)
<option value="{{ $priority->id }}">{{ $priority->name }}</option>
@endforeach
</select>
@error('priority_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="category_id">Category</label>
<select id="category_id" name="category_id" wire:model.defer="category_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
<option value="">Select category</option>
@foreach ($categories as $category)
<option value="{{ $category->id }}">{{ $category->name }}</option>
@endforeach
</select>
@error('category_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="project_id">Project</label>
<select id="project_id" name="project_id" wire:model.defer="project_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
<option value="">Select project</option>
@foreach ($projects as $project)
<option value="{{ $project->id }}">{{ $project->title ?? $project->name }}</option>
@endforeach
</select>
@error('project_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="team_id">Team</label>
<select id="team_id" name="team_id" wire:model.defer="team_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
<option value="">Select team</option>
@foreach ($teams as $team)
<option value="{{ $team->id }}">{{ $team->name }}</option>
@endforeach
</select>
@error('team_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="due_at">Due date</label>
<input id="due_at" name="due_at" type="date" wire:model.defer="due_at" value="{{ old('due_at', $due_at) }}" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
@error('due_at') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div class="lg:col-span-2">
<x-helpdesk::html-editor dusk="ticket-body-editor" wire:model="body" label="Details" rows="10" placeholder="Describe the issue, expected outcome, steps to reproduce and any useful context..." />
</div>
<div class="lg:col-span-2">
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="attachments">Attachments</label>
<input id="attachments" name="attachments[]" type="file" wire:model="attachments" multiple class="mt-2 block w-full rounded-xl border border-zinc-300 bg-white px-3 py-2 text-sm shadow-sm dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
@error('attachments') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
@error('attachments.*') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
</div>
<div class="flex items-center justify-end gap-3 border-t border-zinc-200 px-6 py-4 dark:border-zinc-700">
<a href="{{ route('helpdesk.tickets.index') }}" class="rounded-xl border border-zinc-300 px-4 py-2 text-sm font-semibold text-zinc-700 hover:bg-zinc-50 dark:border-zinc-700 dark:text-zinc-200 dark:hover:bg-zinc-800">Cancel</a>
<button type="submit" class="rounded-xl bg-blue-600 px-5 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-700" data-dusk="ticket-create-submit">Create Ticket</button>
</div>
</div>
</form>
</div>
@@ -0,0 +1,116 @@
<div class="space-y-6" dusk="helpdesk-ticket-edit">
@include('helpdesk::partials.page-header', [
'eyebrow' => 'Helpdesk',
'title' => 'Edit Ticket',
'subtitle' => 'Update assignment, workflow status, priority, project, team and ticket content.',
])
<form wire:submit.prevent="save" class="space-y-6">
<div class="rounded-2xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="border-b border-zinc-200 px-6 py-4 dark:border-zinc-700">
<h2 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100">Ticket information</h2>
<p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Changes are applied to the ticket and workflow notifications are triggered where configured.</p>
</div>
<div class="grid gap-6 p-6 lg:grid-cols-2">
<div class="lg:col-span-2">
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="subject">Subject</label>
<input id="subject" type="text" wire:model.defer="subject" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-edit-subject">
@error('subject') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
@if($companies->isNotEmpty())
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="company_id">Company</label>
<select id="company_id" wire:model.defer="company_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
<option value="">No company</option>
@foreach ($companies as $company)
<option value="{{ $company->id }}">{{ $company->name }}</option>
@endforeach
</select>
@error('company_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
@endif
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="agent_id">Assigned agent</label>
<select id="agent_id" wire:model.defer="agent_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-edit-agent">
<option value="">Unassigned</option>
@foreach ($agents as $agent)
<option value="{{ $agent->id }}">{{ $agent->name }}{{ $agent->email ? ' — '.$agent->email : '' }}</option>
@endforeach
</select>
@error('agent_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="status_id">Status</label>
<select id="status_id" wire:model.defer="status_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-edit-status">
@foreach ($statuses as $status)
<option value="{{ $status->id }}">{{ $status->name }}</option>
@endforeach
</select>
@error('status_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="priority_id">Priority</label>
<select id="priority_id" wire:model.defer="priority_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
@foreach ($priorities as $priority)
<option value="{{ $priority->id }}">{{ $priority->name }}</option>
@endforeach
</select>
@error('priority_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="category_id">Category</label>
<select id="category_id" wire:model.defer="category_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
<option value="">No category</option>
@foreach ($categories as $category)
<option value="{{ $category->id }}">{{ $category->name }}</option>
@endforeach
</select>
@error('category_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="project_id">Project</label>
<select id="project_id" wire:model.defer="project_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
<option value="">No project</option>
@foreach ($projects as $project)
<option value="{{ $project->id }}">{{ $project->title ?? $project->name }}</option>
@endforeach
</select>
@error('project_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="team_id">Team</label>
<select id="team_id" wire:model.defer="team_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
<option value="">No team</option>
@foreach ($teams as $team)
<option value="{{ $team->id }}">{{ $team->name }}</option>
@endforeach
</select>
@error('team_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="due_at">Due date</label>
<input id="due_at" type="date" wire:model.defer="due_at" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
@error('due_at') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div class="lg:col-span-2">
<x-helpdesk::html-editor dusk="ticket-edit-body-editor" wire:model="body" label="Details" rows="10" placeholder="Describe the request, steps, expected outcome and current status..." />
</div>
</div>
<div class="flex items-center justify-end gap-3 border-t border-zinc-200 px-6 py-4 dark:border-zinc-700">
<a href="{{ route('helpdesk.tickets.show', $ticket) }}" wire:navigate class="rounded-xl bg-blue-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-700">Back</a>
<button type="submit" class="rounded-xl bg-emerald-600 px-5 py-2 text-sm font-semibold text-white shadow-sm hover:bg-emerald-700" data-dusk="ticket-edit-submit">Save Ticket</button>
</div>
</div>
</form>
</div>
@@ -11,7 +11,12 @@
<h1 class="text-3xl font-semibold tracking-tight">{{ $ticket->subject }}</h1>
<p class="mt-2 text-sm text-blue-100/90">Raised by {{ $ticket->owner?->name ?? 'Unknown user' }} · Assigned to {{ $ticket->agent?->name ?? 'Unassigned' }}</p>
</div>
<flux:button :href="route('helpdesk.tickets.index')" wire:navigate icon="arrow-left" variant="ghost">Back</flux:button>
<div class="flex flex-wrap gap-2">
<a href="{{ route('helpdesk.tickets.index') }}" wire:navigate class="inline-flex items-center rounded-xl bg-blue-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-700">Back</a>
@can('update', $ticket)
<a href="{{ route('helpdesk.tickets.edit', $ticket) }}" wire:navigate class="inline-flex items-center rounded-xl bg-emerald-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-emerald-700">Edit</a>
@endcan
</div>
</div>
</div>
</div>
@@ -102,12 +107,22 @@
@can('update', $ticket)
<div class="rounded-2xl border border-zinc-200 bg-white p-5 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<h2 class="mb-4 text-base font-semibold text-zinc-900 dark:text-white">Agent actions</h2>
<flux:select wire:model="agent_id" label="Assigned agent">
<option value="">Unassigned</option>
@foreach ($agents as $agent)
<option value="{{ $agent->id }}">{{ $agent->name }}</option>
@endforeach
</flux:select>
<flux:button dusk="update-agent" wire:click="updateAssignment" class="mt-4 w-full" variant="ghost" icon="user">Update assignment</flux:button>
<div class="mt-5">
<flux:select wire:model="status_id" label="Status">
@foreach ($statuses as $status)
<option value="{{ $status->id }}">{{ $status->name }}</option>
@endforeach
</flux:select>
<flux:button dusk="update-status" wire:click="updateStatus" class="mt-4 w-full" variant="primary" icon="check">Update status</flux:button>
</div>
<div class="mt-5">
<flux:select wire:model="priority_id" label="Priority">
@foreach ($priorities as $priority)