diff --git a/pkg/form.go b/pkg/form.go index 4ad8d08..0d206f2 100644 --- a/pkg/form.go +++ b/pkg/form.go @@ -258,6 +258,20 @@ func (field *TagsField) String() string { return strings.Join(field.Tags, ",") } +type ToggleField struct { + Name string + Label string + Selected string + FirstOption *SelectOption + SecondOption *SelectOption + Attributes []template.HTMLAttr + Errors []error +} + +func (field *ToggleField) FillValue(r *http.Request) { + field.Selected = strings.TrimSpace(r.FormValue(field.Name)) +} + type FormValidator struct { Valid bool } diff --git a/pkg/invoices.go b/pkg/invoices.go index 0098e6c..496d4e4 100644 --- a/pkg/invoices.go +++ b/pkg/invoices.go @@ -79,7 +79,7 @@ func mustCollectInvoiceEntries(ctx context.Context, conn *Conn, company *Company maybeAppendWhere("invoice_date >= $%d", filters.FromDate.String(), nil) maybeAppendWhere("invoice_date <= $%d", filters.ToDate.String(), nil) if len(filters.Tags.Tags) > 0 { - if filters.TagsCondition.String() == "and" { + if filters.TagsCondition.Selected == "and" { appendWhere("invoice.tags @> $%d", filters.Tags) } else { appendWhere("invoice.tags && $%d", filters.Tags) @@ -148,7 +148,7 @@ type invoiceFilterForm struct { FromDate *InputField ToDate *InputField Tags *TagsField - TagsCondition *SelectField + TagsCondition *ToggleField } func newInvoiceFilterForm(ctx context.Context, conn *Conn, locale *Locale, company *Company) *invoiceFilterForm { @@ -186,13 +186,15 @@ func newInvoiceFilterForm(ctx context.Context, conn *Conn, locale *Locale, compa Name: "tags", Label: pgettext("input", "Tags", locale), }, - TagsCondition: &SelectField{ + TagsCondition: &ToggleField{ Name: "tags_condition", Label: pgettext("input", "Tags Condition", locale), - Selected: []string{"and"}, - Options: []*SelectOption{ - {Value: "and", Label: pgettext("logical", "AND", locale)}, - {Value: "or", Label: pgettext("logical", "OR", locale)}, + Selected: "and", + FirstOption: &SelectOption{ + Value: "and", Label: pgettext("tag condition", "All", locale), + }, + SecondOption: &SelectOption{ + Value: "or", Label: pgettext("tag condition", "Any", locale), }, }, } diff --git a/po/ca.po b/po/ca.po index 48123f5..4b32038 100644 --- a/po/ca.po +++ b/po/ca.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: numerus\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2023-03-29 16:08+0200\n" +"POT-Creation-Date: 2023-04-15 04:00+0200\n" "PO-Revision-Date: 2023-01-18 17:08+0100\n" "Last-Translator: jordi fita mas \n" "Language-Team: Catalan \n" @@ -47,43 +47,43 @@ msgctxt "title" msgid "New Invoice" msgstr "Nova factura" -#: web/template/invoices/products.gohtml:51 +#: web/template/invoices/products.gohtml:49 #: web/template/products/index.gohtml:25 msgctxt "product" msgid "All" msgstr "Tots" -#: web/template/invoices/products.gohtml:52 +#: web/template/invoices/products.gohtml:50 #: web/template/products/index.gohtml:26 msgctxt "title" msgid "Name" msgstr "Nom" -#: web/template/invoices/products.gohtml:53 -#: web/template/invoices/view.gohtml:59 web/template/products/index.gohtml:28 +#: web/template/invoices/products.gohtml:51 +#: web/template/invoices/view.gohtml:62 web/template/products/index.gohtml:28 msgctxt "title" msgid "Price" msgstr "Preu" -#: web/template/invoices/products.gohtml:67 +#: web/template/invoices/products.gohtml:65 #: web/template/products/index.gohtml:48 msgid "No products added yet." msgstr "No hi ha cap producte." -#: web/template/invoices/products.gohtml:75 web/template/invoices/new.gohtml:67 +#: web/template/invoices/products.gohtml:73 web/template/invoices/new.gohtml:67 #: web/template/invoices/edit.gohtml:68 msgctxt "action" msgid "Add products" msgstr "Afegeix productes" -#: web/template/invoices/new.gohtml:48 web/template/invoices/view.gohtml:64 +#: web/template/invoices/new.gohtml:48 web/template/invoices/view.gohtml:67 #: web/template/invoices/edit.gohtml:49 msgctxt "title" msgid "Subtotal" msgstr "Subtotal" -#: web/template/invoices/new.gohtml:58 web/template/invoices/view.gohtml:68 -#: web/template/invoices/view.gohtml:108 web/template/invoices/edit.gohtml:59 +#: web/template/invoices/new.gohtml:58 web/template/invoices/view.gohtml:71 +#: web/template/invoices/view.gohtml:111 web/template/invoices/edit.gohtml:59 msgctxt "title" msgid "Total" msgstr "Total" @@ -93,7 +93,7 @@ msgctxt "action" msgid "Update" msgstr "Actualitza" -#: web/template/invoices/new.gohtml:72 web/template/invoices/index.gohtml:20 +#: web/template/invoices/new.gohtml:72 web/template/invoices/index.gohtml:21 msgctxt "action" msgid "New invoice" msgstr "Nova factura" @@ -103,102 +103,102 @@ msgctxt "action" msgid "Download invoices" msgstr "Descarrega factures" -#: web/template/invoices/index.gohtml:38 +#: web/template/invoices/index.gohtml:41 msgctxt "action" msgid "Filter" msgstr "Filtra" -#: web/template/invoices/index.gohtml:44 +#: web/template/invoices/index.gohtml:47 msgctxt "invoice" msgid "All" msgstr "Totes" -#: web/template/invoices/index.gohtml:45 web/template/invoices/view.gohtml:31 +#: web/template/invoices/index.gohtml:48 web/template/invoices/view.gohtml:34 msgctxt "title" msgid "Date" msgstr "Data" -#: web/template/invoices/index.gohtml:46 +#: web/template/invoices/index.gohtml:49 msgctxt "title" msgid "Invoice Num." msgstr "Núm. factura" -#: web/template/invoices/index.gohtml:47 web/template/contacts/index.gohtml:26 +#: web/template/invoices/index.gohtml:50 web/template/contacts/index.gohtml:26 msgctxt "title" msgid "Customer" msgstr "Client" -#: web/template/invoices/index.gohtml:48 +#: web/template/invoices/index.gohtml:51 msgctxt "title" msgid "Status" msgstr "Estat" -#: web/template/invoices/index.gohtml:49 web/template/contacts/index.gohtml:29 +#: web/template/invoices/index.gohtml:52 web/template/contacts/index.gohtml:29 #: web/template/products/index.gohtml:27 msgctxt "title" msgid "Tags" msgstr "Etiquetes" -#: web/template/invoices/index.gohtml:50 +#: web/template/invoices/index.gohtml:53 msgctxt "title" msgid "Amount" msgstr "Import" -#: web/template/invoices/index.gohtml:51 +#: web/template/invoices/index.gohtml:54 msgctxt "title" msgid "Download" msgstr "Descàrrega" -#: web/template/invoices/index.gohtml:52 +#: web/template/invoices/index.gohtml:55 msgctxt "title" msgid "Actions" msgstr "Accions" -#: web/template/invoices/index.gohtml:59 +#: web/template/invoices/index.gohtml:62 msgctxt "action" msgid "Select invoice %v" msgstr "Selecciona factura %v" -#: web/template/invoices/index.gohtml:109 web/template/invoices/view.gohtml:16 +#: web/template/invoices/index.gohtml:117 web/template/invoices/view.gohtml:19 msgctxt "action" msgid "Edit" msgstr "Edita" -#: web/template/invoices/index.gohtml:115 web/template/invoices/view.gohtml:15 +#: web/template/invoices/index.gohtml:125 web/template/invoices/view.gohtml:16 msgctxt "action" msgid "Duplicate" msgstr "Duplica" -#: web/template/invoices/index.gohtml:125 +#: web/template/invoices/index.gohtml:135 msgid "No invoices added yet." msgstr "No hi ha cap factura." -#: web/template/invoices/view.gohtml:2 web/template/invoices/view.gohtml:30 +#: web/template/invoices/view.gohtml:2 web/template/invoices/view.gohtml:33 msgctxt "title" msgid "Invoice %s" msgstr "Factura %s" -#: web/template/invoices/view.gohtml:19 +#: web/template/invoices/view.gohtml:22 msgctxt "action" msgid "Download invoice" msgstr "Descarrega factura" -#: web/template/invoices/view.gohtml:58 +#: web/template/invoices/view.gohtml:61 msgctxt "title" msgid "Concept" msgstr "Concepte" -#: web/template/invoices/view.gohtml:61 +#: web/template/invoices/view.gohtml:64 msgctxt "title" msgid "Discount" msgstr "Descompte" -#: web/template/invoices/view.gohtml:63 +#: web/template/invoices/view.gohtml:66 msgctxt "title" msgid "Units" msgstr "Unitats" -#: web/template/invoices/view.gohtml:98 +#: web/template/invoices/view.gohtml:101 msgctxt "title" msgid "Tax Base" msgstr "Base imposable" @@ -430,7 +430,7 @@ msgctxt "action" msgid "Update product" msgstr "Actualitza producte" -#: pkg/login.go:36 pkg/profile.go:40 pkg/contacts.go:216 +#: pkg/login.go:36 pkg/profile.go:40 pkg/contacts.go:210 msgctxt "input" msgid "Email" msgstr "Correu-e" @@ -440,11 +440,11 @@ msgctxt "input" msgid "Password" msgstr "Contrasenya" -#: pkg/login.go:69 pkg/profile.go:89 pkg/contacts.go:312 +#: pkg/login.go:69 pkg/profile.go:89 pkg/contacts.go:306 msgid "Email can not be empty." msgstr "No podeu deixar el correu-e en blanc." -#: pkg/login.go:70 pkg/profile.go:90 pkg/contacts.go:313 +#: pkg/login.go:70 pkg/profile.go:90 pkg/contacts.go:307 msgid "This value is not a valid email. It should be like name@domain.com." msgstr "Aquest valor no és un correu-e vàlid. Hauria de ser similar a nom@domini.cat." @@ -456,49 +456,49 @@ msgstr "No podeu deixar la contrasenya en blanc." msgid "Invalid user or password." msgstr "Nom d’usuari o contrasenya incorrectes." -#: pkg/products.go:209 pkg/invoices.go:728 +#: pkg/products.go:204 pkg/invoices.go:728 msgctxt "input" msgid "Name" msgstr "Nom" -#: pkg/products.go:215 pkg/invoices.go:733 +#: pkg/products.go:210 pkg/invoices.go:733 msgctxt "input" msgid "Description" msgstr "Descripció" -#: pkg/products.go:220 pkg/invoices.go:737 +#: pkg/products.go:215 pkg/invoices.go:737 msgctxt "input" msgid "Price" msgstr "Preu" -#: pkg/products.go:230 pkg/invoices.go:763 +#: pkg/products.go:225 pkg/invoices.go:763 msgctxt "input" msgid "Taxes" msgstr "Imposts" -#: pkg/products.go:236 pkg/invoices.go:192 pkg/invoices.go:571 -#: pkg/contacts.go:273 +#: pkg/products.go:231 pkg/invoices.go:187 pkg/invoices.go:578 +#: pkg/invoices.go:960 pkg/contacts.go:267 msgctxt "input" msgid "Tags" msgstr "Etiquetes" -#: pkg/products.go:255 pkg/profile.go:92 pkg/invoices.go:802 +#: pkg/products.go:250 pkg/profile.go:92 pkg/invoices.go:802 msgid "Name can not be empty." msgstr "No podeu deixar el nom en blanc." -#: pkg/products.go:256 pkg/invoices.go:803 +#: pkg/products.go:251 pkg/invoices.go:803 msgid "Price can not be empty." msgstr "No podeu deixar el preu en blanc." -#: pkg/products.go:257 pkg/invoices.go:804 +#: pkg/products.go:252 pkg/invoices.go:804 msgid "Price must be a number greater than zero." msgstr "El preu ha de ser un número major a zero." -#: pkg/products.go:259 pkg/invoices.go:812 +#: pkg/products.go:254 pkg/invoices.go:812 msgid "Selected tax is not valid." msgstr "Heu seleccionat un impost que no és vàlid." -#: pkg/products.go:260 pkg/invoices.go:813 +#: pkg/products.go:255 pkg/invoices.go:813 msgid "You can only select a tax of each class." msgstr "Només podeu seleccionar un impost de cada classe." @@ -606,88 +606,99 @@ msgstr "La confirmació no és igual a la contrasenya." msgid "Selected language is not valid." msgstr "Heu seleccionat un idioma que no és vàlid." -#: pkg/invoices.go:165 pkg/invoices.go:549 +#: pkg/invoices.go:160 pkg/invoices.go:561 msgctxt "input" msgid "Customer" msgstr "Client" -#: pkg/invoices.go:166 +#: pkg/invoices.go:161 msgid "All customers" msgstr "Tots els clients" -#: pkg/invoices.go:171 pkg/invoices.go:543 +#: pkg/invoices.go:166 pkg/invoices.go:555 msgctxt "input" msgid "Invoice Status" msgstr "Estat de la factura" -#: pkg/invoices.go:172 +#: pkg/invoices.go:167 msgid "All status" msgstr "Tots els estats" -#: pkg/invoices.go:177 +#: pkg/invoices.go:172 msgctxt "input" msgid "Invoice Number" msgstr "Número de factura" -#: pkg/invoices.go:182 +#: pkg/invoices.go:177 msgctxt "input" msgid "From Date" msgstr "A partir de la data" -#: pkg/invoices.go:187 +#: pkg/invoices.go:182 msgctxt "input" msgid "To Date" msgstr "Fins la data" -#: pkg/invoices.go:394 +#: pkg/invoices.go:191 +#, fuzzy +msgctxt "input" +msgid "Tags Condition" +msgstr "Condició de les etiquetes" + +#: pkg/invoices.go:194 +msgctxt "tag condition" +msgid "All" +msgstr "Totes" + +#: pkg/invoices.go:197 +msgctxt "tag condition" +msgid "Any" +msgstr "Qualsevol" + +#: pkg/invoices.go:401 msgid "Select a customer to bill." msgstr "Escolliu un client a facturar." -#: pkg/invoices.go:493 +#: pkg/invoices.go:500 msgid "invoices.zip" msgstr "factures.zip" -#: pkg/invoices.go:499 pkg/invoices.go:921 +#: pkg/invoices.go:506 pkg/invoices.go:946 msgid "Invalid action" msgstr "Acció invàlida." -#: pkg/invoices.go:555 -msgctxt "input" -msgid "Number" -msgstr "Número" - -#: pkg/invoices.go:560 +#: pkg/invoices.go:567 msgctxt "input" msgid "Invoice Date" msgstr "Data de factura" -#: pkg/invoices.go:566 +#: pkg/invoices.go:573 msgctxt "input" msgid "Notes" msgstr "Notes" -#: pkg/invoices.go:576 +#: pkg/invoices.go:583 msgctxt "input" msgid "Payment Method" msgstr "Mètode de pagament" -#: pkg/invoices.go:613 +#: pkg/invoices.go:620 msgid "Selected invoice status is not valid." msgstr "Heu seleccionat un estat de factura que no és vàlid." -#: pkg/invoices.go:614 +#: pkg/invoices.go:621 msgid "Selected customer is not valid." msgstr "Heu seleccionat un client que no és vàlid." -#: pkg/invoices.go:615 +#: pkg/invoices.go:622 msgid "Invoice date can not be empty." msgstr "No podeu deixar la data de la factura en blanc." -#: pkg/invoices.go:616 +#: pkg/invoices.go:623 msgid "Invoice date must be a valid date." msgstr "La data de facturació ha de ser vàlida." -#: pkg/invoices.go:618 +#: pkg/invoices.go:625 msgid "Selected payment method is not valid." msgstr "Heu seleccionat un mètode de pagament que no és vàlid." @@ -726,104 +737,108 @@ msgstr "No podeu deixar el descompte en blanc." msgid "Discount must be a percentage between 0 and 100." msgstr "El descompte ha de ser un percentatge entre 0 i 100." -#: pkg/contacts.go:187 +#: pkg/contacts.go:181 msgctxt "input" msgid "Business name" msgstr "Nom i cognoms" -#: pkg/contacts.go:196 +#: pkg/contacts.go:190 msgctxt "input" msgid "VAT number" msgstr "DNI / NIF" -#: pkg/contacts.go:202 +#: pkg/contacts.go:196 msgctxt "input" msgid "Trade name" msgstr "Nom comercial" -#: pkg/contacts.go:207 +#: pkg/contacts.go:201 msgctxt "input" msgid "Phone" msgstr "Telèfon" -#: pkg/contacts.go:225 +#: pkg/contacts.go:219 msgctxt "input" msgid "Web" msgstr "Web" -#: pkg/contacts.go:233 +#: pkg/contacts.go:227 msgctxt "input" msgid "Address" msgstr "Adreça" -#: pkg/contacts.go:242 +#: pkg/contacts.go:236 msgctxt "input" msgid "City" msgstr "Població" -#: pkg/contacts.go:248 +#: pkg/contacts.go:242 msgctxt "input" msgid "Province" msgstr "Província" -#: pkg/contacts.go:254 +#: pkg/contacts.go:248 msgctxt "input" msgid "Postal code" msgstr "Codi postal" -#: pkg/contacts.go:263 +#: pkg/contacts.go:257 msgctxt "input" msgid "Country" msgstr "País" -#: pkg/contacts.go:301 +#: pkg/contacts.go:295 msgid "Selected country is not valid." msgstr "Heu seleccionat un país que no és vàlid." -#: pkg/contacts.go:305 +#: pkg/contacts.go:299 msgid "Business name can not be empty." msgstr "No podeu deixar el nom i els cognoms en blanc." -#: pkg/contacts.go:306 +#: pkg/contacts.go:300 msgid "VAT number can not be empty." msgstr "No podeu deixar el DNI o NIF en blanc." -#: pkg/contacts.go:307 +#: pkg/contacts.go:301 msgid "This value is not a valid VAT number." msgstr "Aquest valor no és un DNI o NIF vàlid." -#: pkg/contacts.go:309 +#: pkg/contacts.go:303 msgid "Phone can not be empty." msgstr "No podeu deixar el telèfon en blanc." -#: pkg/contacts.go:310 +#: pkg/contacts.go:304 msgid "This value is not a valid phone number." msgstr "Aquest valor no és un telèfon vàlid." -#: pkg/contacts.go:316 +#: pkg/contacts.go:310 msgid "This value is not a valid web address. It should be like https://domain.com/." msgstr "Aquest valor no és una adreça web vàlida. Hauria de ser similar a https://domini.cat/." -#: pkg/contacts.go:318 +#: pkg/contacts.go:312 msgid "Address can not be empty." msgstr "No podeu deixar l’adreça en blanc." -#: pkg/contacts.go:319 +#: pkg/contacts.go:313 msgid "City can not be empty." msgstr "No podeu deixar la població en blanc." -#: pkg/contacts.go:320 +#: pkg/contacts.go:314 msgid "Province can not be empty." msgstr "No podeu deixar la província en blanc." -#: pkg/contacts.go:321 +#: pkg/contacts.go:315 msgid "Postal code can not be empty." msgstr "No podeu deixar el codi postal en blanc." -#: pkg/contacts.go:322 +#: pkg/contacts.go:316 msgid "This value is not a valid postal code." msgstr "Aquest valor no és un codi postal vàlid." +#~ msgctxt "input" +#~ msgid "Number" +#~ msgstr "Número" + #~ msgctxt "title" #~ msgid "Label" #~ msgstr "Etiqueta" diff --git a/po/es.po b/po/es.po index 06fc86e..2f6ed84 100644 --- a/po/es.po +++ b/po/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: numerus\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2023-03-29 16:08+0200\n" +"POT-Creation-Date: 2023-04-15 04:00+0200\n" "PO-Revision-Date: 2023-01-18 17:45+0100\n" "Last-Translator: jordi fita mas \n" "Language-Team: Spanish \n" @@ -47,43 +47,43 @@ msgctxt "title" msgid "New Invoice" msgstr "Nueva factura" -#: web/template/invoices/products.gohtml:51 +#: web/template/invoices/products.gohtml:49 #: web/template/products/index.gohtml:25 msgctxt "product" msgid "All" msgstr "Todos" -#: web/template/invoices/products.gohtml:52 +#: web/template/invoices/products.gohtml:50 #: web/template/products/index.gohtml:26 msgctxt "title" msgid "Name" msgstr "Nombre" -#: web/template/invoices/products.gohtml:53 -#: web/template/invoices/view.gohtml:59 web/template/products/index.gohtml:28 +#: web/template/invoices/products.gohtml:51 +#: web/template/invoices/view.gohtml:62 web/template/products/index.gohtml:28 msgctxt "title" msgid "Price" msgstr "Precio" -#: web/template/invoices/products.gohtml:67 +#: web/template/invoices/products.gohtml:65 #: web/template/products/index.gohtml:48 msgid "No products added yet." msgstr "No hay productos." -#: web/template/invoices/products.gohtml:75 web/template/invoices/new.gohtml:67 +#: web/template/invoices/products.gohtml:73 web/template/invoices/new.gohtml:67 #: web/template/invoices/edit.gohtml:68 msgctxt "action" msgid "Add products" msgstr "Añadir productos" -#: web/template/invoices/new.gohtml:48 web/template/invoices/view.gohtml:64 +#: web/template/invoices/new.gohtml:48 web/template/invoices/view.gohtml:67 #: web/template/invoices/edit.gohtml:49 msgctxt "title" msgid "Subtotal" msgstr "Subtotal" -#: web/template/invoices/new.gohtml:58 web/template/invoices/view.gohtml:68 -#: web/template/invoices/view.gohtml:108 web/template/invoices/edit.gohtml:59 +#: web/template/invoices/new.gohtml:58 web/template/invoices/view.gohtml:71 +#: web/template/invoices/view.gohtml:111 web/template/invoices/edit.gohtml:59 msgctxt "title" msgid "Total" msgstr "Total" @@ -93,7 +93,7 @@ msgctxt "action" msgid "Update" msgstr "Actualizar" -#: web/template/invoices/new.gohtml:72 web/template/invoices/index.gohtml:20 +#: web/template/invoices/new.gohtml:72 web/template/invoices/index.gohtml:21 msgctxt "action" msgid "New invoice" msgstr "Nueva factura" @@ -103,102 +103,102 @@ msgctxt "action" msgid "Download invoices" msgstr "Descargar facturas" -#: web/template/invoices/index.gohtml:38 +#: web/template/invoices/index.gohtml:41 msgctxt "action" msgid "Filter" msgstr "Filtrar" -#: web/template/invoices/index.gohtml:44 +#: web/template/invoices/index.gohtml:47 msgctxt "invoice" msgid "All" msgstr "Todas" -#: web/template/invoices/index.gohtml:45 web/template/invoices/view.gohtml:31 +#: web/template/invoices/index.gohtml:48 web/template/invoices/view.gohtml:34 msgctxt "title" msgid "Date" msgstr "Fecha" -#: web/template/invoices/index.gohtml:46 +#: web/template/invoices/index.gohtml:49 msgctxt "title" msgid "Invoice Num." msgstr "Nº factura" -#: web/template/invoices/index.gohtml:47 web/template/contacts/index.gohtml:26 +#: web/template/invoices/index.gohtml:50 web/template/contacts/index.gohtml:26 msgctxt "title" msgid "Customer" msgstr "Cliente" -#: web/template/invoices/index.gohtml:48 +#: web/template/invoices/index.gohtml:51 msgctxt "title" msgid "Status" msgstr "Estado" -#: web/template/invoices/index.gohtml:49 web/template/contacts/index.gohtml:29 +#: web/template/invoices/index.gohtml:52 web/template/contacts/index.gohtml:29 #: web/template/products/index.gohtml:27 msgctxt "title" msgid "Tags" msgstr "Etiquetes" -#: web/template/invoices/index.gohtml:50 +#: web/template/invoices/index.gohtml:53 msgctxt "title" msgid "Amount" msgstr "Importe" -#: web/template/invoices/index.gohtml:51 +#: web/template/invoices/index.gohtml:54 msgctxt "title" msgid "Download" msgstr "Descargar" -#: web/template/invoices/index.gohtml:52 +#: web/template/invoices/index.gohtml:55 msgctxt "title" msgid "Actions" msgstr "Acciones" -#: web/template/invoices/index.gohtml:59 +#: web/template/invoices/index.gohtml:62 msgctxt "action" msgid "Select invoice %v" msgstr "Seleccionar factura %v" -#: web/template/invoices/index.gohtml:109 web/template/invoices/view.gohtml:16 +#: web/template/invoices/index.gohtml:117 web/template/invoices/view.gohtml:19 msgctxt "action" msgid "Edit" msgstr "Editar" -#: web/template/invoices/index.gohtml:115 web/template/invoices/view.gohtml:15 +#: web/template/invoices/index.gohtml:125 web/template/invoices/view.gohtml:16 msgctxt "action" msgid "Duplicate" msgstr "Duplicar" -#: web/template/invoices/index.gohtml:125 +#: web/template/invoices/index.gohtml:135 msgid "No invoices added yet." msgstr "No hay facturas." -#: web/template/invoices/view.gohtml:2 web/template/invoices/view.gohtml:30 +#: web/template/invoices/view.gohtml:2 web/template/invoices/view.gohtml:33 msgctxt "title" msgid "Invoice %s" msgstr "Factura %s" -#: web/template/invoices/view.gohtml:19 +#: web/template/invoices/view.gohtml:22 msgctxt "action" msgid "Download invoice" msgstr "Descargar factura" -#: web/template/invoices/view.gohtml:58 +#: web/template/invoices/view.gohtml:61 msgctxt "title" msgid "Concept" msgstr "Concepto" -#: web/template/invoices/view.gohtml:61 +#: web/template/invoices/view.gohtml:64 msgctxt "title" msgid "Discount" msgstr "Descuento" -#: web/template/invoices/view.gohtml:63 +#: web/template/invoices/view.gohtml:66 msgctxt "title" msgid "Units" msgstr "Unidades" -#: web/template/invoices/view.gohtml:98 +#: web/template/invoices/view.gohtml:101 msgctxt "title" msgid "Tax Base" msgstr "Base imponible" @@ -430,7 +430,7 @@ msgctxt "action" msgid "Update product" msgstr "Actualizar producto" -#: pkg/login.go:36 pkg/profile.go:40 pkg/contacts.go:216 +#: pkg/login.go:36 pkg/profile.go:40 pkg/contacts.go:210 msgctxt "input" msgid "Email" msgstr "Correo-e" @@ -440,11 +440,11 @@ msgctxt "input" msgid "Password" msgstr "Contraseña" -#: pkg/login.go:69 pkg/profile.go:89 pkg/contacts.go:312 +#: pkg/login.go:69 pkg/profile.go:89 pkg/contacts.go:306 msgid "Email can not be empty." msgstr "No podéis dejar el correo-e en blanco." -#: pkg/login.go:70 pkg/profile.go:90 pkg/contacts.go:313 +#: pkg/login.go:70 pkg/profile.go:90 pkg/contacts.go:307 msgid "This value is not a valid email. It should be like name@domain.com." msgstr "Este valor no es un correo-e válido. Tiene que ser parecido a nombre@dominio.es." @@ -456,49 +456,49 @@ msgstr "No podéis dejar la contraseña en blanco." msgid "Invalid user or password." msgstr "Nombre de usuario o contraseña inválido." -#: pkg/products.go:209 pkg/invoices.go:728 +#: pkg/products.go:204 pkg/invoices.go:728 msgctxt "input" msgid "Name" msgstr "Nombre" -#: pkg/products.go:215 pkg/invoices.go:733 +#: pkg/products.go:210 pkg/invoices.go:733 msgctxt "input" msgid "Description" msgstr "Descripción" -#: pkg/products.go:220 pkg/invoices.go:737 +#: pkg/products.go:215 pkg/invoices.go:737 msgctxt "input" msgid "Price" msgstr "Precio" -#: pkg/products.go:230 pkg/invoices.go:763 +#: pkg/products.go:225 pkg/invoices.go:763 msgctxt "input" msgid "Taxes" msgstr "Impuestos" -#: pkg/products.go:236 pkg/invoices.go:192 pkg/invoices.go:571 -#: pkg/contacts.go:273 +#: pkg/products.go:231 pkg/invoices.go:187 pkg/invoices.go:578 +#: pkg/invoices.go:960 pkg/contacts.go:267 msgctxt "input" msgid "Tags" msgstr "Etiquetes" -#: pkg/products.go:255 pkg/profile.go:92 pkg/invoices.go:802 +#: pkg/products.go:250 pkg/profile.go:92 pkg/invoices.go:802 msgid "Name can not be empty." msgstr "No podéis dejar el nombre en blanco." -#: pkg/products.go:256 pkg/invoices.go:803 +#: pkg/products.go:251 pkg/invoices.go:803 msgid "Price can not be empty." msgstr "No podéis dejar el precio en blanco." -#: pkg/products.go:257 pkg/invoices.go:804 +#: pkg/products.go:252 pkg/invoices.go:804 msgid "Price must be a number greater than zero." msgstr "El precio tiene que ser un número mayor a cero." -#: pkg/products.go:259 pkg/invoices.go:812 +#: pkg/products.go:254 pkg/invoices.go:812 msgid "Selected tax is not valid." msgstr "Habéis escogido un impuesto que no es válido." -#: pkg/products.go:260 pkg/invoices.go:813 +#: pkg/products.go:255 pkg/invoices.go:813 msgid "You can only select a tax of each class." msgstr "Solo podéis escoger un impuesto de cada clase." @@ -606,88 +606,98 @@ msgstr "La confirmación no corresponde con la contraseña." msgid "Selected language is not valid." msgstr "Habéis escogido un idioma que no es válido." -#: pkg/invoices.go:165 pkg/invoices.go:549 +#: pkg/invoices.go:160 pkg/invoices.go:561 msgctxt "input" msgid "Customer" msgstr "Cliente" -#: pkg/invoices.go:166 +#: pkg/invoices.go:161 msgid "All customers" msgstr "Todos los clientes" -#: pkg/invoices.go:171 pkg/invoices.go:543 +#: pkg/invoices.go:166 pkg/invoices.go:555 msgctxt "input" msgid "Invoice Status" msgstr "Estado de la factura" -#: pkg/invoices.go:172 +#: pkg/invoices.go:167 msgid "All status" msgstr "Todos los estados" -#: pkg/invoices.go:177 +#: pkg/invoices.go:172 msgctxt "input" msgid "Invoice Number" msgstr "Número de factura" -#: pkg/invoices.go:182 +#: pkg/invoices.go:177 msgctxt "input" msgid "From Date" msgstr "A partir de la fecha" -#: pkg/invoices.go:187 +#: pkg/invoices.go:182 msgctxt "input" msgid "To Date" msgstr "Hasta la fecha" -#: pkg/invoices.go:394 +#: pkg/invoices.go:191 +msgctxt "input" +msgid "Tags Condition" +msgstr "Condición de las etiquetas" + +#: pkg/invoices.go:194 +msgctxt "tag condition" +msgid "All" +msgstr "Todas" + +#: pkg/invoices.go:197 +msgctxt "tag condition" +msgid "Any" +msgstr "Cualquiera" + +#: pkg/invoices.go:401 msgid "Select a customer to bill." msgstr "Escoged un cliente a facturar." -#: pkg/invoices.go:493 +#: pkg/invoices.go:500 msgid "invoices.zip" msgstr "facturas.zip" -#: pkg/invoices.go:499 pkg/invoices.go:921 +#: pkg/invoices.go:506 pkg/invoices.go:946 msgid "Invalid action" msgstr "Acción inválida." -#: pkg/invoices.go:555 -msgctxt "input" -msgid "Number" -msgstr "Número" - -#: pkg/invoices.go:560 +#: pkg/invoices.go:567 msgctxt "input" msgid "Invoice Date" msgstr "Fecha de factura" -#: pkg/invoices.go:566 +#: pkg/invoices.go:573 msgctxt "input" msgid "Notes" msgstr "Notas" -#: pkg/invoices.go:576 +#: pkg/invoices.go:583 msgctxt "input" msgid "Payment Method" msgstr "Método de pago" -#: pkg/invoices.go:613 +#: pkg/invoices.go:620 msgid "Selected invoice status is not valid." msgstr "Habéis escogido un estado de factura que no es válido." -#: pkg/invoices.go:614 +#: pkg/invoices.go:621 msgid "Selected customer is not valid." msgstr "Habéis escogido un cliente que no es válido." -#: pkg/invoices.go:615 +#: pkg/invoices.go:622 msgid "Invoice date can not be empty." msgstr "No podéis dejar la fecha de la factura en blanco." -#: pkg/invoices.go:616 +#: pkg/invoices.go:623 msgid "Invoice date must be a valid date." msgstr "La fecha de factura debe ser válida." -#: pkg/invoices.go:618 +#: pkg/invoices.go:625 msgid "Selected payment method is not valid." msgstr "Habéis escogido un método de pago que no es válido." @@ -726,104 +736,108 @@ msgstr "No podéis dejar el descuento en blanco." msgid "Discount must be a percentage between 0 and 100." msgstr "El descuento tiene que ser un porcentaje entre 0 y 100." -#: pkg/contacts.go:187 +#: pkg/contacts.go:181 msgctxt "input" msgid "Business name" msgstr "Nombre y apellidos" -#: pkg/contacts.go:196 +#: pkg/contacts.go:190 msgctxt "input" msgid "VAT number" msgstr "DNI / NIF" -#: pkg/contacts.go:202 +#: pkg/contacts.go:196 msgctxt "input" msgid "Trade name" msgstr "Nombre comercial" -#: pkg/contacts.go:207 +#: pkg/contacts.go:201 msgctxt "input" msgid "Phone" msgstr "Teléfono" -#: pkg/contacts.go:225 +#: pkg/contacts.go:219 msgctxt "input" msgid "Web" msgstr "Web" -#: pkg/contacts.go:233 +#: pkg/contacts.go:227 msgctxt "input" msgid "Address" msgstr "Dirección" -#: pkg/contacts.go:242 +#: pkg/contacts.go:236 msgctxt "input" msgid "City" msgstr "Población" -#: pkg/contacts.go:248 +#: pkg/contacts.go:242 msgctxt "input" msgid "Province" msgstr "Provincia" -#: pkg/contacts.go:254 +#: pkg/contacts.go:248 msgctxt "input" msgid "Postal code" msgstr "Código postal" -#: pkg/contacts.go:263 +#: pkg/contacts.go:257 msgctxt "input" msgid "Country" msgstr "País" -#: pkg/contacts.go:301 +#: pkg/contacts.go:295 msgid "Selected country is not valid." msgstr "Habéis escogido un país que no es válido." -#: pkg/contacts.go:305 +#: pkg/contacts.go:299 msgid "Business name can not be empty." msgstr "No podéis dejar el nombre y los apellidos en blanco." -#: pkg/contacts.go:306 +#: pkg/contacts.go:300 msgid "VAT number can not be empty." msgstr "No podéis dejar el DNI o NIF en blanco." -#: pkg/contacts.go:307 +#: pkg/contacts.go:301 msgid "This value is not a valid VAT number." msgstr "Este valor no es un DNI o NIF válido." -#: pkg/contacts.go:309 +#: pkg/contacts.go:303 msgid "Phone can not be empty." msgstr "No podéis dejar el teléfono en blanco." -#: pkg/contacts.go:310 +#: pkg/contacts.go:304 msgid "This value is not a valid phone number." msgstr "Este valor no es un teléfono válido." -#: pkg/contacts.go:316 +#: pkg/contacts.go:310 msgid "This value is not a valid web address. It should be like https://domain.com/." msgstr "Este valor no es una dirección web válida. Tiene que ser parecida a https://dominio.es/." -#: pkg/contacts.go:318 +#: pkg/contacts.go:312 msgid "Address can not be empty." msgstr "No podéis dejar la dirección en blanco." -#: pkg/contacts.go:319 +#: pkg/contacts.go:313 msgid "City can not be empty." msgstr "No podéis dejar la población en blanco." -#: pkg/contacts.go:320 +#: pkg/contacts.go:314 msgid "Province can not be empty." msgstr "No podéis dejar la provincia en blanco." -#: pkg/contacts.go:321 +#: pkg/contacts.go:315 msgid "Postal code can not be empty." msgstr "No podéis dejar el código postal en blanco." -#: pkg/contacts.go:322 +#: pkg/contacts.go:316 msgid "This value is not a valid postal code." msgstr "Este valor no es un código postal válido válido." +#~ msgctxt "input" +#~ msgid "Number" +#~ msgstr "Número" + #~ msgctxt "title" #~ msgid "Label" #~ msgstr "Etiqueta" diff --git a/web/static/numerus.css b/web/static/numerus.css index 42827dc..aaa5bad 100644 --- a/web/static/numerus.css +++ b/web/static/numerus.css @@ -374,11 +374,22 @@ input.width-2x { transition: 0.2s; } +.input[is="numerus-toggle"] label { + position: initial; + font-style: initial; + pointer-events: initial; + font-size: inherit; + padding: initial; +} + fieldset { border: none; padding: 2rem 0 0; margin-top: 3rem; border-top: 1px solid var(--numerus--color--light-gray); + display: flex; + flex-wrap: wrap; + justify-content: space-between; } legend { @@ -392,10 +403,17 @@ legend + * { clear: both; } -fieldset { - display: flex; - flex-wrap: wrap; - justify-content: space-between; +fieldset[is="numerus-toggle"] { + display: inline-flex; + border-top: none; + margin: 0; + padding: 0; +} + +fieldset[is="numerus-toggle"] legend { + float: revert; + margin: 0; + width: initial; } .full-width { diff --git a/web/template/form.gohtml b/web/template/form.gohtml index 63bb69d..899c70b 100644 --- a/web/template/form.gohtml +++ b/web/template/form.gohtml @@ -92,3 +92,12 @@ {{- end }} {{- end }} + +{{ define "toggle-field" -}} + {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.ToggleField*/ -}} +
+ {{ .Label }} + + +
+{{- end }} diff --git a/web/template/invoices/index.gohtml b/web/template/invoices/index.gohtml index 3bf0ebd..f20fe76 100644 --- a/web/template/invoices/index.gohtml +++ b/web/template/invoices/index.gohtml @@ -36,7 +36,7 @@ {{ template "input-field" .ToDate }} {{ template "input-field" .InvoiceNumber }} {{ template "tags-field" .Tags }} - {{ template "select-field" .TagsCondition }} + {{ template "toggle-field" .TagsCondition }} {{ end }}