fix(services): restore separate insurance modal + fix ⋮ menu position

- revert the previous merge of insurance coverage into the service edit
  modal (per user): 'پوشش بیمه' is again a ⋮ menu action opening its own
  ServiceInsuranceModal, kept within the services page
- delete the inline ServiceInsuranceSection; restore ServiceInsuranceModal
- fix ⋮ dropdown position: left:8 → insetInlineStart:8 so the menu anchors
  under the ⋮ button (which sits at inline-start/right in RTL) instead of
  the opposite side
- keep the --primary-subtle → --primary-soft token fix in the modal
- test: assert the ⋮ menu exposes ویرایش / تعرفه‌های سالانه / پوشش بیمه

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-07-14 17:36:17 +03:30
co-authored by Claude Opus 4.8
parent 7da543d8d7
commit 2337cfd90c
3 changed files with 39 additions and 62 deletions
+4 -11
View File
@@ -36,11 +36,6 @@ 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: [] });
});
});
@@ -64,15 +59,13 @@ describe('ClinicServicesPage (خدمات)', () => {
expect(screen.getByText('سرویس جدید')).toBeInTheDocument();
});
it('embeds per-insurer coverage inline inside the service edit modal', async () => {
it('opens the ⋮ actions menu with insurance and tariff entries for a service', 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();
expect(await screen.findByText('ویرایش')).toBeInTheDocument();
expect(screen.getByText('تعرفه‌های سالانه')).toBeInTheDocument();
expect(screen.getByText('پوشش بیمه')).toBeInTheDocument();
});
});