report workflow_level

This commit is contained in:
Dr Masroor Ehsan 2025-01-29 21:25:28 +06:00
parent d1d6f0d7af
commit 5292865bef

View File

@ -4,6 +4,7 @@
use App\Domain\Report\ExportFormat;
use App\Domain\Report\ReportStatus;
use App\Domain\Study\WorkflowLevel;
use App\Services\Report\ReportStorage;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Concerns\HasTimestamps;
@ -96,12 +97,12 @@ public function getContent(): ?string
public function eligibleForExport(): bool
{
return $this->report_status->value >= ReportStatus::Finalized->value;
return $this->workflow_level->value >= WorkflowLevel::Finalized->value;
}
public function canRemove(User|int|null $user = null): bool
{
if ($this->report_status->value < ReportStatus::Finalized->value) {
if ($this->workflow_level->value < WorkflowLevel::Finalized->value) {
if ($this->read_by_id === me($user)->id) {
return true;
}
@ -117,7 +118,7 @@ public function canRemove(User|int|null $user = null): bool
public function canEdit(User|int|null $user = null): bool
{
if ($this->report_status->value < ReportStatus::Finalized->value &&
if ($this->workflow_level->value < WorkflowLevel::Finalized->value &&
$this->study->canEditReport() &&
$this->read_by_id === me($user)->id) {
return true;
@ -128,7 +129,7 @@ public function canEdit(User|int|null $user = null): bool
public function isFinalized(): bool
{
return $this->report_status->value >= ReportStatus::Finalized->value;
return $this->workflow_level->value >= WorkflowLevel::Finalized->value;
}
/**