feat(admin): let the booking date be changed inside the modal
The modal took its date from the caller and had no way to change it. Opened from a session card, that meant the projected date or nothing: if the device had no free time that day the user had to close a form they had already filled with a patient and a service, go elsewhere, and start again. The date is now a field in step one, seeded from the prop and reset when the prop changes. ServiceSlotPicker already clears the picked slot when its date changes, so the times reload for the new day on their own. The header chip drops the date whenever that field is on screen; showing the same value twice, one editable and one not, invites the reader to trust the wrong one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -142,14 +142,16 @@ describe('مودال ثبت نوبتِ منبع', () => {
|
||||
expect(await screen.findByText(/ابتدا بیمار را جستجو کنید/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('تاریخ نوبت بهصورت جلالی بالای فرم میآید', () => {
|
||||
/** تاریخ در حالت انتخابگر یک فیلدِ قابل ویرایش است، نه متنِ ثابتِ هدر. */
|
||||
it('تاریخ نوبت بهصورت جلالی و قابل ویرایش میآید', () => {
|
||||
renderWithProviders(
|
||||
<NewAppointmentModal slot={slot} resource={resource} services={services} date="2026-08-04" onClose={() => {}} onSuccess={() => {}} />,
|
||||
);
|
||||
|
||||
// بدون این، کاربر روزِ در حال رزرو را هیچجای مودال نمیدید.
|
||||
expect(screen.getByText('تاریخ:')).toBeInTheDocument();
|
||||
expect(screen.getByLabelText('تاریخ نوبت')).toBeInTheDocument();
|
||||
expect(screen.getByText('۱۴۰۵/۰۵/۱۳')).toBeInTheDocument();
|
||||
// چیپ هدر دیگر تاریخ را تکرار نمیکند.
|
||||
expect(screen.queryByText('تاریخ:')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('معیار جستجو یک seg با حالتِ اعلامشده است', () => {
|
||||
@@ -217,6 +219,24 @@ describe('مودال ثبت نوبتِ منبع', () => {
|
||||
expect(post.mock.calls[0][1]).not.toHaveProperty('staff_uuid');
|
||||
});
|
||||
|
||||
/**
|
||||
* وقتِ پیشنهادی همیشه در دسترس نیست؛ کاربر باید بتواند بدون بستن فرم روز دیگری
|
||||
* بگیرد و زمانها برای همان روز دوباره خوانده شوند.
|
||||
*/
|
||||
it('تغییر تاریخ، زمانهای خالی را برای روز تازه میخواند', async () => {
|
||||
renderWithProviders(
|
||||
<NewAppointmentModal slot={slot} resource={resource} services={services} date="2026-08-04" onClose={() => {}} onSuccess={() => {}} />,
|
||||
);
|
||||
|
||||
await pickServiceAndTime();
|
||||
await waitFor(() => expect(
|
||||
get.mock.calls.some((c: any[]) => typeof c[0] === 'string' && c[0].includes('date=2026-08-04')),
|
||||
).toBe(true));
|
||||
|
||||
// `PersianDateInput` تریگرش input نیست؛ با نام دسترسپذیرش پیدایش میکنیم.
|
||||
expect(screen.getByLabelText('تاریخ نوبت')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('منبعِ بدون سرویس، پیام راهنما میدهد نه فهرست خالی', () => {
|
||||
renderWithProviders(
|
||||
<NewAppointmentModal slot={slot} resource={resource} services={[]} date="2026-08-04" onClose={() => {}} onSuccess={() => {}} />,
|
||||
|
||||
Reference in New Issue
Block a user