feat(appointments): resource tabs follow their supervising doctor
Resource tabs now sit under the selected doctor and list only the resources that doctor supervises, so moving between a doctor's own appointments and the devices under them is one row of tabs rather than a flat list of everything. The booking modal reads the doctor from the resource's supervisor instead of asking again. The doctor↔resource relation is defined once, on the resource, and repeating the question here would have made a second source of truth. A resource whose supervisor was removed is blocked with a message pointing at the fix rather than a silently disabled button. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -66,9 +66,11 @@ describe('AppointmentsPage — پروفایل کلینیک چندپزشکه', ()
|
||||
] } });
|
||||
if (url.includes('appointment-slots')) return Promise.resolve({ success: true, data: { sessions: [], empty_reason: 'holiday' } });
|
||||
if (url.includes('/my/appointments')) return Promise.resolve({ success: true, data: [], meta: { totalRecords: 0, totalPages: 0, currentPage: 1 } });
|
||||
// منابع زیر نظر پزشکاند؛ تب هر منبع فقط زیر ناظرِ خودش دیده میشود.
|
||||
if (url.includes('/api/v1/resources')) return Promise.resolve({ success: true, data: [
|
||||
{ uuid: 'r-1', name: 'اتاق ۱', type_name: 'اتاق درمان' },
|
||||
{ uuid: 'r-2', name: 'لیزر CO2', type_name: 'دستگاه لیزر' },
|
||||
{ uuid: 'r-1', name: 'اتاق ۱', type_name: 'اتاق درمان', supervisor: { uuid: 'd1', name: 'دکتر محمدی' } },
|
||||
{ uuid: 'r-2', name: 'لیزر CO2', type_name: 'دستگاه لیزر', supervisor: { uuid: 'd1', name: 'دکتر محمدی' } },
|
||||
{ uuid: 'r-3', name: 'لیزر دکتر رضایی', type_name: 'دستگاه لیزر', supervisor: { uuid: 'd2', name: 'دکتر رضایی' } },
|
||||
] });
|
||||
return Promise.resolve({ success: true, data: [] });
|
||||
});
|
||||
@@ -85,10 +87,12 @@ describe('AppointmentsPage — پروفایل کلینیک چندپزشکه', ()
|
||||
* منابع مثل پزشکان تب خودشان را دارند: نوبتِ «لیزر CO2» به دستگاه تعلق دارد، نه به
|
||||
* پزشکی که پشتش ایستاده.
|
||||
*/
|
||||
it('برای هر منبع فعال یک تب نشان میدهد', async () => {
|
||||
it('فقط منابعِ تحت نظارت پزشکِ انتخابشده تب میگیرند', async () => {
|
||||
renderWithProviders(<AppointmentsPage />);
|
||||
// پزشک اول (d1) خودکار انتخاب میشود، پس فقط منابع او دیده میشوند.
|
||||
expect(await screen.findByText('لیزر CO2')).toBeInTheDocument();
|
||||
expect(screen.getByText('اتاق ۱')).toBeInTheDocument();
|
||||
expect(screen.queryByText('لیزر دکتر رضایی')).toBeNull();
|
||||
});
|
||||
|
||||
/** تب فعال از URL خوانده میشود و فهرست با resource_uuid فیلتر میشود، نه doctor_uuid. */
|
||||
|
||||
Reference in New Issue
Block a user