- In-app notifications: a bell in the top bar backed by Laravel's database
  notification channel, alongside existing e-mail notifications (same
  per-trigger toggle drives both; ticket links now correctly point into the
  recipient's own area instead of always linking to the client view).
- Drag-and-drop attachments on every upload form, plus inline image
  thumbnails in the message thread instead of a plain download link.
- Customer satisfaction (CSAT) rating: clients rate a closed ticket 1-5 stars
  with an optional comment; shown read-only to operators, surfaced as a KPI
  on the stats dashboard, and linked from the "ticket closed" e-mail.
- Saved queue views: operators can save/apply/delete named filter+sort+
  column presets in the ticket queue and mark one as their default.
- Full-text search (MySQL FULLTEXT, portable LIKE fallback) across ticket
  subject/body and reply message bodies, now also on the client's own ticket
  list.
- Stats CSV export for the currently filtered ticket set.
- Optional BookStack knowledge-base integration (off by default): suggests
  articles by category/subcategory while creating a ticket and in a separate
  sidebar for operators on an existing ticket (with a copy-link button).
  Configurable connection/SSL bypass/search-type filter, plus two
  independent per-shelf allow-lists so nothing is ever searched until an
  admin opts specific shelves in.
- Closed tickets no longer show in "Moje zgłoszenia"/"Nieprzypisane"/team
  queue tabs, only under "Zamknięte" (matching how "Otwarte" already worked).
- Wired up the Admin > About "Wersja" field to config('app.version')/VERSION
  in .env instead of a stale hardcoded string.
- Fixed: TicketService::setStatus() now checks a status's stage rather than
  the literal key 'closed' to decide whether to fire the "ticket closed"
  notification/stop the timer.
- Updated README/ARCHITECTURE/CHANGELOG/install/SECURITY docs and all three
  wiki/ role guides for the above; documented a root-vs-www-data file
  ownership gotcha in CLAUDE.md (running artisan commands via a plain
  `docker exec` can leave root-owned Blade cache files that later break
  recompilation for the www-data Apache process).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-22 15:18:09 +02:00
parent 4e8f17189a
commit 90fae0a4de
49 changed files with 1649 additions and 79 deletions

View File

@@ -78,7 +78,9 @@ class TicketService
// A transition to "closed" fires its own dedicated notification
// instead of the generic status-changed one, so closing a ticket
// doesn't send the customer/operator two emails for one event.
if ($statusKey === 'closed') {
// Checked via the status's stage (not the literal key) since admins
// can rename/replace which key maps to the "closed" stage.
if (Status::stageFor($statusKey) === 'closed') {
$this->notify($ticket, 'ticket_closed');
// Time tracking only applies to open work — checkpoint and pause
@@ -90,6 +92,22 @@ class TicketService
}
}
public function submitCsat(Ticket $ticket, int $rating, ?string $comment = null): void
{
if (! $ticket->csatSubmittable()) {
return;
}
$rating = max(1, min(5, $rating));
$ticket->update([
'csat_rating' => $rating,
'csat_comment' => $comment,
'csat_rated_at' => now(),
]);
$ticket->addHistory('Klient ocenił obsługę: '.$rating.'/5');
}
public function setPriority(Ticket $ticket, string $priorityKey): void
{
$ticket->update(['priority_key' => $priorityKey]);
@@ -276,6 +294,12 @@ class TicketService
/**
* Public so the scheduled SLA-breach check (which isn't a ticket lifecycle
* event raised from within this service) can trigger the same way.
*
* Routes through the recipient's own User model (so it lands in the
* in-app notification bell in addition to e-mail) whenever one exists;
* falls back to an anonymous mail-only route for a guest customer with
* no account. One shared NotificationSetting.enabled flag gates both
* channels there's no separate in-app on/off switch.
*/
public function notify(Ticket $ticket, string $triggerKey): void
{
@@ -285,6 +309,14 @@ class TicketService
return;
}
$notifiable = $setting->recipient === 'operator' ? $ticket->assignee : $ticket->customer;
if ($notifiable) {
$notifiable->notify(new TicketNotification($ticket, $setting->email_template_id, $setting->recipient));
return;
}
$email = $setting->recipient === 'operator' ? $ticket->assignee?->email : $ticket->email;
if (! $email) {
@@ -292,6 +324,6 @@ class TicketService
}
Notification::route('mail', $email)
->notify(new TicketNotification($ticket, $setting->email_template_id));
->notify(new TicketNotification($ticket, $setting->email_template_id, $setting->recipient));
}
}