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:
@@ -218,4 +218,27 @@ class TreatmentCaseEditTest extends ApiTestCase
|
||||
|
||||
self::assertSame($case->getId(), $this->cases()->findForTenant($type, $id, null, $name)[0]->getId());
|
||||
}
|
||||
|
||||
/** فیلتر بازه روی تاریخِ باز شدن پرونده است، نه سررسید جلسه. */
|
||||
public function testDateRangeFiltersByOpenedAt(): void
|
||||
{
|
||||
[$case, $clinic] = $this->scenario('بازه ' . uniqid());
|
||||
|
||||
$type = 'clinic';
|
||||
$id = (int) $clinic->getId();
|
||||
$openedAt = $case->getOpenedAt();
|
||||
|
||||
// بازهای که همان لحظه را در بر میگیرد
|
||||
self::assertCount(1, $this->cases()->findForTenant($type, $id, null, null, $openedAt - 60, $openedAt + 60));
|
||||
|
||||
// کرانِ پایین بعد از پرونده
|
||||
self::assertSame([], $this->cases()->findForTenant($type, $id, null, null, $openedAt + 60, null));
|
||||
|
||||
// کرانِ بالا قبل از پرونده
|
||||
self::assertSame([], $this->cases()->findForTenant($type, $id, null, null, null, $openedAt - 60));
|
||||
|
||||
// یکطرفه هم باید کار کند
|
||||
self::assertCount(1, $this->cases()->findForTenant($type, $id, null, null, $openedAt - 60, null));
|
||||
self::assertCount(1, $this->cases()->findForTenant($type, $id, null, null, null, $openedAt + 60));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user