Compare commits

..

2 Commits

Author SHA1 Message Date
jordi fita mas 47c23fc4cc Boost the products’ section links and forms
Had to add the editProductPage because now i need to know the slug in
order to build the form’s action link.  I also added the `ProductName`
field because it was less awkward than using `.Form.Name` everywhere.
2023-03-27 09:44:04 +02:00
jordi fita mas 2086f68bd8 Boost contact’s tag links to update <main> with the filtered list 2023-03-27 09:40:24 +02:00
7 changed files with 241 additions and 205 deletions

View File

@ -47,15 +47,26 @@ func GetProductForm(w http.ResponseWriter, r *http.Request, params httprouter.Pa
return
}
w.WriteHeader(http.StatusOK)
mustRenderEditProductForm(w, r, form)
mustRenderEditProductForm(w, r, slug, form)
}
func mustRenderNewProductForm(w http.ResponseWriter, r *http.Request, form *productForm) {
mustRenderAppTemplate(w, r, "products/new.gohtml", form)
mustRenderModalTemplate(w, r, "products/new.gohtml", form)
}
func mustRenderEditProductForm(w http.ResponseWriter, r *http.Request, form *productForm) {
mustRenderAppTemplate(w, r, "products/edit.gohtml", form)
type editProductPage struct {
Slug string
ProductName string
Form *productForm
}
func mustRenderEditProductForm(w http.ResponseWriter, r *http.Request, slug string, form *productForm) {
page := &editProductPage{
Slug: slug,
ProductName: form.Name.Val,
Form: form,
}
mustRenderModalTemplate(w, r, "products/edit.gohtml", page)
}
func HandleAddProduct(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
@ -72,12 +83,21 @@ func HandleAddProduct(w http.ResponseWriter, r *http.Request, _ httprouter.Param
return
}
if !form.Validate() {
if !IsHTMxRequest(r) {
w.WriteHeader(http.StatusUnprocessableEntity)
}
mustRenderNewProductForm(w, r, form)
return
}
taxes := mustSliceAtoi(form.Tax.Selected)
conn.MustExec(r.Context(), "select add_product($1, $2, $3, $4, $5, $6)", company.Id, form.Name, form.Description, form.Price, taxes, form.Tags)
http.Redirect(w, r, companyURI(company, "/products"), http.StatusSeeOther)
if IsHTMxRequest(r) {
w.Header().Set("HX-Trigger", "closeModal")
w.Header().Set("HX-Refresh", "true")
w.WriteHeader(http.StatusNoContent)
} else {
http.Redirect(w, r, companyURI(company, "/products"), http.StatusSeeOther)
}
}
func sliceAtoi(s []string) ([]int, error) {
@ -113,17 +133,23 @@ func HandleUpdateProduct(w http.ResponseWriter, r *http.Request, params httprout
http.Error(w, err.Error(), http.StatusForbidden)
return
}
slug := params[0].Value
if !form.Validate() {
w.WriteHeader(http.StatusUnprocessableEntity)
mustRenderEditProductForm(w, r, form)
mustRenderEditProductForm(w, r, slug, form)
return
}
slug := params[0].Value
taxes := mustSliceAtoi(form.Tax.Selected)
if ok := conn.MustGetBool(r.Context(), "select edit_product($1, $2, $3, $4, $5, $6)", slug, form.Name, form.Description, form.Price, taxes, form.Tags); !ok {
http.NotFound(w, r)
}
http.Redirect(w, r, companyURI(company, "/products/"+slug), http.StatusSeeOther)
if IsHTMxRequest(r) {
w.Header().Set("HX-Trigger", "closeModal")
w.Header().Set("HX-Refresh", "true")
w.WriteHeader(http.StatusNoContent)
} else {
http.Redirect(w, r, companyURI(company, "/products/"+slug), http.StatusSeeOther)
}
}
func mustCollectProductEntries(ctx context.Context, conn *Conn, company *Company, tag string) []*ProductEntry {

179
po/ca.po
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-03-21 11:56+0100\n"
"POT-Creation-Date: 2023-03-27 09:43+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"
@ -26,10 +26,10 @@ msgstr "Afegeix productes a la factura"
#: web/template/invoices/products.gohtml:9 web/template/invoices/new.gohtml:9
#: web/template/invoices/index.gohtml:9 web/template/invoices/view.gohtml:9
#: web/template/invoices/edit.gohtml:9 web/template/contacts/new.gohtml:9
#: web/template/contacts/index.gohtml:9 web/template/contacts/edit.gohtml:9
#: web/template/contacts/index.gohtml:9 web/template/contacts/edit.gohtml:10
#: web/template/profile.gohtml:9 web/template/tax-details.gohtml:9
#: web/template/products/new.gohtml:9 web/template/products/index.gohtml:9
#: web/template/products/edit.gohtml:9
#: web/template/products/edit.gohtml:10
msgctxt "title"
msgid "Home"
msgstr "Inici"
@ -48,25 +48,25 @@ msgid "New Invoice"
msgstr "Nova factura"
#: web/template/invoices/products.gohtml:51
#: web/template/products/index.gohtml:24
#: web/template/products/index.gohtml:25
msgctxt "product"
msgid "All"
msgstr "Tots"
#: web/template/invoices/products.gohtml:52
#: web/template/products/index.gohtml:25
#: 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:26
#: web/template/invoices/view.gohtml:59 web/template/products/index.gohtml:28
msgctxt "title"
msgid "Price"
msgstr "Preu"
#: web/template/invoices/products.gohtml:67
#: web/template/products/index.gohtml:40
#: web/template/products/index.gohtml:48
msgid "No products added yet."
msgstr "No hi ha cap producte."
@ -118,7 +118,7 @@ msgctxt "title"
msgid "Invoice Num."
msgstr "Núm. factura"
#: web/template/invoices/index.gohtml:34 web/template/contacts/index.gohtml:25
#: web/template/invoices/index.gohtml:34 web/template/contacts/index.gohtml:26
msgctxt "title"
msgid "Customer"
msgstr "Client"
@ -128,7 +128,8 @@ msgctxt "title"
msgid "Status"
msgstr "Estat"
#: web/template/invoices/index.gohtml:36
#: web/template/invoices/index.gohtml:36 web/template/contacts/index.gohtml:29
#: web/template/products/index.gohtml:27
msgctxt "title"
msgid "Tags"
msgstr "Etiquetes"
@ -212,37 +213,37 @@ msgctxt "title"
msgid "Dashboard"
msgstr "Tauler"
#: web/template/app.gohtml:22
#: web/template/app.gohtml:23
msgctxt "menu"
msgid "Account"
msgstr "Compte"
#: web/template/app.gohtml:28
#: web/template/app.gohtml:29
msgctxt "menu"
msgid "Tax Details"
msgstr "Configuració fiscal"
#: web/template/app.gohtml:36
#: web/template/app.gohtml:37
msgctxt "action"
msgid "Logout"
msgstr "Surt"
#: web/template/app.gohtml:45
#: web/template/app.gohtml:46
msgctxt "nav"
msgid "Dashboard"
msgstr "Tauler"
#: web/template/app.gohtml:46
#: web/template/app.gohtml:47
msgctxt "nav"
msgid "Invoices"
msgstr "Factures"
#: web/template/app.gohtml:47
#: web/template/app.gohtml:48
msgctxt "nav"
msgid "Products"
msgstr "Productes"
#: web/template/app.gohtml:48
#: web/template/app.gohtml:49
msgctxt "nav"
msgid "Contacts"
msgstr "Contactes"
@ -254,41 +255,41 @@ msgid "New Contact"
msgstr "Nou contacte"
#: web/template/contacts/new.gohtml:10 web/template/contacts/index.gohtml:2
#: web/template/contacts/index.gohtml:10 web/template/contacts/edit.gohtml:10
#: web/template/contacts/index.gohtml:10 web/template/contacts/edit.gohtml:11
msgctxt "title"
msgid "Contacts"
msgstr "Contactes"
#: web/template/contacts/new.gohtml:35 web/template/contacts/index.gohtml:14
#: web/template/contacts/new.gohtml:36 web/template/contacts/index.gohtml:15
msgctxt "action"
msgid "New contact"
msgstr "Nou contacte"
#: web/template/contacts/index.gohtml:24
#: web/template/contacts/index.gohtml:25
msgctxt "contact"
msgid "All"
msgstr "Tots"
#: web/template/contacts/index.gohtml:26
#: web/template/contacts/index.gohtml:27
msgctxt "title"
msgid "Email"
msgstr "Correu-e"
#: web/template/contacts/index.gohtml:27
#: web/template/contacts/index.gohtml:28
msgctxt "title"
msgid "Phone"
msgstr "Telèfon"
#: web/template/contacts/index.gohtml:42
#: web/template/contacts/index.gohtml:50
msgid "No contacts added yet."
msgstr "No hi ha cap contacte."
#: web/template/contacts/edit.gohtml:2 web/template/contacts/edit.gohtml:19
#: web/template/contacts/edit.gohtml:3 web/template/contacts/edit.gohtml:20
msgctxt "title"
msgid "Edit Contact “%s”"
msgstr "Edició del contacte «%s»"
#: web/template/contacts/edit.gohtml:37
#: web/template/contacts/edit.gohtml:41
msgctxt "action"
msgid "Update contact"
msgstr "Actualitza contacte"
@ -404,27 +405,27 @@ msgid "New Product"
msgstr "Nou producte"
#: web/template/products/new.gohtml:10 web/template/products/index.gohtml:2
#: web/template/products/index.gohtml:10 web/template/products/edit.gohtml:10
#: web/template/products/index.gohtml:10 web/template/products/edit.gohtml:11
msgctxt "title"
msgid "Products"
msgstr "Productes"
#: web/template/products/new.gohtml:29 web/template/products/index.gohtml:14
#: web/template/products/new.gohtml:32 web/template/products/index.gohtml:15
msgctxt "action"
msgid "New product"
msgstr "Nou producte"
#: web/template/products/edit.gohtml:2 web/template/products/edit.gohtml:19
#: web/template/products/edit.gohtml:3 web/template/products/edit.gohtml:20
msgctxt "title"
msgid "Edit Product “%s”"
msgstr "Edició del producte «%s»"
#: web/template/products/edit.gohtml:30
#: web/template/products/edit.gohtml:36
msgctxt "action"
msgid "Update product"
msgstr "Actualitza producte"
#: pkg/login.go:36 pkg/profile.go:40 pkg/contacts.go:172
#: pkg/login.go:36 pkg/profile.go:40 pkg/contacts.go:216
msgctxt "input"
msgid "Email"
msgstr "Correu-e"
@ -434,11 +435,11 @@ msgctxt "input"
msgid "Password"
msgstr "Contrasenya"
#: pkg/login.go:69 pkg/profile.go:89 pkg/contacts.go:263
#: pkg/login.go:69 pkg/profile.go:89 pkg/contacts.go:312
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:264
#: pkg/login.go:70 pkg/profile.go:90 pkg/contacts.go:313
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."
@ -450,43 +451,48 @@ msgstr "No podeu deixar la contrasenya en blanc."
msgid "Invalid user or password."
msgstr "Nom dusuari o contrasenya incorrectes."
#: pkg/products.go:165 pkg/invoices.go:647
#: pkg/products.go:209 pkg/invoices.go:636
msgctxt "input"
msgid "Name"
msgstr "Nom"
#: pkg/products.go:171 pkg/invoices.go:652
#: pkg/products.go:215 pkg/invoices.go:641
msgctxt "input"
msgid "Description"
msgstr "Descripció"
#: pkg/products.go:176 pkg/invoices.go:656
#: pkg/products.go:220 pkg/invoices.go:645
msgctxt "input"
msgid "Price"
msgstr "Preu"
#: pkg/products.go:186 pkg/invoices.go:682
#: pkg/products.go:230 pkg/invoices.go:671
msgctxt "input"
msgid "Taxes"
msgstr "Imposts"
#: pkg/products.go:206 pkg/profile.go:92 pkg/invoices.go:721
#: pkg/products.go:236 pkg/invoices.go:479 pkg/contacts.go:273
msgctxt "input"
msgid "Tags"
msgstr "Etiquetes"
#: pkg/products.go:255 pkg/profile.go:92 pkg/invoices.go:710
msgid "Name can not be empty."
msgstr "No podeu deixar el nom en blanc."
#: pkg/products.go:207 pkg/invoices.go:722
#: pkg/products.go:256 pkg/invoices.go:711
msgid "Price can not be empty."
msgstr "No podeu deixar el preu en blanc."
#: pkg/products.go:208 pkg/invoices.go:723
#: pkg/products.go:257 pkg/invoices.go:712
msgid "Price must be a number greater than zero."
msgstr "El preu ha de ser un número major a zero."
#: pkg/products.go:210 pkg/invoices.go:731
#: pkg/products.go:259 pkg/invoices.go:720
msgid "Selected tax is not valid."
msgstr "Heu seleccionat un impost que no és vàlid."
#: pkg/products.go:211 pkg/invoices.go:732
#: pkg/products.go:260 pkg/invoices.go:721
msgid "You can only select a tax of each class."
msgstr "Només podeu seleccionar un impost de cada classe."
@ -594,203 +600,198 @@ 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:303
#: pkg/invoices.go:302
msgid "Select a customer to bill."
msgstr "Escolliu un client a facturar."
#: pkg/invoices.go:402
#: pkg/invoices.go:401
msgid "invoices.zip"
msgstr "factures.zip"
#: pkg/invoices.go:408 pkg/invoices.go:840
#: pkg/invoices.go:407 pkg/invoices.go:829
msgid "Invalid action"
msgstr "Acció invàlida."
#: pkg/invoices.go:452
#: pkg/invoices.go:451
msgctxt "input"
msgid "Invoice Status"
msgstr "Estat de la factura"
#: pkg/invoices.go:458
#: pkg/invoices.go:457
msgctxt "input"
msgid "Customer"
msgstr "Client"
#: pkg/invoices.go:464
#: pkg/invoices.go:463
msgctxt "input"
msgid "Number"
msgstr "Número"
#: pkg/invoices.go:469
#: pkg/invoices.go:468
msgctxt "input"
msgid "Invoice Date"
msgstr "Data de factura"
#: pkg/invoices.go:475
#: pkg/invoices.go:474
msgctxt "input"
msgid "Notes"
msgstr "Notes"
#: pkg/invoices.go:480
msgctxt "input"
msgid "Tags"
msgstr "Etiquetes"
#: pkg/invoices.go:486
#: pkg/invoices.go:484
msgctxt "input"
msgid "Payment Method"
msgstr "Mètode de pagament"
#: pkg/invoices.go:523
#: pkg/invoices.go:521
msgid "Selected invoice status is not valid."
msgstr "Heu seleccionat un estat de factura que no és vàlid."
#: pkg/invoices.go:524
#: pkg/invoices.go:522
msgid "Selected customer is not valid."
msgstr "Heu seleccionat un client que no és vàlid."
#: pkg/invoices.go:525
#: pkg/invoices.go:523
msgid "Invoice date can not be empty."
msgstr "No podeu deixar la data de la factura en blanc."
#: pkg/invoices.go:526
#: pkg/invoices.go:524
msgid "Invoice date must be a valid date."
msgstr "La data de facturació ha de ser vàlida."
#: pkg/invoices.go:528
#: pkg/invoices.go:526
msgid "Selected payment method is not valid."
msgstr "Heu seleccionat un mètode de pagament que no és vàlid."
#: pkg/invoices.go:637 pkg/invoices.go:642
#: pkg/invoices.go:626 pkg/invoices.go:631
msgctxt "input"
msgid "Id"
msgstr "Identificador"
#: pkg/invoices.go:665
#: pkg/invoices.go:654
msgctxt "input"
msgid "Quantity"
msgstr "Quantitat"
#: pkg/invoices.go:673
#: pkg/invoices.go:662
msgctxt "input"
msgid "Discount (%)"
msgstr "Descompte (%)"
#: pkg/invoices.go:720
#: pkg/invoices.go:709
msgid "Product ID can not be empty."
msgstr "No podeu deixar lidentificador del producte en blanc."
#: pkg/invoices.go:725
#: pkg/invoices.go:714
msgid "Quantity can not be empty."
msgstr "No podeu deixar la quantitat en blanc."
#: pkg/invoices.go:726
#: pkg/invoices.go:715
msgid "Quantity must be a number greater than zero."
msgstr "La quantitat ha de ser un número major a zero."
#: pkg/invoices.go:728
#: pkg/invoices.go:717
msgid "Discount can not be empty."
msgstr "No podeu deixar el descompte en blanc."
#: pkg/invoices.go:729
#: pkg/invoices.go:718
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:143
#: pkg/contacts.go:187
msgctxt "input"
msgid "Business name"
msgstr "Nom i cognoms"
#: pkg/contacts.go:152
#: pkg/contacts.go:196
msgctxt "input"
msgid "VAT number"
msgstr "DNI / NIF"
#: pkg/contacts.go:158
#: pkg/contacts.go:202
msgctxt "input"
msgid "Trade name"
msgstr "Nom comercial"
#: pkg/contacts.go:163
#: pkg/contacts.go:207
msgctxt "input"
msgid "Phone"
msgstr "Telèfon"
#: pkg/contacts.go:181
#: pkg/contacts.go:225
msgctxt "input"
msgid "Web"
msgstr "Web"
#: pkg/contacts.go:189
#: pkg/contacts.go:233
msgctxt "input"
msgid "Address"
msgstr "Adreça"
#: pkg/contacts.go:198
#: pkg/contacts.go:242
msgctxt "input"
msgid "City"
msgstr "Població"
#: pkg/contacts.go:204
#: pkg/contacts.go:248
msgctxt "input"
msgid "Province"
msgstr "Província"
#: pkg/contacts.go:210
#: pkg/contacts.go:254
msgctxt "input"
msgid "Postal code"
msgstr "Codi postal"
#: pkg/contacts.go:219
#: pkg/contacts.go:263
msgctxt "input"
msgid "Country"
msgstr "País"
#: pkg/contacts.go:252
#: pkg/contacts.go:301
msgid "Selected country is not valid."
msgstr "Heu seleccionat un país que no és vàlid."
#: pkg/contacts.go:256
#: pkg/contacts.go:305
msgid "Business name can not be empty."
msgstr "No podeu deixar el nom i els cognoms en blanc."
#: pkg/contacts.go:257
#: pkg/contacts.go:306
msgid "VAT number can not be empty."
msgstr "No podeu deixar el DNI o NIF en blanc."
#: pkg/contacts.go:258
#: pkg/contacts.go:307
msgid "This value is not a valid VAT number."
msgstr "Aquest valor no és un DNI o NIF vàlid."
#: pkg/contacts.go:260
#: pkg/contacts.go:309
msgid "Phone can not be empty."
msgstr "No podeu deixar el telèfon en blanc."
#: pkg/contacts.go:261
#: pkg/contacts.go:310
msgid "This value is not a valid phone number."
msgstr "Aquest valor no és un telèfon vàlid."
#: pkg/contacts.go:267
#: pkg/contacts.go:316
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:269
#: pkg/contacts.go:318
msgid "Address can not be empty."
msgstr "No podeu deixar ladreça en blanc."
#: pkg/contacts.go:270
#: pkg/contacts.go:319
msgid "City can not be empty."
msgstr "No podeu deixar la població en blanc."
#: pkg/contacts.go:271
#: pkg/contacts.go:320
msgid "Province can not be empty."
msgstr "No podeu deixar la província en blanc."
#: pkg/contacts.go:272
#: pkg/contacts.go:321
msgid "Postal code can not be empty."
msgstr "No podeu deixar el codi postal en blanc."
#: pkg/contacts.go:273
#: pkg/contacts.go:322
msgid "This value is not a valid postal code."
msgstr "Aquest valor no és un codi postal vàlid."

179
po/es.po
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-03-21 11:56+0100\n"
"POT-Creation-Date: 2023-03-27 09:43+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"
@ -26,10 +26,10 @@ msgstr "Añadir productos a la factura"
#: web/template/invoices/products.gohtml:9 web/template/invoices/new.gohtml:9
#: web/template/invoices/index.gohtml:9 web/template/invoices/view.gohtml:9
#: web/template/invoices/edit.gohtml:9 web/template/contacts/new.gohtml:9
#: web/template/contacts/index.gohtml:9 web/template/contacts/edit.gohtml:9
#: web/template/contacts/index.gohtml:9 web/template/contacts/edit.gohtml:10
#: web/template/profile.gohtml:9 web/template/tax-details.gohtml:9
#: web/template/products/new.gohtml:9 web/template/products/index.gohtml:9
#: web/template/products/edit.gohtml:9
#: web/template/products/edit.gohtml:10
msgctxt "title"
msgid "Home"
msgstr "Inicio"
@ -48,25 +48,25 @@ msgid "New Invoice"
msgstr "Nueva factura"
#: web/template/invoices/products.gohtml:51
#: web/template/products/index.gohtml:24
#: web/template/products/index.gohtml:25
msgctxt "product"
msgid "All"
msgstr "Todos"
#: web/template/invoices/products.gohtml:52
#: web/template/products/index.gohtml:25
#: 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:26
#: web/template/invoices/view.gohtml:59 web/template/products/index.gohtml:28
msgctxt "title"
msgid "Price"
msgstr "Precio"
#: web/template/invoices/products.gohtml:67
#: web/template/products/index.gohtml:40
#: web/template/products/index.gohtml:48
msgid "No products added yet."
msgstr "No hay productos."
@ -118,7 +118,7 @@ msgctxt "title"
msgid "Invoice Num."
msgstr "Nº factura"
#: web/template/invoices/index.gohtml:34 web/template/contacts/index.gohtml:25
#: web/template/invoices/index.gohtml:34 web/template/contacts/index.gohtml:26
msgctxt "title"
msgid "Customer"
msgstr "Cliente"
@ -128,7 +128,8 @@ msgctxt "title"
msgid "Status"
msgstr "Estado"
#: web/template/invoices/index.gohtml:36
#: web/template/invoices/index.gohtml:36 web/template/contacts/index.gohtml:29
#: web/template/products/index.gohtml:27
msgctxt "title"
msgid "Tags"
msgstr "Etiquetes"
@ -212,37 +213,37 @@ msgctxt "title"
msgid "Dashboard"
msgstr "Panel"
#: web/template/app.gohtml:22
#: web/template/app.gohtml:23
msgctxt "menu"
msgid "Account"
msgstr "Cuenta"
#: web/template/app.gohtml:28
#: web/template/app.gohtml:29
msgctxt "menu"
msgid "Tax Details"
msgstr "Configuración fiscal"
#: web/template/app.gohtml:36
#: web/template/app.gohtml:37
msgctxt "action"
msgid "Logout"
msgstr "Salir"
#: web/template/app.gohtml:45
#: web/template/app.gohtml:46
msgctxt "nav"
msgid "Dashboard"
msgstr "Panel"
#: web/template/app.gohtml:46
#: web/template/app.gohtml:47
msgctxt "nav"
msgid "Invoices"
msgstr "Facturas"
#: web/template/app.gohtml:47
#: web/template/app.gohtml:48
msgctxt "nav"
msgid "Products"
msgstr "Productos"
#: web/template/app.gohtml:48
#: web/template/app.gohtml:49
msgctxt "nav"
msgid "Contacts"
msgstr "Contactos"
@ -254,41 +255,41 @@ msgid "New Contact"
msgstr "Nuevo contacto"
#: web/template/contacts/new.gohtml:10 web/template/contacts/index.gohtml:2
#: web/template/contacts/index.gohtml:10 web/template/contacts/edit.gohtml:10
#: web/template/contacts/index.gohtml:10 web/template/contacts/edit.gohtml:11
msgctxt "title"
msgid "Contacts"
msgstr "Contactos"
#: web/template/contacts/new.gohtml:35 web/template/contacts/index.gohtml:14
#: web/template/contacts/new.gohtml:36 web/template/contacts/index.gohtml:15
msgctxt "action"
msgid "New contact"
msgstr "Nuevo contacto"
#: web/template/contacts/index.gohtml:24
#: web/template/contacts/index.gohtml:25
msgctxt "contact"
msgid "All"
msgstr "Todos"
#: web/template/contacts/index.gohtml:26
#: web/template/contacts/index.gohtml:27
msgctxt "title"
msgid "Email"
msgstr "Correo-e"
#: web/template/contacts/index.gohtml:27
#: web/template/contacts/index.gohtml:28
msgctxt "title"
msgid "Phone"
msgstr "Teléfono"
#: web/template/contacts/index.gohtml:42
#: web/template/contacts/index.gohtml:50
msgid "No contacts added yet."
msgstr "No hay contactos."
#: web/template/contacts/edit.gohtml:2 web/template/contacts/edit.gohtml:19
#: web/template/contacts/edit.gohtml:3 web/template/contacts/edit.gohtml:20
msgctxt "title"
msgid "Edit Contact “%s”"
msgstr "Edición del contacto «%s»"
#: web/template/contacts/edit.gohtml:37
#: web/template/contacts/edit.gohtml:41
msgctxt "action"
msgid "Update contact"
msgstr "Actualizar contacto"
@ -404,27 +405,27 @@ msgid "New Product"
msgstr "Nuevo producto"
#: web/template/products/new.gohtml:10 web/template/products/index.gohtml:2
#: web/template/products/index.gohtml:10 web/template/products/edit.gohtml:10
#: web/template/products/index.gohtml:10 web/template/products/edit.gohtml:11
msgctxt "title"
msgid "Products"
msgstr "Productos"
#: web/template/products/new.gohtml:29 web/template/products/index.gohtml:14
#: web/template/products/new.gohtml:32 web/template/products/index.gohtml:15
msgctxt "action"
msgid "New product"
msgstr "Nuevo producto"
#: web/template/products/edit.gohtml:2 web/template/products/edit.gohtml:19
#: web/template/products/edit.gohtml:3 web/template/products/edit.gohtml:20
msgctxt "title"
msgid "Edit Product “%s”"
msgstr "Edición del producto «%s»"
#: web/template/products/edit.gohtml:30
#: web/template/products/edit.gohtml:36
msgctxt "action"
msgid "Update product"
msgstr "Actualizar producto"
#: pkg/login.go:36 pkg/profile.go:40 pkg/contacts.go:172
#: pkg/login.go:36 pkg/profile.go:40 pkg/contacts.go:216
msgctxt "input"
msgid "Email"
msgstr "Correo-e"
@ -434,11 +435,11 @@ msgctxt "input"
msgid "Password"
msgstr "Contraseña"
#: pkg/login.go:69 pkg/profile.go:89 pkg/contacts.go:263
#: pkg/login.go:69 pkg/profile.go:89 pkg/contacts.go:312
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:264
#: pkg/login.go:70 pkg/profile.go:90 pkg/contacts.go:313
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."
@ -450,43 +451,48 @@ 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:165 pkg/invoices.go:647
#: pkg/products.go:209 pkg/invoices.go:636
msgctxt "input"
msgid "Name"
msgstr "Nombre"
#: pkg/products.go:171 pkg/invoices.go:652
#: pkg/products.go:215 pkg/invoices.go:641
msgctxt "input"
msgid "Description"
msgstr "Descripción"
#: pkg/products.go:176 pkg/invoices.go:656
#: pkg/products.go:220 pkg/invoices.go:645
msgctxt "input"
msgid "Price"
msgstr "Precio"
#: pkg/products.go:186 pkg/invoices.go:682
#: pkg/products.go:230 pkg/invoices.go:671
msgctxt "input"
msgid "Taxes"
msgstr "Impuestos"
#: pkg/products.go:206 pkg/profile.go:92 pkg/invoices.go:721
#: pkg/products.go:236 pkg/invoices.go:479 pkg/contacts.go:273
msgctxt "input"
msgid "Tags"
msgstr "Etiquetes"
#: pkg/products.go:255 pkg/profile.go:92 pkg/invoices.go:710
msgid "Name can not be empty."
msgstr "No podéis dejar el nombre en blanco."
#: pkg/products.go:207 pkg/invoices.go:722
#: pkg/products.go:256 pkg/invoices.go:711
msgid "Price can not be empty."
msgstr "No podéis dejar el precio en blanco."
#: pkg/products.go:208 pkg/invoices.go:723
#: pkg/products.go:257 pkg/invoices.go:712
msgid "Price must be a number greater than zero."
msgstr "El precio tiene que ser un número mayor a cero."
#: pkg/products.go:210 pkg/invoices.go:731
#: pkg/products.go:259 pkg/invoices.go:720
msgid "Selected tax is not valid."
msgstr "Habéis escogido un impuesto que no es válido."
#: pkg/products.go:211 pkg/invoices.go:732
#: pkg/products.go:260 pkg/invoices.go:721
msgid "You can only select a tax of each class."
msgstr "Solo podéis escoger un impuesto de cada clase."
@ -594,203 +600,198 @@ 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:303
#: pkg/invoices.go:302
msgid "Select a customer to bill."
msgstr "Escoged un cliente a facturar."
#: pkg/invoices.go:402
#: pkg/invoices.go:401
msgid "invoices.zip"
msgstr "facturas.zip"
#: pkg/invoices.go:408 pkg/invoices.go:840
#: pkg/invoices.go:407 pkg/invoices.go:829
msgid "Invalid action"
msgstr "Acción inválida."
#: pkg/invoices.go:452
#: pkg/invoices.go:451
msgctxt "input"
msgid "Invoice Status"
msgstr "Estado de la factura"
#: pkg/invoices.go:458
#: pkg/invoices.go:457
msgctxt "input"
msgid "Customer"
msgstr "Cliente"
#: pkg/invoices.go:464
#: pkg/invoices.go:463
msgctxt "input"
msgid "Number"
msgstr "Número"
#: pkg/invoices.go:469
#: pkg/invoices.go:468
msgctxt "input"
msgid "Invoice Date"
msgstr "Fecha de factura"
#: pkg/invoices.go:475
#: pkg/invoices.go:474
msgctxt "input"
msgid "Notes"
msgstr "Notas"
#: pkg/invoices.go:480
msgctxt "input"
msgid "Tags"
msgstr "Etiquetes"
#: pkg/invoices.go:486
#: pkg/invoices.go:484
msgctxt "input"
msgid "Payment Method"
msgstr "Método de pago"
#: pkg/invoices.go:523
#: pkg/invoices.go:521
msgid "Selected invoice status is not valid."
msgstr "Habéis escogido un estado de factura que no es válido."
#: pkg/invoices.go:524
#: pkg/invoices.go:522
msgid "Selected customer is not valid."
msgstr "Habéis escogido un cliente que no es válido."
#: pkg/invoices.go:525
#: pkg/invoices.go:523
msgid "Invoice date can not be empty."
msgstr "No podéis dejar la fecha de la factura en blanco."
#: pkg/invoices.go:526
#: pkg/invoices.go:524
msgid "Invoice date must be a valid date."
msgstr "La fecha de factura debe ser válida."
#: pkg/invoices.go:528
#: pkg/invoices.go:526
msgid "Selected payment method is not valid."
msgstr "Habéis escogido un método de pago que no es válido."
#: pkg/invoices.go:637 pkg/invoices.go:642
#: pkg/invoices.go:626 pkg/invoices.go:631
msgctxt "input"
msgid "Id"
msgstr "Identificador"
#: pkg/invoices.go:665
#: pkg/invoices.go:654
msgctxt "input"
msgid "Quantity"
msgstr "Cantidad"
#: pkg/invoices.go:673
#: pkg/invoices.go:662
msgctxt "input"
msgid "Discount (%)"
msgstr "Descuento (%)"
#: pkg/invoices.go:720
#: pkg/invoices.go:709
msgid "Product ID can not be empty."
msgstr "No podéis dejar el identificador de producto en blanco."
#: pkg/invoices.go:725
#: pkg/invoices.go:714
msgid "Quantity can not be empty."
msgstr "No podéis dejar la cantidad en blanco."
#: pkg/invoices.go:726
#: pkg/invoices.go:715
msgid "Quantity must be a number greater than zero."
msgstr "La cantidad tiene que ser un número mayor a cero."
#: pkg/invoices.go:728
#: pkg/invoices.go:717
msgid "Discount can not be empty."
msgstr "No podéis dejar el descuento en blanco."
#: pkg/invoices.go:729
#: pkg/invoices.go:718
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:143
#: pkg/contacts.go:187
msgctxt "input"
msgid "Business name"
msgstr "Nombre y apellidos"
#: pkg/contacts.go:152
#: pkg/contacts.go:196
msgctxt "input"
msgid "VAT number"
msgstr "DNI / NIF"
#: pkg/contacts.go:158
#: pkg/contacts.go:202
msgctxt "input"
msgid "Trade name"
msgstr "Nombre comercial"
#: pkg/contacts.go:163
#: pkg/contacts.go:207
msgctxt "input"
msgid "Phone"
msgstr "Teléfono"
#: pkg/contacts.go:181
#: pkg/contacts.go:225
msgctxt "input"
msgid "Web"
msgstr "Web"
#: pkg/contacts.go:189
#: pkg/contacts.go:233
msgctxt "input"
msgid "Address"
msgstr "Dirección"
#: pkg/contacts.go:198
#: pkg/contacts.go:242
msgctxt "input"
msgid "City"
msgstr "Población"
#: pkg/contacts.go:204
#: pkg/contacts.go:248
msgctxt "input"
msgid "Province"
msgstr "Provincia"
#: pkg/contacts.go:210
#: pkg/contacts.go:254
msgctxt "input"
msgid "Postal code"
msgstr "Código postal"
#: pkg/contacts.go:219
#: pkg/contacts.go:263
msgctxt "input"
msgid "Country"
msgstr "País"
#: pkg/contacts.go:252
#: pkg/contacts.go:301
msgid "Selected country is not valid."
msgstr "Habéis escogido un país que no es válido."
#: pkg/contacts.go:256
#: pkg/contacts.go:305
msgid "Business name can not be empty."
msgstr "No podéis dejar el nombre y los apellidos en blanco."
#: pkg/contacts.go:257
#: pkg/contacts.go:306
msgid "VAT number can not be empty."
msgstr "No podéis dejar el DNI o NIF en blanco."
#: pkg/contacts.go:258
#: pkg/contacts.go:307
msgid "This value is not a valid VAT number."
msgstr "Este valor no es un DNI o NIF válido."
#: pkg/contacts.go:260
#: pkg/contacts.go:309
msgid "Phone can not be empty."
msgstr "No podéis dejar el teléfono en blanco."
#: pkg/contacts.go:261
#: pkg/contacts.go:310
msgid "This value is not a valid phone number."
msgstr "Este valor no es un teléfono válido."
#: pkg/contacts.go:267
#: pkg/contacts.go:316
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:269
#: pkg/contacts.go:318
msgid "Address can not be empty."
msgstr "No podéis dejar la dirección en blanco."
#: pkg/contacts.go:270
#: pkg/contacts.go:319
msgid "City can not be empty."
msgstr "No podéis dejar la población en blanco."
#: pkg/contacts.go:271
#: pkg/contacts.go:320
msgid "Province can not be empty."
msgstr "No podéis dejar la provincia en blanco."
#: pkg/contacts.go:272
#: pkg/contacts.go:321
msgid "Postal code can not be empty."
msgstr "No podéis dejar el código postal en blanco."
#: pkg/contacts.go:273
#: pkg/contacts.go:322
msgid "This value is not a valid postal code."
msgstr "Este valor no es un código postal válido válido."

View File

@ -29,18 +29,18 @@
<th>{{( pgettext "Tags" "title" )}}</th>
</tr>
</thead>
<tbody data-hx-push-url="false" data-hx-swap="beforeend">
<tbody>
{{ with .Contacts }}
{{- range $contact := . }}
<tr>
<td></td>
<td><a href="{{ companyURI "/contacts/"}}{{ .Slug }}" data-hx-boost="true">{{ .Name }}</a></td>
<td><a href="{{ companyURI "/contacts/"}}{{ .Slug }}" data-hx-push-url="false" data-hx-swap="beforeend" data-hx-boost="true">{{ .Name }}</a></td>
<td><a href="mailto:{{ .Email }}">{{ .Email }}</a></td>
<td><a href="tel:{{ .Phone }}">{{ .Phone }}</a></td>
<td>
{{- range $index, $tag := .Tags }}
{{- if gt $index 0 }}, {{ end -}}
<a href="?tag={{ . }}">{{ . }}</a>
<a href="?tag={{ . }}" data-hx-target="main" data-hx-boost="true">{{ . }}</a>
{{- end }}
</td>
</tr>

View File

@ -1,31 +1,36 @@
{{ define "title" -}}
{{printf (pgettext "Edit Product “%s”" "title") .Name }}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.editProductPage*/ -}}
{{printf (pgettext "Edit Product “%s”" "title") .ProductName }}
{{- end }}
{{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.productForm*/ -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.editProductPage*/ -}}
<nav>
<p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a href="{{ companyURI "/products"}}">{{( pgettext "Products" "title" )}}</a> /
<a>{{ .Name }}</a>
<a>{{ .ProductName }}</a>
</p>
</nav>
{{- end }}
{{ define "content" }}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.productForm*/ -}}
<section class="dialog-content">
<h2>{{printf (pgettext "Edit Product “%s”" "title") .Name }}</h2>
<form method="POST">
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.editProductPage*/ -}}
<section class="dialog-content" id="edit-product-dialog-content" data-hx-target="this">
<h2>{{printf (pgettext "Edit Product “%s”" "title") .ProductName }}</h2>
<form method="POST" action="{{ companyURI "/products/" }}{{ .Slug }}"
data-hx-boost="true" data-hx-select="#edit-product-dialog-content"
>
{{ csrfToken }}
{{ putMethod }}
{{ template "input-field" .Name | addInputAttr "autofocus" }}
{{ template "input-field" .Description }}
{{ template "input-field" .Price }}
{{ template "select-field" .Tax }}
{{ template "tags-field" .Tags }}
{{ with .Form }}
{{ template "input-field" .Name | addInputAttr "autofocus" }}
{{ template "input-field" .Description }}
{{ template "input-field" .Price }}
{{ template "select-field" .Tax }}
{{ template "tags-field" .Tags }}
{{ end }}
<fieldset>
<button class="primary" type="submit">{{( pgettext "Update product" "action" )}}</button>

