- 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

@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('notifications', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('type');
$table->morphs('notifiable');
$table->text('data');
$table->timestamp('read_at')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('notifications');
}
};

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('tickets', function (Blueprint $table) {
$table->unsignedTinyInteger('csat_rating')->nullable()->after('time_spent_seconds');
$table->text('csat_comment')->nullable()->after('csat_rating');
$table->timestamp('csat_rated_at')->nullable()->after('csat_comment');
});
// FULLTEXT indexes power full-text ticket search — MariaDB/MySQL only,
// the sqlite driver used by tests has no equivalent (search falls back
// to LIKE there, see Ticket::scopeSearch()).
if (Schema::getConnection()->getDriverName() === 'mysql') {
Schema::table('tickets', function (Blueprint $table) {
$table->fullText(['subject', 'body']);
});
Schema::table('ticket_messages', function (Blueprint $table) {
$table->fullText('body');
});
}
}
public function down(): void
{
if (Schema::getConnection()->getDriverName() === 'mysql') {
Schema::table('tickets', function (Blueprint $table) {
$table->dropFullText(['subject', 'body']);
});
Schema::table('ticket_messages', function (Blueprint $table) {
$table->dropFullText(['body']);
});
}
Schema::table('tickets', function (Blueprint $table) {
$table->dropColumn(['csat_rating', 'csat_comment', 'csat_rated_at']);
});
}
};

View File

@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('saved_queue_views', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->string('name');
$table->json('filters');
$table->boolean('is_default')->default(false);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('saved_queue_views');
}
};

View File

@@ -0,0 +1,52 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Appends a "rate our support" CTA to the existing seeded ticket_closed
* e-mail template, matching what a fresh install's seeder now produces
* (see DatabaseSeeder::seedEmailTemplatesAndNotifications()). Guarded by
* a "does it already contain {ocena}" check so re-running (or a fresh
* seed that already has it) is a no-op, and skipped entirely if the
* admin has since customized the template away from the seeded wording.
*/
public function up(): void
{
$template = DB::table('email_templates')->where('key', 'tpl-closed')->first();
if (! $template || str_contains($template->body, '{ocena}')) {
return;
}
$seededBody = '<p>Cześć {imie},</p><p>Twoje zgłoszenie „{temat}” zostało zamknięte. Jeśli temat nie został rozwiązany, odpowiedz na tego maila lub zgłoś sprawę ponownie.</p><p>Podgląd zgłoszenia: <a href="{link}" rel="noopener noreferrer" target="_blank">Kliknij tu</a></p>';
if (! str_starts_with($template->body, $seededBody)) {
return;
}
$csatLink = '<p><a href="{ocena}" rel="noopener noreferrer" target="_blank">Oceń naszą obsługę</a></p>';
$rest = substr($template->body, strlen($seededBody));
DB::table('email_templates')->where('id', $template->id)->update([
'body' => $seededBody.$csatLink.$rest,
'updated_at' => now(),
]);
}
public function down(): void
{
$template = DB::table('email_templates')->where('key', 'tpl-closed')->first();
if (! $template) {
return;
}
DB::table('email_templates')->where('id', $template->id)->update([
'body' => str_replace('<p><a href="{ocena}" rel="noopener noreferrer" target="_blank">Oceń naszą obsługę</a></p>', '', $template->body),
'updated_at' => now(),
]);
}
};

View File

@@ -287,6 +287,7 @@ class DatabaseSeeder extends Seeder
{
$footer = '<p>Pozdrawiamy,<br>Zespół Wsparcia</p>';
$link = '<p>Podgląd zgłoszenia: <a href="{link}" rel="noopener noreferrer" target="_blank">Kliknij tu</a></p>';
$csatLink = '<p><a href="{ocena}" rel="noopener noreferrer" target="_blank">Oceń naszą obsługę</a></p>';
$templates = [
'tpl-new' => [
@@ -322,7 +323,7 @@ class DatabaseSeeder extends Seeder
'tpl-closed' => [
'name' => 'Zgłoszenie zamknięte', 'trigger_label' => 'Status = Zamknięte',
'subject' => 'Zgłoszenie #{numer} zostało zamknięte',
'body' => '<p>Cześć {imie},</p><p>Twoje zgłoszenie „{temat}” zostało zamknięte. Jeśli temat nie został rozwiązany, odpowiedz na tego maila lub zgłoś sprawę ponownie.</p>'.$link.$footer,
'body' => '<p>Cześć {imie},</p><p>Twoje zgłoszenie „{temat}” zostało zamknięte. Jeśli temat nie został rozwiązany, odpowiedz na tego maila lub zgłoś sprawę ponownie.</p>'.$link.$csatLink.$footer,
],
'tpl-reply' => [
'name' => 'Nowa odpowiedź operatora', 'trigger_label' => 'Operator odpowiedział',