Skip to content

Commit

Permalink
added publicationDate
Browse files Browse the repository at this point in the history
  • Loading branch information
remko48 committed Sep 22, 2023
1 parent fe8532b commit 97a36d3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
2 changes: 0 additions & 2 deletions pwa/src/services/dateFormat.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import dateFormat from "dateformat";

export const translateDate = (language: string, date: Date): string => {
if (!date) return "NVT";

switch (language) {
case "nl":
return dateFormat(date, "dd-mm-yyyy");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export const CardsResultsTemplate: React.FC<CardsResultsTemplateProps> = ({ requ
<CardWrapper key={request.id} className={styles.cardContainer} onClick={() => navigate(request.id)}>
<CardHeader>
<CardHeaderDate>
<FontAwesomeIcon icon={faClock} /> {translateDate(i18n.language, request.Publicatiedatum) ?? "-"}
<FontAwesomeIcon icon={faClock} />{" "}
{request.Publicatiedatum ? translateDate(i18n.language, request.Publicatiedatum) : "NVT"}
</CardHeaderDate>
<CardHeaderTitle className={styles.title}>
<Heading2>{request.Titel}</Heading2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const TableResultsTemplate: React.FC<TableResultsTemplateProps> = ({ requ
<TableRow>
<TableHeaderCell>Woo-verzoek</TableHeaderCell>
<TableHeaderCell>Onderwerp</TableHeaderCell>
<TableHeaderCell>Publicatiedatum</TableHeaderCell>
<TableHeaderCell>Ontvangstdatum</TableHeaderCell>
<TableHeaderCell>Besluitdatum</TableHeaderCell>
<TableHeaderCell>Besluit</TableHeaderCell>
Expand All @@ -35,8 +36,21 @@ export const TableResultsTemplate: React.FC<TableResultsTemplateProps> = ({ requ
<TableRow className={styles.tableRow} key={request.id} onClick={() => navigate(request.id)}>
<TableCell>{request.Titel}</TableCell>
<TableCell>{request.Categorie ?? "-"}</TableCell>
<TableCell>{translateDate(i18n.language, request.Ontvangstdatum) ?? "-"}</TableCell>
<TableCell>{translateDate(i18n.language, request.Besluitdatum) ?? "-"}</TableCell>
<TableCell>
{request.Publicatiedatum
? translateDate(i18n.language, request.Publicatiedatum)
: "Geen publicatiedatum beschikbaar"}
</TableCell>
<TableCell>
{request.Ontvangstdatum
? translateDate(i18n.language, request.Ontvangstdatum)
: "Geen ontvanstdatum beschikbaar"}
</TableCell>
<TableCell>
{request.Besluitdatum
? translateDate(i18n.language, request.Besluitdatum)
: "Geen besluitdatum beschikbaar"}
</TableCell>
<TableCell>{request.Besluit !== "" ? request.Besluit : "Geen besluit beschikbaar"}</TableCell>
</TableRow>
))}
Expand Down
11 changes: 11 additions & 0 deletions pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ export const WOOItemDetailTemplate: React.FC<WOOItemDetailTemplateProps> = ({ wo
</TableRow>
)}

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

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

0 comments on commit 97a36d3

Please sign in to comment.