diff --git a/app/DataTables/WorklistDataTable.php b/app/DataTables/WorklistDataTable.php index ec279ed..761d819 100644 --- a/app/DataTables/WorklistDataTable.php +++ b/app/DataTables/WorklistDataTable.php @@ -281,9 +281,10 @@ private function applyFilters(QueryDataTable $dataTable) $readTo = $this->request()->get('read_to'); $readBy = $this->request()->get('read_by'); $modality = $this->request()->get('modality'); + $search = $this->request()->get('search', ['value' => null])['value']; $dataTable->filter( - function (QueryBuilder $query) use ($status, $studyFrom, $studyTo, $receiveFrom, $receiveTo, $modality, $assignFrom, $assignTo, $readFrom, $readTo, $readBy) { + function (QueryBuilder $query) use ($status, $studyFrom, $studyTo, $receiveFrom, $receiveTo, $modality, $assignFrom, $assignTo, $readFrom, $readTo, $readBy, $search) { $this->filterStatus($query, $status); $this->filterDateRange($query, 'study_date', $studyFrom, $studyTo); $this->filterDateRange($query, 'received_at', $receiveFrom, $receiveTo); @@ -291,6 +292,7 @@ function (QueryBuilder $query) use ($status, $studyFrom, $studyTo, $receiveFrom, $this->filterDateRange($query, 'read_at', $readFrom, $readTo); $this->filterModalities($query, $modality); $this->filterReadBy($query, $readBy); + $this->filterSearchTerm($query, $search); } ); } @@ -312,7 +314,11 @@ private function filterStatus(QueryBuilder $query, ?string $status): void $query->whereNotNull('locked_at'); break; case 'assigned': - $query->whereNotNull('assigned_at'); + // allow only assigned and locked studies + $query + ->whereNotNull('assigned_at') + // ->whereNull('locked_at') + ->whereNull('read_at'); break; case 'orphan': $query->whereNull('assigned_at'); @@ -595,4 +601,20 @@ private function filterReadBy(QueryBuilder $query, ?int $readBy): void $query->where('reading_physician_id', $readBy); } + + private function filterSearchTerm(QueryBuilder $query, ?string $search) + { + if (blank($search)) { + return; + } + $term = '%' . strtoupper(trim($search)) . '%'; + $query->where( + static function ($q) use ($term) { + $q + ->where('patient_name', 'ILIKE', $term) + ->orWhere('patient_id', 'ILIKE', $term) + ->orWhere('study_description', 'ILIKE', $term); + } + ); + } } diff --git a/resources/views/staff/worklist/index.blade.php b/resources/views/staff/worklist/index.blade.php index 8ba1f97..7be3768 100644 --- a/resources/views/staff/worklist/index.blade.php +++ b/resources/views/staff/worklist/index.blade.php @@ -46,6 +46,16 @@ width: 18px !important; height: 18px !important; } + + .nav-tabs .nav-link.active, .nav-tabs .nav-link.active:hover, .nav-tabs .nav-link.active:focus { + color: #efefef !important; + font-weight: bolder !important; + } + + .nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link { + background-color: #515a97 !important; + border-color: #cd0909 !important; + } @endsection @@ -176,7 +186,7 @@ function (givenDate) { } @endforeach - _modality = modalityArray.join(','); + _modality = modalityArray.join(','); _read_by = $('#read_by').val(); filterTable(); @@ -221,10 +231,15 @@ function formatDate(date) { {{-- @include('staff.worklist.partials._stats') --}} @include('staff.worklist.partials._filter-panel', compact('modalities')) - @include('staff.worklist.partials._nav-top') - -