From 612757f914ed2cc6cc735bee36d4712d40328eaf Mon Sep 17 00:00:00 2001 From: Remko Date: Fri, 17 Nov 2023 10:58:44 +0100 Subject: [PATCH 1/3] updated object_data --- pwa/src/services/initiateEnvironment.ts | 2 +- .../CardsResultsTemplate.tsx | 14 ++-- .../TableResultsTemplate.tsx | 18 ++--- .../WOOItemDetailTemplate.tsx | 78 ++++++++++--------- 4 files changed, 57 insertions(+), 55 deletions(-) diff --git a/pwa/src/services/initiateEnvironment.ts b/pwa/src/services/initiateEnvironment.ts index 6ffa76dc..be65bf24 100644 --- a/pwa/src/services/initiateEnvironment.ts +++ b/pwa/src/services/initiateEnvironment.ts @@ -10,7 +10,7 @@ export const initiateEnvironment = () => { window.sessionStorage.setItem("ORGANISATION_NAME", process.env.GATSBY_ORGANISATION_NAME ?? ""); window.sessionStorage.setItem("JUMBOTRON_IMAGE_URL", process.env.GATSBY_JUMBOTRON_IMAGE_URL ?? ""); window.sessionStorage.setItem("FOOTER_LOGO_HREF", process.env.GATSBY_FOOTER_LOGO_HREF ?? ""); - window.sessionStorage.setItem("FOOTER_CONTENT", process.env.FOOTER_CONTENT ?? ""); + window.sessionStorage.setItem("FOOTER_CONTENT", process.env.GATSBY_FOOTER_CONTENT ?? ""); window.sessionStorage.setItem("FOOTER_CONTENT_HEADER", process.env.GATSBY_FOOTER_CONTENT_HEADER ?? ""); window.sessionStorage.setItem("OIDN_NUMBER", process.env.GATSBY_OIDN_NUMBER ?? ""); diff --git a/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx b/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx index 5628260f..e187b557 100644 --- a/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx +++ b/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx @@ -18,24 +18,24 @@ export const CardsResultsTemplate: React.FC = ({ requ
{requests.map((request) => ( navigate(request.id)} + onClick={() => navigate(request._self.id)} tabIndex={0} - aria-label={`${request.Titel}, ${request.Samenvatting}, ${ - request.Publicatiedatum ? translateDate(i18n.language, request.Publicatiedatum) : t("N/A") + aria-label={`${request.titel}, ${request.samenvatting}, ${ + request.publicatiedatum ? translateDate(i18n.language, request.publicatiedatum) : t("N/A") }`} > - {request.Publicatiedatum ? translateDate(i18n.language, request.Publicatiedatum) : t("N/A")} + {request.publicatiedatum ? translateDate(i18n.language, request.publicatiedatum) : t("N/A")} - {request.Titel ?? t("No title available")} + {request.titel ?? t("No title available")} - {request.Samenvatting} + {request.samenvatting} ))}
diff --git a/pwa/src/templates/templateParts/tableResultsTemplate/TableResultsTemplate.tsx b/pwa/src/templates/templateParts/tableResultsTemplate/TableResultsTemplate.tsx index 13e2a5e9..94a48869 100644 --- a/pwa/src/templates/templateParts/tableResultsTemplate/TableResultsTemplate.tsx +++ b/pwa/src/templates/templateParts/tableResultsTemplate/TableResultsTemplate.tsx @@ -39,20 +39,20 @@ export const TableResultsTemplate: React.FC = ({ requ {requests.map((request) => ( navigate(request.id)} + key={request._self.id} + onClick={() => navigate(request._self.id)} tabIndex={0} - aria-label={`${request.Titel}, ${ - request.Publicatiedatum ? translateDate(i18n.language, request.Publicatiedatum) : t("N/A") - }, ${request.Samenvatting}`} + aria-label={`${request.titel}, ${ + request.publicatiedatum ? translateDate(i18n.language, request.publicatiedatum) : t("N/A") + }, ${request.samenvatting}`} > - {request.Titel ?? t("No subject available")} + {request.titel ?? t("No subject available")} - {request.Publicatiedatum - ? translateDate(i18n.language, request.Publicatiedatum) + {request.publicatiedatum + ? translateDate(i18n.language, request.publicatiedatum) : t("No publication date available")} - {request.Samenvatting ?? t("No summary available")} + {request.samenvatting ?? t("No summary available")} ))} diff --git a/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx b/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx index ff84d306..6c925ea1 100644 --- a/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx +++ b/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx @@ -53,7 +53,7 @@ export const WOOItemDetailTemplate: React.FC = ({ wo {getItems.isSuccess && ( <> - {getItems.data.Titel !== "" ? getItems.data.Titel : t("No title available")} + {getItems.data.titel !== "" ? getItems.data.titel : t("No title available")} = ({ wo > - {getItems.data.ID && ( + {getItems.data.id && ( {t("Feature")} - {isUUID(getItems.data.ID) ? getItems.data.Object_ID : getItems.data.ID} + + {isUUID(getItems.data._self.id) ? getItems.data.id : getItems.data._self.id} + )} - {getItems.data.Titel && ( + {getItems.data.titel && ( {t("Category")} - {getItems.data.Categorie ?? "-"} + {getItems.data.categorie ?? "-"} )} - {getItems.data.Samenvatting && ( + {getItems.data.samenvatting && ( {t("Summary")} - {getItems.data.Samenvatting} + {getItems.data.samenvatting} )} - {getItems.data.Beschrijving && ( + {getItems.data.beschrijving && ( {t("Description")} - {getItems.data.Beschrijving} + {getItems.data.beschrijving} )} - {getItems.data.Termijnoverschrijding && ( + {getItems.data.termijnoverschrijding && ( {t("Exceeding the term")} - {getItems.data.Termijnoverschrijding} + {getItems.data.termijnoverschrijding} )} - {getItems.data.Publicatiedatum && ( + {getItems.data.publicatiedatum && ( {t("Publication date")} - {getItems.data.Publicatiedatum - ? translateDate(i18n.language, getItems.data.Publicatiedatum) + {getItems.data.publicatiedatum + ? translateDate(i18n.language, getItems.data.publicatiedatum) : "-"} )} - {getItems.data.Ontvangstdatum && ( + {getItems.data.ontvangstdatum && ( {t("Registration date")} - {translateDate(i18n.language, getItems.data.Ontvangstdatum) ?? "-"} + {translateDate(i18n.language, getItems.data.ontvangstdatum) ?? "-"} )} - {getItems.data.Besluitdatum && ( + {getItems.data.embedded?.metadata?.besluitdatum && ( {t("Decision date")} - {translateDate(i18n.language, getItems.data.Besluitdatum) ?? "-"} + + {translateDate(i18n.language, getItems.data.embedded?.metadata?.besluitdatum) ?? "-"} + )} - {getItems.data?.embedded?.Themas && ( + {getItems.data?.embedded?.themas && ( {t("Themes")} - {getItems.data?.embedded?.Themas.map((thema: any, idx: number) => ( + {getItems.data?.embedded?.themas.map((thema: any, idx: number) => ( - {thema.Hoofdthema + (idx !== getItems.data?.embedded?.Themas.length - 1 ? ", " : "")} + {thema.hoofdthema + (idx !== getItems.data?.embedded?.themas?.length - 1 ? ", " : "")} ))} @@ -141,27 +145,25 @@ export const WOOItemDetailTemplate: React.FC = ({ wo {t("Information request")} - - {getItems.data?.embedded?.informatieverzoek?.Titel_Bijlage} + + {getItems.data?.embedded?.informatieverzoek?.titel} )} - {(getItems.data.Besluit || (getItems.data?.embedded?.besluit ?? getItems.data.URL_besluit)) && ( + {(getItems.data?.besluit || + (getItems.data?.embedded?.besluit ?? getItems.data?.embedded?.besluit?.url)) && ( {t("Decision")} - {getItems.data.Besluit} - {getItems.data.Besluit && - (getItems.data?.embedded?.besluit ?? getItems.data.URL_besluit) && - ","}{" "} - {(getItems.data?.embedded?.besluit ?? getItems.data.URL_besluit) && ( + {(getItems.data?.embedded?.besluit ?? getItems.data?.embedded?.besluit?.url) && ( - {getItems.data?.embedded?.besluit?.Titel_Bijlage ?? getPDFName(getItems.data.URL_besluit)} + {getItems.data?.embedded?.besluit?.titel ?? + getPDFName(getItems.data?.embedded?.besluit?.url)} )} @@ -172,25 +174,25 @@ export const WOOItemDetailTemplate: React.FC = ({ wo {t("Inventory list")} - - {getItems.data?.embedded?.inventarisatielijst?.Titel_Bijlage} + + {getItems.data?.embedded?.inventarisatielijst?.titel} )} - {getItems.data?.embedded?.Bijlagen && ( + {getItems.data?.embedded?.bijlagen && ( {t("Attachments")} - {getItems.data?.embedded?.Bijlagen.map((bijlage: any, idx: number) => ( + {getItems.data?.embedded?.bijlagen.map((bijlage: any, idx: number) => ( - {bijlage.Titel_Bijlage} + {bijlage.titel} ))} From 766d2fcb105c41220e8dd1dbb1f925c5dce58b95 Mon Sep 17 00:00:00 2001 From: Remko Date: Fri, 17 Nov 2023 15:38:41 +0100 Subject: [PATCH 2/3] updated oidn --- pwa/src/apiService/resources/availableFilters.ts | 2 +- pwa/src/apiService/resources/openWoo.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pwa/src/apiService/resources/availableFilters.ts b/pwa/src/apiService/resources/availableFilters.ts index 05b33510..0a488ffe 100644 --- a/pwa/src/apiService/resources/availableFilters.ts +++ b/pwa/src/apiService/resources/availableFilters.ts @@ -14,7 +14,7 @@ export default class AvailableFilters { let endpoint = "/openWOO?_queries[]=Categorie"; if (window.sessionStorage.getItem("OIDN_NUMBER")) { - endpoint += `&oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`; + endpoint += `&behandelendBestuursorgaan.oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`; } const { data } = await this._send(this._instance, "GET", endpoint); diff --git a/pwa/src/apiService/resources/openWoo.ts b/pwa/src/apiService/resources/openWoo.ts index 277bc315..f9ee2e18 100644 --- a/pwa/src/apiService/resources/openWoo.ts +++ b/pwa/src/apiService/resources/openWoo.ts @@ -20,7 +20,7 @@ export default class OpenWoo { )}&_order[Publicatiedatum]=desc&_limit=${limit}&_page=${currentPage}`; if (window.sessionStorage.getItem("OIDN_NUMBER")) { - endpoint += `&oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`; + endpoint += `&behandelendBestuursorgaan.oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`; } const { data } = await this._send(this._instance, "GET", endpoint); From 9928cce9e8e0df537db076a1de52314e8b179eaa Mon Sep 17 00:00:00 2001 From: Remko Date: Tue, 21 Nov 2023 15:25:05 +0100 Subject: [PATCH 3/3] extra metadata check --- .../WOOItemDetailTemplate.tsx | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx b/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx index 6c925ea1..a5dbf859 100644 --- a/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx +++ b/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx @@ -186,16 +186,19 @@ export const WOOItemDetailTemplate: React.FC = ({ wo {t("Attachments")} - {getItems.data?.embedded?.bijlagen.map((bijlage: any, idx: number) => ( - - - {bijlage.titel} - - - ))} + {getItems.data?.embedded?.bijlagen.map( + (bijlage: any, idx: number) => + bijlage.titel && ( + + + {bijlage.titel} + + + ), + )}