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:
@@ -51,8 +51,25 @@ const invoiceMap: Record<InvoiceListStatus, { color: BadgeColor; label: string }
|
||||
unsettled: { color: 'amber', label: 'تسویه نشده' },
|
||||
};
|
||||
|
||||
const treatmentSessionMap: Record<string, { color: BadgeColor; label: string }> = {
|
||||
planned: { color: 'gray', label: 'برنامهریزی شده' },
|
||||
booked: { color: 'blue', label: 'زمانبندی شده' },
|
||||
in_progress: { color: 'amber', label: 'در حال انجام' },
|
||||
done: { color: 'green', label: 'انجام شد' },
|
||||
cancelled: { color: 'red', label: 'لغو شده' },
|
||||
no_show: { color: 'gray', label: 'غیبت' },
|
||||
};
|
||||
|
||||
const treatmentAreaMap: Record<string, { color: BadgeColor; label: string }> = {
|
||||
pending: { color: 'gray', label: 'در انتظار' },
|
||||
in_progress: { color: 'amber', label: 'در حال انجام' },
|
||||
completed: { color: 'green', label: 'تکمیل شده' },
|
||||
skipped: { color: 'violet', label: 'صرفنظر شده' },
|
||||
};
|
||||
|
||||
interface Props {
|
||||
type: 'appointment' | 'payment' | 'sms' | 'settlement' | 'active' | 'claim' | 'invoice';
|
||||
type: 'appointment' | 'payment' | 'sms' | 'settlement' | 'active' | 'claim' | 'invoice'
|
||||
| 'treatment-session' | 'treatment-area';
|
||||
value: string;
|
||||
}
|
||||
|
||||
@@ -78,6 +95,12 @@ export default function StatusBadge({ type, value }: Props) {
|
||||
} else if (type === 'invoice') {
|
||||
const m = invoiceMap[value as InvoiceListStatus];
|
||||
if (m) { color = m.color; label = m.label; }
|
||||
} else if (type === 'treatment-session') {
|
||||
const m = treatmentSessionMap[value];
|
||||
if (m) { color = m.color; label = m.label; }
|
||||
} else if (type === 'treatment-area') {
|
||||
const m = treatmentAreaMap[value];
|
||||
if (m) { color = m.color; label = m.label; }
|
||||
} else if (type === 'active') {
|
||||
color = value === 'true' || value === 'active' ? 'green' : 'gray';
|
||||
label = value === 'true' || value === 'active' ? 'فعال' : 'غیرفعال';
|
||||
|
||||
Reference in New Issue
Block a user