- 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

@@ -15,8 +15,10 @@ use App\Models\Subcategory;
use App\Models\Team;
use App\Models\User;
use App\Models\UserField;
use App\Services\BookStackClient;
use App\Services\LdapUserProvisioner;
use App\Support\Settings;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Mail;
@@ -137,6 +139,12 @@ class Panel extends Component
public ?string $mailTestResult = null;
public array $bookstackConfig = [];
public ?string $bookstackTestResult = null;
public ?string $bookstackTestMessage = null;
// ---- generic pending-delete confirm ----
public ?string $pendingDeleteType = null;
@@ -187,6 +195,18 @@ class Panel extends Component
'fromAddress' => Settings::get('mail_from_address'),
'fromName' => Settings::get('mail_from_name'),
];
$this->bookstackConfig = [
'enabled' => Settings::bool('bookstack_enabled'),
'baseUrl' => Settings::get('bookstack_base_url'),
'tokenId' => Settings::get('bookstack_token_id'),
'tokenSecret' => Settings::get('bookstack_token_secret'),
'verifySsl' => Settings::bool('bookstack_verify_ssl'),
'showToGuests' => Settings::bool('bookstack_show_to_guests'),
'searchTypes' => Settings::get('bookstack_search_types', 'both'),
'allowedShelfIdsCreation' => $this->parseShelfIds(Settings::get('bookstack_allowed_shelf_ids_creation', '')),
'allowedShelfIdsTicketView' => $this->parseShelfIds(Settings::get('bookstack_allowed_shelf_ids_ticket_view', '')),
];
}
public function setTab(string $tab): void
@@ -965,7 +985,7 @@ class Panel extends Component
* key-primary-keyed, sort_order-ordered lists edited the same way: swap
* this row's sort_order with its immediate neighbor in the given direction.
*
* @param \Illuminate\Support\Collection<int, Status|Priority> $ordered
* @param Collection<int, Status|Priority> $ordered
*/
protected function swapAdjacentSortOrder($ordered, string $key, int $direction): void
{
@@ -1288,6 +1308,90 @@ class Panel extends Component
}
}
// ===================== BOOKSTACK CONFIG =====================
public function saveBookstackConfig(): void
{
Settings::set('bookstack_enabled', $this->bookstackConfig['enabled'] ? '1' : '0');
Settings::set('bookstack_base_url', $this->bookstackConfig['baseUrl']);
Settings::set('bookstack_token_id', $this->bookstackConfig['tokenId']);
if ($this->bookstackConfig['tokenSecret']) {
Settings::set('bookstack_token_secret', $this->bookstackConfig['tokenSecret']);
}
Settings::set('bookstack_verify_ssl', $this->bookstackConfig['verifySsl'] ? '1' : '0');
Settings::set('bookstack_show_to_guests', $this->bookstackConfig['showToGuests'] ? '1' : '0');
if (in_array($this->bookstackConfig['searchTypes'], ['both', 'page', 'book'], true)) {
Settings::set('bookstack_search_types', $this->bookstackConfig['searchTypes']);
}
Settings::set('bookstack_allowed_shelf_ids_creation', implode(',', $this->bookstackConfig['allowedShelfIdsCreation']));
Settings::set('bookstack_allowed_shelf_ids_ticket_view', implode(',', $this->bookstackConfig['allowedShelfIdsTicketView']));
$this->bookstackTestResult = null;
$this->bookstackTestMessage = null;
}
#[Computed]
public function bookstackShelves(): array
{
return app(BookStackClient::class)->shelves();
}
/**
* Drops the cached shelf list (and its dependent shelf>book map) so a
* shelf added/renamed/removed in BookStack shows up in both checklists
* right away, then re-fetches shared by both "Dozwolone półki"
* checklists since they list the exact same shelves.
*/
public function refreshBookstackShelves(): void
{
app(BookStackClient::class)->clearShelfCache();
unset($this->bookstackShelves);
}
/**
* @return int[]
*/
protected function parseShelfIds(string $raw): array
{
return collect(explode(',', $raw))->map(fn ($v) => (int) trim($v))->filter()->values()->all();
}
/**
* $field is 'allowedShelfIdsCreation' or 'allowedShelfIdsTicketView'
* the two independent allow-lists (ticket-creation suggestions vs. the
* operator ticket-view sidebar) toggled by their own checklist.
*/
public function toggleBookstackAllowedShelf(string $field, int $id): void
{
$ids = $this->bookstackConfig[$field];
$this->bookstackConfig[$field] = in_array($id, $ids, true)
? array_values(array_diff($ids, [$id]))
: [...$ids, $id];
}
public function testBookstackConnection(): void
{
$cfg = $this->bookstackConfig;
if (empty($cfg['baseUrl']) || empty($cfg['tokenId'])) {
$this->bookstackTestResult = 'error';
$this->bookstackTestMessage = 'Uzupełnij adres instancji i Token ID.';
return;
}
$tokenSecret = $cfg['tokenSecret'] ?: Settings::get('bookstack_token_secret');
$result = app(BookStackClient::class)->testConnection($cfg['baseUrl'], $cfg['tokenId'], $tokenSecret ?? '', (bool) $cfg['verifySsl']);
$this->bookstackTestResult = $result['ok'] ? 'ok' : 'error';
$this->bookstackTestMessage = $result['message'];
}
// ===================== MAIL / SMTP CONFIG =====================
public function saveMailConfig(): void