Compare commits

..

No commits in common. "f3b841473f18089f2828267dee15b446f8fd02ec" and "fab9e2c278f3543a48a08494fa982ba0e1eea6fc" have entirely different histories.

8 changed files with 127 additions and 202 deletions

View File

@ -140,10 +140,6 @@ func (field *SelectField) isValidOption(selected string) bool {
return field.FindOption(selected) != nil return field.FindOption(selected) != nil
} }
func (field *SelectField) Clear() {
field.Selected = []string{}
}
func MustGetOptions(ctx context.Context, conn *Conn, sql string, args ...interface{}) []*SelectOption { func MustGetOptions(ctx context.Context, conn *Conn, sql string, args ...interface{}) []*SelectOption {
rows, err := conn.Query(ctx, sql, args...) rows, err := conn.Query(ctx, sql, args...)
if err != nil { if err != nil {

View File

@ -88,10 +88,6 @@ func ServeInvoice(w http.ResponseWriter, r *http.Request, params httprouter.Para
form := newInvoiceForm(r.Context(), conn, locale, company) form := newInvoiceForm(r.Context(), conn, locale, company)
slug := params[0].Value slug := params[0].Value
if slug == "new" { if slug == "new" {
if invoiceToDuplicate := r.URL.Query().Get("duplicate"); invoiceToDuplicate != "" {
form.MustFillFromDatabase(r.Context(), conn, invoiceToDuplicate)
form.Number.Val = ""
}
form.Date.Val = time.Now().Format("2006-01-02") form.Date.Val = time.Now().Format("2006-01-02")
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
mustRenderNewInvoiceForm(w, r, form) mustRenderNewInvoiceForm(w, r, form)
@ -408,7 +404,6 @@ func (form *invoiceForm) Parse(r *http.Request) error {
form.Number.FillValue(r) form.Number.FillValue(r)
form.Date.FillValue(r) form.Date.FillValue(r)
form.Notes.FillValue(r) form.Notes.FillValue(r)
form.PaymentMethod.FillValue(r)
if _, ok := r.Form["product.id.0"]; ok { if _, ok := r.Form["product.id.0"]; ok {
taxOptions := mustGetTaxOptions(r.Context(), getConn(r), form.company) taxOptions := mustGetTaxOptions(r.Context(), getConn(r), form.company)
for index := 0; true; index++ { for index := 0; true; index++ {
@ -455,13 +450,9 @@ func (form *invoiceForm) Update() {
} }
func (form *invoiceForm) AddProducts(ctx context.Context, conn *Conn, productsId []string) { func (form *invoiceForm) AddProducts(ctx context.Context, conn *Conn, productsId []string) {
form.mustAddProductsFromQuery(ctx, conn, "select product_id, name, description, to_price(price, decimal_digits), 1 as quantity, 0 as discount, array_remove(array_agg(tax_id), null) from product join company using (company_id) join currency using (currency_code) left join product_tax using (product_id) where product_id = any ($1) group by product_id, name, description, price, decimal_digits", productsId)
}
func (form *invoiceForm) mustAddProductsFromQuery(ctx context.Context, conn *Conn, sql string, args ...interface{}) {
index := len(form.Products) index := len(form.Products)
taxOptions := mustGetTaxOptions(ctx, conn, form.company) taxOptions := mustGetTaxOptions(ctx, conn, form.company)
rows := conn.MustQuery(ctx, sql, args...) rows := conn.MustQuery(ctx, "select product_id, name, description, to_price(price, decimal_digits), 1 as quantity, 0 as discount, array_remove(array_agg(tax_id), null) from product join company using (company_id) join currency using (currency_code) left join product_tax using (product_id) where product_id = any ($1) group by product_id, name, description, price, decimal_digits", productsId)
defer rows.Close() defer rows.Close()
for rows.Next() { for rows.Next() {
product := newInvoiceProductForm(index, form.company, form.locale, taxOptions) product := newInvoiceProductForm(index, form.company, form.locale, taxOptions)
@ -476,18 +467,6 @@ func (form *invoiceForm) mustAddProductsFromQuery(ctx context.Context, conn *Con
} }
} }
func (form *invoiceForm) MustFillFromDatabase(ctx context.Context, conn *Conn, slug string) {
var invoiceId int
selectedPaymentMethod := form.PaymentMethod.Selected
form.PaymentMethod.Clear()
if notFoundErrorOrPanic(conn.QueryRow(ctx, "select invoice_id, contact_id, invoice_number, invoice_date, notes, payment_method_id from invoice where slug = $1", slug).Scan(&invoiceId, form.Customer, form.Number, form.Date, form.Notes, form.PaymentMethod)) {
form.PaymentMethod.Selected = selectedPaymentMethod
return
}
form.Products = []*invoiceProductForm{}
form.mustAddProductsFromQuery(ctx, conn, "select product_id, name, description, to_price(price, $2), quantity, (discount_rate * 100)::integer, array_remove(array_agg(tax_id), null) from invoice_product left join invoice_product_tax using (invoice_product_id) where invoice_id = $1 group by product_id, name, description, discount_rate, price, quantity", invoiceId, form.company.DecimalDigits)
}
func mustGetTaxOptions(ctx context.Context, conn *Conn, company *Company) []*SelectOption { func mustGetTaxOptions(ctx context.Context, conn *Conn, company *Company) []*SelectOption {
return MustGetGroupedOptions(ctx, conn, "select tax_id::text, tax.name, tax_class.name from tax join tax_class using (tax_class_id) where tax.company_id = $1 order by tax_class.name, tax.name", company.Id) return MustGetGroupedOptions(ctx, conn, "select tax_id::text, tax.name, tax_class.name from tax join tax_class using (tax_class_id) where tax.company_id = $1 order by tax_class.name, tax.name", company.Id)
} }

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: numerus\n" "Project-Id-Version: numerus\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2023-03-08 11:51+0100\n" "POT-Creation-Date: 2023-03-04 22:11+0100\n"
"PO-Revision-Date: 2023-01-18 17:08+0100\n" "PO-Revision-Date: 2023-01-18 17:08+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n" "Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Catalan <ca@dodds.net>\n" "Language-Team: Catalan <ca@dodds.net>\n"
@ -59,7 +59,7 @@ msgid "Name"
msgstr "Nom" msgstr "Nom"
#: web/template/invoices/products.gohtml:43 #: web/template/invoices/products.gohtml:43
#: web/template/invoices/view.gohtml:54 web/template/products/index.gohtml:23 #: web/template/invoices/view.gohtml:53 web/template/products/index.gohtml:23
msgctxt "title" msgctxt "title"
msgid "Price" msgid "Price"
msgstr "Preu" msgstr "Preu"
@ -74,13 +74,13 @@ msgctxt "action"
msgid "Add products" msgid "Add products"
msgstr "Afegeix productes" msgstr "Afegeix productes"
#: web/template/invoices/new.gohtml:42 web/template/invoices/view.gohtml:59 #: web/template/invoices/new.gohtml:42 web/template/invoices/view.gohtml:58
msgctxt "title" msgctxt "title"
msgid "Subtotal" msgid "Subtotal"
msgstr "Subtotal" msgstr "Subtotal"
#: web/template/invoices/new.gohtml:52 web/template/invoices/view.gohtml:63 #: web/template/invoices/new.gohtml:52 web/template/invoices/view.gohtml:62
#: web/template/invoices/view.gohtml:103 #: web/template/invoices/view.gohtml:102
msgctxt "title" msgctxt "title"
msgid "Total" msgid "Total"
msgstr "Total" msgstr "Total"
@ -100,7 +100,7 @@ msgctxt "invoice"
msgid "All" msgid "All"
msgstr "Totes" msgstr "Totes"
#: web/template/invoices/index.gohtml:22 web/template/invoices/view.gohtml:26 #: web/template/invoices/index.gohtml:22 web/template/invoices/view.gohtml:25
msgctxt "title" msgctxt "title"
msgid "Date" msgid "Date"
msgstr "Data" msgstr "Data"
@ -135,46 +135,36 @@ msgctxt "title"
msgid "Download" msgid "Download"
msgstr "Descàrrega" msgstr "Descàrrega"
#: web/template/invoices/index.gohtml:29 #: web/template/invoices/index.gohtml:50
msgctxt "title"
msgid "Actions"
msgstr "Accions"
#: web/template/invoices/index.gohtml:75 web/template/invoices/view.gohtml:14
msgctxt "action"
msgid "Duplicate"
msgstr "Duplica"
#: web/template/invoices/index.gohtml:85
msgid "No invoices added yet." msgid "No invoices added yet."
msgstr "No hi ha cap factura." msgstr "No hi ha cap factura."
#: web/template/invoices/view.gohtml:2 web/template/invoices/view.gohtml:25 #: web/template/invoices/view.gohtml:2 web/template/invoices/view.gohtml:24
msgctxt "title" msgctxt "title"
msgid "Invoice %s" msgid "Invoice %s"
msgstr "Factura %s" msgstr "Factura %s"
#: web/template/invoices/view.gohtml:17 #: web/template/invoices/view.gohtml:16
msgctxt "action" msgctxt "action"
msgid "Download invoice" msgid "Download invoice"
msgstr "Descarrega factura" msgstr "Descarrega factura"
#: web/template/invoices/view.gohtml:53 #: web/template/invoices/view.gohtml:52
msgctxt "title" msgctxt "title"
msgid "Concept" msgid "Concept"
msgstr "Concepte" msgstr "Concepte"
#: web/template/invoices/view.gohtml:56 #: web/template/invoices/view.gohtml:55
msgctxt "title" msgctxt "title"
msgid "Discount" msgid "Discount"
msgstr "Descompte" msgstr "Descompte"
#: web/template/invoices/view.gohtml:58 #: web/template/invoices/view.gohtml:57
msgctxt "title" msgctxt "title"
msgid "Units" msgid "Units"
msgstr "Unitats" msgstr "Unitats"
#: web/template/invoices/view.gohtml:93 #: web/template/invoices/view.gohtml:92
msgctxt "title" msgctxt "title"
msgid "Tax Base" msgid "Tax Base"
msgstr "Base imposable" msgstr "Base imposable"
@ -418,44 +408,44 @@ msgstr "No podeu deixar la contrasenya en blanc."
msgid "Invalid user or password." msgid "Invalid user or password."
msgstr "Nom dusuari o contrasenya incorrectes." msgstr "Nom dusuari o contrasenya incorrectes."
#: pkg/products.go:165 pkg/invoices.go:517 #: pkg/products.go:165 pkg/invoices.go:472
msgctxt "input" msgctxt "input"
msgid "Name" msgid "Name"
msgstr "Nom" msgstr "Nom"
#: pkg/products.go:171 pkg/invoices.go:522 #: pkg/products.go:171 pkg/invoices.go:477
msgctxt "input" msgctxt "input"
msgid "Description" msgid "Description"
msgstr "Descripció" msgstr "Descripció"
#: pkg/products.go:176 pkg/invoices.go:526 #: pkg/products.go:176 pkg/invoices.go:481
msgctxt "input" msgctxt "input"
msgid "Price" msgid "Price"
msgstr "Preu" msgstr "Preu"
#: pkg/products.go:186 pkg/invoices.go:552 #: pkg/products.go:186 pkg/invoices.go:507
msgctxt "input" msgctxt "input"
msgid "Taxes" msgid "Taxes"
msgstr "Imposts" msgstr "Imposts"
#: pkg/products.go:206 pkg/profile.go:92 pkg/invoices.go:431 #: pkg/products.go:206 pkg/profile.go:92 pkg/invoices.go:402
#: pkg/invoices.go:588 #: pkg/invoices.go:543
msgid "Name can not be empty." msgid "Name can not be empty."
msgstr "No podeu deixar el nom en blanc." msgstr "No podeu deixar el nom en blanc."
#: pkg/products.go:207 pkg/invoices.go:589 #: pkg/products.go:207 pkg/invoices.go:544
msgid "Price can not be empty." msgid "Price can not be empty."
msgstr "No podeu deixar el preu en blanc." msgstr "No podeu deixar el preu en blanc."
#: pkg/products.go:208 pkg/invoices.go:590 #: pkg/products.go:208 pkg/invoices.go:545
msgid "Price must be a number greater than zero." msgid "Price must be a number greater than zero."
msgstr "El preu ha de ser un número major a zero." msgstr "El preu ha de ser un número major a zero."
#: pkg/products.go:210 pkg/invoices.go:598 #: pkg/products.go:210 pkg/invoices.go:553
msgid "Selected tax is not valid." msgid "Selected tax is not valid."
msgstr "Heu seleccionat un impost que no és vàlid." msgstr "Heu seleccionat un impost que no és vàlid."
#: pkg/products.go:211 pkg/invoices.go:599 #: pkg/products.go:211 pkg/invoices.go:554
msgid "You can only select a tax of each class." msgid "You can only select a tax of each class."
msgstr "Només podeu seleccionar un impost de cada classe." msgstr "Només podeu seleccionar un impost de cada classe."
@ -563,79 +553,79 @@ msgstr "La confirmació no és igual a la contrasenya."
msgid "Selected language is not valid." msgid "Selected language is not valid."
msgstr "Heu seleccionat un idioma que no és vàlid." msgstr "Heu seleccionat un idioma que no és vàlid."
#: pkg/invoices.go:258 #: pkg/invoices.go:230
msgid "Select a customer to bill." msgid "Select a customer to bill."
msgstr "Escolliu un client a facturar." msgstr "Escolliu un client a facturar."
#: pkg/invoices.go:351 #: pkg/invoices.go:323
msgid "Invalid action" msgid "Invalid action"
msgstr "Acció invàlida." msgstr "Acció invàlida."
#: pkg/invoices.go:372 #: pkg/invoices.go:344
msgctxt "input" msgctxt "input"
msgid "Customer" msgid "Customer"
msgstr "Client" msgstr "Client"
#: pkg/invoices.go:378 #: pkg/invoices.go:350
msgctxt "input" msgctxt "input"
msgid "Number" msgid "Number"
msgstr "Número" msgstr "Número"
#: pkg/invoices.go:384 #: pkg/invoices.go:356
msgctxt "input" msgctxt "input"
msgid "Invoice Date" msgid "Invoice Date"
msgstr "Data de factura" msgstr "Data de factura"
#: pkg/invoices.go:390 #: pkg/invoices.go:362
msgctxt "input" msgctxt "input"
msgid "Notes" msgid "Notes"
msgstr "Notes" msgstr "Notes"
#: pkg/invoices.go:396 #: pkg/invoices.go:368
msgctxt "input" msgctxt "input"
msgid "Payment Method" msgid "Payment Method"
msgstr "Mètode de pagament" msgstr "Mètode de pagament"
#: pkg/invoices.go:432 #: pkg/invoices.go:403
msgid "Invoice date can not be empty." msgid "Invoice date can not be empty."
msgstr "No podeu deixar la data de la factura en blanc." msgstr "No podeu deixar la data de la factura en blanc."
#: pkg/invoices.go:433 #: pkg/invoices.go:404
msgid "Invoice date must be a valid date." msgid "Invoice date must be a valid date."
msgstr "La data de facturació ha de ser vàlida." msgstr "La data de facturació ha de ser vàlida."
#: pkg/invoices.go:435 #: pkg/invoices.go:406
msgid "Selected payment method is not valid." msgid "Selected payment method is not valid."
msgstr "Heu seleccionat un mètode de pagament que no és vàlid." msgstr "Heu seleccionat un mètode de pagament que no és vàlid."
#: pkg/invoices.go:512 #: pkg/invoices.go:467
msgctxt "input" msgctxt "input"
msgid "Id" msgid "Id"
msgstr "Identificador" msgstr "Identificador"
#: pkg/invoices.go:535 #: pkg/invoices.go:490
msgctxt "input" msgctxt "input"
msgid "Quantity" msgid "Quantity"
msgstr "Quantitat" msgstr "Quantitat"
#: pkg/invoices.go:543 #: pkg/invoices.go:498
msgctxt "input" msgctxt "input"
msgid "Discount (%)" msgid "Discount (%)"
msgstr "Descompte (%)" msgstr "Descompte (%)"
#: pkg/invoices.go:592 #: pkg/invoices.go:547
msgid "Quantity can not be empty." msgid "Quantity can not be empty."
msgstr "No podeu deixar la quantitat en blanc." msgstr "No podeu deixar la quantitat en blanc."
#: pkg/invoices.go:593 #: pkg/invoices.go:548
msgid "Quantity must be a number greater than zero." msgid "Quantity must be a number greater than zero."
msgstr "La quantitat ha de ser un número major a zero." msgstr "La quantitat ha de ser un número major a zero."
#: pkg/invoices.go:595 #: pkg/invoices.go:550
msgid "Discount can not be empty." msgid "Discount can not be empty."
msgstr "No podeu deixar el descompte en blanc." msgstr "No podeu deixar el descompte en blanc."
#: pkg/invoices.go:596 #: pkg/invoices.go:551
msgid "Discount must be a percentage between 0 and 100." msgid "Discount must be a percentage between 0 and 100."
msgstr "El descompte ha de ser un percentatge entre 0 i 100." msgstr "El descompte ha de ser un percentatge entre 0 i 100."

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: numerus\n" "Project-Id-Version: numerus\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2023-03-08 11:51+0100\n" "POT-Creation-Date: 2023-03-04 22:11+0100\n"
"PO-Revision-Date: 2023-01-18 17:45+0100\n" "PO-Revision-Date: 2023-01-18 17:45+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n" "Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Spanish <es@tp.org.es>\n" "Language-Team: Spanish <es@tp.org.es>\n"
@ -59,7 +59,7 @@ msgid "Name"
msgstr "Nombre" msgstr "Nombre"
#: web/template/invoices/products.gohtml:43 #: web/template/invoices/products.gohtml:43
#: web/template/invoices/view.gohtml:54 web/template/products/index.gohtml:23 #: web/template/invoices/view.gohtml:53 web/template/products/index.gohtml:23
msgctxt "title" msgctxt "title"
msgid "Price" msgid "Price"
msgstr "Precio" msgstr "Precio"
@ -74,13 +74,13 @@ msgctxt "action"
msgid "Add products" msgid "Add products"
msgstr "Añadir productos" msgstr "Añadir productos"
#: web/template/invoices/new.gohtml:42 web/template/invoices/view.gohtml:59 #: web/template/invoices/new.gohtml:42 web/template/invoices/view.gohtml:58
msgctxt "title" msgctxt "title"
msgid "Subtotal" msgid "Subtotal"
msgstr "Subtotal" msgstr "Subtotal"
#: web/template/invoices/new.gohtml:52 web/template/invoices/view.gohtml:63 #: web/template/invoices/new.gohtml:52 web/template/invoices/view.gohtml:62
#: web/template/invoices/view.gohtml:103 #: web/template/invoices/view.gohtml:102
msgctxt "title" msgctxt "title"
msgid "Total" msgid "Total"
msgstr "Total" msgstr "Total"
@ -100,7 +100,7 @@ msgctxt "invoice"
msgid "All" msgid "All"
msgstr "Todas" msgstr "Todas"
#: web/template/invoices/index.gohtml:22 web/template/invoices/view.gohtml:26 #: web/template/invoices/index.gohtml:22 web/template/invoices/view.gohtml:25
msgctxt "title" msgctxt "title"
msgid "Date" msgid "Date"
msgstr "Fecha" msgstr "Fecha"
@ -135,46 +135,36 @@ msgctxt "title"
msgid "Download" msgid "Download"
msgstr "Descargar" msgstr "Descargar"
#: web/template/invoices/index.gohtml:29 #: web/template/invoices/index.gohtml:50
msgctxt "title"
msgid "Actions"
msgstr "Acciones"
#: web/template/invoices/index.gohtml:75 web/template/invoices/view.gohtml:14
msgctxt "action"
msgid "Duplicate"
msgstr "Duplicar"
#: web/template/invoices/index.gohtml:85
msgid "No invoices added yet." msgid "No invoices added yet."
msgstr "No hay facturas." msgstr "No hay facturas."
#: web/template/invoices/view.gohtml:2 web/template/invoices/view.gohtml:25 #: web/template/invoices/view.gohtml:2 web/template/invoices/view.gohtml:24
msgctxt "title" msgctxt "title"
msgid "Invoice %s" msgid "Invoice %s"
msgstr "Factura %s" msgstr "Factura %s"
#: web/template/invoices/view.gohtml:17 #: web/template/invoices/view.gohtml:16
msgctxt "action" msgctxt "action"
msgid "Download invoice" msgid "Download invoice"
msgstr "Descargar factura" msgstr "Descargar factura"
#: web/template/invoices/view.gohtml:53 #: web/template/invoices/view.gohtml:52
msgctxt "title" msgctxt "title"
msgid "Concept" msgid "Concept"
msgstr "Concepto" msgstr "Concepto"
#: web/template/invoices/view.gohtml:56 #: web/template/invoices/view.gohtml:55
msgctxt "title" msgctxt "title"
msgid "Discount" msgid "Discount"
msgstr "Descuento" msgstr "Descuento"
#: web/template/invoices/view.gohtml:58 #: web/template/invoices/view.gohtml:57
msgctxt "title" msgctxt "title"
msgid "Units" msgid "Units"
msgstr "Unidades" msgstr "Unidades"
#: web/template/invoices/view.gohtml:93 #: web/template/invoices/view.gohtml:92
msgctxt "title" msgctxt "title"
msgid "Tax Base" msgid "Tax Base"
msgstr "Base imponible" msgstr "Base imponible"
@ -418,44 +408,44 @@ msgstr "No podéis dejar la contraseña en blanco."
msgid "Invalid user or password." msgid "Invalid user or password."
msgstr "Nombre de usuario o contraseña inválido." msgstr "Nombre de usuario o contraseña inválido."
#: pkg/products.go:165 pkg/invoices.go:517 #: pkg/products.go:165 pkg/invoices.go:472
msgctxt "input" msgctxt "input"
msgid "Name" msgid "Name"
msgstr "Nombre" msgstr "Nombre"
#: pkg/products.go:171 pkg/invoices.go:522 #: pkg/products.go:171 pkg/invoices.go:477
msgctxt "input" msgctxt "input"
msgid "Description" msgid "Description"
msgstr "Descripción" msgstr "Descripción"
#: pkg/products.go:176 pkg/invoices.go:526 #: pkg/products.go:176 pkg/invoices.go:481
msgctxt "input" msgctxt "input"
msgid "Price" msgid "Price"
msgstr "Precio" msgstr "Precio"
#: pkg/products.go:186 pkg/invoices.go:552 #: pkg/products.go:186 pkg/invoices.go:507
msgctxt "input" msgctxt "input"
msgid "Taxes" msgid "Taxes"
msgstr "Impuestos" msgstr "Impuestos"
#: pkg/products.go:206 pkg/profile.go:92 pkg/invoices.go:431 #: pkg/products.go:206 pkg/profile.go:92 pkg/invoices.go:402
#: pkg/invoices.go:588 #: pkg/invoices.go:543
msgid "Name can not be empty." msgid "Name can not be empty."
msgstr "No podéis dejar el nombre en blanco." msgstr "No podéis dejar el nombre en blanco."
#: pkg/products.go:207 pkg/invoices.go:589 #: pkg/products.go:207 pkg/invoices.go:544
msgid "Price can not be empty." msgid "Price can not be empty."
msgstr "No podéis dejar el precio en blanco." msgstr "No podéis dejar el precio en blanco."
#: pkg/products.go:208 pkg/invoices.go:590 #: pkg/products.go:208 pkg/invoices.go:545
msgid "Price must be a number greater than zero." msgid "Price must be a number greater than zero."
msgstr "El precio tiene que ser un número mayor a cero." msgstr "El precio tiene que ser un número mayor a cero."
#: pkg/products.go:210 pkg/invoices.go:598 #: pkg/products.go:210 pkg/invoices.go:553
msgid "Selected tax is not valid." msgid "Selected tax is not valid."
msgstr "Habéis escogido un impuesto que no es válido." msgstr "Habéis escogido un impuesto que no es válido."
#: pkg/products.go:211 pkg/invoices.go:599 #: pkg/products.go:211 pkg/invoices.go:554
msgid "You can only select a tax of each class." msgid "You can only select a tax of each class."
msgstr "Solo podéis escoger un impuesto de cada clase." msgstr "Solo podéis escoger un impuesto de cada clase."
@ -563,79 +553,79 @@ msgstr "La confirmación no corresponde con la contraseña."
msgid "Selected language is not valid." msgid "Selected language is not valid."
msgstr "Habéis escogido un idioma que no es válido." msgstr "Habéis escogido un idioma que no es válido."
#: pkg/invoices.go:258 #: pkg/invoices.go:230
msgid "Select a customer to bill." msgid "Select a customer to bill."
msgstr "Escoged un cliente a facturar." msgstr "Escoged un cliente a facturar."
#: pkg/invoices.go:351 #: pkg/invoices.go:323
msgid "Invalid action" msgid "Invalid action"
msgstr "Acción inválida." msgstr "Acción inválida."
#: pkg/invoices.go:372 #: pkg/invoices.go:344
msgctxt "input" msgctxt "input"
msgid "Customer" msgid "Customer"
msgstr "Cliente" msgstr "Cliente"
#: pkg/invoices.go:378 #: pkg/invoices.go:350
msgctxt "input" msgctxt "input"
msgid "Number" msgid "Number"
msgstr "Número" msgstr "Número"
#: pkg/invoices.go:384 #: pkg/invoices.go:356
msgctxt "input" msgctxt "input"
msgid "Invoice Date" msgid "Invoice Date"
msgstr "Fecha de factura" msgstr "Fecha de factura"
#: pkg/invoices.go:390 #: pkg/invoices.go:362
msgctxt "input" msgctxt "input"
msgid "Notes" msgid "Notes"
msgstr "Notas" msgstr "Notas"
#: pkg/invoices.go:396 #: pkg/invoices.go:368
msgctxt "input" msgctxt "input"
msgid "Payment Method" msgid "Payment Method"
msgstr "Método de pago" msgstr "Método de pago"
#: pkg/invoices.go:432 #: pkg/invoices.go:403
msgid "Invoice date can not be empty." msgid "Invoice date can not be empty."
msgstr "No podéis dejar la fecha de la factura en blanco." msgstr "No podéis dejar la fecha de la factura en blanco."
#: pkg/invoices.go:433 #: pkg/invoices.go:404
msgid "Invoice date must be a valid date." msgid "Invoice date must be a valid date."
msgstr "La fecha de factura debe ser válida." msgstr "La fecha de factura debe ser válida."
#: pkg/invoices.go:435 #: pkg/invoices.go:406
msgid "Selected payment method is not valid." msgid "Selected payment method is not valid."
msgstr "Habéis escogido un método de pago que no es válido." msgstr "Habéis escogido un método de pago que no es válido."
#: pkg/invoices.go:512 #: pkg/invoices.go:467
msgctxt "input" msgctxt "input"
msgid "Id" msgid "Id"
msgstr "Identificador" msgstr "Identificador"
#: pkg/invoices.go:535 #: pkg/invoices.go:490
msgctxt "input" msgctxt "input"
msgid "Quantity" msgid "Quantity"
msgstr "Cantidad" msgstr "Cantidad"
#: pkg/invoices.go:543 #: pkg/invoices.go:498
msgctxt "input" msgctxt "input"
msgid "Discount (%)" msgid "Discount (%)"
msgstr "Descuento (%)" msgstr "Descuento (%)"
#: pkg/invoices.go:592 #: pkg/invoices.go:547
msgid "Quantity can not be empty." msgid "Quantity can not be empty."
msgstr "No podéis dejar la cantidad en blanco." msgstr "No podéis dejar la cantidad en blanco."
#: pkg/invoices.go:593 #: pkg/invoices.go:548
msgid "Quantity must be a number greater than zero." msgid "Quantity must be a number greater than zero."
msgstr "La cantidad tiene que ser un número mayor a cero." msgstr "La cantidad tiene que ser un número mayor a cero."
#: pkg/invoices.go:595 #: pkg/invoices.go:550
msgid "Discount can not be empty." msgid "Discount can not be empty."
msgstr "No podéis dejar el descuento en blanco." msgstr "No podéis dejar el descuento en blanco."
#: pkg/invoices.go:596 #: pkg/invoices.go:551
msgid "Discount must be a percentage between 0 and 100." msgid "Discount must be a percentage between 0 and 100."
msgstr "El descuento tiene que ser un porcentaje entre 0 y 100." msgstr "El descuento tiene que ser un porcentaje entre 0 y 100."

View File

@ -418,17 +418,34 @@ fieldset {
} }
/* Profile Menu */ /* Profile Menu */
details.menu summary {
display: flex; #profile-menu {
cursor: pointer; position: relative;
justify-content: center;
align-items: center;
} }
details.menu summary::-webkit-details-marker { #profile-menu summary {
width: 7rem;
height: 7rem;
margin: 1rem 0;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
border: none;
}
#profile-menu summary::-webkit-details-marker {
display: none; display: none;
} }
#profile-menu summary, #profile-menu button {
cursor: pointer;
}
#profile-menu summary, #profile-menu ul {
background-color: var(--numerus--background-color);
}
details.menu[open] summary::before { details.menu[open] summary::before {
background-color: var(--numerus--header--background-color); background-color: var(--numerus--header--background-color);
position: fixed; position: fixed;
@ -443,22 +460,23 @@ details.menu[open] summary::before {
} }
ul[role="menu"] { ul[role="menu"] {
position: absolute;
padding: 0; padding: 0;
list-style: none; list-style: none;
background-color: var(--numerus--background-color); }
#profile-menu ul {
position: absolute;
right: -1.875em;
top: 100%;
padding: 1rem 2rem;
z-index: 20; z-index: 20;
} }
ul[role="menu"].action-menu { #profile-menu li + li {
padding: 1rem 2rem;
}
ul[role="menu"].action-menu li + li {
border-top: 1px solid var(--numerus--color--black); border-top: 1px solid var(--numerus--color--black);
} }
ul[role="menu"].action-menu button, ul[role="menu"].action-menu a { #profile-menu button, #profile-menu a {
font-size: 2rem; font-size: 2rem;
font-style: italic; font-style: italic;
height: 8rem; height: 8rem;
@ -472,37 +490,12 @@ ul[role="menu"].action-menu button, ul[role="menu"].action-menu a {
text-transform: initial; text-transform: initial;
} }
ul[role="menu"].action-menu li i[class^='ri-'] { #profile-menu li i[class^='ri-'] {
margin-right: 2rem; margin-right: 2rem;
color: var(--numerus--color--dark-gray); color: var(--numerus--color--dark-gray);
} }
#profile-menu { #profile-menu summary:hover, #profile-menu summary:focus, #profile-menu button:hover, #profile-menu a:hover, body > nav a:hover {
position: relative;
}
#profile-menu summary {
width: 7rem;
height: 7rem;
margin: 1rem 0;
border-radius: 50%;
border: none;
}
#profile-menu button {
cursor: pointer;
}
#profile-menu summary {
background-color: var(--numerus--background-color);
}
#profile-menu ul {
right: -1.875em;
top: 100%;
}
#profile-menu summary:hover, #profile-menu summary:focus, ul[role="menu"].action-menu button:hover, ul[role="menu"].action-menu a:hover, body > nav a:hover {
background-color: var(--numerus--color--light-gray); background-color: var(--numerus--color--light-gray);
} }
@ -541,16 +534,18 @@ main > nav {
.invoice-status summary { .invoice-status summary {
height: 3rem; height: 3rem;
display: block;
}
.invoice-status summary::-webkit-details-marker {
display: none;
} }
.invoice-status ul { .invoice-status ul {
position: absolute; position: absolute;
top: 0; top: 1.5em;
left: 100%; left: 0;
padding: 2rem; z-index: 20;
display: flex;
flex-direction: column;
gap: 1rem;
} }
.invoice-status button { .invoice-status button {
@ -580,14 +575,6 @@ main > nav {
background-color: var(--numerus--color--rosy); background-color: var(--numerus--color--rosy);
} }
.actions details {
position: relative;
}
.actions .action-menu {
right: 0;
}
/* Remix Icon */ /* Remix Icon */
@font-face { @font-face {

View File

@ -13,7 +13,7 @@
<summary> <summary>
<i class="ri-eye-close-line ri-3x"></i> <i class="ri-eye-close-line ri-3x"></i>
</summary> </summary>
<ul role="menu" class="action-menu"> <ul role="menu">
<li role="presentation"> <li role="presentation">
<a role="menuitem" href="{{ companyURI "/profile" }}"> <a role="menuitem" href="{{ companyURI "/profile" }}">
<i class="ri-account-circle-line"></i> <i class="ri-account-circle-line"></i>

View File

@ -26,7 +26,6 @@
<th>{{( pgettext "Label" "title" )}}</th> <th>{{( pgettext "Label" "title" )}}</th>
<th>{{( pgettext "Amount" "title" )}}</th> <th>{{( pgettext "Amount" "title" )}}</th>
<th>{{( pgettext "Download" "title" )}}</th> <th>{{( pgettext "Download" "title" )}}</th>
<th>{{( pgettext "Actions" "title" )}}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -46,11 +45,9 @@
<ul role="menu"> <ul role="menu">
{{- range $status, $name := $.InvoiceStatuses }} {{- range $status, $name := $.InvoiceStatuses }}
{{- if ne $status $invoice.Status }} {{- if ne $status $invoice.Status }}
<li role="presentation"> <li>
<button role="menuitem" type="submit" <button type="submit" name="status" class="invoice-status-{{ $status }}"
name="status" value="{{ $status }}" value="{{ $status }}">{{ $name }}</button>
class="invoice-status-{{ $status }}"
>{{ $name }}</button>
</li> </li>
{{- end }} {{- end }}
{{- end }} {{- end }}
@ -65,19 +62,6 @@
title="{{( pgettext "Download invoice" "action" )}}" title="{{( pgettext "Download invoice" "action" )}}"
aria-label="{{( pgettext "Download invoice %s" "action" )}}"><i aria-label="{{( pgettext "Download invoice %s" "action" )}}"><i
class="ri-download-line"></i></a></td> class="ri-download-line"></i></a></td>
<td class="actions">
<details class="menu">
<summary><i class="ri-more-line"></i></summary>
<ul role="menu" class="action-menu">
<li role="presentation">
<a role="menuitem" href="{{ companyURI "/invoices/new"}}?duplicate={{ .Slug }}">
<i class="ri-file-copy-line"></i>
{{( pgettext "Duplicate" "action" )}}
</a>
</li>
</ul>
</details>
</td>
</tr> </tr>
{{- end }} {{- end }}
{{ else }} {{ else }}

View File

@ -11,7 +11,6 @@
<a>{{ .Number }}</a> <a>{{ .Number }}</a>
</p> </p>
<p> <p>
<a class="primary button" href="{{ companyURI "/invoices/new"}}?duplicate={{ .Slug }}">{{( pgettext "Duplicate" "action" )}}</a>
<a class="primary button" <a class="primary button"
href="{{ companyURI "/invoices/" }}{{ .Slug }}.pdf" href="{{ companyURI "/invoices/" }}{{ .Slug }}.pdf"
download="{{ .Number}}.pdf">{{( pgettext "Download invoice" "action" )}}</a> download="{{ .Number}}.pdf">{{( pgettext "Download invoice" "action" )}}</a>