From 6b1ca032a927657d707f104b45870379a0e370c9 Mon Sep 17 00:00:00 2001 From: Dr Masroor Ehsan Date: Sun, 5 Jan 2025 01:37:25 +0600 Subject: [PATCH] wip --- app/DataTables/WorklistDataTable.php | 22 ++++++++++----- app/Models/Study.php | 28 +++++++++++++------ app/Models/StudyDetails.php | 5 ++++ .../views/staff/worklist/table.blade.php | 2 +- 4 files changed, 41 insertions(+), 16 deletions(-) diff --git a/app/DataTables/WorklistDataTable.php b/app/DataTables/WorklistDataTable.php index 4b06276..1724cff 100644 --- a/app/DataTables/WorklistDataTable.php +++ b/app/DataTables/WorklistDataTable.php @@ -16,12 +16,6 @@ class WorklistDataTable extends DataTable { - /** - * Build the DataTable class. - * - * @param QueryBuilder $query Results from query() method. - */ - // const DATE_FORMAT = 'DD.MM.YYYY HH:mm'; const DATE_FORMAT = 'DD.MM.YYYY HH:mm'; private static function dtFormat(Carbon|CarbonImmutable|null $dt): string @@ -54,8 +48,15 @@ public function dataTable(QueryBuilder $query): EloquentDataTable ->editColumn('received_at', function (Study $study) { return self::dtFormat($study->received_at); }) + ->editColumn('history', function (Study $study) { + return sprintf(' + + + +', blank($study->body_part_examined) ? 'text-muted' : 'text-primary'); + }) ->orderColumn('patient_name', 'patient_name $1') - ->rawColumns(['priority_icon', 'report_status_led', 'images', 'reader']) + ->rawColumns(['priority_icon', 'report_status_led', 'images', 'reader', 'history']) ->setRowId('id'); } @@ -122,6 +123,13 @@ public function getColumns(): array ->width('20px') ->title(''), + Column::make('history') + ->searchable(false) + ->orderable(false) + ->addClass('text-center') + ->width('20px') + ->title(''), + Column::make('modality')->title('Mo'), Column::make('patient_id')->title('MRN'), Column::make('patient_name')->title('Patient'), diff --git a/app/Models/Study.php b/app/Models/Study.php index ecf0dc1..aee2f78 100644 --- a/app/Models/Study.php +++ b/app/Models/Study.php @@ -121,15 +121,23 @@ public function readingPhysician(): BelongsTo public function getReportStatusLedAttribute(): string { $color = match ($this->report_status) { - ReportStatus::Pending => 'bg-dark', - ReportStatus::Opened => 'bg-warning', - ReportStatus::Draft => 'bg-warning', - ReportStatus::Finalized => 'bg-success', + ReportStatus::Pending => 'bg-white', + ReportStatus::Opened => 'bg-secondary', + ReportStatus::Draft => 'bg-info', + ReportStatus::Finalized => 'bg-primary', ReportStatus::Authorized => 'bg-success', default => 'bg-light', }; + // + $icon = match ($this->report_status) { + ReportStatus::Pending => 'spinner text-muted', + ReportStatus::Draft => 'pen-to-square', + ReportStatus::Finalized => 'badge-check', + ReportStatus::Authorized => 'shield-check', + default => 'spinner text-muted', + }; - return sprintf('', $color); + return sprintf('', $color, $icon); } public function getArchiveLink(): ?string @@ -249,10 +257,14 @@ public function toArray(): array public function getPriorityIcon(): string { + $tpl = ' + + '; + return match ($this->priority) { - Priority::High => '', - Priority::Urgent => '', - Priority::Low => '', + Priority::Urgent => sprintf($tpl, 'danger', 'light-emergency-on'), + Priority::High => sprintf($tpl, 'primary', 'bolt'), + Priority::Low => sprintf($tpl, 'light', 'chevrons-down'), default => '', }; } diff --git a/app/Models/StudyDetails.php b/app/Models/StudyDetails.php index e398173..3060351 100644 --- a/app/Models/StudyDetails.php +++ b/app/Models/StudyDetails.php @@ -37,4 +37,9 @@ public static function seriesOnly(int $studyId): self { return self::where('study_id', $studyId)->select(['id', 'study_id', 'series'])->firstOrFail(); } + + public function historyIcon(): string + { + return sprintf('', blank($this->clinical_history) ? 'text-muted' : 'text-success'); + } } diff --git a/resources/views/staff/worklist/table.blade.php b/resources/views/staff/worklist/table.blade.php index f27faef..0cfbd7a 100644 --- a/resources/views/staff/worklist/table.blade.php +++ b/resources/views/staff/worklist/table.blade.php @@ -17,8 +17,8 @@ @section('vendor-style') @vite([ 'resources/fontawesome/scss/fontawesome.scss', + 'resources/fontawesome/scss/solid.scss', 'resources/fontawesome/scss/light.scss', - 'resources/fontawesome/scss/thin.scss', 'resources/assets/vendor/libs/datatables-bs5/datatables.bootstrap5.scss', 'resources/assets/vendor/libs/datatables-responsive-bs5/responsive.bootstrap5.scss', 'resources/assets/vendor/libs/datatables-checkboxes-jquery/datatables.checkboxes.scss',