refactor(services): merge insurance coverage into the service edit modal
- extract ContractCard + contracts list from ServiceInsuranceModal into a new inline ServiceInsuranceSection (no dialog wrapper; buttons type=button so they don't submit the parent service form) - ClinicServicesPage: drop the separate 'پوشش بیمه' menu action and its standalone modal; render coverage inline under the service fields in the edit modal (edit only — needs the item uuid; create shows a hint) - delete now-unused ServiceInsuranceModal.tsx - fix undefined --primary-subtle token → --primary-soft - test: coverage renders inline inside the service edit modal Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,11 @@ beforeEach(() => {
|
||||
{ uuid: 'st1', full_name: 'مریم امینی', active: true },
|
||||
{ uuid: 'st2', full_name: 'سحر رحمانی', active: true },
|
||||
] });
|
||||
// coverage before tenant-insurances (coverage URL also contains "tenant-insurances")
|
||||
if (url.includes('/service-coverage')) return Promise.resolve({ success: true, data: { data: [] } });
|
||||
if (url.includes('/tenant-insurances')) return Promise.resolve({ success: true, data: { data: [
|
||||
{ uuid: 'ins1', insurance_name: 'تأمین اجتماعی', insurance_kind: 'basic', coverage_percent: 70 },
|
||||
] } });
|
||||
return Promise.resolve({ success: true, data: [] });
|
||||
});
|
||||
});
|
||||
@@ -58,4 +63,16 @@ describe('ClinicServicesPage (خدمات)', () => {
|
||||
expect(screen.getByText('سحر رحمانی')).toBeInTheDocument();
|
||||
expect(screen.getByText('سرویس جدید')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('embeds per-insurer coverage inline inside the service edit modal', async () => {
|
||||
renderWithProviders(<ClinicServicesPage />, { route: '/admin/clinic-services' });
|
||||
fireEvent.click(await screen.findByText('کندلا ۲۰۲۱'));
|
||||
// open the ⋮ actions menu, then ویرایش
|
||||
fireEvent.click(await screen.findByTitle('عملیات'));
|
||||
fireEvent.click(await screen.findByText('ویرایش'));
|
||||
|
||||
// insurance section + contract render inside the same (edit) modal
|
||||
expect(await screen.findByText('پوشش بیمه')).toBeInTheDocument();
|
||||
expect(await screen.findByText('تأمین اجتماعی')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user