fix(treatment): let the operator actually record an area

Starting a session created area records with no device, and the panel only ever
read the device it never set — so every "اتمام این ناحیه" came back 422 with
"دستگاه این ناحیه مشخص نیست". The backend tests passed because they sent
resource_uuid explicitly; from the UI the flow was unusable end to end.

The device now inherits from the appointment's resource, which the secretary
already chose at booking; asking the operator again is taking one decision
twice. The session screen offers a picker per area on top of that, because one
session really does run bikini on an alexandrite and underarms on a diode.

Treating without a device is allowed: botox is an injection, and requiring a
device would make clinics invent a fake resource per injection. Sending readings
with no device is still rejected — there would be no schema to validate against.

A protocol whose service has no ResourceServiceOffering rows now says so in the
tab where the manager is standing. It does not block booking: "no offering means
any resource" is a deliberate, tested rule. But silence meant the gap surfaced
only when the operator was already in front of a patient.

Also adds the live timer the spec asked for, and wires slot-suggestions into the
unbooked queue — the endpoint existed and tested green but no screen called it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hamed
2026-08-07 11:08:48 +03:30
co-authored by Claude Opus 5
parent c7fdb92df4
commit a63de2a52c
11 changed files with 412 additions and 37 deletions
+19
View File
@@ -1342,8 +1342,27 @@ export interface TreatmentFormField {
sort_order?: number;
}
/** وقت‌های آزادِ پیشنهادی برای جلسهٔ بعد. */
export interface SlotSuggestionResponse {
resource_uuid: string;
from: number;
days: Array<{
date: string;
slots: Array<{ start: number; end: number; start_time: string; end_time: string }>;
}>;
}
/** دستگاهی که اپراتور می‌تواند برای یک ناحیه انتخاب کند. */
export interface TreatmentDevice {
uuid: string;
name: string;
type: string;
}
export interface StaffSessionDetail extends TreatmentSessionSummary {
case: TreatmentCaseSummary;
/** دستگاه‌های فعالِ همین محیط — ناحیه‌ها می‌توانند دستگاه متفاوت داشته باشند. */
devices: TreatmentDevice[];
/** uuid منبع => فیلدهای فرمش */
forms: Record<string, TreatmentFormField[]>;
}