You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
4.1 KiB
157 lines
4.1 KiB
<!doctype html> |
|
<html> |
|
<head> |
|
<title>Edit Invoice</title> |
|
<style> |
|
.status-badge { |
|
display: inline-block; |
|
padding: 3px 8px; |
|
border-radius: 999px; |
|
font-size: 12px; |
|
font-weight: bold; |
|
text-transform: uppercase; |
|
letter-spacing: 0.03em; |
|
} |
|
.status-draft { background: #e5e7eb; color: #111827; } |
|
.status-pending { background: #dbeafe; color: #1d4ed8; } |
|
.status-partial { background: #fef3c7; color: #92400e; } |
|
.status-paid { background: #dcfce7; color: #166534; } |
|
.status-overdue { background: #fee2e2; color: #991b1b; } |
|
.status-cancelled { background: #e5e7eb; color: #4b5563; } |
|
|
|
.info-box { |
|
border: 1px solid #2563eb; |
|
background: #eff6ff; |
|
padding: 10px; |
|
margin-bottom: 15px; |
|
} |
|
.warn-box { |
|
border: 1px solid #aa6600; |
|
background: #fff4dd; |
|
padding: 10px; |
|
margin-bottom: 15px; |
|
} |
|
.error-box { |
|
border: 1px solid red; |
|
padding: 10px; |
|
margin-bottom: 15px; |
|
} |
|
</style> |
|
</head> |
|
|
|
<body> |
|
|
|
<h1>Edit Invoice</h1> |
|
|
|
<p><a href="/">Home</a></p> |
|
<p><a href="/invoices">Back to Invoices</a></p> |
|
|
|
{% if errors %} |
|
<div class="error-box"> |
|
<strong>Please fix the following:</strong> |
|
<ul> |
|
{% for error in errors %} |
|
<li>{{ error }}</li> |
|
{% endfor %} |
|
</ul> |
|
</div> |
|
{% endif %} |
|
|
|
{% if locked %} |
|
<div class="warn-box"> |
|
<strong>This invoice is locked for core edits because payments exist.</strong><br> |
|
Core accounting fields cannot be changed after payment activity begins. |
|
</div> |
|
{% else %} |
|
<div class="info-box"> |
|
<strong>Manual status choices are limited to:</strong> draft, pending, or cancelled.<br> |
|
Partial, paid, and overdue are system-managed from payment activity and due dates. |
|
</div> |
|
{% endif %} |
|
|
|
<form method="post"> |
|
|
|
<p> |
|
Invoice Number<br> |
|
<input value="{{ invoice.invoice_number }}" readonly> |
|
</p> |
|
|
|
{% if not locked %} |
|
<p> |
|
Client *<br> |
|
<select name="client_id" required> |
|
{% for c in clients %} |
|
<option value="{{ c.id }}" {% if invoice.client_id == c.id %}selected{% endif %}> |
|
{{ c.client_code }} - {{ c.company_name }} |
|
</option> |
|
{% endfor %} |
|
</select> |
|
</p> |
|
|
|
<p> |
|
Service *<br> |
|
<select name="service_id" required> |
|
{% for s in services %} |
|
<option value="{{ s.id }}" {% if invoice.service_id == s.id %}selected{% endif %}> |
|
{{ s.service_code }} - {{ s.service_name }} |
|
</option> |
|
{% endfor %} |
|
</select> |
|
</p> |
|
|
|
<p> |
|
Currency *<br> |
|
<select name="currency_code" required> |
|
<option value="CAD" {% if invoice.currency_code == 'CAD' %}selected{% endif %}>CAD</option> |
|
<option value="ETHO" {% if invoice.currency_code == 'ETHO' %}selected{% endif %}>ETHO</option> |
|
<option value="EGAZ" {% if invoice.currency_code == 'EGAZ' %}selected{% endif %}>EGAZ</option> |
|
<option value="ALT" {% if invoice.currency_code == 'ALT' %}selected{% endif %}>ALT</option> |
|
</select> |
|
</p> |
|
|
|
<p> |
|
Total Amount *<br> |
|
<input type="number" step="0.00000001" min="0" name="total_amount" value="{{ invoice.total_amount }}" required> |
|
</p> |
|
{% else %} |
|
<p>Client ID<br><input value="{{ invoice.client_id }}" readonly></p> |
|
<p>Service ID<br><input value="{{ invoice.service_id }}" readonly></p> |
|
<p>Currency<br><input value="{{ invoice.currency_code }}" readonly></p> |
|
<p>Total Amount<br><input value="{{ invoice.total_amount|money(invoice.currency_code) }}" readonly></p> |
|
{% endif %} |
|
|
|
<p> |
|
Due Date *<br> |
|
<input type="date" name="due_at" value="{{ invoice.due_at.strftime('%Y-%m-%d') if invoice.due_at else '' }}" required> |
|
</p> |
|
|
|
{% if locked %} |
|
<p> |
|
System Status<br> |
|
<span class="status-badge status-{{ invoice.status }}">{{ invoice.status }}</span> |
|
</p> |
|
{% else %} |
|
<p> |
|
Status *<br> |
|
<select name="status" required> |
|
<option value="draft" {% if invoice.status == 'draft' %}selected{% endif %}>draft</option> |
|
<option value="pending" {% if invoice.status == 'pending' %}selected{% endif %}>pending</option> |
|
<option value="cancelled" {% if invoice.status == 'cancelled' %}selected{% endif %}>cancelled</option> |
|
</select> |
|
</p> |
|
{% endif %} |
|
|
|
<p> |
|
Notes<br> |
|
<textarea name="notes" rows="5" cols="60">{{ invoice.notes or '' }}</textarea> |
|
</p> |
|
|
|
<p> |
|
<button type="submit">Save Invoice</button> |
|
</p> |
|
|
|
</form> |
|
|
|
{% include "footer.html" %} |
|
</body> |
|
</html>
|
|
|