Das Überweisungsformular fragt nur noch das Auftragskonto ab; die passende Bankverbindung ermittelt Bankzugang::zugangJeKonto() aus der Kontenzuordnung. Konten ohne konfigurierte Bank stehen in der Auswahl nicht mehr zur Verfügung. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
159 lines
6.9 KiB
PHP
159 lines
6.9 KiB
PHP
<?php
|
||
|
||
use Finanzmanager\Models\Adresse;
|
||
use Finanzmanager\View;
|
||
|
||
/**
|
||
* @var array<string,mixed>|null $auftrag
|
||
* @var list<array<string,mixed>> $konten
|
||
* @var list<array<string,mixed>> $adressen
|
||
* @var list<array<string,mixed>> $kategorien
|
||
* @var list<array<string,mixed>> $klassen
|
||
* @var string $csrfToken
|
||
*/
|
||
|
||
$neu = $auftrag === null;
|
||
$ziel = $neu ? '/zahlungsverkehr/neu' : '/zahlungsverkehr/' . (int)$auftrag['id'];
|
||
$wert = static fn(string $feld, string $standard = ''): string => (string)($auftrag[$feld] ?? $standard);
|
||
|
||
include __DIR__ . '/../layout/kopf.php';
|
||
?>
|
||
|
||
<div class="seitenaktionen">
|
||
<a href="/zahlungsverkehr" class="knopf">Zurück zur Übersicht</a>
|
||
<?php if (!$neu && $auftrag['status'] !== 'gesendet'): ?>
|
||
<form method="post" action="/zahlungsverkehr/<?= (int)$auftrag['id'] ?>/senden" class="inline"
|
||
data-bestaetigen="Überweisung jetzt an die Bank senden?">
|
||
<input type="hidden" name="csrf_token" value="<?= View::h($csrfToken) ?>">
|
||
<button type="submit" class="knopf primaer">An die Bank senden</button>
|
||
</form>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<?php if (!$neu && $auftrag['status'] === 'gesendet'): ?>
|
||
<p class="meldung meldung-erfolg" role="status">
|
||
Am <?= View::h(date('d.m.Y H:i', strtotime((string)$auftrag['gesendet_am']))) ?> an die Bank
|
||
übergeben. Ein gesendeter Auftrag lässt sich nicht mehr ändern.
|
||
</p>
|
||
<?php elseif (!$neu && ($auftrag['meldung'] ?? '') !== ''): ?>
|
||
<p class="meldung meldung-fehler" role="status"><?= View::h($auftrag['meldung']) ?></p>
|
||
<?php endif; ?>
|
||
|
||
<form method="post" action="<?= View::h($ziel) ?>" class="formular breit">
|
||
<input type="hidden" name="csrf_token" value="<?= View::h($csrfToken) ?>">
|
||
|
||
<label for="konto_id">Auftragskonto</label>
|
||
<?php if ($konten !== []): ?>
|
||
<select id="konto_id" name="konto_id" required>
|
||
<?php foreach ($konten as $konto): ?>
|
||
<option value="<?= (int)$konto['id'] ?>"
|
||
<?= (int)$wert('konto_id') === (int)$konto['id'] ? 'selected' : '' ?>>
|
||
<?= View::h($konto['name']) ?><?= $konto['iban'] !== '' ? ' (' . View::h($konto['iban']) . ')' : '' ?>
|
||
</option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
<p class="feldhinweis">
|
||
Die Bank ergibt sich aus dem Konto und wird beim Senden automatisch gewählt. Nur
|
||
Konten mit eingerichteter Bankverbindung stehen zur Auswahl.
|
||
</p>
|
||
<?php else: ?>
|
||
<p class="meldung meldung-fehler" role="status">
|
||
Keinem Konto ist eine Bankverbindung zugeordnet – <a href="/banking/neu">jetzt einrichten</a>.
|
||
</p>
|
||
<?php endif; ?>
|
||
|
||
<h3>Empfänger</h3>
|
||
|
||
<?php if ($adressen !== []): ?>
|
||
<label for="adresse">Aus dem Adressbuch</label>
|
||
<select id="adresse" name="adresse" data-adressauswahl>
|
||
<option value="">– von Hand eingeben –</option>
|
||
<?php foreach ($adressen as $adresse): ?>
|
||
<option value="<?= (int)$adresse['id'] ?>"
|
||
data-name="<?= View::h($adresse['name']) ?>"
|
||
data-iban="<?= View::h($adresse['iban']) ?>"
|
||
data-bic="<?= View::h($adresse['bic']) ?>">
|
||
<?= View::h($adresse['name']) ?><?= $adresse['ort'] !== '' ? ', ' . View::h($adresse['ort']) : '' ?>
|
||
</option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
<p class="feldhinweis">Die Auswahl füllt Name, IBAN und BIC – ändern lässt sich alles.</p>
|
||
<?php endif; ?>
|
||
|
||
<label for="empfaenger">Name</label>
|
||
<input type="text" id="empfaenger" name="empfaenger" value="<?= View::h($wert('empfaenger')) ?>" required>
|
||
|
||
<label for="iban">IBAN</label>
|
||
<input type="text" id="iban" name="iban"
|
||
value="<?= View::h($neu ? '' : Adresse::ibanFormatiert($wert('iban'))) ?>" required>
|
||
<p class="feldhinweis">Wird beim Speichern geprüft (Prüfziffer nach ISO 13616).</p>
|
||
|
||
<label for="bic">BIC <span class="optional">(im SEPA-Raum nicht nötig)</span></label>
|
||
<input type="text" id="bic" name="bic" value="<?= View::h($wert('bic')) ?>">
|
||
|
||
<?php if ($neu): ?>
|
||
<label class="ankreuzfeld">
|
||
<input type="checkbox" name="adresse_merken" value="1">
|
||
Empfänger ins Adressbuch übernehmen
|
||
</label>
|
||
<?php endif; ?>
|
||
|
||
<h3>Zahlung</h3>
|
||
|
||
<label for="betrag">Betrag</label>
|
||
<input type="text" id="betrag" name="betrag" inputmode="decimal" required
|
||
value="<?= $neu ? '' : View::h(number_format((float)$wert('betrag', '0'), 2, ',', '')) ?>">
|
||
|
||
<label for="verwendungszweck">Verwendungszweck</label>
|
||
<input type="text" id="verwendungszweck" name="verwendungszweck" maxlength="140"
|
||
value="<?= View::h($wert('verwendungszweck')) ?>">
|
||
<p class="feldhinweis">
|
||
Höchstens 140 Zeichen. Umlaute werden für SEPA umgeschrieben (ä → ae), Zeichen
|
||
außerhalb des erlaubten Vorrats fallen weg – sonst weist die Bank den Auftrag ab.
|
||
</p>
|
||
|
||
<label for="ausfuehrung_am">Ausführung am <span class="optional">(leer = sofort)</span></label>
|
||
<input type="date" id="ausfuehrung_am" name="ausfuehrung_am"
|
||
value="<?= View::h($wert('ausfuehrung_am')) ?>">
|
||
|
||
<label for="kategorie_id">Kategorie</label>
|
||
<select id="kategorie_id" name="kategorie_id">
|
||
<option value="">– keine –</option>
|
||
<?php foreach ($kategorien as $kategorie): ?>
|
||
<option value="<?= (int)$kategorie['id'] ?>"
|
||
<?= (int)$wert('kategorie_id') === (int)$kategorie['id'] ? 'selected' : '' ?>>
|
||
<?= View::h($kategorie['pfad']) ?>
|
||
</option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
<p class="feldhinweis">Wird auf die Buchung übertragen, sobald die Bank den Auftrag annimmt.</p>
|
||
|
||
<label for="klasse_id">Klasse</label>
|
||
<select id="klasse_id" name="klasse_id">
|
||
<option value="">– keine –</option>
|
||
<?php foreach ($klassen as $klasse): ?>
|
||
<option value="<?= (int)$klasse['id'] ?>"
|
||
<?= (int)$wert('klasse_id') === (int)$klasse['id'] ? 'selected' : '' ?>>
|
||
<?= View::h($klasse['name']) ?>
|
||
</option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
|
||
<?php if ($neu || $auftrag['status'] !== 'gesendet'): ?>
|
||
<div class="knopfleiste">
|
||
<button type="submit" class="knopf primaer"><?= $neu ? 'Erfassen' : 'Speichern' ?></button>
|
||
</div>
|
||
<?php endif; ?>
|
||
</form>
|
||
|
||
<?php if (!$neu && $auftrag['status'] !== 'gesendet'): ?>
|
||
<form method="post" action="/zahlungsverkehr/<?= (int)$auftrag['id'] ?>/loeschen" class="formular breit"
|
||
data-bestaetigen="Zahlungsauftrag löschen?">
|
||
<input type="hidden" name="csrf_token" value="<?= View::h($csrfToken) ?>">
|
||
<div class="knopfleiste">
|
||
<button type="submit" class="knopf gefahr">Auftrag löschen</button>
|
||
</div>
|
||
</form>
|
||
<?php endif; ?>
|
||
|
||
<?php include __DIR__ . '/../layout/fuss.php'; ?>
|