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