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

Feature/XW-109/object-change #174

Merged
merged 5 commits into from
Nov 21, 2023
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
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 += `&oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`;
endpoint += `&behandelendBestuursorgaan.oidn=${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 += `&oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`;
endpoint += `&behandelendBestuursorgaan.oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`;
}

const { data } = await this._send(this._instance, "GET", endpoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ export const CardsResultsTemplate: React.FC<CardsResultsTemplateProps> = ({ requ
<div className={styles.componentsGrid}>
{requests.map((request) => (
<CardWrapper
key={request.id}
key={request._self.id}
className={styles.cardContainer}
onClick={() => 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")
}`}
>
<CardHeader className={styles.cardHeader}>
<CardHeaderDate>
{request.Publicatiedatum ? translateDate(i18n.language, request.Publicatiedatum) : t("N/A")}
{request.publicatiedatum ? translateDate(i18n.language, request.publicatiedatum) : t("N/A")}
</CardHeaderDate>
<CardHeaderTitle className={styles.title}>
<Heading2>{request.Titel ?? t("No title available")}</Heading2>
<Heading2>{request.titel ?? t("No title available")}</Heading2>
</CardHeaderTitle>
</CardHeader>

<Paragraph className={styles.description}>{request.Samenvatting}</Paragraph>
<Paragraph className={styles.description}>{request.samenvatting}</Paragraph>
</CardWrapper>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ export const TableResultsTemplate: React.FC<TableResultsTemplateProps> = ({ requ
{requests.map((request) => (
<TableRow
className={styles.tableRow}
key={request.id}
onClick={() => 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}`}
>
<TableCell>{request.Titel ?? t("No subject available")}</TableCell>
<TableCell>{request.titel ?? t("No subject available")}</TableCell>
<TableCell>
{request.Publicatiedatum
? translateDate(i18n.language, request.Publicatiedatum)
{request.publicatiedatum
? translateDate(i18n.language, request.publicatiedatum)
: t("No publication date available")}
</TableCell>
<TableCell>{request.Samenvatting ?? t("No summary available")}</TableCell>
<TableCell>{request.samenvatting ?? t("No summary available")}</TableCell>
</TableRow>
))}
</TableBody>
Expand Down
93 changes: 49 additions & 44 deletions pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const WOOItemDetailTemplate: React.FC<WOOItemDetailTemplateProps> = ({ wo
{getItems.isSuccess && (
<>
<Heading1 id="mainContent">
{getItems.data.Titel !== "" ? getItems.data.Titel : t("No title available")}
{getItems.data.titel !== "" ? getItems.data.titel : t("No title available")}
</Heading1>

<HorizontalOverflowWrapper
Expand All @@ -64,73 +64,77 @@ export const WOOItemDetailTemplate: React.FC<WOOItemDetailTemplateProps> = ({ wo
>
<Table className={styles.table}>
<TableBody className={styles.tableBody}>
{getItems.data.ID && (
{getItems.data.id && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Feature")}</TableCell>
<TableCell>{isUUID(getItems.data.ID) ? getItems.data.Object_ID : getItems.data.ID}</TableCell>
<TableCell>
{isUUID(getItems.data._self.id) ? getItems.data.id : getItems.data._self.id}
</TableCell>
</TableRow>
)}

{getItems.data.Titel && (
{getItems.data.titel && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Category")}</TableCell>
<TableCell>{getItems.data.Categorie ?? "-"}</TableCell>
<TableCell>{getItems.data.categorie ?? "-"}</TableCell>
</TableRow>
)}

{getItems.data.Samenvatting && (
{getItems.data.samenvatting && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Summary")}</TableCell>
<TableCell>{getItems.data.Samenvatting}</TableCell>
<TableCell>{getItems.data.samenvatting}</TableCell>
</TableRow>
)}
{getItems.data.Beschrijving && (
{getItems.data.beschrijving && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Description")}</TableCell>
<TableCell>{getItems.data.Beschrijving}</TableCell>
<TableCell>{getItems.data.beschrijving}</TableCell>
</TableRow>
)}

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

{getItems.data.Publicatiedatum && (
{getItems.data.publicatiedatum && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Publication date")}</TableCell>
<TableCell>
{getItems.data.Publicatiedatum
? translateDate(i18n.language, getItems.data.Publicatiedatum)
{getItems.data.publicatiedatum
? translateDate(i18n.language, getItems.data.publicatiedatum)
: "-"}
</TableCell>
</TableRow>
)}

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

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

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

{getItems.data?.embedded?.Themas && (
{getItems.data?.embedded?.themas && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Themes")}</TableCell>
<TableCell>
{getItems.data?.embedded?.Themas.map((thema: any, idx: number) => (
{getItems.data?.embedded?.themas.map((thema: any, idx: number) => (
<span key={idx}>
{thema.Hoofdthema + (idx !== getItems.data?.embedded?.Themas.length - 1 ? ", " : "")}
{thema.hoofdthema + (idx !== getItems.data?.embedded?.themas?.length - 1 ? ", " : "")}
</span>
))}
</TableCell>
Expand All @@ -141,27 +145,25 @@ export const WOOItemDetailTemplate: React.FC<WOOItemDetailTemplateProps> = ({ wo
<TableRow className={styles.tableRow}>
<TableCell>{t("Information request")}</TableCell>
<TableCell>
<Link href={getItems.data?.embedded?.informatieverzoek.URL_Bijlage} target="blank">
{getItems.data?.embedded?.informatieverzoek?.Titel_Bijlage}
<Link href={getItems.data?.embedded?.informatieverzoek?.url} target="blank">
{getItems.data?.embedded?.informatieverzoek?.titel}
</Link>
</TableCell>
</TableRow>
)}

{(getItems.data.Besluit || (getItems.data?.embedded?.besluit ?? getItems.data.URL_besluit)) && (
{(getItems.data?.besluit ||
(getItems.data?.embedded?.besluit ?? getItems.data?.embedded?.besluit?.url)) && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Decision")}</TableCell>
<TableCell>
{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) && (
<Link
href={getItems.data?.embedded?.besluit?.URL_Bijlage ?? getItems.data.URL_besluit}
href={getItems.data?.embedded?.besluit?.url ?? getItems.data?.embedded?.besluit?.url}
target="blank"
>
{getItems.data?.embedded?.besluit?.Titel_Bijlage ?? getPDFName(getItems.data.URL_besluit)}
{getItems.data?.embedded?.besluit?.titel ??
getPDFName(getItems.data?.embedded?.besluit?.url)}
</Link>
)}
</TableCell>
Expand All @@ -172,28 +174,31 @@ export const WOOItemDetailTemplate: React.FC<WOOItemDetailTemplateProps> = ({ wo
<TableRow className={styles.tableRow}>
<TableCell>{t("Inventory list")}</TableCell>
<TableCell>
<Link href={getItems.data?.embedded?.inventarisatielijst?.URL_Bijlage} target="blank">
{getItems.data?.embedded?.inventarisatielijst?.Titel_Bijlage}
<Link href={getItems.data?.embedded?.inventarisatielijst?.url} target="blank">
{getItems.data?.embedded?.inventarisatielijst?.titel}
</Link>
</TableCell>
</TableRow>
)}

{getItems.data?.embedded?.Bijlagen && (
{getItems.data?.embedded?.bijlagen && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Attachments")}</TableCell>
<TableCell>
<UnorderedList>
{getItems.data?.embedded?.Bijlagen.map((bijlage: any, idx: number) => (
<UnorderedListItem key={idx}>
<Link
href={bijlage.URL_Bijlage?.length !== 0 ? bijlage.URL_Bijlage : "#"}
target={bijlage.URL_Bijlage?.length !== 0 ? "blank" : ""}
>
{bijlage.Titel_Bijlage}
</Link>
</UnorderedListItem>
))}
{getItems.data?.embedded?.bijlagen.map(
(bijlage: any, idx: number) =>
bijlage.titel && (
<UnorderedListItem key={idx}>
<Link
href={bijlage.url?.length !== 0 ? bijlage.url : "#"}
target={bijlage.url?.length !== 0 ? "blank" : ""}
>
{bijlage.titel}
</Link>
</UnorderedListItem>
),
)}
</UnorderedList>
</TableCell>
</TableRow>
Expand Down
Loading