v1.0.0
This commit is contained in:
114
src/resources/views/livewire/admin/api-keys.blade.php
Normal file
114
src/resources/views/livewire/admin/api-keys.blade.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<div>
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:14px">
|
||||
<h3 style="margin:0">Klucze API</h3>
|
||||
<div style="display:flex;gap:8px">
|
||||
<a class="btn btn-secondary" href="/admin/api-docs" target="_blank" rel="noopener">Dokumentacja API</a>
|
||||
<button class="btn btn-primary" type="button" wire:click="openForm">+ Nowy klucz</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="text-muted" style="font-size:12.5px;margin:0 0 14px">
|
||||
Klucze API reprezentują niezależne integracje zewnętrzne (nie są przypisane do konkretnego użytkownika). Zgłoszenia i wiadomości utworzone przez klucz zachowują się jak zgłoszenia gościa — identyfikowane e-mailem i imieniem podanym w żądaniu.
|
||||
</p>
|
||||
|
||||
@if ($newTokenPlaintext)
|
||||
<div class="card" style="padding:14px 16px;margin-bottom:16px;border-color:var(--color-success);gap:8px"
|
||||
x-data="{ copied: false }">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;gap:8px">
|
||||
<span class="card-title" style="color:var(--color-success)">Klucz „{{ $newTokenClientName }}” utworzony</span>
|
||||
<button type="button" class="btn btn-ghost" wire:click="dismissNewToken">Zamknij</button>
|
||||
</div>
|
||||
<p class="text-muted" style="font-size:12.5px;margin:0">Skopiuj ten token teraz — nie zostanie ponownie pokazany.</p>
|
||||
<div style="display:flex;gap:8px;align-items:center">
|
||||
<code style="flex:1;padding:8px 10px;border:1px solid var(--color-divider);border-radius:6px;background:color-mix(in srgb, var(--color-text) 5%, var(--color-bg));font-size:12.5px;word-break:break-all">{{ $newTokenPlaintext }}</code>
|
||||
<button type="button" class="btn btn-secondary" style="white-space:nowrap"
|
||||
x-on:click="navigator.clipboard.writeText(@js($newTokenPlaintext)); copied = true; setTimeout(() => copied = false, 1500)"
|
||||
x-text="copied ? 'Skopiowano!' : 'Kopiuj'"></button>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($this->apiClients->isNotEmpty())
|
||||
<div class="table-wrap">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nazwa</th>
|
||||
<th>Opis</th>
|
||||
<th>Uprawnienia</th>
|
||||
<th>Utworzono</th>
|
||||
<th>Ostatnio użyto</th>
|
||||
<th>Status</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($this->apiClients as $client)
|
||||
@php $token = $client->tokens->first(); @endphp
|
||||
<tr>
|
||||
<td style="white-space:nowrap">{{ $client->name }}</td>
|
||||
<td class="text-muted">{{ $client->description ?: '—' }}</td>
|
||||
<td style="min-width:220px">
|
||||
@foreach ($token?->abilities ?? [] as $ability)
|
||||
<span class="tag tag-outline" style="margin:0 4px 4px 0">{{ $ability }}</span>
|
||||
@endforeach
|
||||
</td>
|
||||
<td style="white-space:nowrap">{{ $client->created_at->format('Y-m-d H:i') }}</td>
|
||||
<td style="white-space:nowrap">{{ $token?->last_used_at?->format('Y-m-d H:i') ?? 'Nigdy' }}</td>
|
||||
<td>
|
||||
@if ($client->isRevoked() || ! $token)
|
||||
<span class="tag" style="background:color-mix(in srgb, var(--color-danger) 18%, transparent);color:var(--color-danger)">Odwołany</span>
|
||||
@else
|
||||
<span class="tag" style="background:color-mix(in srgb, var(--color-success) 18%, transparent);color:var(--color-success)">Aktywny</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<div style="display:flex;gap:6px;justify-content:flex-end">
|
||||
<button class="btn btn-ghost" type="button" wire:click="regenerate({{ $client->id }})" wire:confirm="Odwołać bieżący token i wygenerować nowy?">Regeneruj</button>
|
||||
@unless ($client->isRevoked())
|
||||
<button class="btn btn-ghost" type="button" wire:click="revoke({{ $client->id }})" wire:confirm="Odwołać ten klucz? Token przestanie działać natychmiast.">Odwołaj</button>
|
||||
@endunless
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@else
|
||||
<p class="text-muted" style="font-size:13px">Brak kluczy API. Utwórz pierwszy używając przycisku wyżej.</p>
|
||||
@endif
|
||||
|
||||
@if ($formOpen)
|
||||
<div class="dialog-backdrop">
|
||||
<form wire:submit="submit" class="dialog" style="max-width:480px">
|
||||
<div class="dialog-title">Nowy klucz API</div>
|
||||
<div class="field">
|
||||
<label>Nazwa</label>
|
||||
<input class="input" wire:model="form.name" placeholder="np. Integracja z systemem monitoringu">
|
||||
</div>
|
||||
@error('form.name') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
<div class="field">
|
||||
<label>Opis (opcjonalnie)</label>
|
||||
<textarea class="input" style="min-height:70px" wire:model="form.description"></textarea>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Uprawnienia</label>
|
||||
<div style="display:flex;flex-direction:column;gap:6px">
|
||||
@foreach (static::availableAbilities() as $key => $label)
|
||||
<label style="display:flex;align-items:center;gap:8px;font-size:13px;font-weight:400">
|
||||
<input type="checkbox" wire:model="form.abilities" value="{{ $key }}">
|
||||
{{ $label }}
|
||||
</label>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@error('form.abilities') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
<div class="dialog-actions">
|
||||
<button class="btn btn-secondary" type="button" wire:click="closeForm">Anuluj</button>
|
||||
<button class="btn btn-primary" type="submit">Utwórz klucz</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
1004
src/resources/views/livewire/admin/panel.blade.php
Normal file
1004
src/resources/views/livewire/admin/panel.blade.php
Normal file
File diff suppressed because it is too large
Load Diff
27
src/resources/views/livewire/auth/login.blade.php
Normal file
27
src/resources/views/livewire/auth/login.blade.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<div style="flex:1;display:flex;flex-direction:column">
|
||||
<x-topbar>
|
||||
<a href="{{ url('/') }}" wire:navigate class="btn btn-secondary" style="font-size:12px;padding:6px 12px;text-decoration:none">Nowe zgłoszenie bez logowania</a>
|
||||
</x-topbar>
|
||||
|
||||
<div class="page-pad" style="flex:1;display:flex;justify-content:center;align-items:center;padding:40px 20px">
|
||||
<form wire:submit="submit" class="card elev-md" style="width:100%;max-width:380px;padding:28px;gap:16px">
|
||||
<img src="{{ \App\Support\Settings::logoUrl() }}" alt="{{ \App\Support\Settings::get('company_name') }}" style="height:56px;width:auto;align-self:center">
|
||||
<h2 style="margin:0;text-align:center">Zaloguj się</h2>
|
||||
<x-login-notice :html="\App\Support\Settings::get('login_notice_html')" :type="\App\Support\Settings::loginNoticeType()" />
|
||||
|
||||
@if ($error)
|
||||
<div class="tag" style="background:color-mix(in srgb, var(--color-danger) 18%, transparent);color:var(--color-danger)">{{ $error }}</div>
|
||||
@endif
|
||||
|
||||
<div class="field">
|
||||
<label>Nazwa użytkownika</label>
|
||||
<input class="input" wire:model="username" autofocus>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Hasło</label>
|
||||
<input class="input" type="password" wire:model="password">
|
||||
</div>
|
||||
<button class="btn btn-primary btn-block" type="submit">Zaloguj się</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
34
src/resources/views/livewire/client/dashboard.blade.php
Normal file
34
src/resources/views/livewire/client/dashboard.blade.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<div style="flex:1;display:flex;flex-direction:column">
|
||||
<x-topbar />
|
||||
|
||||
<div class="page-pad" style="flex:1;padding:28px;display:flex;flex-direction:column;gap:20px;max-width:920px;width:100%;margin:0 auto;box-sizing:border-box">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap">
|
||||
<h2 style="margin:0">Moje zgłoszenia</h2>
|
||||
<a href="{{ route('client.new') }}" wire:navigate class="btn btn-primary">+ Nowe zgłoszenie</a>
|
||||
</div>
|
||||
|
||||
<div class="seg" style="align-self:flex-start">
|
||||
<label class="seg-opt"><input type="radio" name="ctab" @checked($tab === 'current') wire:click="setTab('current')">Aktualne ({{ $this->currentTickets->count() }})</label>
|
||||
<label class="seg-opt"><input type="radio" name="ctab" @checked($tab === 'archive') wire:click="setTab('archive')">Archiwalne ({{ $this->archiveTickets->count() }})</label>
|
||||
</div>
|
||||
|
||||
<div style="display:flex;flex-direction:column;gap:10px">
|
||||
@foreach (($tab === 'current' ? $this->currentTickets : $this->archiveTickets) as $ticket)
|
||||
<a href="{{ route('client.ticket', $ticket) }}" wire:navigate class="card elev-sm" style="padding:16px;cursor:pointer;flex-direction:row;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;text-decoration:none;color:inherit">
|
||||
<div>
|
||||
<div style="font-weight:500">#{{ $ticket->number }} — {{ $ticket->subject }}</div>
|
||||
<div class="card-meta">{{ $ticket->categoryLabel() }} · {{ \App\Support\Rel::format($ticket->updated_at) }}</div>
|
||||
</div>
|
||||
<div style="display:flex;gap:6px">
|
||||
<span style="{{ $ticket->priorityStyle() }}">{{ $ticket->priorityLabel() }}</span>
|
||||
<span style="{{ $ticket->statusStyle() }}">{{ $ticket->statusLabel() }}</span>
|
||||
</div>
|
||||
</a>
|
||||
@endforeach
|
||||
|
||||
@if (($tab === 'current' ? $this->currentTickets : $this->archiveTickets)->isEmpty())
|
||||
<p class="text-muted" style="font-size:13px">Brak zgłoszeń w tej zakładce.</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
96
src/resources/views/livewire/client/new-ticket.blade.php
Normal file
96
src/resources/views/livewire/client/new-ticket.blade.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<div style="flex:1;display:flex;flex-direction:column">
|
||||
<x-topbar />
|
||||
|
||||
<div class="page-pad" style="flex:1;padding:28px;display:flex;flex-direction:column;gap:20px;max-width:920px;width:100%;margin:0 auto;box-sizing:border-box">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap">
|
||||
<h2 style="margin:0">Nowe zgłoszenie</h2>
|
||||
<a href="{{ route('client.dashboard') }}" wire:navigate class="btn btn-ghost">← Wróć do zgłoszeń</a>
|
||||
</div>
|
||||
|
||||
<div class="card" style="padding:16px 20px">
|
||||
<div class="field" style="margin:0">
|
||||
<label>Adres e-mail</label>
|
||||
<input class="input" value="{{ auth()->user()->email }}" disabled>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display:flex;align-items:flex-start;justify-content:center;padding:4px 8px">
|
||||
@foreach (['Dział', 'Kategoria', 'Szczegóły'] as $i => $label)
|
||||
@php $n = $i + 1; @endphp
|
||||
<div style="display:flex;align-items:center;flex:none">
|
||||
<div class="wizard-step" style="display:flex;flex-direction:column;align-items:center;gap:6px">
|
||||
<div style="width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:13px;flex:none;border:1.5px solid {{ $n <= $step ? 'var(--color-accent)' : 'var(--color-divider)' }};background:{{ $n < $step ? 'var(--color-accent-700)' : 'transparent' }};color:{{ $n < $step ? 'var(--color-accent-100)' : ($n === $step ? 'var(--color-accent)' : 'color-mix(in srgb, var(--color-text) 50%, transparent)') }}">{{ $n }}</div>
|
||||
<div style="font-size:11px;text-align:center">{{ $label }}</div>
|
||||
</div>
|
||||
@if (! $loop->last)
|
||||
<div class="wizard-connector" style="height:1px;margin:15px 8px 0;background:{{ $n < $step ? 'var(--color-accent)' : 'var(--color-divider)' }}"></div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@if ($step === 1)
|
||||
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px">
|
||||
@foreach ($this->categories as $category)
|
||||
<div class="card elev-sm" style="padding:20px;gap:10px;cursor:pointer" wire:click="selectCategory({{ $category->id }})">
|
||||
<div style="width:40px;height:40px;border-radius:50%;background:var(--color-accent-700);color:var(--color-accent-100);display:flex;align-items:center;justify-content:center;font-size:16px">{{ mb_strtoupper(mb_substr($category->name, 0, 1)) }}</div>
|
||||
<span class="card-title">{{ $category->name }}</span>
|
||||
<p class="card-body">{{ $category->description }}</p>
|
||||
<span class="card-meta">{{ $category->subcategories->count() }} podkategorie</span>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@elseif ($step === 2)
|
||||
<div style="display:flex;flex-direction:column;gap:10px">
|
||||
<button type="button" class="btn btn-ghost" style="align-self:flex-start;padding:0" wire:click="backToCategory">← Zmień kategorię</button>
|
||||
@foreach ($this->selectedCategory?->subcategories ?? [] as $sub)
|
||||
<div class="card elev-sm" style="padding:16px;flex-direction:row;align-items:center;justify-content:space-between;gap:12px;cursor:pointer" wire:click="selectSubcategory({{ $sub->id }})">
|
||||
<div>
|
||||
<div style="font-weight:500">{{ $sub->name }}</div>
|
||||
<div class="card-meta">{{ $sub->description }}</div>
|
||||
</div>
|
||||
<span class="text-muted" style="font-size:18px">→</span>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@elseif ($step === 3)
|
||||
<form wire:submit="submit" class="card elev-md" style="padding:24px;gap:16px">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center">
|
||||
<span class="tag tag-outline">{{ $this->selectedCategory?->name }} / {{ $this->selectedSubcategory?->name }}</span>
|
||||
<button type="button" class="btn btn-ghost" style="padding:0" wire:click="backToSubcategory">Zmień</button>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Temat</label>
|
||||
<input class="input" wire:model="subject">
|
||||
@error('subject') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Treść</label>
|
||||
<textarea class="input" wire:model="body"></textarea>
|
||||
@error('body') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
|
||||
@foreach ($this->selectedSubcategory?->customFields ?? [] as $field)
|
||||
<x-custom-field-input :field="$field" wire-model="customValues" />
|
||||
@endforeach
|
||||
|
||||
<div class="field">
|
||||
<label>Załączniki</label>
|
||||
<div style="border:1px dashed var(--color-divider);border-radius:8px;padding:14px;display:flex;flex-wrap:wrap;align-items:center;gap:10px">
|
||||
<label class="btn btn-secondary" style="cursor:pointer">Wybierz pliki<input type="file" multiple style="display:none" wire:model="attachments"></label>
|
||||
@forelse ($attachments as $i => $file)
|
||||
<span class="text-muted" style="font-size:13px;display:flex;align-items:center;gap:6px">
|
||||
{{ $file->getClientOriginalName() }}
|
||||
<span class="material-symbols-outlined" style="font-size:16px;cursor:pointer;opacity:0.7" wire:click="removeAttachment({{ $i }})">close</span>
|
||||
</span>
|
||||
@empty
|
||||
<span class="text-muted" style="font-size:13px">Brak plików</span>
|
||||
@endforelse
|
||||
</div>
|
||||
@error('attachments') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
<button class="btn btn-primary btn-block" type="submit">Utwórz zgłoszenie</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
137
src/resources/views/livewire/client/ticket-show.blade.php
Normal file
137
src/resources/views/livewire/client/ticket-show.blade.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<div style="flex:1;display:flex;flex-direction:column">
|
||||
<x-topbar />
|
||||
|
||||
<div class="page-pad" style="flex:1;padding:28px;display:flex;flex-direction:column;gap:20px;max-width:920px;width:100%;margin:0 auto;box-sizing:border-box">
|
||||
<a href="{{ route('client.dashboard') }}" wire:navigate class="btn btn-ghost" style="align-self:flex-start;padding:0">← Wróć do listy</a>
|
||||
|
||||
<div style="display:flex;gap:20px;align-items:flex-start;flex-wrap:wrap">
|
||||
<div class="main-col" style="display:flex;flex-direction:column;gap:16px">
|
||||
@php
|
||||
$firstMessage = $this->ticketMessages->first();
|
||||
$threadMessages = $this->ticketMessages->skip(1);
|
||||
@endphp
|
||||
|
||||
<div class="card" style="padding:22px;gap:10px">
|
||||
<div class="card-kicker">Zgłoszenie #{{ $ticket->number }}</div>
|
||||
<h2 style="margin:2px 0 0">{{ $ticket->subject }}</h2>
|
||||
<div class="card-meta">{{ $ticket->categoryLabel() }} · utworzono {{ \App\Support\Rel::format($ticket->created_at) }}</div>
|
||||
<div style="white-space:pre-wrap;font-size:14px;margin-top:4px">{{ $ticket->body }}</div>
|
||||
@foreach ($firstMessage?->attachments ?? [] as $a)
|
||||
<x-message-attachment :attachment="$a" />
|
||||
@endforeach
|
||||
@if (count($ticket->customFieldEntries()))
|
||||
<div style="display:flex;flex-direction:column;gap:2px;margin-top:2px">
|
||||
@foreach ($ticket->customFieldEntries() as $cf)
|
||||
<div style="font-size:14px"><strong>{{ $cf['label'] }}:</strong> {{ $cf['value'] }}</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div style="display:flex;flex-direction:column;gap:10px">
|
||||
@foreach ($threadMessages as $m)
|
||||
@php $mine = $m->role === 'client' && $m->author_id === auth()->id(); @endphp
|
||||
<div style="display:flex;justify-content:{{ $mine ? 'flex-end' : 'flex-start' }}">
|
||||
<div style="max-width:75%;padding:10px 14px;border-radius:12px;font-size:14px;background:{{ $mine ? 'var(--color-accent-800)' : 'var(--color-surface)' }};color:{{ $mine ? 'var(--color-accent-100)' : 'var(--color-text)' }};border:1px solid var(--color-divider)">
|
||||
<div style="display:flex;justify-content:space-between;align-items:flex-start;gap:10px">
|
||||
<div style="font-size:11px;opacity:0.65;margin-bottom:4px">{{ $m->author_name }} · {{ \App\Support\Rel::format($m->created_at) }}{{ $m->edited ? ' · edytowano' : '' }}</div>
|
||||
@if ($m->role === 'client' && $m->author_id === auth()->id())
|
||||
<div style="display:flex;gap:6px;flex:none">
|
||||
<span class="material-symbols-outlined" style="font-size:15px;cursor:pointer;opacity:0.7" wire:click="startEdit({{ $m->id }}, @js($m->body))">edit</span>
|
||||
<span class="material-symbols-outlined" style="font-size:15px;cursor:pointer;opacity:0.7" wire:click="requestDelete({{ $m->id }})">delete</span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@if ($editingMessageId === $m->id)
|
||||
<textarea class="input" wire:model="editingDraft"></textarea>
|
||||
<div style="display:flex;gap:8px;margin-top:6px">
|
||||
<button type="button" class="btn btn-secondary" wire:click="cancelEdit">Anuluj</button>
|
||||
<button type="button" class="btn btn-primary" wire:click="saveEdit">Zapisz</button>
|
||||
</div>
|
||||
@else
|
||||
<div style="white-space:pre-wrap">{{ $m->body }}</div>
|
||||
@endif
|
||||
@foreach ($m->attachments as $a)
|
||||
<x-message-attachment :attachment="$a" />
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<form wire:submit="sendReply" class="card" style="padding:16px;gap:10px">
|
||||
<textarea class="input" placeholder="Napisz odpowiedź…" wire:model="reply"></textarea>
|
||||
@error('reply') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
<div style="display:flex;align-items:center;gap:10px">
|
||||
<div style="flex:1;min-width:0;border:1px dashed var(--color-divider);border-radius:8px;padding:10px 14px;display:flex;flex-wrap:wrap;align-items:center;gap:10px">
|
||||
<label class="btn btn-secondary" style="cursor:pointer;flex:none">Załącz pliki<input type="file" multiple style="display:none" wire:model="attachments"></label>
|
||||
@forelse ($attachments as $i => $file)
|
||||
<span class="text-muted" style="font-size:13px;display:flex;align-items:center;gap:6px;min-width:0">
|
||||
<span class="material-symbols-outlined" style="font-size:16px;flex:none">attach_file</span>
|
||||
<span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap">{{ $file->getClientOriginalName() }}</span>
|
||||
<span class="material-symbols-outlined" style="font-size:16px;cursor:pointer;opacity:0.7;flex:none" wire:click="removeAttachment({{ $i }})">close</span>
|
||||
</span>
|
||||
@empty
|
||||
<span class="text-muted" style="font-size:13px">Brak załączników</span>
|
||||
@endforelse
|
||||
</div>
|
||||
<button class="btn btn-primary" style="flex:none" type="submit">Wyślij odpowiedź</button>
|
||||
</div>
|
||||
@error('attachments') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="aside-col" style="display:flex;flex-direction:column;gap:14px">
|
||||
<div class="card" style="padding:16px;gap:8px">
|
||||
<div class="card-kicker">Twoje dane</div>
|
||||
<div style="font-size:14px;font-weight:500">{{ auth()->user()->name }}</div>
|
||||
<div class="text-muted" style="font-size:13px">{{ auth()->user()->email }}</div>
|
||||
</div>
|
||||
<div class="card" style="padding:16px;gap:10px">
|
||||
<div class="card-kicker">Status i priorytet</div>
|
||||
<div style="display:flex;gap:6px">
|
||||
<span style="{{ $ticket->priorityStyle() }}">{{ $ticket->priorityLabel() }}</span>
|
||||
<span style="{{ $ticket->statusStyle() }}">{{ $ticket->statusLabel() }}</span>
|
||||
</div>
|
||||
@if (! $ticket->isClosed())
|
||||
<button type="button" class="btn btn-secondary btn-block" wire:click="close">Zamknij zgłoszenie</button>
|
||||
@elseif ($ticket->isClosed())
|
||||
<button type="button" class="btn btn-secondary btn-block" wire:click="reopen">Otwórz ponownie</button>
|
||||
@endif
|
||||
</div>
|
||||
<div class="card" style="padding:16px;gap:8px">
|
||||
<div class="card-kicker">Historia zmian</div>
|
||||
@forelse ($ticket->histories as $h)
|
||||
<div style="font-size:12.5px"><span>{{ $h->text }}</span><div class="text-muted" style="font-size:11px">{{ \App\Support\Rel::format($h->created_at) }}</div></div>
|
||||
@empty
|
||||
<p class="text-muted" style="font-size:12px;margin:0">Brak historii zmian.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
<div class="card" style="padding:16px;gap:8px">
|
||||
<div class="card-kicker">Inne Twoje zgłoszenia</div>
|
||||
@forelse ($this->otherTickets as $ot)
|
||||
<a href="{{ route('client.ticket', $ot) }}" wire:navigate style="display:flex;justify-content:space-between;align-items:center;gap:8px;cursor:pointer;text-decoration:none;color:inherit">
|
||||
<span style="font-size:13px">#{{ $ot->number }} — {{ $ot->subject }}</span>
|
||||
<span style="{{ $ot->statusStyle() }};flex:none">{{ $ot->statusLabel() }}</span>
|
||||
</a>
|
||||
@empty
|
||||
<p class="text-muted" style="font-size:12px;margin:0">Brak innych zgłoszeń.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($pendingDeleteMessageId)
|
||||
<div class="dialog-backdrop">
|
||||
<div class="dialog" style="max-width:400px">
|
||||
<div class="dialog-title">Potwierdź usunięcie</div>
|
||||
<div class="dialog-body">Czy na pewno usunąć tę wiadomość?</div>
|
||||
<div class="dialog-actions">
|
||||
<button type="button" class="btn btn-secondary" wire:click="cancelDelete">Anuluj</button>
|
||||
<button type="button" class="btn btn-primary" wire:click="confirmDelete">Usuń</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
128
src/resources/views/livewire/landing.blade.php
Normal file
128
src/resources/views/livewire/landing.blade.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<div style="flex:1;display:flex;flex-direction:column">
|
||||
<x-topbar>
|
||||
<a href="{{ url('/login') }}" wire:navigate class="btn btn-secondary" style="font-size:12px;padding:6px 12px;text-decoration:none">Zaloguj się</a>
|
||||
</x-topbar>
|
||||
|
||||
<div class="page-pad" style="flex:1;display:flex;justify-content:center;padding:48px 20px 80px">
|
||||
<div style="width:100%;max-width:640px;display:flex;flex-direction:column;gap:28px">
|
||||
|
||||
@if ($this->submittedTicket)
|
||||
<div class="card elev-md" style="padding:32px;gap:14px;text-align:left">
|
||||
<span class="tag tag-accent" style="align-self:flex-start">Zgłoszenie przyjęte</span>
|
||||
<h2 style="margin:0">Zgłoszenie #{{ $this->submittedTicket->number }} zostało utworzone</h2>
|
||||
<p class="text-muted" style="margin:0">Zapisz numer zgłoszenia i adres e-mail — będziesz mógł/mogła sprawdzić status, kontaktując się z zespołem wsparcia. Aktualizacje będziemy wysyłać na Twój adres e-mail.</p>
|
||||
<div class="hr"></div>
|
||||
<div style="display:flex;flex-direction:column;gap:4px;font-size:14px">
|
||||
<div><strong>Numer zgłoszenia:</strong> #{{ $this->submittedTicket->number }}</div>
|
||||
<div><strong>Temat:</strong> {{ $this->submittedTicket->subject }}</div>
|
||||
<div><strong>Kategoria:</strong> {{ $this->submittedTicket->categoryLabel() }}</div>
|
||||
<div><strong>Zgłaszający:</strong> {{ $this->submittedTicket->email }}</div>
|
||||
<div><strong>Status:</strong> <span style="{{ $this->submittedTicket->statusStyle() }}">{{ $this->submittedTicket->statusLabel() }}</span></div>
|
||||
<div><strong>Priorytet:</strong> <span style="{{ $this->submittedTicket->priorityStyle() }}">{{ $this->submittedTicket->priorityLabel() }}</span></div>
|
||||
<div><strong>Data zgłoszenia:</strong> {{ $this->submittedTicket->created_at->format('d.m.Y H:i') }}</div>
|
||||
</div>
|
||||
|
||||
@if ($this->submittedTicket->customer_id)
|
||||
<div class="hr"></div>
|
||||
<p class="text-muted" style="margin:0;font-size:13px">Ten adres e-mail ma już konto w systemie — zaloguj się, aby śledzić postęp zgłoszenia online, otrzymywać powiadomienia w panelu i odpowiadać bezpośrednio w rozmowie.</p>
|
||||
<a href="{{ route('login', ['redirect' => route('client.ticket', $this->submittedTicket)]) }}" wire:navigate class="btn btn-primary" style="align-self:flex-start;text-decoration:none">Zaloguj się i przejdź do zgłoszenia</a>
|
||||
@endif
|
||||
|
||||
<button class="btn btn-secondary" style="align-self:flex-start" wire:click="resetForm">Utwórz kolejne zgłoszenie</button>
|
||||
</div>
|
||||
@else
|
||||
<div style="display:flex;flex-direction:column;gap:8px">
|
||||
<h1 style="margin:0">Jak możemy pomóc?</h1>
|
||||
<p class="text-muted" style="margin:0;font-size:15px">Utwórz zgłoszenie bez logowania — podaj adres e-mail, na który wyślemy aktualizacje.</p>
|
||||
</div>
|
||||
|
||||
<div class="card" style="padding:16px 20px">
|
||||
<div class="field" style="margin:0">
|
||||
<label>Adres e-mail</label>
|
||||
<input class="input" type="email" placeholder="ty@firma.pl" wire:model="email">
|
||||
@error('email') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display:flex;align-items:flex-start;justify-content:center;padding:4px 8px;gap:0">
|
||||
@foreach (['Dział', 'Kategoria', 'Szczegóły'] as $i => $label)
|
||||
@php $n = $i + 1; @endphp
|
||||
<div style="display:flex;align-items:center;flex:none">
|
||||
<div class="wizard-step" style="display:flex;flex-direction:column;align-items:center;gap:6px">
|
||||
<div style="width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:13px;flex:none;border:1.5px solid {{ $n < $step ? 'var(--color-accent)' : ($n === $step ? 'var(--color-accent)' : 'var(--color-divider)') }};background:{{ $n < $step ? 'var(--color-accent-700)' : 'transparent' }};color:{{ $n < $step ? 'var(--color-accent-100)' : ($n === $step ? 'var(--color-accent)' : 'color-mix(in srgb, var(--color-text) 50%, transparent)') }}">{{ $n }}</div>
|
||||
<div style="font-size:11px;text-align:center;color:{{ $n <= $step ? 'var(--color-text)' : 'color-mix(in srgb, var(--color-text) 50%, transparent)' }}">{{ $label }}</div>
|
||||
</div>
|
||||
@if (! $loop->last)
|
||||
<div class="wizard-connector" style="height:1px;margin:15px 8px 0;background:{{ $n < $step ? 'var(--color-accent)' : 'var(--color-divider)' }}"></div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@if ($step === 1)
|
||||
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px">
|
||||
@foreach ($this->categories as $category)
|
||||
<div class="card elev-sm" style="padding:20px;gap:10px;cursor:pointer" wire:click="selectCategory({{ $category->id }})">
|
||||
<div style="width:40px;height:40px;border-radius:50%;background:var(--color-accent-700);color:var(--color-accent-100);display:flex;align-items:center;justify-content:center;font-size:16px">{{ mb_strtoupper(mb_substr($category->name, 0, 1)) }}</div>
|
||||
<span class="card-title">{{ $category->name }}</span>
|
||||
<p class="card-body">{{ $category->description }}</p>
|
||||
<span class="card-meta">{{ $category->subcategories->count() }} podkategorie</span>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@elseif ($step === 2)
|
||||
<div style="display:flex;flex-direction:column;gap:10px">
|
||||
<button type="button" class="btn btn-ghost" style="align-self:flex-start;padding:0" wire:click="backToCategory">← Zmień kategorię</button>
|
||||
@foreach ($this->selectedCategory?->subcategories ?? [] as $sub)
|
||||
<div class="card elev-sm" style="padding:16px;flex-direction:row;align-items:center;justify-content:space-between;gap:12px;cursor:pointer" wire:click="selectSubcategory({{ $sub->id }})">
|
||||
<div>
|
||||
<div style="font-weight:500">{{ $sub->name }}</div>
|
||||
<div class="card-meta">{{ $sub->description }}</div>
|
||||
</div>
|
||||
<span class="text-muted" style="font-size:18px">→</span>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@elseif ($step === 3)
|
||||
<form wire:submit="submit" class="card elev-md" style="padding:24px;gap:16px">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center">
|
||||
<span class="tag tag-outline">{{ $this->selectedCategory?->name }} / {{ $this->selectedSubcategory?->name }}</span>
|
||||
<button type="button" class="btn btn-ghost" style="padding:0" wire:click="backToSubcategory">Zmień</button>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Temat</label>
|
||||
<input class="input" placeholder="Krótki opis problemu" wire:model="subject">
|
||||
@error('subject') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Treść</label>
|
||||
<textarea class="input" placeholder="Opisz problem — im więcej szczegółów, tym szybciej pomożemy" wire:model="body"></textarea>
|
||||
@error('body') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
|
||||
@foreach ($this->selectedSubcategory?->customFields ?? [] as $field)
|
||||
<x-custom-field-input :field="$field" wire-model="customValues" />
|
||||
@endforeach
|
||||
|
||||
<div class="field">
|
||||
<label>Załączniki</label>
|
||||
<div style="border:1px dashed var(--color-divider);border-radius:8px;padding:14px;display:flex;flex-wrap:wrap;align-items:center;gap:10px">
|
||||
<label class="btn btn-secondary" style="cursor:pointer">Wybierz pliki<input type="file" multiple style="display:none" wire:model="attachments"></label>
|
||||
@forelse ($attachments as $i => $file)
|
||||
<span class="text-muted" style="font-size:13px;display:flex;align-items:center;gap:6px">
|
||||
{{ $file->getClientOriginalName() }}
|
||||
<span class="material-symbols-outlined" style="font-size:16px;cursor:pointer;opacity:0.7" wire:click="removeAttachment({{ $i }})">close</span>
|
||||
</span>
|
||||
@empty
|
||||
<span class="text-muted" style="font-size:13px">Brak plików</span>
|
||||
@endforelse
|
||||
</div>
|
||||
@error('attachments') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
<button class="btn btn-primary btn-block" type="submit">Wyślij zgłoszenie</button>
|
||||
</form>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
102
src/resources/views/livewire/operator/new-ticket.blade.php
Normal file
102
src/resources/views/livewire/operator/new-ticket.blade.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<div style="flex:1;display:flex;flex-direction:column">
|
||||
<x-topbar />
|
||||
|
||||
<div class="page-pad" style="flex:1;padding:28px;display:flex;flex-direction:column;gap:20px;max-width:920px;width:100%;margin:0 auto;box-sizing:border-box">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap">
|
||||
<h2 style="margin:0">Zgłoszenie w imieniu klienta</h2>
|
||||
<a href="{{ route('operator.queue') }}" wire:navigate class="btn btn-ghost">← Wróć do listy</a>
|
||||
</div>
|
||||
|
||||
<div class="card" style="padding:16px 20px">
|
||||
<div class="field" style="margin:0">
|
||||
<label>Klient</label>
|
||||
<select class="input" wire:model="customerId">
|
||||
<option value="">Wybierz klienta</option>
|
||||
@foreach ($this->clients as $cl)
|
||||
<option value="{{ $cl->id }}">{{ $cl->name }} ({{ $cl->email }})</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('customerId') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display:flex;align-items:flex-start;justify-content:center;padding:4px 8px">
|
||||
@foreach (['Dział', 'Kategoria', 'Szczegóły'] as $i => $label)
|
||||
@php $n = $i + 1; @endphp
|
||||
<div style="display:flex;align-items:center;flex:none">
|
||||
<div class="wizard-step" style="display:flex;flex-direction:column;align-items:center;gap:6px">
|
||||
<div style="width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:13px;flex:none;border:1.5px solid {{ $n <= $step ? 'var(--color-accent)' : 'var(--color-divider)' }};background:{{ $n < $step ? 'var(--color-accent-700)' : 'transparent' }};color:{{ $n < $step ? 'var(--color-accent-100)' : ($n === $step ? 'var(--color-accent)' : 'color-mix(in srgb, var(--color-text) 50%, transparent)') }}">{{ $n }}</div>
|
||||
<div style="font-size:11px;text-align:center">{{ $label }}</div>
|
||||
</div>
|
||||
@if (! $loop->last)
|
||||
<div class="wizard-connector" style="height:1px;margin:15px 8px 0;background:{{ $n < $step ? 'var(--color-accent)' : 'var(--color-divider)' }}"></div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@if ($step === 1)
|
||||
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px">
|
||||
@foreach ($this->categories as $category)
|
||||
<div class="card elev-sm" style="padding:20px;gap:10px;cursor:pointer" wire:click="selectCategory({{ $category->id }})">
|
||||
<div style="width:40px;height:40px;border-radius:50%;background:var(--color-accent-700);color:var(--color-accent-100);display:flex;align-items:center;justify-content:center;font-size:16px">{{ mb_strtoupper(mb_substr($category->name, 0, 1)) }}</div>
|
||||
<span class="card-title">{{ $category->name }}</span>
|
||||
<p class="card-body">{{ $category->description }}</p>
|
||||
<span class="card-meta">{{ $category->subcategories->count() }} podkategorie</span>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@elseif ($step === 2)
|
||||
<div style="display:flex;flex-direction:column;gap:10px">
|
||||
<button type="button" class="btn btn-ghost" style="align-self:flex-start;padding:0" wire:click="backToCategory">← Zmień kategorię</button>
|
||||
@foreach ($this->selectedCategory?->subcategories ?? [] as $sub)
|
||||
<div class="card elev-sm" style="padding:16px;flex-direction:row;align-items:center;justify-content:space-between;gap:12px;cursor:pointer" wire:click="selectSubcategory({{ $sub->id }})">
|
||||
<div>
|
||||
<div style="font-weight:500">{{ $sub->name }}</div>
|
||||
<div class="card-meta">{{ $sub->description }}</div>
|
||||
</div>
|
||||
<span class="text-muted" style="font-size:18px">→</span>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@elseif ($step === 3)
|
||||
<form wire:submit="submit" class="card elev-md" style="padding:24px;gap:16px">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center">
|
||||
<span class="tag tag-outline">{{ $this->selectedCategory?->name }} / {{ $this->selectedSubcategory?->name }}</span>
|
||||
<button type="button" class="btn btn-ghost" style="padding:0" wire:click="backToSubcategory">Zmień</button>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Temat</label>
|
||||
<input class="input" wire:model="subject">
|
||||
@error('subject') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Treść</label>
|
||||
<textarea class="input" wire:model="body"></textarea>
|
||||
@error('body') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
|
||||
@foreach ($this->selectedSubcategory?->customFields ?? [] as $field)
|
||||
<x-custom-field-input :field="$field" wire-model="customValues" />
|
||||
@endforeach
|
||||
|
||||
<div class="field">
|
||||
<label>Załączniki</label>
|
||||
<div style="border:1px dashed var(--color-divider);border-radius:8px;padding:14px;display:flex;flex-wrap:wrap;align-items:center;gap:10px">
|
||||
<label class="btn btn-secondary" style="cursor:pointer">Wybierz pliki<input type="file" multiple style="display:none" wire:model="attachments"></label>
|
||||
@forelse ($attachments as $i => $file)
|
||||
<span class="text-muted" style="font-size:13px;display:flex;align-items:center;gap:6px">
|
||||
{{ $file->getClientOriginalName() }}
|
||||
<span class="material-symbols-outlined" style="font-size:16px;cursor:pointer;opacity:0.7" wire:click="removeAttachment({{ $i }})">close</span>
|
||||
</span>
|
||||
@empty
|
||||
<span class="text-muted" style="font-size:13px">Brak plików</span>
|
||||
@endforelse
|
||||
</div>
|
||||
@error('attachments') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
<button class="btn btn-primary btn-block" type="submit">Utwórz zgłoszenie</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
167
src/resources/views/livewire/operator/queue.blade.php
Normal file
167
src/resources/views/livewire/operator/queue.blade.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<div style="flex:1;display:flex;flex-direction:column">
|
||||
<x-topbar />
|
||||
|
||||
<div class="app-split" style="flex:1;display:flex;min-height:0">
|
||||
<div
|
||||
class="side-rail"
|
||||
style="padding:10px;gap:6px;background:color-mix(in srgb, var(--color-text) 5%, var(--color-bg))"
|
||||
x-data="{ collapsed: localStorage.getItem('operatorSidebarCollapsed') === '1' }"
|
||||
x-effect="localStorage.setItem('operatorSidebarCollapsed', collapsed ? '1' : '0')"
|
||||
:class="collapsed ? 'side-rail-collapsed' : ''"
|
||||
>
|
||||
<button type="button" class="side-rail-toggle" @click="collapsed = ! collapsed" :title="collapsed ? 'Rozwiń panel' : 'Zwiń panel'">
|
||||
<span class="material-symbols-outlined" style="font-size:18px" x-text="collapsed ? 'left_panel_open' : 'left_panel_close'"></span>
|
||||
<span class="side-rail-toggle-label" x-text="collapsed ? 'Przegląd' : 'Zwiń panel'"></span>
|
||||
</button>
|
||||
|
||||
<div class="side-rail-scroll">
|
||||
@foreach ($this->queueGroups as $groupLabel => $items)
|
||||
<div style="display:flex;flex-direction:column;gap:1px">
|
||||
<div class="side-rail-group-label" style="font-size:10px;letter-spacing:0.09em;text-transform:uppercase;color:color-mix(in srgb, var(--color-text) 45%, transparent);padding:4px 12px 6px;white-space:nowrap">{{ $groupLabel }}</div>
|
||||
@foreach ($items as $item)
|
||||
<button type="button" class="side-rail-item" wire:click="setQueue('{{ $item['key'] }}')" title="{{ $item['label'] }}" style="display:flex;align-items:center;gap:10px;width:100%;padding:8px 12px;border-radius:6px;border:none;cursor:pointer;font-size:13.5px;text-align:left;white-space:nowrap;background:{{ $item['active'] ? 'color-mix(in srgb, var(--color-accent) 14%, transparent)' : 'transparent' }};color:{{ $item['active'] ? 'var(--color-accent)' : 'var(--color-text)' }}">
|
||||
<span class="material-symbols-outlined" style="font-size:18px">{{ $item['icon'] }}</span>
|
||||
<span class="side-rail-label">{{ $item['label'] }}</span>
|
||||
<span class="side-rail-count" style="margin-left:auto;font-size:11px;padding:1px 7px;border-radius:10px;background:{{ $item['active'] ? 'color-mix(in srgb, var(--color-accent) 25%, transparent)' : 'color-mix(in srgb, var(--color-text) 12%, transparent)' }};color:{{ $item['active'] ? 'var(--color-accent)' : 'color-mix(in srgb, var(--color-text) 70%, transparent)' }}">{{ $item['count'] }}</span>
|
||||
</button>
|
||||
@endforeach
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-pad" style="flex:1;min-width:0;padding:20px 24px;overflow:auto">
|
||||
<div class="queue-toolbar">
|
||||
@if ($this->filteredCustomer)
|
||||
<button type="button" class="btn btn-ghost" wire:click="clearCustomerFilter">Wyczyść filtr</button>
|
||||
@endif
|
||||
<div class="queue-actions">
|
||||
<div class="queue-actions-pair">
|
||||
<button type="button" class="btn btn-secondary" @disabled(count($selectedIds) < 2) wire:click="mergeSelected">Scal zgłoszenia ({{ count($selectedIds) }})</button>
|
||||
<button type="button" class="btn btn-secondary" @disabled(count($selectedIds) < 1) wire:click="requestDeleteSelected" style="color:var(--color-danger)">Usuń zgłoszenia ({{ count($selectedIds) }})</button>
|
||||
</div>
|
||||
<a href="{{ route('operator.stats') }}" wire:navigate class="btn btn-secondary" style="display:flex;align-items:center;gap:6px">
|
||||
<span class="material-symbols-outlined" style="font-size:18px">bar_chart</span>
|
||||
Statystyki
|
||||
</a>
|
||||
<a href="{{ route('operator.new') }}" wire:navigate class="btn btn-primary">+ Zgłoszenie w imieniu klienta</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@php
|
||||
$columnDefs = $this->columnDefs();
|
||||
$sortableColumns = $this->sortableColumns();
|
||||
@endphp
|
||||
|
||||
<div class="queue-filters">
|
||||
<input class="input queue-filters-search" type="search" placeholder="Szukaj po numerze, temacie, kliencie…" wire:model.live.debounce.400ms="search">
|
||||
<select class="input" style="width:auto" wire:model.live="filterStatus">
|
||||
<option value="all">Wszystkie statusy</option>
|
||||
@foreach ($this->filterableStatuses as $s)
|
||||
<option value="{{ $s->key }}">{{ $s->label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<select class="input" style="width:auto" wire:model.live="filterPriority">
|
||||
<option value="all">Wszystkie priorytety</option>
|
||||
@foreach ($this->priorities as $p)
|
||||
<option value="{{ $p->key }}">{{ $p->label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<select class="input" style="width:auto" wire:model.live="filterCategory">
|
||||
<option value="all">Wszystkie kategorie</option>
|
||||
@foreach ($this->categories as $c)
|
||||
<option value="{{ $c->id }}">{{ $c->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
<div class="queue-filters-columns" x-data="{ open: false }">
|
||||
<button type="button" class="btn btn-secondary" @click="open = ! open" style="display:flex;align-items:center;justify-content:center;gap:6px">
|
||||
<span class="material-symbols-outlined" style="font-size:18px">view_column</span>
|
||||
Kolumny
|
||||
</button>
|
||||
<div x-show="open" x-cloak @click.outside="open = false" style="position:absolute;top:100%;right:0;margin-top:4px;background:var(--color-surface);border:1px solid var(--color-divider);border-radius:8px;box-shadow:var(--shadow-md);z-index:30;padding:6px;min-width:180px">
|
||||
@foreach ($columnDefs as $key => $label)
|
||||
<label style="display:flex;align-items:center;gap:8px;font-size:13px;font-weight:400;padding:6px 8px;border-radius:5px;cursor:pointer">
|
||||
<input type="checkbox" @checked(in_array($key, $visibleColumns)) wire:click="toggleColumn('{{ $key }}')">
|
||||
{{ $label }}
|
||||
</label>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-wrap">
|
||||
<table class="table table-cards-mobile">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
@foreach ($columnDefs as $key => $label)
|
||||
@continue(! in_array($key, $visibleColumns))
|
||||
<th>
|
||||
@if (in_array($key, $sortableColumns))
|
||||
<button type="button" wire:click="sortByColumn('{{ $key }}')" style="display:inline-flex;align-items:center;gap:2px;background:none;border:none;cursor:pointer;padding:0;font:inherit;color:inherit;text-transform:inherit;letter-spacing:inherit">
|
||||
{{ $label }}
|
||||
@if ($sortBy === $key)
|
||||
<span class="material-symbols-outlined" style="font-size:15px">{{ $sortDir === 'asc' ? 'arrow_upward' : 'arrow_downward' }}</span>
|
||||
@endif
|
||||
</button>
|
||||
@else
|
||||
{{ $label }}
|
||||
@endif
|
||||
</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($this->filteredTickets as $t)
|
||||
@php $sla = $t->slaInfo(); @endphp
|
||||
<tr>
|
||||
<td class="td-select"><input type="checkbox" @checked(in_array($t->id, $selectedIds)) wire:click="toggleSelect({{ $t->id }})"></td>
|
||||
@if (in_array('number', $visibleColumns))
|
||||
<td data-label="Numer" class="td-title"><a href="{{ route('operator.ticket', $t) }}" wire:navigate style="color:inherit;text-decoration:none;cursor:pointer">{{ $t->number }}</a></td>
|
||||
@endif
|
||||
@if (in_array('subject', $visibleColumns))
|
||||
<td data-label="Temat" class="td-title"><a href="{{ route('operator.ticket', $t) }}" wire:navigate style="color:inherit;text-decoration:none;cursor:pointer;white-space:nowrap">{{ $t->subject }}</a></td>
|
||||
@endif
|
||||
@if (in_array('customer', $visibleColumns))
|
||||
<td data-label="Klient" style="white-space:nowrap">{{ $t->name }}</td>
|
||||
@endif
|
||||
@if (in_array('category', $visibleColumns))
|
||||
<td data-label="Kategoria" style="white-space:nowrap">{{ $t->categoryLabel() }}</td>
|
||||
@endif
|
||||
@if (in_array('priority', $visibleColumns))
|
||||
<td data-label="Priorytet"><span style="{{ $t->priorityStyle() }}">{{ $t->priorityLabel() }}</span></td>
|
||||
@endif
|
||||
@if (in_array('status', $visibleColumns))
|
||||
<td data-label="Status"><span style="{{ $t->statusStyle() }}">{{ $t->statusLabel() }}</span></td>
|
||||
@endif
|
||||
@if (in_array('sla', $visibleColumns))
|
||||
<td data-label="SLA"><span class="{{ $sla['cls'] }}">{{ $sla['short'] }}</span></td>
|
||||
@endif
|
||||
@if (in_array('assignee', $visibleColumns))
|
||||
<td data-label="Przypisany" style="white-space:nowrap">{{ $t->assignee?->name ?? 'Nieprzypisane' }}</td>
|
||||
@endif
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($pendingDeleteSelected)
|
||||
<div class="dialog-backdrop">
|
||||
<div class="dialog" style="max-width:400px">
|
||||
<div class="dialog-title">Potwierdź usunięcie</div>
|
||||
<div class="dialog-body">
|
||||
{{ count($selectedIds) === 1 ? 'Wybrane zgłoszenie zostanie trwale usunięte.' : 'Wybrane zgłoszenia ('.count($selectedIds).') zostaną trwale usunięte.' }}
|
||||
</div>
|
||||
<div class="dialog-actions">
|
||||
<button class="btn btn-secondary" wire:click="cancelDeleteSelected">Anuluj</button>
|
||||
<button class="btn btn-primary" wire:click="confirmDeleteSelected">Usuń</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
217
src/resources/views/livewire/operator/stats.blade.php
Normal file
217
src/resources/views/livewire/operator/stats.blade.php
Normal file
@@ -0,0 +1,217 @@
|
||||
<div style="flex:1;display:flex;flex-direction:column">
|
||||
<x-topbar />
|
||||
|
||||
<div class="page-pad" style="flex:1;padding:20px 24px;overflow:auto;display:flex;flex-direction:column;gap:20px">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap">
|
||||
<h2 style="margin:0">Statystyki</h2>
|
||||
<a href="{{ route('operator.queue') }}" wire:navigate class="btn btn-ghost">← Wróć do listy</a>
|
||||
</div>
|
||||
|
||||
{{-- Filters --}}
|
||||
<div class="card" style="padding:14px 16px;flex-direction:row;flex-wrap:wrap;gap:10px;align-items:center">
|
||||
<select class="input" style="width:auto" wire:model.live="range">
|
||||
<option value="today">Dziś</option>
|
||||
<option value="7d">Ostatnie 7 dni</option>
|
||||
<option value="30d">Ostatnie 30 dni</option>
|
||||
<option value="90d">Ostatnie 90 dni</option>
|
||||
<option value="all">Cały okres</option>
|
||||
<option value="custom">Zakres niestandardowy</option>
|
||||
</select>
|
||||
|
||||
@if ($range === 'custom')
|
||||
<input type="date" class="input" style="width:auto" wire:model.live="from">
|
||||
<span style="color:color-mix(in srgb, var(--color-text) 50%, transparent)">–</span>
|
||||
<input type="date" class="input" style="width:auto" wire:model.live="to">
|
||||
@endif
|
||||
|
||||
<select class="input" style="width:auto" wire:model.live="filterTeam">
|
||||
<option value="all">Wszystkie zespoły</option>
|
||||
@foreach ($this->teams as $t)
|
||||
<option value="{{ $t->id }}">{{ $t->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
<select class="input" style="width:auto" wire:model.live="filterPriority">
|
||||
<option value="all">Wszystkie priorytety</option>
|
||||
@foreach ($this->priorities as $p)
|
||||
<option value="{{ $p->key }}">{{ $p->label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
<select class="input" style="width:auto" wire:model.live="filterCategory">
|
||||
<option value="all">Wszystkie kategorie</option>
|
||||
@foreach ($this->categories as $c)
|
||||
<option value="{{ $c->id }}">{{ $c->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
<select class="input" style="width:auto" wire:model.live="filterAssignee">
|
||||
<option value="all">Wszyscy operatorzy</option>
|
||||
<option value="unassigned">Nieprzypisane</option>
|
||||
@foreach ($this->operators as $u)
|
||||
<option value="{{ $u->id }}">{{ $u->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{-- KPI tiles --}}
|
||||
@php($kpis = $this->kpis)
|
||||
<div style="display:grid;grid-template-columns:repeat(auto-fit, minmax(160px, 1fr));gap:12px">
|
||||
<div class="stat-tile">
|
||||
<div class="stat-tile-label">Łącznie zgłoszeń</div>
|
||||
<div class="stat-tile-value">{{ $kpis['total'] }}</div>
|
||||
</div>
|
||||
<div class="stat-tile">
|
||||
<div class="stat-tile-label">Otwarte</div>
|
||||
<div class="stat-tile-value">{{ $kpis['open'] }}</div>
|
||||
</div>
|
||||
<div class="stat-tile">
|
||||
<div class="stat-tile-label">Zamknięte</div>
|
||||
<div class="stat-tile-value">{{ $kpis['closed'] }}</div>
|
||||
<div class="stat-tile-meta">{{ $kpis['closedPct'] !== null ? $kpis['closedPct'].'% wszystkich' : 'Brak danych' }}</div>
|
||||
</div>
|
||||
<div class="stat-tile">
|
||||
<div class="stat-tile-label">Śr. czas 1. odpowiedzi</div>
|
||||
<div class="stat-tile-value">{{ $kpis['avgFirstResponseHours'] !== null ? $kpis['avgFirstResponseHours'].' godz.' : '—' }}</div>
|
||||
</div>
|
||||
<div class="stat-tile">
|
||||
<div class="stat-tile-label">Śr. czas rozwiązania</div>
|
||||
<div class="stat-tile-value">{{ $kpis['avgResolutionHours'] !== null ? $kpis['avgResolutionHours'].' godz.' : '—' }}</div>
|
||||
</div>
|
||||
<div class="stat-tile">
|
||||
<div class="stat-tile-label">Naruszenia SLA</div>
|
||||
<div class="stat-tile-value" style="{{ ($kpis['sla']['rate'] ?? 0) > 0 ? 'color:var(--color-danger)' : '' }}">
|
||||
{{ $kpis['sla']['rate'] !== null ? $kpis['sla']['rate'].'%' : '—' }}
|
||||
</div>
|
||||
<div class="stat-tile-meta">{{ $kpis['sla']['breached'] }} / {{ $kpis['sla']['total'] }} zgłoszeń</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display:grid;grid-template-columns:repeat(auto-fit, minmax(340px, 1fr));gap:16px;align-items:start">
|
||||
{{-- By status --}}
|
||||
<div class="card" style="padding:16px">
|
||||
<div class="card-title" style="margin-bottom:12px">Zgłoszenia wg statusu</div>
|
||||
@php($max = max($this->byStatus->max('count'), 1))
|
||||
@forelse ($this->byStatus as $row)
|
||||
<div class="bar-row" title="{{ $row['label'] }}: {{ $row['count'] }}">
|
||||
<div class="bar-row-label">{{ $row['label'] }}</div>
|
||||
<div class="bar-track"><div class="bar-fill" style="width:{{ $row['count'] / $max * 100 }}%;background:{{ $row['color'] }}"></div></div>
|
||||
<div class="bar-row-value">{{ $row['count'] }}</div>
|
||||
</div>
|
||||
@empty
|
||||
<div class="card-meta">Brak danych w wybranym okresie.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
{{-- By priority --}}
|
||||
<div class="card" style="padding:16px">
|
||||
<div class="card-title" style="margin-bottom:12px">Zgłoszenia wg priorytetu</div>
|
||||
@php($max = max($this->byPriority->max('count'), 1))
|
||||
@forelse ($this->byPriority as $row)
|
||||
<div class="bar-row" title="{{ $row['label'] }}: {{ $row['count'] }}">
|
||||
<div class="bar-row-label">{{ $row['label'] }}</div>
|
||||
<div class="bar-track"><div class="bar-fill" style="width:{{ $row['count'] / $max * 100 }}%;background:{{ $row['color'] }}"></div></div>
|
||||
<div class="bar-row-value">{{ $row['count'] }}</div>
|
||||
</div>
|
||||
@empty
|
||||
<div class="card-meta">Brak danych w wybranym okresie.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
{{-- By category --}}
|
||||
<div class="card" style="padding:16px">
|
||||
<div class="card-title" style="margin-bottom:12px">Zgłoszenia wg kategorii</div>
|
||||
@php($cats = $this->byCategory)
|
||||
@php($max = max($cats->max('count') ?? 0, 1))
|
||||
@forelse ($cats as $row)
|
||||
<div class="bar-row" title="{{ $row['label'] }}: {{ $row['count'] }}">
|
||||
<div class="bar-row-label">{{ $row['label'] }}</div>
|
||||
<div class="bar-track"><div class="bar-fill" style="width:{{ $row['count'] / $max * 100 }}%;background:var(--color-accent)"></div></div>
|
||||
<div class="bar-row-value">{{ $row['count'] }}</div>
|
||||
</div>
|
||||
@empty
|
||||
<div class="card-meta">Brak danych w wybranym okresie.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
{{-- By team --}}
|
||||
<div class="card" style="padding:16px">
|
||||
<div class="card-title" style="margin-bottom:12px">Obciążenie zespołów</div>
|
||||
@php($teamRows = $this->byTeam)
|
||||
@php($max = max($teamRows->max('count') ?? 0, 1))
|
||||
@forelse ($teamRows as $row)
|
||||
<div class="bar-row" title="{{ $row['label'] }}: {{ $row['count'] }}">
|
||||
<div class="bar-row-label">{{ $row['label'] }}</div>
|
||||
<div class="bar-track"><div class="bar-fill" style="width:{{ $row['count'] / $max * 100 }}%;background:var(--color-accent-2)"></div></div>
|
||||
<div class="bar-row-value">{{ $row['count'] }}</div>
|
||||
</div>
|
||||
@empty
|
||||
<div class="card-meta">Brak danych w wybranym okresie.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
{{-- By assignee --}}
|
||||
<div class="card" style="padding:16px">
|
||||
<div class="card-title" style="margin-bottom:12px">Obciążenie operatorów</div>
|
||||
@php($opRows = $this->byAssignee)
|
||||
@php($max = max($opRows->max('count') ?? 0, 1))
|
||||
@forelse ($opRows as $row)
|
||||
<div class="bar-row" title="{{ $row['label'] }}: {{ $row['count'] }}">
|
||||
<div class="bar-row-label">{{ $row['label'] }}</div>
|
||||
<div class="bar-track"><div class="bar-fill" style="width:{{ $row['count'] / $max * 100 }}%;background:var(--color-accent-2)"></div></div>
|
||||
<div class="bar-row-value">{{ $row['count'] }}</div>
|
||||
</div>
|
||||
@empty
|
||||
<div class="card-meta">Brak danych w wybranym okresie.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Trend --}}
|
||||
@php($trend = $this->trend)
|
||||
@php($trendMax = max(collect($trend)->max('created'), collect($trend)->max('closed'), 1))
|
||||
@php($labelStep = max((int) ceil(count($trend) / 12), 1))
|
||||
<div class="card" style="padding:16px">
|
||||
<div class="card-title">Trend zgłoszeń</div>
|
||||
<div class="card-meta" style="margin-bottom:12px">Utworzone i zamknięte w czasie (maks. ostatnie 60 dni okresu).</div>
|
||||
|
||||
@if (count($trend) === 0)
|
||||
<div class="card-meta">Brak danych w wybranym okresie.</div>
|
||||
@else
|
||||
<div style="display:flex;flex-direction:column;gap:18px">
|
||||
<div class="trend-chart">
|
||||
<div class="card-meta" style="margin-bottom:2px">Nowe zgłoszenia</div>
|
||||
<div class="trend-cols">
|
||||
@foreach ($trend as $day)
|
||||
<div class="trend-col-track" title="{{ $day['label'] }}: {{ $day['created'] }}">
|
||||
<div class="trend-col" style="height:{{ $day['created'] / $trendMax * 100 }}%;background:var(--color-accent)"></div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="trend-x-labels">
|
||||
@foreach ($trend as $i => $day)
|
||||
<div class="trend-x-label">{{ $i % $labelStep === 0 ? $day['label'] : '' }}</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="trend-chart">
|
||||
<div class="card-meta" style="margin-bottom:2px">Zamknięte zgłoszenia</div>
|
||||
<div class="trend-cols">
|
||||
@foreach ($trend as $day)
|
||||
<div class="trend-col-track" title="{{ $day['label'] }}: {{ $day['closed'] }}">
|
||||
<div class="trend-col" style="height:{{ $day['closed'] / $trendMax * 100 }}%;background:{{ $this->closedColor }}"></div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="trend-x-labels">
|
||||
@foreach ($trend as $i => $day)
|
||||
<div class="trend-x-label">{{ $i % $labelStep === 0 ? $day['label'] : '' }}</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
401
src/resources/views/livewire/operator/ticket-show.blade.php
Normal file
401
src/resources/views/livewire/operator/ticket-show.blade.php
Normal file
@@ -0,0 +1,401 @@
|
||||
<div style="flex:1;display:flex;flex-direction:column">
|
||||
<x-topbar />
|
||||
|
||||
<div class="page-pad" style="flex:1;padding:20px 24px;overflow:auto">
|
||||
<div style="display:flex;flex-direction:column;gap:16px;max-width:1020px;margin:0 auto">
|
||||
<a href="{{ route('operator.queue') }}" wire:navigate class="btn btn-ghost" style="align-self:flex-start;padding:0">← Wróć do listy</a>
|
||||
|
||||
<div style="display:flex;gap:20px;align-items:flex-start;flex-wrap:wrap">
|
||||
<div class="main-col" style="display:flex;flex-direction:column;gap:16px">
|
||||
<div class="card" style="padding:20px;gap:8px">
|
||||
<div style="display:flex;justify-content:space-between;align-items:flex-start;gap:8px">
|
||||
<div class="card-kicker">Zgłoszenie #{{ $ticket->number }}</div>
|
||||
@unless ($editingDetails)
|
||||
<button type="button" class="btn btn-ghost" style="padding:0" wire:click="toggleEditDetails">Edytuj</button>
|
||||
@endunless
|
||||
</div>
|
||||
|
||||
@unless ($editingDetails)
|
||||
<h3 style="margin:2px 0 0">{{ $ticket->subject }}</h3>
|
||||
<div class="card-meta">{{ $ticket->categoryLabel() }}</div>
|
||||
<div style="white-space:pre-wrap;font-size:14px;margin-top:4px">{{ $ticket->body }}</div>
|
||||
@foreach ($this->publicMessages->first()?->attachments ?? [] as $a)
|
||||
<x-message-attachment :attachment="$a" />
|
||||
@endforeach
|
||||
@if (count($ticket->customFieldEntries()))
|
||||
<div style="display:flex;flex-direction:column;gap:2px;margin-top:2px">
|
||||
@foreach ($ticket->customFieldEntries() as $cf)
|
||||
<div style="font-size:14px"><strong>{{ $cf['label'] }}:</strong> {{ $cf['value'] }}</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
<div class="field"><label>Temat</label><input class="input" wire:model="editDetailsForm.subject"></div>
|
||||
<div class="field"><label>Treść</label><textarea class="input" wire:model="editDetailsForm.body"></textarea></div>
|
||||
<div style="display:flex;gap:10px">
|
||||
<div class="field" style="flex:1">
|
||||
<label>Kategoria</label>
|
||||
<select class="input" wire:model.live="editDetailsForm.categoryId">
|
||||
<option value="">Wybierz</option>
|
||||
@foreach ($this->categories as $c)
|
||||
<option value="{{ $c->id }}">{{ $c->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="field" style="flex:1">
|
||||
<label>Podkategoria</label>
|
||||
<select class="input" wire:model.live="editDetailsForm.subcategoryId" @disabled(! $editDetailsForm['categoryId'])>
|
||||
<option value="">Wybierz</option>
|
||||
@foreach ($this->editDetailsSubcategoryOptions as $s)
|
||||
<option value="{{ $s->id }}">{{ $s->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@foreach ($this->editDetailsSelectedSubcategory?->customFields ?? [] as $field)
|
||||
<x-custom-field-input :field="$field" wire-model="editDetailsForm.customValues" />
|
||||
@endforeach
|
||||
|
||||
<div style="display:flex;gap:8px;margin-top:6px">
|
||||
<button type="button" class="btn btn-secondary" wire:click="cancelEditDetails">Anuluj</button>
|
||||
<button type="button" class="btn btn-primary" wire:click="saveDetails">Zapisz</button>
|
||||
</div>
|
||||
@endunless
|
||||
</div>
|
||||
|
||||
<div class="card" style="padding:16px;gap:10px">
|
||||
<div class="card-kicker">Notatki wewnętrzne</div>
|
||||
@forelse ($this->internalMessages as $m)
|
||||
<div style="padding:10px 12px;border-left:3px solid var(--color-accent);background:var(--color-surface);border-radius:4px">
|
||||
<div style="display:flex;justify-content:space-between;align-items:flex-start;gap:8px">
|
||||
<div style="font-size:11px;opacity:0.65;margin-bottom:4px">{{ $m->author_name }} · {{ \App\Support\Rel::format($m->created_at) }}</div>
|
||||
@if ($m->role === 'operator')
|
||||
<div style="display:flex;gap:6px;flex:none">
|
||||
<span class="material-symbols-outlined" style="font-size:16px;cursor:pointer;opacity:0.7" wire:click="startEditNote({{ $m->id }}, @js($m->body))">edit</span>
|
||||
<span class="material-symbols-outlined" style="font-size:16px;cursor:pointer;opacity:0.7" wire:click="requestDeleteMessage({{ $m->id }})">delete</span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@if ($editingNoteId === $m->id)
|
||||
<textarea class="input" wire:model="editingNoteDraft"></textarea>
|
||||
<div style="display:flex;gap:8px;margin-top:6px">
|
||||
<button type="button" class="btn btn-secondary" wire:click="cancelEditNote">Anuluj</button>
|
||||
<button type="button" class="btn btn-primary" wire:click="saveEditNote">Zapisz</button>
|
||||
</div>
|
||||
@else
|
||||
<div style="white-space:pre-wrap">{{ $m->body }}</div>
|
||||
@endif
|
||||
@foreach ($m->attachments as $a)
|
||||
<x-message-attachment :attachment="$a" />
|
||||
@endforeach
|
||||
</div>
|
||||
@empty
|
||||
<p class="text-muted" style="font-size:13px;margin:0">Brak notatek wewnętrznych.</p>
|
||||
@endforelse
|
||||
@if ($addingNote)
|
||||
<textarea class="input" placeholder="Dodaj notatkę widoczną tylko dla zespołu…" wire:model="noteDraft"></textarea>
|
||||
<div style="display:flex;align-items:center;gap:10px">
|
||||
<div style="flex:1;min-width:0;border:1px dashed var(--color-divider);border-radius:8px;padding:10px 14px;display:flex;flex-wrap:wrap;align-items:center;gap:10px">
|
||||
<label class="btn btn-secondary" style="cursor:pointer;flex:none">Załącz pliki<input type="file" multiple style="display:none" wire:model="noteAttachments"></label>
|
||||
@forelse ($noteAttachments as $i => $file)
|
||||
<span class="text-muted" style="font-size:13px;display:flex;align-items:center;gap:6px;min-width:0">
|
||||
<span class="material-symbols-outlined" style="font-size:16px;flex:none">attach_file</span>
|
||||
<span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap">{{ $file->getClientOriginalName() }}</span>
|
||||
<span class="material-symbols-outlined" style="font-size:16px;cursor:pointer;opacity:0.7;flex:none" wire:click="removeNoteAttachment({{ $i }})">close</span>
|
||||
</span>
|
||||
@empty
|
||||
<span class="text-muted" style="font-size:13px">Brak załączników</span>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
@error('noteAttachments') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
<div style="display:flex;gap:8px">
|
||||
<button type="button" class="btn btn-secondary" wire:click="cancelAddNote">Anuluj</button>
|
||||
<button type="button" class="btn btn-primary" wire:click="addNote">Dodaj notatkę</button>
|
||||
</div>
|
||||
@else
|
||||
<button type="button" class="btn btn-secondary" wire:click="startAddNote">Dodaj notatkę</button>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@php $threadMessages = $this->publicMessages->skip(1); @endphp
|
||||
<div style="display:flex;flex-direction:column;gap:10px">
|
||||
@foreach ($threadMessages as $m)
|
||||
@php $mine = $m->role === 'operator'; @endphp
|
||||
<div style="display:flex;justify-content:{{ $mine ? 'flex-end' : 'flex-start' }}">
|
||||
<div style="max-width:75%;padding:10px 14px;border-radius:12px;font-size:14px;background:{{ $mine ? 'var(--color-accent-800)' : 'var(--color-surface)' }};color:{{ $mine ? 'var(--color-accent-100)' : 'var(--color-text)' }};border:1px solid var(--color-divider)">
|
||||
<div style="display:flex;justify-content:space-between;align-items:flex-start;gap:10px">
|
||||
<div style="font-size:11px;opacity:0.65;margin-bottom:4px">{{ $m->author_name }} · {{ \App\Support\Rel::format($m->created_at) }}{{ $m->edited ? ' · edytowano' : '' }}</div>
|
||||
@if ($m->role === 'operator')
|
||||
<div style="display:flex;gap:6px;flex:none">
|
||||
<span class="material-symbols-outlined" style="font-size:15px;cursor:pointer;opacity:0.7" wire:click="startEditMessage({{ $m->id }}, @js($m->body))">edit</span>
|
||||
<span class="material-symbols-outlined" style="font-size:15px;cursor:pointer;opacity:0.7" wire:click="requestDeleteMessage({{ $m->id }})">delete</span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@if ($editingMessageId === $m->id)
|
||||
<textarea class="input" wire:model="editingMessageDraft"></textarea>
|
||||
<div style="display:flex;gap:8px;margin-top:6px">
|
||||
<button type="button" class="btn btn-secondary" wire:click="cancelEditMessage">Anuluj</button>
|
||||
<button type="button" class="btn btn-primary" wire:click="saveEditMessage">Zapisz</button>
|
||||
</div>
|
||||
@else
|
||||
<div style="white-space:pre-wrap">{{ $m->body }}</div>
|
||||
@endif
|
||||
@foreach ($m->attachments as $a)
|
||||
<x-message-attachment :attachment="$a" />
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<form wire:submit="sendReply" class="card" style="padding:16px;gap:10px">
|
||||
<select class="input" wire:change="setTemplate($event.target.value)">
|
||||
<option value="">Wstaw szablon odpowiedzi…</option>
|
||||
@foreach ($this->responseTemplates as $rt)
|
||||
<option value="{{ $rt->id }}" @selected($templateId === (string) $rt->id)>{{ $rt->label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<textarea class="input" placeholder="Napisz odpowiedź do klienta…" wire:model="reply"></textarea>
|
||||
<div style="display:flex;align-items:center;gap:10px">
|
||||
<div style="flex:1;min-width:0;border:1px dashed var(--color-divider);border-radius:8px;padding:10px 14px;display:flex;flex-wrap:wrap;align-items:center;gap:10px">
|
||||
<label class="btn btn-secondary" style="cursor:pointer;flex:none">Załącz pliki<input type="file" multiple style="display:none" wire:model="replyAttachments"></label>
|
||||
@forelse ($replyAttachments as $i => $file)
|
||||
<span class="text-muted" style="font-size:13px;display:flex;align-items:center;gap:6px;min-width:0">
|
||||
<span class="material-symbols-outlined" style="font-size:16px;flex:none">attach_file</span>
|
||||
<span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap">{{ $file->getClientOriginalName() }}</span>
|
||||
<span class="material-symbols-outlined" style="font-size:16px;cursor:pointer;opacity:0.7;flex:none" wire:click="removeReplyAttachment({{ $i }})">close</span>
|
||||
</span>
|
||||
@empty
|
||||
<span class="text-muted" style="font-size:13px">Brak załączników</span>
|
||||
@endforelse
|
||||
</div>
|
||||
<div style="display:flex;position:relative;flex:none" x-data="{ open: false }" @click.outside="open = false">
|
||||
<button class="btn btn-primary" style="border-top-right-radius:0;border-bottom-right-radius:0" type="submit">Wyślij odpowiedź</button>
|
||||
<button class="btn btn-primary" type="button" style="border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid var(--color-bg);padding:0 6px" @click="open = !open">
|
||||
<span class="material-symbols-outlined" style="font-size:16px">expand_more</span>
|
||||
</button>
|
||||
<div x-show="open" x-cloak style="position:absolute;bottom:100%;right:0;margin-bottom:6px;background:var(--color-surface);border:1px solid var(--color-divider);border-radius:8px;box-shadow:var(--shadow-md);min-width:220px;overflow:hidden;z-index:10">
|
||||
@forelse ($this->replyQuickActions as $qa)
|
||||
<button type="button" class="theme-toggle-option" @click="open = false" wire:click="sendAndTransition({{ $qa->id }})">{{ $qa->label }}</button>
|
||||
@empty
|
||||
<div class="text-muted" style="font-size:12.5px;padding:8px 12px">Brak skonfigurowanych szybkich akcji.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@error('replyAttachments') <span style="color:var(--color-danger);font-size:12px">{{ $message }}</span> @enderror
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="aside-col" style="display:flex;flex-direction:column;gap:14px">
|
||||
<div class="card" style="padding:16px;gap:6px">
|
||||
<div style="display:flex;justify-content:space-between;align-items:flex-start;gap:8px">
|
||||
<div class="card-kicker">Zgłaszający</div>
|
||||
<span class="material-symbols-outlined" style="font-size:16px;cursor:pointer;opacity:0.7" wire:click="startEditReporter">edit</span>
|
||||
</div>
|
||||
<div style="font-weight:500">{{ $ticket->name }}</div>
|
||||
<div class="text-muted" style="font-size:13px">{{ $ticket->email }}</div>
|
||||
@if ($ticket->customer_id)
|
||||
<a href="{{ route('operator.queue', ['filterCustomerId' => $ticket->customer_id]) }}" wire:navigate class="text-muted" style="font-size:12px;color:var(--color-accent);text-decoration:none">Zobacz zgłoszenia tej osoby →</a>
|
||||
@php $reporterFields = $ticket->customer?->customFieldEntries() ?? []; @endphp
|
||||
@if (count($reporterFields))
|
||||
<div style="display:flex;flex-direction:column;gap:2px;margin-top:6px;padding-top:8px;border-top:1px solid var(--color-divider)">
|
||||
@foreach ($reporterFields as $cf)
|
||||
<div class="card-meta"><strong>{{ $cf['label'] }}:</strong> {{ $cf['value'] }}</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if ($editingReporter)
|
||||
<div class="card" style="padding:16px;gap:10px">
|
||||
<div class="field">
|
||||
<label>Zmień zgłaszającego</label>
|
||||
<select class="input" wire:model="editReporterCustomerId">
|
||||
<option value="">Wybierz klienta</option>
|
||||
@foreach ($this->clients as $cl)
|
||||
<option value="{{ $cl->id }}">{{ $cl->name }} — {{ $cl->email }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div style="display:flex;gap:8px">
|
||||
<button type="button" class="btn btn-secondary" wire:click="cancelEditReporter">Anuluj</button>
|
||||
<button type="button" class="btn btn-primary" wire:click="saveReporter">Zapisz</button>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="card" style="padding:16px;gap:10px">
|
||||
<div class="card-kicker">Status i przypisanie</div>
|
||||
<div class="field">
|
||||
<label>Status</label>
|
||||
<select class="input" wire:change="setStatus($event.target.value)">
|
||||
@foreach ($this->statuses as $s)
|
||||
<option value="{{ $s->key }}" @selected($ticket->status_key === $s->key)>{{ $s->label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Priorytet</label>
|
||||
<select class="input" wire:change="setPriority($event.target.value)">
|
||||
@foreach ($this->priorities as $p)
|
||||
<option value="{{ $p->key }}" @selected($ticket->priority_key === $p->key)>{{ $p->label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Zespół</label>
|
||||
<select class="input" wire:change="setTeam($event.target.value)">
|
||||
<option value="">Brak</option>
|
||||
@foreach ($this->teams as $tm)
|
||||
<option value="{{ $tm->id }}" @selected($ticket->team_id === $tm->id)>{{ $tm->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Przypisany do</label>
|
||||
<div style="display:flex;gap:6px">
|
||||
<select class="input" wire:change="setAssignee($event.target.value)" style="flex:1">
|
||||
<option value="">Nieprzypisane</option>
|
||||
@foreach ($this->operators as $o)
|
||||
<option value="{{ $o->id }}" @selected($ticket->assignee_id === $o->id)>{{ $o->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@if ($ticket->assignee_id !== auth()->id())
|
||||
<button type="button" class="btn btn-secondary" style="flex:none" wire:click="assignToMe">Przypisz do mnie</button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card" style="padding:16px;gap:8px">
|
||||
<div class="card-kicker">SLA</div>
|
||||
<div style="font-size:12.5px">{{ $ticket->slaInfo()['text'] }}</div>
|
||||
</div>
|
||||
|
||||
<div class="card" style="padding:16px;gap:8px">
|
||||
<div class="card-kicker">MONITOR CZASU PRACY</div>
|
||||
<div
|
||||
style="display:flex;flex-direction:column;gap:6px"
|
||||
x-data="{
|
||||
seconds: {{ $ticket->timerElapsedSeconds() }},
|
||||
running: @js((bool) $ticket->timer_started_at),
|
||||
tick: null,
|
||||
navigatingHandler: null,
|
||||
pagehideHandler: null,
|
||||
format() {
|
||||
const h = Math.floor(this.seconds / 3600);
|
||||
const m = Math.floor((this.seconds % 3600) / 60);
|
||||
const s = this.seconds % 60;
|
||||
return [h, m, s].map(n => String(n).padStart(2, '0')).join(':');
|
||||
},
|
||||
start() {
|
||||
clearInterval(this.tick);
|
||||
if (this.running) {
|
||||
this.tick = setInterval(() => { this.seconds++ }, 1000);
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.start();
|
||||
|
||||
// The timer only tracks time this ticket is actually open in
|
||||
// the browser: stop it server-side the moment the operator
|
||||
// navigates elsewhere in the app (wire:navigate — a normal
|
||||
// Livewire call, since the document itself isn't unloading)…
|
||||
this.navigatingHandler = () => {
|
||||
if (this.running) $wire.call('stopTimer');
|
||||
};
|
||||
document.addEventListener('livewire:navigating', this.navigatingHandler);
|
||||
|
||||
// …or closes/reloads the tab. Regular fetch/Livewire calls
|
||||
// can get cut off mid-flight during an actual page unload, so
|
||||
// this uses sendBeacon against a plain endpoint instead, which
|
||||
// browsers guarantee to deliver.
|
||||
this.pagehideHandler = () => {
|
||||
if (this.running) {
|
||||
navigator.sendBeacon(@js(route('operator.ticket.stop-timer', $ticket)));
|
||||
}
|
||||
};
|
||||
window.addEventListener('pagehide', this.pagehideHandler);
|
||||
},
|
||||
destroy() {
|
||||
clearInterval(this.tick);
|
||||
document.removeEventListener('livewire:navigating', this.navigatingHandler);
|
||||
window.removeEventListener('pagehide', this.pagehideHandler);
|
||||
},
|
||||
}"
|
||||
>
|
||||
@if ($editingTimer)
|
||||
<div style="display:flex;align-items:center;gap:4px;font-size:12px">
|
||||
<input class="input" type="number" min="0" style="width:60px" wire:model="editTimerHours"> godz.
|
||||
<input class="input" type="number" min="0" max="59" style="width:52px" wire:model="editTimerMinutes"> min.
|
||||
<input class="input" type="number" min="0" max="59" style="width:52px" wire:model="editTimerSeconds"> sek.
|
||||
</div>
|
||||
<div style="display:flex;gap:6px">
|
||||
<button type="button" class="btn btn-secondary" wire:click="cancelEditTimer">Anuluj</button>
|
||||
<button type="button" class="btn btn-primary" wire:click="saveEditTimer">Zapisz</button>
|
||||
</div>
|
||||
@else
|
||||
<div style="font-size:12px;display:flex;align-items:center;gap:6px">
|
||||
<span>Czas w zgłoszeniu: <strong x-text="format()"></strong></span>
|
||||
<span class="material-symbols-outlined" style="font-size:16px;cursor:pointer;opacity:0.7" wire:click="startEditTimer">edit</span>
|
||||
</div>
|
||||
<div style="display:flex;gap:6px">
|
||||
@if ($ticket->timer_started_at)
|
||||
<button type="button" class="btn btn-secondary" wire:click="stopTimer" @click="running = false; clearInterval(tick)">Zatrzymaj</button>
|
||||
@else
|
||||
<button type="button" class="btn btn-secondary" wire:click="resumeTimer" @click="running = true; start()">Wznów</button>
|
||||
@endif
|
||||
<button type="button" class="btn btn-secondary" wire:click="resetTimer" @click="seconds = 0; running = false; clearInterval(tick)">Resetuj</button>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card" style="padding:16px;gap:8px">
|
||||
<div class="card-kicker">Historia zmian</div>
|
||||
@forelse ($ticket->histories as $h)
|
||||
<div style="font-size:12.5px"><span>{{ $h->text }}</span><div class="text-muted" style="font-size:11px">{{ \App\Support\Rel::format($h->created_at) }}</div></div>
|
||||
@empty
|
||||
<p class="text-muted" style="font-size:12px;margin:0">Brak historii zmian.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<div class="card" style="padding:16px;gap:8px">
|
||||
<button type="button" class="btn btn-secondary btn-block" wire:click="requestDeleteTicket">Usuń zgłoszenie</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($pendingDeleteMessageId)
|
||||
<div class="dialog-backdrop">
|
||||
<div class="dialog" style="max-width:400px">
|
||||
<div class="dialog-title">Potwierdź usunięcie</div>
|
||||
<div class="dialog-body">Czy na pewno usunąć tę wiadomość?</div>
|
||||
<div class="dialog-actions">
|
||||
<button type="button" class="btn btn-secondary" wire:click="cancelDeleteMessage">Anuluj</button>
|
||||
<button type="button" class="btn btn-primary" wire:click="confirmDeleteMessage">Usuń</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($pendingDeleteTicket)
|
||||
<div class="dialog-backdrop">
|
||||
<div class="dialog" style="max-width:400px">
|
||||
<div class="dialog-title">Potwierdź usunięcie</div>
|
||||
<div class="dialog-body">Czy na pewno usunąć zgłoszenie #{{ $ticket->number }}?</div>
|
||||
<div class="dialog-actions">
|
||||
<button type="button" class="btn btn-secondary" wire:click="cancelDeleteTicket">Anuluj</button>
|
||||
<button type="button" class="btn btn-primary" wire:click="confirmDeleteTicket">Usuń</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
Reference in New Issue
Block a user