05/07 Phase 3: initial codes

This commit is contained in:
2026-05-07 12:17:19 -04:00
parent 6e5518c103
commit ce462c57b2
107 changed files with 6365 additions and 208 deletions
@@ -0,0 +1,49 @@
{% extends "tenant/layouts/base.html" %}
{% block title %}Gift Cards{% endblock %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
<h4 class="fw-bold mb-0"><i class="bi bi-gift me-2"></i>Gift Cards</h4>
<div class="d-flex gap-2">
<a href="{{ url_for('gift_cards.lookup') }}" class="btn btn-outline-secondary btn-sm">Lookup Code</a>
<a href="{{ url_for('gift_cards.issue') }}" class="btn btn-primary btn-sm">+ Issue Gift Card</a>
</div>
</div>
<div class="card shadow-sm">
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead class="table-light">
<tr><th>Code</th><th>Original</th><th>Balance</th><th>Customer</th><th>Expires</th><th>Status</th><th></th></tr>
</thead>
<tbody>
{% for card in cards %}
<tr class="{{ '' if card.is_active else 'text-muted' }}">
<td class="font-monospace fw-semibold">{{ card.code }}</td>
<td>${{ "%.2f"|format(card.original_value) }}</td>
<td class="fw-semibold {% if card.remaining_balance <= 0 %}text-danger{% endif %}">
${{ "%.2f"|format(card.remaining_balance) }}
</td>
<td class="small">{{ card.customer.name if card.issued_to_customer_id and card.customer else '—' }}</td>
<td class="small text-muted">{{ card.expires_at.strftime('%Y-%m-%d') if card.expires_at else 'No expiry' }}</td>
<td>
<span class="badge {{ 'bg-success' if card.is_active else 'bg-secondary' }}">
{{ 'Active' if card.is_active else 'Inactive' }}
</span>
</td>
<td>
{% if card.is_active %}
<form method="POST" action="{{ url_for('gift_cards.deactivate', card_id=card.id) }}"
class="d-inline" onsubmit="return confirm('Deactivate this gift card?')">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button class="btn btn-outline-danger btn-sm">Deactivate</button>
</form>
{% endif %}
</td>
</tr>
{% else %}
<tr><td colspan="7" class="text-center text-muted py-4">No gift cards issued yet.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}