rentease/internal/server/handle_public.go
2024-07-14 23:43:14 +02:00

49 lines
1.4 KiB
Go

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())
// }
//}