Skip to content

Commit

Permalink
Merge pull request #89 from cthit/feature/cubsec-checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
GAsplund authored Nov 5, 2023
2 parents b6a205c + 43f263f commit 7f2a4f2
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {
DigitCheckbox,
useDigitFormField,
} from "@cthit/react-digit-components";

const Cubsec = ({ preLinkLabel, linkLabel }) => {
const cubsecValues = useDigitFormField("cubsec");

return (
<DigitCheckbox
{...cubsecValues}
label={
<p>
{preLinkLabel}
<a
href="https://www.chalmers.se/utbildning/studera-hos-oss/studentliv/arrangemang-i-sektionslokaler/formular-for-anmalan-av-arrangemang/"
target="_blank"
rel="noopener noreferrer"
>
{linkLabel}
</a>
</p>
}
size={{ width: "100%" }}
/>
);
};

export default Cubsec;
2 changes: 2 additions & 0 deletions frontend/src/common/components/event-form/elements/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Description from "./description.element";
import Rooms from "./rooms.element";
import BookAs from "./book-as.element";
import GDPR from "./gdpr.element";
import Cubsec from "./cubsec.element";

export {
Title,
Expand All @@ -14,4 +15,5 @@ export {
Rooms,
BookAs,
GDPR,
Cubsec,
};
7 changes: 7 additions & 0 deletions frontend/src/common/components/event-form/event.form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
PhoneNumber,
BookAs,
GDPR,
Cubsec
} from "./elements";
import UserContext from "../../contexts/user-context";
import ROOMS from "../../rooms";
Expand Down Expand Up @@ -63,6 +64,7 @@ const EventFrom = ({ onSubmit, initialValues }) => {
end: yup.date().required(),
booking_terms: yup.bool().isTrue().required(texts.booking_terms_required),
gdpr: yup.bool().isTrue().required(texts.gdpr_required),
cubsec: yup.bool().isTrue().required(texts.cubsec_required),
});

return (
Expand Down Expand Up @@ -124,6 +126,11 @@ const EventFrom = ({ onSubmit, initialValues }) => {
}
/>

<Cubsec
preLinkLabel={texts.cubsec_condition}
linkLabel={texts.cubsec_notified}
/>

<DigitButton
raised
submit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"gdpr_agreement": ["GDPR agreement", "GDPR-avtalet"],
"title_required": [
"You need to provide a title for the event",
"Du måste ange en title för bokningen"
"Du måste ange en titel för bokningen"
],
"name_required": ["You need to provide a name", "Du måste ange ett namn"],
"phone_required": [
Expand All @@ -36,5 +36,17 @@
"You need to accept the booking terms and conditions",
"Du måste godkänna bokningsvillkoren"
],
"submit": ["Submit", "Skicka"]
"submit": ["Submit", "Skicka"],
"cubsec_condition": [
"If this is related to an arrangement, I have ",
"Om det gäller ett arrangemang har jag "
],
"cubsec_notified": [
"notified Cubsec/Chalmers",
"anmält det till Cubsec/Chalmers"
],
"cubsec_required": [
"You must confirm that you have notified Cubsec/Chalmers if applicable",
"Du måste bekräfta en eventuell anmälan till Cubsec/Chalmers"
]
}
1 change: 1 addition & 0 deletions frontend/src/use-cases/edit-event/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const formatEvent = event => {
end: new Date(Number(event.end)),
booking_terms: true,
gdpr: true,
cubsec: true,
};
};

Expand Down

0 comments on commit 7f2a4f2

Please sign in to comment.