minor refactor
This commit is contained in:
parent
82e8b8d018
commit
ca739d4a85
@ -15,4 +15,14 @@ protected function getStudy(): Study
|
||||
|
||||
return $this->study;
|
||||
}
|
||||
|
||||
protected function lockedNotice()
|
||||
{
|
||||
return view('content.pages.notice', [
|
||||
'title' => 'Study Locked',
|
||||
'color' => 'danger',
|
||||
'heading' => 'Study Locked',
|
||||
'message' => 'Study metadata cannot be edited once the report has been finalized.',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -23,14 +23,8 @@ public function edit()
|
||||
{
|
||||
abort_unless(auth()->user()->may(Permission::StudyMetadataEdit), 403);
|
||||
$study = $this->getStudy();
|
||||
|
||||
if ($study->isReportReady()) {
|
||||
return view('content.pages.notice', [
|
||||
'title' => 'Study Locked',
|
||||
'color' => 'danger',
|
||||
'heading' => 'Study Locked',
|
||||
'message' => 'Study metadata cannot be edited once the report has been finalized.',
|
||||
]);
|
||||
return $this->lockedNotice();
|
||||
}
|
||||
|
||||
return view('staff.meta.edit', compact('study'));
|
||||
@ -40,7 +34,9 @@ public function save(StudyMetadataUpdateRequest $request)
|
||||
{
|
||||
abort_unless(auth()->user()->may(Permission::StudyMetadataEdit), 403);
|
||||
$study = $this->getStudy();
|
||||
abort_if($study->report_status->value >= ReportStatus::Finalized->value, 403);
|
||||
if ($study->isReportReady()) {
|
||||
return $this->lockedNotice();
|
||||
}
|
||||
|
||||
$payload = array_trim_strings($request->validated());
|
||||
$payload['body_part_examined'] = strtoupper($payload['body_part_examined']);
|
||||
|
Loading…
Reference in New Issue
Block a user