feat(120): alert component unification

Phase 120 - Plan 01:
- Reusable PHP alert component (resources/views/components/alert.php)
  with inline SVG icon per type, optional dismiss button.
- Missing .alert--info SCSS variant added (#eff6ff/#bfdbfe/#1e3a8a) -
  fixes black-on-white alert after Fakturownia test connection.
- Flash::push(type, message) + Flash::all() with BC for set/get;
  legacy key heuristic (error/.save/warning -> typed entries).
- Central flash renderer in 3 layouts (app/auth/public) iterating
  Flash::all() through component (.alerts-stack wrap).
- Vanilla JS alert-dismiss.js with idempotent guard and delegated
  click handler on [data-alert-dismiss].
- 36 views migrated off inline <div class="alert alert--TYPE">;
  .flash--error/success removed from views (orders/show, shipments/prepare).
- SCSS rebuilt: public/assets/css/{app,login}.css.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 18:47:41 +02:00
parent 3a2c419c25
commit 933dfcc67b
51 changed files with 1109 additions and 210 deletions

View File

@@ -10,19 +10,24 @@ $currentStatusFilter = (string) ($printStatusFilter ?? '');
<p class="muted mt-12">Klucze API do uwierzytelniania aplikacji drukujacej (Windows Client).</p>
<?php if (!empty($errorMessage)): ?>
<div class="alert alert--danger mt-12" role="alert"><?= $e((string) $errorMessage) ?></div>
<div class="mt-12"><?php $type='danger'; $message=(string) $errorMessage; $dismissible=true; include dirname(__DIR__) . '/components/alert.php'; ?></div>
<?php endif; ?>
<?php if (!empty($successMessage)): ?>
<div class="alert alert--success mt-12" role="status"><?= $e((string) $successMessage) ?></div>
<div class="mt-12"><?php $type='success'; $message=(string) $successMessage; $dismissible=true; include dirname(__DIR__) . '/components/alert.php'; ?></div>
<?php endif; ?>
<?php if ($newKey !== ''): ?>
<div class="alert alert--warning mt-12">
<?php
ob_start();
?>
<strong>Nowy klucz API:</strong>
<code id="new-api-key" style="display:inline-block;padding:4px 8px;background:#f5f5f5;border:1px solid #ddd;border-radius:3px;font-size:13px;word-break:break-all;user-select:all"><?= $e($newKey) ?></code>
<button type="button" class="btn btn--secondary btn--sm ml-8" onclick="navigator.clipboard.writeText(document.getElementById('new-api-key').textContent)">Kopiuj</button>
<br><small class="muted">Ten klucz nie bedzie ponownie wyswietlony. Skopiuj go teraz.</small>
</div>
<?php
$newKeyAlertHtml = ob_get_clean();
?>
<div class="mt-12"><?php $type='warning'; $messageHtml=$newKeyAlertHtml; $dismissible=true; include dirname(__DIR__) . '/components/alert.php'; unset($messageHtml); ?></div>
<?php endif; ?>
</section>