Skip to content

feat: coordinator-created NGO/agent profiles from the Agents table (fe#911) - #937

Merged
need4deed merged 2 commits into
developfrom
911-coordinator-created-agent
Aug 21, 2026
Merged

feat: coordinator-created NGO/agent profiles from the Agents table (fe#911)#937
need4deed merged 2 commits into
developfrom
911-coordinator-created-agent

Conversation

@nadavosa

Copy link
Copy Markdown
Collaborator

What

Closes #911

Adds a coordinator/admin-only "+" button to the Agents dashboard table header for creating a bare NGO/agent profile before it has self-registered, per the issue.

Changes

  • CardsHeader: new optional headerAction slot next to the title (no other consumer needs it yet).
  • CreateAgentDialog (new): minimal form — organization name (required) + optional street/postcode — using react-hook-form + zod, mirroring the existing agent-contact add flow (useCreateAgentContact / NewContactRow).
  • useCreateAgent: POST /agent mutation, invalidates the ["agents"] query on success.
  • Only wired into Agents.tsx, gated on UserRole.COORDINATOR/ADMIN.
  • en/de translation keys under dashboard.agents.createAgent.

Deliberately does not reuse the multi-step self-registration wizard (AgentRegistration/*) — that's the right UX for a brand-new org signing itself up, not for a coordinator jotting down a placeholder record from a phone call. Richer fields (type, services, languages, about) are left for the coordinator to fill in afterward on the created agent's own profile page, same as any other agent.

Depends on

be need4deed-org/be#891 (POST /agent) — needs to merge/deploy first for this to actually create anything; the button will otherwise 404/500.

Test plan

  • yarn typecheck, yarn lint, yarn build all clean.
  • Not manually verified in a browser — no browser tooling available in this environment. Please click through the golden path (button visible only to coordinator/admin, form validation, success creates + shows in the list, duplicate title shows the 409 message) before merging.

…e#911)

Adds a coordinator/admin-only "+" button to the Agents table header,
opening a minimal create form (name + optional address) that calls the
new POST /agent (be#891). The created agent has no linked Person/User —
richer fields (type, services, languages, about) are filled in later via
the agent's own profile page, same as any other agent.

- CardsHeader gets a generic headerAction slot next to the title.
- CreateAgentDialog: react-hook-form + zod, mirrors the existing
  add-contact dialog's pattern (useCreateAgentContact / NewContactRow).
- Deliberately does not reuse the multi-step self-registration wizard —
  wrong UX for a quick placeholder-record creation.
- Bump need4deed-sdk 0.0.139 -> 0.0.145 to pick up ApiAgentCreateResponse
  (now published) and Agent.unclaimed, both added by be#891's follow-up
  review round. useCreateAgent now uses the real SDK type instead of a
  local shadow copy that predated its publication.
- Add an "Unclaimed" badge to AgentCard and AgentTableRow so a
  coordinator can actually tell a coordinator-created placeholder agent
  apart from a real one in the list — the whole reason Agent.unclaimed
  was added, which this PR wasn't yet consuming.
- Dedupe the circular icon-button CSS shared by the agent contact list's
  add/edit buttons and the new "create agent" button into
  circleIconButtonStyles (styled/mixins.ts), instead of copy-pasting it.

The sdk bump also pulls in AgentEngagementStatusType.INCONTACT/
TRIED_TO_CONTACT (be#796), which broke typecheck in two files this PR
doesn't otherwise touch (statusMaps.ts, ProfileHeader/agent/constants.ts).
Added the same entries fe#923 already proposes for those exact two
files/keys, so there's nothing left to conflict with once it merges —
the actual UX/copy design for those statuses stays that PR's job, not
reinvented here.
@nadavosa

Copy link
Copy Markdown
Collaborator Author

Self-review follow-up — fixed all 3 findings:

  • Bumped `need4deed-sdk` 0.0.139 → 0.0.145 and switched `useCreateAgent` to the real (now-published) `ApiAgentCreateResponse` instead of the local shadow type.
  • Added an "Unclaimed" badge to `AgentCard`/`AgentTableRow`, consuming the `Agent.unclaimed` field the follow-up review on be#891 added — without it, a coordinator had no way to visually tell a placeholder agent apart from a real one.
  • Deduped the circular icon-button CSS (`AddContactButton` / `CreateAgentButton`) into a shared `circleIconButtonStyles` mixin instead of two copies.

Side effect: the SDK bump also pulls in `AgentEngagementStatusType.INCONTACT`/`TRIED_TO_CONTACT` (be#796), which broke typecheck in two files this PR doesn't otherwise touch. Added the exact same entries fe#923 already proposes for those two files, so this won't conflict with that PR when it lands — the real UX/copy for those statuses is still #923's job, not reinvented here.

yarn typecheck, yarn lint, and yarn build all pass. Still no browser available in this environment to click through it live — please verify the golden path before merging, same as noted in the PR description.

@need4deed
need4deed merged commit 0277222 into develop Aug 21, 2026
1 check passed
@need4deed
need4deed deleted the 911-coordinator-created-agent branch August 21, 2026 10:13
@need4deed
need4deed self-requested a review August 21, 2026 10:14
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.

feat: coordinator-created NGO/agent profiles (no registration) from the Agents dashboard table

2 participants