Skip to content

Fix: Volunteer card: Add tick box in EFZ documents #272#351

Merged
need4deed merged 3 commits intoneed4deed-org:developfrom
lourooo:lourooo-fix-272-efz-checkbox
Apr 28, 2026
Merged

Fix: Volunteer card: Add tick box in EFZ documents #272#351
need4deed merged 3 commits intoneed4deed-org:developfrom
lourooo:lourooo-fix-272-efz-checkbox

Conversation

@lourooo
Copy link
Copy Markdown
Contributor

@lourooo lourooo commented Apr 20, 2026

Fix: Volunteer card: Add tick box in EFZ documents #272

Description

Added Received checkbox column to the left of the Status column in the document table

Related Issues

Closes #272

Changes

  • Added Received checkbox column to the left of the Status column in the document table
  • Checking the box turns the status badge green (Uploaded)
  • Received date is shown in the Uploaded on column when the checkbox is marked
  • Added received and receivedOn translation keys (EN + DE)

Screenshots / Demos

image

Checklist

  • WITHIN THE SCOPE OF AN ISSUE; No unnecessary files included
  • Tests added/updated
  • Documentation updated
  • CI passes

Copy link
Copy Markdown
Collaborator

@nadavosa nadavosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see below

Copy link
Copy Markdown
Collaborator

@nadavosa nadavosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The receivedState is stored in local useState only — no API call is made when the checkbox is toggled. This means the received status is lost on every page refresh and the BE is never updated.

// VolunteerProfileDocument.tsx
const [receivedState, setReceivedState] = useState<Record<string, { isReceived: boolean; receivedAt: Date | null }>>({});

const handleToggleReceived = (type: string) => {
  setReceivedState((prev) => { ... }); // local state only, no mutation
};

To make this work properly, onToggleReceived needs to call a mutation that persists the received status to the BE (similar to how uploadMutation and deleteMutation are handled). it need to be added to the BE first

@lourooo
Copy link
Copy Markdown
Contributor Author

lourooo commented Apr 21, 2026

The backend doesn't support this yet, there's no endpoint or SDK field for marking documents as received. The local state is intentional as a placeholder until the backend implements it, at which point the mutation can be wired up following the same pattern as uploadMutation and deleteMutation.

@lourooo
Copy link
Copy Markdown
Contributor Author

lourooo commented Apr 21, 2026

Updated

@nadavosa
Copy link
Copy Markdown
Collaborator

Before this gets merged, please run yarn lint and yarn typecheck locally and fix any errors. We've added a CI check (#359) that will block merging if these fail.

@nadavosa
Copy link
Copy Markdown
Collaborator

nadavosa commented Apr 27, 2026

BE PR need4deed-org/be#417 adds the endpoint and migration. SDK changes are being published locally.

Once the new SDK version is available, please update this PR:

  1. Replace the useState with a mutation — call PATCH /volunteer/:id/doc/:type with body { received: boolean } when the checkbox is toggled. Use receivedOn from the response to update the "Uploaded on" date.

  2. Use received and receivedOn from the API response instead of local state — the initial checkbox state should come from document.received, and the date from document.receivedOn.

SDK types to use:

  • ApiDocumentGet.received: boolean
  • ApiDocumentGet.receivedOn: Date | null
  • ApiDocumentPatch: { received: boolean } for the request body

lourooo added 3 commits April 28, 2026 10:51
Fix: no API call is made
…om API response

Update: Fix: wire received checkbox to API mutation and read state from API response
@lourooo lourooo force-pushed the lourooo-fix-272-efz-checkbox branch from 94d4ad5 to 6e417d6 Compare April 28, 2026 08:51
@lourooo
Copy link
Copy Markdown
Contributor Author

lourooo commented Apr 28, 2026

Updated

Copy link
Copy Markdown
Collaborator

@nadavosa nadavosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mutation wired up correctly — useMarkDocumentReceived called on toggle, receivedAt date shown, badge reflects received state. The checkbox now actually persists.

Merge is contingent on BE PR need4deed-org/be#417 being merged first (which adds the received/receivedOn fields to the API).

@need4deed need4deed merged commit ed7be18 into need4deed-org:develop Apr 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Volunteer card: Add tick box in EFZ documents

3 participants