feat: coordinator-created NGO/agent profiles from the Agents table (fe#911) - #937
Merged
Conversation
…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.
Collaborator
Author
|
Self-review follow-up — fixed all 3 findings:
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 optionalheaderActionslot next to the title (no other consumer needs it yet).CreateAgentDialog(new): minimal form — organization name (required) + optional street/postcode — usingreact-hook-form+zod, mirroring the existing agent-contact add flow (useCreateAgentContact/NewContactRow).useCreateAgent:POST /agentmutation, invalidates the["agents"]query on success.Agents.tsx, gated onUserRole.COORDINATOR/ADMIN.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
beneed4deed-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 buildall clean.