wip
This commit is contained in:
parent
9a3ffebee9
commit
42524c66f4
@ -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 = '<a href="#" data-id="'.$study->id.'" data-original-title="Show" class="btn btn-info btn-sm showStudy">Show</a>';
|
||||
$btn .= ' <a href="#" data-id="'.$study->id.'" data-original-title="Edit" class="edit btn btn-primary btn-sm editProduct">Edit</a>';
|
||||
$btn .= ' <a href="#" data-id="'.$study->id.'" data-original-title="Delete" class="btn btn-danger btn-sm deleteProduct">Delete</a>';
|
||||
|
||||
return $btn;
|
||||
})
|
||||
->editColumn('history', function (Study $study) {
|
||||
return sprintf('
|
||||
<a href="#" class="btn btn-sm btn-outline-light" data-toggle="modal" data-target="#historyModal" data-study-id="#" data-url="#">
|
||||
@ -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)
|
||||
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
3
resources/views/datatables/action-button.blade.php
Normal file
3
resources/views/datatables/action-button.blade.php
Normal file
@ -0,0 +1,3 @@
|
||||
<a class="btn btn-sm btn-outline-light" href="{{ $url }}">
|
||||
{!! $slot !!}
|
||||
</a>
|
7
resources/views/staff/studies/show-details.blade.php
Normal file
7
resources/views/staff/studies/show-details.blade.php
Normal file
@ -0,0 +1,7 @@
|
||||
<div>
|
||||
<h4>Study ID: {{ $study->id }}</h4>
|
||||
<p>Patient Name: {{ $study->patient_name }}</p>
|
||||
<p>Study Description: {{ $study->study_description }}</p>
|
||||
<p>Study Date: {{ $study->study_date }}</p>
|
||||
<!-- Add more study details as needed -->
|
||||
</div>
|
7
resources/views/staff/worklist/study-details.blade.php
Normal file
7
resources/views/staff/worklist/study-details.blade.php
Normal file
@ -0,0 +1,7 @@
|
||||
<div>
|
||||
<h4>Study ID: {{ $study->id }}</h4>
|
||||
<p>Patient Name: {{ $study->patient_name }}</p>
|
||||
<p>Study Description: {{ $study->study_description }}</p>
|
||||
<p>Study Date: {{ $study->study_date }}</p>
|
||||
<!-- Add more study details as needed -->
|
||||
</div>
|
@ -35,8 +35,49 @@
|
||||
@section('page-script')
|
||||
{{ $dataTable->scripts(attributes: ['type' => 'module']) }}
|
||||
<script>
|
||||
/*
|
||||
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
||||
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
|
||||
*/
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.querySelectorAll('.showStudy').forEach(function (button) {
|
||||
button.addEventListener('click', function () {
|
||||
console.log('Clicked on study:', this.getAttribute('data-id'));
|
||||
var studyId = this.getAttribute('data-id');
|
||||
fetch(`{{ route('staff.studies.show') }}?id=${studyId}`, {
|
||||
mode: 'cors',
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
})
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
document.getElementById('studyDetails').innerHTML = data;
|
||||
var studyModal = new bootstrap.Modal(document.getElementById('studyModal'));
|
||||
studyModal.show();
|
||||
})
|
||||
.catch(error => console.error('Error fetching study details:', error));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
$(document).ready(function () {
|
||||
$('body').on('click', '.showStudy', function () {
|
||||
var study_id = $(this).data('id');
|
||||
$.get("{{ route('staff.studies.show') }}", { id: study_id }, function (data) {
|
||||
$('#studyDetails').html(data);
|
||||
$('#studyModal').modal('show');
|
||||
});
|
||||
});
|
||||
});
|
||||
*/
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@ -44,4 +85,56 @@
|
||||
<div class="table-responsive text-nowrap">
|
||||
{{ $dataTable->table(['class' => 'table table-sm'], true) }}
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="studyModal" tabindex="-1" aria-labelledby="studyModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="studyModalLabel">Study Details</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- Study details will be loaded here -->
|
||||
<div id="studyDetails"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="ajaxModel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="modelHeading"></h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<form id="productForm" name="productForm" class="form-horizontal">
|
||||
<input type="hidden" name="product_id" id="product_id">
|
||||
<div class="form-group">
|
||||
<label for="name" class="col-sm-2 control-label">Name</label>
|
||||
<div class="col-sm-12">
|
||||
<input type="text" class="form-control" id="name" name="name" placeholder="Enter Name" value="" maxlength="50" required="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">Details</label>
|
||||
<div class="col-sm-12">
|
||||
<textarea id="detail" name="detail" required="" placeholder="Enter Details" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button type="submit" class="btn btn-primary" id="saveBtn" value="create">Save changes
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
@ -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 () {
|
||||
|
Loading…
Reference in New Issue
Block a user