mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +00:00
translate the item for display in the invoice
This commit is contained in:
parent
620465f206
commit
5aa67ea1bf
2 changed files with 22 additions and 2 deletions
|
|
@ -50,7 +50,7 @@ func (b Booking) Serialize(hc *config.Host) map[string]any {
|
|||
"to": b.To.Format("02/01/2006"),
|
||||
"lines": u.Map(b.Items, func(i Item) map[string]any {
|
||||
return map[string]any{
|
||||
"name": i.Item,
|
||||
"name": i.ToFrench(),
|
||||
"quantity": i.Quantity,
|
||||
"price": i.Price,
|
||||
"total": i.Price * float64(i.Quantity),
|
||||
|
|
@ -86,3 +86,23 @@ type Item struct {
|
|||
Quantity int
|
||||
Price float64 `gorm:"type:decimal(10,2)"`
|
||||
}
|
||||
|
||||
// ToFrench translates the item name to french
|
||||
func (i Item) ToFrench() string {
|
||||
switch i.Item {
|
||||
case "T2":
|
||||
return "T2"
|
||||
case "T3":
|
||||
return "T3"
|
||||
case "Airport":
|
||||
return "Transport Aéroport"
|
||||
case "Port":
|
||||
return "Transport Gare Maritime"
|
||||
case "Transport":
|
||||
return "Transport"
|
||||
case "Taxes":
|
||||
return "Taxes de sejour"
|
||||
default:
|
||||
return i.Item
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ func BaseLayout() templ.Component {
|
|||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!doctype html><html lang=\"en\"><head><title>RentEase | Your Property Management System</title><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><meta name=\"description\" content=\"Property Management System\"><link rel=\"icon\" href=\"/static/icons/favicon-main.png\"><link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.purple.min.css\"><link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.jsdelivr.net/gh/devicons/devicon@latest/devicon.min.css\"><script src=\"/static/js/htmx.js\" defer></script><script defer src=\"https://cdn.jsdelivr.net/npm/alpinejs@3.14.0/dist/cdn.min.js\"></script><script>\n document.addEventListener(\"DOMContentLoaded\", () => {\n document.addEventListener(\"htmx:beforeSwap\", (e) => {\n if([422,401].includes(e.detail.xhr.status)) {\n e.detail.shouldSwap = true\n e.detail.isError = false\n }\n })\n })\n </script></head><body hx-boost=\"true\" style=\"display: flex; flex-direction: column; min-height: 100vh;\"><nav class=\"container\"><ul><li><a href=\"/\"><b>🏨 RentEase </b></a></li></ul><ul><li><a href=\"/bookings\">Bookings</a></li><li><a href=\"/reports\">Reports</a></li><li><a href=\"/bookings/new\" role=\"button\">New Booking</a></li></ul></nav><main class=\"container\" style=\"flex: 1 0 auto;\">")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!doctype html><html lang=\"en\"><head><title>RentEase | Your Property Management System</title><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><meta name=\"description\" content=\"Property Management System\"><link rel=\"icon\" href=\"/static/icons/favicon-main.png\"><link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.purple.min.css\"><script src=\"/static/js/htmx.js\" defer></script><script defer src=\"https://cdn.jsdelivr.net/npm/alpinejs@3.14.0/dist/cdn.min.js\"></script><script>\n document.addEventListener(\"DOMContentLoaded\", () => {\n document.addEventListener(\"htmx:beforeSwap\", (e) => {\n if([422,401].includes(e.detail.xhr.status)) {\n e.detail.shouldSwap = true\n e.detail.isError = false\n }\n })\n })\n </script></head><body hx-boost=\"true\" style=\"display: flex; flex-direction: column; min-height: 100vh;\"><nav class=\"container\"><ul><li><a href=\"/\"><b>🏨 RentEase </b></a></li></ul><ul><li><a href=\"/bookings\">Bookings</a></li><li><a href=\"/reports\">Reports</a></li><li><a href=\"/bookings/new\" role=\"button\">New Booking</a></li></ul></nav><main class=\"container\" style=\"flex: 1 0 auto;\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue