From 8dc729cf41986913ca580e9a3cb19b0cdc5d2fa1 Mon Sep 17 00:00:00 2001 From: Remko Date: Wed, 28 Feb 2024 15:08:04 +0100 Subject: [PATCH 1/3] updated variables --- .env | 6 +++--- .env.production | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.env b/.env index 2b74013..b53b244 100644 --- a/.env +++ b/.env @@ -9,6 +9,6 @@ VERSION= NEXT_PUBLIC_API_URL=https://api.leiden-hp.commonground.nu/api NEXT_PUBLIC_MATOMO_URL=https://stats.utrecht.nl/analytics/ NEXT_PUBLIC_MATOMO_SITE_ID=5 -NEXT_PUBLIC_NL_DESIGN_THEME_CLASSNAME=utrecht-theme -NEXT_PUBLIC_ORGANISATION_NAME=Gemeente Utrecht -NEXT_PUBLIC_FAV_ICON=https://www.utrecht.nl/favicon.ico +NEXT_PUBLIC_NL_DESIGN_THEME_CLASSNAME=leiden-theme +NEXT_PUBLIC_ORGANISATION_NAME=Gemeente Leiden +NEXT_PUBLIC_FAV_ICON=https://gemeente.leiden.nl/typo3conf/ext/leiden_template/Resources/Public/Images/favicon/favicon-96x96.png diff --git a/.env.production b/.env.production index 6bb850a..005a285 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,3 @@ -NEXT_PUBLIC_NL_DESIGN_THEME_CLASSNAME= -NEXT_PUBLIC_ORGANISATION_NAME= -NEXT_PUBLIC_FAV_ICON= +NEXT_PUBLIC_NL_DESIGN_THEME_CLASSNAME=leiden-theme +NEXT_PUBLIC_ORGANISATION_NAME=Gemeente Leiden +NEXT_PUBLIC_FAV_ICON=https://gemeente.leiden.nl/typo3conf/ext/leiden_template/Resources/Public/Images/favicon/favicon-96x96.png From 51c50ffbfd48915ffaa74d14edeebc8a909dbeb0 Mon Sep 17 00:00:00 2001 From: Remko Date: Tue, 19 Mar 2024 07:29:33 +0100 Subject: [PATCH 2/3] WIP --- .env | 2 +- helm/huwelijksplanner/templates/service.yaml | 8 +- package-lock.json | 22 ++- package.json | 3 +- pages/persoonsgegevens/[person].tsx | 141 ++++++++++++++++-- .../huwelijksplanner/PageFooterTemplate.tsx | 16 +- src/hooks/useSdgProductGetItem.tsx | 2 +- 7 files changed, 162 insertions(+), 32 deletions(-) diff --git a/.env b/.env index b53b244..86aed22 100644 --- a/.env +++ b/.env @@ -6,7 +6,7 @@ NPM_REGISTRY= NPM_TOKEN= VCS_REF= VERSION= -NEXT_PUBLIC_API_URL=https://api.leiden-hp.commonground.nu/api +NEXT_PUBLIC_API_URL=https://api.huwelijksplanner.online/api NEXT_PUBLIC_MATOMO_URL=https://stats.utrecht.nl/analytics/ NEXT_PUBLIC_MATOMO_SITE_ID=5 NEXT_PUBLIC_NL_DESIGN_THEME_CLASSNAME=leiden-theme diff --git a/helm/huwelijksplanner/templates/service.yaml b/helm/huwelijksplanner/templates/service.yaml index 04ba526..e0ad76b 100644 --- a/helm/huwelijksplanner/templates/service.yaml +++ b/helm/huwelijksplanner/templates/service.yaml @@ -1,14 +1,12 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "api-platform.fullname" . }} - labels: - {{- include "api-platform.labelsPWA" . | nindent 4 }} + name: { { include "api-platform.fullname" . } } + labels: { { - include "api-platform.labelsPWA" . | nindent 4 } } spec: ports: - port: 80 targetPort: 3000 protocol: TCP name: http - selector: - {{- include "api-platform.selectorLabelsPWA" . | nindent 4 }} + selector: { { - include "api-platform.selectorLabelsPWA" . | nindent 4 } } diff --git a/package-lock.json b/package-lock.json index 8996049..14ccc59 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,8 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-hook-form": "7.44.3", - "react-loading-skeleton": "3.3.1" + "react-loading-skeleton": "3.3.1", + "uuid": "9.0.1" }, "devDependencies": { "@conductionnl/agenda-service": "github:Huwelijksplanner/AgendaService", @@ -900,6 +901,15 @@ "uuid": "9.0.0" } }, + "node_modules/@cucumber/messages/node_modules/uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "dev": true, @@ -12796,9 +12806,13 @@ "license": "MIT" }, "node_modules/uuid": { - "version": "9.0.0", - "dev": true, - "license": "MIT", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "bin": { "uuid": "dist/bin/uuid" } diff --git a/package.json b/package.json index b5d7f7f..3e33a5b 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,8 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-hook-form": "7.44.3", - "react-loading-skeleton": "3.3.1" + "react-loading-skeleton": "3.3.1", + "uuid": "9.0.1" }, "devDependencies": { "@conductionnl/agenda-service": "github:Huwelijksplanner/AgendaService", diff --git a/pages/persoonsgegevens/[person].tsx b/pages/persoonsgegevens/[person].tsx index cb929c5..87dbe76 100644 --- a/pages/persoonsgegevens/[person].tsx +++ b/pages/persoonsgegevens/[person].tsx @@ -19,7 +19,7 @@ import { Surface, Textbox, } from "@utrecht/component-library-react"; -import { addMinutes } from "date-fns"; +import { addMinutes, format } from "date-fns"; import Head from "next/head"; import { useRouter } from "next/router"; import { useTranslation } from "next-i18next"; @@ -38,6 +38,7 @@ import { resolveEmbedded } from "../../src/embedded"; import { AssentService, HuwelijkService } from "../../src/generated"; import { useIngeschrevenpersoonGetByBsn } from "../../src/hooks/useIngeschrevenpersoonGetByBsn"; import { getBsnFromJWT } from "../../src/openapi/authentication"; +import { v4 as uuidv4 } from "uuid"; export const getServerSideProps = async ({ locale }: { locale: string }) => ({ props: { @@ -71,10 +72,53 @@ export default function MultistepForm1() { const [marriageOptions, setMarriageOptions] = useContext(MarriageOptionsContext); const [persoonData] = useIngeschrevenpersoonGetByBsn(getBsnFromJWT()); const { reservation, ambtenaar, productId } = marriageOptions; + + const [huwelijkIdCreate, setHuwelijkIdCreate] = useState(marriageOptions.id); + const [testPersoon, setTestPersoon] = useState(persoonData); + const [loadingType, setLoadingType] = useState(false); + const [loadingCeremonie, setLoadingCeremonie] = useState(false); + const [loadingMoment, setLoadingMoment] = useState(false); + const [loadingAmbtenaar, setLoadingAmbtenaar] = useState(false); + const [loadingLocatie, setLoadingLocatie] = useState(false); const [loading, setLoading] = useState(false); const pageInitialized = useRef(false); const invalidStateDescriptionId = useId(); + + // console.log(persoonData) + + useEffect(() => { + if ( + loadingType === true && + loadingCeremonie === true && + loadingMoment === true && + loadingAmbtenaar === true && + loadingLocatie === true + ) { + setLoading(false); + // setMarriageOptions({ + // ...marriageOptions, + // id: result._id || "", + // partners: [...result.partners], + // reservation: { + // ...reservation, + // "ceremony-end": addMinutes(new Date(result.moment || ""), 15).toString(), + // "ceremony-price-currency": result.kosten?.split(" ")[0] || "EUR", + // "ceremony-price-amount": result.kosten?.split(" ")[1] || "-", + // }, + // }); + HuwelijkService.huwelijkGet(huwelijkIdCreate ?? " ").then((response) => console.log("get", { response })); + + } else { + setLoading(true); + } + }, [loadingType, loadingCeremonie, loadingMoment, loadingAmbtenaar, loadingLocatie]); + + + + + + useEffect(() => { if ( declarationCheckboxData["correct-information-and-complete"] === true && @@ -102,24 +146,89 @@ export default function MultistepForm1() { }, }; - HuwelijkService.huwelijkPostItem(postBody) + const postHuwelijk = { + identificatie: uuidv4(), + bronorganisatie: "unknown", + omschrijving: `Test ${format(new Date(), "HH:mm:ss")} huwelijk`, + toelichting: `Test ${format(new Date(), "HH:mm:ss")} huwelijk`, + zaaktype: "https://api.huwelijksplanner.online/api/ztc/v1/zaaktypen/4af1c0ea-12b7-4e23-8913-b3effc047951", + verantwoordelijkeOrganisatie: null, + startdatum: format(new Date(), "yyyy-MM-dd"), + }; + + HuwelijkService.huwelijkCreate(postHuwelijk) .then((response) => { - const result = resolveEmbedded(response) as HuwelijkWithId; - setMarriageOptions({ - ...marriageOptions, - id: result._id || "", - partners: [...result.partners], - reservation: { - ...reservation, - "ceremony-end": addMinutes(new Date(result.moment || ""), 15).toString(), - "ceremony-price-currency": result.kosten?.split(" ")[0] || "EUR", - "ceremony-price-amount": result.kosten?.split(" ")[1] || "-", - }, + setHuwelijkIdCreate(response.id); + + HuwelijkService.huwelijkPostEigenschap( + response.id ?? "", + "a2f2bce4-3877-4ad9-833e-5241c3a71cab", + productId ?? "" + ).finally(() => { + setLoadingType(true); + }); + + HuwelijkService.huwelijkPostEigenschap( + response.id ?? "", + "d63af89f-0ee7-4b26-b07d-0faf02d34b51", + reservation["ceremony-id"] ?? "" + ).finally(() => { + setLoadingCeremonie(true); + }); + + HuwelijkService.huwelijkPostEigenschap( + response.id ?? "", + "f81cb98c-233c-4b8d-9de3-4ecc93032012", + reservation["ceremony-start"] ?? "" + ).finally(() => { + setLoadingMoment(true); + }); + + HuwelijkService.huwelijkPostEigenschap( + response.id ?? "", + "1f8e3903-ca20-4b34-a46a-aef0cc16eb19", + ambtenaar ?? "" + ).finally(() => { + setLoadingAmbtenaar(true); }); + + HuwelijkService.huwelijkPostEigenschap( + response.id ?? "", + "745d85cc-8972-43b9-916e-c268bf87d750", + reservation["ceremony-location"] ?? "" + ).finally(() => { + setLoadingLocatie(true); + }); + + HuwelijkService.huwelijkPostEigenschap( + response.id ?? "", + "4dee2797-1faf-4dc0-95f8-ddc4956302f3", + getBsnFromJWT() ?? "" + ).finally(() => { + setLoadingLocatie(true); + }); + }) - .finally(() => { - setLoading(false); - }); + .finally(() => {}); + + // HuwelijkService.huwelijkPostItem(postBody) + // .then((response) => { + // const result = resolveEmbedded(response) as HuwelijkWithId; + // setMarriageOptions({ + // ...marriageOptions, + // id: result._id || "", + // partners: [...result.partners], + // reservation: { + // ...reservation, + // "ceremony-end": addMinutes(new Date(result.moment || ""), 15).toString(), + // "ceremony-price-currency": result.kosten?.split(" ")[0] || "EUR", + // "ceremony-price-amount": result.kosten?.split(" ")[1] || "-", + // }, + // }); + // }) + // .finally(() => { + // setLoading(false); + // }); }, [ambtenaar, marriageOptions, productId, reservation, setMarriageOptions]); useEffect(() => { diff --git a/src/components/huwelijksplanner/PageFooterTemplate.tsx b/src/components/huwelijksplanner/PageFooterTemplate.tsx index 24f2461..b472c4e 100644 --- a/src/components/huwelijksplanner/PageFooterTemplate.tsx +++ b/src/components/huwelijksplanner/PageFooterTemplate.tsx @@ -3,12 +3,20 @@ * Copyright (c) 2021 Robbert Broersma */ +import * as React from "react"; import { footerData } from "../../data/footer-data"; export const PageFooterTemplate = () => { - const data = + const [data, setData] = React.useState(footerData.find((data: any) => data.theme === "utrecht-theme")); + + React.useEffect(() => { typeof window !== "undefined" && - footerData.find((data: any) => data.theme === process.env.NEXT_PUBLIC_NL_DESIGN_THEME_CLASSNAME ?? "utrecht-theme"); + setData( + footerData.find( + (data: any) => data.theme === process.env.NEXT_PUBLIC_NL_DESIGN_THEME_CLASSNAME ?? "utrecht-theme" + ) + ); + }, []); return ( <> @@ -29,11 +37,11 @@ export const PageFooterTemplate = () => { {item.title !== "Telefoon" && item.subItems && item.subItems.map((subItem: any, idx: number) => ( - <> + {subItem.title}
{subItem.value} - +
))}

