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:
@@ -49,6 +49,8 @@ class TreatmentCaseRepository extends ServiceEntityRepository
|
||||
int $entityId,
|
||||
?string $status = null,
|
||||
?string $q = null,
|
||||
?int $openedFrom = null,
|
||||
?int $openedTo = null,
|
||||
): array {
|
||||
$qb = $this->createQueryBuilder('c')
|
||||
->where('c.entityType = :type')
|
||||
@@ -61,6 +63,16 @@ class TreatmentCaseRepository extends ServiceEntityRepository
|
||||
$qb->andWhere('c.status = :status')->setParameter('status', $status);
|
||||
}
|
||||
|
||||
// بازه روی تاریخِ باز شدن پرونده است، نه سررسید جلسه: سؤالِ این فهرست
|
||||
// «چه پروندههایی در این بازه شروع شدند» است.
|
||||
if ($openedFrom !== null) {
|
||||
$qb->andWhere('c.openedAt >= :from')->setParameter('from', $openedFrom);
|
||||
}
|
||||
|
||||
if ($openedTo !== null) {
|
||||
$qb->andWhere('c.openedAt <= :to')->setParameter('to', $openedTo);
|
||||
}
|
||||
|
||||
if ($q !== null && $q !== '') {
|
||||
$qb->join('c.patientRecord', 'pr')
|
||||
->join('pr.user', 'u')
|
||||
|
||||
Reference in New Issue
Block a user