From 42524c66f4fada3ae78352926bcccf97d1b51b42 Mon Sep 17 00:00:00 2001 From: Dr Masroor Ehsan Date: Sun, 5 Jan 2025 11:58:31 +0600 Subject: [PATCH] wip --- app/DataTables/WorklistDataTable.php | 25 +++-- .../Controllers/Staff/StudiesController.php | 15 ++- .../Controllers/Staff/WorklistController.php | 8 -- .../views/datatables/action-button.blade.php | 3 + .../staff/studies/show-details.blade.php | 7 ++ .../staff/worklist/study-details.blade.php | 7 ++ .../views/staff/worklist/table.blade.php | 93 +++++++++++++++++++ routes/web.php | 7 +- 8 files changed, 142 insertions(+), 23 deletions(-) create mode 100644 resources/views/datatables/action-button.blade.php create mode 100644 resources/views/staff/studies/show-details.blade.php create mode 100644 resources/views/staff/worklist/study-details.blade.php diff --git a/app/DataTables/WorklistDataTable.php b/app/DataTables/WorklistDataTable.php index 1724cff..a8f3a70 100644 --- a/app/DataTables/WorklistDataTable.php +++ b/app/DataTables/WorklistDataTable.php @@ -16,11 +16,11 @@ class WorklistDataTable extends DataTable { - const DATE_FORMAT = 'DD.MM.YYYY HH:mm'; + const DATE_FORMAT = 'd.m.Y H:i'; - private static function dtFormat(Carbon|CarbonImmutable|null $dt): string + private static function dtFormat(Carbon|CarbonImmutable|null $dt): ?string { - return $dt == null ? '' : $dt->isoFormat(self::DATE_FORMAT); + return $dt?->format(self::DATE_FORMAT); } public function dataTable(QueryBuilder $query): EloquentDataTable @@ -48,6 +48,13 @@ public function dataTable(QueryBuilder $query): EloquentDataTable ->editColumn('received_at', function (Study $study) { return self::dtFormat($study->received_at); }) + ->editColumn('show_study', function (Study $study) { + $btn = 'Show'; + $btn .= ' Edit'; + $btn .= ' Delete'; + + return $btn; + }) ->editColumn('history', function (Study $study) { return sprintf(' @@ -56,7 +63,7 @@ public function dataTable(QueryBuilder $query): EloquentDataTable ', blank($study->body_part_examined) ? 'text-muted' : 'text-primary'); }) ->orderColumn('patient_name', 'patient_name $1') - ->rawColumns(['priority_icon', 'report_status_led', 'images', 'reader', 'history']) + ->rawColumns(['priority_icon', 'report_status_led', 'images', 'reader', 'history', 'show_study']) ->setRowId('id'); } @@ -97,8 +104,8 @@ public function html(): HtmlBuilder [8, 'desc'], ], ]) - ->selectStyleSingle() - ->pageLength(25) + // ->selectStyleSingle() + ->pageLength(15) ->lengthMenu([15, 25, 50, 100, 250]); } @@ -142,6 +149,12 @@ public function getColumns(): array Column::make('study_description') ->title('Study'), + Column::make('show_study')->searchable(false) + ->orderable(false) + ->addClass('text-center') + ->width('20px') + ->title(''), + Column::make('study_date')->searchable(false)->title('Scan Dt'), Column::make('reader') ->searchable(false) diff --git a/app/Http/Controllers/Staff/StudiesController.php b/app/Http/Controllers/Staff/StudiesController.php index 03f1255..7ba121e 100644 --- a/app/Http/Controllers/Staff/StudiesController.php +++ b/app/Http/Controllers/Staff/StudiesController.php @@ -2,20 +2,12 @@ namespace App\Http\Controllers\Staff; -use App\DAL\Studies\WorklistFactory; use App\Http\Controllers\HashidControllerBase; use App\Models\Study; use App\Services\AuditTrail\Activity; class StudiesController extends HashidControllerBase { - public function index() - { - $studies = WorklistFactory::getLister()->get(); - - return view('staff.studies.index', compact('studies')); - } - public function details() { $this->decodeKeys(); @@ -28,4 +20,11 @@ public function details() // return view('staff.studies.details', compact('study')); return response()->json($study); } + + public function show(Request $request) + { + $study = Study::with(['details'])->findOrFail($request->id); + + return view('staff.studies.show-details', compact('study')); + } } diff --git a/app/Http/Controllers/Staff/WorklistController.php b/app/Http/Controllers/Staff/WorklistController.php index 0bbecfe..2000f13 100644 --- a/app/Http/Controllers/Staff/WorklistController.php +++ b/app/Http/Controllers/Staff/WorklistController.php @@ -2,7 +2,6 @@ namespace App\Http\Controllers\Staff; -use App\DAL\Studies\WorklistFactory; use App\DataTables\WorklistDataTable; use App\Http\Controllers\HashidControllerBase; @@ -12,11 +11,4 @@ public function index(WorklistDataTable $dataTable) { return $dataTable->render('staff.worklist.table'); } - - public function details($hashid) - { - $study = WorklistFactory::getViewer($hashid)->get(); - - return view('staff.worklist.details', compact('study')); - } } diff --git a/resources/views/datatables/action-button.blade.php b/resources/views/datatables/action-button.blade.php new file mode 100644 index 0000000..79e08e3 --- /dev/null +++ b/resources/views/datatables/action-button.blade.php @@ -0,0 +1,3 @@ + + {!! $slot !!} + diff --git a/resources/views/staff/studies/show-details.blade.php b/resources/views/staff/studies/show-details.blade.php new file mode 100644 index 0000000..3452428 --- /dev/null +++ b/resources/views/staff/studies/show-details.blade.php @@ -0,0 +1,7 @@ +
+

