report workflow_level
This commit is contained in:
parent
d1d6f0d7af
commit
5292865bef
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use App\Domain\Report\ExportFormat;
|
use App\Domain\Report\ExportFormat;
|
||||||
use App\Domain\Report\ReportStatus;
|
use App\Domain\Report\ReportStatus;
|
||||||
|
use App\Domain\Study\WorkflowLevel;
|
||||||
use App\Services\Report\ReportStorage;
|
use App\Services\Report\ReportStorage;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Concerns\HasTimestamps;
|
use Illuminate\Database\Eloquent\Concerns\HasTimestamps;
|
||||||
@ -96,12 +97,12 @@ public function getContent(): ?string
|
|||||||
|
|
||||||
public function eligibleForExport(): bool
|
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
|
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) {
|
if ($this->read_by_id === me($user)->id) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -117,7 +118,7 @@ public function canRemove(User|int|null $user = null): bool
|
|||||||
|
|
||||||
public function canEdit(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->study->canEditReport() &&
|
||||||
$this->read_by_id === me($user)->id) {
|
$this->read_by_id === me($user)->id) {
|
||||||
return true;
|
return true;
|
||||||
@ -128,7 +129,7 @@ public function canEdit(User|int|null $user = null): bool
|
|||||||
|
|
||||||
public function isFinalized(): bool
|
public function isFinalized(): bool
|
||||||
{
|
{
|
||||||
return $this->report_status->value >= ReportStatus::Finalized->value;
|
return $this->workflow_level->value >= WorkflowLevel::Finalized->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user