wip
This commit is contained in:
parent
10c6921209
commit
0d81629027
@ -57,9 +57,10 @@ public function create()
|
||||
abort_unless(me()->may([Permission::ReportEdit, Permission::ReportDictate, Permission::ReportApprove]), 403);
|
||||
$this->decodeKeys();
|
||||
$study = Study::findOrFail($this->key);
|
||||
if ($study->report_status >= ReportStatus::Finalized) {
|
||||
if (! $study->canEditReport()) {
|
||||
return redirect()->back()->with('error', 'Report is already approved.');
|
||||
}
|
||||
|
||||
$report = StudyReport::where('study_id', $study->id)
|
||||
->where('report_status', ReportStatus::Preliminary->value)
|
||||
->latest()
|
||||
|
@ -20,10 +20,9 @@ public function rules(): array
|
||||
return [
|
||||
'hashid' => ['required', new ExistsByHash(Study::class)],
|
||||
'content' => 'required',
|
||||
'report_status' => ['required',
|
||||
|
||||
Rule::enum(ReportStatus::class)
|
||||
->only([ReportStatus::Preliminary, ReportStatus::Finalized, ReportStatus::Approved]),
|
||||
'report_status' => [
|
||||
'required',
|
||||
Rule::enum(ReportStatus::class)->only([ReportStatus::Preliminary, ReportStatus::Finalized, ReportStatus::Approved]),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -26,12 +26,11 @@
|
||||
<form action="{{ route('staff.report.save') }}" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" value="{{ $study->hash }}" name="hashid">
|
||||
|
||||
<div
|
||||
class="ck-editor editor-container editor-container_classic-editor editor-container_include-word-count fixed-container"
|
||||
id="editor-container">
|
||||
<div class="editor-container__editor">
|
||||
<textarea id="editor" name="content"></textarea>
|
||||
<textarea id="editor" name="content">{{ $report?->getContent() }}</textarea>
|
||||
</div>
|
||||
<div class="editor_container__word-count" id="editor-word-count"></div>
|
||||
</div>
|
||||
@ -39,9 +38,9 @@ class="ck-editor editor-container editor-container_classic-editor editor-contain
|
||||
<div class="row w-75 mb-4">
|
||||
<div class="col-md mb-md-0 mb-2">
|
||||
<div class="form-check form-check-success custom-option custom-option-basic">
|
||||
<label class="form-check-label custom-option-content" for="customRadioVTemp1">
|
||||
<input name="report_status" class="form-check-input" type="radio" value="20"
|
||||
id="customRadioVTemp1" checked/>
|
||||
<label class="form-check-label custom-option-content" for="radio_prelim">
|
||||
<input name="report_status" class="form-check-input" type="radio" value="{{ \App\Domain\Report\ReportStatus::Preliminary->value }}"
|
||||
id="radio_prelim" checked/>
|
||||
<span class="custom-option-header">
|
||||
<span class="h6 mb-0">Draft</span>
|
||||
</span>
|
||||
@ -53,9 +52,9 @@ class="ck-editor editor-container editor-container_classic-editor editor-contain
|
||||
</div>
|
||||
<div class="col-md">
|
||||
<div class="form-check form-check-success custom-option custom-option-basic">
|
||||
<label class="form-check-label custom-option-content" for="customRadioVTemp2">
|
||||
<input name="report_status" class="form-check-input" type="radio" value="40"
|
||||
id="customRadioVTemp2"/>
|
||||
<label class="form-check-label custom-option-content" for="radio_final">
|
||||
<input name="report_status" class="form-check-input" type="radio" value="{{ \App\Domain\Report\ReportStatus::Finalized->value }}"
|
||||
id="radio_final"/>
|
||||
<span class="custom-option-header">
|
||||
<span class="h6 mb-0">Finalize</span>
|
||||
</span>
|
||||
@ -293,7 +292,7 @@ class: 'ck-heading_heading6'
|
||||
}
|
||||
]
|
||||
},
|
||||
initialData: '{!! $report?->getContent() !!}',
|
||||
//initialData: '',
|
||||
licenseKey: LICENSE_KEY,
|
||||
link: {
|
||||
addTargetToExternalLinks: true,
|
||||
|
Loading…
Reference in New Issue
Block a user