Aug 17 - Update with utilities management
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Link Payment{% endblock %}
|
||||
{% block page_title %}Link Existing Payment{% endblock %}
|
||||
|
||||
{% block topbar_actions %}
|
||||
<a href="{{ url_for('utilities.provider_detail', id=bill.provider_id) }}" class="btn btn-sm btn-outline-secondary" style="font-size:12px;">← {{ bill.provider.name }}</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-lg-9">
|
||||
|
||||
<!-- Bill summary -->
|
||||
<div class="pcard mb-3" style="border-left:4px solid {{ bill.provider.color }};">
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<div style="width:42px;height:42px;border-radius:10px;background:{{ bill.provider.color }}22;color:{{ bill.provider.color }};display:flex;align-items:center;justify-content:center;font-size:20px;flex-shrink:0;">
|
||||
<i class="bi {{ bill.provider.icon }}"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<div style="font-size:14px;font-weight:600;">{{ bill.provider.name }}</div>
|
||||
<div style="font-size:12px;color:var(--muted);">{{ bill.period_label }}{% if bill.due_date %} · due {{ bill.due_date.strftime('%b %d, %Y') }}{% endif %}</div>
|
||||
</div>
|
||||
<div class="mono fw-bold" style="font-size:20px;">{{ bill.amount | currency }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pcard p-0">
|
||||
<div class="p-3" style="border-bottom:1px solid var(--border);">
|
||||
<div class="pcard-title mb-1">Candidate Transactions</div>
|
||||
<div class="text-muted" style="font-size:12px;">
|
||||
Expenses within 45 days of the due date, closest amount first. Transactions already linked to another bill are hidden.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if candidates %}
|
||||
<form method="POST" id="linkForm">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<div class="table-wrap">
|
||||
<table class="pfm-table wide">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:40px;"></th>
|
||||
<th>Date</th>
|
||||
<th>Description</th>
|
||||
<th class="d-mob-none">Account</th>
|
||||
<th class="d-mob-none">Category</th>
|
||||
<th class="text-end">Amount</th>
|
||||
<th class="text-end d-mob-none">Δ</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for t in candidates %}
|
||||
{% set diff = (t.amount | float) - (bill.amount | float) %}
|
||||
<tr style="cursor:pointer;" onclick="this.querySelector('input[type=radio]').checked = true;">
|
||||
<td><input type="radio" name="transaction_id" value="{{ t.id }}" class="form-check-input" {% if loop.first %}checked{% endif %}></td>
|
||||
<td style="font-size:12px;">{{ t.date.strftime('%b %d, %Y') }}</td>
|
||||
<td style="font-size:13px;">{{ t.description | truncate(48) }}</td>
|
||||
<td class="d-mob-none" style="font-size:12px;color:var(--muted);">{{ t.account.name if t.account else '—' }}</td>
|
||||
<td class="d-mob-none" style="font-size:12px;color:var(--muted);">{{ t.category.name if t.category else '—' }}</td>
|
||||
<td class="text-end mono fw-bold" style="font-size:13px;">{{ t.amount | currency }}</td>
|
||||
<td class="text-end mono d-mob-none" style="font-size:12px;color:{% if diff == 0 %}#10b981{% else %}var(--muted){% endif %};">
|
||||
{% if diff == 0 %}exact{% else %}{{ '+' if diff > 0 else '' }}{{ '%.2f' | format(diff) }}{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-2 p-3" style="border-top:1px solid var(--border);">
|
||||
<button type="submit" class="btn btn-primary btn-sm"><i class="bi bi-link-45deg me-1"></i>Link Selected Payment</button>
|
||||
<a href="{{ url_for('utilities.bill_pay', id=bill.id) }}" class="btn btn-outline-primary btn-sm">Create New Transaction Instead</a>
|
||||
<a href="{{ url_for('utilities.provider_detail', id=bill.provider_id) }}" class="btn btn-outline-secondary btn-sm">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
{% else %}
|
||||
<div class="text-center py-5">
|
||||
<i class="bi bi-search text-muted" style="font-size:2.5rem;"></i>
|
||||
<h6 class="mt-3 mb-1">No matching transactions</h6>
|
||||
<p class="text-muted small mb-3">Nothing unlinked was found near this bill's due date.</p>
|
||||
<a href="{{ url_for('utilities.bill_pay', id=bill.id) }}" class="btn btn-primary btn-sm">Create a Payment Transaction</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user