05/06 Phase 2: updated and added new files

This commit is contained in:
2026-05-06 17:40:21 -04:00
parent d924e41d9e
commit 8da0c11290
28 changed files with 2113 additions and 35 deletions
+37
View File
@@ -0,0 +1,37 @@
{% extends "admin/layouts/base.html" %}
{% block title %}Add Billing Entry{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card shadow-sm">
<div class="card-header"><h5 class="mb-0">Add Billing Entry — {{ tenant.name }}</h5></div>
<div class="card-body">
{% if error %}<div class="alert alert-danger py-2">{{ error }}</div>{% endif %}
<form method="POST" novalidate>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="mb-3">
<label class="form-label">Amount ($)</label>
<input type="number" step="0.01" class="form-control" name="amount" min="0" required>
</div>
<div class="mb-3">
<label class="form-label">Description</label>
<input type="text" class="form-control" name="description" required>
</div>
<div class="mb-3">
<label class="form-label">Invoice Reference <small class="text-muted">(optional)</small></label>
<input type="text" class="form-control" name="invoice_ref">
</div>
<div class="mb-3">
<label class="form-label">Paid At <small class="text-muted">(optional)</small></label>
<input type="datetime-local" class="form-control" name="paid_at">
</div>
<div class="d-flex gap-2">
<button type="submit" class="btn btn-dark">Save</button>
<a href="{{ url_for('billing.tenant_billing', tenant_id=tenant.id) }}" class="btn btn-outline-secondary">Cancel</a>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}
+32
View File
@@ -0,0 +1,32 @@
{% extends "admin/layouts/base.html" %}
{% block title %}Billing History{% endblock %}
{% block content %}
<h4 class="fw-bold mb-4"><i class="bi bi-receipt me-2"></i>Billing History</h4>
<div class="card shadow-sm">
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead class="table-dark">
<tr><th>Date</th><th>Tenant</th><th>Amount</th><th>Description</th><th>Invoice Ref</th><th>Paid</th></tr>
</thead>
<tbody>
{% for b in entries %}
<tr>
<td class="small">{{ b.created_at.strftime('%Y-%m-%d') }}</td>
<td>
<a href="{{ url_for('tenants.detail', tenant_id=b.tenant_id) }}" class="text-decoration-none">
{{ b.tenant.name if b.tenant else b.tenant_id }}
</a>
</td>
<td class="fw-semibold">${{ "%.2f"|format(b.amount) }}</td>
<td>{{ b.description }}</td>
<td class="text-muted small">{{ b.invoice_ref or '—' }}</td>
<td class="text-muted small">{{ b.paid_at.strftime('%Y-%m-%d') if b.paid_at else '—' }}</td>
</tr>
{% else %}
<tr><td colspan="6" class="text-center text-muted py-4">No billing entries yet.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}
+35
View File
@@ -0,0 +1,35 @@
{% extends "admin/layouts/base.html" %}
{% block title %}Billing — {{ tenant.name }}{% endblock %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
<h4 class="fw-bold mb-0">Billing — {{ tenant.name }}</h4>
<a href="{{ url_for('billing.add_entry', tenant_id=tenant.id) }}" class="btn btn-dark btn-sm">
<i class="bi bi-plus-lg me-1"></i>Add Entry
</a>
</div>
<div class="card shadow-sm">
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead class="table-dark">
<tr><th>Date</th><th>Amount</th><th>Description</th><th>Invoice Ref</th><th>Paid</th></tr>
</thead>
<tbody>
{% for b in entries %}
<tr>
<td class="small">{{ b.created_at.strftime('%Y-%m-%d') }}</td>
<td class="fw-semibold">${{ "%.2f"|format(b.amount) }}</td>
<td>{{ b.description }}</td>
<td class="text-muted small">{{ b.invoice_ref or '—' }}</td>
<td class="text-muted small">{{ b.paid_at.strftime('%Y-%m-%d') if b.paid_at else '—' }}</td>
</tr>
{% else %}
<tr><td colspan="5" class="text-center text-muted py-4">No entries yet.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<a href="{{ url_for('tenants.detail', tenant_id=tenant.id) }}" class="btn btn-outline-secondary btn-sm mt-3">
<i class="bi bi-arrow-left me-1"></i>Back to Tenant
</a>
{% endblock %}