fixe duploads and attachments
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -37,19 +37,21 @@
|
||||
</div>
|
||||
</article>
|
||||
|
||||
@if ($ticket->attachments->isNotEmpty())
|
||||
<div class="rounded-2xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<h2 class="mb-4 text-base font-semibold text-zinc-900 dark:text-white">Ticket attachments</h2>
|
||||
<div class="grid gap-3 sm:grid-cols-2">
|
||||
@foreach ($ticket->attachments as $attachment)
|
||||
<a href="{{ $attachment->url() }}" target="_blank" class="rounded-xl border border-zinc-200 p-3 text-sm hover:bg-zinc-50 dark:border-zinc-700 dark:hover:bg-zinc-800">
|
||||
<div class="font-medium text-zinc-900 dark:text-zinc-100">{{ $attachment->original_name }}</div>
|
||||
<div class="text-xs text-zinc-500">{{ Number::fileSize($attachment->size) }}</div>
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="rounded-2xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<h2 class="mb-4 text-base font-semibold text-zinc-900 dark:text-white">Ticket attachments</h2>
|
||||
<div class="grid gap-3 sm:grid-cols-2">
|
||||
@forelse ($ticket->attachments as $attachment)
|
||||
<a href="{{ method_exists($attachment, 'url') ? $attachment->url() : Storage::disk($attachment->disk ?? 'public')->url($attachment->path ?? $attachment->file_path) }}" target="_blank" class="rounded-xl border border-zinc-200 p-3 text-sm hover:bg-zinc-50 dark:border-zinc-700 dark:hover:bg-zinc-800">
|
||||
<div class="font-medium text-zinc-900 dark:text-zinc-100">{{ $attachment->original_name ?? $attachment->original_filename ?? $attachment->filename ?? $attachment->file_name ?? basename($attachment->path ?? $attachment->file_path ?? '') }}</div>
|
||||
<div class="text-xs text-zinc-500">{{ Number::fileSize($attachment->size ?? $attachment->size_bytes ?? 0) }}</div>
|
||||
</a>
|
||||
@empty
|
||||
<div class="rounded-xl border border-dashed border-zinc-300 p-4 text-sm text-zinc-500 dark:border-zinc-700">
|
||||
No ticket-level attachments are currently saved.
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<section class="space-y-4">
|
||||
<h2 class="text-lg font-semibold text-zinc-900 dark:text-white">Conversation</h2>
|
||||
@@ -184,6 +186,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>
|
||||
<label class="mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-200" for="show_agent_id">Assigned agent</label>
|
||||
<select
|
||||
id="show_agent_id"
|
||||
wire:model.live="agent_id"
|
||||
class="block w-full rounded-lg border border-zinc-300 bg-white p-2 text-sm dark:border-zinc-700 dark:bg-zinc-950"
|
||||
data-dusk="ticket-show-agent"
|
||||
>
|
||||
<option value="">Unassigned</option>
|
||||
@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>
|
||||
<flux:button dusk="update-agent" wire:click="updateAgent" class="mt-4 mb-5 w-full !bg-emerald-600 !text-white hover:!bg-emerald-700 focus:!ring-emerald-400/60" variant="primary" icon="user">Update assigned agent</flux:button>
|
||||
|
||||
<flux:select wire:model="status_id" label="Status">
|
||||
@foreach ($statuses as $status)
|
||||
<option value="{{ $status->id }}">{{ $status->name }}</option>
|
||||
|
||||
Reference in New Issue
Block a user