feat(admin): Anzahlungskonten in der Verwaltung pflegen (zwei IBANs)
- Migration 016_deposit_accounts.sql: Tabelle deposit_accounts (label, holder, bank, iban, sort_order), gefüllt mit Postbank (DE12 …1261 30) und Sparkasse (DE83 3206 0362 3303 2140 10); bookings.deposit_account -> deposit_account_id mit Fremdschlüssel (ON DELETE SET NULL), Altbestand wird aufs erste Konto gemappt; schema.sql nachgezogen - Neue Seite Verwaltung → Konten (/admin/accounts): anlegen, ändern, löschen (Löschen nur ohne Buchungsbezug), Anzeige der Verwendung je Konto - Buchungsformular wählt aus dieser Liste (Anzeige mit IBAN-Ende), Validierung prüft IBAN-Format, Auftragsbestätigung druckt das gewählte Konto - deposit_accounts()/deposit_account() lesen aus der DB (Cache wird nach Änderungen verworfen); Konfigurations-Override entfällt - Anleitung (Abschnitt 3 und 15), README, config.example.php und ROADMAP (Feature 25) aktualisiert
This commit is contained in:
parent
bf85a64a79
commit
cc8d7330f8
15 changed files with 478 additions and 76 deletions
|
|
@ -7,7 +7,7 @@
|
|||
/** @var array $user */
|
||||
/** @var bool $isEdit */
|
||||
/** @var bool $canEditBilling */
|
||||
/** @var array<string, array{label: string, holder: string, bank: string, iban: string}> $depositAccounts */
|
||||
/** @var list<array{id: int, label: string, holder: string, bank: string, iban: string}> $depositAccounts */
|
||||
/** @var int $depositDueDays */
|
||||
$fieldError = static fn (string $key): string => (string) ($errors[$key] ?? '');
|
||||
$cancelled = $isEdit && ($booking['status'] ?? '') === 'cancelled';
|
||||
|
|
@ -232,9 +232,9 @@ $backUrl = $isEdit ? '/bookings/' . (int) $booking['id'] : '/calendar';
|
|||
<div class="field<?= $fieldError('deposit_account') !== '' ? ' has-error' : '' ?>">
|
||||
<span>Anzahlung fällig · Konto</span>
|
||||
<div class="field-with-aside">
|
||||
<select name="deposit_account" aria-label="Konto für die Anzahlung"<?= empty($canEditBilling) ? ' disabled' : '' ?>>
|
||||
<?php foreach ($depositAccounts as $accountKey => $accountRow): ?>
|
||||
<option value="<?= e_attr((string) $accountKey) ?>"<?= (string) $values['deposit_account'] === (string) $accountKey ? ' selected' : '' ?>><?= e((string) $accountRow['label']) ?></option>
|
||||
<select name="deposit_account_id" aria-label="Konto für die Anzahlung"<?= empty($canEditBilling) ? ' disabled' : '' ?>>
|
||||
<?php foreach ($depositAccounts as $accountRow): ?>
|
||||
<option value="<?= (int) $accountRow['id'] ?>"<?= (int) $values['deposit_account_id'] === (int) $accountRow['id'] ? ' selected' : '' ?>><?= e(deposit_account_label($accountRow)) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<span class="segmented-radio segmented-radio--compact">
|
||||
|
|
@ -244,7 +244,8 @@ $backUrl = $isEdit ? '/bookings/' . (int) $booking['id'] : '/calendar';
|
|||
</div>
|
||||
<?php if ($fieldError('deposit_account')): ?><em class="field-error"><?= e($fieldError('deposit_account')) ?></em><?php endif; ?>
|
||||
<em class="muted small">Bei „JA“ fordert die Auftragsbestätigung die Anzahlung mit
|
||||
Frist (<?= (int) $depositDueDays ?> Werktage) und nennt das Konto.</em>
|
||||
Frist (<?= (int) $depositDueDays ?> Werktage) und nennt das Konto. Konten pflegt die
|
||||
Verwaltung unter „Konten“.</em>
|
||||
</div>
|
||||
|
||||
<div class="field<?= $fieldError('invoice_no') !== '' ? ' has-error' : '' ?>" data-paste-field="invoice_no">
|
||||
|
|
@ -295,7 +296,10 @@ $backUrl = $isEdit ? '/bookings/' . (int) $booking['id'] : '/calendar';
|
|||
<div><dt>Gesamtbetrag</dt><dd data-summary-total><?= e(fmt_money(parse_money((string) $values['rent']) + parse_money((string) $values['delivery']))) ?></dd></div>
|
||||
<div><dt>Anzahlung</dt><dd data-summary-deposit><?= e(fmt_money(parse_money((string) $values['deposit']))) ?><?= (int) $values['deposit_required'] === 1 ? ' · fällig' : '' ?></dd></div>
|
||||
<?php if ((int) $values['deposit_required'] === 1): ?>
|
||||
<div><dt>Konto</dt><dd><?= e((string) ($depositAccounts[(string) $values['deposit_account']]['label'] ?? '')) ?></dd></div>
|
||||
<div><dt>Konto</dt><dd><?php
|
||||
$currentAccount = deposit_account((int) $values['deposit_account_id']);
|
||||
echo e($currentAccount !== null ? deposit_account_label($currentAccount) : '–');
|
||||
?></dd></div>
|
||||
<?php endif; ?>
|
||||
<div class="is-strong"><dt>Noch zu zahlen</dt><dd data-summary-due><?= e(fmt_money(due_cents(parse_money((string) $values['rent']) + parse_money((string) $values['delivery']), parse_money((string) $values['deposit'])))) ?></dd></div>
|
||||
</dl>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue