Add option to switch to another company

This is for users that belong to more than one company.  It is just a
page with links to the home of each company that the user belongs to.

Had to add a second company to the demo data to test it properly, even
though i already have unit tests for multicompany, but, you know….
This commit is contained in:
jordi fita mas 2023-11-06 13:52:34 +01:00
parent 4e831d94db
commit 998159d1d7
7 changed files with 253 additions and 113 deletions

View File

@ -12,12 +12,16 @@ set constraints "company_default_payment_method_id_fkey" deferred;
alter sequence company_company_id_seq restart with 123;
insert into company (business_name, vatin, trade_name, phone, email, web, address, city, province, postal_code, country_code, currency_code, default_payment_method_id, legal_disclaimer)
values ('Juli Verd', 'ES40404040D', 'Pesebre', parse_packed_phone_number('972 50 60 70', 'ES'), 'info@numerus.cat', 'https://numerus.cat/', 'C/ de lHort', 'Castelló dEmpúries', 'Girona', '17486', 'ES', 'EUR', 124, 'Juli Verd és responsable del tractament de les seves dades dacord amb el RGPD i la LOPDGDD, i les tracta per a mantenir una relació mercantil/comercial amb vostè. Les conservarà mentre es mantingui aquesta relació i no es comunicaran a tercers. Pot exercir els drets daccés, rectificació, portabilitat, supressió, limitació i oposició a Juli Verd, amb domicili Carrer de lHort 71, 17486 Castelló dEmpúries o enviant un correu electrònic a info@numerus.cat. Per a qualsevol reclamació pot acudir a agpd.es. Per a més informació pot consultar la nostra política de privacitat a numerus.cat.');
values ('Juli Verd', 'ES40404040D', 'Pessebre', parse_packed_phone_number('972 50 60 70', 'ES'), 'info@numerus.cat', 'https://numerus.cat/', 'C/ de lHort', 'Castelló dEmpúries', 'Girona', '17486', 'ES', 'EUR', 124, 'Juli Verd és responsable del tractament de les seves dades dacord amb el RGPD i la LOPDGDD, i les tracta per a mantenir una relació mercantil/comercial amb vostè. Les conservarà mentre es mantingui aquesta relació i no es comunicaran a tercers. Pot exercir els drets daccés, rectificació, portabilitat, supressió, limitació i oposició a Juli Verd, amb domicili Carrer de lHort 71, 17486 Castelló dEmpúries o enviant un correu electrònic a info@numerus.cat. Per a qualsevol reclamació pot acudir a agpd.es. Per a més informació pot consultar la nostra política de privacitat a numerus.cat.')
, ('Pere Gil', 'ES41414141L', 'Betlem', parse_packed_phone_number('972 80 90 00', 'ES'), 'info@numerus.cat', 'https://numerus.cat/', 'C/ de lHort', 'Castelló dEmpúries', 'Girona', '17486', 'ES', 'EUR', 126, 'Pere Gil és responsable del tractament de les seves dades dacord amb el RGPD i la LOPDGDD, i les tracta per a mantenir una relació mercantil/comercial amb vostè. Les conservarà mentre es mantingui aquesta relació i no es comunicaran a tercers. Pot exercir els drets daccés, rectificació, portabilitat, supressió, limitació i oposició a Pere Gil, amb domicili Carrer de lHort 71, 17486 Castelló dEmpúries o enviant un correu electrònic a info@numerus.cat. Per a qualsevol reclamació pot acudir a agpd.es. Per a més informació pot consultar la nostra política de privacitat a numerus.cat.')
;
alter sequence payment_method_payment_method_id_seq restart with 123;
insert into payment_method (company_id, name, instructions)
values (123, 'Efectiu', 'Pagament en efectiu al comptat.')
, (123, 'Transferència', E'Pagament per transferència bancària al compte:\n\nES0123456789012345678901\n\nBIC AAAABBCCDD')
, (124, 'Efectiu', 'Pagament en efectiu al comptat.')
, (124, 'Transferència', E'Pagament per transferència bancària al compte:\n\nES0123456789012345678901\n\nBIC AAAABBCCDD')
;
set constraints "company_default_payment_method_id_fkey" immediate;
@ -25,12 +29,16 @@ set constraints "company_default_payment_method_id_fkey" immediate;
insert into company_user (company_id, user_id)
values (123, 123)
, (123, 124)
, (124, 123)
, (124, 124)
;
alter sequence tax_class_tax_class_id_seq restart with 123;
insert into tax_class (company_id, name)
values (123, 'IRPF')
, (123, 'IVA')
, (124, 'IRPF')
, (124, 'IVA')
;
alter sequence tax_tax_id_seq restart with 123;
@ -39,6 +47,10 @@ values (123, 123, 'Retenció 15 %', -0.15)
, (123, 124, 'IVA 21 %', 0.21)
, (123, 124, 'IVA 10 %', 0.10)
, (123, 124, 'IVA 4 %', 0.04)
, (124, 123, 'Retenció 15 %', -0.15)
, (124, 124, 'IVA 21 %', 0.21)
, (124, 124, 'IVA 10 %', 0.10)
, (124, 124, 'IVA 4 %', 0.04)
;
alter sequence contact_contact_id_seq restart with 123;

View File

@ -737,3 +737,46 @@ func HandleAddPaymentMethod(w http.ResponseWriter, r *http.Request, _ httprouter
http.Redirect(w, r, companyURI(company, "/tax-details"), http.StatusSeeOther)
}
}
func GetCompanySwitcher(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
page := &CompanySwitchPage{
Companies: mustCollectUserCompanies(r.Context(), getConn(r)),
}
page.MustRender(w, r)
}
type CompanySwitchPage struct {
Companies []*UserCompany
}
type UserCompany struct {
Name string
Slug string
}
func (page *CompanySwitchPage) MustRender(w http.ResponseWriter, r *http.Request) {
mustRenderModalTemplate(w, r, "switch-company.gohtml", page)
}
func mustCollectUserCompanies(ctx context.Context, conn *Conn) []*UserCompany {
rows, err := conn.Query(ctx, "select business_name::text, slug::text from company order by business_name")
if err != nil {
panic(err)
}
defer rows.Close()
var companies []*UserCompany
for rows.Next() {
company := &UserCompany{}
err = rows.Scan(&company.Name, &company.Slug)
if err != nil {
panic(err)
}
companies = append(companies, company)
}
if rows.Err() != nil {
panic(rows.Err())
}
return companies
}

View File

@ -11,6 +11,7 @@ func NewRouter(db *Db) http.Handler {
companyRouter.GET("/profile", GetProfileForm)
companyRouter.POST("/profile", HandleProfileForm)
companyRouter.GET("/tax-details", GetCompanyTaxDetailsForm)
companyRouter.GET("/switch-company", GetCompanySwitcher)
companyRouter.POST("/tax-details", HandleCompanyTaxDetailsForm)
companyRouter.POST("/tax", HandleAddCompanyTax)
companyRouter.DELETE("/tax/:taxId", HandleDeleteCompanyTax)

133
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-10-02 16:35+0200\n"
"POT-Creation-Date: 2023-11-06 13:50+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,15 +26,15 @@ 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/home.gohtml:2
#: web/template/quotes/products.gohtml:9 web/template/quotes/new.gohtml:9
#: web/template/quotes/index.gohtml:9 web/template/quotes/view.gohtml:9
#: web/template/quotes/edit.gohtml:9 web/template/contacts/new.gohtml:9
#: web/template/contacts/index.gohtml:9 web/template/contacts/edit.gohtml:10
#: web/template/contacts/import.gohtml:8 web/template/profile.gohtml:9
#: web/template/expenses/new.gohtml:10 web/template/expenses/index.gohtml:10
#: web/template/expenses/edit.gohtml:10 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/switch-company.gohtml:9 web/template/quotes/products.gohtml:9
#: web/template/quotes/new.gohtml:9 web/template/quotes/index.gohtml:9
#: web/template/quotes/view.gohtml:9 web/template/quotes/edit.gohtml:9
#: web/template/contacts/new.gohtml:9 web/template/contacts/index.gohtml:9
#: web/template/contacts/edit.gohtml:10 web/template/contacts/import.gohtml:8
#: web/template/profile.gohtml:9 web/template/expenses/new.gohtml:10
#: web/template/expenses/index.gohtml:10 web/template/expenses/edit.gohtml:10
#: web/template/tax-details.gohtml:9 web/template/products/new.gohtml:9
#: web/template/products/index.gohtml:9 web/template/products/edit.gohtml:10
msgctxt "title"
msgid "Home"
msgstr "Inici"
@ -59,7 +59,8 @@ msgid "All"
msgstr "Tots"
#: web/template/invoices/products.gohtml:49
#: web/template/quotes/products.gohtml:49 web/template/products/index.gohtml:45
#: web/template/switch-company.gohtml:22 web/template/quotes/products.gohtml:49
#: web/template/products/index.gohtml:45
msgctxt "title"
msgid "Name"
msgstr "Nom"
@ -203,9 +204,9 @@ msgctxt "title"
msgid "Download"
msgstr "Descàrrega"
#: web/template/invoices/index.gohtml:74 web/template/quotes/index.gohtml:74
#: web/template/contacts/index.gohtml:51 web/template/expenses/index.gohtml:76
#: web/template/products/index.gohtml:48
#: web/template/invoices/index.gohtml:74 web/template/switch-company.gohtml:23
#: web/template/quotes/index.gohtml:74 web/template/contacts/index.gohtml:51
#: web/template/expenses/index.gohtml:76 web/template/products/index.gohtml:48
msgctxt "title"
msgid "Actions"
msgstr "Accions"
@ -215,16 +216,16 @@ msgctxt "action"
msgid "Select invoice %v"
msgstr "Selecciona factura %v"
#: web/template/invoices/index.gohtml:122
#: web/template/invoices/index.gohtml:123
msgctxt "action"
msgid "Download invoice %s"
msgstr "Descarrega factura %s"
#: web/template/invoices/index.gohtml:130
#: web/template/invoices/index.gohtml:131
msgid "Actions for invoice %s"
msgstr "Accions per la factura %s"
#: web/template/invoices/index.gohtml:138 web/template/invoices/view.gohtml:19
#: web/template/invoices/index.gohtml:139 web/template/invoices/view.gohtml:19
#: web/template/quotes/index.gohtml:137 web/template/quotes/view.gohtml:22
#: web/template/contacts/index.gohtml:82 web/template/expenses/index.gohtml:143
#: web/template/products/index.gohtml:78
@ -232,17 +233,17 @@ msgctxt "action"
msgid "Edit"
msgstr "Edita"
#: web/template/invoices/index.gohtml:146 web/template/invoices/view.gohtml:16
#: web/template/invoices/index.gohtml:147 web/template/invoices/view.gohtml:16
#: web/template/quotes/index.gohtml:145 web/template/quotes/view.gohtml:19
msgctxt "action"
msgid "Duplicate"
msgstr "Duplica"
#: web/template/invoices/index.gohtml:156
#: web/template/invoices/index.gohtml:157
msgid "No invoices added yet."
msgstr "No hi ha cap factura."
#: web/template/invoices/index.gohtml:163 web/template/quotes/index.gohtml:170
#: web/template/invoices/index.gohtml:164 web/template/quotes/index.gohtml:170
#: web/template/expenses/index.gohtml:160
msgid "Total"
msgstr "Total"
@ -317,6 +318,17 @@ msgctxt "action"
msgid "Filters"
msgstr "Filtra"
#: web/template/switch-company.gohtml:2 web/template/switch-company.gohtml:10
#: web/template/switch-company.gohtml:18
msgctxt "title"
msgid "Company Switch"
msgstr "Canvi dempresa"
#: web/template/switch-company.gohtml:30
msgctxt "action"
msgid "Switch"
msgstr "Canvia"
#: web/template/dashboard.gohtml:3
msgctxt "title"
msgid "Dashboard"
@ -437,37 +449,42 @@ msgctxt "menu"
msgid "Tax Details"
msgstr "Configuració fiscal"
#: web/template/app.gohtml:37
#: web/template/app.gohtml:35
msgctxt "menu"
msgid "Switch Company"
msgstr "Canvi dempresa"
#: web/template/app.gohtml:43
msgctxt "action"
msgid "Logout"
msgstr "Surt"
#: web/template/app.gohtml:46
#: web/template/app.gohtml:52
msgctxt "nav"
msgid "Dashboard"
msgstr "Tauler"
#: web/template/app.gohtml:47
#: web/template/app.gohtml:53
msgctxt "nav"
msgid "Quotations"
msgstr "Pressuposts"
#: web/template/app.gohtml:48
#: web/template/app.gohtml:54
msgctxt "nav"
msgid "Invoices"
msgstr "Factures"
#: web/template/app.gohtml:49
#: web/template/app.gohtml:55
msgctxt "nav"
msgid "Expenses"
msgstr "Despeses"
#: web/template/app.gohtml:50
#: web/template/app.gohtml:56
msgctxt "nav"
msgid "Products"
msgstr "Productes"
#: web/template/app.gohtml:51
#: web/template/app.gohtml:57
msgctxt "nav"
msgid "Contacts"
msgstr "Contactes"
@ -735,37 +752,37 @@ msgid "Name"
msgstr "Nom"
#: pkg/products.go:177 pkg/products.go:303 pkg/quote.go:174 pkg/quote.go:708
#: pkg/expenses.go:339 pkg/expenses.go:507 pkg/invoices.go:174
#: pkg/expenses.go:340 pkg/expenses.go:508 pkg/invoices.go:174
#: pkg/invoices.go:746 pkg/invoices.go:1331 pkg/contacts.go:154
#: pkg/contacts.go:362
msgctxt "input"
msgid "Tags"
msgstr "Etiquetes"
#: pkg/products.go:181 pkg/quote.go:178 pkg/expenses.go:517 pkg/invoices.go:178
#: pkg/products.go:181 pkg/quote.go:178 pkg/expenses.go:518 pkg/invoices.go:178
#: pkg/contacts.go:158
msgctxt "input"
msgid "Tags Condition"
msgstr "Condició de les etiquetes"
#: pkg/products.go:185 pkg/quote.go:182 pkg/expenses.go:521 pkg/invoices.go:182
#: pkg/products.go:185 pkg/quote.go:182 pkg/expenses.go:522 pkg/invoices.go:182
#: pkg/contacts.go:162
msgctxt "tag condition"
msgid "All"
msgstr "Totes"
#: pkg/products.go:186 pkg/expenses.go:522 pkg/invoices.go:183
#: pkg/products.go:186 pkg/expenses.go:523 pkg/invoices.go:183
#: pkg/contacts.go:163
msgid "Invoices must have all the specified labels."
msgstr "Les factures han de tenir totes les etiquetes."
#: pkg/products.go:190 pkg/quote.go:187 pkg/expenses.go:526 pkg/invoices.go:187
#: pkg/products.go:190 pkg/quote.go:187 pkg/expenses.go:527 pkg/invoices.go:187
#: pkg/contacts.go:167
msgctxt "tag condition"
msgid "Any"
msgstr "Qualsevol"
#: pkg/products.go:191 pkg/expenses.go:527 pkg/invoices.go:188
#: pkg/products.go:191 pkg/expenses.go:528 pkg/invoices.go:188
#: pkg/contacts.go:168
msgid "Invoices must have at least one of the specified labels."
msgstr "Les factures han de tenir com a mínim una de les etiquetes."
@ -780,7 +797,7 @@ msgctxt "input"
msgid "Price"
msgstr "Preu"
#: pkg/products.go:297 pkg/quote.go:948 pkg/expenses.go:307
#: pkg/products.go:297 pkg/quote.go:948 pkg/expenses.go:308
#: pkg/invoices.go:1063
msgctxt "input"
msgid "Taxes"
@ -799,12 +816,12 @@ msgstr "No podeu deixar el preu en blanc."
msgid "Price must be a number greater than zero."
msgstr "El preu ha de ser un número major a zero."
#: pkg/products.go:326 pkg/quote.go:1007 pkg/expenses.go:375
#: pkg/products.go:326 pkg/quote.go:1007 pkg/expenses.go:376
#: pkg/invoices.go:1122
msgid "Selected tax is not valid."
msgstr "Heu seleccionat un impost que no és vàlid."
#: pkg/products.go:327 pkg/quote.go:1008 pkg/expenses.go:376
#: pkg/products.go:327 pkg/quote.go:1008 pkg/expenses.go:377
#: pkg/invoices.go:1123
msgid "You can only select a tax of each class."
msgstr "Només podeu seleccionar un impost de cada classe."
@ -1028,7 +1045,7 @@ msgctxt "input"
msgid "Quotation Status"
msgstr "Estat del pressupost"
#: pkg/quote.go:154 pkg/expenses.go:512 pkg/invoices.go:154
#: pkg/quote.go:154 pkg/expenses.go:513 pkg/invoices.go:154
msgid "All status"
msgstr "Tots els estats"
@ -1037,12 +1054,12 @@ msgctxt "input"
msgid "Quotation Number"
msgstr "Número de pressupost"
#: pkg/quote.go:164 pkg/expenses.go:497 pkg/invoices.go:164
#: pkg/quote.go:164 pkg/expenses.go:498 pkg/invoices.go:164
msgctxt "input"
msgid "From Date"
msgstr "A partir de la data"
#: pkg/quote.go:169 pkg/expenses.go:502 pkg/invoices.go:169
#: pkg/quote.go:169 pkg/expenses.go:503 pkg/invoices.go:169
msgctxt "input"
msgid "To Date"
msgstr "Fins la data"
@ -1063,8 +1080,8 @@ msgstr "pressuposts.zip"
msgid "quotations.ods"
msgstr "pressuposts.ods"
#: pkg/quote.go:634 pkg/quote.go:1176 pkg/quote.go:1184 pkg/expenses.go:716
#: pkg/expenses.go:742 pkg/invoices.go:677 pkg/invoices.go:1306
#: pkg/quote.go:634 pkg/quote.go:1176 pkg/quote.go:1184 pkg/expenses.go:717
#: pkg/expenses.go:743 pkg/invoices.go:677 pkg/invoices.go:1306
#: pkg/invoices.go:1314
msgid "Invalid action"
msgstr "Acció invàlida."
@ -1219,70 +1236,70 @@ msgctxt "period option"
msgid "Previous year"
msgstr "Any anterior"
#: pkg/expenses.go:233
#: pkg/expenses.go:234
msgid "Select a contact."
msgstr "Escolliu un contacte."
#: pkg/expenses.go:290 pkg/expenses.go:486
#: pkg/expenses.go:291 pkg/expenses.go:487
msgctxt "input"
msgid "Contact"
msgstr "Contacte"
#: pkg/expenses.go:296
#: pkg/expenses.go:297
msgctxt "input"
msgid "Invoice number"
msgstr "Número de factura"
#: pkg/expenses.go:301 pkg/invoices.go:735
#: pkg/expenses.go:302 pkg/invoices.go:735
msgctxt "input"
msgid "Invoice Date"
msgstr "Data de factura"
#: pkg/expenses.go:316
#: pkg/expenses.go:317
msgctxt "input"
msgid "Amount"
msgstr "Import"
#: pkg/expenses.go:327 pkg/invoices.go:757
#: pkg/expenses.go:328 pkg/invoices.go:757
msgctxt "input"
msgid "File"
msgstr "Fitxer"
#: pkg/expenses.go:333 pkg/expenses.go:511
#: pkg/expenses.go:334 pkg/expenses.go:512
msgctxt "input"
msgid "Expense Status"
msgstr "Estat de la despesa"
#: pkg/expenses.go:373
#: pkg/expenses.go:374
msgid "Selected contact is not valid."
msgstr "Heu seleccionat un contacte que no és vàlid."
#: pkg/expenses.go:374 pkg/invoices.go:808
#: pkg/expenses.go:375 pkg/invoices.go:808
msgid "Invoice date must be a valid date."
msgstr "La data de facturació ha de ser vàlida."
#: pkg/expenses.go:377
#: pkg/expenses.go:378
msgid "Amount can not be empty."
msgstr "No podeu deixar limport en blanc."
#: pkg/expenses.go:378
#: pkg/expenses.go:379
msgid "Amount must be a number greater than zero."
msgstr "Limport ha de ser un número major a zero."
#: pkg/expenses.go:380
#: pkg/expenses.go:381
msgid "Selected expense status is not valid."
msgstr "Heu seleccionat un estat de despesa que no és vàlid."
#: pkg/expenses.go:487
#: pkg/expenses.go:488
msgid "All contacts"
msgstr "Tots els contactes"
#: pkg/expenses.go:492 pkg/invoices.go:159
#: pkg/expenses.go:493 pkg/invoices.go:159
msgctxt "input"
msgid "Invoice Number"
msgstr "Número de factura"
#: pkg/expenses.go:740
#: pkg/expenses.go:741
msgid "expenses.ods"
msgstr "despeses.ods"
@ -1357,6 +1374,10 @@ msgctxt "input"
msgid "Holded Excel file"
msgstr "Fitxer Excel del Holded"
#~ msgctxt "title"
#~ msgid "Switch Company"
#~ msgstr "Canvi dempresa"
#~ msgctxt "expense"
#~ msgid "All"
#~ msgstr "Totes"

133
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-10-02 16:35+0200\n"
"POT-Creation-Date: 2023-11-06 13:50+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,15 +26,15 @@ 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/home.gohtml:2
#: web/template/quotes/products.gohtml:9 web/template/quotes/new.gohtml:9
#: web/template/quotes/index.gohtml:9 web/template/quotes/view.gohtml:9
#: web/template/quotes/edit.gohtml:9 web/template/contacts/new.gohtml:9
#: web/template/contacts/index.gohtml:9 web/template/contacts/edit.gohtml:10
#: web/template/contacts/import.gohtml:8 web/template/profile.gohtml:9
#: web/template/expenses/new.gohtml:10 web/template/expenses/index.gohtml:10
#: web/template/expenses/edit.gohtml:10 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/switch-company.gohtml:9 web/template/quotes/products.gohtml:9
#: web/template/quotes/new.gohtml:9 web/template/quotes/index.gohtml:9
#: web/template/quotes/view.gohtml:9 web/template/quotes/edit.gohtml:9
#: web/template/contacts/new.gohtml:9 web/template/contacts/index.gohtml:9
#: web/template/contacts/edit.gohtml:10 web/template/contacts/import.gohtml:8
#: web/template/profile.gohtml:9 web/template/expenses/new.gohtml:10
#: web/template/expenses/index.gohtml:10 web/template/expenses/edit.gohtml:10
#: web/template/tax-details.gohtml:9 web/template/products/new.gohtml:9
#: web/template/products/index.gohtml:9 web/template/products/edit.gohtml:10
msgctxt "title"
msgid "Home"
msgstr "Inicio"
@ -59,7 +59,8 @@ msgid "All"
msgstr "Todos"
#: web/template/invoices/products.gohtml:49
#: web/template/quotes/products.gohtml:49 web/template/products/index.gohtml:45
#: web/template/switch-company.gohtml:22 web/template/quotes/products.gohtml:49
#: web/template/products/index.gohtml:45
msgctxt "title"
msgid "Name"
msgstr "Nombre"
@ -203,9 +204,9 @@ msgctxt "title"
msgid "Download"
msgstr "Descargar"
#: web/template/invoices/index.gohtml:74 web/template/quotes/index.gohtml:74
#: web/template/contacts/index.gohtml:51 web/template/expenses/index.gohtml:76
#: web/template/products/index.gohtml:48
#: web/template/invoices/index.gohtml:74 web/template/switch-company.gohtml:23
#: web/template/quotes/index.gohtml:74 web/template/contacts/index.gohtml:51
#: web/template/expenses/index.gohtml:76 web/template/products/index.gohtml:48
msgctxt "title"
msgid "Actions"
msgstr "Acciones"
@ -215,16 +216,16 @@ msgctxt "action"
msgid "Select invoice %v"
msgstr "Seleccionar factura %v"
#: web/template/invoices/index.gohtml:122
#: web/template/invoices/index.gohtml:123
msgctxt "action"
msgid "Download invoice %s"
msgstr "Descargar factura %s"
#: web/template/invoices/index.gohtml:130
#: web/template/invoices/index.gohtml:131
msgid "Actions for invoice %s"
msgstr "Acciones para la factura %s"
#: web/template/invoices/index.gohtml:138 web/template/invoices/view.gohtml:19
#: web/template/invoices/index.gohtml:139 web/template/invoices/view.gohtml:19
#: web/template/quotes/index.gohtml:137 web/template/quotes/view.gohtml:22
#: web/template/contacts/index.gohtml:82 web/template/expenses/index.gohtml:143
#: web/template/products/index.gohtml:78
@ -232,17 +233,17 @@ msgctxt "action"
msgid "Edit"
msgstr "Editar"
#: web/template/invoices/index.gohtml:146 web/template/invoices/view.gohtml:16
#: web/template/invoices/index.gohtml:147 web/template/invoices/view.gohtml:16
#: web/template/quotes/index.gohtml:145 web/template/quotes/view.gohtml:19
msgctxt "action"
msgid "Duplicate"
msgstr "Duplicar"
#: web/template/invoices/index.gohtml:156
#: web/template/invoices/index.gohtml:157
msgid "No invoices added yet."
msgstr "No hay facturas."
#: web/template/invoices/index.gohtml:163 web/template/quotes/index.gohtml:170
#: web/template/invoices/index.gohtml:164 web/template/quotes/index.gohtml:170
#: web/template/expenses/index.gohtml:160
msgid "Total"
msgstr "Total"
@ -317,6 +318,17 @@ msgctxt "action"
msgid "Filters"
msgstr "Filtrar"
#: web/template/switch-company.gohtml:2 web/template/switch-company.gohtml:10
#: web/template/switch-company.gohtml:18
msgctxt "title"
msgid "Company Switch"
msgstr "Cambio de empresa"
#: web/template/switch-company.gohtml:30
msgctxt "action"
msgid "Switch"
msgstr "Cambiar"
#: web/template/dashboard.gohtml:3
msgctxt "title"
msgid "Dashboard"
@ -437,37 +449,42 @@ msgctxt "menu"
msgid "Tax Details"
msgstr "Configuración fiscal"
#: web/template/app.gohtml:37
#: web/template/app.gohtml:35
msgctxt "menu"
msgid "Switch Company"
msgstr "Cambio de empresa"
#: web/template/app.gohtml:43
msgctxt "action"
msgid "Logout"
msgstr "Salir"
#: web/template/app.gohtml:46
#: web/template/app.gohtml:52
msgctxt "nav"
msgid "Dashboard"
msgstr "Panel"
#: web/template/app.gohtml:47
#: web/template/app.gohtml:53
msgctxt "nav"
msgid "Quotations"
msgstr "Presupuestos"
#: web/template/app.gohtml:48
#: web/template/app.gohtml:54
msgctxt "nav"
msgid "Invoices"
msgstr "Facturas"
#: web/template/app.gohtml:49
#: web/template/app.gohtml:55
msgctxt "nav"
msgid "Expenses"
msgstr "Gastos"
#: web/template/app.gohtml:50
#: web/template/app.gohtml:56
msgctxt "nav"
msgid "Products"
msgstr "Productos"
#: web/template/app.gohtml:51
#: web/template/app.gohtml:57
msgctxt "nav"
msgid "Contacts"
msgstr "Contactos"
@ -735,37 +752,37 @@ msgid "Name"
msgstr "Nombre"
#: pkg/products.go:177 pkg/products.go:303 pkg/quote.go:174 pkg/quote.go:708
#: pkg/expenses.go:339 pkg/expenses.go:507 pkg/invoices.go:174
#: pkg/expenses.go:340 pkg/expenses.go:508 pkg/invoices.go:174
#: pkg/invoices.go:746 pkg/invoices.go:1331 pkg/contacts.go:154
#: pkg/contacts.go:362
msgctxt "input"
msgid "Tags"
msgstr "Etiquetes"
#: pkg/products.go:181 pkg/quote.go:178 pkg/expenses.go:517 pkg/invoices.go:178
#: pkg/products.go:181 pkg/quote.go:178 pkg/expenses.go:518 pkg/invoices.go:178
#: pkg/contacts.go:158
msgctxt "input"
msgid "Tags Condition"
msgstr "Condición de las etiquetas"
#: pkg/products.go:185 pkg/quote.go:182 pkg/expenses.go:521 pkg/invoices.go:182
#: pkg/products.go:185 pkg/quote.go:182 pkg/expenses.go:522 pkg/invoices.go:182
#: pkg/contacts.go:162
msgctxt "tag condition"
msgid "All"
msgstr "Todas"
#: pkg/products.go:186 pkg/expenses.go:522 pkg/invoices.go:183
#: pkg/products.go:186 pkg/expenses.go:523 pkg/invoices.go:183
#: pkg/contacts.go:163
msgid "Invoices must have all the specified labels."
msgstr "Las facturas deben tener todas las etiquetas."
#: pkg/products.go:190 pkg/quote.go:187 pkg/expenses.go:526 pkg/invoices.go:187
#: pkg/products.go:190 pkg/quote.go:187 pkg/expenses.go:527 pkg/invoices.go:187
#: pkg/contacts.go:167
msgctxt "tag condition"
msgid "Any"
msgstr "Cualquiera"
#: pkg/products.go:191 pkg/expenses.go:527 pkg/invoices.go:188
#: pkg/products.go:191 pkg/expenses.go:528 pkg/invoices.go:188
#: pkg/contacts.go:168
msgid "Invoices must have at least one of the specified labels."
msgstr "Las facturas deben tener como mínimo una de las etiquetas."
@ -780,7 +797,7 @@ msgctxt "input"
msgid "Price"
msgstr "Precio"
#: pkg/products.go:297 pkg/quote.go:948 pkg/expenses.go:307
#: pkg/products.go:297 pkg/quote.go:948 pkg/expenses.go:308
#: pkg/invoices.go:1063
msgctxt "input"
msgid "Taxes"
@ -799,12 +816,12 @@ msgstr "No podéis dejar el precio en blanco."
msgid "Price must be a number greater than zero."
msgstr "El precio tiene que ser un número mayor a cero."
#: pkg/products.go:326 pkg/quote.go:1007 pkg/expenses.go:375
#: pkg/products.go:326 pkg/quote.go:1007 pkg/expenses.go:376
#: pkg/invoices.go:1122
msgid "Selected tax is not valid."
msgstr "Habéis escogido un impuesto que no es válido."
#: pkg/products.go:327 pkg/quote.go:1008 pkg/expenses.go:376
#: pkg/products.go:327 pkg/quote.go:1008 pkg/expenses.go:377
#: pkg/invoices.go:1123
msgid "You can only select a tax of each class."
msgstr "Solo podéis escoger un impuesto de cada clase."
@ -1028,7 +1045,7 @@ msgctxt "input"
msgid "Quotation Status"
msgstr "Estado del presupuesto"
#: pkg/quote.go:154 pkg/expenses.go:512 pkg/invoices.go:154
#: pkg/quote.go:154 pkg/expenses.go:513 pkg/invoices.go:154
msgid "All status"
msgstr "Todos los estados"
@ -1037,12 +1054,12 @@ msgctxt "input"
msgid "Quotation Number"
msgstr "Número de presupuesto"
#: pkg/quote.go:164 pkg/expenses.go:497 pkg/invoices.go:164
#: pkg/quote.go:164 pkg/expenses.go:498 pkg/invoices.go:164
msgctxt "input"
msgid "From Date"
msgstr "A partir de la fecha"
#: pkg/quote.go:169 pkg/expenses.go:502 pkg/invoices.go:169
#: pkg/quote.go:169 pkg/expenses.go:503 pkg/invoices.go:169
msgctxt "input"
msgid "To Date"
msgstr "Hasta la fecha"
@ -1063,8 +1080,8 @@ msgstr "presupuestos.zip"
msgid "quotations.ods"
msgstr "presupuestos.ods"
#: pkg/quote.go:634 pkg/quote.go:1176 pkg/quote.go:1184 pkg/expenses.go:716
#: pkg/expenses.go:742 pkg/invoices.go:677 pkg/invoices.go:1306
#: pkg/quote.go:634 pkg/quote.go:1176 pkg/quote.go:1184 pkg/expenses.go:717
#: pkg/expenses.go:743 pkg/invoices.go:677 pkg/invoices.go:1306
#: pkg/invoices.go:1314
msgid "Invalid action"
msgstr "Acción inválida."
@ -1219,70 +1236,70 @@ msgctxt "period option"
msgid "Previous year"
msgstr "Año anterior"
#: pkg/expenses.go:233
#: pkg/expenses.go:234
msgid "Select a contact."
msgstr "Escoged un contacto"
#: pkg/expenses.go:290 pkg/expenses.go:486
#: pkg/expenses.go:291 pkg/expenses.go:487
msgctxt "input"
msgid "Contact"
msgstr "Contacto"
#: pkg/expenses.go:296
#: pkg/expenses.go:297
msgctxt "input"
msgid "Invoice number"
msgstr "Número de factura"
#: pkg/expenses.go:301 pkg/invoices.go:735
#: pkg/expenses.go:302 pkg/invoices.go:735
msgctxt "input"
msgid "Invoice Date"
msgstr "Fecha de factura"
#: pkg/expenses.go:316
#: pkg/expenses.go:317
msgctxt "input"
msgid "Amount"
msgstr "Importe"
#: pkg/expenses.go:327 pkg/invoices.go:757
#: pkg/expenses.go:328 pkg/invoices.go:757
msgctxt "input"
msgid "File"
msgstr "Archivo"
#: pkg/expenses.go:333 pkg/expenses.go:511
#: pkg/expenses.go:334 pkg/expenses.go:512
msgctxt "input"
msgid "Expense Status"
msgstr "Estado del gasto"
#: pkg/expenses.go:373
#: pkg/expenses.go:374
msgid "Selected contact is not valid."
msgstr "Habéis escogido un contacto que no es válido."
#: pkg/expenses.go:374 pkg/invoices.go:808
#: pkg/expenses.go:375 pkg/invoices.go:808
msgid "Invoice date must be a valid date."
msgstr "La fecha de factura debe ser válida."
#: pkg/expenses.go:377
#: pkg/expenses.go:378
msgid "Amount can not be empty."
msgstr "No podéis dejar el importe en blanco."
#: pkg/expenses.go:378
#: pkg/expenses.go:379
msgid "Amount must be a number greater than zero."
msgstr "El importe tiene que ser un número mayor a cero."
#: pkg/expenses.go:380
#: pkg/expenses.go:381
msgid "Selected expense status is not valid."
msgstr "Habéis escogido un estado de gasto que no es válido."
#: pkg/expenses.go:487
#: pkg/expenses.go:488
msgid "All contacts"
msgstr "Todos los contactos"
#: pkg/expenses.go:492 pkg/invoices.go:159
#: pkg/expenses.go:493 pkg/invoices.go:159
msgctxt "input"
msgid "Invoice Number"
msgstr "Número de factura"
#: pkg/expenses.go:740
#: pkg/expenses.go:741
msgid "expenses.ods"
msgstr "gastos.ods"
@ -1357,6 +1374,10 @@ msgctxt "input"
msgid "Holded Excel file"
msgstr "Archivo Excel de Holded"
#~ msgctxt "title"
#~ msgid "Switch Company"
#~ msgstr "Cambio de empresa"
#~ msgctxt "expense"
#~ msgid "All"
#~ msgstr "Todos"

View File

@ -29,6 +29,12 @@
{{( pgettext "Tax Details" "menu" )}}
</a>
</li>
<li role="presentation">
<a role="menuitem" href="{{ companyURI "/switch-company" }}" data-hx-boost="true">
<i class="ri-briefcase-line"></i>
{{( pgettext "Switch Company" "menu" )}}
</a>
</li>
<li role="presentation">
<form method="POST" action="/logout">
{{ csrfToken }}

View File

@ -0,0 +1,36 @@
{{ define "title" -}}
{{( pgettext "Company Switch" "title" )}}
{{- end }}
{{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.CompanySwitchPage*/ -}}
<nav data-hx-target="main" data-hx-boost="true">
<p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a>{{( pgettext "Company Switch" "title" )}}</a>
</p>
</nav>
{{- end }}
{{ define "content" }}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.CompanySwitchPage*/ -}}
<section class="dialog-content" id="switch-company-dialog-content" data-hx-target="this">
<h2>{{(pgettext "Company Switch" "title")}}</h2>
<table>
<thead>
<tr>
<th>{{( pgettext "Name" "title" )}}</th>
<th>{{( pgettext "Actions" "title" )}}</th>
</tr>
</thead>
<tbody>
{{ range .Companies -}}
<tr>
<td>{{ .Name }}</td>
<td><a href="/company/{{ .Slug }}/">{{( pgettext "Switch" "action" )}}</a></td>
</tr>
{{- end}}
</tbody>
</table>
</section>
{{- end }}