Files
2026-11-17 21:48:36 +01:00

20 lines
1.8 KiB
HTML

{% macro debt_form(x=None) %}
<form method="post" action="/debts/save" class="form-grid">
<input type="hidden" name="id" value="{{ x.id if x else '' }}">
<label>Name<input name="name" required value="{{ x.name if x else '' }}" placeholder="DUO study loan / Loan to Sam"></label>
<label>Direction<select name="direction">
<option value="i_owe" {{ 'selected' if x and x.direction == 'i_owe' }}>I owe them</option>
<option value="owed_to_me" {{ 'selected' if x and x.direction == 'owed_to_me' }}>They owe me</option></select></label>
<label>Counterparty<input name="counterparty" value="{{ x.counterparty if x else '' }}"></label>
<label>Amount (€)<input name="principal" inputmode="decimal" required value="{{ x.principal if x else '' }}"></label>
<label>Start date<input type="date" name="start_date" value="{{ x.start_date.isoformat() if x else today().isoformat() }}"></label>
<label>Monthly payment (€)<input name="monthly_payment" inputmode="decimal" value="{{ x.monthly_payment if x and x.monthly_payment else '' }}" placeholder="optional"></label>
<label>Due day of month<input name="due_day" type="number" min="1" max="31" value="{{ x.due_day if x and x.due_day else '' }}" placeholder="optional"></label>
<label>Interest % / year<input name="interest_rate" inputmode="decimal" value="{{ x.interest_rate if x and x.interest_rate is not none else '' }}" placeholder="informational"></label>
<label title="Bank transactions whose name/description contains this are counted as payments automatically">Auto-match bank text
<input name="match_pattern" value="{{ x.match_pattern if x and x.match_pattern else '' }}" placeholder="e.g. DUO or S. Jansen"></label>
<label>Notes<input name="notes" value="{{ x.notes if x else '' }}"></label>
<div><button>{{ 'Save' if x else 'Add' }}</button></div>
</form>
{% endmacro %}