This commit is contained in:
Dr Masroor Ehsan 2025-01-14 12:43:01 +06:00
parent 2a38df9383
commit 302b02e025
2 changed files with 12 additions and 5 deletions

View File

@ -26,11 +26,7 @@ public function edit()
$this->decodeKeys();
$study = Study::findOrFail($this->key);
if (in_array($study->report_status->value, [
ReportStatus::Finalized->value,
ReportStatus::Approved->value,
],
true)) {
if ($study->isReportReady()) {
return view('content.pages.notice', [
'title' => 'Study Locked',
'color' => 'danger',

View File

@ -450,6 +450,17 @@ public function hasReports(): bool
return $this->reports->isNotEmpty();
}
public function isReportReady(): bool
{
return ($this->report_status->value == ReportStatus::Finalized->value) ||
($this->report_status->value == ReportStatus::Approved->value);
}
public function isStudyComplete(): bool
{
return $this->report_status->value >= ReportStatus::Finalized->value;
}
protected function casts(): array
{
return [