|
@@ -82,6 +82,7 @@ class NoteController extends Controller
|
|
|
$note = null;
|
|
|
$sectionTemplate = null;
|
|
|
|
|
|
+ // if CREATE
|
|
|
if($section == null){
|
|
|
// TODO require valid note_uid & section_template_uid
|
|
|
$note = Note::where('uid', $note_uid)->first();
|
|
@@ -101,8 +102,20 @@ class NoteController extends Controller
|
|
|
// if UPDATE, $section, and $request
|
|
|
|
|
|
// remember: the existence of form.php overrides section_template.is_canvas == TRUE
|
|
|
- if(file_exists(storage_path('sections/' . $sectionTemplate->internal_name . '/form.blade.php'))) {
|
|
|
-
|
|
|
+
|
|
|
+ if($sectionTemplate->is_canvas){
|
|
|
+ if(file_exists()){
|
|
|
+ include(storage_path('sections/' . $sectionTemplate->internal_name . '/processor.php'));
|
|
|
+ }else{
|
|
|
+ $newContentData = json_decode($request->get('data'), true);
|
|
|
+ }
|
|
|
+ ob_start();
|
|
|
+ // TODO include the resource_path
|
|
|
+ include(storage_path('sections/' . $sectionTemplate->internal_name . '/summary.php'));
|
|
|
+ $newSummaryHtml = ob_get_contents();
|
|
|
+ ob_end_clean();
|
|
|
+ }elseif(file_exists(storage_path('sections/' . $sectionTemplate->internal_name . '/form.blade.php'))) {
|
|
|
+
|
|
|
include(storage_path('sections/' . $sectionTemplate->internal_name . '/processor.php'));
|
|
|
|
|
|
// now, create summaryHtml appropriate
|
|
@@ -114,7 +127,7 @@ class NoteController extends Controller
|
|
|
$newContentData = json_decode($request->get('data'), true);
|
|
|
if(isset($newContentData['value'])){
|
|
|
$newSummaryHtml = $newContentData['value'];
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$response = null;
|
|
@@ -129,6 +142,12 @@ class NoteController extends Controller
|
|
|
//TODO: handle if response->success == false
|
|
|
}else{
|
|
|
// call Java to create section
|
|
|
+ // if default.php, run it to hydrate $newContentData and $newSummaryHtml
|
|
|
+
|
|
|
+ if(file_exists(storage_path('sections/' . $sectionTemplate->internal_name . '/default.php'))) {
|
|
|
+ include(storage_path('sections/' . $sectionTemplate->internal_name . '/default.php'));
|
|
|
+ }
|
|
|
+
|
|
|
$data = [
|
|
|
'noteUid' => $note->uid,
|
|
|
'sectionTemplateUid' => $sectionTemplate->uid,
|
|
@@ -139,7 +158,7 @@ class NoteController extends Controller
|
|
|
$response = $this->callJava($request, '/section/create', $data);
|
|
|
//TODO: handle if response->success == false
|
|
|
}
|
|
|
- //return redirect(route('patients.view.notes',$note->client->uid));
|
|
|
+ return redirect(route('patients.view.notes',$note->client->uid));
|
|
|
return [
|
|
|
'success' => $response->success,
|
|
|
'newSummaryHtml' => $newSummaryHtml
|