View File

@ -11,6 +11,7 @@
</p>
<p>
<a class="primary button"
data-hx-push-url="false" data-hx-swap="beforeend" data-hx-boost="true"
href="{{ companyURI "/products/new" }}">{{( pgettext "New product" "action" )}}</a>
</p>
</nav>
@ -32,11 +33,11 @@
{{- range $product := . }}
<tr>
<td></td>
<td><a href="{{ companyURI "/products/"}}{{ .Slug }}">{{ .Name }}</a></td>
<td><a href="{{ companyURI "/products/"}}{{ .Slug }}" data-hx-push-url="false" data-hx-swap="beforeend" data-hx-boost="true">{{ .Name }}</a></td>
<td>
{{- range $index, $tag := .Tags }}
{{- if gt $index 0 }}, {{ end -}}
<a href="?tag={{ . }}">{{ . }}</a>
<a href="?tag={{ . }}" data-hx-target="main" data-hx-boost="true">{{ . }}</a>
{{- end }}
</td>
<td class="numeric">{{ .Price | formatPrice }}</td>

View File

@ -15,9 +15,11 @@
{{ define "content" }}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.productForm*/ -}}
<section class="dialog-content">
<section class="dialog-content" id="new-product-dialog-content" data-hx-target="this">
<h2>{{(pgettext "New Product" "title")}}</h2>
<form method="POST" action="{{ companyURI "/products" }}">
<form method="POST" action="{{ companyURI "/products" }}"
data-hx-boost="true" data-hx-select="#new-product-dialog-content"
>
{{ csrfToken }}
{{ template "input-field" .Name | addInputAttr "autofocus" }}