diff --git a/src/hooks/useSdgProductGetItem.tsx b/src/hooks/useSdgProductGetItem.tsx index 6cebc06..c21c58f 100644 --- a/src/hooks/useSdgProductGetItem.tsx +++ b/src/hooks/useSdgProductGetItem.tsx @@ -15,7 +15,7 @@ const mapToCeremonyData = (products: SDGProduct): CeremonyData[] => { id: ceremony.id as string, type: ceremony.upnLabel as string, locationId: ceremony.gerelateerdeProducten[0].id, - ambtenaarId: ceremony.gerelateerdeProducten[0].gerelateerdeProducten[0].id, + // ambtenaarId: ceremony.gerelateerdeProducten[0]?.gerelateerdeProducten[0]?.id, })); }; From 50e75ed4fc6fc780a3945b51bec8fae20e9eb46d Mon Sep 17 00:00:00 2001 From: Remko Date: Thu, 21 Mar 2024 10:24:58 +0100 Subject: [PATCH 3/3] Added ZGW untill second partner login --- .env.development | 1 + .env.production | 1 + pages/persoonsgegevens/[person].tsx | 230 ++++++++++++++++++---------- pages/persoonsgegevens/succes.tsx | 7 +- pages/trouw-opties/[slug].tsx | 3 +- pages/trouw-opties/index.tsx | 3 +- src/components/LanguageToggle.tsx | 17 +- 7 files changed, 170 insertions(+), 92 deletions(-) diff --git a/.env.development b/.env.development index 005a285..3d9890e 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,4 @@ NEXT_PUBLIC_NL_DESIGN_THEME_CLASSNAME=leiden-theme NEXT_PUBLIC_ORGANISATION_NAME=Gemeente Leiden +NEXT_PUBLIC_ORGANISATION_NAME_SHORT=Leiden NEXT_PUBLIC_FAV_ICON=https://gemeente.leiden.nl/typo3conf/ext/leiden_template/Resources/Public/Images/favicon/favicon-96x96.png diff --git a/.env.production b/.env.production index 005a285..3d9890e 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,4 @@ NEXT_PUBLIC_NL_DESIGN_THEME_CLASSNAME=leiden-theme NEXT_PUBLIC_ORGANISATION_NAME=Gemeente Leiden +NEXT_PUBLIC_ORGANISATION_NAME_SHORT=Leiden NEXT_PUBLIC_FAV_ICON=https://gemeente.leiden.nl/typo3conf/ext/leiden_template/Resources/Public/Images/favicon/favicon-96x96.png diff --git a/pages/persoonsgegevens/[person].tsx b/pages/persoonsgegevens/[person].tsx index 87dbe76..28917a7 100644 --- a/pages/persoonsgegevens/[person].tsx +++ b/pages/persoonsgegevens/[person].tsx @@ -74,18 +74,29 @@ export default function MultistepForm1() { const { reservation, ambtenaar, productId } = marriageOptions; const [huwelijkIdCreate, setHuwelijkIdCreate] = useState(marriageOptions.id); - const [testPersoon, setTestPersoon] = useState(persoonData); const [loadingType, setLoadingType] = useState(false); const [loadingCeremonie, setLoadingCeremonie] = useState(false); const [loadingMoment, setLoadingMoment] = useState(false); 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(); - - // console.log(persoonData) + const getCosts = (reservation: any) => { + switch (reservation["ceremony-type"]) { + case "gratis trouwen": + return "EUR 0.00"; + case "flits/baliehuwelijk": + return "EUR 32.50"; + case "eenvoudig huwelijk": + return "EUR 220.00"; + default: + return "EUR 0.00"; + } + }; useEffect(() => { if ( @@ -93,31 +104,43 @@ export default function MultistepForm1() { loadingCeremonie === true && loadingMoment === true && loadingAmbtenaar === true && - loadingLocatie === true + loadingLocatie === true && + loadingKosten === true && + loadingPartner === true && + !huwelijkId ) { - setLoading(false); - // setMarriageOptions({ - // ...marriageOptions, - // id: result._id || "", - // partners: [...result.partners], - // reservation: { - // ...reservation, - // "ceremony-end": addMinutes(new Date(result.moment || ""), 15).toString(), - // "ceremony-price-currency": result.kosten?.split(" ")[0] || "EUR", - // "ceremony-price-amount": result.kosten?.split(" ")[1] || "-", - // }, - // }); - HuwelijkService.huwelijkGet(huwelijkIdCreate ?? " ").then((response) => console.log("get", { response })); - + HuwelijkService.huwelijkGet(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 === + "https://api.huwelijksplanner.online/api/ztc/v1/eigenschappen/f81cb98c-233c-4b8d-9de3-4ecc93032012" + ); + + setMarriageOptions({ + ...marriageOptions, + id: huwelijkIdCreate || "", + partners: [partner.waarde], + reservation: { + ...reservation, + "ceremony-end": addMinutes(new Date(moment.waarde || ""), 15).toString(), + "ceremony-price-currency": getCosts(reservation).split(" ")[0] || "EUR", + "ceremony-price-amount": getCosts(reservation).split(" ")[1] || "-", + }, + }); + setLoading(false); + }); } else { - setLoading(true); + !huwelijkId && setLoading(true); } - }, [loadingType, loadingCeremonie, loadingMoment, loadingAmbtenaar, loadingLocatie]); - - - - - + }, [loadingType, loadingCeremonie, loadingMoment, loadingAmbtenaar, loadingLocatie, loadingKosten, loadingPartner]); useEffect(() => { if ( @@ -136,16 +159,6 @@ export default function MultistepForm1() { setLoading(true); - const postBody = { - requestBody: { - type: productId, - ceremonie: reservation["ceremony-id"], - moment: reservation["ceremony-start"], - ambtenaar: ambtenaar, - locatie: reservation["ceremony-location"], - }, - }; - const postHuwelijk = { identificatie: uuidv4(), bronorganisatie: "unknown", @@ -160,6 +173,7 @@ export default function MultistepForm1() { .then((response) => { setHuwelijkIdCreate(response.id); + // ID HuwelijkService.huwelijkPostEigenschap( response.id ?? "", "a2f2bce4-3877-4ad9-833e-5241c3a71cab", @@ -168,6 +182,7 @@ export default function MultistepForm1() { setLoadingType(true); }); + // Ceremonie HuwelijkService.huwelijkPostEigenschap( response.id ?? "", "d63af89f-0ee7-4b26-b07d-0faf02d34b51", @@ -176,6 +191,7 @@ export default function MultistepForm1() { setLoadingCeremonie(true); }); + // Moment HuwelijkService.huwelijkPostEigenschap( response.id ?? "", "f81cb98c-233c-4b8d-9de3-4ecc93032012", @@ -184,6 +200,7 @@ export default function MultistepForm1() { setLoadingMoment(true); }); + // Ambtenaar HuwelijkService.huwelijkPostEigenschap( response.id ?? "", "1f8e3903-ca20-4b34-a46a-aef0cc16eb19", @@ -192,6 +209,7 @@ export default function MultistepForm1() { setLoadingAmbtenaar(true); }); + // Location HuwelijkService.huwelijkPostEigenschap( response.id ?? "", "745d85cc-8972-43b9-916e-c268bf87d750", @@ -200,45 +218,37 @@ export default function MultistepForm1() { setLoadingLocatie(true); }); + // Kosten + HuwelijkService.huwelijkPostEigenschap( + huwelijkIdCreate ?? "", + "416de8b8-d5d1-4f44-9a1e-1846d552292c", + getCosts(reservation) ?? "" + ).finally(() => { + setLoadingKosten(true); + }); + + // Partner HuwelijkService.huwelijkPostEigenschap( response.id ?? "", "4dee2797-1faf-4dc0-95f8-ddc4956302f3", - getBsnFromJWT() ?? "" + JSON.stringify(persoonData) ?? "" ).finally(() => { - setLoadingLocatie(true); + setLoadingPartner(true); }); - }) - .finally(() => {}); - - // HuwelijkService.huwelijkPostItem(postBody) - // .then((response) => { - // const result = resolveEmbedded(response) as HuwelijkWithId; - // setMarriageOptions({ - // ...marriageOptions, - // id: result._id || "", - // partners: [...result.partners], - // reservation: { - // ...reservation, - // "ceremony-end": addMinutes(new Date(result.moment || ""), 15).toString(), - // "ceremony-price-currency": result.kosten?.split(" ")[0] || "EUR", - // "ceremony-price-amount": result.kosten?.split(" ")[1] || "-", - // }, - // }); - // }) - // .finally(() => { - // setLoading(false); - // }); - }, [ambtenaar, marriageOptions, productId, reservation, setMarriageOptions]); + .finally(() => { + setLoading(false); + }); + }, [ambtenaar, marriageOptions, productId, reservation, setMarriageOptions, persoonData]); useEffect(() => { - if (pageInitialized.current || !reservation) return; + if (pageInitialized.current || !reservation || !persoonData) return; if (!marriageOptions.id) { initializeMarriage(); pageInitialized.current = true; } - }, [huwelijkId, initializeMarriage, marriageOptions, reservation, setMarriageOptions]); + }, [huwelijkId, initializeMarriage, marriageOptions, reservation, setMarriageOptions, persoonData]); useEffect(() => { if (formState.isDirty) @@ -248,12 +258,27 @@ export default function MultistepForm1() { const onContactDetailsSubmit = (data: FormData) => { setLoading(true); if (huwelijkId) { - HuwelijkService.huwelijkPatchItem({ - id: huwelijkId as string, - requestBody: { - partners: [ + HuwelijkService.huwelijkGet(huwelijkId.toString()).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( + response.id ?? "", + "4dee2797-1faf-4dc0-95f8-ddc4956302f3", + JSON.stringify([ + { partner }, { + ...persoonData, requester: getBsnFromJWT(), + contact: { subjectIdentificatie: { inpBsn: getBsnFromJWT(), @@ -261,30 +286,65 @@ export default function MultistepForm1() { ...mapToContactObject(data.email, data.phoneNumber), }, results: getResultsChecklist(), + name: "", }, - ], - }, - }).then(() => { - push(`/persoonsgegevens/succes?huwelijkId=${huwelijkId}`); - setLoading(false); + ]) ?? "" + ).then(() => { + push(`/persoonsgegevens/succes?huwelijkId=${huwelijkId}`); + setLoading(false); + }); }); } else { - AssentService.assentPatchItem({ - id: persoonData?.id as string, - requestBody: { - requester: getBsnFromJWT(), - contact: { - subjectIdentificatie: { - inpBsn: getBsnFromJWT(), + HuwelijkService.huwelijkGet(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( + response.id ?? "", + "4dee2797-1faf-4dc0-95f8-ddc4956302f3", + JSON.stringify({ + ...partner, + requester: getBsnFromJWT(), + + contact: { + subjectIdentificatie: { + inpBsn: getBsnFromJWT(), + }, + ...mapToContactObject(data.email, data.phoneNumber), }, - ...mapToContactObject(data.email, data.phoneNumber), - }, - results: getResultsChecklist(), - name: "", - }, - }).then(() => { - push("/voorgenomen-huwelijk/partner"); - setLoading(false); + results: getResultsChecklist(), + name: "", + }) ?? "" + ).then(() => { + const newPartner: any = JSON.stringify({ + ...partner, + requester: getBsnFromJWT(), + + contact: { + subjectIdentificatie: { + inpBsn: getBsnFromJWT(), + }, + ...mapToContactObject(data.email, data.phoneNumber), + }, + results: getResultsChecklist(), + name: "", + }); + setMarriageOptions({ + ...marriageOptions, + + partners: [newPartner], + }); + push("/voorgenomen-huwelijk/partner"); + setLoading(false); + }); }); } }; diff --git a/pages/persoonsgegevens/succes.tsx b/pages/persoonsgegevens/succes.tsx index 42e8166..0147b58 100644 --- a/pages/persoonsgegevens/succes.tsx +++ b/pages/persoonsgegevens/succes.tsx @@ -35,7 +35,8 @@ export default function MultistepForm1() { const { t } = useTranslation(["common", "huwelijksplanner-step-5", "form"]); const [marriageOptions] = useContext(MarriageOptionsContext); const { locale = "nl" } = useRouter(); - const contact = marriageOptions.partners[0]?.contact; + const partner = JSON.parse(marriageOptions.partners[0]?.toString()); + const contact = partner?.naam; return ( @@ -69,8 +70,8 @@ export default function MultistepForm1() { Gelukt We hebben jouw gegevens gekoppeld aan die van{" "} - {`${contact.voornaam} ${contact.achternaam}`}. Jullie kunnen nu - verder gaan met het plannen van jullie huwelijk. + {`${contact.voornamen} ${contact.geslachtsnaam}`}. Jullie kunnen + nu verder gaan met het plannen van jullie huwelijk. diff --git a/pages/trouw-opties/[slug].tsx b/pages/trouw-opties/[slug].tsx index dc5ccfc..253f336 100644 --- a/pages/trouw-opties/[slug].tsx +++ b/pages/trouw-opties/[slug].tsx @@ -201,7 +201,8 @@ const PlanningFormPage: NextPage = () => { Meer informatie - Trouwen of partnerschap registreren in Utrecht + Trouwen of partnerschap registreren in{" "} + {process.env.NEXT_PUBLIC_ORGANISATION_NAME_SHORT ?? "Utrecht"} diff --git a/pages/trouw-opties/index.tsx b/pages/trouw-opties/index.tsx index 417ded0..0a5221a 100644 --- a/pages/trouw-opties/index.tsx +++ b/pages/trouw-opties/index.tsx @@ -109,7 +109,8 @@ export default function MultistepForm1() { - Trouwen of partnerschap registreren in Utrecht + Trouwen of partnerschap registreren in{" "} + {process.env.NEXT_PUBLIC_ORGANISATION_NAME_SHORT ?? "Utrecht"} diff --git a/src/components/LanguageToggle.tsx b/src/components/LanguageToggle.tsx index e4017dd..ba8b4fe 100644 --- a/src/components/LanguageToggle.tsx +++ b/src/components/LanguageToggle.tsx @@ -1,8 +1,9 @@ import clsx from "clsx"; import Link from "next/link"; import { useRouter } from "next/router"; -import { Fragment, HTMLAttributes, useId } from "react"; -import { ButtonGroup, Heading, LinkButton } from "./index"; +import { Fragment, HTMLAttributes, useContext, useId } from "react"; +import { Button, ButtonGroup, Heading, LinkButton } from "./index"; +import { MarriageOptionsContext } from "../context/MarriageOptionsContext"; export type LanguageToggleProps = HTMLAttributes; @@ -47,6 +48,7 @@ export const LanguageToggleButtons = ({ className, headingLevel }: LanguageToggl const router = useRouter(); const { locales, pathname, query, asPath, locale: currentLocale } = router; const headingId = useId(); + // const [marriageOptions, setMarriageOptions] = useContext(MarriageOptionsContext); const languages = [ { @@ -97,6 +99,17 @@ export const LanguageToggleButtons = ({ className, headingLevel }: LanguageToggl {textContent} ))} + {/* DEV */} + {/* */} );