feat(admin): default the booking staff from the service's protocol, and call it پرسنل
The staff field started empty even when the service's treatment protocol already named who may perform it — a decision made once in the service settings and then asked again on every booking. The modal now reads that protocol and preselects its first staff member, but only until the user touches the field; otherwise a manual choice would be wiped on the next service change. A protocol with no staff leaves it empty and does not block submission. Renames the four user-facing 'اپراتور' strings to 'پرسنل', matching the record in /admin/staff that they all refer to. ResourcesPage keeps the word: there it names a kind of bookable resource (doctor, operator, room, device), not a ClinicStaff row. Drops a test whose premise the default invalidated; the two new ones cover both sides — protocol with staff sends staff_uuid, protocol without staff sends none. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -113,7 +113,7 @@ export default function StaffSessionDetailPage() {
|
||||
|
||||
<div style={{ display: 'flex', gap: 16, flexWrap: 'wrap', fontSize: 12.5, color: 'var(--text-2)' }}>
|
||||
{session.appointment && <span>تاریخ: {formatDate(session.appointment.slot_start)}</span>}
|
||||
{session.performed_by && <span>اپراتور: {session.performed_by.name}</span>}
|
||||
{session.performed_by && <span>پرسنل: {session.performed_by.name}</span>}
|
||||
<span>{formatNumber(settled)} از {formatNumber(areas.length)} ناحیه انجام شده</span>
|
||||
{elapsed && (
|
||||
<span style={{ fontVariantNumeric: 'tabular-nums' }}>
|
||||
|
||||
@@ -142,14 +142,14 @@ describe('صفحهٔ پروندههای درمان', () => {
|
||||
});
|
||||
|
||||
/** تا وقتی جلسهای انجام نشده، برنامه را نشان میدهیم نه هیچ. */
|
||||
it('اگر هنوز انجام نشده، اپراتورِ اختصاصیافته را نشان میدهد', async () => {
|
||||
it('اگر هنوز انجام نشده، پرسنلِ اختصاصیافته را نشان میدهد', async () => {
|
||||
mockList([caseRow({ assigned_staff: [{ uuid: 'st-2', name: 'پرسنل۲' }] })]);
|
||||
|
||||
renderWithProviders(<TreatmentCasesPage />);
|
||||
await screen.findByText('محمد رسولی');
|
||||
fireEvent.click(screen.getByLabelText('نمایش کارتی'));
|
||||
|
||||
expect(await screen.findByText(/اپراتور: پرسنل۲/)).toBeInTheDocument();
|
||||
expect(await screen.findByText(/پرسنل: پرسنل۲/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
/** نمای پیشفرض جدول است — همان الگوی صفحهٔ پروندهها، با سوییچ به کارتی. */
|
||||
|
||||
@@ -354,7 +354,7 @@ function CaseCard({ item: c, onEdit }: { item: TreatmentCaseSummary; onEdit: ()
|
||||
{c.supervisor && <span>پزشک ناظر: {c.supervisor.name}</span>}
|
||||
{operator !== null && (
|
||||
operator.planned
|
||||
? <span style={{ color: 'var(--text-3)' }}>اپراتور: {operator.text} (هنوز انجام نشده)</span>
|
||||
? <span style={{ color: 'var(--text-3)' }}>پرسنل: {operator.text} (هنوز انجام نشده)</span>
|
||||
: <span>انجامدهنده: {operator.text}</span>
|
||||
)}
|
||||
{c.areas.length > 0 && <span>نواحی: {c.areas.map((a) => a.name).join('، ')}</span>}
|
||||
|
||||
Reference in New Issue
Block a user