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.
78 lines
2.2 KiB
78 lines
2.2 KiB
{{define "invoice_search_results"}} {{if .Error}}
|
|
<div class="not-found">
|
|
<p>{{.ErrorMsg}}</p>
|
|
<p>Search term: "{{.SearchTerm}}"</p>
|
|
</div>
|
|
{{else if .NotFound}}
|
|
<div class="not-found">
|
|
<p>{{.ErrorMsg}}</p>
|
|
<p>Search term: "{{.SearchTerm}}"</p>
|
|
</div>
|
|
{{else if .invoiceNumber}}
|
|
<h3>Invoice Details</h3>
|
|
{{if and (or (ne .status "void") (ne .status "processed")) (or (eq .status
|
|
"draft") (eq .status "ok") (eq .status "pending_accounting") (eq .status
|
|
"failed") )}}
|
|
<button
|
|
hx-put="/draft-invoice/{{.id}}"
|
|
hx-confirm="Are you sure you want to void this invoice?"
|
|
hx-target="#invoice-search-results"
|
|
class="success-button">
|
|
Draft Invoice
|
|
</button>
|
|
<button
|
|
hx-put="/ok-invoice/{{.id}}"
|
|
hx-confirm="Are you sure you want to void this invoice?"
|
|
hx-target="#invoice-search-results"
|
|
class="success-button">
|
|
Ok Invoice
|
|
</button>
|
|
<button
|
|
hx-put="/fail-invoice/{{.id}}"
|
|
hx-confirm="Are you sure you want to void this invoice?"
|
|
hx-target="#invoice-search-results"
|
|
class="caution-button">
|
|
Fail Invoice
|
|
</button>
|
|
<button
|
|
hx-put="/pending-invoice/{{.id}}"
|
|
hx-confirm="Are you sure you want to void this invoice?"
|
|
hx-target="#invoice-search-results"
|
|
class="caution-button">
|
|
Pending Invoice
|
|
</button>
|
|
{{end}} {{if and (ne .status "void") (ne .status "processed")}}
|
|
<button
|
|
hx-put="/process-invoice/{{.id}}"
|
|
hx-confirm="Are you sure you want to void this invoice?"
|
|
hx-target="#invoice-search-results"
|
|
class="warning-button">
|
|
Process Invoice
|
|
</button>
|
|
<button
|
|
hx-put="/void-invoice/{{.id}}"
|
|
hx-confirm="Are you sure you want to void this invoice?"
|
|
hx-target="#invoice-search-results"
|
|
class="warning-button">
|
|
Void Invoice
|
|
</button>
|
|
{{end}}
|
|
<p><strong>Invoice Number:</strong> {{.invoiceNumber}}</p>
|
|
<p><strong>Total Price:</strong> ${{.totalPrice}}</p>
|
|
<p><strong>Status:</strong> {{.status}}</p>
|
|
{{with .customer}}
|
|
<p><strong>Customer:</strong> {{.name}}</p>
|
|
{{end}} {{with .job}}
|
|
<p><strong>Job:</strong> {{.name}}</p>
|
|
{{end}} {{with .location}}
|
|
<p><strong>Location:</strong> {{.name}}</p>
|
|
{{end}} {{if .items}}
|
|
<h4>Items:</h4>
|
|
<ul>
|
|
{{range .items}}
|
|
<li>{{.description}} - ${{.totalPrice}}</li>
|
|
{{end}}
|
|
</ul>
|
|
{{end}} {{else}}
|
|
<p>Unexpected response. Please try again.</p>
|
|
{{end}} {{end}}
|
|
|