Fix Issue ticket queue dropdown HTML breakage.
Deploy Ladill Queue / deploy (push) Successful in 2m0s

@json inside onchange terminated the attribute and broke the select; use a data-create-url attribute instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-17 19:59:53 +00:00
co-authored by Cursor
parent 74c7782cdf
commit f1edf8a19e
2 changed files with 64 additions and 52 deletions
+61 -51
View File
@@ -5,64 +5,74 @@
@endphp
<div class="mx-auto max-w-lg">
<h1 class="text-2xl font-semibold">Issue ticket</h1>
<form method="POST" action="{{ route('qms.tickets.store') }}" class="mt-6 space-y-4 rounded-2xl border bg-white p-6 dark:border-slate-700 dark:bg-slate-900">
@csrf
<div>
<label class="block text-sm font-medium">Queue</label>
<select
name="service_queue_id"
required
class="mt-1 w-full rounded-lg border-slate-300 text-sm"
onchange="window.location = @json(route('qms.tickets.create')).concat('?queue=', encodeURIComponent(this.value))"
>
@foreach ($queues as $queue)
<option value="{{ $queue->id }}" @selected($selectedQueueId === (int) $queue->id)>
{{ $queue->name }}{{ $queue->branch ? ' ('.$queue->branch->name.')' : '' }}
</option>
@endforeach
</select>
@error('service_queue_id')
<p class="mt-1 text-sm text-rose-600">{{ $message }}</p>
@enderror
</div>
@if ($needsPoint)
@if ($queues->isEmpty())
<div class="mt-6 rounded-2xl border border-amber-200 bg-amber-50 p-6 text-sm text-amber-900 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100">
<p class="font-medium">No active queues yet.</p>
<p class="mt-1">Create a queue first, then come back to issue tickets.</p>
<a href="{{ route('qms.service-queues.index') }}" class="mt-4 inline-flex text-sm font-medium text-indigo-600 hover:text-indigo-800">Go to queues </a>
</div>
@else
<form method="POST" action="{{ route('qms.tickets.store') }}" class="mt-6 space-y-4 rounded-2xl border bg-white p-6 dark:border-slate-700 dark:bg-slate-900">
@csrf
<div>
<label class="block text-sm font-medium">Service point</label>
<select name="assigned_counter_id" required class="mt-1 w-full rounded-lg border-slate-300 text-sm">
<option value="">Select service point</option>
@forelse ($selectedQueue->counters as $counter)
<option value="{{ $counter->id }}" @selected((string) old('assigned_counter_id') === (string) $counter->id)>
{{ $counter->name }}{{ $counter->code ? ' · '.$counter->code : '' }}
<label class="block text-sm font-medium">Queue</label>
<select
name="service_queue_id"
required
class="mt-1 w-full rounded-lg border-slate-300 text-sm"
data-create-url="{{ route('qms.tickets.create') }}"
onchange="window.location = this.dataset.createUrl + '?queue=' + encodeURIComponent(this.value)"
>
@foreach ($queues as $queue)
<option value="{{ $queue->id }}" @selected($selectedQueueId === (int) $queue->id)>
{{ $queue->name }}{{ $queue->branch ? ' ('.$queue->branch->name.')' : '' }}
</option>
@empty
<option value="" disabled>No service points linked to this queue</option>
@endforelse
@endforeach
</select>
<p class="mt-1 text-xs text-slate-500">This queue only serves tickets assigned to a desk or room.</p>
@error('assigned_counter_id')
@error('service_queue_id')
<p class="mt-1 text-sm text-rose-600">{{ $message }}</p>
@enderror
</div>
@endif
<div>
<label class="block text-sm font-medium">Customer name</label>
<input name="customer_name" value="{{ old('customer_name') }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<div>
<label class="block text-sm font-medium">Phone</label>
<input name="customer_phone" type="tel" value="{{ old('customer_phone') }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<div>
<label class="block text-sm font-medium">Priority</label>
<select name="priority" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
@foreach (config('qms.ticket_priorities') as $value => $label)
<option value="{{ $value }}" @selected(old('priority', 'walk_in') === $value)>{{ $label }}</option>
@endforeach
</select>
</div>
<button type="submit" class="btn-primary w-full">Issue ticket</button>
</form>
@if ($needsPoint)
<div>
<label class="block text-sm font-medium">Service point</label>
<select name="assigned_counter_id" required class="mt-1 w-full rounded-lg border-slate-300 text-sm">
<option value="">Select service point</option>
@forelse ($selectedQueue->counters as $counter)
<option value="{{ $counter->id }}" @selected((string) old('assigned_counter_id') === (string) $counter->id)>
{{ $counter->name }}{{ $counter->code ? ' · '.$counter->code : '' }}
</option>
@empty
<option value="" disabled>No service points linked to this queue</option>
@endforelse
</select>
<p class="mt-1 text-xs text-slate-500">This queue only serves tickets assigned to a desk or room.</p>
@error('assigned_counter_id')
<p class="mt-1 text-sm text-rose-600">{{ $message }}</p>
@enderror
</div>
@endif
<div>
<label class="block text-sm font-medium">Customer name</label>
<input name="customer_name" value="{{ old('customer_name') }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<div>
<label class="block text-sm font-medium">Phone</label>
<input name="customer_phone" type="tel" value="{{ old('customer_phone') }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<div>
<label class="block text-sm font-medium">Priority</label>
<select name="priority" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
@foreach (config('qms.ticket_priorities') as $value => $label)
<option value="{{ $value }}" @selected(old('priority', 'walk_in') === $value)>{{ $label }}</option>
@endforeach
</select>
</div>
<button type="submit" class="btn-primary w-full">Issue ticket</button>
</form>
@endif
</div>
</x-app-layout>
+3 -1
View File
@@ -125,8 +125,10 @@ class ServicePointRoutingTest extends TestCase
->get(route('qms.tickets.create', ['queue' => $queue->id]))
->assertOk()
->assertSee('Service point')
->assertSee('data-create-url', false)
->assertDontSee('needsPoint')
->assertDontSee('onQueueChange');
->assertDontSee('onQueueChange')
->assertDontSee('@json');
}
public function test_web_issue_without_service_point_returns_validation_error_not_500(): void