Do not include inactive campsite types in booking form

This commit is contained in:
jordi fita mas 2024-01-29 03:03:20 +01:00
parent 2ec363ca63
commit a31f5038db
1 changed files with 2 additions and 1 deletions

View File

@ -174,7 +174,7 @@ func newBookingForm(ctx context.Context, company *auth.Company, conn *database.C
},
CampsiteType: &form.Select{
Name: "campsite_type",
Options: form.MustGetOptions(ctx, conn, "select type.slug, coalesce(i18n.name, type.name) as l10n_name from campsite_type as type left join campsite_type_i18n as i18n on type.campsite_type_id = i18n.campsite_type_id and i18n.lang_tag = $1 where company_id = $2 order by position, l10n_name", l.Language, company.ID),
Options: form.MustGetOptions(ctx, conn, "select type.slug, coalesce(i18n.name, type.name) as l10n_name from campsite_type as type left join campsite_type_i18n as i18n on type.campsite_type_id = i18n.campsite_type_id and i18n.lang_tag = $1 where company_id = $2 and active order by position, l10n_name", l.Language, company.ID),
},
CampsiteTypeOptions: make(map[string][]*campsiteTypeOption),
ArrivalDate: &form.Input{
@ -204,6 +204,7 @@ func newBookingForm(ctx context.Context, company *auth.Company, conn *database.C
join campsite_type using (campsite_type_id)
left join campsite_type_option_i18n as i18n on i18n.campsite_type_option_id = option.campsite_type_option_id and i18n.lang_tag = $1
where company_id = $2
and campsite_type.active
order by option.position, l10_name
`, l.Language, company.ID)
if err != nil {