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>
97 lines
4.1 KiB
PHP
97 lines
4.1 KiB
PHP
<?php
|
|
/** @var array<int, array<string, mixed>> $configs */
|
|
$configs = is_array($configs ?? null) ? $configs : [];
|
|
$success = trim((string) ($successMessage ?? ''));
|
|
$error = trim((string) ($errorMessage ?? ''));
|
|
?>
|
|
|
|
<section class="card">
|
|
<p class="muted" style="margin-bottom:8px"><a href="/settings/accounting">← Ksiegowosc</a></p>
|
|
<h2 class="section-title">Konfiguracje faktur</h2>
|
|
<p class="muted mt-12">Zarzadzaj konfiguracjami wystawiania faktur. Mozesz dodac wiele konfiguracji (np. dla roznych dzialalnosci) i opcjonalnie delegowac wystawianie do Fakturowni.</p>
|
|
|
|
<?php if ($error !== ''): ?>
|
|
<div class="mt-12"><?php $type='danger'; $message=(string) $error; $dismissible=true; include dirname(__DIR__) . '/components/alert.php'; ?></div>
|
|
<?php endif; ?>
|
|
<?php if ($success !== ''): ?>
|
|
<div class="mt-12"><?php $type='success'; $message=(string) $success; $dismissible=true; include dirname(__DIR__) . '/components/alert.php'; ?></div>
|
|
<?php endif; ?>
|
|
</section>
|
|
|
|
<section class="card mt-16">
|
|
<h3 class="section-title">Lista konfiguracji</h3>
|
|
|
|
<div class="form-actions mt-12">
|
|
<a class="btn btn--primary" href="/settings/accounting/invoices/new">Dodaj konfiguracje</a>
|
|
</div>
|
|
|
|
<?php if ($configs === []): ?>
|
|
<p class="muted mt-12">Brak konfiguracji faktur. Dodaj pierwsza powyzej.</p>
|
|
<?php else: ?>
|
|
<div class="table-wrap mt-12">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Nazwa</th>
|
|
<th>Format numeru</th>
|
|
<th>Numerowanie</th>
|
|
<th>Tryb</th>
|
|
<th>Konto Fakturowni</th>
|
|
<th>Status</th>
|
|
<th>Akcje</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($configs as $cfg):
|
|
$cid = (int) ($cfg['id'] ?? 0);
|
|
$isDelegated = ((int) ($cfg['is_delegated'] ?? 0)) === 1;
|
|
$isActive = ((int) ($cfg['is_active'] ?? 0)) === 1;
|
|
?>
|
|
<tr>
|
|
<td><?= $e((string) ($cfg['name'] ?? '')) ?></td>
|
|
<td><code><?= $e((string) ($cfg['number_format'] ?? '')) ?></code></td>
|
|
<td><?= ((string) ($cfg['numbering_type'] ?? 'monthly')) === 'yearly' ? 'Roczne' : 'Miesieczne' ?></td>
|
|
<td>
|
|
<?php if ($isDelegated): ?>
|
|
<span class="badge badge--success">Fakturownia</span>
|
|
<?php else: ?>
|
|
<span class="badge badge--muted">Lokalna</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td>
|
|
<?php if ($isDelegated && !empty($cfg['integration_name'])): ?>
|
|
<?= $e((string) $cfg['integration_name']) ?>
|
|
<?php else: ?>
|
|
<span class="muted">-</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td>
|
|
<?php if ($isActive): ?>
|
|
<span class="badge badge--success">Aktywna</span>
|
|
<?php else: ?>
|
|
<span class="badge badge--muted">Nieaktywna</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td style="white-space:nowrap">
|
|
<a href="/settings/accounting/invoices/edit?id=<?= $cid ?>" class="btn btn--sm btn--secondary">Edytuj</a>
|
|
<form action="/settings/accounting/invoices/toggle" method="post" style="display:inline">
|
|
<input type="hidden" name="_token" value="<?= $e($csrfToken ?? '') ?>">
|
|
<input type="hidden" name="id" value="<?= $cid ?>">
|
|
<button type="submit" class="btn btn--sm btn--secondary">
|
|
<?= $isActive ? 'Dezaktywuj' : 'Aktywuj' ?>
|
|
</button>
|
|
</form>
|
|
<form action="/settings/accounting/invoices/delete" method="post" style="display:inline" class="js-confirm-delete">
|
|
<input type="hidden" name="_token" value="<?= $e($csrfToken ?? '') ?>">
|
|
<input type="hidden" name="id" value="<?= $cid ?>">
|
|
<button type="button" class="btn btn--sm btn--danger js-delete-btn">Usun</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|