diff --git a/internal/server/handle_public.go b/internal/server/handle_public.go deleted file mode 100644 index 047ad36..0000000 --- a/internal/server/handle_public.go +++ /dev/null @@ -1,49 +0,0 @@ -package server - -//func handleHomePage() echo.HandlerFunc { -// return func(ctx echo.Context) error { -// return renderTempl(ctx, http.StatusOK, view.Index()) -// } -//} - -//func handleRequestBooking(bs *booking.Service) echo.HandlerFunc { -// return func(c echo.Context) error { -// itemStr := c.FormValue("item") -// fromStr := c.FormValue("from") -// toStr := c.FormValue("to") -// name := c.FormValue("item") -// phoneNumber := c.FormValue("phone") -// email := c.FormValue("email") -// -// from, fErr := myTime.ParseFromForm(fromStr) -// to, tErr := myTime.ParseFromForm(toStr) -// if fErr != nil || tErr != nil { -// return fmt.Errorf("error parsing booking request time: %q %q", fErr, tErr) -// } -// -// errs := make([]string, 0) -// if to.Sub(from) < time.Duration(0) { -// errs = append(errs, "invalid_time_range") -// } -// -// if phoneNumber == "" && email == "" { -// errs = append(errs, "missing_communication_method") -// } -// -// if len(errs) > 0 { -// return renderTempl(c, http.StatusOK, component.RequestBookingForm(&component.RequestBookingViewModel{ -// Item: itemStr, -// From: fromStr, -// To: toStr, -// Name: name, -// PhoneNumber: phoneNumber, -// Email: email, -// Errors: errs, -// })) -// } -// -// bs.CreateRequest(from, to, name, phoneNumber, email, itemStr, 1) -// -// return renderTempl(c, http.StatusSeeOther, view.Success()) -// } -//} diff --git a/internal/view/component/request_booking_form.templ b/internal/view/component/request_booking_form.templ deleted file mode 100644 index 0812053..0000000 --- a/internal/view/component/request_booking_form.templ +++ /dev/null @@ -1,117 +0,0 @@ -package component - -import "github.com/rjNemo/rentease/internal/config" - -type RequestBookingViewModel struct { - Item string - From string - To string - Name string - PhoneNumber string - Email string - Errors []string -} - -func makeItems() []string { - host := config.NewHost() - items := make([]string, 0, 2) - for _, i := range host.Items { - if i.Name == "T2" || i.Name == "T3" { - items = append(items, i.Name) - } - } - return items -} - -var items = makeItems() - -func (rbvm RequestBookingViewModel) invalidTimeRange() bool { - for _, e := range rbvm.Errors { - if e == "invalid_time_range" { - return true - } - } - return false -} - -func (rbvm RequestBookingViewModel) missingCommunicationMethod() bool { - for _, e := range rbvm.Errors { - if e == "missing_communication_method" { - return true - } - } - return false -} - -templ RequestBookingForm(rbvm *RequestBookingViewModel) { -
-
- - - -
-
- - - -
- - -
-} diff --git a/internal/view/component/request_booking_form_templ.go b/internal/view/component/request_booking_form_templ.go deleted file mode 100644 index 10ec41d..0000000 --- a/internal/view/component/request_booking_form_templ.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.793 -package component - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import "github.com/rjNemo/rentease/internal/config" - -type RequestBookingViewModel struct { - Item string - From string - To string - Name string - PhoneNumber string - Email string - Errors []string -} - -func makeItems() []string { - host := config.NewHost() - items := make([]string, 0, 2) - for _, i := range host.Items { - if i.Name == "T2" || i.Name == "T3" { - items = append(items, i.Name) - } - } - return items -} - -var items = makeItems() - -func (rbvm RequestBookingViewModel) invalidTimeRange() bool { - for _, e := range rbvm.Errors { - if e == "invalid_time_range" { - return true - } - } - return false -} - -func (rbvm RequestBookingViewModel) missingCommunicationMethod() bool { - for _, e := range rbvm.Errors { - if e == "missing_communication_method" { - return true - } - } - return false -} - -func RequestBookingForm(rbvm *RequestBookingViewModel) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/view/index.templ b/internal/view/index.templ deleted file mode 100644 index 16c8fbc..0000000 --- a/internal/view/index.templ +++ /dev/null @@ -1,25 +0,0 @@ -package view - -import ( - "github.com/rjNemo/rentease/internal/view/component" - "github.com/rjNemo/rentease/internal/view/layout" -) - -templ Index() { - @layout.PublicLayout() { -
-

Reserver votre sejour dès maintenant

-
- @component.RequestBookingForm(&component.RequestBookingViewModel{ - Item: "T2", - From: "", - To: "", - Name: "", - PhoneNumber: "", - Email: "", - Errors: nil, - }) -
-
- } -} diff --git a/internal/view/index_templ.go b/internal/view/index_templ.go deleted file mode 100644 index baaf5bf..0000000 --- a/internal/view/index_templ.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.793 -package view - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "github.com/rjNemo/rentease/internal/view/component" - "github.com/rjNemo/rentease/internal/view/layout" -) - -func Index() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Reserver votre sejour dès maintenant

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = component.RequestBookingForm(&component.RequestBookingViewModel{ - Item: "T2", - From: "", - To: "", - Name: "", - PhoneNumber: "", - Email: "", - Errors: nil, - }).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = layout.PublicLayout().Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/view/layout/public.templ b/internal/view/layout/public.templ deleted file mode 100644 index b7a0f66..0000000 --- a/internal/view/layout/public.templ +++ /dev/null @@ -1,79 +0,0 @@ -package layout - -import ( - "fmt" - "github.com/rjNemo/rentease/internal/config" -) - -type HostViewModel struct { - Name string - Address string - ZipCode string - City string - PhoneNumber string - PhoneUrl templ.SafeURL - Email string - EmailUrl templ.SafeURL - Items []Item -} - -type Item struct { - Name string - Url templ.SafeURL -} - -var host = config.NewHost() -var hvm = &HostViewModel{ - Name: host.Name, - PhoneNumber: host.PhoneNumber, - PhoneUrl: templ.SafeURL(fmt.Sprintf("tel:%s", host.PhoneNumber)), - Email: host.Email, - EmailUrl: templ.SafeURL(fmt.Sprintf("mailto:%s", host.Email)), - Items: []Item{ - {"T2 Corail", templ.URL("logements/t2")}, - {"T3 Azur", templ.URL("logements/t3")}, - }, -} - -templ PublicLayout() { - - - - { hvm.Name } | Locations de vacances au Gosier en Guadeloupe - - - - - - - - - -
- { children... } -
- - - -} diff --git a/internal/view/layout/public_templ.go b/internal/view/layout/public_templ.go deleted file mode 100644 index 3bc57b7..0000000 --- a/internal/view/layout/public_templ.go +++ /dev/null @@ -1,185 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.793 -package layout - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "fmt" - "github.com/rjNemo/rentease/internal/config" -) - -type HostViewModel struct { - Name string - Address string - ZipCode string - City string - PhoneNumber string - PhoneUrl templ.SafeURL - Email string - EmailUrl templ.SafeURL - Items []Item -} - -type Item struct { - Name string - Url templ.SafeURL -} - -var host = config.NewHost() -var hvm = &HostViewModel{ - Name: host.Name, - PhoneNumber: host.PhoneNumber, - PhoneUrl: templ.SafeURL(fmt.Sprintf("tel:%s", host.PhoneNumber)), - Email: host.Email, - EmailUrl: templ.SafeURL(fmt.Sprintf("mailto:%s", host.Email)), - Items: []Item{ - {"T2 Corail", templ.URL("logements/t2")}, - {"T3 Azur", templ.URL("logements/t3")}, - }, -} - -func PublicLayout() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(hvm.Name) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/layout/public.templ`, Line: 42, Col: 20} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | Locations de vacances au Gosier en Guadeloupe
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate