cleanup
This commit is contained in:
parent
f4de216946
commit
f6261bec1b
@ -31,83 +31,20 @@ private static function dtFormat(Carbon|CarbonImmutable|null $dt): ?string
|
||||
|
||||
public function dataTable(QueryBuilder $query): EloquentDataTable
|
||||
{
|
||||
$table = new EloquentDataTable($query);
|
||||
$data_table = new EloquentDataTable($query);
|
||||
$rawColumns = [
|
||||
'priority_icon',
|
||||
'report_status_led',
|
||||
];
|
||||
foreach ($this->customColumns() as $column => $content) {
|
||||
$table->editColumn($column, $content);
|
||||
$data_table->editColumn($column, $content);
|
||||
$rawColumns[] = $column;
|
||||
}
|
||||
$table
|
||||
->orderColumn('patient_name', 'patient_name $1')
|
||||
$data_table
|
||||
->orderColumn(WorklistColumn::PatientName->value, sprintf('%s $1', WorklistColumn::PatientName->value))
|
||||
->rawColumns($rawColumns)
|
||||
->setRowId('id');
|
||||
|
||||
return $table;
|
||||
|
||||
return (new EloquentDataTable($query))
|
||||
->addColumn('action', 'worklist.action')
|
||||
->editColumn('patient_name', fn (Study $study) => $study->sanitizedPatientName())
|
||||
->editColumn('study_description', fn (Study $study) => $study->sanitizedStudyDescription())
|
||||
->editColumn('reader', function (Study $study) {
|
||||
if ($study->readingPhysician == null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Blade::render('staff.worklist.partials._radiologist-listing',
|
||||
[
|
||||
'avatar_url' => $study->readingPhysician->avatar(),
|
||||
'name' => $study->readingPhysician->display_name,
|
||||
'time' => $study->read_at->diffForHumans(),
|
||||
]
|
||||
);
|
||||
})
|
||||
->editColumn('assigned_to', function (Study $study) {
|
||||
|
||||
if ($study->assignedPhysician == null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Blade::render('staff.worklist.partials._radiologist-listing',
|
||||
[
|
||||
'avatar_url' => $study->assignedPhysician->avatar(),
|
||||
'name' => $study->assignedPhysician->display_name,
|
||||
'time' => $study->assigned_at->diffForHumans(),
|
||||
]
|
||||
);
|
||||
})
|
||||
->editColumn('images', function (Study $study) {
|
||||
return $study->numInstances() . '<small class="text-muted ms-2 fw-lighter fs-xsmall">' . human_filesize($study->disk_size) . '</small>';
|
||||
})
|
||||
->editColumn('study_date', function (Study $study) {
|
||||
return self::dtFormat($study->study_date);
|
||||
})
|
||||
->editColumn('reported_at', function (Study $study) {
|
||||
return self::dtFormat($study->reported_at);
|
||||
})
|
||||
->editColumn('received_at', function (Study $study) {
|
||||
return self::dtFormat($study->received_at);
|
||||
})
|
||||
->editColumn('show_study', function (Study $study) {
|
||||
$btn = '<a href="#" data-id="' . _h($study->id) . '" class="btn btn-outline-facebook btn-xs showStudy"><i class="fa-light fa-circle-info me-1"></i>Show</a>';
|
||||
$btn .= '<a href="' . route('staff.history.edit', $study->hash) . '" class="edit btn btn-outline-primary btn-xs"><i class="fa-light fa-pen-to-square me-1"></i>Edit</a>';
|
||||
$btn .= ' <a href="#" data-id="' . _h($study->id) . '" class="btn btn-outline-youtube fw-light btn-xs show-assign"><i class="fa-light fa-user-doctor me-1"></i>Assign</a>';
|
||||
$btn .= ' <a href="#" data-id="' . _h($study->id) . '" class="btn btn-danger btn-xs deleteStudy">Delete</a>';
|
||||
|
||||
return $btn;
|
||||
})
|
||||
->editColumn('history', function (Study $study) {
|
||||
return sprintf('
|
||||
<a href="#" data-id="' . _h($study->id) . '" class="btn btn-sm btn-outline-light show-attach">
|
||||
<i class="fa-light fa-file-prescription %s"></i>
|
||||
</a>
|
||||
', blank($study->body_part_examined) ? 'text-muted' : 'text-primary');
|
||||
})
|
||||
->orderColumn('patient_name', 'patient_name $1')
|
||||
->rawColumns(['priority_icon', 'report_status_led', 'images', 'reader', 'assigned_to', 'history', 'show_study'])
|
||||
->setRowId('id');
|
||||
return $data_table;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -222,75 +159,6 @@ public function getColumns(): array
|
||||
}
|
||||
|
||||
return $columns;
|
||||
|
||||
return [
|
||||
Column::make('priority')->hidden(),
|
||||
Column::make('priority_icon')
|
||||
->searchable(false)
|
||||
->orderable(false)
|
||||
->addClass('text-center')
|
||||
->width('20px')
|
||||
->title(''),
|
||||
|
||||
Column::make('report_status_led')
|
||||
->searchable(false)
|
||||
->orderable(false)
|
||||
->addClass('text-center')
|
||||
->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'),
|
||||
Column::make('sex_age')
|
||||
->searchable(false)
|
||||
->orderable(false)
|
||||
->addClass('text-center')
|
||||
->title('Age'),
|
||||
|
||||
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('assigned_to')
|
||||
->searchable(false)
|
||||
->title('Assigned'),
|
||||
|
||||
Column::make('reader')
|
||||
->searchable(false)
|
||||
->title('Read by'),
|
||||
|
||||
Column::make('reported_at')->searchable(false)->title('Read At'),
|
||||
// Column::make('body_part_examined'),
|
||||
Column::make('images')
|
||||
->searchable(false)
|
||||
->orderable(false)
|
||||
->addClass('text-center')
|
||||
->title('Images'),
|
||||
Column::make('received_at')->searchable(false)->title('Received'),
|
||||
|
||||
// Column::make('xxx'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(60)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -404,12 +272,5 @@ private function generateButtons(Study $study): string
|
||||
}
|
||||
|
||||
return implode("\r", $btns);
|
||||
|
||||
$btn = '<a href="#" data-id="' . _h($study->id) . '" class="btn btn-outline-facebook btn-xs showStudy"><i class="fa-light fa-circle-info me-1"></i>Show</a>';
|
||||
$btn .= '<a href="' . route('staff.history.edit', $study->hash) . '" class="edit btn btn-outline-primary btn-xs"><i class="fa-light fa-pen-to-square me-1"></i>Edit</a>';
|
||||
$btn .= ' <a href="#" data-id="' . _h($study->id) . '" class="btn btn-outline-youtube fw-light btn-xs show-assign"><i class="fa-light fa-user-doctor me-1"></i>Assign</a>';
|
||||
$btn .= ' <a href="#" data-id="' . _h($study->id) . '" class="btn btn-danger btn-xs deleteStudy">Delete</a>';
|
||||
|
||||
return $btn;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user