diff --git a/app/Models/Study.php b/app/Models/Study.php index 6b45321..267eec1 100644 --- a/app/Models/Study.php +++ b/app/Models/Study.php @@ -177,20 +177,21 @@ public function isArchived(): bool public function getReportStatusLedAttribute(): string { - $color = match ($this->report_status) { - ReportStatus::Unread => 'bg-white', + // todo: implement + $color = match ($this->workflow_level) { + WorkflowLevel::Unassigned => 'bg-white', // ReportStatus::Opened => 'bg-secondary', - ReportStatus::Preliminary => 'bg-info', - ReportStatus::Finalized => 'bg-primary', - ReportStatus::Approved => 'bg-success', + WorkflowLevel::DraftAvailable => 'bg-info', + WorkflowLevel::Finalized => 'bg-primary', + WorkflowLevel::Published => 'bg-success', default => 'bg-light', }; // - $icon = match ($this->report_status) { - ReportStatus::Unread => 'spinner text-muted', - ReportStatus::Preliminary => 'pen-to-square', - ReportStatus::Finalized => 'badge-check', - ReportStatus::Approved => 'shield-check', + $icon = match ($this->workflow_level) { + WorkflowLevel::Unassigned => 'spinner text-muted', + WorkflowLevel::DraftAvailable => 'pen-to-square', + WorkflowLevel::Finalized => 'badge-check', + WorkflowLevel::Published => 'shield-check', default => 'spinner text-muted', }; @@ -483,18 +484,18 @@ public function setReportStatus(ReportStatus $status, User|int|null $user = null public function canEditReport(): bool { // todo: check if the study disallows reporting - return $this->isActive() && $this->reportStatusBefore(ReportStatus::Finalized); + return $this->isActive() && $this->reportStatusBefore(WorkflowLevel::Finalized); } - public function reportStatusBefore(ReportStatus $checkpoint): bool + public function reportStatusBefore(WorkflowLevel $checkpoint): bool { - return $this->report_status->value < $checkpoint->value; + return $this->workflow_level->value < $checkpoint->value; } public function canEditMetadata(): bool { - return $this->isActive() && $this->reportStatusBefore(ReportStatus::Finalized); + return $this->isActive() && $this->reportStatusBefore(WorkflowLevel::Finalized); } public function canAssignRad(): bool @@ -503,7 +504,7 @@ public function canAssignRad(): bool return false; } - return $this->isActive() && $this->reportStatusBefore(ReportStatus::Preliminary); + return $this->isActive() && $this->reportStatusBefore(WorkflowLevel::DraftAvailable); } public function hasReports(): bool @@ -513,13 +514,13 @@ public function hasReports(): bool public function isReportReady(): bool { - return ($this->report_status->value == ReportStatus::Finalized->value) || - ($this->report_status->value == ReportStatus::Approved->value); + return ($this->workflow_level->value == WorkflowLevel::Finalized->value) || + ($this->workflow_level->value == WorkflowLevel::Published->value); } public function isStudyComplete(): bool { - return $this->report_status->value >= ReportStatus::Finalized->value; + return $this->workflow_level->value >= WorkflowLevel::Finalized->value; } public function bookmarkedByUsers()