booking form

This commit is contained in:
Ruidy 2025-06-23 20:12:50 +02:00
parent eaa40a62f3
commit 8b29657c36
No known key found for this signature in database
GPG key ID: E00F51288CB857CC
2 changed files with 68 additions and 57 deletions

View file

@ -1,12 +1,17 @@
package view
templ BookingForm(booking BookingViewModel) {
<form hx-put={ booking.Url } hx-swap="outerHTML" 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">
<form hx-put={ booking.Url } hx-swap="outerHTML" class="p-4 bg-base-200 rounded-lg shadow-lg w-[98%] mx-auto grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
<fieldset class="card bg-base-100 shadow-md p-6">
<h2
class="text-xl font-semibold mb-4 border-b pb-2 border-base-content/10"
>
Customer Information
</h2>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<label class="form-control w-full">
<div class="label">
<span class="label-text">Customer name</span>
<span class="label-text">Name</span>
</div>
<input
type="text"
@ -32,7 +37,19 @@ templ BookingForm(booking BookingViewModel) {
</label>
<label class="form-control w-full">
<div class="label">
<span class="label-text">Customer number</span>
<span class="label-text">Email</span>
</div>
<input
type="email"
id="email"
name="email"
value={ booking.Email }
class="input input-bordered w-full"
/>
</label>
<label class="form-control w-full">
<div class="label">
<span class="label-text">Number of guests</span>
</div>
<input
type="number"
@ -44,19 +61,14 @@ templ BookingForm(booking BookingViewModel) {
/>
</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"
value={ booking.Email }
class="input input-bordered w-full"
/>
</label>
</fieldset>
<fieldset class="card bg-base-100 shadow-md p-6">
<h2
class="text-xl font-semibold mb-4 border-b pb-2 border-base-content/10"
>
Booking Details
</h2>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<label class="form-control w-full">
<div class="label">
<span class="label-text">From</span>
@ -81,8 +93,6 @@ templ BookingForm(booking BookingViewModel) {
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>
@ -96,7 +106,19 @@ templ BookingForm(booking BookingViewModel) {
</label>
<label class="form-control w-full">
<div class="label">
<span class="label-text">Fees</span>
<span class="label-text">Platform ID</span>
</div>
<input
type="text"
id="external_id"
name="external_id"
value={ booking.ExternalId }
class="input input-bordered w-full"
/>
</label>
<label class="form-control w-full">
<div class="label">
<span class="label-text">Platform Fees</span>
</div>
<input
type="number"
@ -108,20 +130,9 @@ templ BookingForm(booking BookingViewModel) {
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"
value={ booking.ExternalId }
class="input input-bordered w-full"
/>
</label>
</div>
</fieldset>
<div></div>
<div class="mt-6 flex justify-end">
<button type="submit" class="btn btn-primary">Update</button>
</div>

View file

@ -42,14 +42,14 @@ func BookingForm(booking BookingViewModel) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" hx-swap=\"outerHTML\" 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\" value=\"")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" hx-swap=\"outerHTML\" class=\"p-4 bg-base-200 rounded-lg shadow-lg w-[98%] mx-auto grid grid-cols-1 md:grid-cols-2 gap-6 mb-8\"><fieldset class=\"card bg-base-100 shadow-md p-6\"><h2 class=\"text-xl font-semibold mb-4 border-b pb-2 border-base-content/10\">Customer Information</h2><div class=\"grid grid-cols-1 sm:grid-cols-2 gap-4\"><label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">Name</span></div><input type=\"text\" id=\"name\" name=\"name\" value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 15, Col: 26}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 20, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@ -62,46 +62,46 @@ func BookingForm(booking BookingViewModel) templ.Component {
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(booking.PhoneNumber)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 29, Col: 33}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 34, Col: 33}
}
_, 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, "\" 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\" id=\"customer_number\" name=\"customer_number\" required value=\"")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\" class=\"input input-bordered w-full\"></label> <label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">Email</span></div><input type=\"email\" id=\"email\" name=\"email\" value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(booking.CustomerNumber)
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Email)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 42, Col: 36}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 46, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\" 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\" value=\"")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\" class=\"input input-bordered w-full\"></label> <label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">Number of guests</span></div><input type=\"number\" id=\"customer_number\" name=\"customer_number\" required value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Email)
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(booking.CustomerNumber)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 56, Col: 27}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 59, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "\" class=\"input input-bordered w-full\"></label> <label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">From</span></div><input type=\"date\" id=\"from\" name=\"from\" value=\"")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "\" class=\"input input-bordered w-full\"></label></div></fieldset><fieldset class=\"card bg-base-100 shadow-md p-6\"><h2 class=\"text-xl font-semibold mb-4 border-b pb-2 border-base-content/10\">Booking Details</h2><div class=\"grid grid-cols-1 sm:grid-cols-2 gap-4\"><label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">From</span></div><input type=\"date\" id=\"from\" name=\"from\" value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(booking.From)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 68, Col: 26}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 80, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
@ -114,20 +114,20 @@ func BookingForm(booking BookingViewModel) templ.Component {
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(booking.To)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 80, Col: 24}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 92, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "\" 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\"><option value=\"")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "\" class=\"input input-bordered w-full\"></label> <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\"><option value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Platform)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 91, Col: 38}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 101, Col: 38}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
@ -140,7 +140,7 @@ func BookingForm(booking BookingViewModel) templ.Component {
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Platform)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 91, Col: 68}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 101, Col: 68}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil {
@ -158,7 +158,7 @@ func BookingForm(booking BookingViewModel) templ.Component {
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(platform)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 93, Col: 31}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 103, Col: 31}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
@ -171,7 +171,7 @@ func BookingForm(booking BookingViewModel) templ.Component {
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(platform)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 93, Col: 44}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 103, Col: 44}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil {
@ -182,33 +182,33 @@ func BookingForm(booking BookingViewModel) templ.Component {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "</select></label> <label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">Fees</span></div><input type=\"number\" id=\"platform_fees\" inputmode=\"decimal\" step=\"0.01\" name=\"platform_fees\" value=\"")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "</select></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\" value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(booking.PlatformFees)
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(booking.ExternalId)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 107, Col: 34}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 115, Col: 32}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "\" 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\" value=\"")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "\" class=\"input input-bordered w-full\"></label> <label class=\"form-control w-full\"><div class=\"label\"><span class=\"label-text\">Platform Fees</span></div><input type=\"number\" id=\"platform_fees\" inputmode=\"decimal\" step=\"0.01\" name=\"platform_fees\" value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(booking.ExternalId)
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(booking.PlatformFees)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 119, Col: 32}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 129, Col: 34}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "\" class=\"input input-bordered w-full\"></label></div></fieldset><div class=\"mt-6 flex justify-end\"><button type=\"submit\" class=\"btn btn-primary\">Update</button></div></form>")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "\" class=\"input input-bordered w-full\"></label></div></fieldset><div></div><div class=\"mt-6 flex justify-end\"><button type=\"submit\" class=\"btn btn-primary\">Update</button></div></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}