Browse Source

update to new notes

Josh 4 years ago
parent
commit
816e3df3a6

+ 9 - 1
app/Http/Controllers/NoteController.php

@@ -83,6 +83,7 @@ class NoteController extends Controller
         $sectionTemplate = null;
         $sectionTemplate = null;
 
 
         if($section == null){
         if($section == null){
+            // TODO require valid note_uid & section_template_uid
             $note = Note::where('uid', $note_uid)->first();
             $note = Note::where('uid', $note_uid)->first();
             $sectionTemplate = SectionTemplate::where('uid', $section_template_uid)->first();
             $sectionTemplate = SectionTemplate::where('uid', $section_template_uid)->first();
         } else {
         } else {
@@ -90,6 +91,8 @@ class NoteController extends Controller
             $sectionTemplate = SectionTemplate::where('id', $section->section_template_id)->first();
             $sectionTemplate = SectionTemplate::where('id', $section->section_template_id)->first();
         }
         }
 
 
+        // our intention is to now process a submit...
+        // ... the point of which is to have newContentData and newSummaryHtml
         $newContentData = [];
         $newContentData = [];
         $newSummaryHtml = "";
         $newSummaryHtml = "";
 
 
@@ -97,6 +100,7 @@ class NoteController extends Controller
         // if CREATE, $note and $sectionTemplate, and $request
         // if CREATE, $note and $sectionTemplate, and $request
         // if UPDATE, $section, and $request
         // 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(file_exists(storage_path('sections/' . $sectionTemplate->internal_name . '/form.blade.php'))) {
           
           
             include(storage_path('sections/' . $sectionTemplate->internal_name . '/processor.php'));
             include(storage_path('sections/' . $sectionTemplate->internal_name . '/processor.php'));
@@ -113,6 +117,7 @@ class NoteController extends Controller
             }  
             }  
         }
         }
 
 
+        $response = null;
         if($section){
         if($section){
             // call Java to update section
             // call Java to update section
             $data = [
             $data = [
@@ -135,7 +140,10 @@ class NoteController extends Controller
             //TODO: handle if response->success == false
             //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 $newSummaryHtml;
+         return [
+             'success' => $response->success,
+             'newSummaryHtml' => $newSummaryHtml
+         ];
     }
     }
 
 
     private function callJava($request, $endPoint, $data){
     private function callJava($request, $endPoint, $data){

+ 1 - 1
resources/views/app/patient/note/dashboard.blade.php

@@ -217,7 +217,7 @@
                         $shortcuts = "";
                         $shortcuts = "";
                         $latestSectionTS = 0;
                         $latestSectionTS = 0;
                         ?>
                         ?>
-                        @include('app.patient.note.note-list')
+                        @include('app.patient.note.note-section-list')
                     </div>
                     </div>
                 </div>
                 </div>
 
 

+ 8 - 5
resources/views/app/patient/note/note-list.blade.php → resources/views/app/patient/note/note-section-list.blade.php

@@ -1,6 +1,7 @@
 @foreach($note->sections as $section)
 @foreach($note->sections as $section)
     <?php
     <?php
     $sectionTS = strtotime($section->created_at);
     $sectionTS = strtotime($section->created_at);
+    // TODO ask Vijay why is this here?
     if($latestSectionTS === 0 || $latestSectionTS < $sectionTS) {
     if($latestSectionTS === 0 || $latestSectionTS < $sectionTS) {
         $latestSectionTS = $sectionTS;
         $latestSectionTS = $sectionTS;
     }
     }
@@ -52,7 +53,9 @@
             </a>
             </a>
 
 
         </div>
         </div>
-        <div class="d-none if-not-edit  inset-comment">{!! !empty($section->summary_html) ? $section->summary_html : '-' !!}</div>
+        <div class="d-none if-not-edit  inset-comment">
+            {!! !empty($section->summary_html) ? $section->summary_html : '-' !!}
+        </div>
 
 
         <div class="d-none if-edit">
         <div class="d-none if-edit">
             
             
@@ -63,9 +66,7 @@
                         <span class="mx-2 text-secondary">|</span>
                         <span class="mx-2 text-secondary">|</span>
                         @include('app.patient.canvas-sections.canvas-editor-modal', ['key' => $sectionInternalName])
                         @include('app.patient.canvas-sections.canvas-editor-modal', ['key' => $sectionInternalName])
                     </div>
                     </div>
-                    <div class="bg-light border p-2 mb-3">
-                        @include("app.patient.canvas-sections.${sectionInternalName}.summary")
-                    </div>
+                   
                 </div>
                 </div>
             <?php
             <?php
                 } else if(file_exists(storage_path('sections/' . $sectionInternalName . '/form.blade.php'))) {
                 } else if(file_exists(storage_path('sections/' . $sectionInternalName . '/form.blade.php'))) {
@@ -84,7 +85,6 @@
                         'value'=>''
                         'value'=>''
                     ];
                     ];
                 }
                 }
-                $formID = rand(0, 100000);
             ?>
             ?>
             <form ajax-form method="POST" action="/process_form_submit">
             <form ajax-form method="POST" action="/process_form_submit">
                 <input type="hidden" name="section_uid" value="<?= $section->uid?>">
                 <input type="hidden" name="section_uid" value="<?= $section->uid?>">
@@ -137,6 +137,7 @@
                 showMask();
                 showMask();
                 $(this).ajaxForm(function(result){
                 $(this).ajaxForm(function(result){
                     console.log("DONE: "+result);
                     console.log("DONE: "+result);
+                    //TODO: Swap new summary html
                     fastReload();
                     fastReload();
                 });
                 });
             })
             })
@@ -145,5 +146,7 @@
                 $(el).closest('.note-section').toggleClass('edit');
                 $(el).closest('.note-section').toggleClass('edit');
                 return false;
                 return false;
             }
             }
+
         })
         })
+        
     </script>
     </script>