rentease/internal/view/bookings_new_templ.go
2025-03-23 23:06:19 +01:00

96 lines
6.4 KiB
Go

// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.856
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/layout"
func NewBooking(platforms []string) 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<section class=\"flex justify-between items-center p-4 bg-base-100\"><hgroup class=\"flex flex-col\"><h1 class=\"text-3xl font-bold text-primary\">New Booking</h1><h2 class=\"text-lg text-muted\">Create a new booking</h2></hgroup></section><form method=\"POST\" class=\"p-4 bg-base-200 rounded-lg shadow-lg w-[98%] mx-auto\"><fieldset class=\"space-y-6\"><div class=\"grid grid-cols-1 md:grid-cols-3 gap-4\"><label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">Customer name</span></div><input type=\"text\" id=\"name\" name=\"name\" placeholder=\"John Doe\" required autofocus class=\"input input-bordered w-full\"></label> <label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">Phone number</span></div><input type=\"tel\" id=\"phone_number\" name=\"phone_number\" placeholder=\"06 12 34 56 78\" class=\"input input-bordered w-full\"></label> <label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">Customer number</span></div><input type=\"number\" inputmode=\"numeric\" id=\"customer_number\" name=\"customer_number\" placeholder=\"1\" required class=\"input input-bordered w-full\"></label></div><div class=\"grid grid-cols-1 md:grid-cols-3 gap-4\"><label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">Email</span></div><input type=\"email\" id=\"email\" name=\"email\" placeholder=\"john@doe.com\" class=\"input input-bordered w-full\"></label> <label class=\"form-control\"><div class=\"label\"><span class=\"label-text\">From</span></div><input type=\"date\" id=\"from\" name=\"from\" required class=\"input input-bordered w-full\"></label> <label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">To</span></div><input type=\"date\" id=\"to\" name=\"to\" required class=\"input input-bordered w-full\"></label></div><div class=\"grid grid-cols-1 md:grid-cols-3 gap-4\"><label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">Platform</span></div><select id=\"platform\" name=\"platform\" class=\"select select-bordered w-full\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, platform := range platforms {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<option value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(platform)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/bookings_new.templ`, Line: 62, Col: 32}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(platform)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/bookings_new.templ`, Line: 62, Col: 45}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</option>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</select></label> <label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">Fees</span></div><input type=\"number\" inputmode=\"decimal\" step=\"0.01\" id=\"platform_fees\" name=\"platform_fees\" placeholder=\"0\" class=\"input input-bordered w-full\"></label> <label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">Platform ID</span></div><input type=\"text\" id=\"external_id\" name=\"external_id\" placeholder=\"XXX-XXXX-XX\" class=\"input input-bordered w-full\"></label></div><div class=\"mt-6 flex justify-end\"><button type=\"submit\" class=\"btn btn-primary\">Submit</button></div></fieldset></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = layout.BaseLayout().Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate