diff --git a/app/DataTables/WorklistDataTable.php b/app/DataTables/WorklistDataTable.php index 62e0c87..1c2ba6f 100644 --- a/app/DataTables/WorklistDataTable.php +++ b/app/DataTables/WorklistDataTable.php @@ -279,6 +279,13 @@ private function renderCustomColumns(): array private function generateReportingButtons(Study $study): string { + if (me()->isRadiologist()) { + if (! $study->hasReports() && $study->canEditReport()) { + // fresh untouched study, can edit report: take the rad directly to the edit page + return ''; + } + } + return $this->renderButton($study->hash, 'fa-eye', 'show-reports btn-outline', 'R'); } diff --git a/app/Models/Study.php b/app/Models/Study.php index 6db6545..ce8da6c 100644 --- a/app/Models/Study.php +++ b/app/Models/Study.php @@ -413,6 +413,11 @@ public function canEditReport(): bool $this->report_status <= ReportStatus::Finalized; } + public function hasReports(): bool + { + return $this->reports->isNotEmpty(); + } + protected function casts(): array { return [