Study ID: {{ $study->id }}

+

Patient Name: {{ $study->patient_name }}

+

Study Description: {{ $study->study_description }}

+

Study Date: {{ $study->study_date }}

+ +
diff --git a/resources/views/staff/worklist/study-details.blade.php b/resources/views/staff/worklist/study-details.blade.php new file mode 100644 index 0000000..3452428 --- /dev/null +++ b/resources/views/staff/worklist/study-details.blade.php @@ -0,0 +1,7 @@ +
+

Study ID: {{ $study->id }}

+

Patient Name: {{ $study->patient_name }}

+

Study Description: {{ $study->study_description }}

+

Study Date: {{ $study->study_date }}

+ +
diff --git a/resources/views/staff/worklist/table.blade.php b/resources/views/staff/worklist/table.blade.php index 0cfbd7a..4eabd4e 100644 --- a/resources/views/staff/worklist/table.blade.php +++ b/resources/views/staff/worklist/table.blade.php @@ -35,8 +35,49 @@ @section('page-script') {{ $dataTable->scripts(attributes: ['type' => 'module']) }} + + @endsection @@ -44,4 +85,56 @@
{{ $dataTable->table(['class' => 'table table-sm'], true) }}
+ + + + + @endsection diff --git a/routes/web.php b/routes/web.php index 9655f6f..f187172 100644 --- a/routes/web.php +++ b/routes/web.php @@ -4,6 +4,7 @@ use App\Http\Controllers\Guest\ViewSharedStudyController; use App\Http\Controllers\Radiologist\ReportWriteController; use App\Http\Controllers\SocialLoginController; +use App\Http\Controllers\Staff\StudiesController; use App\Http\Controllers\Staff\StudyHistoryController; use App\Http\Controllers\Staff\StudyViewerController; use App\Http\Controllers\Staff\WorklistController; @@ -47,7 +48,11 @@ Route::group(['prefix' => 'worklist', 'as' => 'worklist.'], function () { Route::get('/', [WorklistController::class, 'index'])->name('index'); - Route::get('{hashid}/details', [WorklistController::class, 'details'])->name('details'); + // Route::get('{hashid}/edit', [WorklistController::class, 'edit'])->name('edit'); + }); + + Route::group(['prefix' => 'studies', 'as' => 'studies.'], function () { + Route::get('show', [StudiesController::class, 'show'])->name('show'); }); Route::group(['prefix' => 'history', 'as' => 'history.'], function () {