workflow_level

This commit is contained in:
Dr Masroor Ehsan 2025-01-29 21:24:45 +06:00
parent 3f2a38faa6
commit d1d6f0d7af

View File

@ -177,20 +177,21 @@ public function isArchived(): bool
public function getReportStatusLedAttribute(): string public function getReportStatusLedAttribute(): string
{ {
$color = match ($this->report_status) { // todo: implement
ReportStatus::Unread => 'bg-white', $color = match ($this->workflow_level) {
WorkflowLevel::Unassigned => 'bg-white',
// ReportStatus::Opened => 'bg-secondary', // ReportStatus::Opened => 'bg-secondary',
ReportStatus::Preliminary => 'bg-info', WorkflowLevel::DraftAvailable => 'bg-info',
ReportStatus::Finalized => 'bg-primary', WorkflowLevel::Finalized => 'bg-primary',
ReportStatus::Approved => 'bg-success', WorkflowLevel::Published => 'bg-success',
default => 'bg-light', default => 'bg-light',
}; };
// <i class="fa-solid fa-spinner"></i> // <i class="fa-solid fa-spinner"></i>
$icon = match ($this->report_status) { $icon = match ($this->workflow_level) {
ReportStatus::Unread => 'spinner text-muted', WorkflowLevel::Unassigned => 'spinner text-muted',
ReportStatus::Preliminary => 'pen-to-square', WorkflowLevel::DraftAvailable => 'pen-to-square',
ReportStatus::Finalized => 'badge-check', WorkflowLevel::Finalized => 'badge-check',
ReportStatus::Approved => 'shield-check', WorkflowLevel::Published => 'shield-check',
default => 'spinner text-muted', default => 'spinner text-muted',
}; };
@ -483,18 +484,18 @@ public function setReportStatus(ReportStatus $status, User|int|null $user = null
public function canEditReport(): bool public function canEditReport(): bool
{ {
// todo: check if the study disallows reporting // 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 public function canEditMetadata(): bool
{ {
return $this->isActive() && $this->reportStatusBefore(ReportStatus::Finalized); return $this->isActive() && $this->reportStatusBefore(WorkflowLevel::Finalized);
} }
public function canAssignRad(): bool public function canAssignRad(): bool
@ -503,7 +504,7 @@ public function canAssignRad(): bool
return false; return false;
} }
return $this->isActive() && $this->reportStatusBefore(ReportStatus::Preliminary); return $this->isActive() && $this->reportStatusBefore(WorkflowLevel::DraftAvailable);
} }
public function hasReports(): bool public function hasReports(): bool
@ -513,13 +514,13 @@ public function hasReports(): bool
public function isReportReady(): bool public function isReportReady(): bool
{ {
return ($this->report_status->value == ReportStatus::Finalized->value) || return ($this->workflow_level->value == WorkflowLevel::Finalized->value) ||
($this->report_status->value == ReportStatus::Approved->value); ($this->workflow_level->value == WorkflowLevel::Published->value);
} }
public function isStudyComplete(): bool public function isStudyComplete(): bool
{ {
return $this->report_status->value >= ReportStatus::Finalized->value; return $this->workflow_level->value >= WorkflowLevel::Finalized->value;
} }
public function bookmarkedByUsers() public function bookmarkedByUsers()