diff --git a/.env b/.env index b53b2445..86aed22a 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 04ba5263..e0ad76b8 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 89960490..14ccc59c 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 b5d7f7f8..3e33a5ba 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 cb929c5a..87dbe76c 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 24f24611..b472c4e6 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 6cebc06f..c21c58fa 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, })); };