Skip to content

Commit

Permalink
added api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
remko48 committed Nov 28, 2023
1 parent 1865d14 commit 85df86e
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 47 deletions.
2 changes: 1 addition & 1 deletion pwa/src/apiService/resources/availableFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class AvailableFilters {
let endpoint = "/openWOO?_queries[]=categorie";

if (window.sessionStorage.getItem("OIDN_NUMBER")) {
endpoint += `&embedded.behandelendBestuursorgaan.oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`;
endpoint += `&organisatie.oin=${window.sessionStorage.getItem("OIDN_NUMBER")}`;
}

const { data } = await this._send(this._instance, "GET", endpoint);
Expand Down
2 changes: 1 addition & 1 deletion pwa/src/apiService/resources/openWoo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class OpenWoo {
)}&_order[publicatiedatum]=desc&_limit=${limit}&_page=${currentPage}`;

if (window.sessionStorage.getItem("OIDN_NUMBER")) {
endpoint += `&embedded.behandelendBestuursorgaan.oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`;
endpoint += `&organisatie.oin=${window.sessionStorage.getItem("OIDN_NUMBER")}`;
}

const { data } = await this._send(this._instance, "GET", endpoint);
Expand Down
5 changes: 0 additions & 5 deletions pwa/src/services/isUUID.ts

This file was deleted.

2 changes: 1 addition & 1 deletion pwa/src/templates/landing/LandingTemplate.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as React from "react";
import * as styles from "./LandingTemplate.module.css";
import Skeleton from "react-loading-skeleton";
import { Page, PageContent } from "@utrecht/component-library-react/dist/css-module";
import { FiltersTemplate } from "../templateParts/filters/FiltersTemplate";
import { ResultsDisplayTemplate } from "../templateParts/resultsDisplayTemplate/ResultsDisplayTemplate";
import { JumbotronTemplate } from "../jumbotronTemplate/JumbotronTemplate";
import { useOpenWoo } from "../../hooks/openWoo";
import { useFiltersContext } from "../../context/filters";
import Skeleton from "react-loading-skeleton";
import { QueryClient } from "react-query";
import { Pagination } from "@conduction/components";
import { usePaginationContext } from "../../context/pagination";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ export const CardsResultsTemplate: React.FC<CardsResultsTemplateProps> = ({ requ
<div className={styles.componentsGrid}>
{requests.map((request) => (
<CardWrapper
key={request._self.id}
key={request.id}
className={styles.cardContainer}
onClick={() => navigate(request._self.id)}
onClick={() => navigate(request.id)}
tabIndex={0}
aria-label={`${
request.publicatiedatum ? translateDate(i18n.language, request.publicatiedatum) : t("N/A")
}, ${request.titel}, ${request.samenvatting} ${
window.sessionStorage.getItem("SHOW_ORGANIZATION") === "true"
? `,${request.embedded?.behandelendBestuursorgaan?.naam}`
: ""
window.sessionStorage.getItem("SHOW_ORGANIZATION") === "true" ? `,${request.organisatie?.naam}` : ""
} ${
window.sessionStorage.getItem("SHOW_CATEGORY") === "true"
? `, ${t("Category")}, ${request.categorie}`
Expand All @@ -52,7 +50,7 @@ export const CardsResultsTemplate: React.FC<CardsResultsTemplateProps> = ({ requ
{window.sessionStorage.getItem("SHOW_ORGANIZATION") === "true" && (
<CardHeaderDate>
<span data-tooltip-id={TOOLTIP_ID} data-tooltip-content={t("Municipality")}>
{request.embedded?.behandelendBestuursorgaan?.naam}
{request.organisatie?.naam}
</span>
</CardHeaderDate>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,13 @@ export const TableResultsTemplate: React.FC<TableResultsTemplateProps> = ({ requ
{requests.map((request) => (
<TableRow
className={styles.tableRow}
key={request._self.id}
onClick={() => navigate(request._self.id)}
key={request.id}
onClick={() => navigate(request.id)}
tabIndex={0}
aria-label={`${request.titel}, ${
request.publicatiedatum ? translateDate(i18n.language, request.publicatiedatum) : t("N/A")
} ${
window.sessionStorage.getItem("SHOW_ORGANIZATION") === "true"
? `,${request.embedded?.behandelendBestuursorgaan?.naam}`
: ""
window.sessionStorage.getItem("SHOW_ORGANIZATION") === "true" ? `,${request.organisatie?.naam}` : ""
} ${window.sessionStorage.getItem("SHOW_CATEGORY") === "true" ? `, ${request.categorie}` : ""}, ${
request.samenvatting
}`}
Expand All @@ -75,7 +73,7 @@ export const TableResultsTemplate: React.FC<TableResultsTemplateProps> = ({ requ
<>
{window.sessionStorage.getItem("SHOW_ORGANIZATION") === "true" && (
<TableCell className={styles.categoryAndMunicipality}>
{request.embedded?.behandelendBestuursorgaan?.naam ?? t("No municipality available")}
{request.organisatie?.naam ?? t("No municipality available")}
</TableCell>
)}
{window.sessionStorage.getItem("SHOW_CATEGORY") === "true" && (
Expand Down
57 changes: 30 additions & 27 deletions pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { QueryClient } from "react-query";
import { useOpenWoo } from "../../hooks/openWoo";
import Skeleton from "react-loading-skeleton";
import { getPDFName } from "../../services/getPDFName";
import { isUUID } from "../../services/isUUID";
import { HorizontalOverflowWrapper } from "@conduction/components";

interface WOOItemDetailTemplateProps {
Expand Down Expand Up @@ -67,9 +66,7 @@ export const WOOItemDetailTemplate: React.FC<WOOItemDetailTemplateProps> = ({ wo
{getItems.data.id && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Feature")}</TableCell>
<TableCell>
{isUUID(getItems.data._self.id) ? getItems.data.id : getItems.data._self.id}
</TableCell>
<TableCell>{getItems.data?.metadata?.volgnummer}</TableCell>
</TableRow>
)}

Expand All @@ -93,10 +90,10 @@ export const WOOItemDetailTemplate: React.FC<WOOItemDetailTemplateProps> = ({ wo
</TableRow>
)}

{getItems.data.termijnoverschrijding && (
{getItems.data?.metadata?.verzoek?.termijnoverschrijding && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Exceeding the term")}</TableCell>
<TableCell>{getItems.data.termijnoverschrijding}</TableCell>
<TableCell>{getItems.data?.metadata?.verzoek?.termijnoverschrijding}</TableCell>
</TableRow>
)}

Expand All @@ -111,82 +108,88 @@ export const WOOItemDetailTemplate: React.FC<WOOItemDetailTemplateProps> = ({ wo
</TableRow>
)}

{getItems.data.ontvangstdatum && (
{getItems.data?.metadata?.verzoek?.ontvangstdatum && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Registration date")}</TableCell>

<TableCell>{translateDate(i18n.language, getItems.data.ontvangstdatum) ?? "-"}</TableCell>
<TableCell>
{translateDate(i18n.language, getItems.data?.metadata?.verzoek?.ontvangstdatum) ?? "-"}
</TableCell>
</TableRow>
)}

{getItems.data.embedded?.metadata?.besluitdatum && (
{getItems.data.metadata?.besluitdatum && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Decision date")} </TableCell>
<TableCell>
{translateDate(i18n.language, getItems.data.embedded?.metadata?.besluitdatum) ?? "-"}
{translateDate(i18n.language, getItems.data?.metadata?.besluitdatum) ?? "-"}
</TableCell>
</TableRow>
)}

{getItems.data?.embedded?.themas && (
{getItems.data?.themas && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Themes")}</TableCell>
<TableCell>
{getItems.data?.embedded?.themas.map((thema: any, idx: number) => (
{getItems.data?.themas.map((thema: any, idx: number) => (
<span key={idx}>
{thema.hoofdthema + (idx !== getItems.data?.embedded?.themas?.length - 1 ? ", " : "")}
{thema.hoofdthema + (idx !== getItems.data?.themas?.length - 1 ? ", " : "")}
</span>
))}
</TableCell>
</TableRow>
)}

{getItems.data?.embedded?.informatieverzoek && (
{getItems.data?.metadata?.verzoek?.informatieverzoek && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Information request")}</TableCell>
<TableCell>
<Link href={getItems.data?.embedded?.informatieverzoek?.url} target="blank">
{getItems.data?.embedded?.informatieverzoek?.titel}
<Link href={getItems.data?.metadata?.verzoek?.informatieverzoek?.url} target="blank">
{getItems.data?.metadata?.verzoek?.informatieverzoek?.titel}
</Link>
</TableCell>
</TableRow>
)}

{(getItems.data?.besluit ||
(getItems.data?.embedded?.besluit ?? getItems.data?.embedded?.besluit?.url)) && (
{(getItems.data?.metadata?.verzoek.besluit ||
(getItems.data?.metadata?.verzoek?.besluit ?? getItems.data?.metadata?.verzoek?.besluit?.url)) && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Decision")}</TableCell>
<TableCell>
{(getItems.data?.embedded?.besluit ?? getItems.data?.embedded?.besluit?.url) && (
{(getItems.data?.metadata?.verzoek?.besluit ??
getItems.data?.metadata?.verzoek?.besluit?.url) && (
<Link
href={getItems.data?.embedded?.besluit?.url ?? getItems.data?.embedded?.besluit?.url}
href={
getItems.data?.metadata?.verzoek?.besluit?.url ??
getItems.data?.metadata?.verzoek?.besluit?.url
}
target="blank"
>
{getItems.data?.embedded?.besluit?.titel ??
getPDFName(getItems.data?.embedded?.besluit?.url)}
{getItems.data?.metadata?.verzoek?.besluit?.titel ??
getPDFName(getItems.data?.metadata?.verzoek?.besluit?.url)}
</Link>
)}
</TableCell>
</TableRow>
)}

{getItems.data?.embedded?.inventarisatielijst && (
{getItems.data?.metadata.verzoek?.inventarisatielijst && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Inventory list")}</TableCell>
<TableCell>
<Link href={getItems.data?.embedded?.inventarisatielijst?.url} target="blank">
{getItems.data?.embedded?.inventarisatielijst?.titel}
<Link href={getItems.data?.metadata.verzoek?.inventarisatielijst?.url} target="blank">
{getItems.data?.metadata.verzoek?.inventarisatielijst?.titel}
</Link>
</TableCell>
</TableRow>
)}

{getItems.data?.embedded?.bijlagen && (
{getItems.data?.bijlagen && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Attachments")}</TableCell>
<TableCell>
<UnorderedList>
{getItems.data?.embedded?.bijlagen.map(
{getItems.data?.bijlagen.map(
(bijlage: any, idx: number) =>
bijlage.titel && (
<UnorderedListItem key={idx}>
Expand Down

0 comments on commit 85df86e

Please sign in to comment.