fix(appointments): stay on the same day after edit/create

AppointmentsPage now reads an optional ?date=YYYY-MM-DD query param as its
initial selected date. AppointmentEditPage and AppointmentCreatePage navigate
back to /admin/appointments?date=<the appointment's day> on save (and the edit
page's back link carries the date too), so the user returns to the day they
were viewing instead of today.

Test: AppointmentsPage honors ?date= and fetches that day.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
hamed
2026-07-15 16:13:32 +03:30
co-authored by Claude Opus 4.8
parent 41e193ab83
commit 526048fd56
4 changed files with 16 additions and 5 deletions
@@ -39,6 +39,13 @@ describe('AppointmentsPage — طرح نوبت‌ها', () => {
expect(await screen.findByText('این روز تعطیل است')).toBeInTheDocument();
});
it('honors the ?date= query param (returns to the same day after edit)', async () => {
renderWithProviders(<AppointmentsPage />, { route: '/admin/appointments?date=2024-06-01' });
await screen.findByText('این روز تعطیل است');
const usedDate = get.mock.calls.some((c: any[]) => typeof c[0] === 'string' && c[0].includes('date=2024-06-01'));
expect(usedDate).toBe(true);
});
it('independent doctor profile does NOT show doctor tabs', async () => {
renderWithProviders(<AppointmentsPage />);
await screen.findByText('این روز تعطیل است');