Rename Customer expense filter to Contact

It would be very unusual to have an expense from a customer, and we do
not have (yet) a name for supplier or whatever it should be here, so i
used the same name we use for the column in the table.
This commit is contained in:
jordi fita mas 2023-06-20 11:17:07 +02:00
parent 1ad771b771
commit 8a4f80783d
4 changed files with 51 additions and 47 deletions

View File

@ -59,8 +59,8 @@ func mustCollectExpenseEntries(ctx context.Context, conn *Conn, company *Company
}
}
}
maybeAppendWhere("contact_id = $%d", filters.Customer.String(), func(v string) interface{} {
customerId, _ := strconv.Atoi(filters.Customer.Selected[0])
maybeAppendWhere("contact_id = $%d", filters.Contact.String(), func(v string) interface{} {
customerId, _ := strconv.Atoi(filters.Contact.Selected[0])
return customerId
})
maybeAppendWhere("invoice_number = $%d", filters.InvoiceNumber.String(), nil)
@ -323,7 +323,7 @@ func HandleUpdateExpense(w http.ResponseWriter, r *http.Request, params httprout
type expenseFilterForm struct {
locale *Locale
company *Company
Customer *SelectField
Contact *SelectField
InvoiceNumber *InputField
FromDate *InputField
ToDate *InputField
@ -335,10 +335,10 @@ func newExpenseFilterForm(ctx context.Context, conn *Conn, locale *Locale, compa
return &expenseFilterForm{
locale: locale,
company: company,
Customer: &SelectField{
Name: "customer",
Label: pgettext("input", "Customer", locale),
EmptyLabel: gettext("All customers", locale),
Contact: &SelectField{
Name: "contact",
Label: pgettext("input", "Contact", locale),
EmptyLabel: gettext("All contacts", locale),
Options: mustGetContactOptions(ctx, conn, company),
},
InvoiceNumber: &InputField{
@ -382,7 +382,7 @@ func (form *expenseFilterForm) Parse(r *http.Request) error {
if err := r.ParseForm(); err != nil {
return err
}
form.Customer.FillValue(r)
form.Contact.FillValue(r)
form.InvoiceNumber.FillValue(r)
form.FromDate.FillValue(r)
form.ToDate.FillValue(r)

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: numerus\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2023-06-16 10:55+0200\n"
"POT-Creation-Date: 2023-06-20 10:48+0200\n"
"PO-Revision-Date: 2023-01-18 17:08+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Catalan <ca@dodds.net>\n"
@ -157,10 +157,10 @@ msgid "Invoice Num."
msgstr "Núm. factura"
#: web/template/invoices/index.gohtml:52 web/template/quotes/index.gohtml:52
#: web/template/contacts/index.gohtml:40
#: web/template/contacts/index.gohtml:40 web/template/expenses/index.gohtml:43
msgctxt "title"
msgid "Customer"
msgstr "Client"
msgid "Contact"
msgstr "Contacte"
#: web/template/invoices/index.gohtml:53 web/template/quotes/index.gohtml:53
msgctxt "title"
@ -526,11 +526,6 @@ msgctxt "expense"
msgid "All"
msgstr "Totes"
#: web/template/expenses/index.gohtml:43
msgctxt "title"
msgid "Contact"
msgstr "Contacte"
#: web/template/expenses/index.gohtml:44
msgctxt "title"
msgid "Invoice Date"
@ -852,11 +847,11 @@ msgstr "No podeu deixar el nom del mètode de pagament en blanc."
msgid "Payment instructions can not be empty."
msgstr "No podeu deixar les instruccions de pagament en blanc."
#: pkg/quote.go:161 pkg/quote.go:586 pkg/expenses.go:340 pkg/invoices.go:162
#: pkg/invoices.go:586
#: pkg/quote.go:148 pkg/quote.go:609 pkg/expenses.go:164 pkg/expenses.go:340
#: pkg/invoices.go:147 pkg/invoices.go:606
msgctxt "input"
msgid "Customer"
msgstr "Client"
msgid "Contact"
msgstr "Contacte"
#: pkg/quote.go:162 pkg/expenses.go:341 pkg/invoices.go:163
msgid "All customers"
@ -1057,11 +1052,6 @@ msgstr "Any anterior"
msgid "Select a contact."
msgstr "Escolliu un contacte."
#: pkg/expenses.go:164
msgctxt "input"
msgid "Contact"
msgstr "Contacte"
#: pkg/expenses.go:170
msgctxt "input"
msgid "Invoice number"
@ -1098,7 +1088,11 @@ msgstr "No podeu deixar limport en blanc."
msgid "Amount must be a number greater than zero."
msgstr "Limport ha de ser un número major a zero."
#: pkg/expenses.go:346 pkg/invoices.go:174
#: pkg/expenses.go:341
msgid "All contacts"
msgstr "Tots els contactes"
#: pkg/expenses.go:346 pkg/invoices.go:159
msgctxt "input"
msgid "Invoice Number"
msgstr "Número de factura"
@ -1240,6 +1234,14 @@ msgstr "No podeu deixar el codi postal en blanc."
msgid "This value is not a valid postal code."
msgstr "Aquest valor no és un codi postal vàlid."
#~ msgctxt "title"
#~ msgid "Customer"
#~ msgstr "Client"
#~ msgctxt "input"
#~ msgid "Customer"
#~ msgstr "Client"
#~ msgctxt "action"
#~ msgid "Update contact"
#~ msgstr "Actualitza contacte"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: numerus\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2023-06-16 10:55+0200\n"
"POT-Creation-Date: 2023-06-20 10:48+0200\n"
"PO-Revision-Date: 2023-01-18 17:45+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Spanish <es@tp.org.es>\n"
@ -157,10 +157,10 @@ msgid "Invoice Num."
msgstr "N.º factura"
#: web/template/invoices/index.gohtml:52 web/template/quotes/index.gohtml:52
#: web/template/contacts/index.gohtml:40
#: web/template/contacts/index.gohtml:40 web/template/expenses/index.gohtml:43
msgctxt "title"
msgid "Customer"
msgstr "Cliente"
msgid "Contact"
msgstr "Contacto"
#: web/template/invoices/index.gohtml:53 web/template/quotes/index.gohtml:53
msgctxt "title"
@ -526,11 +526,6 @@ msgctxt "expense"
msgid "All"
msgstr "Todos"
#: web/template/expenses/index.gohtml:43
msgctxt "title"
msgid "Contact"
msgstr "Contacto"
#: web/template/expenses/index.gohtml:44
msgctxt "title"
msgid "Invoice Date"
@ -852,11 +847,11 @@ msgstr "No podéis dejar el nombre del método de pago en blanco."
msgid "Payment instructions can not be empty."
msgstr "No podéis dejar las instrucciones de pago en blanco."
#: pkg/quote.go:161 pkg/quote.go:586 pkg/expenses.go:340 pkg/invoices.go:162
#: pkg/invoices.go:586
#: pkg/quote.go:148 pkg/quote.go:609 pkg/expenses.go:164 pkg/expenses.go:340
#: pkg/invoices.go:147 pkg/invoices.go:606
msgctxt "input"
msgid "Customer"
msgstr "Cliente"
msgid "Contact"
msgstr "Contacto"
#: pkg/quote.go:162 pkg/expenses.go:341 pkg/invoices.go:163
msgid "All customers"
@ -1057,11 +1052,6 @@ msgstr "Año anterior"
msgid "Select a contact."
msgstr "Escoged un contacto"
#: pkg/expenses.go:164
msgctxt "input"
msgid "Contact"
msgstr "Contacto"
#: pkg/expenses.go:170
msgctxt "input"
msgid "Invoice number"
@ -1098,7 +1088,11 @@ msgstr "No podéis dejar el importe en blanco."
msgid "Amount must be a number greater than zero."
msgstr "El importe tiene que ser un número mayor a cero."
#: pkg/expenses.go:346 pkg/invoices.go:174
#: pkg/expenses.go:341
msgid "All contacts"
msgstr "Todos los contactos"
#: pkg/expenses.go:346 pkg/invoices.go:159
msgctxt "input"
msgid "Invoice Number"
msgstr "Número de factura"
@ -1240,6 +1234,14 @@ msgstr "No podéis dejar el código postal en blanco."
msgid "This value is not a valid postal code."
msgstr "Este valor no es un código postal válido válido."
#~ msgctxt "title"
#~ msgid "Customer"
#~ msgstr "Cliente"
#~ msgctxt "input"
#~ msgid "Customer"
#~ msgstr "Cliente"
#~ msgctxt "action"
#~ msgid "Update contact"
#~ msgstr "Actualizar contacto"

View File

@ -25,7 +25,7 @@
aria-labelledby="filters-toggle"
>
{{ with .Filters }}
{{ template "select-field" .Customer }}
{{ template "select-field" .Contact }}
{{ template "input-field" .FromDate }}
{{ template "input-field" .ToDate }}
{{ template "input-field" .InvoiceNumber }}