Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated leiden #9

Merged
merged 7 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -53,7 +53,7 @@
const certificateRadioName = "marriage-certificate-kind";
const noCertificateId = useId();

const getCosts = (id: any) => {

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

View workflow job for this annotation

GitHub Actions / continuous-integration

Unexpected any. Specify a different type
switch (id) {
case "998206bc-d530-4291-89eb-02ebe21a7289":
return parseFloat(marriageOptions.reservation?.["ceremony-price-amount"] ?? "0") + 32.5;
Expand All @@ -77,14 +77,20 @@
setSaving(true);

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 @@
} 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 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 @@
<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 { 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 All @@ -56,7 +54,7 @@

export default function MultistepForm1() {
const { t } = useTranslation(["common", "huwelijksplanner-step-4", "form"]);
const [declarationCheckboxData, setDeclarationCheckboxData] = useState<any>({

Check warning on line 57 in pages/persoonsgegevens/[person].tsx

View workflow job for this annotation

GitHub Actions / continuous-integration

Unexpected any. Specify a different type
"correct-information-and-complete": false,
"not-marrying-relative": false,
unmarried: false,
Expand All @@ -80,12 +78,11 @@
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();

const getCosts = (reservation: any) => {

Check warning on line 85 in pages/persoonsgegevens/[person].tsx

View workflow job for this annotation

GitHub Actions / continuous-integration

Unexpected any. Specify a different type
switch (reservation["ceremony-type"]) {
case "gratis trouwen":
return "EUR 0.00";
Expand All @@ -106,18 +103,11 @@
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 @@
setMarriageOptions({
...marriageOptions,
id: huwelijkIdCreate || "",
partners: [partner.waarde],
reservation: {
...reservation,
"ceremony-end": addMinutes(new Date(moment.waarde || ""), 15).toString(),
Expand All @@ -140,7 +129,7 @@
} 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 @@
// 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 @@
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 @@
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 @@
},
}).then(() => {
const newPartner: any = JSON.stringify({
...partner,
...persoonData,
requester: getBsnFromJWT(),

contact: {
Expand Down
Loading
Loading