This commit is contained in:
Dr Masroor Ehsan 2025-01-05 01:37:25 +06:00
parent 9b4bfb8c1e
commit 6b1ca032a9
4 changed files with 41 additions and 16 deletions

View File

@ -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('
<a href="#" class="btn btn-sm btn-outline-light" data-toggle="modal" data-target="#historyModal" data-study-id="#" data-url="#">
<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'])
->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'),

View File

@ -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',
};
// <i class="fa-solid fa-spinner"></i>
$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('<span class="badge badge-center rounded-pill %s"><i class="fa-light fa-battery-bolt"></i></span>', $color);
return sprintf('<span class="badge badge-center rounded-pill %s"><i class="fa-solid fa-%s"></i></span>', $color, $icon);
}
public function getArchiveLink(): ?string
@ -249,10 +257,14 @@ public function toArray(): array
public function getPriorityIcon(): string
{
$tpl = '<span class="badge badge-center rounded-pill bg-%s">
<i class="fa-solid text-white fa-%s"></i>
</span>';
return match ($this->priority) {
Priority::High => '<i class="fa-light fa-triangle-exclamation"></i>',
Priority::Urgent => '<i class="fa-light fa-bolt"></i>',
Priority::Low => '<i class="fa-thin fa-chevrons-down"></i>',
Priority::Urgent => sprintf($tpl, 'danger', 'light-emergency-on'),
Priority::High => sprintf($tpl, 'primary', 'bolt'),
Priority::Low => sprintf($tpl, 'light', 'chevrons-down'),
default => '',
};
}

View File

@ -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('<i class="fa-regular fa-file-prescription %s"></i>', blank($this->clinical_history) ? 'text-muted' : 'text-success');
}
}

View File

@ -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',