fixe duploads and attachments

This commit is contained in:
Mark Gregory
2026-06-16 18:25:54 +01:00
parent c008fc67dc
commit bcd133e27a
4 changed files with 276 additions and 33 deletions
@@ -170,19 +170,19 @@
<div class="xl:col-span-2">
<label class="block text-sm font-semibold text-zinc-200" for="agent_id">Assigned agent</label>
<div class="mt-2" wire:ignore>
<div class="mt-2">
<select
id="agent_id"
data-helpdesk-select2
data-placeholder="Select option"
data-wire-model="agent_id"
wire:model.live="agent_id"
class="block w-full rounded-xl border-zinc-700 bg-zinc-950 text-zinc-100 shadow-sm focus:border-blue-500 focus:ring-blue-500"
data-dusk="ticket-edit-agent"
>
<option value="">Unassigned</option>
@foreach ($agents as $agent)
<option value="{{ $agent->id }}" @selected((string) $agent_id === (string) $agent->id)>{{ $agent->name }} · {{ $agent->email }}</option>
@endforeach
@forelse ($agents as $agent)
<option value="{{ $agent->id }}">{{ $agent->name }} · {{ $agent->email }}</option>
@empty
<option value="" disabled>No users available for assignment</option>
@endforelse
</select>
</div>
@@ -374,6 +374,42 @@
Uploading attachments...
</div>
<div class="mt-4 space-y-3">
<h3 class="text-sm font-semibold text-zinc-200">Existing attachments</h3>
@forelse ($ticket->attachments as $attachment)
<div class="flex flex-col gap-3 rounded-xl border border-zinc-700 bg-zinc-900 p-3 text-sm sm:flex-row sm:items-center sm:justify-between">
<a
href="{{ method_exists($attachment, 'url') ? $attachment->url() : Storage::disk($attachment->disk ?? 'public')->url($attachment->path ?? $attachment->file_path) }}"
target="_blank"
class="min-w-0 font-medium text-blue-300 hover:text-blue-200"
>
<i class="fa-regular fa-file mr-2" aria-hidden="true"></i>
{{ $attachment->original_name ?? $attachment->original_filename ?? $attachment->filename ?? $attachment->file_name ?? basename($attachment->path ?? $attachment->file_path ?? '') }}
</a>
<button
type="button"
wire:click="removeAttachment({{ $attachment->id }})"
wire:confirm="Remove this attachment?"
class="inline-flex items-center justify-center rounded-lg bg-red-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-red-700"
>
Remove
</button>
</div>
@empty
<div class="rounded-xl border border-dashed border-zinc-700 bg-zinc-900 px-4 py-3 text-sm text-zinc-400">
No ticket-level attachments are currently saved.
</div>
@endforelse
</div>
@if ($attachments !== [])
<div class="mt-4 rounded-xl border border-blue-500/30 bg-blue-500/10 px-4 py-3 text-sm text-blue-100">
{{ count($attachments) }} new attachment(s) selected. Save the ticket to attach them.
</div>
@endif
@error('attachments')
<p class="mt-3 text-sm text-red-500">{{ $message }}</p>
@enderror