mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +00:00
RE18 translation (#22)
* translate the item for display in the invoice * add documentation to the makefile
This commit is contained in:
parent
620465f206
commit
5d826c21da
3 changed files with 37 additions and 10 deletions
23
Makefile
23
Makefile
|
|
@ -3,24 +3,31 @@ PORT=8000
|
||||||
DB_USER=ruidy
|
DB_USER=ruidy
|
||||||
DB_NAME=villafleurie
|
DB_NAME=villafleurie
|
||||||
|
|
||||||
build: format lint
|
build: format lint ## Build the binary
|
||||||
@docker build -t ${NAME}:latest .
|
@docker build -t ${NAME}:latest .
|
||||||
run: build
|
run: build ## Run the binary
|
||||||
@docker run -p ${PORT}:${PORT} -e DATABASE_URL="host=docker.for.mac.host.internal user=${DB_USER} database=${DB_NAME}" -e PORT=${PORT} ${NAME}
|
@docker run -p ${PORT}:${PORT} -e DATABASE_URL="host=docker.for.mac.host.internal user=${DB_USER} database=${DB_NAME}" -e PORT=${PORT} ${NAME}
|
||||||
dev:
|
dev: ## Run the binary in dev mode
|
||||||
@docker build -t ${NAME}:dev -f Dockerfile.dev .
|
@docker build -t ${NAME}:dev -f Dockerfile.dev .
|
||||||
@docker run -p ${PORT}:${PORT} --rm -v `pwd`:/app -v /app/tmp --name ${NAME} -e DATABASE_URL="host=docker.for.mac.host.internal user=${DB_USER} database=${DB_NAME}" -e PORT=${PORT} ${NAME}:dev
|
@docker run -p ${PORT}:${PORT} --rm -v `pwd`:/app -v /app/tmp --name ${NAME} -e DATABASE_URL="host=docker.for.mac.host.internal user=${DB_USER} database=${DB_NAME}" -e PORT=${PORT} ${NAME}:dev
|
||||||
test:
|
test: ## Run the tests
|
||||||
@go test ./...
|
@go test ./...
|
||||||
up-deps:
|
up-deps: ## Update dependencies
|
||||||
@go get -u ./...
|
@go get -u ./...
|
||||||
cron:
|
cron: ## Run the cron
|
||||||
@go run cmd/cron/main.go
|
@go run cmd/cron/main.go
|
||||||
format:
|
format: ## Format the code
|
||||||
@templ generate internal/views
|
@templ generate internal/views
|
||||||
@templ fmt .
|
@templ fmt .
|
||||||
@go fmt ./...
|
@go fmt ./...
|
||||||
lint:
|
lint: ## Lint the code
|
||||||
@golangci-lint run ./...
|
@golangci-lint run ./...
|
||||||
|
|
||||||
|
help: ## Display this help message
|
||||||
|
@echo "Usage: make [command]"
|
||||||
|
@echo
|
||||||
|
@echo "Commands:"
|
||||||
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-15s %s\n", $$1, $$2}'
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := help
|
||||||
.PHONY: build run dev templ format lint
|
.PHONY: build run dev templ format lint
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ func (b Booking) Serialize(hc *config.Host) map[string]any {
|
||||||
"to": b.To.Format("02/01/2006"),
|
"to": b.To.Format("02/01/2006"),
|
||||||
"lines": u.Map(b.Items, func(i Item) map[string]any {
|
"lines": u.Map(b.Items, func(i Item) map[string]any {
|
||||||
return map[string]any{
|
return map[string]any{
|
||||||
"name": i.Item,
|
"name": i.ToFrench(),
|
||||||
"quantity": i.Quantity,
|
"quantity": i.Quantity,
|
||||||
"price": i.Price,
|
"price": i.Price,
|
||||||
"total": i.Price * float64(i.Quantity),
|
"total": i.Price * float64(i.Quantity),
|
||||||
|
|
@ -86,3 +86,23 @@ type Item struct {
|
||||||
Quantity int
|
Quantity int
|
||||||
Price float64 `gorm:"type:decimal(10,2)"`
|
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
|
templ_7745c5c3_Var1 = templ.NopComponent
|
||||||
}
|
}
|
||||||
ctx = templ.ClearChildren(ctx)
|
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 {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue