diff --git a/demo/demo.sql b/demo/demo.sql index 12dd57f..a16cd57 100644 --- a/demo/demo.sql +++ b/demo/demo.sql @@ -127,11 +127,11 @@ select translate_services_carousel_slide(63, 'en', 'Safari Tents'); select translate_services_carousel_slide(63, 'es', 'Tiendas Safari'); alter table campsite_type alter column campsite_type_id restart with 72; -select add_campsite_type(52, 62, 'Parceŀles', '

Acampa enmig de la natura

Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.

Parcel·les amples amb serveis a prop d’on ets per fer allò que vols.

', '

Proxo/terrassa (13 m²)

Planta baixa (32 m²)

Planta altell (16 m²)

', '

El preu inclou

* Tovalloles: preu extra

', '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

', '', '15 h a 21 h', '12 h', 6, true); -select add_campsite_type(52, 63, 'Safari Tents', '

Glàmping a la teva disposició

Un luxe de tendes per viure aventures.

Dues tendes amb terra de fusta, llits, cuina i tot de comoditats per gaudir de les teves vacances.

', '

Proxo/terrassa (13 m²)

Planta baixa (32 m²)

Planta altell (16 m²)

', '

El preu inclou

* Tovalloles: preu extra

', '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

', '', '16 h a 21 h', '10 h', 6, false); -select add_campsite_type(52, 64, 'Bungalous', '

Allotjaments de luxe

Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.

Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.

', '

Proxo/terrassa (13 m²)

Planta baixa (32 m²)

Planta altell (16 m²)

', '

El preu inclou

* Tovalloles: preu extra

', '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

', '', '15 h a 21 h', '12 h', 5, false); -select add_campsite_type(52, 65, 'Bungalous prèmium', '

Allotjaments de luxe

Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.

Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.

', '

Proxo/terrassa (13 m²)

Planta baixa (32 m²)

Planta altell (16 m²)

', '

El preu inclou

* Tovalloles: preu extra

', '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

', '', '15 h a 21 h', '12 h', 5, false); -select add_campsite_type(52, 66, 'Cabanes de fusta', '

Allotjaments de luxe

Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.

Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.

', '

Proxo/terrassa (13 m²)

Planta baixa (32 m²)

Planta altell (16 m²)

', '

El preu inclou

* Tovalloles: preu extra

', '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

', '', '15 h a 21 h', '12 h', 5, false); +select add_campsite_type(52, 62, 'Parceŀles', '

Acampa enmig de la natura

Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.

Parcel·les amples amb serveis a prop d’on ets per fer allò que vols.

', '

Proxo/terrassa (13 m²)

Planta baixa (32 m²)

Planta altell (16 m²)

', '

El preu inclou

* Tovalloles: preu extra

', '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

', '', '15 h a 21 h', '12 h', 6, true, true, true); +select add_campsite_type(52, 63, 'Safari Tents', '

Glàmping a la teva disposició

Un luxe de tendes per viure aventures.

Dues tendes amb terra de fusta, llits, cuina i tot de comoditats per gaudir de les teves vacances.

', '

Proxo/terrassa (13 m²)

Planta baixa (32 m²)

Planta altell (16 m²)

', '

El preu inclou

* Tovalloles: preu extra

', '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

', '', '16 h a 21 h', '10 h', 6, false, false, false); +select add_campsite_type(52, 64, 'Bungalous', '

Allotjaments de luxe

Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.

Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.

', '

Proxo/terrassa (13 m²)

Planta baixa (32 m²)

Planta altell (16 m²)

', '

El preu inclou

* Tovalloles: preu extra

', '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

', '', '15 h a 21 h', '12 h', 5, false, false, false); +select add_campsite_type(52, 65, 'Bungalous prèmium', '

Allotjaments de luxe

Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.

Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.

', '

Proxo/terrassa (13 m²)

Planta baixa (32 m²)

Planta altell (16 m²)

', '

El preu inclou

* Tovalloles: preu extra

', '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

', '', '15 h a 21 h', '12 h', 5, false, false, false); +select add_campsite_type(52, 66, 'Cabanes de fusta', '

Allotjaments de luxe

Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.

Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.

', '

Proxo/terrassa (13 m²)

Planta baixa (32 m²)

Planta altell (16 m²)

', '

El preu inclou

* Tovalloles: preu extra

', '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

', '', '15 h a 21 h', '12 h', 5, false, false, false); insert into campsite_type_i18n (campsite_type_id, lang_tag, name, spiel, info, facilities, description, additional_info, check_in, check_out) values (72, 'en', 'Plots', '

Camp in the middle of nature

Located on the campground’s mountain-side and overlooking the nature that surrounds us.

Large plots with serivces close to where you are to do what you want.

', '

Porch/terrace (13 m²)

First floor (32 m²)

Loft floor (16 m²)

', '

Price includes

* Towels: extra cost

', '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

', '', '3 p.m. to 9 p.m.', '12 a.m.') diff --git a/deploy/add_campsite_type.sql b/deploy/add_campsite_type.sql index ad5825b..5130991 100644 --- a/deploy/add_campsite_type.sql +++ b/deploy/add_campsite_type.sql @@ -3,23 +3,26 @@ -- requires: schema_camper -- requires: campsite_type -- requires: company +-- requires: campsite_type__check_in_out +-- requires: campsite_type__overflow_allowed +-- requires: campsite_type__ask_zone_preferences begin; set search_path to camper, public; -drop function if exists add_campsite_type(integer, integer, text, text, text, text, text, text, integer, boolean); +drop function if exists add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean); -create or replace function add_campsite_type(company integer, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, dogs_allowed boolean) returns uuid as +create or replace function add_campsite_type(company integer, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, dogs_allowed boolean, overflow_allowed boolean, ask_zone_preferences boolean) returns uuid as $$ - insert into campsite_type (company_id, media_id, name, spiel, info, facilities, description, additional_info, check_in, check_out, max_campers, dogs_allowed) - values (company, media_id, name, xmlparse(content spiel), xmlparse(content info), xmlparse(content facilities), xmlparse(content description), xmlparse(content additional_info), check_in, check_out, max_campers, dogs_allowed) + insert into campsite_type (company_id, media_id, name, spiel, info, facilities, description, additional_info, check_in, check_out, max_campers, dogs_allowed, overflow_allowed, ask_zone_preferences) + values (company, media_id, name, xmlparse(content spiel), xmlparse(content info), xmlparse(content facilities), xmlparse(content description), xmlparse(content additional_info), check_in, check_out, max_campers, dogs_allowed, overflow_allowed, ask_zone_preferences) returning slug; $$ language sql ; -revoke execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean) from public; -grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean) to admin; +revoke execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean, boolean) from public; +grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean, boolean) to admin; commit; diff --git a/deploy/add_campsite_type@v2.sql b/deploy/add_campsite_type@v2.sql new file mode 100644 index 0000000..ad5825b --- /dev/null +++ b/deploy/add_campsite_type@v2.sql @@ -0,0 +1,25 @@ +-- Deploy camper:add_campsite_type to pg +-- requires: roles +-- requires: schema_camper +-- requires: campsite_type +-- requires: company + +begin; + +set search_path to camper, public; + +drop function if exists add_campsite_type(integer, integer, text, text, text, text, text, text, integer, boolean); + +create or replace function add_campsite_type(company integer, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, dogs_allowed boolean) returns uuid as +$$ + insert into campsite_type (company_id, media_id, name, spiel, info, facilities, description, additional_info, check_in, check_out, max_campers, dogs_allowed) + values (company, media_id, name, xmlparse(content spiel), xmlparse(content info), xmlparse(content facilities), xmlparse(content description), xmlparse(content additional_info), check_in, check_out, max_campers, dogs_allowed) + returning slug; +$$ + language sql +; + +revoke execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean) from public; +grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean) to admin; + +commit; diff --git a/deploy/campsite_type__ask_zone_preferences.sql b/deploy/campsite_type__ask_zone_preferences.sql new file mode 100644 index 0000000..0cafea5 --- /dev/null +++ b/deploy/campsite_type__ask_zone_preferences.sql @@ -0,0 +1,10 @@ +-- Deploy camper:campsite_type__ask_zone_preferences to pg +-- requires: campsite_type + +begin; + +alter table camper.campsite_type +add column ask_zone_preferences boolean not null default false +; + +commit; diff --git a/deploy/campsite_type__overflow_allowed.sql b/deploy/campsite_type__overflow_allowed.sql new file mode 100644 index 0000000..60a1953 --- /dev/null +++ b/deploy/campsite_type__overflow_allowed.sql @@ -0,0 +1,10 @@ +-- Deploy camper:campsite_type__overflow_allowed to pg +-- requires: campsite_type + +begin; + +alter table camper.campsite_type +add column overflow_allowed boolean not null default false +; + +commit; diff --git a/deploy/edit_campsite_type.sql b/deploy/edit_campsite_type.sql index 0abfe8a..81efa25 100644 --- a/deploy/edit_campsite_type.sql +++ b/deploy/edit_campsite_type.sql @@ -3,14 +3,17 @@ -- requires: schema_camper -- requires: campsite_type -- requires: company +-- requires: campsite_type__check_in_out +-- requires: campsite_type__overflow_allowed +-- requires: campsite_type__ask_zone_preferences begin; set search_path to camper, public; -drop function if exists edit_campsite_type(uuid, integer, text, text, text, text, text, text, integer, boolean, boolean); +drop function if exists edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean); -create or replace function edit_campsite_type(slug uuid, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, dogs_allowed boolean, active boolean) returns uuid as +create or replace function edit_campsite_type(slug uuid, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, dogs_allowed boolean, overflow_allowed boolean, ask_zone_preferences boolean, active boolean) returns uuid as $$ update campsite_type set name = edit_campsite_type.name @@ -24,6 +27,8 @@ $$ , media_id = coalesce(edit_campsite_type.media_id, campsite_type.media_id) , max_campers = edit_campsite_type.max_campers , dogs_allowed = edit_campsite_type.dogs_allowed + , overflow_allowed = edit_campsite_type.overflow_allowed + , ask_zone_preferences = edit_campsite_type.ask_zone_preferences , active = edit_campsite_type.active where slug = edit_campsite_type.slug returning slug; @@ -31,7 +36,7 @@ $$ language sql ; -revoke execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean) from public; -grant execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean) to admin; +revoke execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean, boolean, boolean) from public; +grant execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean, boolean, boolean) to admin; commit; diff --git a/deploy/edit_campsite_type@v2.sql b/deploy/edit_campsite_type@v2.sql new file mode 100644 index 0000000..0abfe8a --- /dev/null +++ b/deploy/edit_campsite_type@v2.sql @@ -0,0 +1,37 @@ +-- Deploy camper:edit_campsite_type to pg +-- requires: roles +-- requires: schema_camper +-- requires: campsite_type +-- requires: company + +begin; + +set search_path to camper, public; + +drop function if exists edit_campsite_type(uuid, integer, text, text, text, text, text, text, integer, boolean, boolean); + +create or replace function edit_campsite_type(slug uuid, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, dogs_allowed boolean, active boolean) returns uuid as +$$ + update campsite_type + set name = edit_campsite_type.name + , spiel = xmlparse(content edit_campsite_type.spiel) + , description = xmlparse(content edit_campsite_type.description) + , info = xmlparse(content edit_campsite_type.info) + , additional_info = xmlparse(content edit_campsite_type.additional_info) + , check_in = edit_campsite_type.check_in + , check_out = edit_campsite_type.check_out + , facilities = xmlparse(content edit_campsite_type.facilities) + , media_id = coalesce(edit_campsite_type.media_id, campsite_type.media_id) + , max_campers = edit_campsite_type.max_campers + , dogs_allowed = edit_campsite_type.dogs_allowed + , active = edit_campsite_type.active + where slug = edit_campsite_type.slug + returning slug; +$$ +language sql +; + +revoke execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean) from public; +grant execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean) to admin; + +commit; diff --git a/pkg/booking/public.go b/pkg/booking/public.go index 3f0ee89..70f046f 100644 --- a/pkg/booking/public.go +++ b/pkg/booking/public.go @@ -136,7 +136,7 @@ type bookingForm struct { CampsiteTypeOptions map[string][]*campsiteTypeOption ArrivalDate *form.Input DepartureDate *form.Input - AreaPreferences *form.Input + ZonePreferences map[string]*form.Input ACSICard *form.Checkbox Agreement *form.Checkbox } @@ -149,7 +149,43 @@ type campsiteTypeOption struct { } func newBookingForm(ctx context.Context, company *auth.Company, conn *database.Conn, l *locale.Locale) *bookingForm { - f := &bookingForm{ + var typeSelectOptions []*form.Option + zonePreferences := make(map[string]*form.Input) + rows, err := conn.Query(ctx, ` + select type.slug + , coalesce(i18n.name, type.name) as l10n_name + , ask_zone_preferences + 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) + if err != nil { + panic(err) + } + defer rows.Close() + + for rows.Next() { + option := &form.Option{} + var ask bool + if err = rows.Scan(&option.Value, &option.Label, &ask); err != nil { + panic(err) + } + typeSelectOptions = append(typeSelectOptions, option) + if ask { + zonePreferences[option.Value] = &form.Input{ + Name: "zone_preferences_" + option.Value, + } + } + } + if rows.Err() != nil { + panic(rows.Err()) + } + + return &bookingForm{ FullName: &form.Input{ Name: "full_name", }, @@ -174,18 +210,16 @@ 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 and active order by position, l10n_name", l.Language, company.ID), + Options: typeSelectOptions, }, - CampsiteTypeOptions: make(map[string][]*campsiteTypeOption), + CampsiteTypeOptions: mustGetCampsiteTypeOptions(ctx, conn, company, l), ArrivalDate: &form.Input{ Name: "arrival_date", }, DepartureDate: &form.Input{ Name: "departure_date", }, - AreaPreferences: &form.Input{ - Name: "area_preferences", - }, + ZonePreferences: zonePreferences, ACSICard: &form.Checkbox{ Name: "acsi_card", }, @@ -193,6 +227,9 @@ func newBookingForm(ctx context.Context, company *auth.Company, conn *database.C Name: "agreement", }, } +} + +func mustGetCampsiteTypeOptions(ctx context.Context, conn *database.Conn, company *auth.Company, l *locale.Locale) map[string][]*campsiteTypeOption { rows, err := conn.Query(ctx, ` select 'campsite_type_option_' || option.campsite_type_option_id , slug @@ -210,21 +247,24 @@ func newBookingForm(ctx context.Context, company *auth.Company, conn *database.C if err != nil { panic(err) } + defer rows.Close() + options := make(map[string][]*campsiteTypeOption) for rows.Next() { var slug string option := &campsiteTypeOption{ Input: &form.Input{}, } - if err := rows.Scan(&option.Input.Name, &slug, &option.Label, &option.Input.Val, &option.Min, &option.Max); err != nil { + if err = rows.Scan(&option.Input.Name, &slug, &option.Label, &option.Input.Val, &option.Min, &option.Max); err != nil { panic(err) } - f.CampsiteTypeOptions[slug] = append(f.CampsiteTypeOptions[slug], option) + options[slug] = append(options[slug], option) } if rows.Err() != nil { panic(rows.Err()) } - return f + return options } + func (f *bookingForm) Parse(r *http.Request) error { if err := r.ParseForm(); err != nil { return err @@ -239,9 +279,11 @@ func (f *bookingForm) Parse(r *http.Request) error { f.CampsiteType.FillValue(r) f.ArrivalDate.FillValue(r) f.DepartureDate.FillValue(r) - f.AreaPreferences.FillValue(r) f.ACSICard.FillValue(r) f.Agreement.FillValue(r) + for _, preferences := range f.ZonePreferences { + preferences.FillValue(r) + } for _, options := range f.CampsiteTypeOptions { for _, option := range options { option.Input.FillValue(r) diff --git a/pkg/campsite/types/admin.go b/pkg/campsite/types/admin.go index 0634f39..2ded84a 100644 --- a/pkg/campsite/types/admin.go +++ b/pkg/campsite/types/admin.go @@ -167,7 +167,7 @@ func addType(w http.ResponseWriter, r *http.Request, user *auth.User, company *a } processTypeForm(w, r, user, company, conn, f, func(ctx context.Context, tx *database.Tx) error { var err error - f.Slug, err = tx.AddCampsiteType(ctx, company.ID, f.Media.Int(), f.Name[f.DefaultLang].Val, f.Spiel[f.DefaultLang].Val, f.Info[f.DefaultLang].Val, f.Facilities[f.DefaultLang].Val, f.Description[f.DefaultLang].Val, f.AdditionalInfo[f.DefaultLang].Val, f.CheckIn[f.DefaultLang].Val, f.CheckOut[f.DefaultLang].Val, f.MaxCampers.Int(), f.DogsAllowed.Checked) + f.Slug, err = tx.AddCampsiteType(ctx, company.ID, f.Media.Int(), f.Name[f.DefaultLang].Val, f.Spiel[f.DefaultLang].Val, f.Info[f.DefaultLang].Val, f.Facilities[f.DefaultLang].Val, f.Description[f.DefaultLang].Val, f.AdditionalInfo[f.DefaultLang].Val, f.CheckIn[f.DefaultLang].Val, f.CheckOut[f.DefaultLang].Val, f.MaxCampers.Int(), f.DogsAllowed.Checked, f.OverflowAllowed.Checked, f.AskZonePreferences.Checked) if err != nil { return err } @@ -202,7 +202,7 @@ func setTypePrices(ctx context.Context, tx *database.Tx, slug string, prices map func editType(w http.ResponseWriter, r *http.Request, user *auth.User, company *auth.Company, conn *database.Conn, f *typeForm) { processTypeForm(w, r, user, company, conn, f, func(ctx context.Context, tx *database.Tx) error { - if _, err := tx.EditCampsiteType(ctx, f.Slug, f.Media.Int(), f.Name[f.DefaultLang].Val, f.Spiel[f.DefaultLang].Val, f.Info[f.DefaultLang].Val, f.Facilities[f.DefaultLang].Val, f.Description[f.DefaultLang].Val, f.AdditionalInfo[f.DefaultLang].Val, f.CheckIn[f.DefaultLang].Val, f.CheckOut[f.DefaultLang].Val, f.MaxCampers.Int(), f.DogsAllowed.Checked, f.Active.Checked); err != nil { + if _, err := tx.EditCampsiteType(ctx, f.Slug, f.Media.Int(), f.Name[f.DefaultLang].Val, f.Spiel[f.DefaultLang].Val, f.Info[f.DefaultLang].Val, f.Facilities[f.DefaultLang].Val, f.Description[f.DefaultLang].Val, f.AdditionalInfo[f.DefaultLang].Val, f.CheckIn[f.DefaultLang].Val, f.CheckOut[f.DefaultLang].Val, f.MaxCampers.Int(), f.DogsAllowed.Checked, f.OverflowAllowed.Checked, f.AskZonePreferences.Checked, f.Active.Checked); err != nil { return err } if err := translateTypes(ctx, tx, company, f); err != nil { @@ -270,21 +270,23 @@ func processTypeForm(w http.ResponseWriter, r *http.Request, user *auth.User, co } type typeForm struct { - DefaultLang string - Slug string - Active *form.Checkbox - Media *form.Media - Name form.I18nInput - MaxCampers *form.Input - DogsAllowed *form.Checkbox - Spiel form.I18nInput - Info form.I18nInput - Facilities form.I18nInput - Description form.I18nInput - AdditionalInfo form.I18nInput - CheckIn form.I18nInput - CheckOut form.I18nInput - Prices map[int]*typePriceForm + DefaultLang string + Slug string + Active *form.Checkbox + Media *form.Media + Name form.I18nInput + MaxCampers *form.Input + DogsAllowed *form.Checkbox + OverflowAllowed *form.Checkbox + AskZonePreferences *form.Checkbox + Spiel form.I18nInput + Info form.I18nInput + Facilities form.I18nInput + Description form.I18nInput + AdditionalInfo form.I18nInput + CheckIn form.I18nInput + CheckOut form.I18nInput + Prices map[int]*typePriceForm } type typePriceForm struct { @@ -314,6 +316,12 @@ func newTypeForm(ctx context.Context, company *auth.Company, conn *database.Conn DogsAllowed: &form.Checkbox{ Name: "dogs_allowed", }, + OverflowAllowed: &form.Checkbox{ + Name: "overflow_allowed", + }, + AskZonePreferences: &form.Checkbox{ + Name: "ask_zone_preferences", + }, Spiel: form.NewI18nInput(company.Locales, "spiel"), Info: form.NewI18nInput(company.Locales, "info"), Facilities: form.NewI18nInput(company.Locales, "facilities"), @@ -374,6 +382,8 @@ func (f *typeForm) FillFromDatabase(ctx context.Context, conn *database.Conn, sl , media_id::text , max_campers::text , dogs_allowed + , overflow_allowed + , ask_zone_preferences , active , array_agg((lang_tag, i18n.name)) , array_agg((lang_tag, i18n.spiel::text)) @@ -397,9 +407,11 @@ func (f *typeForm) FillFromDatabase(ctx context.Context, conn *database.Conn, sl , media_id::text , max_campers::text , dogs_allowed + , overflow_allowed + , ask_zone_preferences , active `, pgx.QueryResultFormats{pgx.BinaryFormatCode}, slug) - if err := row.Scan(&f.Name[f.DefaultLang].Val, &f.Spiel[f.DefaultLang].Val, &f.Info[f.DefaultLang].Val, &f.Facilities[f.DefaultLang].Val, &f.Description[f.DefaultLang].Val, &f.AdditionalInfo[f.DefaultLang].Val, &f.CheckIn[f.DefaultLang].Val, &f.CheckOut[f.DefaultLang].Val, &f.Media.Val, &f.MaxCampers.Val, &f.DogsAllowed.Checked, &f.Active.Checked, &name, &spiel, &info, &facilities, &description, &additionalInfo, &checkIn, &checkOut); err != nil { + if err := row.Scan(&f.Name[f.DefaultLang].Val, &f.Spiel[f.DefaultLang].Val, &f.Info[f.DefaultLang].Val, &f.Facilities[f.DefaultLang].Val, &f.Description[f.DefaultLang].Val, &f.AdditionalInfo[f.DefaultLang].Val, &f.CheckIn[f.DefaultLang].Val, &f.CheckOut[f.DefaultLang].Val, &f.Media.Val, &f.MaxCampers.Val, &f.DogsAllowed.Checked, &f.OverflowAllowed.Checked, &f.AskZonePreferences.Checked, &f.Active.Checked, &name, &spiel, &info, &facilities, &description, &additionalInfo, &checkIn, &checkOut); err != nil { return err } if err := f.Name.FillArray(name); err != nil { @@ -463,6 +475,8 @@ func (f *typeForm) Parse(r *http.Request) error { f.Name.FillValue(r) f.MaxCampers.FillValue(r) f.DogsAllowed.FillValue(r) + f.OverflowAllowed.FillValue(r) + f.AskZonePreferences.FillValue(r) f.Spiel.FillValue(r) f.Info.FillValue(r) f.Facilities.FillValue(r) diff --git a/pkg/database/funcs.go b/pkg/database/funcs.go index a970f55..512cad3 100644 --- a/pkg/database/funcs.go +++ b/pkg/database/funcs.go @@ -130,12 +130,12 @@ func (c *Conn) RemoveCampsiteFeature(ctx context.Context, id int) error { return err } -func (tx *Tx) AddCampsiteType(ctx context.Context, companyID int, mediaID int, name string, spiel string, info string, facilities string, description string, additionalInfo string, checkIn string, checkOut string, maxCampers int, dogsAllowed bool) (string, error) { - return tx.GetText(ctx, "select add_campsite_type($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)", companyID, mediaID, name, spiel, info, facilities, description, additionalInfo, checkIn, checkOut, maxCampers, dogsAllowed) +func (tx *Tx) AddCampsiteType(ctx context.Context, companyID int, mediaID int, name string, spiel string, info string, facilities string, description string, additionalInfo string, checkIn string, checkOut string, maxCampers int, dogsAllowed bool, overflowAllowed bool, askZonePreferences bool) (string, error) { + return tx.GetText(ctx, "select add_campsite_type($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)", companyID, mediaID, name, spiel, info, facilities, description, additionalInfo, checkIn, checkOut, maxCampers, dogsAllowed, overflowAllowed, askZonePreferences) } -func (tx *Tx) EditCampsiteType(ctx context.Context, slug string, mediaID int, name string, spiel string, info string, facilities string, description string, additionalInfo string, checkIn string, checkOut string, maxCampers int, dogsAllowed bool, active bool) (string, error) { - return tx.GetText(ctx, "select edit_campsite_type($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)", slug, mediaID, name, spiel, info, facilities, description, additionalInfo, checkIn, checkOut, maxCampers, dogsAllowed, active) +func (tx *Tx) EditCampsiteType(ctx context.Context, slug string, mediaID int, name string, spiel string, info string, facilities string, description string, additionalInfo string, checkIn string, checkOut string, maxCampers int, dogsAllowed bool, overflowAllowed bool, askZonePreferences bool, active bool) (string, error) { + return tx.GetText(ctx, "select edit_campsite_type($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)", slug, mediaID, name, spiel, info, facilities, description, additionalInfo, checkIn, checkOut, maxCampers, dogsAllowed, overflowAllowed, askZonePreferences, active) } func (c *Conn) OrderCampsiteTypes(ctx context.Context, slugs []string) error { diff --git a/po/ca.po b/po/ca.po index 72d1c53..2b21246 100644 --- a/po/ca.po +++ b/po/ca.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: camper\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-01-27 22:29+0100\n" +"POT-Creation-Date: 2024-01-29 03:30+0100\n" "PO-Revision-Date: 2023-07-22 23:45+0200\n" "Last-Translator: jordi fita mas \n" "Language-Team: Catalan \n" @@ -124,7 +124,7 @@ msgid "Check-out Date" msgstr "Data de sortida" #: web/templates/public/campsite/type.gohtml:54 -#: web/templates/public/booking.gohtml:164 +#: web/templates/public/booking.gohtml:169 msgctxt "action" msgid "Book" msgstr "Reserva" @@ -136,7 +136,7 @@ msgid "Calendar" msgstr "Calendari" #: web/templates/public/campsite/type.gohtml:73 -#: web/templates/admin/campsite/type/form.gohtml:109 +#: web/templates/admin/campsite/type/form.gohtml:127 #: web/templates/admin/campsite/type/option/form.gohtml:70 msgctxt "title" msgid "Prices" @@ -351,32 +351,36 @@ msgctxt "title" msgid "Accommodation" msgstr "Allotjaments" -#: web/templates/public/booking.gohtml:99 +#: web/templates/public/booking.gohtml:101 msgctxt "input" msgid "Area preferences (optional)" msgstr "Preferències d’àrea (opcional)" -#: web/templates/public/booking.gohtml:121 +#: web/templates/public/booking.gohtml:108 +msgid "Campground map" +msgstr "Mapa del càmping" + +#: web/templates/public/booking.gohtml:126 msgctxt "title" msgid "Booking Period" msgstr "Període de reserva" -#: web/templates/public/booking.gohtml:124 +#: web/templates/public/booking.gohtml:129 msgctxt "input" msgid "Arrival date" msgstr "Data d’arribada" -#: web/templates/public/booking.gohtml:133 +#: web/templates/public/booking.gohtml:138 msgctxt "input" msgid "Departure date" msgstr "Data de sortida" -#: web/templates/public/booking.gohtml:144 +#: web/templates/public/booking.gohtml:149 msgctxt "input" msgid "ACSI card? (optional)" msgstr "Targeta ACSI? (opcional)" -#: web/templates/public/booking.gohtml:151 +#: web/templates/public/booking.gohtml:156 msgctxt "input" msgid "I have read and I accept %[1]sthe reservation conditions%[2]s" msgstr "He llegit i accepto %[1]sles condicions de reserves%[2]s" @@ -481,7 +485,7 @@ msgstr "Contingut" #: web/templates/admin/campsite/form.gohtml:92 #: web/templates/admin/campsite/type/feature/form.gohtml:74 #: web/templates/admin/campsite/type/carousel/form.gohtml:59 -#: web/templates/admin/campsite/type/form.gohtml:202 +#: web/templates/admin/campsite/type/form.gohtml:220 #: web/templates/admin/campsite/type/option/form.gohtml:90 #: web/templates/admin/season/form.gohtml:73 #: web/templates/admin/services/form.gohtml:81 @@ -503,7 +507,7 @@ msgstr "Actualitza" #: web/templates/admin/campsite/form.gohtml:94 #: web/templates/admin/campsite/type/feature/form.gohtml:76 #: web/templates/admin/campsite/type/carousel/form.gohtml:61 -#: web/templates/admin/campsite/type/form.gohtml:204 +#: web/templates/admin/campsite/type/form.gohtml:222 #: web/templates/admin/campsite/type/option/form.gohtml:92 #: web/templates/admin/season/form.gohtml:75 #: web/templates/admin/services/form.gohtml:83 @@ -627,6 +631,7 @@ msgstr "Afegeix característica" #: web/templates/admin/surroundings/index.gohtml:84 #: web/templates/admin/amenity/feature/index.gohtml:31 #: web/templates/admin/amenity/carousel/index.gohtml:31 +#: web/templates/admin/amenity/index.gohtml:25 #: web/templates/admin/home/index.gohtml:54 #: web/templates/admin/home/index.gohtml:99 msgctxt "header" @@ -651,6 +656,7 @@ msgstr "Esteu segur de voler esborrar aquesta característica?" #: web/templates/admin/surroundings/index.gohtml:101 #: web/templates/admin/amenity/feature/index.gohtml:47 #: web/templates/admin/amenity/carousel/index.gohtml:49 +#: web/templates/admin/amenity/index.gohtml:45 #: web/templates/admin/home/index.gohtml:71 #: web/templates/admin/home/index.gohtml:116 msgctxt "action" @@ -798,14 +804,14 @@ msgstr "Carrusel" #: web/templates/admin/campsite/index.gohtml:36 #: web/templates/admin/campsite/type/index.gohtml:45 -#: web/templates/admin/amenity/index.gohtml:33 +#: web/templates/admin/amenity/index.gohtml:35 msgctxt "action" msgid "Edit Features" msgstr "Edita les característiques" #: web/templates/admin/campsite/index.gohtml:39 #: web/templates/admin/campsite/type/index.gohtml:51 -#: web/templates/admin/amenity/index.gohtml:36 +#: web/templates/admin/amenity/index.gohtml:38 msgctxt "action" msgid "Edit Carousel" msgstr "Edita el carrusel" @@ -814,7 +820,7 @@ msgstr "Edita el carrusel" #: web/templates/admin/campsite/type/index.gohtml:53 #: web/templates/admin/season/index.gohtml:44 #: web/templates/admin/user/login-attempts.gohtml:31 -#: web/templates/admin/amenity/index.gohtml:38 +#: web/templates/admin/amenity/index.gohtml:40 msgid "Yes" msgstr "Sí" @@ -822,7 +828,7 @@ msgstr "Sí" #: web/templates/admin/campsite/type/index.gohtml:53 #: web/templates/admin/season/index.gohtml:44 #: web/templates/admin/user/login-attempts.gohtml:31 -#: web/templates/admin/amenity/index.gohtml:38 +#: web/templates/admin/amenity/index.gohtml:40 msgid "No" msgstr "No" @@ -914,50 +920,60 @@ msgctxt "input" msgid "Check-out" msgstr "Sortida" -#: web/templates/admin/campsite/type/form.gohtml:93 +#: web/templates/admin/campsite/type/form.gohtml:94 msgctxt "input" msgid "Maximum number of campers" msgstr "Número màxim de persones" -#: web/templates/admin/campsite/type/form.gohtml:103 +#: web/templates/admin/campsite/type/form.gohtml:104 +msgctxt "input" +msgid "Allow overflowing guests to neighbouring campsites" +msgstr "Permet reservar allotjaments veïns si es supera el màxim de persones" + +#: web/templates/admin/campsite/type/form.gohtml:113 +msgctxt "input" +msgid "Ask for zone preferences when booking" +msgstr "Demana la preferència de zona durant la reserva" + +#: web/templates/admin/campsite/type/form.gohtml:121 msgctxt "input" msgid "Dogs allowed" msgstr "Es permeten gossos" -#: web/templates/admin/campsite/type/form.gohtml:115 +#: web/templates/admin/campsite/type/form.gohtml:133 #: web/templates/admin/campsite/type/option/form.gohtml:76 msgctxt "input" msgid "Price per night" msgstr "Preu per nit" -#: web/templates/admin/campsite/type/form.gohtml:123 +#: web/templates/admin/campsite/type/form.gohtml:141 msgctxt "input" msgid "Minimum number of nights" msgstr "Número mínim de nits" -#: web/templates/admin/campsite/type/form.gohtml:135 +#: web/templates/admin/campsite/type/form.gohtml:153 msgctxt "input" msgid "Spiel" msgstr "Introducció" -#: web/templates/admin/campsite/type/form.gohtml:148 +#: web/templates/admin/campsite/type/form.gohtml:166 msgctxt "input" msgid "Info" msgstr "Informació" -#: web/templates/admin/campsite/type/form.gohtml:161 +#: web/templates/admin/campsite/type/form.gohtml:179 msgctxt "input" msgid "Facilities" msgstr "Equipaments" -#: web/templates/admin/campsite/type/form.gohtml:174 +#: web/templates/admin/campsite/type/form.gohtml:192 #: web/templates/admin/services/form.gohtml:66 #: web/templates/admin/surroundings/form.gohtml:54 msgctxt "input" msgid "Description" msgstr "Descripció" -#: web/templates/admin/campsite/type/form.gohtml:187 +#: web/templates/admin/campsite/type/form.gohtml:205 msgctxt "input" msgid "Additional Information" msgstr "Informació addicional" @@ -1432,7 +1448,11 @@ msgctxt "action" msgid "Add Amenity" msgstr "Afegeix instaŀlació" -#: web/templates/admin/amenity/index.gohtml:44 +#: web/templates/admin/amenity/index.gohtml:29 +msgid "Are you sure you wish to delete this amenity?" +msgstr "Esteu segur de voler esborrar aquesta instaŀlació?" + +#: web/templates/admin/amenity/index.gohtml:53 msgid "No amenities added yet." msgstr "No s’ha afegit cap instaŀlació encara." @@ -1650,15 +1670,15 @@ msgid "No booking found." msgstr "No s’ha trobat cap reserva." #: pkg/legal/admin.go:258 pkg/app/user.go:249 pkg/campsite/types/option.go:357 -#: pkg/campsite/types/feature.go:272 pkg/campsite/types/admin.go:483 +#: pkg/campsite/types/feature.go:272 pkg/campsite/types/admin.go:497 #: pkg/campsite/feature.go:269 pkg/season/admin.go:412 #: pkg/services/admin.go:316 pkg/surroundings/admin.go:340 -#: pkg/amenity/feature.go:269 pkg/amenity/admin.go:270 +#: pkg/amenity/feature.go:269 pkg/amenity/admin.go:283 msgid "Name can not be empty." msgstr "No podeu deixar el nom en blanc." #: pkg/legal/admin.go:259 pkg/campsite/types/option.go:358 -#: pkg/campsite/types/feature.go:273 pkg/campsite/types/admin.go:484 +#: pkg/campsite/types/feature.go:273 pkg/campsite/types/admin.go:498 #: pkg/campsite/feature.go:270 pkg/amenity/feature.go:270 msgid "Name must have at least one letter." msgstr "El nom ha de tenir com a mínim una lletra." @@ -1688,12 +1708,12 @@ msgid "Slide image must be an image media type." msgstr "La imatge de la diapositiva ha de ser un mèdia de tipus imatge." #: pkg/app/login.go:56 pkg/app/user.go:246 pkg/company/admin.go:217 -#: pkg/booking/public.go:269 +#: pkg/booking/public.go:312 msgid "Email can not be empty." msgstr "No podeu deixar el correu-e en blanc." #: pkg/app/login.go:57 pkg/app/user.go:247 pkg/company/admin.go:218 -#: pkg/booking/public.go:270 +#: pkg/booking/public.go:313 msgid "This email is not valid. It should be like name@domain.com." msgstr "Aquest correu-e no és vàlid. Hauria de ser similar a nom@domini.com." @@ -1750,15 +1770,15 @@ msgstr "El valor del màxim ha de ser un número enter." msgid "Maximum must be equal or greater than minimum." msgstr "El valor del màxim ha de ser igual o superir al del mínim." -#: pkg/campsite/types/option.go:374 pkg/campsite/types/admin.go:499 +#: pkg/campsite/types/option.go:374 pkg/campsite/types/admin.go:513 msgid "Price per night can not be empty." msgstr "No podeu deixar el preu per nit en blanc." -#: pkg/campsite/types/option.go:375 pkg/campsite/types/admin.go:500 +#: pkg/campsite/types/option.go:375 pkg/campsite/types/admin.go:514 msgid "Price per night must be a decimal number." msgstr "El preu per nit ha de ser un número decimal." -#: pkg/campsite/types/option.go:376 pkg/campsite/types/admin.go:501 +#: pkg/campsite/types/option.go:376 pkg/campsite/types/admin.go:515 msgid "Price per night must be zero or greater." msgstr "El preu per nit ha de ser com a mínim zero." @@ -1767,61 +1787,61 @@ msgstr "El preu per nit ha de ser com a mínim zero." msgid "Selected icon is not valid." msgstr "La icona escollida no és vàlida." -#: pkg/campsite/types/admin.go:307 +#: pkg/campsite/types/admin.go:309 msgctxt "input" msgid "Cover image" msgstr "Imatge de portada" -#: pkg/campsite/types/admin.go:308 +#: pkg/campsite/types/admin.go:310 msgctxt "action" msgid "Set campsite type cover" msgstr "Estableix la portada del tipus d’allotjament" -#: pkg/campsite/types/admin.go:486 +#: pkg/campsite/types/admin.go:500 msgid "Check-in can not be empty." msgstr "No podeu deixar l’entrada en blanc." -#: pkg/campsite/types/admin.go:487 +#: pkg/campsite/types/admin.go:501 msgid "Check-out can not be empty." msgstr "No podeu deixar la sortida en blanc." -#: pkg/campsite/types/admin.go:488 +#: pkg/campsite/types/admin.go:502 msgid "Cover image can not be empty." msgstr "No podeu deixar la imatge de portada en blanc." -#: pkg/campsite/types/admin.go:489 +#: pkg/campsite/types/admin.go:503 msgid "Cover image must be an image media type." msgstr "La imatge de portada ha de ser un mèdia de tipus imatge." -#: pkg/campsite/types/admin.go:493 +#: pkg/campsite/types/admin.go:507 msgid "Maximum number of campers can not be empty." msgstr "No podeu deixar el número màxim de persones en blanc." -#: pkg/campsite/types/admin.go:494 +#: pkg/campsite/types/admin.go:508 msgid "Maximum number of campers must be an integer number." msgstr "El número màxim de persones ha de ser enter." -#: pkg/campsite/types/admin.go:495 +#: pkg/campsite/types/admin.go:509 msgid "Maximum number of campers must be one or greater." msgstr "El número màxim de persones no pot ser zero." -#: pkg/campsite/types/admin.go:504 +#: pkg/campsite/types/admin.go:518 msgid "Minimum number of nights can not be empty." msgstr "No podeu deixar el número mínim de nits en blanc." -#: pkg/campsite/types/admin.go:505 +#: pkg/campsite/types/admin.go:519 msgid "Minimum number of nights must be an integer." msgstr "El número mínim de nits ha de ser enter." -#: pkg/campsite/types/admin.go:506 +#: pkg/campsite/types/admin.go:520 msgid "Minimum number of nights must be one or greater." msgstr "El número mínim de nits no pot ser zero." -#: pkg/campsite/admin.go:275 pkg/booking/public.go:278 +#: pkg/campsite/admin.go:275 pkg/booking/public.go:321 msgid "Selected campsite type is not valid." msgstr "El tipus d’allotjament escollit no és vàlid." -#: pkg/campsite/admin.go:276 pkg/amenity/admin.go:269 +#: pkg/campsite/admin.go:276 pkg/amenity/admin.go:282 msgid "Label can not be empty." msgstr "No podeu deixar l’etiqueta en blanc." @@ -1973,7 +1993,7 @@ msgstr "No podeu deixar l’adreça de l’enllaç en blanc." msgid "This web address is not valid. It should be like https://domain.com/." msgstr "Aquesta adreça web no és vàlida. Hauria de ser similar a https://domini.com/." -#: pkg/company/admin.go:200 pkg/booking/public.go:256 +#: pkg/company/admin.go:200 pkg/booking/public.go:299 msgid "Selected country is not valid." msgstr "El país escollit no és vàlid." @@ -1993,11 +2013,11 @@ msgstr "No podeu deixar el NIF en blanc." msgid "This VAT number is not valid." msgstr "Aquest NIF no és vàlid." -#: pkg/company/admin.go:212 pkg/booking/public.go:272 +#: pkg/company/admin.go:212 pkg/booking/public.go:315 msgid "Phone can not be empty." msgstr "No podeu deixar el telèfon en blanc." -#: pkg/company/admin.go:213 pkg/booking/public.go:273 +#: pkg/company/admin.go:213 pkg/booking/public.go:316 msgid "This phone number is not valid." msgstr "Aquest número de telèfon no és vàlid." @@ -2017,7 +2037,7 @@ msgstr "No podeu deixar la província en blanc." msgid "Postal code can not be empty." msgstr "No podeu deixar el codi postal en blanc." -#: pkg/company/admin.go:227 pkg/booking/public.go:265 +#: pkg/company/admin.go:227 pkg/booking/public.go:308 msgid "This postal code is not valid." msgstr "Aquest codi postal no és vàlid." @@ -2114,54 +2134,54 @@ msgstr "La integració escollida no és vàlida." msgid "The merchant key is not valid." msgstr "Aquesta clau del comerç no és vàlid." -#: pkg/booking/public.go:260 +#: pkg/booking/public.go:303 msgid "Full name can not be empty." msgstr "No podeu deixar el nom i els cognoms en blanc." -#: pkg/booking/public.go:261 +#: pkg/booking/public.go:304 msgid "Full name must have at least one letter." msgstr "El nom i els cognoms han de tenir com a mínim una lletra." -#: pkg/booking/public.go:279 +#: pkg/booking/public.go:322 msgid "Arrival date can not be empty" msgstr "No podeu deixar la data d’arribada en blanc." -#: pkg/booking/public.go:280 +#: pkg/booking/public.go:323 msgid "Arrival date must be a valid date." msgstr "La data d’arribada ha de ser una data vàlida." -#: pkg/booking/public.go:284 +#: pkg/booking/public.go:327 msgid "Departure date can not be empty" msgstr "No podeu deixar la data de sortida en blanc." -#: pkg/booking/public.go:285 +#: pkg/booking/public.go:328 msgid "Departure date must be a valid date." msgstr "La data de sortida ha de ser una data vàlida." -#: pkg/booking/public.go:286 +#: pkg/booking/public.go:329 msgid "The departure date must be after the arrival date." msgstr "La data de sortida ha de ser posterior a la d’arribada." -#: pkg/booking/public.go:289 +#: pkg/booking/public.go:332 msgid "It is mandatory to agree to the reservation conditions." msgstr "És obligatori acceptar les condicions de reserves." -#: pkg/booking/public.go:292 +#: pkg/booking/public.go:335 #, c-format msgid "%s can not be empty" msgstr "No podeu deixar %s en blanc." -#: pkg/booking/public.go:293 +#: pkg/booking/public.go:336 #, c-format msgid "%s must be an integer." msgstr "%s ha de ser un número enter." -#: pkg/booking/public.go:294 +#: pkg/booking/public.go:337 #, c-format msgid "%s must be %d or greater." msgstr "El valor de %s ha de ser com a mínim %d." -#: pkg/booking/public.go:295 +#: pkg/booking/public.go:338 #, c-format msgid "%s must be at most %d." msgstr "El valor de %s ha de ser com a màxim %d." diff --git a/po/es.po b/po/es.po index e739b65..1720207 100644 --- a/po/es.po +++ b/po/es.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: camper\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-01-27 22:29+0100\n" +"POT-Creation-Date: 2024-01-29 03:30+0100\n" "PO-Revision-Date: 2023-07-22 23:46+0200\n" "Last-Translator: jordi fita mas \n" "Language-Team: Spanish \n" @@ -124,7 +124,7 @@ msgid "Check-out Date" msgstr "Fecha de salida" #: web/templates/public/campsite/type.gohtml:54 -#: web/templates/public/booking.gohtml:164 +#: web/templates/public/booking.gohtml:169 msgctxt "action" msgid "Book" msgstr "Reservar" @@ -136,7 +136,7 @@ msgid "Calendar" msgstr "Calendario" #: web/templates/public/campsite/type.gohtml:73 -#: web/templates/admin/campsite/type/form.gohtml:109 +#: web/templates/admin/campsite/type/form.gohtml:127 #: web/templates/admin/campsite/type/option/form.gohtml:70 msgctxt "title" msgid "Prices" @@ -351,32 +351,36 @@ msgctxt "title" msgid "Accommodation" msgstr "Alojamientos" -#: web/templates/public/booking.gohtml:99 +#: web/templates/public/booking.gohtml:101 msgctxt "input" msgid "Area preferences (optional)" msgstr "Preferencias de área (opcional)" -#: web/templates/public/booking.gohtml:121 +#: web/templates/public/booking.gohtml:108 +msgid "Campground map" +msgstr "Mapa del camping" + +#: web/templates/public/booking.gohtml:126 msgctxt "title" msgid "Booking Period" msgstr "Periodo de reserva" -#: web/templates/public/booking.gohtml:124 +#: web/templates/public/booking.gohtml:129 msgctxt "input" msgid "Arrival date" msgstr "Fecha de llegada" -#: web/templates/public/booking.gohtml:133 +#: web/templates/public/booking.gohtml:138 msgctxt "input" msgid "Departure date" msgstr "Fecha de salida" -#: web/templates/public/booking.gohtml:144 +#: web/templates/public/booking.gohtml:149 msgctxt "input" msgid "ACSI card? (optional)" msgstr "¿Tarjeta ACSI? (opcional)" -#: web/templates/public/booking.gohtml:151 +#: web/templates/public/booking.gohtml:156 msgctxt "input" msgid "I have read and I accept %[1]sthe reservation conditions%[2]s" msgstr "He leído y acepto %[1]slas condiciones de reserva%[2]s" @@ -481,7 +485,7 @@ msgstr "Contenido" #: web/templates/admin/campsite/form.gohtml:92 #: web/templates/admin/campsite/type/feature/form.gohtml:74 #: web/templates/admin/campsite/type/carousel/form.gohtml:59 -#: web/templates/admin/campsite/type/form.gohtml:202 +#: web/templates/admin/campsite/type/form.gohtml:220 #: web/templates/admin/campsite/type/option/form.gohtml:90 #: web/templates/admin/season/form.gohtml:73 #: web/templates/admin/services/form.gohtml:81 @@ -503,7 +507,7 @@ msgstr "Actualizar" #: web/templates/admin/campsite/form.gohtml:94 #: web/templates/admin/campsite/type/feature/form.gohtml:76 #: web/templates/admin/campsite/type/carousel/form.gohtml:61 -#: web/templates/admin/campsite/type/form.gohtml:204 +#: web/templates/admin/campsite/type/form.gohtml:222 #: web/templates/admin/campsite/type/option/form.gohtml:92 #: web/templates/admin/season/form.gohtml:75 #: web/templates/admin/services/form.gohtml:83 @@ -627,6 +631,7 @@ msgstr "Añadir características" #: web/templates/admin/surroundings/index.gohtml:84 #: web/templates/admin/amenity/feature/index.gohtml:31 #: web/templates/admin/amenity/carousel/index.gohtml:31 +#: web/templates/admin/amenity/index.gohtml:25 #: web/templates/admin/home/index.gohtml:54 #: web/templates/admin/home/index.gohtml:99 msgctxt "header" @@ -651,6 +656,7 @@ msgstr "¿Estáis seguro de querer borrar esta característica?" #: web/templates/admin/surroundings/index.gohtml:101 #: web/templates/admin/amenity/feature/index.gohtml:47 #: web/templates/admin/amenity/carousel/index.gohtml:49 +#: web/templates/admin/amenity/index.gohtml:45 #: web/templates/admin/home/index.gohtml:71 #: web/templates/admin/home/index.gohtml:116 msgctxt "action" @@ -798,14 +804,14 @@ msgstr "Carrusel" #: web/templates/admin/campsite/index.gohtml:36 #: web/templates/admin/campsite/type/index.gohtml:45 -#: web/templates/admin/amenity/index.gohtml:33 +#: web/templates/admin/amenity/index.gohtml:35 msgctxt "action" msgid "Edit Features" msgstr "Editar las características" #: web/templates/admin/campsite/index.gohtml:39 #: web/templates/admin/campsite/type/index.gohtml:51 -#: web/templates/admin/amenity/index.gohtml:36 +#: web/templates/admin/amenity/index.gohtml:38 msgctxt "action" msgid "Edit Carousel" msgstr "Editar el carrusel" @@ -814,7 +820,7 @@ msgstr "Editar el carrusel" #: web/templates/admin/campsite/type/index.gohtml:53 #: web/templates/admin/season/index.gohtml:44 #: web/templates/admin/user/login-attempts.gohtml:31 -#: web/templates/admin/amenity/index.gohtml:38 +#: web/templates/admin/amenity/index.gohtml:40 msgid "Yes" msgstr "Sí" @@ -822,7 +828,7 @@ msgstr "Sí" #: web/templates/admin/campsite/type/index.gohtml:53 #: web/templates/admin/season/index.gohtml:44 #: web/templates/admin/user/login-attempts.gohtml:31 -#: web/templates/admin/amenity/index.gohtml:38 +#: web/templates/admin/amenity/index.gohtml:40 msgid "No" msgstr "No" @@ -914,50 +920,60 @@ msgctxt "input" msgid "Check-out" msgstr "Salida" -#: web/templates/admin/campsite/type/form.gohtml:93 +#: web/templates/admin/campsite/type/form.gohtml:94 msgctxt "input" msgid "Maximum number of campers" msgstr "Número máximo de personas" -#: web/templates/admin/campsite/type/form.gohtml:103 +#: web/templates/admin/campsite/type/form.gohtml:104 +msgctxt "input" +msgid "Allow overflowing guests to neighbouring campsites" +msgstr "Permitir reservar alojamientos vecinos si se supera el máximo de personas" + +#: web/templates/admin/campsite/type/form.gohtml:113 +msgctxt "input" +msgid "Ask for zone preferences when booking" +msgstr "Pedir la preferencia de zona durante la reserva" + +#: web/templates/admin/campsite/type/form.gohtml:121 msgctxt "input" msgid "Dogs allowed" msgstr "Se permiten perros" -#: web/templates/admin/campsite/type/form.gohtml:115 +#: web/templates/admin/campsite/type/form.gohtml:133 #: web/templates/admin/campsite/type/option/form.gohtml:76 msgctxt "input" msgid "Price per night" msgstr "Precio por noche" -#: web/templates/admin/campsite/type/form.gohtml:123 +#: web/templates/admin/campsite/type/form.gohtml:141 msgctxt "input" msgid "Minimum number of nights" msgstr "Número mínimos de noches" -#: web/templates/admin/campsite/type/form.gohtml:135 +#: web/templates/admin/campsite/type/form.gohtml:153 msgctxt "input" msgid "Spiel" msgstr "Introducción" -#: web/templates/admin/campsite/type/form.gohtml:148 +#: web/templates/admin/campsite/type/form.gohtml:166 msgctxt "input" msgid "Info" msgstr "Información" -#: web/templates/admin/campsite/type/form.gohtml:161 +#: web/templates/admin/campsite/type/form.gohtml:179 msgctxt "input" msgid "Facilities" msgstr "Equipamento" -#: web/templates/admin/campsite/type/form.gohtml:174 +#: web/templates/admin/campsite/type/form.gohtml:192 #: web/templates/admin/services/form.gohtml:66 #: web/templates/admin/surroundings/form.gohtml:54 msgctxt "input" msgid "Description" msgstr "Descripción" -#: web/templates/admin/campsite/type/form.gohtml:187 +#: web/templates/admin/campsite/type/form.gohtml:205 msgctxt "input" msgid "Additional Information" msgstr "Información adicional" @@ -1432,7 +1448,11 @@ msgctxt "action" msgid "Add Amenity" msgstr "Añadir instalación" -#: web/templates/admin/amenity/index.gohtml:44 +#: web/templates/admin/amenity/index.gohtml:29 +msgid "Are you sure you wish to delete this amenity?" +msgstr "¿Estáis seguro de querer borrar esta instalación?" + +#: web/templates/admin/amenity/index.gohtml:53 msgid "No amenities added yet." msgstr "No se ha añadido ninguna instalación todavía." @@ -1650,15 +1670,15 @@ msgid "No booking found." msgstr "No se ha encontrado ninguna reserva." #: pkg/legal/admin.go:258 pkg/app/user.go:249 pkg/campsite/types/option.go:357 -#: pkg/campsite/types/feature.go:272 pkg/campsite/types/admin.go:483 +#: pkg/campsite/types/feature.go:272 pkg/campsite/types/admin.go:497 #: pkg/campsite/feature.go:269 pkg/season/admin.go:412 #: pkg/services/admin.go:316 pkg/surroundings/admin.go:340 -#: pkg/amenity/feature.go:269 pkg/amenity/admin.go:270 +#: pkg/amenity/feature.go:269 pkg/amenity/admin.go:283 msgid "Name can not be empty." msgstr "No podéis dejar el nombre en blanco." #: pkg/legal/admin.go:259 pkg/campsite/types/option.go:358 -#: pkg/campsite/types/feature.go:273 pkg/campsite/types/admin.go:484 +#: pkg/campsite/types/feature.go:273 pkg/campsite/types/admin.go:498 #: pkg/campsite/feature.go:270 pkg/amenity/feature.go:270 msgid "Name must have at least one letter." msgstr "El nombre tiene que tener como mínimo una letra." @@ -1688,12 +1708,12 @@ msgid "Slide image must be an image media type." msgstr "La imagen de la diapositiva tiene que ser un medio de tipo imagen." #: pkg/app/login.go:56 pkg/app/user.go:246 pkg/company/admin.go:217 -#: pkg/booking/public.go:269 +#: pkg/booking/public.go:312 msgid "Email can not be empty." msgstr "No podéis dejar el correo-e en blanco." #: pkg/app/login.go:57 pkg/app/user.go:247 pkg/company/admin.go:218 -#: pkg/booking/public.go:270 +#: pkg/booking/public.go:313 msgid "This email is not valid. It should be like name@domain.com." msgstr "Este correo-e no es válido. Tiene que ser parecido a nombre@dominio.com." @@ -1750,15 +1770,15 @@ msgstr "El valor del máximo tiene que ser un número entero." msgid "Maximum must be equal or greater than minimum." msgstr "El valor del máximo tiene que ser igual o mayor al del mínimo." -#: pkg/campsite/types/option.go:374 pkg/campsite/types/admin.go:499 +#: pkg/campsite/types/option.go:374 pkg/campsite/types/admin.go:513 msgid "Price per night can not be empty." msgstr "No podéis dejar el precio por noche en blanco." -#: pkg/campsite/types/option.go:375 pkg/campsite/types/admin.go:500 +#: pkg/campsite/types/option.go:375 pkg/campsite/types/admin.go:514 msgid "Price per night must be a decimal number." msgstr "El precio por noche tiene que ser un número decimal." -#: pkg/campsite/types/option.go:376 pkg/campsite/types/admin.go:501 +#: pkg/campsite/types/option.go:376 pkg/campsite/types/admin.go:515 msgid "Price per night must be zero or greater." msgstr "El precio por noche tiene que ser como mínimo cero." @@ -1767,61 +1787,61 @@ msgstr "El precio por noche tiene que ser como mínimo cero." msgid "Selected icon is not valid." msgstr "El icono escogido no es válido." -#: pkg/campsite/types/admin.go:307 +#: pkg/campsite/types/admin.go:309 msgctxt "input" msgid "Cover image" msgstr "Imagen de portada" -#: pkg/campsite/types/admin.go:308 +#: pkg/campsite/types/admin.go:310 msgctxt "action" msgid "Set campsite type cover" msgstr "Establecer la portada del tipo de alojamiento" -#: pkg/campsite/types/admin.go:486 +#: pkg/campsite/types/admin.go:500 msgid "Check-in can not be empty." msgstr "No podéis dejar la entrada en blanco." -#: pkg/campsite/types/admin.go:487 +#: pkg/campsite/types/admin.go:501 msgid "Check-out can not be empty." msgstr "No podéis dejar la salida en blanco." -#: pkg/campsite/types/admin.go:488 +#: pkg/campsite/types/admin.go:502 msgid "Cover image can not be empty." msgstr "No podéis dejar la imagen de portada en blanco." -#: pkg/campsite/types/admin.go:489 +#: pkg/campsite/types/admin.go:503 msgid "Cover image must be an image media type." msgstr "La imagen de portada tiene que ser un medio de tipo imagen." -#: pkg/campsite/types/admin.go:493 +#: pkg/campsite/types/admin.go:507 msgid "Maximum number of campers can not be empty." msgstr "No podéis dejar el número máximo de personas en blanco." -#: pkg/campsite/types/admin.go:494 +#: pkg/campsite/types/admin.go:508 msgid "Maximum number of campers must be an integer number." msgstr "El número máximo de personas tiene que ser entero." -#: pkg/campsite/types/admin.go:495 +#: pkg/campsite/types/admin.go:509 msgid "Maximum number of campers must be one or greater." msgstr "El número máximo de personas no puede ser cero." -#: pkg/campsite/types/admin.go:504 +#: pkg/campsite/types/admin.go:518 msgid "Minimum number of nights can not be empty." msgstr "No podéis dejar el número mínimo de noches en blanco." -#: pkg/campsite/types/admin.go:505 +#: pkg/campsite/types/admin.go:519 msgid "Minimum number of nights must be an integer." msgstr "El número mínimo de noches tiene que ser entero." -#: pkg/campsite/types/admin.go:506 +#: pkg/campsite/types/admin.go:520 msgid "Minimum number of nights must be one or greater." msgstr "El número mínimo de noches no puede ser cero." -#: pkg/campsite/admin.go:275 pkg/booking/public.go:278 +#: pkg/campsite/admin.go:275 pkg/booking/public.go:321 msgid "Selected campsite type is not valid." msgstr "El tipo de alojamiento escogido no es válido." -#: pkg/campsite/admin.go:276 pkg/amenity/admin.go:269 +#: pkg/campsite/admin.go:276 pkg/amenity/admin.go:282 msgid "Label can not be empty." msgstr "No podéis dejar la etiqueta en blanco." @@ -1973,7 +1993,7 @@ msgstr "No podéis dejar la dirección del enlace en blanco." msgid "This web address is not valid. It should be like https://domain.com/." msgstr "Esta dirección web no es válida. Tiene que ser parecido a https://dominio.com/." -#: pkg/company/admin.go:200 pkg/booking/public.go:256 +#: pkg/company/admin.go:200 pkg/booking/public.go:299 msgid "Selected country is not valid." msgstr "El país escogido no es válido." @@ -1993,11 +2013,11 @@ msgstr "No podéis dejar el NIF en blanco." msgid "This VAT number is not valid." msgstr "Este NIF no es válido." -#: pkg/company/admin.go:212 pkg/booking/public.go:272 +#: pkg/company/admin.go:212 pkg/booking/public.go:315 msgid "Phone can not be empty." msgstr "No podéis dejar el teléfono en blanco." -#: pkg/company/admin.go:213 pkg/booking/public.go:273 +#: pkg/company/admin.go:213 pkg/booking/public.go:316 msgid "This phone number is not valid." msgstr "Este teléfono no es válido." @@ -2017,7 +2037,7 @@ msgstr "No podéis dejar la provincia en blanco." msgid "Postal code can not be empty." msgstr "No podéis dejar el código postal en blanco." -#: pkg/company/admin.go:227 pkg/booking/public.go:265 +#: pkg/company/admin.go:227 pkg/booking/public.go:308 msgid "This postal code is not valid." msgstr "Este código postal no es válido." @@ -2114,54 +2134,54 @@ msgstr "La integración escogida no es válida." msgid "The merchant key is not valid." msgstr "Esta clave del comercio no es válida." -#: pkg/booking/public.go:260 +#: pkg/booking/public.go:303 msgid "Full name can not be empty." msgstr "No podéis dejar el nombre y los apellidos en blanco." -#: pkg/booking/public.go:261 +#: pkg/booking/public.go:304 msgid "Full name must have at least one letter." msgstr "El nombre y los apellidos tienen que tener como mínimo una letra." -#: pkg/booking/public.go:279 +#: pkg/booking/public.go:322 msgid "Arrival date can not be empty" msgstr "No podéis dejar la fecha de llegada en blanco." -#: pkg/booking/public.go:280 +#: pkg/booking/public.go:323 msgid "Arrival date must be a valid date." msgstr "La fecha de llegada tiene que ser una fecha válida." -#: pkg/booking/public.go:284 +#: pkg/booking/public.go:327 msgid "Departure date can not be empty" msgstr "No podéis dejar la fecha de partida en blanco." -#: pkg/booking/public.go:285 +#: pkg/booking/public.go:328 msgid "Departure date must be a valid date." msgstr "La fecha de partida tiene que ser una fecha válida." -#: pkg/booking/public.go:286 +#: pkg/booking/public.go:329 msgid "The departure date must be after the arrival date." msgstr "La fecha de partida tiene que ser posterior a la de llegada." -#: pkg/booking/public.go:289 +#: pkg/booking/public.go:332 msgid "It is mandatory to agree to the reservation conditions." msgstr "Es obligatorio aceptar las condiciones de reserva." -#: pkg/booking/public.go:292 +#: pkg/booking/public.go:335 #, c-format msgid "%s can not be empty" msgstr "No podéis dejar %s en blanco." -#: pkg/booking/public.go:293 +#: pkg/booking/public.go:336 #, c-format msgid "%s must be an integer." msgstr "%s tiene que ser un número entero." -#: pkg/booking/public.go:294 +#: pkg/booking/public.go:337 #, c-format msgid "%s must be %d or greater." msgstr "%s tiene que ser como mínimo %d." -#: pkg/booking/public.go:295 +#: pkg/booking/public.go:338 #, c-format msgid "%s must be at most %d." msgstr "%s tiene que ser como máximo %d" diff --git a/po/fr.po b/po/fr.po index ece2a26..b7c73ab 100644 --- a/po/fr.po +++ b/po/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: camper\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-01-27 22:29+0100\n" +"POT-Creation-Date: 2024-01-29 03:30+0100\n" "PO-Revision-Date: 2023-12-20 10:13+0100\n" "Last-Translator: Oriol Carbonell \n" "Language-Team: French \n" @@ -125,7 +125,7 @@ msgid "Check-out Date" msgstr "Date de départ" #: web/templates/public/campsite/type.gohtml:54 -#: web/templates/public/booking.gohtml:164 +#: web/templates/public/booking.gohtml:169 msgctxt "action" msgid "Book" msgstr "Réserver" @@ -137,7 +137,7 @@ msgid "Calendar" msgstr "Calendrier" #: web/templates/public/campsite/type.gohtml:73 -#: web/templates/admin/campsite/type/form.gohtml:109 +#: web/templates/admin/campsite/type/form.gohtml:127 #: web/templates/admin/campsite/type/option/form.gohtml:70 msgctxt "title" msgid "Prices" @@ -352,32 +352,36 @@ msgctxt "title" msgid "Accommodation" msgstr "Hébergement" -#: web/templates/public/booking.gohtml:99 +#: web/templates/public/booking.gohtml:101 msgctxt "input" msgid "Area preferences (optional)" msgstr "Préférences de zone (facultatif)" -#: web/templates/public/booking.gohtml:121 +#: web/templates/public/booking.gohtml:108 +msgid "Campground map" +msgstr "Plan du camping" + +#: web/templates/public/booking.gohtml:126 msgctxt "title" msgid "Booking Period" msgstr "Période de réservation" -#: web/templates/public/booking.gohtml:124 +#: web/templates/public/booking.gohtml:129 msgctxt "input" msgid "Arrival date" msgstr "Date d’arrivée" -#: web/templates/public/booking.gohtml:133 +#: web/templates/public/booking.gohtml:138 msgctxt "input" msgid "Departure date" msgstr "Date de depart" -#: web/templates/public/booking.gohtml:144 +#: web/templates/public/booking.gohtml:149 msgctxt "input" msgid "ACSI card? (optional)" msgstr "Carte ACSI ? (Facultatif)" -#: web/templates/public/booking.gohtml:151 +#: web/templates/public/booking.gohtml:156 msgctxt "input" msgid "I have read and I accept %[1]sthe reservation conditions%[2]s" msgstr "J’ai lu et j’accepte %[1]sles conditions de réservation%[2]s" @@ -482,7 +486,7 @@ msgstr "Contenu" #: web/templates/admin/campsite/form.gohtml:92 #: web/templates/admin/campsite/type/feature/form.gohtml:74 #: web/templates/admin/campsite/type/carousel/form.gohtml:59 -#: web/templates/admin/campsite/type/form.gohtml:202 +#: web/templates/admin/campsite/type/form.gohtml:220 #: web/templates/admin/campsite/type/option/form.gohtml:90 #: web/templates/admin/season/form.gohtml:73 #: web/templates/admin/services/form.gohtml:81 @@ -504,7 +508,7 @@ msgstr "Mettre à jour" #: web/templates/admin/campsite/form.gohtml:94 #: web/templates/admin/campsite/type/feature/form.gohtml:76 #: web/templates/admin/campsite/type/carousel/form.gohtml:61 -#: web/templates/admin/campsite/type/form.gohtml:204 +#: web/templates/admin/campsite/type/form.gohtml:222 #: web/templates/admin/campsite/type/option/form.gohtml:92 #: web/templates/admin/season/form.gohtml:75 #: web/templates/admin/services/form.gohtml:83 @@ -628,6 +632,7 @@ msgstr "Ajouter une caractéristique" #: web/templates/admin/surroundings/index.gohtml:84 #: web/templates/admin/amenity/feature/index.gohtml:31 #: web/templates/admin/amenity/carousel/index.gohtml:31 +#: web/templates/admin/amenity/index.gohtml:25 #: web/templates/admin/home/index.gohtml:54 #: web/templates/admin/home/index.gohtml:99 msgctxt "header" @@ -652,6 +657,7 @@ msgstr "Êtes-vous sûr de vouloir supprimer cette caractéristique ?" #: web/templates/admin/surroundings/index.gohtml:101 #: web/templates/admin/amenity/feature/index.gohtml:47 #: web/templates/admin/amenity/carousel/index.gohtml:49 +#: web/templates/admin/amenity/index.gohtml:45 #: web/templates/admin/home/index.gohtml:71 #: web/templates/admin/home/index.gohtml:116 msgctxt "action" @@ -799,14 +805,14 @@ msgstr "Carrousel" #: web/templates/admin/campsite/index.gohtml:36 #: web/templates/admin/campsite/type/index.gohtml:45 -#: web/templates/admin/amenity/index.gohtml:33 +#: web/templates/admin/amenity/index.gohtml:35 msgctxt "action" msgid "Edit Features" msgstr "Edit caractéristiques" #: web/templates/admin/campsite/index.gohtml:39 #: web/templates/admin/campsite/type/index.gohtml:51 -#: web/templates/admin/amenity/index.gohtml:36 +#: web/templates/admin/amenity/index.gohtml:38 msgctxt "action" msgid "Edit Carousel" msgstr "Modifier le carrousel" @@ -815,7 +821,7 @@ msgstr "Modifier le carrousel" #: web/templates/admin/campsite/type/index.gohtml:53 #: web/templates/admin/season/index.gohtml:44 #: web/templates/admin/user/login-attempts.gohtml:31 -#: web/templates/admin/amenity/index.gohtml:38 +#: web/templates/admin/amenity/index.gohtml:40 msgid "Yes" msgstr "Oui" @@ -823,7 +829,7 @@ msgstr "Oui" #: web/templates/admin/campsite/type/index.gohtml:53 #: web/templates/admin/season/index.gohtml:44 #: web/templates/admin/user/login-attempts.gohtml:31 -#: web/templates/admin/amenity/index.gohtml:38 +#: web/templates/admin/amenity/index.gohtml:40 msgid "No" msgstr "Non" @@ -915,50 +921,60 @@ msgctxt "input" msgid "Check-out" msgstr "Départ" -#: web/templates/admin/campsite/type/form.gohtml:93 +#: web/templates/admin/campsite/type/form.gohtml:94 msgctxt "input" msgid "Maximum number of campers" -msgstr "Nombre maximum de campeurs" +msgstr "Nombre maximum de personnes" -#: web/templates/admin/campsite/type/form.gohtml:103 +#: web/templates/admin/campsite/type/form.gohtml:104 +msgctxt "input" +msgid "Allow overflowing guests to neighbouring campsites" +msgstr "Autoriser la réservation d’un hébergement voisin si le nombre maximum de personnes est dépassé" + +#: web/templates/admin/campsite/type/form.gohtml:113 +msgctxt "input" +msgid "Ask for zone preferences when booking" +msgstr "Demandez la préférence de zone lors de la réservation" + +#: web/templates/admin/campsite/type/form.gohtml:121 msgctxt "input" msgid "Dogs allowed" msgstr "Chiens acceptés" -#: web/templates/admin/campsite/type/form.gohtml:115 +#: web/templates/admin/campsite/type/form.gohtml:133 #: web/templates/admin/campsite/type/option/form.gohtml:76 msgctxt "input" msgid "Price per night" msgstr "Prix par nuit" -#: web/templates/admin/campsite/type/form.gohtml:123 +#: web/templates/admin/campsite/type/form.gohtml:141 msgctxt "input" msgid "Minimum number of nights" msgstr "Nombre minimum de nuits" -#: web/templates/admin/campsite/type/form.gohtml:135 +#: web/templates/admin/campsite/type/form.gohtml:153 msgctxt "input" msgid "Spiel" msgstr "Boniment" -#: web/templates/admin/campsite/type/form.gohtml:148 +#: web/templates/admin/campsite/type/form.gohtml:166 msgctxt "input" msgid "Info" msgstr "Info" -#: web/templates/admin/campsite/type/form.gohtml:161 +#: web/templates/admin/campsite/type/form.gohtml:179 msgctxt "input" msgid "Facilities" msgstr "Installations" -#: web/templates/admin/campsite/type/form.gohtml:174 +#: web/templates/admin/campsite/type/form.gohtml:192 #: web/templates/admin/services/form.gohtml:66 #: web/templates/admin/surroundings/form.gohtml:54 msgctxt "input" msgid "Description" msgstr "Description" -#: web/templates/admin/campsite/type/form.gohtml:187 +#: web/templates/admin/campsite/type/form.gohtml:205 msgctxt "input" msgid "Additional Information" msgstr "Informations Complémentaires" @@ -1433,7 +1449,11 @@ msgctxt "action" msgid "Add Amenity" msgstr "Ajouter un installation" -#: web/templates/admin/amenity/index.gohtml:44 +#: web/templates/admin/amenity/index.gohtml:29 +msgid "Are you sure you wish to delete this amenity?" +msgstr "Êtes-vous sûr de vouloir supprimer ce installation ?" + +#: web/templates/admin/amenity/index.gohtml:53 msgid "No amenities added yet." msgstr "Aucun installation n’a encore été ajouté." @@ -1651,15 +1671,15 @@ msgid "No booking found." msgstr "Aucune réservation trouvée." #: pkg/legal/admin.go:258 pkg/app/user.go:249 pkg/campsite/types/option.go:357 -#: pkg/campsite/types/feature.go:272 pkg/campsite/types/admin.go:483 +#: pkg/campsite/types/feature.go:272 pkg/campsite/types/admin.go:497 #: pkg/campsite/feature.go:269 pkg/season/admin.go:412 #: pkg/services/admin.go:316 pkg/surroundings/admin.go:340 -#: pkg/amenity/feature.go:269 pkg/amenity/admin.go:270 +#: pkg/amenity/feature.go:269 pkg/amenity/admin.go:283 msgid "Name can not be empty." msgstr "Le nom ne peut pas être laissé vide." #: pkg/legal/admin.go:259 pkg/campsite/types/option.go:358 -#: pkg/campsite/types/feature.go:273 pkg/campsite/types/admin.go:484 +#: pkg/campsite/types/feature.go:273 pkg/campsite/types/admin.go:498 #: pkg/campsite/feature.go:270 pkg/amenity/feature.go:270 msgid "Name must have at least one letter." msgstr "Le nom doit comporter au moins une lettre." @@ -1689,12 +1709,12 @@ msgid "Slide image must be an image media type." msgstr "L’image de la diapositive doit être de type média d’image." #: pkg/app/login.go:56 pkg/app/user.go:246 pkg/company/admin.go:217 -#: pkg/booking/public.go:269 +#: pkg/booking/public.go:312 msgid "Email can not be empty." msgstr "L’e-mail ne peut pas être vide." #: pkg/app/login.go:57 pkg/app/user.go:247 pkg/company/admin.go:218 -#: pkg/booking/public.go:270 +#: pkg/booking/public.go:313 msgid "This email is not valid. It should be like name@domain.com." msgstr "Cette adresse e-mail n’est pas valide. Il devrait en être name@domain.com." @@ -1751,15 +1771,15 @@ msgstr "Le maximum doit être un nombre entier." msgid "Maximum must be equal or greater than minimum." msgstr "Le maximum doit être égal ou supérieur au minimum." -#: pkg/campsite/types/option.go:374 pkg/campsite/types/admin.go:499 +#: pkg/campsite/types/option.go:374 pkg/campsite/types/admin.go:513 msgid "Price per night can not be empty." msgstr "Le prix par nuit ne peut pas être vide." -#: pkg/campsite/types/option.go:375 pkg/campsite/types/admin.go:500 +#: pkg/campsite/types/option.go:375 pkg/campsite/types/admin.go:514 msgid "Price per night must be a decimal number." msgstr "Le prix par nuit doit être un nombre décimal." -#: pkg/campsite/types/option.go:376 pkg/campsite/types/admin.go:501 +#: pkg/campsite/types/option.go:376 pkg/campsite/types/admin.go:515 msgid "Price per night must be zero or greater." msgstr "Le prix par nuit doit être égal ou supérieur." @@ -1768,61 +1788,61 @@ msgstr "Le prix par nuit doit être égal ou supérieur." msgid "Selected icon is not valid." msgstr "L’icône sélectionnée n’est pas valide." -#: pkg/campsite/types/admin.go:307 +#: pkg/campsite/types/admin.go:309 msgctxt "input" msgid "Cover image" msgstr "Image de couverture" -#: pkg/campsite/types/admin.go:308 +#: pkg/campsite/types/admin.go:310 msgctxt "action" msgid "Set campsite type cover" msgstr "Définir une couverture type camping" -#: pkg/campsite/types/admin.go:486 +#: pkg/campsite/types/admin.go:500 msgid "Check-in can not be empty." msgstr "L’arrivée ne peut pas être vide." -#: pkg/campsite/types/admin.go:487 +#: pkg/campsite/types/admin.go:501 msgid "Check-out can not be empty." msgstr "Le départ ne peut pas être vide." -#: pkg/campsite/types/admin.go:488 +#: pkg/campsite/types/admin.go:502 msgid "Cover image can not be empty." msgstr "L’image de couverture ne peut pas être vide." -#: pkg/campsite/types/admin.go:489 +#: pkg/campsite/types/admin.go:503 msgid "Cover image must be an image media type." msgstr "L’image de couverture doit être de type média d’image." -#: pkg/campsite/types/admin.go:493 +#: pkg/campsite/types/admin.go:507 msgid "Maximum number of campers can not be empty." msgstr "Le nombre maximum de campeurs ne peut pas être vide." -#: pkg/campsite/types/admin.go:494 +#: pkg/campsite/types/admin.go:508 msgid "Maximum number of campers must be an integer number." msgstr "Le nombre maximum de campeurs doit être un nombre entier." -#: pkg/campsite/types/admin.go:495 +#: pkg/campsite/types/admin.go:509 msgid "Maximum number of campers must be one or greater." msgstr "Le nombre maximum de campeurs doit être égal ou supérieur à un campeur." -#: pkg/campsite/types/admin.go:504 +#: pkg/campsite/types/admin.go:518 msgid "Minimum number of nights can not be empty." msgstr "Le nombre minimum de nuits ne peut pas être vide." -#: pkg/campsite/types/admin.go:505 +#: pkg/campsite/types/admin.go:519 msgid "Minimum number of nights must be an integer." msgstr "Le nombre minimum de nuits doit être un entier." -#: pkg/campsite/types/admin.go:506 +#: pkg/campsite/types/admin.go:520 msgid "Minimum number of nights must be one or greater." msgstr "Le nombre minimum de nuits doit être supérieur ou égal à une nuit." -#: pkg/campsite/admin.go:275 pkg/booking/public.go:278 +#: pkg/campsite/admin.go:275 pkg/booking/public.go:321 msgid "Selected campsite type is not valid." msgstr "Le type d’emplacement sélectionné n’est pas valide." -#: pkg/campsite/admin.go:276 pkg/amenity/admin.go:269 +#: pkg/campsite/admin.go:276 pkg/amenity/admin.go:282 msgid "Label can not be empty." msgstr "L'étiquette ne peut pas être vide." @@ -1974,7 +1994,7 @@ msgstr "L’addresse du lien ne peut pas être vide." msgid "This web address is not valid. It should be like https://domain.com/." msgstr "Cette adresse web n’est pas valide. Il devrait en être https://domain.com/." -#: pkg/company/admin.go:200 pkg/booking/public.go:256 +#: pkg/company/admin.go:200 pkg/booking/public.go:299 msgid "Selected country is not valid." msgstr "Le pays sélectionné n’est pas valide." @@ -1994,11 +2014,11 @@ msgstr "Le numéro de TVA ne peut pas être vide." msgid "This VAT number is not valid." msgstr "Ce numéro de TVA n’est pas valide." -#: pkg/company/admin.go:212 pkg/booking/public.go:272 +#: pkg/company/admin.go:212 pkg/booking/public.go:315 msgid "Phone can not be empty." msgstr "Le téléphone ne peut pas être vide." -#: pkg/company/admin.go:213 pkg/booking/public.go:273 +#: pkg/company/admin.go:213 pkg/booking/public.go:316 msgid "This phone number is not valid." msgstr "Ce numéro de téléphone n’est pas valide." @@ -2018,7 +2038,7 @@ msgstr "La province ne peut pas être vide." msgid "Postal code can not be empty." msgstr "Le code postal ne peut pas être vide." -#: pkg/company/admin.go:227 pkg/booking/public.go:265 +#: pkg/company/admin.go:227 pkg/booking/public.go:308 msgid "This postal code is not valid." msgstr "Ce code postal n’est pas valide." @@ -2115,54 +2135,54 @@ msgstr "L’intégration sélectionnée n’est pas valide." msgid "The merchant key is not valid." msgstr "La clé marchand n’est pas valide." -#: pkg/booking/public.go:260 +#: pkg/booking/public.go:303 msgid "Full name can not be empty." msgstr "Le nom complet ne peut pas être vide." -#: pkg/booking/public.go:261 +#: pkg/booking/public.go:304 msgid "Full name must have at least one letter." msgstr "Le nom complet doit comporter au moins une lettre." -#: pkg/booking/public.go:279 +#: pkg/booking/public.go:322 msgid "Arrival date can not be empty" msgstr "La date d’arrivée ne peut pas être vide" -#: pkg/booking/public.go:280 +#: pkg/booking/public.go:323 msgid "Arrival date must be a valid date." msgstr "La date d’arrivée doit être une date valide." -#: pkg/booking/public.go:284 +#: pkg/booking/public.go:327 msgid "Departure date can not be empty" msgstr "La date de départ ne peut pas être vide" -#: pkg/booking/public.go:285 +#: pkg/booking/public.go:328 msgid "Departure date must be a valid date." msgstr "La date de départ doit être une date valide." -#: pkg/booking/public.go:286 +#: pkg/booking/public.go:329 msgid "The departure date must be after the arrival date." msgstr "La date de départ doit être postérieure à la date d’arrivée." -#: pkg/booking/public.go:289 +#: pkg/booking/public.go:332 msgid "It is mandatory to agree to the reservation conditions." msgstr "Il est obligatoire d’accepter les conditions de réservation." -#: pkg/booking/public.go:292 +#: pkg/booking/public.go:335 #, c-format msgid "%s can not be empty" msgstr "%s ne peut pas être vide" -#: pkg/booking/public.go:293 +#: pkg/booking/public.go:336 #, c-format msgid "%s must be an integer." msgstr "%s doit être un entier." -#: pkg/booking/public.go:294 +#: pkg/booking/public.go:337 #, c-format msgid "%s must be %d or greater." msgstr "%s doit être %d ou plus." -#: pkg/booking/public.go:295 +#: pkg/booking/public.go:338 #, c-format msgid "%s must be at most %d." msgstr "%s doit être tout au plus %d." diff --git a/revert/add_campsite_type.sql b/revert/add_campsite_type.sql index 48218d0..e0d414c 100644 --- a/revert/add_campsite_type.sql +++ b/revert/add_campsite_type.sql @@ -3,23 +3,24 @@ -- requires: schema_camper -- requires: campsite_type -- requires: company +-- requires: campsite_type__check_in_out begin; set search_path to camper, public; -drop function if exists add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean); +drop function if exists add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean, boolean); -create or replace function add_campsite_type(company integer, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, max_campers integer, dogs_allowed boolean) returns uuid as +create or replace function add_campsite_type(company integer, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, dogs_allowed boolean) returns uuid as $$ - insert into campsite_type (company_id, media_id, name, spiel, info, facilities, description, additional_info, max_campers, dogs_allowed) - values (company, media_id, name, xmlparse(content spiel), xmlparse(content info), xmlparse(content facilities), xmlparse(content description), xmlparse(content additional_info), max_campers, dogs_allowed) + insert into campsite_type (company_id, media_id, name, spiel, info, facilities, description, additional_info, check_in, check_out, max_campers, dogs_allowed) + values (company, media_id, name, xmlparse(content spiel), xmlparse(content info), xmlparse(content facilities), xmlparse(content description), xmlparse(content additional_info), check_in, check_out, max_campers, dogs_allowed) returning slug; $$ language sql ; -revoke execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, integer, boolean) from public; -grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, integer, boolean) to admin; +revoke execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean) from public; +grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean) to admin; commit; diff --git a/revert/add_campsite_type@v2.sql b/revert/add_campsite_type@v2.sql new file mode 100644 index 0000000..48218d0 --- /dev/null +++ b/revert/add_campsite_type@v2.sql @@ -0,0 +1,25 @@ +-- Deploy camper:add_campsite_type to pg +-- requires: roles +-- requires: schema_camper +-- requires: campsite_type +-- requires: company + +begin; + +set search_path to camper, public; + +drop function if exists add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean); + +create or replace function add_campsite_type(company integer, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, max_campers integer, dogs_allowed boolean) returns uuid as +$$ + insert into campsite_type (company_id, media_id, name, spiel, info, facilities, description, additional_info, max_campers, dogs_allowed) + values (company, media_id, name, xmlparse(content spiel), xmlparse(content info), xmlparse(content facilities), xmlparse(content description), xmlparse(content additional_info), max_campers, dogs_allowed) + returning slug; +$$ + language sql +; + +revoke execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, integer, boolean) from public; +grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, integer, boolean) to admin; + +commit; diff --git a/revert/campsite_type__ask_zone_preferences.sql b/revert/campsite_type__ask_zone_preferences.sql new file mode 100644 index 0000000..3247de8 --- /dev/null +++ b/revert/campsite_type__ask_zone_preferences.sql @@ -0,0 +1,9 @@ +-- Revert camper:campsite_type__ask_zone_preferences from pg + +begin; + +alter table camper.campsite_type +drop column if exists ask_zone_preferences +; + +commit; diff --git a/revert/campsite_type__overflow_allowed.sql b/revert/campsite_type__overflow_allowed.sql new file mode 100644 index 0000000..1305d71 --- /dev/null +++ b/revert/campsite_type__overflow_allowed.sql @@ -0,0 +1,9 @@ +-- Revert camper:campsite_type__overflow_allowed from pg + +begin; + +alter table camper.campsite_type +drop column if exists overflow_allowed +; + +commit; diff --git a/revert/edit_campsite_type.sql b/revert/edit_campsite_type.sql index e95d779..5e3c235 100644 --- a/revert/edit_campsite_type.sql +++ b/revert/edit_campsite_type.sql @@ -3,14 +3,15 @@ -- requires: schema_camper -- requires: campsite_type -- requires: company +-- requires: campsite_type__check_in_out begin; set search_path to camper, public; -drop function if exists edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean); +drop function if exists edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean, boolean, boolean); -create or replace function edit_campsite_type(slug uuid, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, max_campers integer, dogs_allowed boolean, active boolean) returns uuid as +create or replace function edit_campsite_type(slug uuid, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, dogs_allowed boolean, active boolean) returns uuid as $$ update campsite_type set name = edit_campsite_type.name @@ -18,6 +19,8 @@ $$ , description = xmlparse(content edit_campsite_type.description) , info = xmlparse(content edit_campsite_type.info) , additional_info = xmlparse(content edit_campsite_type.additional_info) + , check_in = edit_campsite_type.check_in + , check_out = edit_campsite_type.check_out , facilities = xmlparse(content edit_campsite_type.facilities) , media_id = coalesce(edit_campsite_type.media_id, campsite_type.media_id) , max_campers = edit_campsite_type.max_campers @@ -29,7 +32,7 @@ $$ language sql ; -revoke execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, integer, boolean, boolean) from public; -grant execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, integer, boolean, boolean) to admin; +revoke execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean) from public; +grant execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean) to admin; commit; diff --git a/revert/edit_campsite_type@v2.sql b/revert/edit_campsite_type@v2.sql new file mode 100644 index 0000000..e95d779 --- /dev/null +++ b/revert/edit_campsite_type@v2.sql @@ -0,0 +1,35 @@ +-- Deploy camper:edit_campsite_type to pg +-- requires: roles +-- requires: schema_camper +-- requires: campsite_type +-- requires: company + +begin; + +set search_path to camper, public; + +drop function if exists edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean); + +create or replace function edit_campsite_type(slug uuid, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, max_campers integer, dogs_allowed boolean, active boolean) returns uuid as +$$ + update campsite_type + set name = edit_campsite_type.name + , spiel = xmlparse(content edit_campsite_type.spiel) + , description = xmlparse(content edit_campsite_type.description) + , info = xmlparse(content edit_campsite_type.info) + , additional_info = xmlparse(content edit_campsite_type.additional_info) + , facilities = xmlparse(content edit_campsite_type.facilities) + , media_id = coalesce(edit_campsite_type.media_id, campsite_type.media_id) + , max_campers = edit_campsite_type.max_campers + , dogs_allowed = edit_campsite_type.dogs_allowed + , active = edit_campsite_type.active + where slug = edit_campsite_type.slug + returning slug; +$$ +language sql +; + +revoke execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, integer, boolean, boolean) from public; +grant execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, integer, boolean, boolean) to admin; + +commit; diff --git a/sqitch.plan b/sqitch.plan index b6eface..46593d0 100644 --- a/sqitch.plan +++ b/sqitch.plan @@ -218,3 +218,7 @@ amenity_feature_i18n [roles schema_camper amenity_feature language] 2024-01-27T1 translate_amenity_feature [roles schema_camper amenity_feature_i18n] 2024-01-27T19:26:21Z jordi fita mas # Add function to translate amenity features remove_amenity_feature [roles schema_camper amenity_feature amenity_feature_i18n] 2024-01-27T19:34:52Z jordi fita mas # Add function to remove amenity features remove_amenity [roles schema_camper amenity amenity_i18n amenity_carousel amenity_carousel_i18n amenity_feature amenity_feature_i18n] 2024-01-27T18:54:34Z jordi fita mas # Add function to remove amenity +campsite_type__overflow_allowed [campsite_type] 2024-01-29T01:05:11Z jordi fita mas # Add overflow_allowed column to campsite_type +campsite_type__ask_zone_preferences [campsite_type] 2024-01-29T01:08:14Z jordi fita mas # Add ask_zone_preferences column to campsite_type +add_campsite_type [add_campsite_type@v2 campsite_type__overflow_allowed campsite_type__ask_zone_preferences] 2024-01-29T01:13:55Z jordi fita mas # Add overflow_allowed and ask_zone_preferences parameters to add_campsite_type +edit_campsite_type [edit_campsite_type@v2 campsite_type__overflow_allowed campsite_type__ask_zone_preferences] 2024-01-29T01:18:03Z jordi fita mas # Add overflow_allowed and ask_zone_preferences parameters to edit_campsite_type diff --git a/test/add_campsite_type.sql b/test/add_campsite_type.sql index 4e5a744..9d2e798 100644 --- a/test/add_campsite_type.sql +++ b/test/add_campsite_type.sql @@ -9,15 +9,15 @@ set search_path to camper, public; select plan(13); -select has_function('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean']); -select function_lang_is('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean'], 'sql'); -select function_returns('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean'], 'uuid'); -select isnt_definer('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean']); -select volatility_is('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean'], 'volatile'); -select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean'], 'guest', array[]::text[]); -select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean'], 'employee', array[]::text[]); -select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean'], 'admin', array['EXECUTE']); -select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean'], 'authenticator', array[]::text[]); +select has_function('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean']); +select function_lang_is('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean'], 'sql'); +select function_returns('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean'], 'uuid'); +select isnt_definer('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean']); +select volatility_is('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean'], 'volatile'); +select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean'], 'guest', array[]::text[]); +select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean'], 'employee', array[]::text[]); +select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean'], 'admin', array['EXECUTE']); +select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean'], 'authenticator', array[]::text[]); set client_min_messages to warning; @@ -44,19 +44,19 @@ values (3, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a ; select lives_ok( - $$ select add_campsite_type(1, 3, 'Type A', '', '

Features

', '', '

This is what, exactly?

Dunno

', '', 'After 4 p.m.', '12 a.m.', 5, true) $$, + $$ select add_campsite_type(1, 3, 'Type A', '', '

Features

', '', '

This is what, exactly?

Dunno

', '', 'After 4 p.m.', '12 a.m.', 5, true, false, true) $$, 'Should be able to add a campsite type to the first company' ); select lives_ok( - $$ select add_campsite_type(2, 4, 'Type B', '

One

Two

', '', '

Pricing

', '', '

More

', 'After 9 p.m.', '9 a.m.', 2, false) $$, + $$ select add_campsite_type(2, 4, 'Type B', '

One

Two

', '', '

Pricing

', '', '

More

', 'After 9 p.m.', '9 a.m.', 2, false, true, false) $$, 'Should be able to add a campsite type to the second company' ); select bag_eq( - $$ select company_id, media_id, name, spiel::text, info::text, facilities::text, description::text, additional_info::text, check_in, check_out, active, max_campers, dogs_allowed from campsite_type $$, - $$ values (1, 3, 'Type A', '', '

Features

', '', '

This is what, exactly?

Dunno

', '', 'After 4 p.m.', '12 a.m.', true, 5, true) - , (2, 4, 'Type B', '

One

Two

', '', '

Pricing

', '', '

More

', 'After 9 p.m.', '9 a.m.', true, 2, false) + $$ select company_id, media_id, name, spiel::text, info::text, facilities::text, description::text, additional_info::text, check_in, check_out, active, max_campers, dogs_allowed, overflow_allowed, ask_zone_preferences from campsite_type $$, + $$ values (1, 3, 'Type A', '', '

Features

', '', '

This is what, exactly?

Dunno

', '', 'After 4 p.m.', '12 a.m.', true, 5, true, false, true) + , (2, 4, 'Type B', '

One

Two

', '', '

Pricing

', '', '

More

', 'After 9 p.m.', '9 a.m.', true, 2, false, true, false) $$, 'Should have added all two campsite type' ); diff --git a/test/campsite_type.sql b/test/campsite_type.sql index 3563043..11f6294 100644 --- a/test/campsite_type.sql +++ b/test/campsite_type.sql @@ -5,7 +5,7 @@ reset client_min_messages; begin; -select plan(96); +select plan(106); set search_path to camper, public; @@ -88,6 +88,18 @@ select col_type_is('campsite_type', 'dogs_allowed', 'boolean'); select col_not_null('campsite_type', 'dogs_allowed'); select col_hasnt_default('campsite_type', 'dogs_allowed'); +select has_column('campsite_type', 'overflow_allowed'); +select col_type_is('campsite_type', 'overflow_allowed', 'boolean'); +select col_not_null('campsite_type', 'overflow_allowed'); +select col_has_default('campsite_type', 'overflow_allowed'); +select col_default_is('campsite_type', 'overflow_allowed', false); + +select has_column('campsite_type', 'ask_zone_preferences'); +select col_type_is('campsite_type', 'ask_zone_preferences', 'boolean'); +select col_not_null('campsite_type', 'ask_zone_preferences'); +select col_has_default('campsite_type', 'ask_zone_preferences'); +select col_default_is('campsite_type', 'ask_zone_preferences', false); + select has_column('campsite_type', 'check_in'); select col_type_is('campsite_type', 'check_in', 'text'); select col_not_null('campsite_type', 'check_in'); diff --git a/test/edit_campsite_type.sql b/test/edit_campsite_type.sql index 1650fd2..79e7535 100644 --- a/test/edit_campsite_type.sql +++ b/test/edit_campsite_type.sql @@ -9,15 +9,15 @@ set search_path to camper, public; select plan(12); -select has_function('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean']); -select function_lang_is('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'sql'); -select function_returns('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'uuid'); -select isnt_definer('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean']); -select volatility_is('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'volatile'); -select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'guest', array[]::text[]); -select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'employee', array[]::text[]); -select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'admin', array['EXECUTE']); -select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'authenticator', array[]::text[]); +select has_function('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean', 'boolean']); +select function_lang_is('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean', 'boolean'], 'sql'); +select function_returns('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean', 'boolean'], 'uuid'); +select isnt_definer('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean', 'boolean']); +select volatility_is('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean', 'boolean'], 'volatile'); +select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean', 'boolean'], 'guest', array[]::text[]); +select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean', 'boolean'], 'employee', array[]::text[]); +select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean', 'boolean'], 'admin', array['EXECUTE']); +select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean', 'boolean', 'boolean'], 'authenticator', array[]::text[]); set client_min_messages to warning; truncate campsite_type cascade; @@ -43,25 +43,25 @@ values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a , (4, 1, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffff00","a"};')) ; -insert into campsite_type (company_id, slug, media_id, name, spiel, info, facilities, description, additional_info, check_in, check_out, max_campers, dogs_allowed, active) -values (1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '

1

', '

info 1

', '

facilities A

', '

A

', '

Additional A

', '', '', 5, false, true) - , (1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '

2

', '

info 2

', '

facilities B

', '

B

', '

Additional B

', '', '', 4, true, false) +insert into campsite_type (company_id, slug, media_id, name, spiel, info, facilities, description, additional_info, check_in, check_out, max_campers, dogs_allowed, overflow_allowed, ask_zone_preferences, active) +values (1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '

1

', '

info 1

', '

facilities A

', '

A

', '

Additional A

', '', '', 5, false, true, false, true) + , (1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '

2

', '

info 2

', '

facilities B

', '

B

', '

Additional B

', '', '', 4, true, false, true, false) ; select lives_ok( - $$ select edit_campsite_type('87452b88-b48f-48d3-bb6c-0296de64164e', 4, 'Type 1', '

A

', '

Features A

', '

Pricing 1

', '

1

', '

Additional 1

', 'Check-in 1', 'Check-out 1', 2, true, false) $$, + $$ select edit_campsite_type('87452b88-b48f-48d3-bb6c-0296de64164e', 4, 'Type 1', '

A

', '

Features A

', '

Pricing 1

', '

1

', '

Additional 1

', 'Check-in 1', 'Check-out 1', 2, true, false, true, false) $$, 'Should be able to edit the first type' ); select lives_ok( - $$ select edit_campsite_type('9b6370f7-f941-46f2-bc6e-de455675bd0a', null, 'Type 2', '

B

', '

Features B

', '

Pricing 2

', '

2

', '

Additional 2

', 'Check-in 2', 'Check-out 2', 9, false, true) $$, + $$ select edit_campsite_type('9b6370f7-f941-46f2-bc6e-de455675bd0a', null, 'Type 2', '

B

', '

Features B

', '

Pricing 2

', '

2

', '

Additional 2

', 'Check-in 2', 'Check-out 2', 9, false, true, false, true) $$, 'Should be able to edit the second type' ); select bag_eq( - $$ select slug::text, media_id, name, spiel::text, info::text, facilities::text, description::text, additional_info::text, check_in, check_out, max_campers, dogs_allowed, active from campsite_type $$, - $$ values ('87452b88-b48f-48d3-bb6c-0296de64164e', 4, 'Type 1', '

A

', '

Features A

', '

Pricing 1

', '

1

', '

Additional 1

', 'Check-in 1', 'Check-out 1', 2, true, false) - , ('9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type 2', '

B

', '

Features B

', '

Pricing 2

', '

2

', '

Additional 2

', 'Check-in 2', 'Check-out 2', 9, false, true) + $$ select slug::text, media_id, name, spiel::text, info::text, facilities::text, description::text, additional_info::text, check_in, check_out, max_campers, dogs_allowed, overflow_allowed, ask_zone_preferences, active from campsite_type $$, + $$ values ('87452b88-b48f-48d3-bb6c-0296de64164e', 4, 'Type 1', '

A

', '

Features A

', '

Pricing 1

', '

1

', '

Additional 1

', 'Check-in 1', 'Check-out 1', 2, true, false, true, false) + , ('9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type 2', '

B

', '

Features B

', '

Pricing 2

', '

2

', '

Additional 2

', 'Check-in 2', 'Check-out 2', 9, false, true, false, true) $$, 'Should have updated all campsite types.' ); diff --git a/verify/add_campsite_type.sql b/verify/add_campsite_type.sql index fb9b83d..53e3e64 100644 --- a/verify/add_campsite_type.sql +++ b/verify/add_campsite_type.sql @@ -2,6 +2,6 @@ begin; -select has_function_privilege('camper.add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean)', 'execute'); +select has_function_privilege('camper.add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean, boolean)', 'execute'); rollback; diff --git a/verify/add_campsite_type@v2.sql b/verify/add_campsite_type@v2.sql new file mode 100644 index 0000000..fb9b83d --- /dev/null +++ b/verify/add_campsite_type@v2.sql @@ -0,0 +1,7 @@ +-- Verify camper:add_campsite_type on pg + +begin; + +select has_function_privilege('camper.add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean)', 'execute'); + +rollback; diff --git a/verify/campsite_type__ask_zone_preferences.sql b/verify/campsite_type__ask_zone_preferences.sql new file mode 100644 index 0000000..d06a071 --- /dev/null +++ b/verify/campsite_type__ask_zone_preferences.sql @@ -0,0 +1,10 @@ +-- Verify camper:campsite_type__ask_zone_preferences on pg + +begin; + +select ask_zone_preferences +from camper.campsite_type +where false +; + +rollback; diff --git a/verify/campsite_type__overflow_allowed.sql b/verify/campsite_type__overflow_allowed.sql new file mode 100644 index 0000000..df40154 --- /dev/null +++ b/verify/campsite_type__overflow_allowed.sql @@ -0,0 +1,10 @@ +-- Verify camper:campsite_type__overflow_allowed on pg + +begin; + +select overflow_allowed +from camper.campsite_type +where false +; + +rollback; diff --git a/verify/edit_campsite_type.sql b/verify/edit_campsite_type.sql index 6702754..a2870bb 100644 --- a/verify/edit_campsite_type.sql +++ b/verify/edit_campsite_type.sql @@ -2,6 +2,6 @@ begin; -select has_function_privilege('camper.edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean)', 'execute'); +select has_function_privilege('camper.edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean, boolean, boolean)', 'execute'); rollback; diff --git a/verify/edit_campsite_type@v2.sql b/verify/edit_campsite_type@v2.sql new file mode 100644 index 0000000..6702754 --- /dev/null +++ b/verify/edit_campsite_type@v2.sql @@ -0,0 +1,7 @@ +-- Verify camper:edit_campsite_type on pg + +begin; + +select has_function_privilege('camper.edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean)', 'execute'); + +rollback; diff --git a/web/templates/admin/campsite/type/form.gohtml b/web/templates/admin/campsite/type/form.gohtml index 1ac31dd..655c912 100644 --- a/web/templates/admin/campsite/type/form.gohtml +++ b/web/templates/admin/campsite/type/form.gohtml @@ -88,13 +88,31 @@ {{ template "error-message" . }} {{- end }} - {{ with .MaxCampers -}} -