Finanzmanager/src/Views/vertraege/adressen.php
fds2610-bot 26b9cb12f1 Fix n.n.: Position der Neu-Knöpfe, Erklärtexte als Tooltip am Reiter
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-01 11:28:13 +02:00

188 lines
8.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use Finanzmanager\Models\Adresse;
use Finanzmanager\View;
/**
* @var list<array<string,mixed>> $adressen
* @var string $suche
* @var string $csrfToken
*/
include __DIR__ . '/../layout/kopf.php';
?>
<div class="tableiste">
<a href="/vertraege" class="tab">Verträge</a>
<span class="tab aktiv">Adressen</span>
<a href="/vertraege/sparziele" class="tab">Sparziele</a>
<a href="/vertraege/kredite" class="tab">Kredite</a>
</div>
<p class="hinweis">
Das Adressbuch speist die Empfängerauswahl im Zahlungsverkehr. IBANs werden beim
Speichern geprüft – die Prüfziffer fängt Zahlendreher ab, bevor eine Überweisung
hinausgeht.
</p>
<div class="seitenaktionen">
<button type="button" class="knopf primaer" id="neu-knopf" data-neudialog="neudialog">+ Neu</button>
<form method="get" action="/vertraege/adressen" class="filterleiste">
<label for="suche">Suchen</label>
<input type="search" id="suche" name="suche" value="<?= View::h($suche) ?>"
placeholder="Name, Ort oder IBAN">
<button type="submit" class="knopf">Suchen</button>
<?php if ($suche !== ''): ?>
<a href="/vertraege/adressen" class="knopf">Alle zeigen</a>
<?php endif; ?>
</form>
</div>
<?php if ($adressen === []): ?>
<p class="platzhalter">
<?= $suche === '' ? 'Noch keine Adressen erfasst.' : 'Keine Adresse passt zur Suche.' ?>
</p>
<?php else: ?>
<?php foreach ($adressen as $adresse): ?>
<form id="adresse-<?= (int)$adresse['id'] ?>" method="post"
action="/vertraege/adressen/<?= (int)$adresse['id'] ?>"></form>
<form id="adresse-loeschen-<?= (int)$adresse['id'] ?>" method="post"
action="/vertraege/adressen/<?= (int)$adresse['id'] ?>/loeschen"
data-bestaetigen="Adresse „<?= View::h($adresse['name']) ?>“ löschen?"></form>
<?php endforeach; ?>
<table class="liste">
<thead>
<tr><th>Name</th><th>Ort</th><th>IBAN</th><th>BIC</th><th>Kontakt</th><th class="rechts">Aktion</th></tr>
</thead>
<tbody>
<?php foreach ($adressen as $adresse): ?>
<?php $f = 'adresse-' . (int)$adresse['id']; ?>
<tr>
<td>
<input type="hidden" form="<?= $f ?>" name="csrf_token" value="<?= View::h($csrfToken) ?>">
<input type="text" form="<?= $f ?>" name="name" value="<?= View::h($adresse['name']) ?>" required>
<input type="hidden" form="<?= $f ?>" name="zusatz" value="<?= View::h($adresse['zusatz']) ?>">
<input type="hidden" form="<?= $f ?>" name="strasse" value="<?= View::h($adresse['strasse']) ?>">
<input type="hidden" form="<?= $f ?>" name="land" value="<?= View::h($adresse['land']) ?>">
<input type="hidden" form="<?= $f ?>" name="notiz" value="<?= View::h($adresse['notiz'] ?? '') ?>">
</td>
<td class="nowrap">
<input type="text" form="<?= $f ?>" name="plz" class="schmal"
value="<?= View::h($adresse['plz']) ?>">
<input type="text" form="<?= $f ?>" name="ort" value="<?= View::h($adresse['ort']) ?>">
</td>
<td>
<input type="text" form="<?= $f ?>" name="iban"
value="<?= View::h(Adresse::ibanFormatiert($adresse['iban'])) ?>">
</td>
<td>
<input type="text" form="<?= $f ?>" name="bic" class="schmal"
value="<?= View::h($adresse['bic']) ?>">
</td>
<td>
<input type="text" form="<?= $f ?>" name="email" value="<?= View::h($adresse['email']) ?>"
placeholder="E-Mail">
<input type="hidden" form="<?= $f ?>" name="telefon" value="<?= View::h($adresse['telefon']) ?>">
</td>
<td class="rechts nowrap">
<input type="hidden" form="adresse-loeschen-<?= (int)$adresse['id'] ?>"
name="csrf_token" value="<?= View::h($csrfToken) ?>">
<button type="submit" form="<?= $f ?>" class="knopf klein">Speichern</button>
<button type="submit" form="adresse-loeschen-<?= (int)$adresse['id'] ?>"
class="knopf klein gefahr">Löschen</button>
</td>
</tr>
<tr>
<td colspan="6">
<details>
<summary>
Letzte Buchungen
<?= $adresse['buchungen'] !== [] ? '(' . count($adresse['buchungen']) . ')' : '' ?>
</summary>
<?php if ($adresse['buchungen'] === []): ?>
<p class="platzhalter">Noch keine Buchung mit diesem Empfänger.</p>
<?php else: ?>
<table class="liste">
<thead>
<tr><th>Datum</th><th>Konto</th><th>Buchungstext</th><th class="rechts">Betrag</th></tr>
</thead>
<tbody>
<?php foreach ($adresse['buchungen'] as $buchung): ?>
<tr>
<td><?= View::datum($buchung['datum']) ?></td>
<td><?= View::h($buchung['kontoname']) ?></td>
<td><?= View::h($buchung['buchungstext']) ?></td>
<td class="rechts <?= View::betragKlasse($buchung['betrag']) ?>">
<?= View::betrag($buchung['betrag']) ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</details>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<dialog id="neudialog" class="splitdialog neudialog">
<form method="post" action="/vertraege/adressen/neu" class="formular breit">
<input type="hidden" name="csrf_token" value="<?= View::h($csrfToken) ?>">
<h2>Neue Adresse</h2>
<label for="name">Name</label>
<input type="text" id="name" name="name" required>
<label for="zusatz">Zusatz <span class="optional">(optional)</span></label>
<input type="text" id="zusatz" name="zusatz">
<label for="strasse">Straße</label>
<input type="text" id="strasse" name="strasse">
<div class="feldpaar">
<div>
<label for="plz">PLZ</label>
<input type="text" id="plz" name="plz">
</div>
<div>
<label for="ort">Ort</label>
<input type="text" id="ort" name="ort">
</div>
<div>
<label for="land">Land</label>
<input type="text" id="land" name="land">
</div>
</div>
<label for="iban">IBAN</label>
<input type="text" id="iban" name="iban" placeholder="DE00 0000 0000 0000 0000 00">
<label for="bic">BIC</label>
<input type="text" id="bic" name="bic">
<div class="feldpaar">
<div>
<label for="email">E-Mail</label>
<input type="text" id="email" name="email">
</div>
<div>
<label for="telefon">Telefon</label>
<input type="text" id="telefon" name="telefon">
</div>
</div>
<label for="notiz">Notiz</label>
<input type="text" id="notiz" name="notiz">
<div class="knopfleiste">
<button type="submit" class="knopf primaer">Adresse anlegen</button>
<button type="submit" class="knopf" formmethod="dialog" formnovalidate>Abbrechen</button>
</div>
</form>
</dialog>
<?php include __DIR__ . '/../layout/fuss.php'; ?>