4 changed files with 425 additions and 40 deletions
@ -1,43 +1,116 @@ |
|||||
{{define "invoice_search_results"}} {{if .Error}} |
{{define "invoice_search_results"}} |
||||
|
{{if .Error}} |
||||
<div class="not-found"> |
<div class="not-found"> |
||||
{{.ErrorMsg}} |
{{.ErrorMsg}} |
||||
<p>Search term: "{{.SearchTerm}}"</p> |
<p>Search term: "{{.SearchTerm}}"</p> |
||||
</div> |
</div> |
||||
|
|
||||
{{else if .NotFound}} |
{{else if .NotFound}} |
||||
<div class="not-found"> |
<div class="not-found"> |
||||
{{.ErrorMsg}} |
{{.ErrorMsg}} |
||||
<p>Search term: "{{.SearchTerm}}"</p> |
<p>Search term: "{{.SearchTerm}}"</p> |
||||
</div> |
</div> |
||||
|
|
||||
|
{{else if .MultipleInvoices}} |
||||
|
<div class="multiple-invoices"> |
||||
|
<h3>Multiple Invoices Found</h3> |
||||
|
<div class="invoice-summary"> |
||||
|
<p>Found <strong>{{.TotalFound}}</strong> of {{.TotalSearched}} invoices for: "{{.SearchTerm}}"</p> |
||||
|
{{if gt .FailedCount 0}} |
||||
|
<p class="error-text">Failed to find {{.FailedCount}} invoices: {{range $i, $id := .FailedIDs}}{{if $i}}, |
||||
|
{{end}}{{$id}}{{end}}</p> |
||||
|
{{end}} |
||||
|
</div> |
||||
|
|
||||
|
{{range .Invoices}} |
||||
|
<div class="invoice-card"> |
||||
|
<div class="invoice-header"> |
||||
|
<h4>Invoice #{{.invoiceNumber}}</h4> |
||||
|
<div class="invoice-status {{.status}}">{{.status}}</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="invoice-details"> |
||||
|
<div class="invoice-info"> |
||||
|
{{with .customer}}<p><strong>Customer:</strong> {{.name}}</p>{{end}} |
||||
|
{{with .job}}<p><strong>Job:</strong> {{.name}}</p>{{end}} |
||||
|
<p><strong>Total:</strong> ${{.totalPrice}}</p> |
||||
|
</div> |
||||
|
|
||||
|
<div class="invoice-actions"> |
||||
|
<div class="button-group"> |
||||
|
{{range .buttons}} |
||||
|
<button hx-put="{{.Action}}" hx-confirm="{{.ConfirmText}}" hx-target="#invoice-search-results" |
||||
|
class="compact-button {{.Class}}" title="{{.Label}}" data-status="{{.Status}}"> |
||||
|
<span class="icon"> |
||||
|
{{if eq .Status "draft"}}📝 |
||||
|
{{else if eq .Status "ok"}}✅ |
||||
|
{{else if eq .Status "failed"}}❌ |
||||
|
{{else if eq .Status "pending_accounting"}}⏳ |
||||
|
{{else if eq .Status "processed"}}📊 |
||||
|
{{else if eq .Status "void"}}🚫 |
||||
|
{{end}} |
||||
|
</span> |
||||
|
</button> |
||||
|
{{end}} |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
{{end}} |
||||
|
</div> |
||||
|
|
||||
{{else if .invoiceNumber}} |
{{else if .invoiceNumber}} |
||||
<h3>Invoice Details</h3> |
<div class="multiple-invoices"> |
||||
|
<h3>Invoice Details</h3> |
||||
{{range .buttons}} |
|
||||
<button |
<div class="invoice-card"> |
||||
hx-put="{{.Action}}" |
<div class="invoice-header"> |
||||
hx-confirm="{{.ConfirmText}}" |
<h4>Invoice #{{.invoiceNumber}}</h4> |
||||
hx-target="#invoice-search-results" |
<div class="invoice-status {{.status}}">{{.status}}</div> |
||||
class="{{.Class}}"> |
</div> |
||||
{{.Label}} |
|
||||
</button> |
<div class="invoice-details"> |
||||
{{end}} |
<div class="invoice-info"> |
||||
|
{{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}} |
||||
|
<p><strong>Total Price:</strong> ${{.totalPrice}}</p> |
||||
|
|
||||
<p><strong>Invoice Number:</strong> {{.invoiceNumber}}</p> |
{{if .items}} |
||||
<p><strong>Total Price:</strong> ${{.totalPrice}}</p> |
<div class="invoice-items"> |
||||
<p><strong>Status:</strong> {{.status}}</p> |
<h5>Items</h5> |
||||
|
<ul> |
||||
{{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}} |
{{range .items}} |
||||
<li>{{.description}} - ${{.totalPrice}}</li> |
<li>{{.description}} - ${{.totalPrice}}</li> |
||||
{{end}} |
{{end}} |
||||
</ul> |
</ul> |
||||
{{end}} {{else}} |
</div> |
||||
|
{{end}} |
||||
|
</div> |
||||
|
|
||||
|
<div class="invoice-actions"> |
||||
|
<div class="button-group"> |
||||
|
{{range .buttons}} |
||||
|
<button hx-put="{{.Action}}" hx-confirm="{{.ConfirmText}}" hx-target="#invoice-search-results" |
||||
|
class="compact-button {{.Class}}" title="{{.Label}}" data-status="{{.Status}}"> |
||||
|
<span class="icon"> |
||||
|
{{if eq .Status "draft"}}📝 |
||||
|
{{else if eq .Status "ok"}}✅ |
||||
|
{{else if eq .Status "failed"}}❌ |
||||
|
{{else if eq .Status "pending_accounting"}}⏳ |
||||
|
{{else if eq .Status "processed"}}📊 |
||||
|
{{else if eq .Status "void"}}🚫 |
||||
|
{{end}} |
||||
|
</span> |
||||
|
</button> |
||||
|
{{end}} |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
{{else}} |
||||
<p>Unexpected response. Please try again.</p> |
<p>Unexpected response. Please try again.</p> |
||||
{{end}} {{end}} |
{{end}} |
||||
|
{{end}} |
||||
Loading…
Reference in new issue