feat(admin): treatment plan tab, staff session screens and the device form editor
Three screens, each reusing what already exists rather than inventing a parallel look. The treatment plan lives as a tab on the service page next to categories, because the course belongs to the service; the switch is the protocol's existence rather than a separate boolean that could disagree with the step list. Each step asks for days since the previous session, which is how the interval actually works and what the form should therefore say. The staff screens are the flow from the reference screenshots: today's sessions, then a session where each area is started, recorded and closed on its own. Field inputs are built from the schema the server sends per resource type, so a clinic adding an RF device sees its own form here without a code change. StatusBadge gains treatment session and area states rather than a second badge component sitting beside it, and the resource type modal grows a field editor so the operator form is configured where the device is defined. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -958,6 +958,8 @@ export interface ResourceType {
|
||||
/** نوعهای doctor/staff/room را backfill میسازد و حذف نمیشوند */
|
||||
is_system: boolean;
|
||||
active: boolean;
|
||||
/** فیلدهای فرم ثبت درمان برای این نوع منبع؛ `null` یعنی فرمی ندارد. */
|
||||
field_schema: TreatmentFormField[] | null;
|
||||
resources_count?: number;
|
||||
created_at: number;
|
||||
updated_at: number;
|
||||
@@ -1267,3 +1269,70 @@ export interface CatalogCategory {
|
||||
active: boolean;
|
||||
children?: CatalogCategory[];
|
||||
}
|
||||
|
||||
// ── Treatment ────────────────────────────────────────────────────────────────
|
||||
|
||||
export type TreatmentSessionStatus =
|
||||
| 'planned' | 'booked' | 'in_progress' | 'done' | 'cancelled' | 'no_show';
|
||||
|
||||
export type SessionAreaStatus = 'pending' | 'in_progress' | 'completed' | 'skipped';
|
||||
|
||||
export interface SessionAreaRecord {
|
||||
uuid: string;
|
||||
area: { uuid: string; name: string };
|
||||
status: SessionAreaStatus;
|
||||
/** خواندههای دستگاه؛ کلیدهایش از `field_schema` همان نوع منبع میآید. */
|
||||
parameters: Record<string, string | number> | null;
|
||||
started_at: number | null;
|
||||
finished_at: number | null;
|
||||
note: string | null;
|
||||
resource: { uuid: string; name: string; type: string } | null;
|
||||
}
|
||||
|
||||
export interface TreatmentSessionSummary {
|
||||
uuid: string;
|
||||
session_number: number;
|
||||
total_sessions: number;
|
||||
status: TreatmentSessionStatus;
|
||||
due_at: number | null;
|
||||
started_at: number | null;
|
||||
finished_at: number | null;
|
||||
note: string | null;
|
||||
appointment: { uuid: string; slot_start: number; slot_end: number; status: string } | null;
|
||||
performed_by: { uuid: string; name: string } | null;
|
||||
areas?: SessionAreaRecord[];
|
||||
}
|
||||
|
||||
export interface StaffTreatmentSession extends TreatmentSessionSummary {
|
||||
case_uuid: string;
|
||||
service_name: string;
|
||||
}
|
||||
|
||||
export interface TreatmentCaseSummary {
|
||||
uuid: string;
|
||||
status: 'active' | 'completed' | 'abandoned';
|
||||
total_sessions: number;
|
||||
completed_sessions: number;
|
||||
opened_at: number;
|
||||
closed_at: number | null;
|
||||
service: { uuid: string; name: string };
|
||||
supervisor: { uuid: string; name: string } | null;
|
||||
areas: Array<{ uuid: string; name: string }>;
|
||||
sessions?: TreatmentSessionSummary[];
|
||||
}
|
||||
|
||||
/** تعریف یک فیلد فرم ثبت درمان، از `ResourceType.field_schema`. */
|
||||
export interface TreatmentFormField {
|
||||
key: string;
|
||||
label: string;
|
||||
type: 'select' | 'number' | 'text';
|
||||
options?: Array<string | number>;
|
||||
required?: boolean;
|
||||
sort_order?: number;
|
||||
}
|
||||
|
||||
export interface StaffSessionDetail extends TreatmentSessionSummary {
|
||||
case: TreatmentCaseSummary;
|
||||
/** uuid منبع => فیلدهای فرمش */
|
||||
forms: Record<string, TreatmentFormField[]>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user