Do not include inactive campsite types in booking form
This commit is contained in:
parent
2ec363ca63
commit
a31f5038db
|
@ -174,7 +174,7 @@ func newBookingForm(ctx context.Context, company *auth.Company, conn *database.C
|
||||||
},
|
},
|
||||||
CampsiteType: &form.Select{
|
CampsiteType: &form.Select{
|
||||||
Name: "campsite_type",
|
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),
|
CampsiteTypeOptions: make(map[string][]*campsiteTypeOption),
|
||||||
ArrivalDate: &form.Input{
|
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)
|
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
|
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
|
where company_id = $2
|
||||||
|
and campsite_type.active
|
||||||
order by option.position, l10_name
|
order by option.position, l10_name
|
||||||
`, l.Language, company.ID)
|
`, l.Language, company.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue