{{define "invoice_search_results"}} {{if .Error}}
{{.ErrorMsg}}

Search term: "{{.SearchTerm}}"

{{else if .NotFound}}
{{.ErrorMsg}}

Search term: "{{.SearchTerm}}"

{{else if .MultipleInvoices}}

Multiple Invoices Found

Found {{.TotalFound}} of {{.TotalSearched}} invoices for: "{{.SearchTerm}}"

{{if gt .FailedCount 0}}

Failed to find {{.FailedCount}} invoices: {{range $i, $id := .FailedIDs}}{{if $i}}, {{end}}{{$id}}{{end}}

{{end}}
{{range .Invoices}} {{template "invoice_card" .}} {{end}}
{{else if .invoiceNumber}}

Invoice Details

{{template "invoice_card" .}}
{{else}}

Unexpected response. Please try again.

{{end}} {{end}}