4.2 KiB
name, description
| name | description |
|---|---|
| dyolink-lab-tasks | Lab Tasks tab — list, sort, filters, case grouping, prosthesis colors, step-completed filter. Use when changing TasksPage, tasks API, or lab task list UX. |
Lab Tasks
Main UI: frontend/src/components/ui/lab/TasksPage.tsx
Backend: backend/src/modules/tasks/
Default sort (backend)
sortBy=date + sortDir=desc:
labCase.sentAtdesc (newest case first)labCaseId,treatmentDetailId,prosthesisTypeCodeasc (stable grouping)stepOrderasc (steps 1→N within prosthesis group)idasc
Other sorts use flat list on the frontend; stepOrder asc is still a tiebreaker.
Case grouping (frontend)
sortBy === 'date'→ grouped view viataskListGrouping.ts: case header → prosthesis sub-header → task rows.- Other sorts → flat list; show muted hint (
groupingOff*i18n keys). Each row keeps clinic/patient/teeth context.
Components: TaskCaseGroupHeader, TaskProsthesisGroupHeader, TaskRow.
Prosthesis colors
- Map:
catalog-type-colors.ts→PROSTHESIS_TYPE_COLORS(one hex per catalog code). - Resolve with
prosthesisTypeDisplay.ts— useprosthesisTypeBadgeStyleFromCatalog(code, catalog), not list row index. - Load catalog via
prosthesisCatalogApi.list()on Tasks/Cases/Today dashboard.
Filters
| Param | API | UI |
|---|---|---|
q, clinicOrganizationId, status |
GET /tasks |
Search, clinic, status |
stepCompleted |
GET /tasks |
Workflow step dropdown |
pinImportant |
GET /tasks |
Important first (sort pin) |
assignedToMe |
GET /tasks |
Only tasks assigned to current user |
| Clinics + steps options | GET /tasks/filter-options |
Populates dropdowns (not from current page) |
Task assignment: Managed in Cases (TAB_CASES_EDIT), not on Tasks tab. PATCH /cases/:caseId/tasks/:taskId/assign; assignable staff via GET /cases/assignable-staff (members with TAB_TASKS_EDIT, including participating owner). Case detail task row: step label, status badge, assign dropdown, and last-updated line on one compact row.
Tasks visibility & status edit: All tasks remain visible to every user with task access (no hiding assigned tasks). Unassigned tasks or tasks assigned to you → status dropdown when TAB_TASKS_EDIT. Assigned to someone else → read-only “Assigned to {name}” badge instead of the dropdown (backend rejects status PATCH). Managers assign/monitor in Cases.
Step completed filter: Restricts to prosthesis groups (labCaseId, treatmentDetailId, prosthesisTypeCode) where that workflowStepCode task is COMPLETED. Combined with status=IN_PROGRESS, returns only in-progress tasks in those groups (completed step row hidden).
- Important first:
pinImportant=trueprepends important cases in sort order. - Assigned to me:
assignedToMe=truefilters to current user's assigned tasks only. - Reset view:
resetViewrestoresDEFAULT_TASKS_VIEWfromtasksViewDefaults.ts. - Show in case: flat-sort rows only; resets filters/sort, calls
GET /tasks/locate-pageto find the correct page in the full default-sorted list, then highlights + scrolls to the task. - Complete animation: when marking done under in-progress filter, row plays exit animation + success toast before refetch.
APIs
GET /tasks— paginated flat task list (grouping is client-side whensortBy=date)PATCH /tasks/:taskId— update status (only assignee or unassigned task)GET /tasks/filter-options— clinics + workflow steps (localized)GET /tasks/locate-page— page number for a task in the sorted filtered listGET /cases/assignable-staff— staff eligible for task assignmentPATCH /cases/:caseId/tasks/:taskId/assign— assign or unassign (assigneeUserIdnullable)
List items include caseSentAt, assignee, assignedAt for case headers / flat rows.
Permissions
TAB_TASKS_READ / TAB_TASKS_EDIT; LabOrgGuard on all task routes.