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:
@@ -13,9 +13,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php if (!empty($errorMessage)): ?>
|
||||
<div class="alert alert--warning mt-12" role="alert">
|
||||
<?= $e((string) $errorMessage) ?>
|
||||
</div>
|
||||
<div class="mt-12"><?php $type='warning'; $message=(string) $errorMessage; $dismissible=true; include dirname(__DIR__) . '/components/alert.php'; ?></div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@ $hasExistingReceipts = $existingReceiptsList !== [];
|
||||
</div>
|
||||
|
||||
<?php if ($hasExistingReceipts): ?>
|
||||
<div class="alert alert--warning mt-12">
|
||||
<?php
|
||||
ob_start();
|
||||
?>
|
||||
<strong>Uwaga!</strong> Do tego zamówienia wystawiono już <?= $e((string) count($existingReceiptsList)) ?> paragon(ów):
|
||||
<ul class="mt-4">
|
||||
<?php foreach ($existingReceiptsList as $er): ?>
|
||||
@@ -35,7 +37,10 @@ $hasExistingReceipts = $existingReceiptsList !== [];
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
$existingReceiptsHtml = ob_get_clean();
|
||||
?>
|
||||
<div class="mt-12"><?php $type='warning'; $messageHtml = $existingReceiptsHtml; $dismissible=true; include dirname(__DIR__) . '/components/alert.php'; unset($messageHtml); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form id="receipt-create-form" method="post" action="/orders/<?= $e((string) $orderIdVal) ?>/receipt/store" class="mt-16">
|
||||
|
||||
@@ -134,10 +134,10 @@ foreach ($addressesList as $address) {
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($flashSuccessMsg !== ''): ?>
|
||||
<div class="flash flash--success mt-12"><?= $e($flashSuccessMsg) ?></div>
|
||||
<div class="mt-12"><?php $type='success'; $message=(string) $flashSuccessMsg; $dismissible=true; include dirname(__DIR__) . '/components/alert.php'; ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($flashErrorMsg !== ''): ?>
|
||||
<div class="flash flash--error mt-12"><?= $e($flashErrorMsg) ?></div>
|
||||
<div class="mt-12"><?php $type='danger'; $message=(string) $flashErrorMsg; $dismissible=true; include dirname(__DIR__) . '/components/alert.php'; ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="order-status-change mt-12">
|
||||
|
||||
Reference in New Issue
Block a user