improve month sync again

This commit is contained in:
Ruidy 2024-09-28 09:01:48 +02:00
parent d7e6b7891d
commit 3e7a07dc2a
No known key found for this signature in database
GPG key ID: E00F51288CB857CC
4 changed files with 16 additions and 15 deletions

View file

@ -86,7 +86,7 @@ func formatDate(date string) *time.Time {
months := map[string]string{
"janv.": "01", "févr.": "02", "mar": "03", "avr": "04",
"mai": "05", "juin": "06", "juil.": "07", "août": "08",
"sep": "09", "oct": "10", "nov": "11", "déc": "12",
"sep.": "09", "oct.": "10", "nov.": "11", "déc.": "12",
}
parts := strings.Split(date, " ")
dateString := fmt.Sprintf("%s-%02s-%02s", parts[2], months[parts[1]], parts[0])

View file

@ -13,15 +13,15 @@ templ BaseLayout() {
<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>
document.addEventListener("DOMContentLoaded", () => {
document.addEventListener("htmx:beforeSwap", (e) => {
if([422,401].includes(e.detail.xhr.status) ){
e.detail.shouldSwap = true
e.detail.isError = false
}
})
})
</script>
document.addEventListener("DOMContentLoaded", () => {
document.addEventListener("htmx:beforeSwap", (e) => {
if([422,401].includes(e.detail.xhr.status)) {
e.detail.shouldSwap = true
e.detail.isError = false
}
})
})
</script>
</head>
<body hx-boost="true" style="display: flex; flex-direction: column; min-height: 100vh;">
<nav class="container">

View file

@ -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\"><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\t\t\t\t\t\tdocument.addEventListener(\"DOMContentLoaded\", () => {\n\t\t\t\t\t\t\t\tdocument.addEventListener(\"htmx:beforeSwap\", (e) => {\n\t\t\t\t\t\t\t\t\t\tif([422,401].includes(e.detail.xhr.status) ){\n\t\t\t\t\t\t\t\t\t\t\t\te.detail.shouldSwap = true\n\t\t\t\t\t\t\t\t\t\t\t\te.detail.isError = false\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t})\n\t\t\t\t</script><style>\n\t\t\t\t/* Responsive navigation menu */\n\t\t\t\tnav ul {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: row;\n\t\t\t\t\talign-items: center;\n\t\t\t\t\tlist-style: none;\n\t\t\t\t\tpadding: 0;\n\t\t\t\t\tmargin: 0;\n\t\t\t\t}\n\n\t\t\t\t/* Dropdown menu for smaller screens */\n\t\t\t\t@media (max-width: 600px) {\n\t\t\t\t\tnav ul {\n\t\t\t\t\t\tflex-direction: column;\n\t\t\t\t\t}\n\t\t\t\t\tnav ul > li {\n\t\t\t\t\t\tmargin: 5px 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Container adjustments for a more flexible layout */\n\t\t\t\t.container {\n\t\t\t\t\tpadding: 0 1rem;\n\t\t\t\t}\n\t\t\t</style></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
}

View file

@ -43,17 +43,19 @@ func run(c context.Context, getEnv func(string) string) error {
TracesSampleRate: 1.0,
ProfilesSampleRate: 1.0,
}); err != nil {
return fmt.Errorf("error initializing sentry: %w", err)
return fmt.Errorf("error initializing sentry %w", err)
}
// init database
db, err := database.New(getEnv("DATABASE_URL"))
if err != nil {
return fmt.Errorf("error connecting to the database: %w", err)
return fmt.Errorf("error connecting to the database %w", err)
}
if err = database.Migrate(db, &booking.Booking{}, &booking.BookingRequest{}, &booking.Item{}); err != nil {
return fmt.Errorf("error migrating the database: %w", err)
return fmt.Errorf("error migrating the database %w", err)
}
gc, err := calendar.NewGoogleClient(ctx, getEnv("CALENDAR_CREDENTIALS"))
if err != nil {
return fmt.Errorf("error building calendar client %w", err)
@ -87,7 +89,6 @@ func run(c context.Context, getEnv func(string) string) error {
return fmt.Errorf("error starting auth service %w", err)
}
// starting server
p := getEnv("PORT")
port, err := strconv.Atoi(p)
if err != nil {