feat(appointments): close the three remaining design gaps
1. شارژ کیف پول is now functional end-to-end. New owner-gated
POST /api/v1/patient/{uuid}/wallet/charge creates a manual credit
WalletTransaction (computed balance_after); the patient detail's wallet tab
gains a top-up modal (PriceInput + description) and supports ?tab= deep
links. The deposit sections of the create drawer, the edit page and the
replace modal link to it via WalletChargeLink (record resolved by mobile).
2. جایگزینی نوبت now matches appointments-replace.pdf: patient search-or-new,
بخش/سرویس/پرسنل selects prefilled from the appointment, deposit toggle +
amount + charge link, read-only original date/time, status pick and notes —
all through the general PATCH.
3. The confirmed-appointments table is paginated (20/page, client-side so the
schedule view and doctor-tab derivation keep the whole day), resetting on
date/doctor/filter changes. The page-local STATUS_META also adopts the
design labels plus following_up/salon for the schedule cards.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -85,15 +85,40 @@ describe('AppointmentActionsMenu (عملیات نوبت)', () => {
|
||||
})));
|
||||
});
|
||||
|
||||
it('replace modal swaps the patient on the slot', async () => {
|
||||
it('replace modal swaps the patient and keeps the slot locked', async () => {
|
||||
openMenu();
|
||||
fireEvent.click(screen.getByText('جایگزینی نوبت'));
|
||||
expect(await screen.findByPlaceholderText('نام و نام خانوادگی مراجعه کننده')).toBeInTheDocument();
|
||||
fireEvent.change(screen.getByPlaceholderText('نام و نام خانوادگی مراجعه کننده'), { target: { value: 'ساغر صابری' } });
|
||||
expect(await screen.findByPlaceholderText('نام و نام خانوادگی')).toBeInTheDocument();
|
||||
// the original slot is shown read-only
|
||||
expect(screen.getByDisplayValue('2024-12-31')).toBeDisabled();
|
||||
expect(screen.getByDisplayValue('09:00')).toBeDisabled();
|
||||
// prefilled from the appointment's current specs
|
||||
expect((screen.getByLabelText('وضعیت') as HTMLSelectElement).value).toBe('confirmed');
|
||||
|
||||
fireEvent.change(screen.getByPlaceholderText('نام و نام خانوادگی'), { target: { value: 'ساغر صابری' } });
|
||||
fireEvent.change(screen.getByPlaceholderText('شماره تماس'), { target: { value: '09356619438' } });
|
||||
fireEvent.click(screen.getByText('ثبت نوبت'));
|
||||
await waitFor(() => expect(patch).toHaveBeenCalledWith('/api/v1/appointment/ap1', expect.objectContaining({
|
||||
patient_name: 'ساغر صابری', patient_mobile: '09356619438', version: 3,
|
||||
patient_name: 'ساغر صابری', patient_mobile: '09356619438',
|
||||
service_section_uuid: 's1', service_item_uuid: 'i1', staff_uuid: 'st1',
|
||||
version: 3,
|
||||
})));
|
||||
});
|
||||
|
||||
it('replace modal picks an existing patient from the record search', async () => {
|
||||
get.mockImplementation((url: string) => {
|
||||
if (url.startsWith('/api/v1/patient?search=')) return Promise.resolve({ success: true, data: [
|
||||
{ uuid: 'rec9', user_name: 'پریسا همتی', user_mobile: '09120009999' },
|
||||
] });
|
||||
return Promise.resolve({ success: true, data: [] });
|
||||
});
|
||||
openMenu();
|
||||
fireEvent.click(screen.getByText('جایگزینی نوبت'));
|
||||
fireEvent.change(await screen.findByPlaceholderText('جستجوی نام، شماره تماس، شماره پرونده...'), { target: { value: 'پریسا' } });
|
||||
fireEvent.click(await screen.findByText('پریسا همتی'));
|
||||
fireEvent.click(screen.getByText('ثبت نوبت'));
|
||||
await waitFor(() => expect(patch).toHaveBeenCalledWith('/api/v1/appointment/ap1', expect.objectContaining({
|
||||
patient_name: 'پریسا همتی', patient_mobile: '09120009999',
|
||||
})));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user