Files
budget/views/dead-account.php
T
Ty Clifford b7eaa81501 -
2026-06-14 15:25:31 -04:00

63 lines
4.3 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.
<section class="dead-hero card glow-blue">
<div>
<p class="eyebrow">Dormant and disregarded</p>
<h2>Dead account balance</h2>
<p>Money here is excluded from usable monthly funds until you explicitly restore it.</p>
</div>
<?php if ($hideBalance): ?>
<button class="concealed-balance" type="button" data-concealed-balance data-value="<?= h(Support::money($balance, $symbol)) ?>">
<span class="masked">••••••</span><span class="revealed"></span><small>Hover, then click to confirm</small>
</button>
<?php else: ?>
<div class="visible-balance"><?= h(Support::money($balance, $symbol)) ?></div>
<?php endif; ?>
</section>
<section class="content-grid dead-grid">
<article class="card">
<div class="card-heading"><div><p class="eyebrow">Manual movement</p><h2>Deposit or restore</h2></div></div>
<form method="post" class="stack-form">
<?= csrf_field() ?><input type="hidden" name="action" value="dead.move"><input type="hidden" name="month" value="<?= h($month) ?>">
<label>Direction<select name="direction"><option value="deposit">Move into dormant account</option><option value="restore">Restore to this months usable budget</option></select></label>
<label>Amount<div class="money-input"><span><?= h($symbol) ?></span><input type="number" name="amount" min="0.01" step="0.01" required></div></label>
<label>Reason<textarea name="notes" rows="3" placeholder="Emergency reserve, return to groceries…"></textarea></label>
<button class="button primary" type="submit">Record transfer</button>
</form>
</article>
<article class="card">
<div class="card-heading"><div><p class="eyebrow">Automatic rules</p><h2>How funds arrive here</h2></div><a class="text-link" href="<?= h(url('settings')) ?>">Configure →</a></div>
<div class="rule-list">
<div><span class="metric-icon blue">↙</span><p><strong>Income withholding</strong><small><?= h((string) $settings->get('dead.income_value', 0)) ?><?= $settings->get('dead.income_mode') === 'percent' ? '%' : ' fixed' ?> from each income source</small></p></div>
<div><span class="metric-icon pink">↗</span><p><strong>Transaction pull</strong><small><?= h((string) $settings->get('dead.transaction_value', 0)) ?><?= $settings->get('dead.transaction_mode') === 'percent' ? '%' : ' fixed' ?> whenever an expense is recorded</small></p></div>
<div><span class="metric-icon orange">◇</span><p><strong>Restorations</strong><small>Return to the selected month without changing historical expense records</small></p></div>
</div>
</article>
</section>
<article class="card">
<div class="card-heading">
<div><p class="eyebrow">Permanent paper trail</p><h2>Dormant ledger</h2></div>
<label class="search-box"><span>⌕</span><input type="search" placeholder="Search movements…" data-table-search="dead-table"></label>
</div>
<?php if ($entries === []): ?>
<div class="empty-state"><strong>The account is empty</strong><p>Automatic or manual transfers will appear here.</p></div>
<?php else: ?>
<div class="table-wrap">
<table id="dead-table">
<thead><tr><th>Date</th><th>Budget month</th><th>Movement</th><th>Source</th><th>Amount</th></tr></thead>
<tbody>
<?php foreach ($entries as $entry): ?>
<tr>
<td><?= h(date('M j, Y g:i A', strtotime($entry['created_at']))) ?></td>
<td><a class="text-link" href="<?= h(url('dead-account', ['month' => $entry['month']])) ?>"><?= h($entry['month']) ?></a></td>
<td><strong><?= h(ucwords(str_replace('_', ' ', $entry['kind']))) ?></strong><?php if ($entry['notes']): ?><small><?= h($entry['notes']) ?></small><?php endif; ?></td>
<td><?= h(ucfirst((string) ($entry['source_type'] ?: 'manual'))) ?></td>
<td class="<?= (float) $entry['amount'] >= 0 ? 'green' : 'orange' ?>"><strong><?= (float) $entry['amount'] >= 0 ? '+' : '' ?><?= h(Support::money($entry['amount'], $symbol)) ?></strong></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</article>