61 lines
2.2 KiB
Markdown
61 lines
2.2 KiB
Markdown
# PersonPicker Implementation Plan
|
|||
|
|
|
||
|
|
> **For agentic workers:** This plan was written after the code landed (per user request: build first, document after). Tasks below reflect what was done and how to verify.
|
||
|
|
|
||
|
|
**Goal:** Shared Ant Design Vue `PersonPicker` (select + server search + dropdown «add person» + create modal), used in Activity, Deal, and Invoice forms.
|
||
|
|
|
||
|
|
**Architecture:** One component owns search, options, dropdown footer CTA, and `PersonFormView` modal. Parents pass `v-model` + `seedPeople` and handle side effects via `@change` / `@created`.
|
||
|
|
|
||
|
|
**Tech stack:** Vue 3, Ant Design Vue 4, `@mento/web`, existing `/people` API.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## File map
|
||
|
|
|
||
|
|
| File | Role |
|
||
|
|
|---|---|
|
||
|
|
| `apps/web/src/components/PersonPicker.vue` | New shared picker |
|
||
|
|
| `apps/web/src/views/ActivityFormView.vue` | Consume picker; remove local search/modal |
|
||
|
|
| `apps/web/src/views/DealFormView.vue` | Same |
|
||
|
|
| `apps/web/src/views/InvoiceFormView.vue` | Same; label «افزودن مشتری جدید» |
|
||
|
|
| `docs/superpowers/specs/2026-11-29-person-picker-design.md` | Design spec |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### Task 1: PersonPicker component
|
||
|
|
|
||
|
|
**Status:** Done
|
||
|
|
|
||
|
|
- `a-select` + `filter-option=false` + debounce search `GET /people?q=&limit=30`
|
||
|
|
- `dropdownRender` footer: divider + link button with `UserAddOutlined`
|
||
|
|
- `a-modal` + embedded `PersonFormView`; on save select person and emit `created` + `change`
|
||
|
|
- Props: `modelValue`, `placeholder`, `allowClear`, `disabled`, `addLabel`, `seedPeople`
|
||
|
|
|
||
|
|
### Task 2: ActivityFormView
|
||
|
|
|
||
|
|
**Status:** Done
|
||
|
|
|
||
|
|
- Replace select + link + `UiModal` with `<PersonPicker v-model="personId" :seed-people="people" @change="onPersonPickerChange" />`
|
||
|
|
- Keep `rememberPerson` / `ensurePersonLoaded` for load paths
|
||
|
|
|
||
|
|
### Task 3: DealFormView
|
||
|
|
|
||
|
|
**Status:** Done
|
||
|
|
|
||
|
|
- Same wiring; `@created` sets `contactKind = 'person'` and fills company from person
|
||
|
|
|
||
|
|
### Task 4: InvoiceFormView
|
||
|
|
|
||
|
|
**Status:** Done
|
||
|
|
|
||
|
|
- Replace select + `RouterLink` with PersonPicker (`add-label="افزودن مشتری جدید"`)
|
||
|
|
- Server search instead of client-only filter; seed from loaded `people`
|
||
|
|
|
||
|
|
### Task 5: Verify
|
||
|
|
|
||
|
|
```bash
|
||
|
|
npm run build -w @mento/web
|
||
|
|
```
|
||
|
|
|
||
|
|
Manual smoke: open Activity / Deal / Invoice → search person → add via dropdown footer → save form still binds personId.
|