Selaa lähdekoodia

All segment edits in popups (wip)

Vijayakrishnan 3 vuotta sitten
vanhempi
commit
6975e98f21

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

@@ -325,6 +325,15 @@ class NoteController extends Controller
         ]);
     }
 
+    public function noteSegmentView(Request $request, Client $patient, Note $note, Segment $segment, $segmentInternalName, $view) {
+        return view("app.patient.segment-templates.{$segmentInternalName}.{$view}", [
+            'patient' => $patient,
+            'note' => $patient->coreNote,
+            'segment' => $segment,
+            'segmentInternalName' => $segmentInternalName
+        ]);
+    }
+
     public function medicationsCenter(Request $request, Client $patient, Note $note) {
         return view('app.patient.medications-center', compact('patient', 'note'));
     }

+ 6 - 0
resources/views/app/patient/note/dashboard_script.blade.php

@@ -150,6 +150,12 @@
                             return false;
                         }
 
+                        // OPEN popup for if note-segment-view exists
+                        if($('.' + editParent.attr('data-segment-template-name') + '-trigger').length) {
+                            $('.' + editParent.attr('data-segment-template-name') + '-trigger').trigger('click');
+                            return false;
+                        }
+
                         if(editParent.is('.edit')) {
                             editParent.removeClass('edit');
                         }

+ 19 - 0
resources/views/app/patient/note/segment.blade.php

@@ -200,5 +200,24 @@
     </div>
     <?php endif ?>
 
+    {{-- popup trigger --}}
+    <div class="d-none">
+        <a native="" target="_blank"
+           class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none <?= $segment->segmentTemplate->internal_name ?>-trigger"
+           open-in-stag-popup="" update-parent=""
+           mc-initer="<?= $segment->segmentTemplate->internal_name ?>_{{$patient->id}}"
+           title="{{$segment->subheading ? $segment->subheading . ' / ' : ''}}{{$segment->display_title}}"
+           popup-style="wide overflow-visible"
+           href="/note-segment-view/{{$patient->uid}}/{{$note->uid}}/{{$segment->uid}}/<?= $segment->segmentTemplate->internal_name ?>/edit">
+            <i class="fa fa-bolt mr-1"></i>
+            <span>Manage</span>
+        </a>
+        <script>
+        addMCInitializer('<?= $segment->segmentTemplate->internal_name ?>_{{$patient->id}}', function() {
+            window.segmentInitializers['<?= $segment->segmentTemplate->internal_name ?>'].call(window);
+        }, '.<?= $segment->segmentTemplate->internal_name ?>-trigger');
+        </script>
+    </div>
+
 </div>
 

+ 1 - 0
routes/web.php

@@ -383,6 +383,7 @@ Route::middleware('pro.auth')->group(function () {
     Route::get('/point/plan-log/{point}', 'NoteController@planLog')->name('point-plan-log');
     Route::get('/note/pdf/{note}', 'NoteController@downloadAsPdf')->name('note-pdf');
     Route::get('/segment-summary/{segment}', 'NoteController@segmentSummary')->name('segment-summary');
+    Route::get('/note-segment-view/{patient}/{note}/{segment}/{segmentInternalName}/{view}', 'NoteController@noteSegmentView')->name('note-segment-view');
     Route::get('/chart-segment-view/{patient}/{segmentInternalName}/{view}', 'NoteController@chartSegmentView')->name('chart-segment-view');
     Route::get('/medications-center/{patient}/{note}', 'NoteController@medicationsCenter')->name('medications-center');
     Route::get('/medications-reconcile/{patient}/{note}', 'NoteController@medicationsReconcile')->name('medications-reconcile');