Skip to content

Commit

Permalink
Merge pull request #9 from ConductionNL/leiden
Browse files Browse the repository at this point in the history
Updated leiden
  • Loading branch information
remko48 authored Apr 25, 2024
2 parents 77a8cda + 251efa6 commit e2e7da3
Show file tree
Hide file tree
Showing 11 changed files with 216 additions and 127 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"scripts": {
"dev": "next dev",
"build": "npm run codegen && npm-run-all build:**",
"build:assets": "cp node_modules/@utrecht/assets/favicon.ico public/",
"build:next": "next build",
"clean": "rimraf .next/ src/generated/",
"download": "curl --output src/openapi/openapi.yaml https://api.huwelijksplanner.online/openapi.yaml",
Expand Down
12 changes: 9 additions & 3 deletions pages/extra/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,19 @@ export default function MultistepForm1() {

if (marriageOptions.id) {
HuwelijkService.huwelijkGet({ id: marriageOptions.id.toString() }).then((response: any) => {

Check warning on line 80 in pages/extra/index.tsx

View workflow job for this annotation

GitHub Actions / continuous-integration

Unexpected any. Specify a different type
const kosten = response.results.find(
(result: any) =>

Check warning on line 82 in pages/extra/index.tsx

View workflow job for this annotation

GitHub Actions / continuous-integration

Unexpected any. Specify a different type
result.eigenschap ===
"https://api.huwelijksplanner.online/api/ztc/v1/eigenschappen/416de8b8-d5d1-4f44-9a1e-1846d552292c"
);
// Kosten
HuwelijkService.huwelijkPostEigenschap({
HuwelijkService.huwelijkPatchEigenschap({
id: kosten.id,
requestBody: {
zaak: `https://api.huwelijksplanner.online/api/zrc/v1/zaken/${response.id ?? ""}`,
zaak: `https://api.huwelijksplanner.online/api/zrc/v1/zaken/${marriageOptions.id ?? ""}`,
eigenschap:
"https://api.huwelijksplanner.online/api/ztc/v1/eigenschappen/416de8b8-d5d1-4f44-9a1e-1846d552292c",
waarde: getCosts(formData["marriage-certificate-kind"]).toString() ?? "",
waarde: `EUR ${getCosts(formData["marriage-certificate-kind"]).toString()}` ?? "",
},
}).finally(() => {
setMarriageOptions({
Expand Down
17 changes: 16 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Head from "next/head";
import { useTranslation } from "next-i18next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { useContext } from "react";
import {
ButtonLink,
Document,
Expand All @@ -23,6 +24,7 @@ import {
} from "../src/components";
import { PageFooterTemplate } from "../src/components/huwelijksplanner/PageFooterTemplate";
import { PageHeaderTemplate } from "../src/components/huwelijksplanner/PageHeaderTemplate";
import { MarriageOptionsContext } from "../src/context/MarriageOptionsContext";

export const getServerSideProps = async ({ locale }: { locale: string }) => ({
props: {
Expand All @@ -32,6 +34,7 @@ export const getServerSideProps = async ({ locale }: { locale: string }) => ({

export default function HuwelijksplannerStep0() {
const { t } = useTranslation(["common", "huwelijksplanner-step-0"]);
const [_, setMarriageOptions] = useContext(MarriageOptionsContext);

Check warning on line 37 in pages/index.tsx

View workflow job for this annotation

GitHub Actions / continuous-integration

'_' is assigned a value but never used

return (
<Surface>
Expand Down Expand Up @@ -64,7 +67,19 @@ export default function HuwelijksplannerStep0() {
<UnorderedListItem>Je datum is geregeld!</UnorderedListItem>
</UnorderedList>
<Paragraph>
<ButtonLink appearance="primary-action-button" href="/trouw-opties">
<ButtonLink
onClick={() =>
setMarriageOptions({
id: "",
maxWitnessPerPartner: 0,
minWitnessPerPartner: 0,
partners: [],
witnesses: [],
})
}
appearance="primary-action-button"
href="/trouw-opties"
>
Start
<UtrechtIconArrow />
</ButtonLink>
Expand Down
50 changes: 10 additions & 40 deletions pages/persoonsgegevens/[person].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ import { PageFooterTemplate } from "../../src/components/huwelijksplanner/PageFo
import { PageHeaderTemplate } from "../../src/components/huwelijksplanner/PageHeaderTemplate";
import { PersonalDataList } from "../../src/components/huwelijksplanner/PersonalDataList";
import { MarriageOptionsContext } from "../../src/context/MarriageOptionsContext";
import { HuwelijkWithId } from "../../src/data/huwelijksplanner-state";
import { resolveEmbedded } from "../../src/embedded";
import { AssentService, HuwelijkService } from "../../src/generated";
import { HuwelijkService } from "../../src/generated";
import { useIngeschrevenpersoonGetByBsn } from "../../src/hooks/useIngeschrevenpersoonGetByBsn";
import { getBsnFromJWT } from "../../src/openapi/authentication";

Expand Down Expand Up @@ -80,7 +78,6 @@ export default function MultistepForm1() {
const [loadingAmbtenaar, setLoadingAmbtenaar] = useState(false);
const [loadingLocatie, setLoadingLocatie] = useState(false);
const [loadingKosten, setLoadingKosten] = useState(false);
const [loadingPartner, setLoadingPartner] = useState(false);
const [loading, setLoading] = useState(false);
const pageInitialized = useRef(false);
const invalidStateDescriptionId = useId();
Expand All @@ -106,18 +103,11 @@ export default function MultistepForm1() {
loadingAmbtenaar === true &&
loadingLocatie === true &&
loadingKosten === true &&
loadingPartner === true &&
!huwelijkId
) {
HuwelijkService.huwelijkGet({ id: huwelijkIdCreate ?? " " }).then((response: any) => {
if (!reservation) return;

const partner = response.results.find(
(result: any) =>
result.eigenschap ===
"https://api.huwelijksplanner.online/api/ztc/v1/eigenschappen/4dee2797-1faf-4dc0-95f8-ddc4956302f3"
);

const moment = response.results.find(
(result: any) =>
result.eigenschap ===
Expand All @@ -127,7 +117,6 @@ export default function MultistepForm1() {
setMarriageOptions({
...marriageOptions,
id: huwelijkIdCreate || "",
partners: [partner.waarde],
reservation: {
...reservation,
"ceremony-end": addMinutes(new Date(moment.waarde || ""), 15).toString(),
Expand All @@ -140,7 +129,7 @@ export default function MultistepForm1() {
} else {
if (!huwelijkId) setLoading(true);
}
}, [loadingType, loadingCeremonie, loadingMoment, loadingAmbtenaar, loadingLocatie, loadingKosten, loadingPartner]);
}, [loadingType, loadingCeremonie, loadingMoment, loadingAmbtenaar, loadingLocatie, loadingKosten]);

useEffect(() => {
if (
Expand Down Expand Up @@ -236,26 +225,14 @@ export default function MultistepForm1() {
// Kosten
HuwelijkService.huwelijkPostEigenschap({
requestBody: {
zaak: `https://api.huwelijksplanner.online/api/zrc/v1/zaken/${huwelijkIdCreate ?? ""}`,
zaak: `https://api.huwelijksplanner.online/api/zrc/v1/zaken/${response.id ?? ""}`,
eigenschap:
"https://api.huwelijksplanner.online/api/ztc/v1/eigenschappen/416de8b8-d5d1-4f44-9a1e-1846d552292c",
waarde: getCosts(reservation) ?? "",
},
}).finally(() => {
setLoadingKosten(true);
});

// Partner
HuwelijkService.huwelijkPostEigenschap({
requestBody: {
zaak: `https://api.huwelijksplanner.online/api/zrc/v1/zaken/${response.id ?? ""}`,
eigenschap:
"https://api.huwelijksplanner.online/api/ztc/v1/eigenschappen/4dee2797-1faf-4dc0-95f8-ddc4956302f3",
waarde: JSON.stringify(persoonData) ?? "",
},
}).finally(() => {
setLoadingPartner(true);
});
})
.finally(() => {
setLoading(false);
Expand Down Expand Up @@ -291,14 +268,15 @@ export default function MultistepForm1() {
const partner = JSON.parse(partnerString.waarde);

// Partner
HuwelijkService.huwelijkPostEigenschap({
HuwelijkService.huwelijkPatchEigenschap({
id: partnerString.id,
requestBody: {
zaak: `https://api.huwelijksplanner.online/api/zrc/v1/zaken/${response.id ?? ""}`,
zaak: `https://api.huwelijksplanner.online/api/zrc/v1/zaken/${huwelijkId ?? ""}`,
eigenschap:
"https://api.huwelijksplanner.online/api/ztc/v1/eigenschappen/4dee2797-1faf-4dc0-95f8-ddc4956302f3",
waarde:
JSON.stringify([
{ partner },
{ ...partner },
{
...persoonData,
requester: getBsnFromJWT(),
Expand All @@ -323,23 +301,15 @@ export default function MultistepForm1() {
HuwelijkService.huwelijkGet({ id: huwelijkIdCreate ?? " " }).then((response: any) => {
if (!reservation) return;

const partnerString = response.results.find(
(result: any) =>
result.eigenschap ===
"https://api.huwelijksplanner.online/api/ztc/v1/eigenschappen/4dee2797-1faf-4dc0-95f8-ddc4956302f3"
);

const partner = JSON.parse(partnerString.waarde);

// Partner
HuwelijkService.huwelijkPostEigenschap({
requestBody: {
zaak: `https://api.huwelijksplanner.online/api/zrc/v1/zaken/${response.id ?? ""}`,
zaak: `https://api.huwelijksplanner.online/api/zrc/v1/zaken/${huwelijkIdCreate ?? ""}`,
eigenschap:
"https://api.huwelijksplanner.online/api/ztc/v1/eigenschappen/4dee2797-1faf-4dc0-95f8-ddc4956302f3",
waarde:
JSON.stringify({
...partner,
...persoonData,
requester: getBsnFromJWT(),

contact: {
Expand All @@ -354,7 +324,7 @@ export default function MultistepForm1() {
},
}).then(() => {
const newPartner: any = JSON.stringify({
...partner,
...persoonData,
requester: getBsnFromJWT(),

contact: {
Expand Down
Loading

0 comments on commit e2e7da3

Please sign in to comment.