Phase 114 complete (v3.7 Invoices): - /settings/accounting jako hub-rozdroze (Paragony / Faktury) - /settings/accounting/receipts + /invoices osobne podstrony list i edycji - InvoiceConfigRepository + Controller (CRUD z walidacja delegacji) - Seed Domyslny VAT (NOT EXISTS idempotent) - invoice-config-form.js (toggle is_delegated -> integration_id) - confirm-delete.js (globalny modul OrderProAlerts.confirm) - Legacy aliasy starych endpointow /settings/accounting/save|toggle|delete Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
80 lines
3.2 KiB
PHP
80 lines
3.2 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 paragonow</h2>
|
|
<p class="muted mt-12">Zarzadzaj konfiguracjami wystawiania paragonow.</p>
|
|
|
|
<?php if ($error !== ''): ?>
|
|
<div class="alert alert--danger mt-12" role="alert"><?= $e($error) ?></div>
|
|
<?php endif; ?>
|
|
<?php if ($success !== ''): ?>
|
|
<div class="alert alert--success mt-12" role="status"><?= $e($success) ?></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/receipts/new">Dodaj konfiguracje</a>
|
|
</div>
|
|
|
|
<?php if ($configs === []): ?>
|
|
<p class="muted mt-12">Brak konfiguracji paragonow. 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>Status</th>
|
|
<th>Akcje</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($configs as $cfg):
|
|
$cid = (int) ($cfg['id'] ?? 0);
|
|
$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 ($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/receipts/edit?id=<?= $cid ?>" class="btn btn--sm btn--secondary">Edytuj</a>
|
|
<form action="/settings/accounting/receipts/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/receipts/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>
|