count overpay as debts when fronted + add debt writeoff

This commit is contained in:
SowinskiBraeden committed 2026-06-11 13:11:04 -07:00
1 parent 1265e3047f
commit 64b6cd175e
8 files changed
+194 -5

No files matched your search

+45 -1
View File
@@ -112,6 +112,39 @@
</form>
</div>
</section>
<form class="panel form-card" method="post" action="{{ url_for('admin_write_off_front') }}">
<p class="eyebrow">Front debt</p>
<h2>Write off debt</h2>
<label>
<span>Outstanding debt</span>
<select name="debt_key" required>
<option value="">Select debt</option>
{% for item in debt_entries %}
{% set session = item.session %}
{% set entry = item.entry %}
<option value="{{ session.session_id }}||{{ entry.player_name }}">
{{ entry.player_name }} · {{ session_label(session) }} · owes {{ entry.player_owes_cents | money }}
</option>
{% endfor %}
</select>
</label>
<label>
<span>Amount to write off</span>
<input type="number" step="0.01" name="amount" placeholder="5.00" required>
</label>
<label>
<span>Note</span>
<textarea name="note" rows="3" placeholder="Won't be collected."></textarea>
</label>
<div class="button-row">
<button class="secondary-button" type="submit">Write off front</button>
</div>
</form>
</section>
</section>
@@ -140,6 +173,13 @@
</strong>
</article>
<article class="panel stat-card">
<span>Written off</span>
<strong class="{{ 'negative' if admin_totals.written_off_cents > 0 else '' }}">
{{ admin_totals.written_off_cents | money }}
</strong>
</article>
<article class="panel stat-card">
<span>Open balance</span>
<strong class="{% if admin_totals.open_balance_cents > 0 %}negative{% elif admin_totals.open_balance_cents < 0 %}positive{% endif %}">
@@ -165,6 +205,7 @@
<th>Paid out</th>
<th>Still owed</th>
<th>Players owe</th>
<th>Written off</th>
<th>Open balance</th>
<th>Status</th>
<th>Action</th>
@@ -187,6 +228,9 @@
<td class="{{ 'negative' if session.total_player_owes_cents > 0 else '' }}">
{{ session.total_player_owes_cents | money }}
</td>
<td class="{{ 'negative' if session.total_front_writeoff_cents > 0 else '' }}">
{{ session.total_front_writeoff_cents | money }}
</td>
<td class="{% if session.total_open_balance_cents > 0 %}negative{% elif session.total_open_balance_cents < 0 %}positive{% endif %}">
{{ session.total_open_balance_cents | money }}
</td>
@@ -208,7 +252,7 @@
</tr>
{% else %}
<tr>
<td colspan="4">No sessions yet.</td>
<td colspan="10">No sessions yet.</td>
</tr>
{% endfor %}
</tbody>