Compare commits

..

No commits in common. "47c23fc4cc2fede472e0ec97082d21c78eb72983" and "5d82597d14977e71013833d62f02985811939416" have entirely different histories.

7 changed files with 205 additions and 241 deletions

View File

@ -47,26 +47,15 @@ func GetProductForm(w http.ResponseWriter, r *http.Request, params httprouter.Pa
return
}
w.WriteHeader(http.StatusOK)
mustRenderEditProductForm(w, r, slug, form)
mustRenderEditProductForm(w, r, form)
}
func mustRenderNewProductForm(w http.ResponseWriter, r *http.Request, form *productForm) {
mustRenderModalTemplate(w, r, "products/new.gohtml", form)
mustRenderAppTemplate(w, r, "products/new.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 mustRenderEditProductForm(w http.ResponseWriter, r *http.Request, form *productForm) {
mustRenderAppTemplate(w, r, "products/edit.gohtml", form)
}
func HandleAddProduct(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
@ -83,21 +72,12 @@ 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)
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)
}
http.Redirect(w, r, companyURI(company, "/products"), http.StatusSeeOther)
}
func sliceAtoi(s []string) ([]int, error) {
@ -133,23 +113,17 @@ 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, slug, form)
mustRenderEditProductForm(w, r, 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)
}
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)
}
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-27 09:43+0200\n"
"POT-Creation-Date: 2023-03-21 11:56+0100\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:10
#: web/template/contacts/index.gohtml:9 web/template/contacts/edit.gohtml:9
#: 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:10
#: web/template/products/edit.gohtml:9
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:25
#: web/template/products/index.gohtml:24
msgctxt "product"
msgid "All"
msgstr "Tots"
#: web/template/invoices/products.gohtml:52
#: web/template/products/index.gohtml:26
#: web/template/products/index.gohtml:25
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/view.gohtml:59 web/template/products/index.gohtml:26
msgctxt "title"
msgid "Price"
msgstr "Preu"
#: web/template/invoices/products.gohtml:67
#: web/template/products/index.gohtml:48
#: web/template/products/index.gohtml:40
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:26
#: web/template/invoices/index.gohtml:34 web/template/contacts/index.gohtml:25
msgctxt "title"
msgid "Customer"
msgstr "Client"
@ -128,8 +128,7 @@ msgctxt "title"
msgid "Status"
msgstr "Estat"
#: web/template/invoices/index.gohtml:36 web/template/contacts/index.gohtml:29
#: web/template/products/index.gohtml:27
#: web/template/invoices/index.gohtml:36
msgctxt "title"
msgid "Tags"
msgstr "Etiquetes"
@ -213,37 +212,37 @@ msgctxt "title"
msgid "Dashboard"
msgstr "Tauler"
#: web/template/app.gohtml:23
#: web/template/app.gohtml:22
msgctxt "menu"
msgid "Account"
msgstr "Compte"
#: web/template/app.gohtml:29
#: web/template/app.gohtml:28
msgctxt "menu"
msgid "Tax Details"
msgstr "Configuració fiscal"
#: web/template/app.gohtml:37
#: web/template/app.gohtml:36
msgctxt "action"
msgid "Logout"
msgstr "Surt"
#: web/template/app.gohtml:46
#: web/template/app.gohtml:45
msgctxt "nav"
msgid "Dashboard"
msgstr "Tauler"
#: web/template/app.gohtml:47
#: web/template/app.gohtml:46
msgctxt "nav"
msgid "Invoices"
msgstr "Factures"
#: web/template/app.gohtml:48
#: web/template/app.gohtml:47
msgctxt "nav"
msgid "Products"
msgstr "Productes"
#: web/template/app.gohtml:49
#: web/template/app.gohtml:48
msgctxt "nav"
msgid "Contacts"
msgstr "Contactes"
@ -255,41 +254,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:11
#: web/template/contacts/index.gohtml:10 web/template/contacts/edit.gohtml:10
msgctxt "title"
msgid "Contacts"
msgstr "Contactes"
#: web/template/contacts/new.gohtml:36 web/template/contacts/index.gohtml:15
#: web/template/contacts/new.gohtml:35 web/template/contacts/index.gohtml:14
msgctxt "action"
msgid "New contact"
msgstr "Nou contacte"
#: web/template/contacts/index.gohtml:25
#: web/template/contacts/index.gohtml:24
msgctxt "contact"
msgid "All"
msgstr "Tots"
#: web/template/contacts/index.gohtml:27
#: web/template/contacts/index.gohtml:26
msgctxt "title"
msgid "Email"
msgstr "Correu-e"
#: web/template/contacts/index.gohtml:28
#: web/template/contacts/index.gohtml:27
msgctxt "title"
msgid "Phone"
msgstr "Telèfon"
#: web/template/contacts/index.gohtml:50
#: web/template/contacts/index.gohtml:42
msgid "No contacts added yet."
msgstr "No hi ha cap contacte."
#: web/template/contacts/edit.gohtml:3 web/template/contacts/edit.gohtml:20
#: web/template/contacts/edit.gohtml:2 web/template/contacts/edit.gohtml:19
msgctxt "title"
msgid "Edit Contact “%s”"
msgstr "Edició del contacte «%s»"
#: web/template/contacts/edit.gohtml:41
#: web/template/contacts/edit.gohtml:37
msgctxt "action"
msgid "Update contact"
msgstr "Actualitza contacte"
@ -405,27 +404,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:11
#: web/template/products/index.gohtml:10 web/template/products/edit.gohtml:10
msgctxt "title"
msgid "Products"
msgstr "Productes"
#: web/template/products/new.gohtml:32 web/template/products/index.gohtml:15
#: web/template/products/new.gohtml:29 web/template/products/index.gohtml:14
msgctxt "action"
msgid "New product"
msgstr "Nou producte"
#: web/template/products/edit.gohtml:3 web/template/products/edit.gohtml:20
#: web/template/products/edit.gohtml:2 web/template/products/edit.gohtml:19
msgctxt "title"
msgid "Edit Product “%s”"
msgstr "Edició del producte «%s»"
#: web/template/products/edit.gohtml:36
#: web/template/products/edit.gohtml:30
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:172
msgctxt "input"
msgid "Email"
msgstr "Correu-e"
@ -435,11 +434,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:263
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:264
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."
@ -451,48 +450,43 @@ msgstr "No podeu deixar la contrasenya en blanc."
msgid "Invalid user or password."
msgstr "Nom dusuari o contrasenya incorrectes."
#: pkg/products.go:209 pkg/invoices.go:636
#: pkg/products.go:165 pkg/invoices.go:647
msgctxt "input"
msgid "Name"
msgstr "Nom"
#: pkg/products.go:215 pkg/invoices.go:641
#: pkg/products.go:171 pkg/invoices.go:652
msgctxt "input"
msgid "Description"
msgstr "Descripció"
#: pkg/products.go:220 pkg/invoices.go:645
#: pkg/products.go:176 pkg/invoices.go:656
msgctxt "input"
msgid "Price"
msgstr "Preu"
#: pkg/products.go:230 pkg/invoices.go:671
#: pkg/products.go:186 pkg/invoices.go:682
msgctxt "input"
msgid "Taxes"
msgstr "Imposts"
#: 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
#: pkg/products.go:206 pkg/profile.go:92 pkg/invoices.go:721
msgid "Name can not be empty."
msgstr "No podeu deixar el nom en blanc."
#: pkg/products.go:256 pkg/invoices.go:711
#: pkg/products.go:207 pkg/invoices.go:722
msgid "Price can not be empty."
msgstr "No podeu deixar el preu en blanc."
#: pkg/products.go:257 pkg/invoices.go:712
#: pkg/products.go:208 pkg/invoices.go:723
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:720
#: pkg/products.go:210 pkg/invoices.go:731
msgid "Selected tax is not valid."
msgstr "Heu seleccionat un impost que no és vàlid."
#: pkg/products.go:260 pkg/invoices.go:721
#: pkg/products.go:211 pkg/invoices.go:732
msgid "You can only select a tax of each class."
msgstr "Només podeu seleccionar un impost de cada classe."
@ -600,198 +594,203 @@ 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:302
#: pkg/invoices.go:303
msgid "Select a customer to bill."
msgstr "Escolliu un client a facturar."
#: pkg/invoices.go:401
#: pkg/invoices.go:402
msgid "invoices.zip"
msgstr "factures.zip"
#: pkg/invoices.go:407 pkg/invoices.go:829
#: pkg/invoices.go:408 pkg/invoices.go:840
msgid "Invalid action"
msgstr "Acció invàlida."
#: pkg/invoices.go:451
#: pkg/invoices.go:452
msgctxt "input"
msgid "Invoice Status"
msgstr "Estat de la factura"
#: pkg/invoices.go:457
#: pkg/invoices.go:458
msgctxt "input"
msgid "Customer"
msgstr "Client"
#: pkg/invoices.go:463
#: pkg/invoices.go:464
msgctxt "input"
msgid "Number"
msgstr "Número"
#: pkg/invoices.go:468
#: pkg/invoices.go:469
msgctxt "input"
msgid "Invoice Date"
msgstr "Data de factura"
#: pkg/invoices.go:474
#: pkg/invoices.go:475
msgctxt "input"
msgid "Notes"
msgstr "Notes"
#: pkg/invoices.go:484
#: pkg/invoices.go:480
msgctxt "input"
msgid "Tags"
msgstr "Etiquetes"
#: pkg/invoices.go:486
msgctxt "input"
msgid "Payment Method"
msgstr "Mètode de pagament"
#: pkg/invoices.go:521
#: pkg/invoices.go:523
msgid "Selected invoice status is not valid."
msgstr "Heu seleccionat un estat de factura que no és vàlid."
#: pkg/invoices.go:522
#: pkg/invoices.go:524
msgid "Selected customer is not valid."
msgstr "Heu seleccionat un client que no és vàlid."
#: pkg/invoices.go:523
#: pkg/invoices.go:525
msgid "Invoice date can not be empty."
msgstr "No podeu deixar la data de la factura en blanc."
#: pkg/invoices.go:524
#: pkg/invoices.go:526
msgid "Invoice date must be a valid date."
msgstr "La data de facturació ha de ser vàlida."
#: pkg/invoices.go:526
#: pkg/invoices.go:528
msgid "Selected payment method is not valid."
msgstr "Heu seleccionat un mètode de pagament que no és vàlid."
#: pkg/invoices.go:626 pkg/invoices.go:631
#: pkg/invoices.go:637 pkg/invoices.go:642
msgctxt "input"
msgid "Id"
msgstr "Identificador"
#: pkg/invoices.go:654
#: pkg/invoices.go:665
msgctxt "input"
msgid "Quantity"
msgstr "Quantitat"
#: pkg/invoices.go:662
#: pkg/invoices.go:673
msgctxt "input"
msgid "Discount (%)"
msgstr "Descompte (%)"
#: pkg/invoices.go:709
#: pkg/invoices.go:720
msgid "Product ID can not be empty."
msgstr "No podeu deixar lidentificador del producte en blanc."
#: pkg/invoices.go:714
#: pkg/invoices.go:725
msgid "Quantity can not be empty."
msgstr "No podeu deixar la quantitat en blanc."
#: pkg/invoices.go:715
#: pkg/invoices.go:726
msgid "Quantity must be a number greater than zero."
msgstr "La quantitat ha de ser un número major a zero."
#: pkg/invoices.go:717
#: pkg/invoices.go:728
msgid "Discount can not be empty."
msgstr "No podeu deixar el descompte en blanc."
#: pkg/invoices.go:718
#: pkg/invoices.go:729
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:143
msgctxt "input"
msgid "Business name"
msgstr "Nom i cognoms"
#: pkg/contacts.go:196
#: pkg/contacts.go:152
msgctxt "input"
msgid "VAT number"
msgstr "DNI / NIF"
#: pkg/contacts.go:202
#: pkg/contacts.go:158
msgctxt "input"
msgid "Trade name"
msgstr "Nom comercial"
#: pkg/contacts.go:207
#: pkg/contacts.go:163
msgctxt "input"
msgid "Phone"
msgstr "Telèfon"
#: pkg/contacts.go:225
#: pkg/contacts.go:181
msgctxt "input"
msgid "Web"
msgstr "Web"
#: pkg/contacts.go:233
#: pkg/contacts.go:189
msgctxt "input"
msgid "Address"
msgstr "Adreça"
#: pkg/contacts.go:242
#: pkg/contacts.go:198
msgctxt "input"
msgid "City"
msgstr "Població"
#: pkg/contacts.go:248
#: pkg/contacts.go:204
msgctxt "input"
msgid "Province"
msgstr "Província"
#: pkg/contacts.go:254
#: pkg/contacts.go:210
msgctxt "input"
msgid "Postal code"
msgstr "Codi postal"
#: pkg/contacts.go:263
#: pkg/contacts.go:219
msgctxt "input"
msgid "Country"
msgstr "País"
#: pkg/contacts.go:301
#: pkg/contacts.go:252
msgid "Selected country is not valid."
msgstr "Heu seleccionat un país que no és vàlid."
#: pkg/contacts.go:305
#: pkg/contacts.go:256
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:257
msgid "VAT number can not be empty."
msgstr "No podeu deixar el DNI o NIF en blanc."
#: pkg/contacts.go:307
#: pkg/contacts.go:258
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:260
msgid "Phone can not be empty."
msgstr "No podeu deixar el telèfon en blanc."
#: pkg/contacts.go:310
#: pkg/contacts.go:261
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:267
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:269
msgid "Address can not be empty."
msgstr "No podeu deixar ladreça en blanc."
#: pkg/contacts.go:319
#: pkg/contacts.go:270
msgid "City can not be empty."
msgstr "No podeu deixar la població en blanc."
#: pkg/contacts.go:320
#: pkg/contacts.go:271
msgid "Province can not be empty."
msgstr "No podeu deixar la província en blanc."
#: pkg/contacts.go:321
#: pkg/contacts.go:272
msgid "Postal code can not be empty."
msgstr "No podeu deixar el codi postal en blanc."
#: pkg/contacts.go:322
#: pkg/contacts.go:273
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-27 09:43+0200\n"
"POT-Creation-Date: 2023-03-21 11:56+0100\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:10
#: web/template/contacts/index.gohtml:9 web/template/contacts/edit.gohtml:9
#: 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:10
#: web/template/products/edit.gohtml:9
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:25
#: web/template/products/index.gohtml:24
msgctxt "product"
msgid "All"
msgstr "Todos"
#: web/template/invoices/products.gohtml:52
#: web/template/products/index.gohtml:26
#: web/template/products/index.gohtml:25
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/view.gohtml:59 web/template/products/index.gohtml:26
msgctxt "title"
msgid "Price"
msgstr "Precio"
#: web/template/invoices/products.gohtml:67
#: web/template/products/index.gohtml:48
#: web/template/products/index.gohtml:40
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:26
#: web/template/invoices/index.gohtml:34 web/template/contacts/index.gohtml:25
msgctxt "title"
msgid "Customer"
msgstr "Cliente"
@ -128,8 +128,7 @@ msgctxt "title"
msgid "Status"
msgstr "Estado"
#: web/template/invoices/index.gohtml:36 web/template/contacts/index.gohtml:29
#: web/template/products/index.gohtml:27
#: web/template/invoices/index.gohtml:36
msgctxt "title"
msgid "Tags"
msgstr "Etiquetes"
@ -213,37 +212,37 @@ msgctxt "title"
msgid "Dashboard"
msgstr "Panel"
#: web/template/app.gohtml:23
#: web/template/app.gohtml:22
msgctxt "menu"
msgid "Account"
msgstr "Cuenta"
#: web/template/app.gohtml:29
#: web/template/app.gohtml:28
msgctxt "menu"
msgid "Tax Details"
msgstr "Configuración fiscal"
#: web/template/app.gohtml:37
#: web/template/app.gohtml:36
msgctxt "action"
msgid "Logout"
msgstr "Salir"
#: web/template/app.gohtml:46
#: web/template/app.gohtml:45
msgctxt "nav"
msgid "Dashboard"
msgstr "Panel"
#: web/template/app.gohtml:47
#: web/template/app.gohtml:46
msgctxt "nav"
msgid "Invoices"
msgstr "Facturas"
#: web/template/app.gohtml:48
#: web/template/app.gohtml:47
msgctxt "nav"
msgid "Products"
msgstr "Productos"
#: web/template/app.gohtml:49
#: web/template/app.gohtml:48
msgctxt "nav"
msgid "Contacts"
msgstr "Contactos"
@ -255,41 +254,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:11
#: web/template/contacts/index.gohtml:10 web/template/contacts/edit.gohtml:10
msgctxt "title"
msgid "Contacts"
msgstr "Contactos"
#: web/template/contacts/new.gohtml:36 web/template/contacts/index.gohtml:15
#: web/template/contacts/new.gohtml:35 web/template/contacts/index.gohtml:14
msgctxt "action"
msgid "New contact"
msgstr "Nuevo contacto"
#: web/template/contacts/index.gohtml:25
#: web/template/contacts/index.gohtml:24
msgctxt "contact"
msgid "All"
msgstr "Todos"
#: web/template/contacts/index.gohtml:27
#: web/template/contacts/index.gohtml:26
msgctxt "title"
msgid "Email"
msgstr "Correo-e"
#: web/template/contacts/index.gohtml:28
#: web/template/contacts/index.gohtml:27
msgctxt "title"
msgid "Phone"
msgstr "Teléfono"
#: web/template/contacts/index.gohtml:50
#: web/template/contacts/index.gohtml:42
msgid "No contacts added yet."
msgstr "No hay contactos."
#: web/template/contacts/edit.gohtml:3 web/template/contacts/edit.gohtml:20
#: web/template/contacts/edit.gohtml:2 web/template/contacts/edit.gohtml:19
msgctxt "title"
msgid "Edit Contact “%s”"
msgstr "Edición del contacto «%s»"
#: web/template/contacts/edit.gohtml:41
#: web/template/contacts/edit.gohtml:37
msgctxt "action"
msgid "Update contact"
msgstr "Actualizar contacto"
@ -405,27 +404,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:11
#: web/template/products/index.gohtml:10 web/template/products/edit.gohtml:10
msgctxt "title"
msgid "Products"
msgstr "Productos"
#: web/template/products/new.gohtml:32 web/template/products/index.gohtml:15
#: web/template/products/new.gohtml:29 web/template/products/index.gohtml:14
msgctxt "action"
msgid "New product"
msgstr "Nuevo producto"
#: web/template/products/edit.gohtml:3 web/template/products/edit.gohtml:20
#: web/template/products/edit.gohtml:2 web/template/products/edit.gohtml:19
msgctxt "title"
msgid "Edit Product “%s”"
msgstr "Edición del producto «%s»"
#: web/template/products/edit.gohtml:36
#: web/template/products/edit.gohtml:30
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:172
msgctxt "input"
msgid "Email"
msgstr "Correo-e"
@ -435,11 +434,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:263
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:264
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."
@ -451,48 +450,43 @@ 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:636
#: pkg/products.go:165 pkg/invoices.go:647
msgctxt "input"
msgid "Name"
msgstr "Nombre"
#: pkg/products.go:215 pkg/invoices.go:641
#: pkg/products.go:171 pkg/invoices.go:652
msgctxt "input"
msgid "Description"
msgstr "Descripción"
#: pkg/products.go:220 pkg/invoices.go:645
#: pkg/products.go:176 pkg/invoices.go:656
msgctxt "input"
msgid "Price"
msgstr "Precio"
#: pkg/products.go:230 pkg/invoices.go:671
#: pkg/products.go:186 pkg/invoices.go:682
msgctxt "input"
msgid "Taxes"
msgstr "Impuestos"
#: 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
#: pkg/products.go:206 pkg/profile.go:92 pkg/invoices.go:721
msgid "Name can not be empty."
msgstr "No podéis dejar el nombre en blanco."
#: pkg/products.go:256 pkg/invoices.go:711
#: pkg/products.go:207 pkg/invoices.go:722
msgid "Price can not be empty."
msgstr "No podéis dejar el precio en blanco."
#: pkg/products.go:257 pkg/invoices.go:712
#: pkg/products.go:208 pkg/invoices.go:723
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:720
#: pkg/products.go:210 pkg/invoices.go:731
msgid "Selected tax is not valid."
msgstr "Habéis escogido un impuesto que no es válido."
#: pkg/products.go:260 pkg/invoices.go:721
#: pkg/products.go:211 pkg/invoices.go:732
msgid "You can only select a tax of each class."
msgstr "Solo podéis escoger un impuesto de cada clase."
@ -600,198 +594,203 @@ 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:302
#: pkg/invoices.go:303
msgid "Select a customer to bill."
msgstr "Escoged un cliente a facturar."
#: pkg/invoices.go:401
#: pkg/invoices.go:402
msgid "invoices.zip"
msgstr "facturas.zip"
#: pkg/invoices.go:407 pkg/invoices.go:829
#: pkg/invoices.go:408 pkg/invoices.go:840
msgid "Invalid action"
msgstr "Acción inválida."
#: pkg/invoices.go:451
#: pkg/invoices.go:452
msgctxt "input"
msgid "Invoice Status"
msgstr "Estado de la factura"
#: pkg/invoices.go:457
#: pkg/invoices.go:458
msgctxt "input"
msgid "Customer"
msgstr "Cliente"
#: pkg/invoices.go:463
#: pkg/invoices.go:464
msgctxt "input"
msgid "Number"
msgstr "Número"
#: pkg/invoices.go:468
#: pkg/invoices.go:469
msgctxt "input"
msgid "Invoice Date"
msgstr "Fecha de factura"
#: pkg/invoices.go:474
#: pkg/invoices.go:475
msgctxt "input"
msgid "Notes"
msgstr "Notas"
#: pkg/invoices.go:484
#: pkg/invoices.go:480
msgctxt "input"
msgid "Tags"
msgstr "Etiquetes"
#: pkg/invoices.go:486
msgctxt "input"
msgid "Payment Method"
msgstr "Método de pago"
#: pkg/invoices.go:521
#: pkg/invoices.go:523
msgid "Selected invoice status is not valid."
msgstr "Habéis escogido un estado de factura que no es válido."
#: pkg/invoices.go:522
#: pkg/invoices.go:524
msgid "Selected customer is not valid."
msgstr "Habéis escogido un cliente que no es válido."
#: pkg/invoices.go:523
#: pkg/invoices.go:525
msgid "Invoice date can not be empty."
msgstr "No podéis dejar la fecha de la factura en blanco."
#: pkg/invoices.go:524
#: pkg/invoices.go:526
msgid "Invoice date must be a valid date."
msgstr "La fecha de factura debe ser válida."
#: pkg/invoices.go:526
#: pkg/invoices.go:528
msgid "Selected payment method is not valid."
msgstr "Habéis escogido un método de pago que no es válido."
#: pkg/invoices.go:626 pkg/invoices.go:631
#: pkg/invoices.go:637 pkg/invoices.go:642
msgctxt "input"
msgid "Id"
msgstr "Identificador"
#: pkg/invoices.go:654
#: pkg/invoices.go:665
msgctxt "input"
msgid "Quantity"
msgstr "Cantidad"
#: pkg/invoices.go:662
#: pkg/invoices.go:673
msgctxt "input"
msgid "Discount (%)"
msgstr "Descuento (%)"
#: pkg/invoices.go:709
#: pkg/invoices.go:720
msgid "Product ID can not be empty."
msgstr "No podéis dejar el identificador de producto en blanco."
#: pkg/invoices.go:714
#: pkg/invoices.go:725
msgid "Quantity can not be empty."
msgstr "No podéis dejar la cantidad en blanco."
#: pkg/invoices.go:715
#: pkg/invoices.go:726
msgid "Quantity must be a number greater than zero."
msgstr "La cantidad tiene que ser un número mayor a cero."
#: pkg/invoices.go:717
#: pkg/invoices.go:728
msgid "Discount can not be empty."
msgstr "No podéis dejar el descuento en blanco."
#: pkg/invoices.go:718
#: pkg/invoices.go:729
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:143
msgctxt "input"
msgid "Business name"
msgstr "Nombre y apellidos"
#: pkg/contacts.go:196
#: pkg/contacts.go:152
msgctxt "input"
msgid "VAT number"
msgstr "DNI / NIF"
#: pkg/contacts.go:202
#: pkg/contacts.go:158
msgctxt "input"
msgid "Trade name"
msgstr "Nombre comercial"
#: pkg/contacts.go:207
#: pkg/contacts.go:163
msgctxt "input"
msgid "Phone"
msgstr "Teléfono"
#: pkg/contacts.go:225
#: pkg/contacts.go:181
msgctxt "input"
msgid "Web"
msgstr "Web"
#: pkg/contacts.go:233
#: pkg/contacts.go:189
msgctxt "input"
msgid "Address"
msgstr "Dirección"
#: pkg/contacts.go:242
#: pkg/contacts.go:198
msgctxt "input"
msgid "City"
msgstr "Población"
#: pkg/contacts.go:248
#: pkg/contacts.go:204
msgctxt "input"
msgid "Province"
msgstr "Provincia"
#: pkg/contacts.go:254
#: pkg/contacts.go:210
msgctxt "input"
msgid "Postal code"
msgstr "Código postal"
#: pkg/contacts.go:263
#: pkg/contacts.go:219
msgctxt "input"
msgid "Country"
msgstr "País"
#: pkg/contacts.go:301
#: pkg/contacts.go:252
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:256
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:257
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:258
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:260
msgid "Phone can not be empty."
msgstr "No podéis dejar el teléfono en blanco."
#: pkg/contacts.go:310
#: pkg/contacts.go:261
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:267
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:269
msgid "Address can not be empty."
msgstr "No podéis dejar la dirección en blanco."
#: pkg/contacts.go:319
#: pkg/contacts.go:270
msgid "City can not be empty."
msgstr "No podéis dejar la población en blanco."
#: pkg/contacts.go:320
#: pkg/contacts.go:271
msgid "Province can not be empty."
msgstr "No podéis dejar la provincia en blanco."
#: pkg/contacts.go:321
#: pkg/contacts.go:272
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:273
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>
<tbody data-hx-push-url="false" data-hx-swap="beforeend">
{{ with .Contacts }}
{{- range $contact := . }}
<tr>
<td></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="{{ companyURI "/contacts/"}}{{ .Slug }}" 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={{ . }}" data-hx-target="main" data-hx-boost="true">{{ . }}</a>
<a href="?tag={{ . }}">{{ . }}</a>
{{- end }}
</td>
</tr>

View File

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

View File

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

View File

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