diff --git a/mocks/collections.json b/mocks/collections.json
index 0dc2c0f8c3..e8727df428 100644
--- a/mocks/collections.json
+++ b/mocks/collections.json
@@ -55,12 +55,14 @@
"get-wpi-specificaties:standard",
"post-afis-businesspartner-bsn:standard",
"post-afis-businesspartner-kvk:standard",
- "post-afis-factuur-document:standard",
+ "get-afis-factuur-document:standard",
"get-afis-businesspartner-details:standard",
+ "get-afis-businesspartner-address:standard",
"get-afis-businesspartner-phonenumber:standard",
"get-afis-businesspartner-emailaddress:standard",
"get-afis-facturen:standard",
"get-afis-factuur-id:standard",
+ "get-afis-paylink:standard",
"get-powerbrowser-bb-vergunning-attachments:standard",
"post-powerbrowser-bb-vergunning-attachments:standard",
"post-powerbrowser-token:standard",
diff --git a/mocks/fixtures/afis/afgehandelde-facturen.json b/mocks/fixtures/afis/afgehandelde-facturen.json
index b75bcfa293..05e5ed0200 100644
--- a/mocks/fixtures/afis/afgehandelde-facturen.json
+++ b/mocks/fixtures/afis/afgehandelde-facturen.json
@@ -15,6 +15,7 @@
"@rel": "self",
"@title": "SomeITEM"
},
+ "count": 10,
"entry": [
{
"content": {
@@ -24,8 +25,10 @@
"DunningLevel": 0,
"ProfitCenterName": "Lisan al Gaib inc.",
"NetDueDate": "2023-12-21T00:00:00",
+ "ClearingDate": "2024-05-01",
"ReverseDocument": "someReverseDocument123",
- "InvoiceNo": "INV-2023-010"
+ "DocumentReferenceID": "INV-2023-010",
+ "AccountingDocument": "INV-2023-010"
}
}
},
@@ -37,8 +40,10 @@
"DunningLevel": 0,
"ProfitCenterName": "Lisan al Gaib inc.",
"NetDueDate": "2023-12-12T00:00:00",
+ "ClearingDate": "2024-05-01",
"ReverseDocument": "someReverseDocument123",
- "InvoiceNo": "INV-2023-008"
+ "DocumentReferenceID": "INV-2023-008",
+ "AccountingDocument": "INV-2023-008"
}
}
},
@@ -50,8 +55,10 @@
"DunningLevel": 0,
"ProfitCenterName": "Lisan al Gaib inc.",
"NetDueDate": "2023-10-26T00:00:00",
+ "ClearingDate": "2024-05-01",
"ReverseDocument": "someReverseDocument123",
- "InvoiceNo": "INV-2023-006"
+ "DocumentReferenceID": "INV-2023-006",
+ "AccountingDocument": "INV-2023-006"
}
}
},
@@ -63,8 +70,10 @@
"DunningLevel": 0,
"ProfitCenterName": "Stellar Innovations Corp.",
"NetDueDate": "2023-08-09T00:00:00",
+ "ClearingDate": "2024-05-01",
"ReverseDocument": "someReverseDocument123",
- "InvoiceNo": "INV-2023-005"
+ "DocumentReferenceID": "INV-2023-005",
+ "AccountingDocument": "INV-2023-005"
}
}
},
@@ -76,8 +85,10 @@
"DunningLevel": 2,
"ProfitCenterName": "Eco Synergy Solutions",
"NetDueDate": "2023-07-27T00:00:00",
+ "ClearingDate": "2024-05-01",
"ReverseDocument": "",
- "InvoiceNo": "INV-2023-003"
+ "DocumentReferenceID": "INV-2023-003",
+ "AccountingDocument": "INV-2023-003"
}
}
},
@@ -89,8 +100,10 @@
"DunningLevel": 0,
"ProfitCenterName": "Nebula Dynamics Ltd.",
"NetDueDate": "2023-06-12T00:00:00",
+ "ClearingDate": "2024-05-01",
"ReverseDocument": "",
- "InvoiceNo": "INV-2023-001"
+ "DocumentReferenceID": "INV-2023-001",
+ "AccountingDocument": "INV-2023-001"
}
}
},
@@ -102,8 +115,10 @@
"DunningLevel": 0,
"ProfitCenterName": "Quantum Horizons GmbH",
"NetDueDate": "2023-05-11T00:00:00",
+ "ClearingDate": "2024-05-01",
"ReverseDocument": "",
- "InvoiceNo": "INV-2023-002"
+ "DocumentReferenceID": "INV-2023-002",
+ "AccountingDocument": "INV-2023-002"
}
}
},
@@ -115,8 +130,10 @@
"DunningLevel": 0,
"ProfitCenterName": "Cyber Nexus Technologies",
"NetDueDate": "2023-04-28T00:00:00",
+ "ClearingDate": "2024-05-01",
"ReverseDocument": "someReverseDocument123",
- "InvoiceNo": "INV-2023-004"
+ "DocumentReferenceID": "INV-2023-004",
+ "AccountingDocument": "INV-2023-004"
}
}
},
@@ -128,8 +145,10 @@
"DunningLevel": 0,
"ProfitCenterName": "Lisan al Gaib inc.",
"NetDueDate": "2023-01-31T00:00:00",
+ "ClearingDate": "2024-05-01",
"ReverseDocument": "someReverseDocument123",
- "InvoiceNo": "INV-2023-007"
+ "DocumentReferenceID": "INV-2023-007",
+ "AccountingDocument": "INV-2023-007"
}
}
},
@@ -141,8 +160,10 @@
"DunningLevel": 0,
"ProfitCenterName": "Lisan al Gaib inc.",
"NetDueDate": "2023-01-01T00:00:00",
+ "ClearingDate": "2024-05-01",
"ReverseDocument": "someReverseDocument123",
- "InvoiceNo": "INV-2023-009"
+ "DocumentReferenceID": "INV-2023-009",
+ "AccountingDocument": "INV-2023-009"
}
}
}
diff --git a/mocks/fixtures/afis/openstaande-facturen.json b/mocks/fixtures/afis/openstaande-facturen.json
index bef1e9cd88..a72c83e2c7 100644
--- a/mocks/fixtures/afis/openstaande-facturen.json
+++ b/mocks/fixtures/afis/openstaande-facturen.json
@@ -15,6 +15,7 @@
"@rel": "self",
"@title": "SomeITEM"
},
+ "count": 7,
"entry": [
{
"content": {
@@ -28,8 +29,9 @@
"NetDueDate": "2023-12-21T00:00:00",
"NetPaymentAmount": "0.00",
"AmountInBalanceTransacCrcy": "343.00",
- "InvoiceNo": "5555555",
- "Paylink": "http://localhost:3100/mocks-server/afis/paylink"
+ "DocumentReferenceID": "5555555",
+ "AccountingDocument": "5555555",
+ "Paylink": "http://localhost:3100/mocks-api/afis/paylink"
}
}
},
@@ -45,8 +47,9 @@
"NetDueDate": "2023-12-12T00:00:00",
"NetPaymentAmount": "0.00",
"AmountInBalanceTransacCrcy": "-80.00",
- "InvoiceNo": "5555555",
- "Paylink": "http://localhost:3100/mocks-server/afis/paylink"
+ "DocumentReferenceID": "5555555",
+ "AccountingDocument": "5555555",
+ "Paylink": "http://localhost:3100/mocks-api/afis/paylink"
}
}
},
@@ -62,8 +65,9 @@
"NetDueDate": "2023-10-26T00:00:00",
"NetPaymentAmount": "0.00",
"AmountInBalanceTransacCrcy": "-12.10",
- "InvoiceNo": "5555555",
- "Paylink": "http://localhost:3100/mocks-server/afis/paylink"
+ "DocumentReferenceID": "5555555",
+ "AccountingDocument": "5555555",
+ "Paylink": "http://localhost:3100/mocks-api/afis/paylink"
}
}
},
@@ -79,8 +83,9 @@
"NetDueDate": "2023-08-09T00:00:00",
"NetPaymentAmount": "0.00",
"AmountInBalanceTransacCrcy": "-16.00",
- "InvoiceNo": "5555555",
- "Paylink": "http://localhost:3100/mocks-server/afis/paylink"
+ "DocumentReferenceID": "5555555",
+ "AccountingDocument": "5555555",
+ "Paylink": "http://localhost:3100/mocks-api/afis/paylink"
}
}
},
@@ -96,8 +101,9 @@
"NetDueDate": "2023-03-23T00:00:00",
"NetPaymentAmount": "-900.98",
"AmountInBalanceTransacCrcy": "1000.00",
- "InvoiceNo": "5555555",
- "Paylink": "http://localhost:3100/mocks-server/afis/paylink"
+ "DocumentReferenceID": "5555555",
+ "AccountingDocument": "5555555",
+ "Paylink": "http://localhost:3100/mocks-api/afis/paylink"
}
}
},
@@ -113,8 +119,9 @@
"NetDueDate": "2023-01-31T00:00:00",
"NetPaymentAmount": "0.00",
"AmountInBalanceTransacCrcy": "121.00",
- "InvoiceNo": "5555555",
- "Paylink": "http://localhost:3100/mocks-server/afis/paylink"
+ "DocumentReferenceID": "5555555",
+ "AccountingDocument": "5555555",
+ "Paylink": "http://localhost:3100/mocks-api/afis/paylink"
}
}
},
@@ -132,8 +139,9 @@
},
"NetPaymentAmount": "0.00",
"AmountInBalanceTransacCrcy": "230.00",
- "InvoiceNo": "5555555",
- "Paylink": "http://localhost:3100/mocks-server/afis/paylink"
+ "DocumentReferenceID": "5555555",
+ "AccountingDocument": "5555555",
+ "Paylink": "http://localhost:3100/mocks-api/afis/paylink"
}
}
}
diff --git a/mocks/fixtures/afis/overgedragen-facturen.json b/mocks/fixtures/afis/overgedragen-facturen.json
new file mode 100644
index 0000000000..f14b4e29f6
--- /dev/null
+++ b/mocks/fixtures/afis/overgedragen-facturen.json
@@ -0,0 +1,37 @@
+{
+ "feed": {
+ "@base": "https://sap:8080OPERACCTGDOCITEM_CDS/",
+ "id": "https://sap:8080OPERACCTGDOCITEM_CDS/SomeITEM",
+ "title": {
+ "@type": "text",
+ "$": "SomeITEM"
+ },
+ "updated": "2000-01-22T11:32:02Z",
+ "author": {
+ "name": ""
+ },
+ "link": {
+ "@href": "SomeITEM",
+ "@rel": "self",
+ "@title": "SomeITEM"
+ },
+ "count": 1,
+ "entry": [
+ {
+ "content": {
+ "@type": "application/xml",
+ "properties": {
+ "IsCleared": true,
+ "DunningLevel": 3,
+ "ProfitCenterName": "Qui-gon jinn",
+ "NetDueDate": "2023-12-21T00:00:00",
+ "ClearingDate": "2024-05-01",
+ "ReverseDocument": "",
+ "DocumentReferenceID": "INV-2024-001",
+ "AccountingDocument": "INV-2024-001"
+ }
+ }
+ }
+ ]
+ }
+}
diff --git a/mocks/routes/afis.js b/mocks/routes/afis.js
index b6b60e9b57..114a1721c7 100644
--- a/mocks/routes/afis.js
+++ b/mocks/routes/afis.js
@@ -65,17 +65,35 @@ module.exports = [
'@type': 'application/xml',
properties: {
BusinessPartner: 515177,
- FullName: 'Taxon Expeditions BV',
+ BusinessPartnerFullName: 'Taxon Expeditions BV',
+ },
+ },
+ },
+ ],
+ },
+ },
+ },
+ },
+ ],
+ },
+ {
+ id: 'get-afis-businesspartner-address',
+ url: `${settings.MOCK_BASE_PATH}${REST_BASE}/API/ZAPI_BUSINESS_PARTNER_DET_SRV/A_BusinessPartnerAddress`,
+ method: 'GET',
+ variants: [
+ {
+ id: 'standard',
+ type: 'json',
+ options: {
+ status: 200,
+ body: {
+ feed: {
+ entry: [
+ {
+ content: {
+ '@type': 'application/xml',
+ properties: {
AddressID: 430844,
- CityName: 'Leiden',
- Country: 'NL',
- HouseNumber: 20,
- HouseNumberSupplementText: '',
- PostalCode: '2311 VW',
- Region: '',
- StreetName: 'Rembrandtstraat',
- StreetPrefixName: '',
- StreetSuffixName: '',
},
},
},
@@ -152,16 +170,41 @@ module.exports = [
type: 'middleware',
options: {
middleware: (req, res) => {
- const isAboutClosedInvoices = req.query?.['$filter']?.includes(
- `IsCleared eq true and (DunningLevel eq '0' or ReverseDocument ne '')`
- );
- const filename = isAboutClosedInvoices
- ? 'afgehandelde-facturen'
- : 'openstaande-facturen';
+ const stateFilters = {
+ openstaande: 'IsCleared eq false',
+ afgehandelde: `DunningLevel ne '3' or ReverseDocument ne ''`,
+ overgedragen: `DunningLevel eq '3'`,
+ };
+
+ const stateName = Object.entries(stateFilters).find(
+ ([name, filterValueSegment]) => {
+ return req.query?.['$filter']?.includes(filterValueSegment);
+ }
+ )?.[0];
+
+ if (!stateName) {
+ return res.status(500).end();
+ }
// DO NOT adjust this mock data (tests depend on it).
// If needed copy, mutate and let it point to the newly made copy.
- return res.send(require(`../fixtures/afis/${filename}.json`));
+ const facturenData = require(
+ `../fixtures/afis/${stateName}-facturen.json`
+ );
+
+ if (req.query?.['$top']) {
+ return res.send({
+ feed: {
+ count: facturenData.feed.count,
+ entry: facturenData.feed.entry.slice(
+ 0,
+ parseInt(req.query?.['$top'], 10)
+ ),
+ },
+ });
+ }
+
+ return res.send(facturenData);
},
},
},
@@ -183,9 +226,9 @@ module.exports = [
],
},
{
- id: 'post-afis-factuur-document',
- url: `${settings.MOCK_BASE_PATH}${REST_BASE}/getDebtorInvoice/API_CV_ATTACHMENT_SRV/`,
- method: 'POST',
+ id: 'get-afis-factuur-document',
+ url: `${settings.MOCK_BASE_PATH}${REST_BASE}/API/ZFI_OPERACCTGDOCITEM_CDS/ZFI_CDS_TOA02`,
+ method: 'GET',
variants: [
{
id: 'standard',
@@ -197,4 +240,21 @@ module.exports = [
},
],
},
+ {
+ id: 'get-afis-paylink',
+ url: `${settings.MOCK_BASE_PATH}/afis/paylink`,
+ method: 'GET',
+ variants: [
+ {
+ id: 'standard',
+ type: 'middleware',
+ options: {
+ middleware: (req, res, next, core) => {
+ const htmlResponse = `
Afis factuur betalen Betaal factuur `;
+ res.send(htmlResponse);
+ },
+ },
+ },
+ ],
+ },
];
diff --git a/src/client/components/DocumentList/DocumentLink.tsx b/src/client/components/DocumentList/DocumentLink.tsx
index 0ec8b59baf..5ff1ef0841 100644
--- a/src/client/components/DocumentList/DocumentLink.tsx
+++ b/src/client/components/DocumentList/DocumentLink.tsx
@@ -53,6 +53,7 @@ export function DocumentLink({
if (isLoading) {
return false;
}
+ setErrorVisible(false);
setLoading(true);
if (!('fetch' in window) || document?.external) {
@@ -122,7 +123,7 @@ export function DocumentLink({
});
return false;
},
- [document, profileType, isLoading, trackPath, userCity]
+ [document, profileType, isLoading, trackPath, userCity, setErrorVisible]
);
return (
diff --git a/src/client/components/ListPagePaginated/ListPagePaginated.tsx b/src/client/components/ListPagePaginated/ListPagePaginated.tsx
index 2673a6eb79..84b7095a30 100644
--- a/src/client/components/ListPagePaginated/ListPagePaginated.tsx
+++ b/src/client/components/ListPagePaginated/ListPagePaginated.tsx
@@ -20,17 +20,18 @@ interface ListPagePaginatedProps {
appRouteBack: string;
appRouteParams?: Record | null;
backLinkTitle?: string;
+ body?: ReactNode;
displayProps: DisplayProps | null;
+ errorText?: string;
isError: boolean;
isLoading: boolean;
items: T[];
- title: string;
- body?: ReactNode;
- thema?: Thema;
- tableClassName?: string;
- errorText?: string;
noItemsText?: string;
pageSize?: number;
+ tableClassName?: string;
+ thema?: Thema;
+ title: string;
+ totalCount?: number;
}
export function ListPagePaginated({
@@ -47,6 +48,7 @@ export function ListPagePaginated({
isLoading,
items,
pageSize = DEFAULT_PAGE_SIZE,
+ totalCount,
tableClassName,
title,
}: ListPagePaginatedProps) {
@@ -70,7 +72,7 @@ export function ListPagePaginated({
return items.slice(start, end);
}, [currentPage, items, pageSize]);
- const total = items.length;
+ const total = totalCount ?? items.length;
return (
diff --git a/src/client/components/Table/TableV2.tsx b/src/client/components/Table/TableV2.tsx
index 06eed8c3b5..f56f0efb96 100644
--- a/src/client/components/Table/TableV2.tsx
+++ b/src/client/components/Table/TableV2.tsx
@@ -1,4 +1,4 @@
-import { Table } from '@amsterdam/design-system-react';
+import { Heading, Paragraph, Table } from '@amsterdam/design-system-react';
import classNames from 'classnames';
import { ReactNode } from 'react';
import { capitalizeFirstLetter } from '../../../universal/helpers/text';
@@ -54,10 +54,12 @@ export interface TableV2Props {
className?: string;
showTHead?: boolean;
caption?: string;
+ subTitle?: string;
}
export function TableV2({
caption,
+ subTitle,
items,
displayProps,
className,
@@ -65,40 +67,50 @@ export function TableV2({
}: TableV2Props) {
const displayPropEntries = displayProps !== null ? entries(displayProps) : [];
return (
-
- {!!caption && {caption} }
- {showTHead && (
-
-
- {displayPropEntries.map(([key, label], index) => {
- if (!!label) {
- return (
- {label}
- );
- }
- return {label} ;
- })}
-
-
+ <>
+ {!!caption && (
+
+ {caption}
+
)}
-
- {items.map((item, index) => {
- const key = String(
- 'id' in item ? item.id : `item-${index}` ?? `tr-${index}`
- );
- return (
-
- {displayPropEntries.map(([key]) => {
- return (
-
- {item[key] as ReactNode}
-
- );
+
+ {!!subTitle && {subTitle} }
+
+ {showTHead && (
+
+
+ {displayPropEntries.map(([key, label], index) => {
+ if (!!label) {
+ return (
+
+ {label}
+
+ );
+ }
+ return {label} ;
})}
- );
- })}
-
-
+
+ )}
+
+ {items.map((item, index) => {
+ const key = String(
+ ('id' in item ? item.id : `item-${index}`) ?? `tr-${index}`
+ );
+ return (
+
+ {displayPropEntries.map(([key]) => {
+ return (
+
+ {item[key] as ReactNode}
+
+ );
+ })}
+
+ );
+ })}
+
+
+ >
);
}
diff --git a/src/client/config/thema.ts b/src/client/config/thema.ts
index c4a9810ae3..afd06bae94 100644
--- a/src/client/config/thema.ts
+++ b/src/client/config/thema.ts
@@ -128,7 +128,14 @@ export const DocumentTitles: DocumentTitlesConfig = {
[AppRoutes.API1_LOGIN]: 'Inloggen | Mijn Amsterdam',
[AppRoutes.API2_LOGIN]: 'Inloggen | Mijn Amsterdam',
[AppRoutes.ZAAK_STATUS]: 'Status van uw Zaak | Mijn Amsterdam',
- [AppRoutes.AFIS]: 'Facturen en betalen | Mijn Amsterdam',
+ [AppRoutes.AFIS]: 'Facturen en betalen | overzicht',
+ [generatePath(AppRoutes['AFIS/FACTUREN'], { state: 'open' })]:
+ 'Open facturen | Facturen en betalen',
+ [generatePath(AppRoutes['AFIS/FACTUREN'], { state: 'afgehandeld' })]:
+ 'Afgehanelde facturen | Facturen en betalen',
+ [generatePath(AppRoutes['AFIS/FACTUREN'], { state: 'overgedragen' })]:
+ 'Overgedragen aan belastingen facturen | Facturen en betalen',
+ [AppRoutes['AFIS/FACTUREN']]: 'Lijst met facturen | Facturen en betalen',
[AppRoutes['AFIS/BETAALVOORKEUREN']]:
'Betaalvoorkeuren | Facturen en betalen',
};
diff --git a/src/client/hooks/useAppState.ts b/src/client/hooks/useAppState.ts
index 7043767380..d6ff509699 100644
--- a/src/client/hooks/useAppState.ts
+++ b/src/client/hooks/useAppState.ts
@@ -1,5 +1,11 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
-import { SetterOrUpdater, atom, useRecoilState, useRecoilValue } from 'recoil';
+import {
+ SetterOrUpdater,
+ atom,
+ useRecoilState,
+ useRecoilValue,
+ useSetRecoilState,
+} from 'recoil';
import { streamEndpointQueryParamKeys } from '../../universal/config/app';
import { FeatureToggle } from '../../universal/config/feature-toggles';
import {
@@ -19,6 +25,7 @@ import { captureMessage } from '../utils/monitoring';
import { useDataApi } from './api/useDataApi';
import { useProfileTypeValue } from './useProfileType';
import { SSE_ERROR_MESSAGE, useSSE } from './useSSE';
+import { entries } from '../../universal/helpers/utils';
const fallbackServiceRequestOptions = {
postpone: true,
@@ -253,13 +260,15 @@ export function useAppStateBagApi({
);
useEffect(() => {
+ // Initial automatic fetch
if (url && !isApiDataCached && !api.isDirty && !api.isLoading) {
fetch({
url,
postpone: false,
});
}
- if (!isApiDataCached && !!api.data.content) {
+
+ if (!isApiDataCached && api.isDirty && !api.isLoading) {
setAppState((state) => {
let localState = state[bagThema];
if (!localState) {
@@ -268,7 +277,7 @@ export function useAppStateBagApi({
localState = {
...localState,
- [key]: api.data.content as T,
+ [key]: api.data as ApiResponse,
};
return {
@@ -279,7 +288,19 @@ export function useAppStateBagApi({
}
}, [isApiDataCached, api, key, url]);
- return [appState?.[bagThema]?.[key] as T, api, fetch] as const;
+ return [
+ (appState?.[bagThema]?.[key] as ApiResponse) || api.data, // Return the response data from remote system or the pristine data provided to useApiData.
+ fetch,
+ isApiDataCached,
+ ] as const;
+}
+
+export function useGetAppStateBagDataByKey({
+ bagThema,
+ key,
+}: Omit): ApiResponse | null {
+ const appState = useRecoilValue(appStateAtom);
+ return appState?.[bagThema]?.[key] ?? null;
}
export function useRemoveAppStateBagData() {
@@ -291,7 +312,7 @@ export function useRemoveAppStateBagData() {
setAppState(
Object.assign({}, appState, {
[bagThema]: Object.fromEntries(
- Object.entries(local).filter(([key]) => {
+ entries(local).filter(([key]) => {
return keyExpected !== key;
})
),
diff --git a/src/client/pages/Afis/Afis-thema-config.ts b/src/client/pages/Afis/Afis-thema-config.ts
index fd62251e0e..03adf6fde6 100644
--- a/src/client/pages/Afis/Afis-thema-config.ts
+++ b/src/client/pages/Afis/Afis-thema-config.ts
@@ -1,50 +1,102 @@
import { ReactNode } from 'react';
+import { generatePath } from 'react-router-dom';
+import {
+ AfisFacturenByStateResponse,
+ AfisFacturenResponse,
+ AfisFactuur,
+ AfisFactuurState,
+} from '../../../server/services/afis/afis-types';
import { AppRoutes } from '../../../universal/config/routes';
import { ZaakDetail } from '../../../universal/types';
-import { MAX_TABLE_ROWS_ON_THEMA_PAGINA } from '../../config/app';
-import { AfisFactuur } from '../../../server/services/afis/afis-types';
import { DisplayProps } from '../../components/Table/TableV2';
-
-export type AfisEmandateStub = ZaakDetail & Record;
-
-export type AfisFactuurFrontend = AfisFactuur & {
- factuurNummerEl: ReactNode;
-};
+import { MAX_TABLE_ROWS_ON_THEMA_PAGINA } from '../../config/app';
// Themapagina
const MAX_TABLE_ROWS_ON_THEMA_PAGINA_OPEN = 5;
+const MAX_TABLE_ROWS_ON_THEMA_PAGINA_TRANSFERRED =
+ MAX_TABLE_ROWS_ON_THEMA_PAGINA;
const MAX_TABLE_ROWS_ON_THEMA_PAGINA_CLOSED = MAX_TABLE_ROWS_ON_THEMA_PAGINA;
-const displayPropsFacturen: DisplayProps = {
+const displayPropsFacturenOpen: DisplayProps = {
afzender: 'Afzender',
- factuurNummer: 'Factuurnummer',
+ factuurNummerEl: 'Factuurnummer',
statusDescription: 'Status',
paymentDueDateFormatted: 'Vervaldatum',
};
-export const listPageParamKind = {
- open: 'open',
- closed: 'closed',
-} as const;
+const displayPropsFacturenAfgehandeld: DisplayProps = {
+ afzender: 'Afzender',
+ factuurNummerEl: 'Factuurnummer',
+ statusDescription: 'Status',
+};
-export type ListPageParamKey = keyof typeof listPageParamKind;
-export type ListPageParamKind = (typeof listPageParamKind)[ListPageParamKey];
+const displayPropsFacturenOvergedragen: DisplayProps = {
+ afzender: 'Afzender',
+ factuurNummerEl: 'Factuurnummer',
+ statusDescription: 'Status',
+};
-export const listPageTitle = {
- [listPageParamKind.open]: 'Openstaande facturen',
- [listPageParamKind.closed]: 'Afgehandelde facturen',
-} as const;
+export const listPageTitle: Record = {
+ open: 'Openstaande facturen',
+ afgehandeld: 'Afgehandelde facturen',
+ overgedragen: 'Overgedragen facturen',
+};
-export const facturenTableConfig = {
- [listPageParamKind.open]: {
- title: listPageTitle[listPageParamKind.open],
- displayProps: displayPropsFacturen,
+export type AfisEmandateStub = ZaakDetail & Record;
+
+export type AfisFactuurFrontend = AfisFactuur & {
+ factuurNummerEl: ReactNode;
+};
+
+export type AfisFacturenResponseFrontend = AfisFacturenResponse & {
+ facturen: AfisFactuurFrontend[];
+};
+
+export type AfisFacturenByStateFrontend = {
+ [key in keyof AfisFacturenByStateResponse]: AfisFacturenResponseFrontend;
+};
+
+type AfisFacturenTableConfig = {
+ title: string;
+ subTitle?: string;
+ displayProps: DisplayProps;
+ maxItems: number;
+ listPageLinkLabel: string;
+ listPageRoute: string;
+};
+
+type AfisFacturenTableConfigByState = Record<
+ AfisFactuurState,
+ AfisFacturenTableConfig
+>;
+
+export const facturenTableConfig: AfisFacturenTableConfigByState = {
+ open: {
+ title: listPageTitle.open,
+ displayProps: displayPropsFacturenOpen,
maxItems: MAX_TABLE_ROWS_ON_THEMA_PAGINA_OPEN,
+ listPageLinkLabel: 'Alle openstaande facturen',
+ listPageRoute: generatePath(AppRoutes['AFIS/FACTUREN'], {
+ state: 'open',
+ }),
},
- [listPageParamKind.closed]: {
- title: listPageTitle[listPageParamKind.closed],
- displayProps: displayPropsFacturen,
+ afgehandeld: {
+ title: listPageTitle.afgehandeld,
+ displayProps: displayPropsFacturenAfgehandeld,
maxItems: MAX_TABLE_ROWS_ON_THEMA_PAGINA_CLOSED,
+ listPageLinkLabel: 'Alle afgehandelde facturen',
+ listPageRoute: generatePath(AppRoutes['AFIS/FACTUREN'], {
+ state: 'afgehandeld',
+ }),
+ },
+ overgedragen: {
+ title: listPageTitle.overgedragen,
+ displayProps: displayPropsFacturenOvergedragen,
+ maxItems: MAX_TABLE_ROWS_ON_THEMA_PAGINA_TRANSFERRED,
+ listPageLinkLabel: 'Alle overgedragen facturen',
+ listPageRoute: generatePath(AppRoutes['AFIS/FACTUREN'], {
+ state: 'overgedragen',
+ }),
},
} as const;
@@ -53,6 +105,13 @@ const displayPropsEmandates: DisplayProps = {
name: 'Naam',
};
+export const businessPartnerDetailsLabels = {
+ fullName: 'Debiteurnaam',
+ businessPartnerId: 'Debiteurnummer',
+ email: 'E-mailadres factuur',
+ phone: 'Telefoonnummer',
+};
+
export const eMandateTableConfig = {
active: {
title: `Actieve automatische incasso's`,
diff --git a/src/client/pages/Afis/Afis.module.scss b/src/client/pages/Afis/Afis.module.scss
index daa8f230d9..cad0d6c754 100644
--- a/src/client/pages/Afis/Afis.module.scss
+++ b/src/client/pages/Afis/Afis.module.scss
@@ -1,6 +1,19 @@
+@import '../../styles/_global.scss';
+
.FacturenTable {
- tr td:nth-child(2) {
- white-space: normal;
- word-wrap: break-word;
+ tr {
+ th,
+ td {
+ @media screen and (min-width: $ams-breakpoint-medium) {
+ &:nth-child(1),
+ &:nth-child(2) {
+ width: 25%;
+ }
+ }
+ &:nth-child(2) {
+ white-space: normal;
+ word-wrap: break-word;
+ }
+ }
}
}
diff --git a/src/client/pages/Afis/Afis.test.tsx b/src/client/pages/Afis/Afis.test.tsx
index 1b2145229c..cfd5d41347 100644
--- a/src/client/pages/Afis/Afis.test.tsx
+++ b/src/client/pages/Afis/Afis.test.tsx
@@ -1,17 +1,16 @@
import { render, waitFor } from '@testing-library/react';
-
import { generatePath } from 'react-router-dom';
import { MutableSnapshot } from 'recoil';
+import {
+ AfisBusinessPartnerDetailsTransformed,
+ AfisFacturenByStateResponse,
+} from '../../../server/services/afis/afis-types';
+import { bffApi } from '../../../test-utils';
import { AppRoutes } from '../../../universal/config/routes';
import { AppState } from '../../../universal/types';
import { appStateAtom } from '../../hooks/useAppState';
import MockApp from '../MockApp';
import { AfisThemaPagina } from './Afis';
-import { bffApi } from '../../../test-utils';
-import {
- AfisBusinessPartnerDetailsTransformed,
- AfisFactuur,
-} from '../../../server/services/afis/afis-types';
const businessPartnerIdEncrypted = 'xxx-123-xxx';
const testState = {
@@ -31,68 +30,75 @@ function initializeState(snapshot: MutableSnapshot) {
describe(' ', () => {
const businessPartnerDetails: AfisBusinessPartnerDetailsTransformed = {
addressId: 999,
- businessPartnerId: 515177,
+ businessPartnerId: '000515177',
fullName: 'Taxon Expeditions BV',
phone: null,
email: null,
};
- const mockFacturen = {
- open: [
- {
- id: 'F001',
- title: 'Invoice F001',
- afzender: 'Company A',
- datePublished: '2023-01-15',
- datePublishedFormatted: '15 januari 2023',
- paymentDueDate: '2023-02-15',
- paymentDueDateFormatted: '15 februari 2023',
- debtClearingDate: null,
- debtClearingDateFormatted: null,
- amountOwed: 1000,
- amountOwedFormatted: '€ 1.000,00',
- factuurNummer: 'F001',
- status: 'openstaand',
- paylink: 'https://payment.example.com/F001',
- documentDownloadLink: 'https://download.example.com/F001',
- },
- {
- id: 'F003',
- title: 'Invoice F003',
- afzender: 'Company C',
- datePublished: '2023-03-10',
- datePublishedFormatted: '10 maart 2023',
- paymentDueDate: '2023-04-10',
- paymentDueDateFormatted: '10 april 2023',
- debtClearingDate: null,
- debtClearingDateFormatted: null,
- amountOwed: 2000,
- amountOwedFormatted: '€ 2.000,00',
- factuurNummer: 'F003',
- status: 'openstaand',
- paylink: 'https://payment.example.com/F003',
- documentDownloadLink: 'https://download.example.com/F003',
- },
- ],
- closed: [
- {
- id: 'F002',
- title: 'Invoice F002',
- afzender: 'Company B',
- datePublished: '2023-02-01',
- datePublishedFormatted: '1 februari 2023',
- paymentDueDate: '2023-03-01',
- paymentDueDateFormatted: '1 maart 2023',
- debtClearingDate: '2023-02-15',
- debtClearingDateFormatted: '15 februari 2023',
- amountOwed: 0,
- amountOwedFormatted: '€ 0,00',
- factuurNummer: 'F002',
- status: 'betaald',
- paylink: null,
- documentDownloadLink: 'https://download.example.com/F002',
- },
- ],
+ const mockFacturen: AfisFacturenByStateResponse = {
+ open: {
+ count: 2,
+ facturen: [
+ {
+ afzender: 'Company A',
+ datePublished: '2023-01-15',
+ datePublishedFormatted: '15 januari 2023',
+ paymentDueDate: '2023-02-15',
+ paymentDueDateFormatted: '15 februari 2023',
+ debtClearingDate: null,
+ debtClearingDateFormatted: null,
+ amountOwed: 1000,
+ amountOwedFormatted: '€ 1.000,00',
+ factuurNummer: 'F001',
+ status: 'openstaand',
+ statusDescription: 'openstaand',
+ paylink: 'https://payment.example.com/F001',
+ documentDownloadLink: 'https://download.example.com/F001',
+ factuurDocumentId: '1',
+ },
+ {
+ afzender: 'Company C',
+ datePublished: '2023-03-10',
+ datePublishedFormatted: '10 maart 2023',
+ paymentDueDate: '2023-04-10',
+ paymentDueDateFormatted: '10 april 2023',
+ debtClearingDate: null,
+ debtClearingDateFormatted: null,
+ amountOwed: 2000,
+ amountOwedFormatted: '€ 2.000,00',
+ factuurNummer: 'F003',
+ status: 'openstaand',
+ statusDescription: 'openstaand',
+ paylink: 'https://payment.example.com/F003',
+ documentDownloadLink: 'https://download.example.com/F003',
+ factuurDocumentId: '2',
+ },
+ ],
+ },
+ afgehandeld: {
+ count: 1,
+ facturen: [
+ {
+ afzender: 'Company B',
+ datePublished: '2023-02-01',
+ datePublishedFormatted: '1 februari 2023',
+ paymentDueDate: '2023-03-01',
+ paymentDueDateFormatted: '1 maart 2023',
+ debtClearingDate: '2023-02-15',
+ debtClearingDateFormatted: '15 februari 2023',
+ amountOwed: 0,
+ amountOwedFormatted: '€ 0,00',
+ factuurNummer: 'F002',
+ status: 'betaald',
+ statusDescription: 'betaald',
+ paylink: null,
+ documentDownloadLink: 'https://download.example.com/F002',
+ factuurDocumentId: '3',
+ },
+ ],
+ },
+ overgedragen: { count: 0, facturen: [] },
};
bffApi
diff --git a/src/client/pages/Afis/Afis.tsx b/src/client/pages/Afis/Afis.tsx
index 73ec6d194d..fbb389ac73 100644
--- a/src/client/pages/Afis/Afis.tsx
+++ b/src/client/pages/Afis/Afis.tsx
@@ -1,59 +1,105 @@
-import { Button, Paragraph } from '@amsterdam/design-system-react';
-import { generatePath, useHistory } from 'react-router-dom';
+import {
+ Alert,
+ Button,
+ Grid,
+ Paragraph,
+ UnorderedList,
+} from '@amsterdam/design-system-react';
+import React from 'react';
+import { useHistory } from 'react-router-dom';
+import { entries } from '../../../universal/helpers/utils';
import { ThemaTitles } from '../../config/thema';
import ThemaPagina from '../ThemaPagina/ThemaPagina';
import ThemaPaginaTable from '../ThemaPagina/ThemaPaginaTable';
-import { useAfisThemaData } from './useAfisThemaData.hook';
-import { AppRoutes } from '../../../universal/config/routes';
-import { AfisFactuur } from '../../../server/services/afis/afis-types';
-import { ListPageParamKind } from './Afis-thema-config';
+import { AfisFactuurFrontend } from './Afis-thema-config';
import styles from './Afis.module.scss';
+import { useAfisThemaData } from './useAfisThemaData.hook';
+
+const pageContentTop = (
+
+ Hieronder ziet u een overzicht van uw facturen. U ziet hier niet de facturen
+ van belastingen. U kunt deze bij belastingen vinden.
+
+);
export function AfisThemaPagina() {
const history = useHistory();
const {
- facturen,
+ dependencyErrors,
+ facturenByState,
facturenTableConfig,
- isFacturenError,
- isFacturenLoading,
isThemaPaginaError,
isThemaPaginaLoading,
+ isOverviewApiError,
+ isOverviewApiLoading,
+ listPageTitle,
routes,
- hasFailedFacturenOpenDependency,
- hasFailedFacturenClosedDependency,
} = useAfisThemaData();
- const pageContentTop = (
- <>
-
- Hieronder kunt u uw facturatiegegevens inzien en een automatische
- incasso instellen per afdeling van de gemeente.
-
+ const isPartialError = entries(dependencyErrors).some(
+ ([, hasError]) => hasError
+ );
+
+ const pageContentSecondary = (
+
history.push(routes.betaalVoorkeuren)}
>
Betaalvoorkeuren
+
+
+
+ De betaalstatus kan 3 werkdagen achterlopen op de doorgevoerde
+ wijzigingen.
+
+
+ Betalingsregelingen zijn niet zichtbaar in dit overzicht.
+
+
+
+
+ );
+
+ const pageContentErrorAlert = (
+ <>
+ We kunnen niet alle gegevens tonen.{' '}
+ {entries(dependencyErrors)
+ .filter(([, hasError]) => hasError)
+ .map(([state]) => (
+
+ - {listPageTitle[state]} kunnen nu niet getoond worden.
+
+ ))}
>
);
- const pageContentTables = Object.entries(facturenTableConfig).map(
- ([kind, { title, displayProps, maxItems }]) => {
- const kindFacturen = (
- facturen as { [K in ListPageParamKind]: AfisFactuur[] }
- )[kind as ListPageParamKind];
+ const pageContentTables = entries(facturenTableConfig).map(
+ ([
+ state,
+ {
+ title,
+ subTitle,
+ displayProps,
+ maxItems,
+ listPageLinkLabel,
+ listPageRoute,
+ },
+ ]) => {
return (
-
- key={kind}
+
+ key={state}
title={title}
- zaken={kindFacturen}
+ subTitle={subTitle}
+ zaken={facturenByState?.[state]?.facturen ?? []}
displayProps={displayProps}
textNoContent={`U heeft geen ${title.toLowerCase()}`}
maxItems={maxItems}
- listPageRoute={generatePath(AppRoutes['AFIS/FACTUREN'], {
- kind,
- })}
+ totalItems={facturenByState?.[state]?.count}
+ listPageLinkLabel={listPageLinkLabel}
+ listPageRoute={listPageRoute}
className={styles.FacturenTable}
/>
);
@@ -63,21 +109,27 @@ export function AfisThemaPagina() {
return (
+ {pageContentSecondary}
+ {pageContentTables}
+ >
+ }
/>
);
}
diff --git a/src/client/pages/Afis/AfisBetaalVoorkeuren.test.tsx b/src/client/pages/Afis/AfisBetaalVoorkeuren.test.tsx
index b3bc372bb7..0ef5ff092c 100644
--- a/src/client/pages/Afis/AfisBetaalVoorkeuren.test.tsx
+++ b/src/client/pages/Afis/AfisBetaalVoorkeuren.test.tsx
@@ -30,7 +30,7 @@ function initializeState(snapshot: MutableSnapshot) {
describe(' ', () => {
const businessPartnerDetails: AfisBusinessPartnerDetailsTransformed = {
addressId: 999,
- businessPartnerId: 515177,
+ businessPartnerId: '515177',
fullName: 'Taxon Expeditions BV',
phone: null,
email: null,
@@ -44,14 +44,18 @@ describe(' ', () => {
});
bffApi
- .get(`/services/afis/facturen/${businessPartnerIdEncrypted}`)
+ .get(`/services/afis/facturen/overzicht/${businessPartnerIdEncrypted}`)
.reply(200, {
- content: [],
+ content: {
+ open: { facturen: [], count: 0 },
+ afgehandeld: { facturen: [], count: 0 },
+ overgedragen: { facturen: [], count: 0 },
+ },
status: 'OK',
});
- const routeEntry = generatePath(AppRoutes['AFIS/BETAALVOORKEUREN']);
const routePath = AppRoutes['AFIS/BETAALVOORKEUREN'];
+ const routeEntry = generatePath(routePath);
const Component = () => (
', () => {
/>
);
- it('Matches the Full Page snapshot', async () => {
- const screen = render( );
+ test('Display business partner details', async () => {
const user = userEvent.setup();
- const toonButton = screen.getByText('Toon');
- await user.click(toonButton);
+ let screen = render( );
await waitFor(() => {
expect(screen.getByText('Taxon Expeditions BV')).toBeInTheDocument();
});
- expect(screen.asFragment()).toMatchSnapshot();
+ const verbergKnop = screen.getByText('Verberg');
+ expect(verbergKnop).toBeInTheDocument();
+
+ await user.click(verbergKnop);
+
+ expect(screen.getByText('Toon')).toBeInTheDocument();
});
});
diff --git a/src/client/pages/Afis/AfisBetaalVoorkeuren.tsx b/src/client/pages/Afis/AfisBetaalVoorkeuren.tsx
index 32db64d4f4..af78bbcda3 100644
--- a/src/client/pages/Afis/AfisBetaalVoorkeuren.tsx
+++ b/src/client/pages/Afis/AfisBetaalVoorkeuren.tsx
@@ -1,42 +1,41 @@
import {
Grid,
- Heading,
Link,
LinkList,
Paragraph,
} from '@amsterdam/design-system-react';
-import {
- AfisBusinessPartnerDetailsTransformed,
- AfisBusinessPartnerKnownResponse,
-} from '../../../server/services/afis/afis-types';
+import { AfisBusinessPartnerDetailsTransformed } from '../../../server/services/afis/afis-types';
+import { FeatureToggle } from '../../../universal/config/feature-toggles';
+import { AppRoutes } from '../../../universal/config/routes';
+import { entries } from '../../../universal/helpers/utils';
+import { LoadingContent } from '../../components';
+import { CollapsiblePanel } from '../../components/CollapsiblePanel/CollapsiblePanel';
import { Datalist } from '../../components/Datalist/Datalist';
import { DisplayProps } from '../../components/Table/TableV2';
+import { ThemaTitles } from '../../config/thema';
import ThemaPagina from '../ThemaPagina/ThemaPagina';
-import styles from './AfisBetaalVoorkeuren.module.scss';
+import ThemaPaginaTable from '../ThemaPagina/ThemaPaginaTable';
+import { AfisEmandateStub } from './Afis-thema-config';
import {
useAfisBetaalVoorkeurenData,
useAfisThemaData,
} from './useAfisThemaData.hook';
-import { AppRoutes } from '../../../universal/config/routes';
-import { ThemaTitles } from '../../config/thema';
-import ThemaPaginaTable from '../ThemaPagina/ThemaPaginaTable';
-import { AfisEmandateStub } from './Afis-thema-config';
-import { CollapsiblePanel } from '../../components/CollapsiblePanel/CollapsiblePanel';
-import { LoadingContent } from '../../components';
type AfisBusinessPartnerProps = {
businesspartner: AfisBusinessPartnerDetailsTransformed | null;
labels: DisplayProps;
isLoading: boolean;
+ startCollapsed: boolean;
};
function AfisBusinessPartnerDetails({
businesspartner,
labels,
isLoading,
+ startCollapsed = true,
}: AfisBusinessPartnerProps) {
const rows = !!businesspartner
- ? Object.entries(labels).map(([key, label]) => {
+ ? entries(labels).map(([key, label]) => {
const value = businesspartner[key as keyof typeof businesspartner];
return {
label,
@@ -54,7 +53,7 @@ function AfisBusinessPartnerDetails({
return (
-
+
{isLoading && }
{!isLoading && !!rows.length && (
@@ -78,19 +77,21 @@ function AfisBusinessPartnerDetails({
export function AfisBetaalVoorkeuren() {
const {
businessPartnerIdEncrypted,
- isThemaPaginaLoading,
isThemaPaginaError,
+ isThemaPaginaLoading,
} = useAfisThemaData();
+
const {
businesspartnerDetails,
businessPartnerDetailsLabels,
+ eMandates,
+ eMandateTableConfig,
hasBusinessPartnerDetailsError,
hasEmandatesError,
hasFailedEmailDependency,
hasFailedPhoneDependency,
+ hasFailedFullNameDependency,
isLoadingBusinessPartnerDetails,
- eMandateTableConfig,
- eMandates,
isLoadingEmandates,
} = useAfisBetaalVoorkeurenData(businessPartnerIdEncrypted);
@@ -99,25 +100,27 @@ export function AfisBetaalVoorkeuren() {
isLoadingBusinessPartnerDetails &&
isLoadingEmandates;
- const eMandateTables = Object.entries(eMandateTableConfig).map(
- ([kind, { title, displayProps, filter }]) => {
- return (
-
- key={kind}
- title={title}
- zaken={eMandates.filter(filter)}
- displayProps={displayProps}
- textNoContent={`U heeft geen ${title.toLowerCase()}`}
- maxItems={-1}
- />
- );
- }
- );
+ const eMandateTables =
+ FeatureToggle.afisEmandatesActive &&
+ entries(eMandateTableConfig).map(
+ ([kind, { title, displayProps, filter }]) => {
+ return (
+
+ key={kind}
+ title={title}
+ zaken={eMandates.filter(filter)}
+ displayProps={displayProps}
+ textNoContent={`U heeft geen ${title.toLowerCase()}`}
+ maxItems={-1}
+ />
+ );
+ }
+ );
const pageContentTop = (
<>
- Hier kunt u uw betaal gegevens inzien en automatische incasso gegevens
+ Hier kunt u uw betaalgegevens inzien en automatische incasso gegevens
instellen.
>
@@ -129,20 +132,30 @@ export function AfisBetaalVoorkeuren() {
businesspartner={businesspartnerDetails}
labels={businessPartnerDetailsLabels}
isLoading={isLoadingBusinessPartnerDetails || isThemaPaginaLoading}
+ startCollapsed={FeatureToggle.afisEmandatesActive}
/>
{eMandateTables}
>
);
- const errorAlertContent = (
+ const errorAlertContent = isThemaPaginaError ? (
+ <>Wij kunnen nu niet alle gegevens laten zien.>
+ ) : (
<>
{!hasBusinessPartnerDetailsError &&
- (hasFailedEmailDependency || hasFailedPhoneDependency) && (
+ (hasFailedEmailDependency ||
+ hasFailedPhoneDependency ||
+ hasFailedFullNameDependency) && (
<>
De volgende gegevens konden niet worden opgehaald:
+ {hasFailedFullNameDependency && (
+ <>
+ - Debiteurnaam
+ >
+ )}
{hasFailedEmailDependency && (
<>
- - Email
+ - E-mailadres
>
)}
{hasFailedPhoneDependency && (
@@ -172,7 +185,8 @@ export function AfisBetaalVoorkeuren() {
(hasBusinessPartnerDetailsError && hasEmandatesError)
}
isPartialError={
- hasFailedEmailDependency ||
+ hasFailedFullNameDependency ||
+ hasFailedPhoneDependency ||
hasFailedPhoneDependency ||
hasBusinessPartnerDetailsError ||
hasEmandatesError
diff --git a/src/client/pages/Afis/AfisFacturen.test.tsx b/src/client/pages/Afis/AfisFacturen.test.tsx
index a4a7730306..b9019c8c7a 100644
--- a/src/client/pages/Afis/AfisFacturen.test.tsx
+++ b/src/client/pages/Afis/AfisFacturen.test.tsx
@@ -8,6 +8,7 @@ import MockApp from '../MockApp';
import { AfisFacturen } from './AfisFacturen';
import { bffApi } from '../../../test-utils';
import { AfisFactuur } from '../../../server/services/afis/afis-types';
+import { AfisFactuurFrontend } from './Afis-thema-config';
const businessPartnerIdEncrypted = 'yyy-456-yyy';
const testState = {
@@ -25,65 +26,130 @@ function initializeState(snapshot: MutableSnapshot) {
}
describe(' ', () => {
- const mockFacturen: AfisFactuur[] = [
- {
- afzender: 'Company D',
- datePublished: '2023-04-01',
- datePublishedFormatted: '1 april 2023',
- paymentDueDate: '2023-05-01',
- paymentDueDateFormatted: '1 mei 2023',
- debtClearingDate: null,
- debtClearingDateFormatted: null,
- amountOwed: 1500,
- amountOwedFormatted: '€ 1.500,00',
- factuurNummer: 'F004',
- status: 'openstaand',
- paylink: 'https://payment.example.com/F004',
- documentDownloadLink: 'https://download.example.com/F004',
- },
- {
- afzender: 'Company E',
- datePublished: '2023-04-15',
- datePublishedFormatted: '15 april 2023',
- paymentDueDate: '2023-05-15',
- paymentDueDateFormatted: '15 mei 2023',
- debtClearingDate: null,
- debtClearingDateFormatted: null,
- amountOwed: 2500,
- amountOwedFormatted: '€ 2.500,00',
- factuurNummer: 'F005',
- status: 'openstaand',
- paylink: 'https://payment.example.com/F005',
- documentDownloadLink: 'https://download.example.com/F005',
- },
- ];
+ const routePath = AppRoutes['AFIS/FACTUREN'];
- bffApi
- .get(`/services/afis/facturen/open/${businessPartnerIdEncrypted}`)
- .reply(200, {
- content: mockFacturen,
- status: 'OK',
+ test('Lists Open facturen', async () => {
+ bffApi
+ .get(`/services/afis/facturen/overzicht/${businessPartnerIdEncrypted}`)
+ .reply(200, {
+ content: {
+ open: {
+ count: 1,
+ facturen: [
+ {
+ id: '2',
+ factuurDocumentId: '2',
+ afzender: 'Company E',
+ datePublished: '2023-04-15',
+ datePublishedFormatted: '15 april 2023',
+ paymentDueDate: '2023-05-15',
+ paymentDueDateFormatted: '15 mei 2023',
+ debtClearingDate: null,
+ debtClearingDateFormatted: null,
+ amountOwed: 2500,
+ amountOwedFormatted: '€ 2.500,00',
+ factuurNummer: 'F005',
+ factuurNummerEl: 'F005',
+ status: 'openstaand',
+ statusDescription: 'Openstaand description',
+ paylink: 'https://payment.example.com/F005',
+ documentDownloadLink: 'https://download.example.com/F005',
+ },
+ ],
+ },
+ afgehandeld: { facturen: [], count: 0 },
+ overgedragen: { facturen: [], count: 0 },
+ },
+ status: 'OK',
+ });
+
+ const routeEntry = generatePath(routePath, {
+ state: 'open',
});
- const routeEntry = generatePath(AppRoutes['AFIS/FACTUREN'], { kind: 'open' });
- const routePath = AppRoutes['AFIS/FACTUREN'];
+ const Component = () => (
+
+ );
+ const screen = render( );
- const Component = () => (
-
- );
+ await waitFor(() => {
+ expect(screen.getByText('15 mei 2023')).toBeInTheDocument();
+ expect(screen.getByText('Openstaand description')).toBeInTheDocument();
+ expect(screen.getByText('Company E')).toBeInTheDocument();
+ });
+ });
+
+ test('Lists Closed facturen', async () => {
+ bffApi
+ .get(`/services/afis/facturen/afgehandeld/${businessPartnerIdEncrypted}`)
+ .reply(200, {
+ content: {
+ afgehandeld: {
+ count: 1,
+ facturen: [
+ {
+ id: '1',
+ factuurDocumentId: '1',
+ afzender: 'Company D',
+ datePublished: '2023-04-01',
+ datePublishedFormatted: '1 april 2023',
+ paymentDueDate: '2023-05-01',
+ paymentDueDateFormatted: '1 mei 2023',
+ debtClearingDate: null,
+ debtClearingDateFormatted: null,
+ amountOwed: 1500,
+ amountOwedFormatted: '€ 1.500,00',
+ factuurNummer: 'F001',
+ factuurNummerEl: 'F001',
+ status: 'betaald',
+ statusDescription: 'Betaalde description',
+ paylink: null,
+ documentDownloadLink: 'https://download.example.com/F004',
+ },
+ ],
+ },
+ },
+ status: 'OK',
+ });
+
+ bffApi
+ .get(`/services/afis/facturen/overzicht/${businessPartnerIdEncrypted}`)
+ .reply(200, {
+ content: {
+ open: { count: 0, facturen: [] },
+ afgehandeld: { facturen: [], count: 0 },
+ overgedragen: { facturen: [], count: 0 },
+ },
+ status: 'OK',
+ });
+
+ const routeEntry = generatePath(routePath, {
+ state: 'afgehandeld',
+ });
- it('Matches the Full Page snapshot', async () => {
+ const Component = () => (
+
+ );
const screen = render( );
- expect(screen.asFragment()).toMatchSnapshot();
await waitFor(() => {
expect(screen.getByText('Company D')).toBeInTheDocument();
- expect(screen.getByText('Company E')).toBeInTheDocument();
+ expect(screen.getByText('Betaalde description')).toBeInTheDocument();
+ expect(screen.queryByText('15 mei 2023')).not.toBeInTheDocument();
});
});
+
+ test('Partial error display', () => {});
+
+ test('Error display', () => {});
});
diff --git a/src/client/pages/Afis/AfisFacturen.tsx b/src/client/pages/Afis/AfisFacturen.tsx
index c133b1c4e4..969d163a7c 100644
--- a/src/client/pages/Afis/AfisFacturen.tsx
+++ b/src/client/pages/Afis/AfisFacturen.tsx
@@ -1,27 +1,39 @@
import { useParams } from 'react-router-dom';
-import { ListPageParamKind } from './Afis-thema-config';
+import {
+ AfisFactuur,
+ AfisFactuurState,
+} from '../../../server/services/afis/afis-types';
import { ListPagePaginated } from '../../components/ListPagePaginated/ListPagePaginated';
-import { useAfisThemaData } from './useAfisThemaData.hook';
-import { AfisFactuur } from '../../../server/services/afis/afis-types';
+import { ThemaTitles } from '../../config/thema';
import styles from './Afis.module.scss';
+import { useAfisListPageData } from './useAfisThemaData.hook';
export const AfisFacturen = () => {
- const { kind } = useParams<{ kind: ListPageParamKind }>();
- const { facturen, facturenTableConfig, routes, isFacturenLoading } =
- useAfisThemaData(kind);
- const listPageTableConfig = facturenTableConfig[kind];
+ const { state } = useParams<{ state: AfisFactuurState }>();
+ const {
+ facturenListResponse,
+ isListPageError,
+ isListPageLoading,
+ facturenTableConfig,
+ isThemaPaginaError,
+ isThemaPaginaLoading,
+ routes,
+ } = useAfisListPageData(state);
+
+ const listPageTableConfig = facturenTableConfig[state];
+ const facturen = facturenListResponse?.facturen ?? [];
return (
- items={facturen as AfisFactuur[]}
- backLinkTitle={listPageTableConfig.title}
+ items={facturen}
+ backLinkTitle={ThemaTitles.AFIS}
title={listPageTableConfig.title}
appRoute={routes.listPageFacturen}
- appRouteParams={{ kind }}
+ appRouteParams={{ state }}
appRouteBack={routes.themaPage}
displayProps={listPageTableConfig.displayProps}
- isLoading={isFacturenLoading}
- isError={false}
+ isLoading={isThemaPaginaLoading || isListPageLoading}
+ isError={isThemaPaginaError || isListPageError}
tableClassName={styles.FacturenTable}
/>
);
diff --git a/src/client/pages/Afis/__snapshots__/Afis.test.tsx.snap b/src/client/pages/Afis/__snapshots__/Afis.test.tsx.snap
index f5d5287414..c8921b088c 100644
--- a/src/client/pages/Afis/__snapshots__/Afis.test.tsx.snap
+++ b/src/client/pages/Afis/__snapshots__/Afis.test.tsx.snap
@@ -81,16 +81,10 @@ exports[` > Matches the Full Page snapshot 1`] = `
class="ams-grid__cell ams-grid__cell--span-all"
>
- Hieronder kunt u uw facturatiegegevens inzien en een automatische incasso instellen per afdeling van de gemeente.
+ Hieronder ziet u een overzicht van uw facturen. U ziet hier niet de facturen van belastingen. U kunt deze bij belastingen vinden.
-
- Betaalvoorkeuren
-
> Matches the Full Page snapshot 1`] = `
Meer over facturen van de gemeente
+
+
+
+
+
+
+
+ Belastingen op Mijn Amsterdam
+
+
> Matches the Full Page snapshot 1`] = `
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Hier kunt u uw betaal gegevens inzien en automatische incasso gegevens instellen.
-
-
-
-
-
-
- Betaalgegevens
-
-
- Verberg
-
-
-
-
-
-
-
- Debiteurnaam
-
-
- Taxon Expeditions BV
-
-
- Debiteurnummer
-
-
- 515177
-
-
- E-mailadres factuur
-
-
-
-
-
- Telefoonnummer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Actieve automatische incasso's
-
-
-
-
-
- U heeft geen actieve automatische incasso's
-
-
-
-
-
-
- Niet actieve automatische incasso's
-
-
-
-
-
- U heeft geen niet actieve automatische incasso's
-
-
-
-
-
-
-`;
diff --git a/src/client/pages/Afis/__snapshots__/AfisFacturen.test.tsx.snap b/src/client/pages/Afis/__snapshots__/AfisFacturen.test.tsx.snap
deleted file mode 100644
index ddd48fa7d3..0000000000
--- a/src/client/pages/Afis/__snapshots__/AfisFacturen.test.tsx.snap
+++ /dev/null
@@ -1,101 +0,0 @@
-// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
-
-exports[` > Matches the Full Page snapshot 1`] = `
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-`;
diff --git a/src/client/pages/Afis/useAfisThemaData.hook.tsx b/src/client/pages/Afis/useAfisThemaData.hook.tsx
index 5a37c191e5..ed7d66cc82 100644
--- a/src/client/pages/Afis/useAfisThemaData.hook.tsx
+++ b/src/client/pages/Afis/useAfisThemaData.hook.tsx
@@ -2,91 +2,58 @@ import { ReactNode, useEffect, useMemo } from 'react';
import {
AfisBusinessPartnerDetailsTransformed,
AfisBusinessPartnerKnownResponse,
+ AfisFacturenByStateResponse,
AfisFactuur,
+ AfisFactuurState,
} from '../../../server/services/afis/afis-types';
import {
+ ApiResponse,
hasFailedDependency,
isError,
isLoading,
} from '../../../universal/helpers/api';
-import { DisplayProps } from '../../components/Table/TableV2';
+import { capitalizeFirstLetter } from '../../../universal/helpers/text';
+import { entries } from '../../../universal/helpers/utils';
+import { DocumentLink } from '../../components/DocumentList/DocumentLink';
+import { MaLink } from '../../components/MaLink/MaLink';
import { BFFApiUrls } from '../../config/api';
import { BagThemas } from '../../config/thema';
import { useAppStateBagApi, useAppStateGetter } from '../../hooks/useAppState';
import {
+ AfisFacturenByStateFrontend,
+ businessPartnerDetailsLabels,
eMandateTableConfig,
facturenTableConfig,
- ListPageParamKind,
- listPageParamKind,
listPageTitle,
routes,
} from './Afis-thema-config';
-import { MaLink } from '../../components/MaLink/MaLink';
-import { DocumentLink } from '../../components/DocumentList/DocumentLink';
+const AFIS_OVERVIEW_STATE_KEY = 'afis-facturen-overzicht';
-export function useAfisThemaData(kind?: ListPageParamKind) {
- const { AFIS } = useAppStateGetter();
- const businessPartnerIdEncrypted = AFIS.content?.businessPartnerIdEncrypted;
- const [facturen, facturenApi, fetchFacturen] = useAppStateBagApi<
- { [key in ListPageParamKind]: AfisFactuur[] } | AfisFactuur[] | null
- >({
- bagThema: BagThemas.AFIS,
- key: `${businessPartnerIdEncrypted}-facturen-${kind}`,
- });
-
- useEffect(() => {
- if (businessPartnerIdEncrypted) {
- const url = kind
- ? `${BFFApiUrls.AFIS_FACTUREN}/${kind}/${businessPartnerIdEncrypted}`
- : `${BFFApiUrls.AFIS_FACTUREN_OVERZICHT}/${businessPartnerIdEncrypted}`;
- fetchFacturen({ url });
- }
- }, [businessPartnerIdEncrypted, fetchFacturen, kind]);
-
- const updatedFacturen = useMemo(() => {
- return kind
- ? Array.isArray(facturen)
- ? (facturen as AfisFactuur[])?.map(mapFactuur)
- : []
- : facturen && Object.keys(facturen).length > 0
- ? Object.fromEntries(
- Object.entries(facturen).map(([key, value]) => [
- key,
- value.map(mapFactuur),
- ])
- )
- : { open: [], closed: [] };
- }, [facturen, kind]);
-
- return {
- businessPartnerIdEncrypted:
- AFIS.content?.businessPartnerIdEncrypted ?? null,
- isThemaPaginaLoading: isLoading(AFIS),
- isThemaPaginaError: isError(AFIS, false),
- routes,
- facturenTableConfig,
- listPageTitle,
- listPageParamKind,
- isFacturenError: facturenApi.isError,
- isFacturenLoading: facturenApi.isLoading,
- hasFailedFacturenOpenDependency: hasFailedDependency(
- facturenApi.data,
- 'open'
- ),
- hasFailedFacturenClosedDependency: hasFailedDependency(
- facturenApi.data,
- 'closed'
- ),
- facturen: updatedFacturen,
- };
+function getInvoiceStatusDescriptionFrontend(factuur: AfisFactuur): ReactNode {
+ switch (factuur.status) {
+ case 'openstaand':
+ return (
+ <>
+ {capitalizeFirstLetter(factuur.status)}:{' '}
+
+ {factuur.statusDescription}
+
+ >
+ );
+ default:
+ return factuur.statusDescription;
+ }
}
function mapFactuur(factuur: AfisFactuur) {
return {
...factuur,
- statusDescription: getInvoiceStatusDescription(factuur),
- factuurNummer: factuur.documentDownloadLink ? (
+ statusDescription: getInvoiceStatusDescriptionFrontend(factuur),
+ factuurNummerEl: factuur.documentDownloadLink ? (
=
- {
- fullName: 'Debiteurnaam',
- businessPartnerId: 'Debiteurnummer',
- email: 'E-mailadres factuur',
- phone: 'Telefoonnummer',
+function useTransformFacturen(
+ facturenByStateApiResponse: ApiResponse
+): ApiResponse {
+ const facturenByStateTransfomed: AfisFacturenByStateFrontend | null =
+ useMemo(() => {
+ if (facturenByStateApiResponse.content) {
+ return Object.fromEntries(
+ entries(facturenByStateApiResponse.content)
+ .filter(([state, facturenResponse]) => facturenResponse !== null)
+ .map(([state, facturenResponse]) => [
+ state,
+ {
+ ...facturenResponse,
+ facturen: facturenResponse?.facturen?.map(mapFactuur) ?? [],
+ },
+ ])
+ );
+ }
+ return null;
+ }, [facturenByStateApiResponse]);
+
+ return Object.assign({}, facturenByStateApiResponse, {
+ content: facturenByStateTransfomed,
+ });
+}
+
+/**
+ * Uses /overview endpoint for Open and Overview facturen (All the Open facuren are loaded with this endpoint)
+ * Uses /facturen/(afgehandeld|overgedragen) for the facturen with this state.
+ */
+function useAfisFacturenApi(
+ businessPartnerIdEncrypted:
+ | AfisBusinessPartnerKnownResponse['businessPartnerIdEncrypted']
+ | undefined,
+ state?: AfisFactuurState
+) {
+ const isOpenfacturenState = !state || state === 'open';
+
+ const [facturenByStateApiResponse, fetchFacturen, isApiDataCached] =
+ useAppStateBagApi({
+ bagThema: BagThemas.AFIS,
+ key: isOpenfacturenState
+ ? AFIS_OVERVIEW_STATE_KEY
+ : `afis-facturen-${state}`,
+ });
+
+ useEffect(() => {
+ if (businessPartnerIdEncrypted && !isApiDataCached) {
+ let url = `${BFFApiUrls.AFIS_FACTUREN}/${state}/${businessPartnerIdEncrypted}`;
+ if (isOpenfacturenState) {
+ url = `${BFFApiUrls.AFIS_FACTUREN_OVERZICHT}/${businessPartnerIdEncrypted}`;
+ }
+ fetchFacturen({
+ url,
+ });
+ }
+ }, [businessPartnerIdEncrypted, fetchFacturen, isApiDataCached, state]);
+
+ const facturenByStateApiResponseUpdated = useTransformFacturen(
+ facturenByStateApiResponse
+ );
+
+ return [
+ facturenByStateApiResponseUpdated,
+ fetchFacturen,
+ isApiDataCached,
+ ] as const;
+}
+
+export function useAfisListPageData(state: AfisFactuurState) {
+ const { AFIS } = useAppStateGetter();
+ const businessPartnerIdEncrypted =
+ AFIS.content?.businessPartnerIdEncrypted ?? null;
+
+ const [facturenByStateApiResponse] = useAfisFacturenApi(
+ businessPartnerIdEncrypted,
+ state
+ );
+
+ return {
+ facturenListResponse: facturenByStateApiResponse.content?.[state] ?? null,
+ facturenTableConfig,
+ isThemaPaginaError: isError(AFIS, false),
+ isThemaPaginaLoading: isLoading(AFIS),
+ isListPageError: isError(facturenByStateApiResponse, false),
+ isListPageLoading: isLoading(facturenByStateApiResponse),
+ listPageTitle,
+ routes,
+ };
+}
+
+export function useAfisThemaData() {
+ const { AFIS } = useAppStateGetter();
+ const businessPartnerIdEncrypted =
+ AFIS.content?.businessPartnerIdEncrypted ?? null;
+
+ const [facturenByStateApiResponse] = useAfisFacturenApi(
+ businessPartnerIdEncrypted
+ );
+
+ return {
+ businessPartnerIdEncrypted,
+ facturenByState: facturenByStateApiResponse.content,
+ facturenTableConfig,
+ isThemaPaginaError: isError(AFIS, false),
+ isThemaPaginaLoading: isLoading(AFIS),
+ listPageTitle,
+ routes,
+ isOverviewApiError: isError(facturenByStateApiResponse),
+ isOverviewApiLoading: isLoading(facturenByStateApiResponse),
+ dependencyErrors: {
+ open: hasFailedDependency(facturenByStateApiResponse, 'open'),
+ afgehandeld: hasFailedDependency(
+ facturenByStateApiResponse,
+ 'afgehandeld'
+ ),
+ overgedragen: hasFailedDependency(
+ facturenByStateApiResponse,
+ 'overgedragen'
+ ),
+ },
};
+}
export function useAfisBetaalVoorkeurenData(
- businessPartnerIdEncrypted: AfisBusinessPartnerKnownResponse['businessPartnerIdEncrypted']
+ businessPartnerIdEncrypted:
+ | AfisBusinessPartnerKnownResponse['businessPartnerIdEncrypted']
+ | undefined
) {
const [
- businesspartnerDetails,
- businesspartnerDetailsApi,
- fetchBusinessPartner,
+ businesspartnerDetailsApiResponse,
+ fetchBusinessPartnerDetails,
+ isApiDataCached,
] = useAppStateBagApi({
bagThema: BagThemas.AFIS,
- key: `${businessPartnerIdEncrypted}-betaalvoorkeuren`,
+ key: `afis-betaalvoorkeuren`,
});
useEffect(() => {
- if (businessPartnerIdEncrypted) {
- fetchBusinessPartner({
+ if (businessPartnerIdEncrypted && !isApiDataCached) {
+ fetchBusinessPartnerDetails({
url: `${BFFApiUrls.AFIS_BUSINESSPARTNER}/${businessPartnerIdEncrypted}`,
});
}
- }, [businessPartnerIdEncrypted, fetchBusinessPartner]);
+ }, [
+ businessPartnerIdEncrypted,
+ fetchBusinessPartnerDetails,
+ isApiDataCached,
+ ]);
return {
- businesspartnerDetails,
+ businesspartnerDetails: businesspartnerDetailsApiResponse.content,
businessPartnerDetailsLabels,
- isLoadingBusinessPartnerDetails: businesspartnerDetailsApi.isLoading,
+ isLoadingBusinessPartnerDetails: isLoading(
+ businesspartnerDetailsApiResponse
+ ),
hasBusinessPartnerDetailsError: isError(
- businesspartnerDetailsApi.data,
+ businesspartnerDetailsApiResponse,
false
),
hasEmandatesError: false,
hasFailedEmailDependency: hasFailedDependency(
- businesspartnerDetailsApi.data,
+ businesspartnerDetailsApiResponse,
'email'
),
hasFailedPhoneDependency: hasFailedDependency(
- businesspartnerDetailsApi.data,
+ businesspartnerDetailsApiResponse,
'phone'
),
+ hasFailedFullNameDependency: hasFailedDependency(
+ businesspartnerDetailsApiResponse,
+ 'fullName'
+ ),
eMandateTableConfig,
eMandates: [],
isLoadingEmandates: false,
};
}
-
-function getInvoiceStatusDescription(factuur: AfisFactuur): ReactNode {
- switch (factuur.status) {
- case 'openstaand':
- const [label = factuur.statusDescription || '', linkText = ''] =
- factuur.statusDescription?.split(':') || [];
- return (
- <>
- {label}:{' '}
-
- {linkText}
-
- >
- );
- default:
- return factuur.statusDescription;
- }
-}
diff --git a/src/client/pages/BezwarenDetail/BezwarenDetail.test.tsx b/src/client/pages/BezwarenDetail/BezwarenDetail.test.tsx
index 78afd576e2..2e6fb2af7d 100644
--- a/src/client/pages/BezwarenDetail/BezwarenDetail.test.tsx
+++ b/src/client/pages/BezwarenDetail/BezwarenDetail.test.tsx
@@ -39,53 +39,55 @@ const testState = {
BEZWAREN_BAG: {
abc: null,
'asdasd98asd098asdjalmsndas-d9aps9dapsdja.sdasd': {
- statussen: [
- {
- uuid: 'b62fdaa9-f7ec-45d1-b23c-7f36fa00b393',
- datum: '2023-03-29T10:00:00+02:00',
- statustoelichting: 'Ontvangen',
- },
- {
- uuid: '50dcd25b-a826-422b-b51c-9049dda9600c',
- datum: '2023-03-30T02:53:00+02:00',
- statustoelichting: 'In behandeling',
- },
- {
- uuid: '00000000-0000-0000-0000-000000000000',
- datum: '',
- statustoelichting: 'Afgehandeld',
- },
- ],
- documents: [
- {
- id: 'd0fe0ace-6f53-4342-b978-1cf12f8675be',
- title: 'connector.docx',
- datePublished: '30 augustus 2023',
- url: 'http://localhost:5000/api/v1/services/bezwaren/d0fe0ace-6f53-4342-b978-1cf12f8675be/attachments',
- dossiertype: 'Online Aangeleverd',
- },
- {
- id: '736ae47e-e703-4238-a664-100cde4c90a1',
- title: 'Bezwaar_JB20230049.pdf',
- datePublished: '30 augustus 2023',
- url: 'http://localhost:5000/api/v1/services/bezwaren/736ae47e-e703-4238-a664-100cde4c90a1/attachments',
- dossiertype: 'Online Aangeleverd',
- },
- {
- id: 'd0fe0ace-6f53-4342-b978-1cf12f8675be',
- title: 'connector.docx',
- datePublished: '30 augustus 2023',
- url: 'http://localhost:5000/api/v1/services/bezwaren/d0fe0ace-6f53-4342-b978-1cf12f8675be/attachments',
- dossiertype: 'Online Besluitvorming',
- },
- {
- id: '736ae47e-e703-4238-a664-100cde4c90a1',
- title: 'Bezwaar_JB20230049.pdf',
- datePublished: '30 augustus 2023',
- url: 'http://localhost:5000/api/v1/services/bezwaren/736ae47e-e703-4238-a664-100cde4c90a1/attachments',
- dossiertype: 'Online Procesdossier',
- },
- ],
+ content: {
+ statussen: [
+ {
+ uuid: 'b62fdaa9-f7ec-45d1-b23c-7f36fa00b393',
+ datum: '2023-03-29T10:00:00+02:00',
+ statustoelichting: 'Ontvangen',
+ },
+ {
+ uuid: '50dcd25b-a826-422b-b51c-9049dda9600c',
+ datum: '2023-03-30T02:53:00+02:00',
+ statustoelichting: 'In behandeling',
+ },
+ {
+ uuid: '00000000-0000-0000-0000-000000000000',
+ datum: '',
+ statustoelichting: 'Afgehandeld',
+ },
+ ],
+ documents: [
+ {
+ id: 'd0fe0ace-6f53-4342-b978-1cf12f8675be',
+ title: 'connector.docx',
+ datePublished: '30 augustus 2023',
+ url: 'http://localhost:5000/api/v1/services/bezwaren/d0fe0ace-6f53-4342-b978-1cf12f8675be/attachments',
+ dossiertype: 'Online Aangeleverd',
+ },
+ {
+ id: '736ae47e-e703-4238-a664-100cde4c90a1',
+ title: 'Bezwaar_JB20230049.pdf',
+ datePublished: '30 augustus 2023',
+ url: 'http://localhost:5000/api/v1/services/bezwaren/736ae47e-e703-4238-a664-100cde4c90a1/attachments',
+ dossiertype: 'Online Aangeleverd',
+ },
+ {
+ id: 'd0fe0ace-6f53-4342-b978-1cf12f8675be',
+ title: 'connector.docx',
+ datePublished: '30 augustus 2023',
+ url: 'http://localhost:5000/api/v1/services/bezwaren/d0fe0ace-6f53-4342-b978-1cf12f8675be/attachments',
+ dossiertype: 'Online Besluitvorming',
+ },
+ {
+ id: '736ae47e-e703-4238-a664-100cde4c90a1',
+ title: 'Bezwaar_JB20230049.pdf',
+ datePublished: '30 augustus 2023',
+ url: 'http://localhost:5000/api/v1/services/bezwaren/736ae47e-e703-4238-a664-100cde4c90a1/attachments',
+ dossiertype: 'Online Procesdossier',
+ },
+ ],
+ },
},
},
};
diff --git a/src/client/pages/BezwarenDetail/BezwarenDetail.tsx b/src/client/pages/BezwarenDetail/BezwarenDetail.tsx
index 20a3d4c5e6..f8f7ee4558 100644
--- a/src/client/pages/BezwarenDetail/BezwarenDetail.tsx
+++ b/src/client/pages/BezwarenDetail/BezwarenDetail.tsx
@@ -39,12 +39,13 @@ interface BezwarenDetailPartialProps {
}
function BezwarenDetailPartial({ uuidEncrypted }: BezwarenDetailPartialProps) {
- const [bezwaarDetail, api] = useAppStateBagApi({
- url: `${BFFApiUrls.BEZWAREN_DETAIL}/${uuidEncrypted}`,
- bagThema: BagThemas.BEZWAREN,
- key: uuidEncrypted,
- });
-
+ const [bezwaarDetailApiResponse, api] =
+ useAppStateBagApi({
+ url: `${BFFApiUrls.BEZWAREN_DETAIL}/${uuidEncrypted}`,
+ bagThema: BagThemas.BEZWAREN,
+ key: uuidEncrypted,
+ });
+ const bezwaarDetail = bezwaarDetailApiResponse.content;
const documents = bezwaarDetail?.documents ?? [];
const statussen = bezwaarDetail?.statussen ?? [];
@@ -85,7 +86,7 @@ function BezwarenDetailPartial({ uuidEncrypted }: BezwarenDetailPartialProps) {
})}
>
)}
- {api.isLoading && (
+ {isLoading(bezwaarDetailApiResponse) && (
<>
Status
diff --git a/src/client/pages/Erfpacht/DossierDetail/ErfpachtDossierDetail.tsx b/src/client/pages/Erfpacht/DossierDetail/ErfpachtDossierDetail.tsx
index 2c933161d9..4fc0fa0c63 100644
--- a/src/client/pages/Erfpacht/DossierDetail/ErfpachtDossierDetail.tsx
+++ b/src/client/pages/Erfpacht/DossierDetail/ErfpachtDossierDetail.tsx
@@ -21,6 +21,7 @@ import { DatalistGeneral } from './DatalistGeneral';
import { DatalistJuridisch } from './DatalistJuridisch';
import { DatalistsFinancieel } from './DatalistsFinancieel';
import styles from './ErfpachtDossierDetail.module.scss';
+import { isError, isLoading } from '../../../../universal/helpers/api';
const loadingContentBarConfig: BarConfig = [
['12rem', '2rem', '.5rem'],
@@ -45,12 +46,13 @@ export default function ErfpachtDossierDetail() {
dossierNummerUrlParam: string;
}>();
const { ERFPACHTv2 } = useErfpachtV2Data();
- const [dossier, api] = useAppStateBagApi({
+ const [dossierApiResponse] = useAppStateBagApi({
url: `${BFFApiUrls.ERFPACHTv2_DOSSIER_DETAILS}/${dossierNummerUrlParam}`,
bagThema: BagThemas.ERFPACHTv2,
key: dossierNummerUrlParam,
});
- const noContent = !api.isLoading && !dossier;
+ const dossier = dossierApiResponse.content;
+ const noContent = !isLoading(dossierApiResponse) && !dossier;
return (
@@ -65,10 +67,10 @@ export default function ErfpachtDossierDetail() {
- {api.isLoading && (
+ {isLoading(dossierApiResponse) && (
)}
- {(api.isError || noContent) && (
+ {(isError(dossierApiResponse) || noContent) && (
We kunnen op dit moment geen erfpachtdossier tonen.
diff --git a/src/client/pages/Erfpacht/ErfpachtFacturen.tsx b/src/client/pages/Erfpacht/ErfpachtFacturen.tsx
index 5236689f26..47e28865e1 100644
--- a/src/client/pages/Erfpacht/ErfpachtFacturen.tsx
+++ b/src/client/pages/Erfpacht/ErfpachtFacturen.tsx
@@ -8,6 +8,7 @@ import { BFFApiUrls } from '../../config/api';
import { BagThemas } from '../../config/thema';
import { useAppStateBagApi } from '../../hooks/useAppState';
import { useErfpachtV2Data } from './erfpachtData.hook';
+import { isError, isLoading } from '../../../universal/helpers/api';
export default function ErfpachtFacturen() {
const { displayPropsAlleFacturen } = useErfpachtV2Data();
@@ -16,11 +17,15 @@ export default function ErfpachtFacturen() {
dossierNummerUrlParam: string;
}>();
- const [dossier, api] = useAppStateBagApi({
- url: `${BFFApiUrls.ERFPACHTv2_DOSSIER_DETAILS}/${dossierNummerUrlParam}`,
- bagThema: BagThemas.ERFPACHTv2,
- key: dossierNummerUrlParam,
- });
+ const [dossierApiResponse, api] = useAppStateBagApi(
+ {
+ url: `${BFFApiUrls.ERFPACHTv2_DOSSIER_DETAILS}/${dossierNummerUrlParam}`,
+ bagThema: BagThemas.ERFPACHTv2,
+ key: dossierNummerUrlParam,
+ }
+ );
+
+ const dossier = dossierApiResponse.content;
return (
);
}
diff --git a/src/client/pages/Parkeren/__snapshots__/Parkeren.test.tsx.snap b/src/client/pages/Parkeren/__snapshots__/Parkeren.test.tsx.snap
index b5a5555227..3f44519749 100644
--- a/src/client/pages/Parkeren/__snapshots__/Parkeren.test.tsx.snap
+++ b/src/client/pages/Parkeren/__snapshots__/Parkeren.test.tsx.snap
@@ -140,17 +140,17 @@ exports[`Parkeren > should display the list of parkeervergunningen 1`] = `