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