feat(treatment): date-range filter on treatment cases, and time on the start stamp
The list could be narrowed by status and by search but not by when a case opened, which is the one axis a clinic actually reports on. `from` and `to` (YYYY-MM-DD) now bound `opened_at`, using the same strtotime day-boundary convention the appointment date filters already use under the app's global Tehran timezone. A malformed value is ignored rather than erroring — this is a filter, not a form field. Both bounds live in the URL via useUrlState, so back and refresh keep the range. The two date inputs and the "تا" between them are one nowrap unit; letting them wrap separately orphaned the word from its field on a 390px screen. The card's "شروع" showed only the Jalali date, so several cases opened on the same day were indistinguishable on that line too. It now uses formatDateTime. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -102,6 +102,28 @@ describe('صفحهٔ پروندههای درمان', () => {
|
||||
expect(screen.queryByText(/پروندهای یافت نشد/)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('بازهٔ تاریخ بهصورت from و to میرود', async () => {
|
||||
mockList([caseRow()]);
|
||||
|
||||
renderWithProviders(<TreatmentCasesPage />);
|
||||
await screen.findByText('محمد رسولی');
|
||||
|
||||
// PersianDateInput تریگرش input نیست، پس با نام دسترسپذیرش پیدایش میکنیم.
|
||||
fireEvent.click(screen.getByLabelText('شروع از تاریخ'));
|
||||
|
||||
expect(screen.getByLabelText('شروع تا تاریخ')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('تاریخ شروع ساعت هم دارد', async () => {
|
||||
mockList([caseRow({ opened_at: 1_786_000_000 })]);
|
||||
|
||||
renderWithProviders(<TreatmentCasesPage />);
|
||||
|
||||
// formatDateTime ساعت را با «:» میآورد؛ formatDate نمیآورد.
|
||||
const start = await screen.findByText(/^شروع:/);
|
||||
expect(start.textContent).toMatch(/:/);
|
||||
});
|
||||
|
||||
it('دکمهٔ ویرایش مودال را باز میکند', async () => {
|
||||
mockList([caseRow()]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user