91 lines
4.6 KiB
HTML
91 lines
4.6 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}{{ title }}{% endblock %}
|
|
{% block page_title %}{{ title }}{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="row justify-content-center">
|
|
<div class="col-12 col-md-8 col-lg-6">
|
|
<div class="pcard" style="border-top: 4px solid {% if txn_type=='income' %}var(--income){% else %}var(--expense){% endif %};">
|
|
<form method="POST" novalidate>
|
|
{{ form.hidden_tag() }}
|
|
{{ form.transaction_type() }}
|
|
|
|
<div class="mb-3">
|
|
{{ form.description.label(class="form-label fw-medium", style="font-size:13px;") }}
|
|
{{ form.description(class="form-control" + (" is-invalid" if form.description.errors else ""), placeholder="What was this for?") }}
|
|
{% for e in form.description.errors %}<div class="invalid-feedback">{{ e }}</div>{% endfor %}
|
|
</div>
|
|
|
|
<div class="row g-3 mb-3">
|
|
<div class="col-6">
|
|
{{ form.amount.label(class="form-label fw-medium", style="font-size:13px;") }}
|
|
<div class="input-group">
|
|
<span class="input-group-text" style="font-size:13px;">{{ current_user.currency_symbol }}</span>
|
|
{{ form.amount(class="form-control" + (" is-invalid" if form.amount.errors else ""), placeholder="0.00") }}
|
|
</div>
|
|
{% for e in form.amount.errors %}<div class="text-danger mt-1" style="font-size:12px;">{{ e }}</div>{% endfor %}
|
|
</div>
|
|
<div class="col-6">
|
|
{{ form.date.label(class="form-label fw-medium", style="font-size:13px;") }}
|
|
{{ form.date(class="form-control" + (" is-invalid" if form.date.errors else "")) }}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
{{ form.account_id.label(class="form-label fw-medium", style="font-size:13px;") }}
|
|
{{ form.account_id(class="form-select" + (" is-invalid" if form.account_id.errors else "")) }}
|
|
{% for e in form.account_id.errors %}<div class="invalid-feedback">{{ e }}</div>{% endfor %}
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
{{ form.category_id.label(class="form-label fw-medium", style="font-size:13px;") }}
|
|
{{ form.category_id(class="form-select") }}
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
{{ form.notes.label(class="form-label fw-medium", style="font-size:13px;") }}
|
|
{{ form.notes(class="form-control", rows=2, placeholder="Optional notes") }}
|
|
</div>
|
|
|
|
|
|
{% if txn and txn.receipt %}
|
|
<div class="mb-3 p-3" style="background:#f8fafc;border-radius:8px;">
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<div style="font-size:13px;">
|
|
<i class="bi bi-paperclip me-1 text-muted"></i>
|
|
<a href="{{ url_for('settings.view_receipt', filename=txn.receipt.filename) }}" target="_blank">
|
|
{{ txn.receipt.original_filename }}
|
|
</a>
|
|
</div>
|
|
<form method="POST" action="{{ url_for('settings.delete_receipt', txn_id=txn.id) }}" onsubmit="return confirm('Delete receipt?')">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button type="submit" class="btn btn-sm btn-outline-danger" style="font-size:11px;padding:2px 8px;">Remove</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% elif txn %}
|
|
<div class="mb-3">
|
|
<label class="form-label fw-medium" style="font-size:13px;">Receipt</label>
|
|
<form method="POST" action="{{ url_for('settings.upload_receipt', txn_id=txn.id) }}" enctype="multipart/form-data">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<div class="input-group input-group-sm">
|
|
<input type="file" name="receipt" class="form-control" accept=".png,.jpg,.jpeg,.gif,.pdf" style="font-size:12px;">
|
|
<button type="submit" class="btn btn-outline-secondary" style="font-size:12px;">Upload</button>
|
|
</div>
|
|
<small class="text-muted" style="font-size:11px;">PNG, JPG, GIF, PDF — max 10MB</small>
|
|
</form>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="d-flex gap-2">
|
|
<button type="submit" class="btn {% if txn_type=='income' %}btn-success{% else %}btn-danger{% endif %}">
|
|
Save {{ txn_type | title }}
|
|
</button>
|
|
<a href="{{ url_for('transactions.index', tab=txn_type) }}" class="btn btn-outline-secondary">Cancel</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|