Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
remko48 committed Mar 19, 2024
1 parent 8dc729c commit 51c50ff
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions helm/huwelijksplanner/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -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 } }
22 changes: 18 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
141 changes: 125 additions & 16 deletions pages/persoonsgegevens/[person].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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: {
Expand Down Expand Up @@ -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<string | null | undefined>(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 &&
Expand Down Expand Up @@ -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(() => {
Expand Down
16 changes: 12 additions & 4 deletions src/components/huwelijksplanner/PageFooterTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>(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 (
<>
Expand All @@ -29,11 +37,11 @@ export const PageFooterTemplate = () => {
{item.title !== "Telefoon" &&
item.subItems &&
item.subItems.map((subItem: any, idx: number) => (
<>
<React.Fragment key={idx}>
<strong>{subItem.title}</strong>
<br />
{subItem.value}
</>
</React.Fragment>
))}
</p>
</section>
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useSdgProductGetItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}));
};

Expand Down

0 comments on commit 51c50ff

Please sign in to comment.