workflow_level

This commit is contained in:
Dr Masroor Ehsan 2025-01-29 21:26:37 +06:00
parent 5292865bef
commit bdf1ad1ca3
2 changed files with 7 additions and 7 deletions

View File

@ -3,7 +3,7 @@
namespace App\Services\Workflow;
use App\Domain\ACL\Permission;
use App\Domain\Report\ReportStatus;
use App\Domain\Study\WorkflowLevel;
use App\Models\Study;
use App\Models\User;
use Closure;
@ -42,28 +42,28 @@ public function can(Permission $permission): bool
public function canAssignPhysician(): bool
{
return $this->activeStudy(fn () => $this->study->report_status <= ReportStatus::Preliminary);
return $this->activeStudy(fn () => $this->study->workflow_level <= WorkflowLevel::DraftAvailable);
}
public function canStudyHistoryEdit(): bool
{
return $this->activeStudy(fn () => $this->study->report_status <= ReportStatus::Preliminary);
return $this->activeStudy(fn () => $this->study->workflow_level <= WorkflowLevel::DraftAvailable);
}
public function canAttachmentUpload(): bool
{
return $this->activeStudy(fn () => $this->study->report_status <= ReportStatus::Preliminary);
return $this->activeStudy(fn () => $this->study->workflow_level <= WorkflowLevel::DraftAvailable);
}
public function canReportDownload(): bool
{
return $this->activeStudy(fn () => $this->study->report_status >= ReportStatus::Finalized);
return $this->activeStudy(fn () => $this->study->workflow_level >= WorkflowLevel::Finalized);
}
public function canReportEdit(): bool
{
return $this->activeStudy(fn () => $this->study->isUnlocked() &&
$this->study->report_status <= ReportStatus::Preliminary &&
$this->study->workflow_level <= WorkflowLevel::DraftAvailable &&
$this->study->isAssignedTo($this->user)
);
}

View File

@ -4,7 +4,7 @@
<td class="bg-gray-100">{{ $report->created_at }}</td>
<td>
<a target="_blank" href="{{ $report->viewUrl() }}">
{{ $report->report_status->name }}
{{ $report->workflow_level->name }}
<i class="fa-regular fa-square-arrow-up-right ms-1"></i>
</a>
</td>