diff --git a/frontend/src/lib/api/destructionListsItem.ts b/frontend/src/lib/api/destructionListsItem.ts index 661c2217..49dfe293 100644 --- a/frontend/src/lib/api/destructionListsItem.ts +++ b/frontend/src/lib/api/destructionListsItem.ts @@ -33,6 +33,7 @@ export async function listDestructionListItems( page_size?: number; "item-processing_status"?: ProcessingStatus; "item-status": DestructionListItemStatus; // TODO ? + "item-order_review_ignored"?: string; }, ) { const response = await request("GET", "/destruction-list-items/", { diff --git a/frontend/src/pages/destructionlist/review/DestructionListReview.loader.ts b/frontend/src/pages/destructionlist/review/DestructionListReview.loader.ts index 39a1d209..b72758ae 100644 --- a/frontend/src/pages/destructionlist/review/DestructionListReview.loader.ts +++ b/frontend/src/pages/destructionlist/review/DestructionListReview.loader.ts @@ -6,6 +6,10 @@ import { DestructionList, getDestructionList, } from "../../../lib/api/destructionLists"; +import { + PaginatedDestructionListItems, + listDestructionListItems, +} from "../../../lib/api/destructionListsItem"; import { Review, ReviewItemWithZaak, @@ -17,7 +21,6 @@ import { getLatestReviewResponse, } from "../../../lib/api/reviewResponse"; import { listReviewers } from "../../../lib/api/reviewers"; -import { PaginatedZaken, listZaken } from "../../../lib/api/zaken"; import { canReviewDestructionListRequired, loginRequired, @@ -31,7 +34,7 @@ export type DestructionListReviewContext = { destructionList: DestructionList; logItems: AuditLogItem[]; - paginatedZaken: PaginatedZaken; + paginatedZaken: PaginatedDestructionListItems; review: Review; reviewItems?: ReviewItemWithZaak[]; reviewResponse?: ReviewResponse; @@ -76,9 +79,9 @@ export const destructionListReviewLoader = loginRequired( reviewItemsPromise, reviewResponsePromise, listReviewers(), - listZaken({ - ...objParams, - in_destruction_list: uuid, + listDestructionListItems(uuid, { + "item-order_review_ignored": String(true), + ...(objParams as unknown as URLSearchParams), }), ]); diff --git a/frontend/src/pages/destructionlist/review/DestructionListReview.stories.tsx b/frontend/src/pages/destructionlist/review/DestructionListReview.stories.tsx index fd25615a..1eda330e 100644 --- a/frontend/src/pages/destructionlist/review/DestructionListReview.stories.tsx +++ b/frontend/src/pages/destructionlist/review/DestructionListReview.stories.tsx @@ -12,7 +12,7 @@ import { destructionListAssigneesFactory, destructionListFactory, } from "../../../fixtures/destructionList"; -import { paginatedZakenFactory } from "../../../fixtures/paginatedZaken"; +import { paginatedDestructionListItemsFactory } from "../../../fixtures/destructionListItem"; import { reviewFactory } from "../../../fixtures/review"; import { beoordelaarFactory, @@ -167,7 +167,7 @@ const FIXTURE: DestructionListReviewContext = { logItems: [], review: reviewFactory(), reviewers: usersFactory(), - paginatedZaken: paginatedZakenFactory(), + paginatedZaken: paginatedDestructionListItemsFactory(), }; export const ReviewerCanApproveZaak: Story = { @@ -186,8 +186,10 @@ export const ReviewerCanApproveZaak: Story = { }); const approve = approves[0]; await userEvent.click(approve); - const checkbox = await canvas.findByRole("checkbox", { checked: true }); - await expect(checkbox).toBeInTheDocument(); + // Find all checkboxes + const checkboxes = await canvas.findAllByRole("checkbox"); + const checkbox = checkboxes[0]; + await expect(checkbox).toBeChecked(); }, }; diff --git a/frontend/src/pages/destructionlist/review/DestructionListReview.tsx b/frontend/src/pages/destructionlist/review/DestructionListReview.tsx index fc5e28ba..2ec3f14c 100644 --- a/frontend/src/pages/destructionlist/review/DestructionListReview.tsx +++ b/frontend/src/pages/destructionlist/review/DestructionListReview.tsx @@ -7,7 +7,7 @@ import { useConfirm, usePrompt, } from "@maykin-ui/admin-ui"; -import React, { useMemo } from "react"; +import { useMemo } from "react"; import { useLoaderData } from "react-router-dom"; import { @@ -60,6 +60,9 @@ export function DestructionListReviewPage() { reviewItems, reviewResponse, } = useLoaderData() as DestructionListReviewContext; + const zakenResults = paginatedZaken.results + .map((zaak) => zaak.zaak) + .filter((zaak) => zaak !== null) as Zaak[]; const user = useWhoAmI(); @@ -70,7 +73,7 @@ export function DestructionListReviewPage() { comment: string; }>( storageKey, - paginatedZaken.results, + zakenResults, filterSelectionZaken, getSelectionDetail, RestBackend, @@ -84,7 +87,7 @@ export function DestructionListReviewPage() { comment: string; }>( storageKey, - paginatedZaken.results.map((z) => z.url as string), + paginatedZaken.results.map((z) => z.zaak?.url as string), true, RestBackend, ); @@ -125,14 +128,15 @@ export function DestructionListReviewPage() { uuid, destructionList.status, ); - const zaakReviewStatusBadges = useZaakReviewStatusBadges( - paginatedZaken.results, - { ...approvedZaakSelection, ...excludedZaakSelection }, - ); + const zaakReviewStatusBadges = useZaakReviewStatusBadges(zakenResults, { + ...approvedZaakSelection, + ...excludedZaakSelection, + }); // The object list of the current page with review actions appended. const objectList = useMemo(() => { - return paginatedZaken.results.map((zaak) => { + return paginatedZaken.results.map((result) => { + const zaak = result.zaak as Zaak; const badge = zaakReviewStatusBadges[zaak.url as string].badge; const actions = getActionsToolbarForZaak(zaak); return { ...zaak, Beoordeling: badge, Acties: actions };