rentease/internal/view/booking_form.templ
Ruidy 584d81f7bd
Some checks failed
CI / checks (push) Has been cancelled
feat(i18n): add language toggle and localize views
2026-01-09 16:09:20 -04:00

142 lines
4.1 KiB
Text

package view
import "github.com/rjNemo/rentease/internal/i18n"
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 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"
>
{ i18n.Localize(ctx, "booking.form.customer_info") }
</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">{ i18n.Localize(ctx, "booking.form.name") }</span>
</div>
<input
type="text"
id="name"
name="name"
value={ booking.Name }
required
autofocus
class="input input-bordered w-full"
/>
</label>
<label class="form-control w-full">
<div class="label">
<span class="label-text">{ i18n.Localize(ctx, "booking.form.phone_number") }</span>
</div>
<input
type="tel"
id="phone_number"
name="phone_number"
value={ booking.PhoneNumber }
class="input input-bordered w-full"
/>
</label>
<label class="form-control w-full">
<div class="label">
<span class="label-text">{ i18n.Localize(ctx, "booking.form.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">{ i18n.Localize(ctx, "booking.form.guests") }</span>
</div>
<input
type="number"
id="customer_number"
name="customer_number"
required
value={ booking.CustomerNumber }
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"
>
{ i18n.Localize(ctx, "booking.form.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">{ i18n.Localize(ctx, "booking.form.from") }</span>
</div>
<input
type="date"
id="from"
name="from"
value={ booking.From }
class="input input-bordered w-full"
/>
</label>
<label class="form-control w-full">
<div class="label">
<span class="label-text">{ i18n.Localize(ctx, "booking.form.to") }</span>
</div>
<input
type="date"
id="to"
name="to"
value={ booking.To }
class="input input-bordered w-full"
/>
</label>
<label class="form-control w-full">
<div class="label">
<span class="label-text">{ i18n.Localize(ctx, "booking.form.platform") }</span>
</div>
<select id="platform" name="platform" class="select select-bordered w-full">
<option value={ booking.Platform } selected>{ booking.Platform } </option>
for _, platform := range booking.Platforms {
<option value={ platform }>{ platform } </option>
}
</select>
</label>
<label class="form-control w-full">
<div class="label">
<span class="label-text">{ i18n.Localize(ctx, "booking.form.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">{ i18n.Localize(ctx, "booking.form.platform_fees") }</span>
</div>
<input
type="number"
id="platform_fees"
inputmode="decimal"
step="0.01"
name="platform_fees"
value={ booking.PlatformFees }
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">{ i18n.Localize(ctx, "action.update") }</button>
</div>
</form>
}