WIP #10 search

This commit is contained in:
Dr Masroor Ehsan 2025-01-21 01:12:39 +06:00
parent 040b2fba55
commit 80fb2c32a9
4 changed files with 46 additions and 9 deletions

View File

@ -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);
}
);
}
}

View File

@ -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;
}
</style>
@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')
<div class="table-responsive text-nowrap">
{{ $dataTable->table(['class' => 'table table-sm'], true) }}
<div class="card">
<div class="card-header p-0 bg-light">
@include('staff.worklist.partials._nav-top')
</div>
<div class="card-body pt-2">
<div class="table-responsive text-nowrap">
{{ $dataTable->table(['class' => 'table table-sm'], true) }}
</div>
</div>
</div>
<div class="modal fade" id="study-modal" tabindex="-1" aria-labelledby="studyModalLabel" aria-hidden="true">

View File

@ -1,4 +1,4 @@
<li class="nav-item">
<li class="nav-item" role="presentation">
<a href="#" type="button" class="nav-link {{ $active }}" role="tab" data-bs-toggle="tab" id="{{ $id }}">
<i class="me-2 fa-regular fa-{{ $icon ?? 'star' }}"></i>
{{ $text }}

View File

@ -1,4 +1,4 @@
<div class="nav-align-top">
<div class="nav-align-top ms-4">
<ul class="nav nav-tabs" role="tablist">
@include('staff.worklist.partials._nav-item', ['id' => 'nav-unread', 'text' => 'Pending', 'active' => 'active', 'icon' => 'hourglass'])
@include('staff.worklist.partials._nav-item', ['id' => 'nav-progress', 'text' => 'Read in Progress', 'active' => '', 'icon' => 'pen-to-square'])