From b4ccdeff2fc2e84717961c1f548b0de1dd5cc2a5 Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Fri, 3 May 2024 20:09:07 +0200 Subject: [PATCH] Add filters and pagination to payments --- pkg/payment/admin.go | 35 ++++-- pkg/payment/filter.go | 125 +++++++++++++++++++++ po/ca.po | 82 ++++++++------ po/es.po | 82 ++++++++------ po/fr.po | 82 ++++++++------ web/templates/admin/payment/index.gohtml | 62 ++++++++-- web/templates/admin/payment/results.gohtml | 10 ++ 7 files changed, 358 insertions(+), 120 deletions(-) create mode 100644 pkg/payment/filter.go create mode 100644 web/templates/admin/payment/results.gohtml diff --git a/pkg/payment/admin.go b/pkg/payment/admin.go index 8b70d97..bb07bb2 100644 --- a/pkg/payment/admin.go +++ b/pkg/payment/admin.go @@ -108,17 +108,24 @@ func (h *AdminHandler) paymentHandler(user *auth.User, company *auth.Company, co } func servePaymentIndex(w http.ResponseWriter, r *http.Request, user *auth.User, company *auth.Company, conn *database.Conn) { - payments, err := collectPaymentEntries(r.Context(), company, conn, user.Locale) + filters := newFilterForm(r.Context(), conn, company, user.Locale) + if err := filters.Parse(r); err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + payments, err := collectPaymentEntries(r.Context(), company, conn, user.Locale, filters) if err != nil { panic(err) } page := &paymentIndex{ - Payments: payments, + Payments: filters.buildCursor(payments), + Filters: filters, } page.MustRender(w, r, user, company) } type paymentEntry struct { + ID int URL string Reference string DownPayment string @@ -128,9 +135,11 @@ type paymentEntry struct { CreatedAt time.Time } -func collectPaymentEntries(ctx context.Context, company *auth.Company, conn *database.Conn, locale *locale.Locale) ([]*paymentEntry, error) { - rows, err := conn.Query(ctx, ` - select '/admin/payments/' || payment.slug +func collectPaymentEntries(ctx context.Context, company *auth.Company, conn *database.Conn, locale *locale.Locale, filters *filterForm) ([]*paymentEntry, error) { + where, args := filters.BuildQuery([]interface{}{locale.Language}) + rows, err := conn.Query(ctx, fmt.Sprintf(` + select payment_id + , '/admin/payments/' || payment.slug , payment.reference , to_price(payment.down_payment, decimal_digits) , to_price(total, decimal_digits) @@ -141,10 +150,12 @@ func collectPaymentEntries(ctx context.Context, company *auth.Company, conn *dat join currency using (currency_code) join payment_status using (payment_status) left join payment_status_i18n on payment_status_i18n.payment_status = payment.payment_status - and payment_status_i18n.lang_tag = $2 - where company_id = $1 + and payment_status_i18n.lang_tag = $1 + where (%s) order by created_at desc - `, company.ID, locale.Language) + , payment_id + limit %d + `, where, filters.PerPage()+1), args...) if err != nil { return nil, err } @@ -154,6 +165,7 @@ func collectPaymentEntries(ctx context.Context, company *auth.Company, conn *dat for rows.Next() { entry := &paymentEntry{} if err = rows.Scan( + &entry.ID, &entry.URL, &entry.Reference, &entry.DownPayment, @@ -172,10 +184,15 @@ func collectPaymentEntries(ctx context.Context, company *auth.Company, conn *dat type paymentIndex struct { Payments []*paymentEntry + Filters *filterForm } func (page *paymentIndex) MustRender(w http.ResponseWriter, r *http.Request, user *auth.User, company *auth.Company) { - template.MustRenderAdmin(w, r, user, company, "payment/index.gohtml", page) + if httplib.IsHTMxRequest(r) && page.Filters.Paginated() { + template.MustRenderAdminNoLayout(w, r, user, company, "payment/results.gohtml", page) + } else { + template.MustRenderAdminFiles(w, r, user, company, page, "payment/index.gohtml", "payment/results.gohtml") + } } type paymentDetails struct { diff --git a/pkg/payment/filter.go b/pkg/payment/filter.go new file mode 100644 index 0000000..8eb90d8 --- /dev/null +++ b/pkg/payment/filter.go @@ -0,0 +1,125 @@ +package payment + +import ( + "context" + "fmt" + "net/http" + "strconv" + "strings" + + "dev.tandem.ws/tandem/camper/pkg/auth" + "dev.tandem.ws/tandem/camper/pkg/database" + "dev.tandem.ws/tandem/camper/pkg/form" + "dev.tandem.ws/tandem/camper/pkg/locale" +) + +type filterForm struct { + company *auth.Company + PaymentStatus *form.Select + Reference *form.Input + FromDate *form.Input + ToDate *form.Input + Cursor *form.Cursor +} + +func newFilterForm(ctx context.Context, conn *database.Conn, company *auth.Company, locale *locale.Locale) *filterForm { + return &filterForm{ + company: company, + PaymentStatus: &form.Select{ + Name: "payment_status", + Options: mustGetPaymentStatusOptions(ctx, conn, locale), + }, + Reference: &form.Input{ + Name: "reference", + }, + FromDate: &form.Input{ + Name: "from_date", + }, + ToDate: &form.Input{ + Name: "to_date", + }, + Cursor: &form.Cursor{ + Name: "cursor", + PerPage: 25, + }, + } +} + +func mustGetPaymentStatusOptions(ctx context.Context, conn *database.Conn, locale *locale.Locale) []*form.Option { + return form.MustGetOptions(ctx, conn, ` + select payment_status.payment_status + , isi18n.name + from payment_status + join payment_status_i18n isi18n using(payment_status) + where isi18n.lang_tag = $1 + order by payment_status`, locale.Language) +} + +func (f *filterForm) Parse(r *http.Request) error { + if err := r.ParseForm(); err != nil { + return err + } + f.PaymentStatus.FillValue(r) + f.Reference.FillValue(r) + f.FromDate.FillValue(r) + f.ToDate.FillValue(r) + f.Cursor.FillValue(r) + return nil +} + +func (f *filterForm) BuildQuery(args []interface{}) (string, []interface{}) { + var where []string + appendWhere := func(expression string, value interface{}) { + args = append(args, value) + where = append(where, fmt.Sprintf(expression, len(args))) + } + maybeAppendWhere := func(expression string, value string, conv func(string) interface{}) { + if value != "" { + if conv == nil { + appendWhere(expression, value) + } else { + appendWhere(expression, conv(value)) + } + } + } + + appendWhere("payment.company_id = $%d", f.company.ID) + maybeAppendWhere("payment.payment_status = $%d", f.PaymentStatus.String(), nil) + maybeAppendWhere("payment.reference like $%d", f.Reference.Val, func(v string) interface{} { + return "%" + v + }) + maybeAppendWhere("payment.created_at >= $%d", f.FromDate.Val, nil) + maybeAppendWhere("payment.created_at <= $%d", f.ToDate.Val, nil) + + if f.Paginated() { + params := f.Cursor.Params() + if len(params) == 2 { + where = append(where, fmt.Sprintf("(payment.created_at, payment_id) < ($%d, $%d)", len(args)+1, len(args)+2)) + args = append(args, params[0]) + args = append(args, params[1]) + } + } + + return strings.Join(where, ") AND ("), args +} + +func (f *filterForm) buildCursor(customers []*paymentEntry) []*paymentEntry { + return form.BuildCursor(f.Cursor, customers, func(entry *paymentEntry) []string { + return []string{entry.CreatedAt.Format(database.ISODateTimeFormat), strconv.Itoa(entry.ID)} + }) +} + +func (f *filterForm) HasValue() bool { + return (len(f.PaymentStatus.Selected) > 0 && f.PaymentStatus.Selected[0] != "") || + f.Reference.Val != "" || + f.FromDate.Val != "" || + f.ToDate.Val != "" +} + +func (f *filterForm) PerPage() int { + return f.Cursor.PerPage +} + +func (f *filterForm) Paginated() bool { + return f.Cursor.Pagination +} diff --git a/po/ca.po b/po/ca.po index 2ecceff..63a415c 100644 --- a/po/ca.po +++ b/po/ca.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: camper\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-05-03 19:12+0200\n" +"POT-Creation-Date: 2024-05-03 20:07+0200\n" "PO-Revision-Date: 2024-02-06 10:04+0100\n" "Last-Translator: jordi fita mas \n" "Language-Team: Catalan \n" @@ -78,7 +78,7 @@ msgid "Payment" msgstr "Pagament" #: web/templates/mail/payment/details.gotxt:9 -#: web/templates/admin/payment/index.gohtml:21 +#: web/templates/admin/payment/index.gohtml:73 #: web/templates/admin/payment/details.gohtml:52 #: web/templates/admin/prebooking/index.gohtml:59 #: web/templates/admin/booking/index.gohtml:73 @@ -87,7 +87,7 @@ msgid "Reference" msgstr "Referència" #: web/templates/mail/payment/details.gotxt:10 -#: web/templates/admin/payment/index.gohtml:22 +#: web/templates/admin/payment/index.gohtml:74 #: web/templates/admin/payment/details.gohtml:56 #: web/templates/admin/booking/index.gohtml:77 msgctxt "header" @@ -1114,25 +1114,66 @@ msgctxt "action" msgid "Save changes" msgstr "Desa els canvis" -#: web/templates/admin/payment/index.gohtml:20 +#: web/templates/admin/payment/index.gohtml:24 +msgctxt "input" +msgid "Payment status" +msgstr "Estat del pagament" + +#: web/templates/admin/payment/index.gohtml:28 +#: web/templates/admin/invoice/index.gohtml:55 +#: web/templates/admin/booking/index.gohtml:38 +msgid "All statuses" +msgstr "Tots els estats" + +#: web/templates/admin/payment/index.gohtml:36 +#: web/templates/admin/invoice/index.gohtml:63 +#: web/templates/admin/prebooking/index.gohtml:32 +#: web/templates/admin/booking/index.gohtml:46 +msgctxt "input" +msgid "From date" +msgstr "De la data" + +#: web/templates/admin/payment/index.gohtml:45 +#: web/templates/admin/invoice/index.gohtml:72 +#: web/templates/admin/prebooking/index.gohtml:41 +#: web/templates/admin/booking/index.gohtml:55 +msgctxt "input" +msgid "To date" +msgstr "A la data" + +#: web/templates/admin/payment/index.gohtml:54 +msgctxt "input" +msgid "Reference" +msgstr "Referència" + +#: web/templates/admin/payment/index.gohtml:64 +#: web/templates/admin/customer/index.gohtml:43 +#: web/templates/admin/invoice/index.gohtml:94 +#: web/templates/admin/prebooking/index.gohtml:51 +#: web/templates/admin/booking/index.gohtml:65 +msgctxt "action" +msgid "Reset" +msgstr "Restableix" + +#: web/templates/admin/payment/index.gohtml:72 #: web/templates/admin/user/login-attempts.gohtml:19 msgctxt "header" msgid "Date" msgstr "Data" -#: web/templates/admin/payment/index.gohtml:23 +#: web/templates/admin/payment/index.gohtml:75 msgctxt "header" msgid "Down payment" msgstr "A compte" -#: web/templates/admin/payment/index.gohtml:24 +#: web/templates/admin/payment/index.gohtml:76 #: web/templates/admin/booking/fields.gohtml:75 #: web/templates/admin/booking/fields.gohtml:173 msgctxt "header" msgid "Total" msgstr "Total" -#: web/templates/admin/payment/index.gohtml:40 +#: web/templates/admin/payment/index.gohtml:84 msgid "No payments found." msgstr "No s’ha trobat cap pagament." @@ -1925,14 +1966,6 @@ msgctxt "action" msgid "Add Customer" msgstr "Afegeix client" -#: web/templates/admin/customer/index.gohtml:43 -#: web/templates/admin/invoice/index.gohtml:94 -#: web/templates/admin/prebooking/index.gohtml:51 -#: web/templates/admin/booking/index.gohtml:65 -msgctxt "action" -msgid "Reset" -msgstr "Restableix" - #: web/templates/admin/customer/index.gohtml:52 #: web/templates/admin/user/login-attempts.gohtml:20 #: web/templates/admin/user/index.gohtml:21 @@ -2063,25 +2096,6 @@ msgstr "Client" msgid "All customers" msgstr "Tots els clients" -#: web/templates/admin/invoice/index.gohtml:55 -#: web/templates/admin/booking/index.gohtml:38 -msgid "All statuses" -msgstr "Tots els estats" - -#: web/templates/admin/invoice/index.gohtml:63 -#: web/templates/admin/prebooking/index.gohtml:32 -#: web/templates/admin/booking/index.gohtml:46 -msgctxt "input" -msgid "From date" -msgstr "De la data" - -#: web/templates/admin/invoice/index.gohtml:72 -#: web/templates/admin/prebooking/index.gohtml:41 -#: web/templates/admin/booking/index.gohtml:55 -msgctxt "input" -msgid "To date" -msgstr "A la data" - #: web/templates/admin/invoice/index.gohtml:81 msgctxt "input" msgid "Invoice number" diff --git a/po/es.po b/po/es.po index 99abc2c..36e2bf5 100644 --- a/po/es.po +++ b/po/es.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: camper\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-05-03 19:12+0200\n" +"POT-Creation-Date: 2024-05-03 20:07+0200\n" "PO-Revision-Date: 2024-02-06 10:04+0100\n" "Last-Translator: jordi fita mas \n" "Language-Team: Spanish \n" @@ -78,7 +78,7 @@ msgid "Payment" msgstr "Pago" #: web/templates/mail/payment/details.gotxt:9 -#: web/templates/admin/payment/index.gohtml:21 +#: web/templates/admin/payment/index.gohtml:73 #: web/templates/admin/payment/details.gohtml:52 #: web/templates/admin/prebooking/index.gohtml:59 #: web/templates/admin/booking/index.gohtml:73 @@ -87,7 +87,7 @@ msgid "Reference" msgstr "Referencia" #: web/templates/mail/payment/details.gotxt:10 -#: web/templates/admin/payment/index.gohtml:22 +#: web/templates/admin/payment/index.gohtml:74 #: web/templates/admin/payment/details.gohtml:56 #: web/templates/admin/booking/index.gohtml:77 msgctxt "header" @@ -1114,25 +1114,66 @@ msgctxt "action" msgid "Save changes" msgstr "Guardar los cambios" -#: web/templates/admin/payment/index.gohtml:20 +#: web/templates/admin/payment/index.gohtml:24 +msgctxt "input" +msgid "Payment status" +msgstr "Estado del pago" + +#: web/templates/admin/payment/index.gohtml:28 +#: web/templates/admin/invoice/index.gohtml:55 +#: web/templates/admin/booking/index.gohtml:38 +msgid "All statuses" +msgstr "Todos los estados" + +#: web/templates/admin/payment/index.gohtml:36 +#: web/templates/admin/invoice/index.gohtml:63 +#: web/templates/admin/prebooking/index.gohtml:32 +#: web/templates/admin/booking/index.gohtml:46 +msgctxt "input" +msgid "From date" +msgstr "De la fecha" + +#: web/templates/admin/payment/index.gohtml:45 +#: web/templates/admin/invoice/index.gohtml:72 +#: web/templates/admin/prebooking/index.gohtml:41 +#: web/templates/admin/booking/index.gohtml:55 +msgctxt "input" +msgid "To date" +msgstr "A la fecha" + +#: web/templates/admin/payment/index.gohtml:54 +msgctxt "input" +msgid "Reference" +msgstr "Referencia" + +#: web/templates/admin/payment/index.gohtml:64 +#: web/templates/admin/customer/index.gohtml:43 +#: web/templates/admin/invoice/index.gohtml:94 +#: web/templates/admin/prebooking/index.gohtml:51 +#: web/templates/admin/booking/index.gohtml:65 +msgctxt "action" +msgid "Reset" +msgstr "Restablecer" + +#: web/templates/admin/payment/index.gohtml:72 #: web/templates/admin/user/login-attempts.gohtml:19 msgctxt "header" msgid "Date" msgstr "Fecha" -#: web/templates/admin/payment/index.gohtml:23 +#: web/templates/admin/payment/index.gohtml:75 msgctxt "header" msgid "Down payment" msgstr "A cuenta" -#: web/templates/admin/payment/index.gohtml:24 +#: web/templates/admin/payment/index.gohtml:76 #: web/templates/admin/booking/fields.gohtml:75 #: web/templates/admin/booking/fields.gohtml:173 msgctxt "header" msgid "Total" msgstr "Total" -#: web/templates/admin/payment/index.gohtml:40 +#: web/templates/admin/payment/index.gohtml:84 msgid "No payments found." msgstr "No se ha encontrado ningún pago." @@ -1925,14 +1966,6 @@ msgctxt "action" msgid "Add Customer" msgstr "Añadir cliente" -#: web/templates/admin/customer/index.gohtml:43 -#: web/templates/admin/invoice/index.gohtml:94 -#: web/templates/admin/prebooking/index.gohtml:51 -#: web/templates/admin/booking/index.gohtml:65 -msgctxt "action" -msgid "Reset" -msgstr "Restablecer" - #: web/templates/admin/customer/index.gohtml:52 #: web/templates/admin/user/login-attempts.gohtml:20 #: web/templates/admin/user/index.gohtml:21 @@ -2063,25 +2096,6 @@ msgstr "Cliente" msgid "All customers" msgstr "Todos los clientes" -#: web/templates/admin/invoice/index.gohtml:55 -#: web/templates/admin/booking/index.gohtml:38 -msgid "All statuses" -msgstr "Todos los estados" - -#: web/templates/admin/invoice/index.gohtml:63 -#: web/templates/admin/prebooking/index.gohtml:32 -#: web/templates/admin/booking/index.gohtml:46 -msgctxt "input" -msgid "From date" -msgstr "De la fecha" - -#: web/templates/admin/invoice/index.gohtml:72 -#: web/templates/admin/prebooking/index.gohtml:41 -#: web/templates/admin/booking/index.gohtml:55 -msgctxt "input" -msgid "To date" -msgstr "A la fecha" - #: web/templates/admin/invoice/index.gohtml:81 msgctxt "input" msgid "Invoice number" diff --git a/po/fr.po b/po/fr.po index a85f9c9..d0cdf8b 100644 --- a/po/fr.po +++ b/po/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: camper\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-05-03 19:12+0200\n" +"POT-Creation-Date: 2024-05-03 20:07+0200\n" "PO-Revision-Date: 2024-02-06 10:05+0100\n" "Last-Translator: Oriol Carbonell \n" "Language-Team: French \n" @@ -78,7 +78,7 @@ msgid "Payment" msgstr "Paiement" #: web/templates/mail/payment/details.gotxt:9 -#: web/templates/admin/payment/index.gohtml:21 +#: web/templates/admin/payment/index.gohtml:73 #: web/templates/admin/payment/details.gohtml:52 #: web/templates/admin/prebooking/index.gohtml:59 #: web/templates/admin/booking/index.gohtml:73 @@ -87,7 +87,7 @@ msgid "Reference" msgstr "Référence" #: web/templates/mail/payment/details.gotxt:10 -#: web/templates/admin/payment/index.gohtml:22 +#: web/templates/admin/payment/index.gohtml:74 #: web/templates/admin/payment/details.gohtml:56 #: web/templates/admin/booking/index.gohtml:77 msgctxt "header" @@ -1114,25 +1114,66 @@ msgctxt "action" msgid "Save changes" msgstr "Enregistrer les changements" -#: web/templates/admin/payment/index.gohtml:20 +#: web/templates/admin/payment/index.gohtml:24 +msgctxt "input" +msgid "Payment status" +msgstr "Statut du paiement" + +#: web/templates/admin/payment/index.gohtml:28 +#: web/templates/admin/invoice/index.gohtml:55 +#: web/templates/admin/booking/index.gohtml:38 +msgid "All statuses" +msgstr "Tous les statuts" + +#: web/templates/admin/payment/index.gohtml:36 +#: web/templates/admin/invoice/index.gohtml:63 +#: web/templates/admin/prebooking/index.gohtml:32 +#: web/templates/admin/booking/index.gohtml:46 +msgctxt "input" +msgid "From date" +msgstr "Partir de la date" + +#: web/templates/admin/payment/index.gohtml:45 +#: web/templates/admin/invoice/index.gohtml:72 +#: web/templates/admin/prebooking/index.gohtml:41 +#: web/templates/admin/booking/index.gohtml:55 +msgctxt "input" +msgid "To date" +msgstr "À ce jour" + +#: web/templates/admin/payment/index.gohtml:54 +msgctxt "input" +msgid "Reference" +msgstr "Référence" + +#: web/templates/admin/payment/index.gohtml:64 +#: web/templates/admin/customer/index.gohtml:43 +#: web/templates/admin/invoice/index.gohtml:94 +#: web/templates/admin/prebooking/index.gohtml:51 +#: web/templates/admin/booking/index.gohtml:65 +msgctxt "action" +msgid "Reset" +msgstr "Réinitialiser" + +#: web/templates/admin/payment/index.gohtml:72 #: web/templates/admin/user/login-attempts.gohtml:19 msgctxt "header" msgid "Date" msgstr "Date" -#: web/templates/admin/payment/index.gohtml:23 +#: web/templates/admin/payment/index.gohtml:75 msgctxt "header" msgid "Down payment" msgstr "Acompte" -#: web/templates/admin/payment/index.gohtml:24 +#: web/templates/admin/payment/index.gohtml:76 #: web/templates/admin/booking/fields.gohtml:75 #: web/templates/admin/booking/fields.gohtml:173 msgctxt "header" msgid "Total" msgstr "Totale" -#: web/templates/admin/payment/index.gohtml:40 +#: web/templates/admin/payment/index.gohtml:84 msgid "No payments found." msgstr "Aucun paiement trouvée." @@ -1925,14 +1966,6 @@ msgctxt "action" msgid "Add Customer" msgstr "Ajouter un client" -#: web/templates/admin/customer/index.gohtml:43 -#: web/templates/admin/invoice/index.gohtml:94 -#: web/templates/admin/prebooking/index.gohtml:51 -#: web/templates/admin/booking/index.gohtml:65 -msgctxt "action" -msgid "Reset" -msgstr "Réinitialiser" - #: web/templates/admin/customer/index.gohtml:52 #: web/templates/admin/user/login-attempts.gohtml:20 #: web/templates/admin/user/index.gohtml:21 @@ -2063,25 +2096,6 @@ msgstr "Client" msgid "All customers" msgstr "Tous les clients" -#: web/templates/admin/invoice/index.gohtml:55 -#: web/templates/admin/booking/index.gohtml:38 -msgid "All statuses" -msgstr "Tous les statuts" - -#: web/templates/admin/invoice/index.gohtml:63 -#: web/templates/admin/prebooking/index.gohtml:32 -#: web/templates/admin/booking/index.gohtml:46 -msgctxt "input" -msgid "From date" -msgstr "Partir de la date" - -#: web/templates/admin/invoice/index.gohtml:72 -#: web/templates/admin/prebooking/index.gohtml:41 -#: web/templates/admin/booking/index.gohtml:55 -msgctxt "input" -msgid "To date" -msgstr "À ce jour" - #: web/templates/admin/invoice/index.gohtml:81 msgctxt "input" msgid "Invoice number" diff --git a/web/templates/admin/payment/index.gohtml b/web/templates/admin/payment/index.gohtml index 89fe9e5..29965e2 100644 --- a/web/templates/admin/payment/index.gohtml +++ b/web/templates/admin/payment/index.gohtml @@ -12,6 +12,58 @@ {{ define "content" -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/payment.paymentIndex*/ -}} {{( pgettext "Payment Settings" "title" )}} + {{ template "filters-toggle" }} +
+ {{ with .Filters }} +
+ {{ with .PaymentStatus -}} + + {{- end }} + {{ with .FromDate -}} + + {{- end }} + {{ with .ToDate -}} + + {{- end }} + {{ with .Reference -}} + + {{- end }} +
+ {{ end }} + {{ if .Filters.HasValue }} + {{( pgettext "Reset" "action" )}} + {{ end }} +

{{ template "title" . }}

{{ if .Payments -}} @@ -25,15 +77,7 @@ - {{ range .Payments -}} - - - - - - - - {{- end }} + {{ template "results.gohtml" . }}
{{ .CreatedAt | formatDate }}{{ .Reference }}{{ .StatusLabel }}{{ .DownPayment | formatPrice }}{{ .Total | formatPrice }}
{{ else -}} diff --git a/web/templates/admin/payment/results.gohtml b/web/templates/admin/payment/results.gohtml new file mode 100644 index 0000000..7a48766 --- /dev/null +++ b/web/templates/admin/payment/results.gohtml @@ -0,0 +1,10 @@ +{{ range .Payments -}} + + {{ .CreatedAt | formatDate }} + {{ .Reference }} + {{ .StatusLabel }} + {{ .DownPayment | formatPrice }} + {{ .Total | formatPrice }} + +{{- end }} +{{ template "pagination" .Filters.Cursor | colspan 5 }}