Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: require adult reservee configuration #1619

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions apps/admin-ui/gql/gql-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3646,7 +3646,7 @@ export type ReservationUnitCreateMutationInput = {
publishEnds?: InputMaybe<Scalars["DateTime"]["input"]>;
purposes?: InputMaybe<Array<InputMaybe<Scalars["Int"]["input"]>>>;
qualifiers?: InputMaybe<Array<InputMaybe<Scalars["Int"]["input"]>>>;
requireIntroduction?: InputMaybe<Scalars["Boolean"]["input"]>;
requireAdultReservee?: InputMaybe<Scalars["Boolean"]["input"]>;
requireReservationHandling?: InputMaybe<Scalars["Boolean"]["input"]>;
reservationBegins?: InputMaybe<Scalars["DateTime"]["input"]>;
reservationBlockWholeDay?: InputMaybe<Scalars["Boolean"]["input"]>;
Expand Down Expand Up @@ -3718,7 +3718,7 @@ export type ReservationUnitCreateMutationPayload = {
publishingState?: Maybe<Scalars["String"]["output"]>;
purposes?: Maybe<Array<Maybe<Scalars["Int"]["output"]>>>;
qualifiers?: Maybe<Array<Maybe<Scalars["Int"]["output"]>>>;
requireIntroduction?: Maybe<Scalars["Boolean"]["output"]>;
requireAdultReservee?: Maybe<Scalars["Boolean"]["output"]>;
requireReservationHandling?: Maybe<Scalars["Boolean"]["output"]>;
reservationBegins?: Maybe<Scalars["DateTime"]["output"]>;
reservationBlockWholeDay?: Maybe<Scalars["Boolean"]["output"]>;
Expand Down Expand Up @@ -3857,7 +3857,7 @@ export type ReservationUnitNode = Node & {
purposes: Array<PurposeNode>;
qualifiers: Array<QualifierNode>;
rank: Scalars["Int"]["output"];
requireIntroduction: Scalars["Boolean"]["output"];
requireAdultReservee: Scalars["Boolean"]["output"];
requireReservationHandling: Scalars["Boolean"]["output"];
reservableTimeSpans?: Maybe<Array<Maybe<ReservableTimeSpanType>>>;
reservationBegins?: Maybe<Scalars["DateTime"]["output"]>;
Expand Down Expand Up @@ -4236,7 +4236,7 @@ export type ReservationUnitUpdateMutationInput = {
publishEnds?: InputMaybe<Scalars["DateTime"]["input"]>;
purposes?: InputMaybe<Array<InputMaybe<Scalars["Int"]["input"]>>>;
qualifiers?: InputMaybe<Array<InputMaybe<Scalars["Int"]["input"]>>>;
requireIntroduction?: InputMaybe<Scalars["Boolean"]["input"]>;
requireAdultReservee?: InputMaybe<Scalars["Boolean"]["input"]>;
requireReservationHandling?: InputMaybe<Scalars["Boolean"]["input"]>;
reservationBegins?: InputMaybe<Scalars["DateTime"]["input"]>;
reservationBlockWholeDay?: InputMaybe<Scalars["Boolean"]["input"]>;
Expand Down Expand Up @@ -4308,7 +4308,7 @@ export type ReservationUnitUpdateMutationPayload = {
publishingState?: Maybe<Scalars["String"]["output"]>;
purposes?: Maybe<Array<Maybe<Scalars["Int"]["output"]>>>;
qualifiers?: Maybe<Array<Maybe<Scalars["Int"]["output"]>>>;
requireIntroduction?: Maybe<Scalars["Boolean"]["output"]>;
requireAdultReservee?: Maybe<Scalars["Boolean"]["output"]>;
requireReservationHandling?: Maybe<Scalars["Boolean"]["output"]>;
reservationBegins?: Maybe<Scalars["DateTime"]["output"]>;
reservationBlockWholeDay?: Maybe<Scalars["Boolean"]["output"]>;
Expand Down Expand Up @@ -6370,7 +6370,7 @@ export type ReservationUnitEditQuery = {
isDraft: boolean;
authentication: Authentication;
uuid: string;
requireIntroduction: boolean;
requireAdultReservee: boolean;
termsOfUseFi?: string | null;
termsOfUseSv?: string | null;
termsOfUseEn?: string | null;
Expand Down Expand Up @@ -11045,7 +11045,7 @@ export const ReservationUnitEditDocument = gql`
nameFi
}
uuid
requireIntroduction
requireAdultReservee
termsOfUseFi
termsOfUseSv
termsOfUseEn
Expand Down
9 changes: 4 additions & 5 deletions apps/admin-ui/src/i18n/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1486,10 +1486,8 @@ const translations: ITranslations = {
`Voit määrittää, kuinka monta voimassaolevaa varausta käyttäjällä voi samanaikaisesti olla tähän varausyksikköön.
Älä rajoita määrää tarpeettomasti. Väärinkäytösten ehkäisemiseksi suositus max 30/varausyksikkö. `,
],
introductionSettings: [
`Toiminnallisuus ei ole vielä käytössä.
Suositus:
jätä tyhjäksi`,
requireAdultReservee: [
"Valinta estää alle 18-vuotiasta tekemästä varausta tai hakemusta. Täysi-ikäisyys vaaditaan varauksen ja hakemuksen tekohetkellä.",
],
handlingSettings: [
`Voit valita kaikki varaukset käsiteltäviksi ennen hyväksymistä.
Expand Down Expand Up @@ -1597,6 +1595,7 @@ const translations: ITranslations = {
requireReservationHandling: [
"Haluan käsitellä kaikki varaukset. Varaukset tulee aina käsitellä - hyväksyä tai hylätä -luvatussa ajassa, usein kolmen arkipäivän kuluessa.",
],
requireAdultReserveeLabel: ["Varaajan on oltava täysi-ikäinen"],
requireIntroductionLabel: ["Varausyksikkö vaatii pakollisen perehdytyksen"],
surfaceAreaHelperText: ["Tilojen yhteenlaskettua alaa ei voi pienentää"],
maxPersonsHelperText: [
Expand Down Expand Up @@ -1671,7 +1670,7 @@ const translations: ITranslations = {
],
reservationSettings: ["Varauskalenterin ajastus"],
handlingSettings: ["Käsittely"],
introductionSettings: ["Perehdytys"],
requireAdultReserveeSettings: ["Iän tarkistus"],
bufferSettings: ["Varauksen tauko"],
cancellationSettings: ["Varauksen peruutus"],
reservationBegins: ["Avaa varauskalenteri alkaen"],
Expand Down
4 changes: 2 additions & 2 deletions apps/admin-ui/src/spa/ReservationUnit/edit/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ export const ReservationUnitEditSchema = z
reservationBeginsTime: z.string(),
reservationEndsDate: z.string(),
reservationEndsTime: z.string(),
requireIntroduction: z.boolean(),
requireAdultReservee: z.boolean(),
requireReservationHandling: z.boolean(),
reservationStartInterval: z.nativeEnum(ReservationStartInterval),
canApplyFreeOfCharge: z.boolean(),
Expand Down Expand Up @@ -826,7 +826,7 @@ export function convertReservationUnit(
reservationEndsTime: data?.reservationEnds
? format(new Date(data.reservationEnds), "H:mm")
: "",
requireIntroduction: data?.requireIntroduction ?? false,
requireAdultReservee: data?.requireAdultReservee ?? false,
requireReservationHandling: data?.requireReservationHandling ?? false,
reservationStartInterval:
data?.reservationStartInterval ??
Expand Down
11 changes: 6 additions & 5 deletions apps/admin-ui/src/spa/ReservationUnit/edit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1010,17 +1010,18 @@ function ReservationUnitSettings({
/>
<CustomNumberInput name="maxReservationsPerUser" min={1} form={form} />
<FieldGroup
heading={t("ReservationUnitEditor.introductionSettings")}
tooltip={t("ReservationUnitEditor.tooltip.introductionSettings")}
// FIXME replace the text fields
heading={t("ReservationUnitEditor.requireAdultReserveeSettings")}
tooltip={t("ReservationUnitEditor.tooltip.requireAdultReservee")}
style={{ gridColumn: "1 / -1" }}
>
<Controller
control={control}
name="requireIntroduction"
name="requireAdultReservee"
render={({ field: { value, onChange } }) => (
<Checkbox
id="requireIntroduction"
label={t("ReservationUnitEditor.requireIntroductionLabel")}
id="requireAdultReservee"
label={t("ReservationUnitEditor.requireAdultReserveeLabel")}
checked={value}
onChange={(e) => onChange(e.target.checked)}
/>
Expand Down
2 changes: 1 addition & 1 deletion apps/admin-ui/src/spa/ReservationUnit/edit/queries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const RESERVATION_UNIT_EDIT_QUERY = gql`
nameFi
}
uuid
requireIntroduction
requireAdultReservee
termsOfUseFi
termsOfUseSv
termsOfUseEn
Expand Down
10 changes: 5 additions & 5 deletions apps/ui/gql/gql-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3646,7 +3646,7 @@ export type ReservationUnitCreateMutationInput = {
publishEnds?: InputMaybe<Scalars["DateTime"]["input"]>;
purposes?: InputMaybe<Array<InputMaybe<Scalars["Int"]["input"]>>>;
qualifiers?: InputMaybe<Array<InputMaybe<Scalars["Int"]["input"]>>>;
requireIntroduction?: InputMaybe<Scalars["Boolean"]["input"]>;
requireAdultReservee?: InputMaybe<Scalars["Boolean"]["input"]>;
requireReservationHandling?: InputMaybe<Scalars["Boolean"]["input"]>;
reservationBegins?: InputMaybe<Scalars["DateTime"]["input"]>;
reservationBlockWholeDay?: InputMaybe<Scalars["Boolean"]["input"]>;
Expand Down Expand Up @@ -3718,7 +3718,7 @@ export type ReservationUnitCreateMutationPayload = {
publishingState?: Maybe<Scalars["String"]["output"]>;
purposes?: Maybe<Array<Maybe<Scalars["Int"]["output"]>>>;
qualifiers?: Maybe<Array<Maybe<Scalars["Int"]["output"]>>>;
requireIntroduction?: Maybe<Scalars["Boolean"]["output"]>;
requireAdultReservee?: Maybe<Scalars["Boolean"]["output"]>;
requireReservationHandling?: Maybe<Scalars["Boolean"]["output"]>;
reservationBegins?: Maybe<Scalars["DateTime"]["output"]>;
reservationBlockWholeDay?: Maybe<Scalars["Boolean"]["output"]>;
Expand Down Expand Up @@ -3857,7 +3857,7 @@ export type ReservationUnitNode = Node & {
purposes: Array<PurposeNode>;
qualifiers: Array<QualifierNode>;
rank: Scalars["Int"]["output"];
requireIntroduction: Scalars["Boolean"]["output"];
requireAdultReservee: Scalars["Boolean"]["output"];
requireReservationHandling: Scalars["Boolean"]["output"];
reservableTimeSpans?: Maybe<Array<Maybe<ReservableTimeSpanType>>>;
reservationBegins?: Maybe<Scalars["DateTime"]["output"]>;
Expand Down Expand Up @@ -4236,7 +4236,7 @@ export type ReservationUnitUpdateMutationInput = {
publishEnds?: InputMaybe<Scalars["DateTime"]["input"]>;
purposes?: InputMaybe<Array<InputMaybe<Scalars["Int"]["input"]>>>;
qualifiers?: InputMaybe<Array<InputMaybe<Scalars["Int"]["input"]>>>;
requireIntroduction?: InputMaybe<Scalars["Boolean"]["input"]>;
requireAdultReservee?: InputMaybe<Scalars["Boolean"]["input"]>;
requireReservationHandling?: InputMaybe<Scalars["Boolean"]["input"]>;
reservationBegins?: InputMaybe<Scalars["DateTime"]["input"]>;
reservationBlockWholeDay?: InputMaybe<Scalars["Boolean"]["input"]>;
Expand Down Expand Up @@ -4308,7 +4308,7 @@ export type ReservationUnitUpdateMutationPayload = {
publishingState?: Maybe<Scalars["String"]["output"]>;
purposes?: Maybe<Array<Maybe<Scalars["Int"]["output"]>>>;
qualifiers?: Maybe<Array<Maybe<Scalars["Int"]["output"]>>>;
requireIntroduction?: Maybe<Scalars["Boolean"]["output"]>;
requireAdultReservee?: Maybe<Scalars["Boolean"]["output"]>;
requireReservationHandling?: Maybe<Scalars["Boolean"]["output"]>;
reservationBegins?: Maybe<Scalars["DateTime"]["output"]>;
reservationBlockWholeDay?: Maybe<Scalars["Boolean"]["output"]>;
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/modules/__tests__/reservation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function createMockReservationUnit({
images: [],
isArchived: false,
isDraft: false,
requireIntroduction: false,
requireAdultReservee: false,
reservationKind: ReservationKind.Direct,
reservationStartInterval: ReservationStartInterval.Interval_15Mins,
reservationBegins: addDays(new Date(), -1).toISOString(),
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/modules/__tests__/reservationUnit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ describe("isReservationUnitReservable", () => {
pricings: [],
purposes: [],
qualifiers: [],
requireIntroduction: false,
requireAdultReservee: false,
requireReservationHandling: false,
reservationBlockWholeDay: false,
reservationCancelledInstructions: "",
Expand Down
10 changes: 5 additions & 5 deletions packages/common/gql/gql-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3646,7 +3646,7 @@ export type ReservationUnitCreateMutationInput = {
publishEnds?: InputMaybe<Scalars["DateTime"]["input"]>;
purposes?: InputMaybe<Array<InputMaybe<Scalars["Int"]["input"]>>>;
qualifiers?: InputMaybe<Array<InputMaybe<Scalars["Int"]["input"]>>>;
requireIntroduction?: InputMaybe<Scalars["Boolean"]["input"]>;
requireAdultReservee?: InputMaybe<Scalars["Boolean"]["input"]>;
requireReservationHandling?: InputMaybe<Scalars["Boolean"]["input"]>;
reservationBegins?: InputMaybe<Scalars["DateTime"]["input"]>;
reservationBlockWholeDay?: InputMaybe<Scalars["Boolean"]["input"]>;
Expand Down Expand Up @@ -3718,7 +3718,7 @@ export type ReservationUnitCreateMutationPayload = {
publishingState?: Maybe<Scalars["String"]["output"]>;
purposes?: Maybe<Array<Maybe<Scalars["Int"]["output"]>>>;
qualifiers?: Maybe<Array<Maybe<Scalars["Int"]["output"]>>>;
requireIntroduction?: Maybe<Scalars["Boolean"]["output"]>;
requireAdultReservee?: Maybe<Scalars["Boolean"]["output"]>;
requireReservationHandling?: Maybe<Scalars["Boolean"]["output"]>;
reservationBegins?: Maybe<Scalars["DateTime"]["output"]>;
reservationBlockWholeDay?: Maybe<Scalars["Boolean"]["output"]>;
Expand Down Expand Up @@ -3857,7 +3857,7 @@ export type ReservationUnitNode = Node & {
purposes: Array<PurposeNode>;
qualifiers: Array<QualifierNode>;
rank: Scalars["Int"]["output"];
requireIntroduction: Scalars["Boolean"]["output"];
requireAdultReservee: Scalars["Boolean"]["output"];
requireReservationHandling: Scalars["Boolean"]["output"];
reservableTimeSpans?: Maybe<Array<Maybe<ReservableTimeSpanType>>>;
reservationBegins?: Maybe<Scalars["DateTime"]["output"]>;
Expand Down Expand Up @@ -4236,7 +4236,7 @@ export type ReservationUnitUpdateMutationInput = {
publishEnds?: InputMaybe<Scalars["DateTime"]["input"]>;
purposes?: InputMaybe<Array<InputMaybe<Scalars["Int"]["input"]>>>;
qualifiers?: InputMaybe<Array<InputMaybe<Scalars["Int"]["input"]>>>;
requireIntroduction?: InputMaybe<Scalars["Boolean"]["input"]>;
requireAdultReservee?: InputMaybe<Scalars["Boolean"]["input"]>;
requireReservationHandling?: InputMaybe<Scalars["Boolean"]["input"]>;
reservationBegins?: InputMaybe<Scalars["DateTime"]["input"]>;
reservationBlockWholeDay?: InputMaybe<Scalars["Boolean"]["input"]>;
Expand Down Expand Up @@ -4308,7 +4308,7 @@ export type ReservationUnitUpdateMutationPayload = {
publishingState?: Maybe<Scalars["String"]["output"]>;
purposes?: Maybe<Array<Maybe<Scalars["Int"]["output"]>>>;
qualifiers?: Maybe<Array<Maybe<Scalars["Int"]["output"]>>>;
requireIntroduction?: Maybe<Scalars["Boolean"]["output"]>;
requireAdultReservee?: Maybe<Scalars["Boolean"]["output"]>;
requireReservationHandling?: Maybe<Scalars["Boolean"]["output"]>;
reservationBegins?: Maybe<Scalars["DateTime"]["output"]>;
reservationBlockWholeDay?: Maybe<Scalars["Boolean"]["output"]>;
Expand Down
10 changes: 5 additions & 5 deletions tilavaraus.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4002,7 +4002,7 @@ input ReservationUnitCreateMutationInput {
publishEnds: DateTime
purposes: [Int]
qualifiers: [Int]
requireIntroduction: Boolean
requireAdultReservee: Boolean
requireReservationHandling: Boolean
reservationBegins: DateTime
reservationBlockWholeDay: Boolean
Expand Down Expand Up @@ -4074,7 +4074,7 @@ type ReservationUnitCreateMutationPayload {
publishingState: String
purposes: [Int]
qualifiers: [Int]
requireIntroduction: Boolean
requireAdultReservee: Boolean
requireReservationHandling: Boolean
reservationBegins: DateTime
reservationBlockWholeDay: Boolean
Expand Down Expand Up @@ -4265,7 +4265,7 @@ type ReservationUnitNode implements Node {
pk: [Int]
): [QualifierNode!]!
rank: Int!
requireIntroduction: Boolean!
requireAdultReservee: Boolean!
requireReservationHandling: Boolean!
reservableTimeSpans(
endDate: Date!
Expand Down Expand Up @@ -4628,7 +4628,7 @@ input ReservationUnitUpdateMutationInput {
publishEnds: DateTime
purposes: [Int]
qualifiers: [Int]
requireIntroduction: Boolean
requireAdultReservee: Boolean
requireReservationHandling: Boolean
reservationBegins: DateTime
reservationBlockWholeDay: Boolean
Expand Down Expand Up @@ -4700,7 +4700,7 @@ type ReservationUnitUpdateMutationPayload {
publishingState: String
purposes: [Int]
qualifiers: [Int]
requireIntroduction: Boolean
requireAdultReservee: Boolean
requireReservationHandling: Boolean
reservationBegins: DateTime
reservationBlockWholeDay: Boolean
Expand Down
Loading