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'); $readTo = $this->request()->get('read_to');
$readBy = $this->request()->get('read_by'); $readBy = $this->request()->get('read_by');
$modality = $this->request()->get('modality'); $modality = $this->request()->get('modality');
$search = $this->request()->get('search', ['value' => null])['value'];
$dataTable->filter( $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->filterStatus($query, $status);
$this->filterDateRange($query, 'study_date', $studyFrom, $studyTo); $this->filterDateRange($query, 'study_date', $studyFrom, $studyTo);
$this->filterDateRange($query, 'received_at', $receiveFrom, $receiveTo); $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->filterDateRange($query, 'read_at', $readFrom, $readTo);
$this->filterModalities($query, $modality); $this->filterModalities($query, $modality);
$this->filterReadBy($query, $readBy); $this->filterReadBy($query, $readBy);
$this->filterSearchTerm($query, $search);
} }
); );
} }
@ -312,7 +314,11 @@ private function filterStatus(QueryBuilder $query, ?string $status): void
$query->whereNotNull('locked_at'); $query->whereNotNull('locked_at');
break; break;
case 'assigned': case 'assigned':
$query->whereNotNull('assigned_at'); // allow only assigned and locked studies
$query
->whereNotNull('assigned_at')
// ->whereNull('locked_at')
->whereNull('read_at');
break; break;
case 'orphan': case 'orphan':
$query->whereNull('assigned_at'); $query->whereNull('assigned_at');
@ -595,4 +601,20 @@ private function filterReadBy(QueryBuilder $query, ?int $readBy): void
$query->where('reading_physician_id', $readBy); $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; width: 18px !important;
height: 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> </style>
@endsection @endsection
@ -221,11 +231,16 @@ function formatDate(date) {
{{-- @include('staff.worklist.partials._stats') --}} {{-- @include('staff.worklist.partials._stats') --}}
@include('staff.worklist.partials._filter-panel', compact('modalities')) @include('staff.worklist.partials._filter-panel', compact('modalities'))
<div class="card">
<div class="card-header p-0 bg-light">
@include('staff.worklist.partials._nav-top') @include('staff.worklist.partials._nav-top')
</div>
<div class="card-body pt-2">
<div class="table-responsive text-nowrap"> <div class="table-responsive text-nowrap">
{{ $dataTable->table(['class' => 'table table-sm'], true) }} {{ $dataTable->table(['class' => 'table table-sm'], true) }}
</div> </div>
</div>
</div>
<div class="modal fade" id="study-modal" tabindex="-1" aria-labelledby="studyModalLabel" aria-hidden="true"> <div class="modal fade" id="study-modal" tabindex="-1" aria-labelledby="studyModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl"> <div class="modal-dialog modal-xl">

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 }}"> <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> <i class="me-2 fa-regular fa-{{ $icon ?? 'star' }}"></i>
{{ $text }} {{ $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"> <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-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']) @include('staff.worklist.partials._nav-item', ['id' => 'nav-progress', 'text' => 'Read in Progress', 'active' => '', 'icon' => 'pen-to-square'])