Просмотр исходного кода

Omega - make covid intake and follow-up operable via popup/wizard

Vijayakrishnan 3 лет назад
Родитель
Сommit
72306f7197

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

@@ -342,6 +342,15 @@ class NoteController extends Controller
         ]);
     }
 
+    public function noteSegmentViewByName(Request $request, Note $note, $segmentInternalName, $view) {
+        return view("app.patient.segment-templates.{$segmentInternalName}.{$view}", [
+            'patient' => $note->client,
+            'note' => $note,
+            'segment' => $note->coreSegment,
+            'segmentInternalName' => $segmentInternalName
+        ]);
+    }
+
     public function rhsSidebar(Request $request, Client $patient, Note $note) {
         return view('app.patient.note.rhs-sidebar', compact('patient', 'note'));
     }

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

@@ -445,6 +445,19 @@
                     "href" => "/behavior-center/{$note->client->uid}/{$note->uid}",
                     "initer" => "behavior-center-{$note->id}"
                 ],
+                [], // for separator
+                [
+                    "name" => 'COVID-19 Intake',
+                    "title" => 'COVID-19 Intake',
+                    "href" => "/note-segment-view-by-name/{$note->uid}/covid_intake/edit",
+                    "initer" => "hide-moes"
+                ],
+                [
+                    "name" => 'COVID-19 Follow-up',
+                    "title" => 'COVID-19 Follow-up',
+                    "href" => "/note-segment-view-by-name/{$note->uid}/covid_follow-up/edit",
+                    "initer" => "covid-follow-up-{$note->id}"
+                ]
             ];
             ?>
             <div moe relative class="px-2 border-left screen-only">
@@ -452,12 +465,16 @@
                 <form url="#" right>
                     <p class="font-weight-bold text-secondary">Additional Modules</p>
                     @foreach($availableModules as $module)
-                        <a href="{{$module['href']}}"
-                           open-in-stag-popup
-                           popup-style="medium-large overflow-visible"
-                           title="{!! $module['title'] !!}"
-                           mc-initer="{{ $module['initer']  }}"
-                           class="d-inline-block mr-2 mb-2 width-100px">{!! $module['name'] !!}</a>
+                        @if(@$module['name'])
+                            <a href="{{$module['href']}}"
+                               open-in-stag-popup
+                               popup-style="medium-large overflow-visible"
+                               title="{!! $module['title'] !!}"
+                               mc-initer="{{ @$module['initer']  }}"
+                               class="d-block mb-1 text-nowrap">{!! $module['name'] !!}</a>
+                        @else
+                            <hr class="my-2">
+                        @endif
                     @endforeach
                 </form>
             </div>

+ 36 - 1
resources/views/app/patient/segment-templates/covid_follow-up/edit.blade.php

@@ -4,6 +4,10 @@ use App\Models\Point;
 
 $category = 'COVID_FOLLOW-UP';
 
+if(!@$sessionKey) {
+        $sessionKey = request()->cookie('sessionKey');
+}
+
 $point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, $category, $sessionKey, true);
 
 $contentData = [
@@ -50,7 +54,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 $submitFormUrl = '/api/visitPoint/upsertChildReview';
 
 ?>
-<div visit-moe close-on-save close-on-cancel class="d-block p-3">       
+<div id="covid-follow-up-{{$note->id}}" visit-moe close-on-save close-on-cancel class="d-block p-3 popup-content-container">
         <form id="visitNoteForm" show url="{{ $submitFormUrl }}" class="mcp-theme-1">
                 <input type="hidden" name="uid" value="<?= $point->uid ?>">
                 <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
@@ -500,6 +504,7 @@ $submitFormUrl = '/api/visitPoint/upsertChildReview';
         // PHQ
 
         (function() {
+                @if(@$segment->segmentTemplate && @$segment->segmentTemplate->internal_name)
                 window.segmentInitializers.covidFollowUp = function() {
                         var covidFollowUp = {
                                 parentSegment: $('[data-segment-template-name="<?= $segment->segmentTemplate->internal_name ?>"] '),
@@ -527,5 +532,35 @@ $submitFormUrl = '/api/visitPoint/upsertChildReview';
                         };
                         covidFollowUp.init();
                 };
+                @endif
+
+                addMCInitializer('covid-follow-up-{{$note->id}}', function() {
+                        var covidFollowUp = {
+                                parentSegment: $('#covid-follow-up-{{$note->id}}'),
+                                initAutoCheckAll: function() {
+                                        var self = this;
+                                        var checkSegments = $('[check-all]');
+                                        $.each(checkSegments, function(i, segment) {
+                                                var target = $(segment).data('target');
+                                                var allChildrenCheckboxes = self.parentSegment.find('input[type=checkbox][' + target + ']');
+                                                $(segment).click(function() {
+                                                        var checkAllInput = this;
+                                                        var isChecked = checkAllInput.checked ? true : false;
+                                                        allChildrenCheckboxes.attr('checked', isChecked);
+                                                });
+                                                var allCheckedChildrenCheckboxes = self.parentSegment.find('input[type=checkbox][' + target + ']:checked');
+                                                if (allChildrenCheckboxes.length === allCheckedChildrenCheckboxes.length) {
+                                                        $(segment).attr('checked', true);
+                                                }
+                                        });
+
+                                },
+                                init: function() {
+                                        $('div[moe] form').hide();
+                                        this.initAutoCheckAll();
+                                }
+                        };
+                        covidFollowUp.init();
+                }, '#covid-follow-up-{{$note->id}}');
         }).call(window);
 </script>

+ 5 - 1
resources/views/app/patient/segment-templates/covid_intake/edit.blade.php

@@ -4,6 +4,10 @@ use App\Models\Point;
 
 $category = 'COVID_INTAKE';
 
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
 $point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'COVID_INTAKE', $sessionKey, true);
 
 $contentData = [
@@ -141,7 +145,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 
 ?>
 
-<div visit-moe close-on-save close-on-cancel class="d-block p-3">
+<div visit-moe close-on-save close-on-cancel class="d-block p-3 popup-content-container">
     <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
         <input type="hidden" name="uid" value="<?= $point->uid ?>">
         <input type="hidden" name="noteUid" value="<?= $note->uid ?>">

+ 4 - 0
resources/views/layouts/template.blade.php

@@ -434,6 +434,10 @@
                     if(window.vgWtChart) window.vgWtChart.flush();
                     return false;
                 });
+
+            addMCInitializer('hide-moes', function() {
+                $('div[moe] form').hide();
+            });
         });
     </script>
     <script src="/js/click-to-copy.js?v={{config('app.asset_version')}}"></script>

+ 1 - 0
routes/web.php

@@ -548,6 +548,7 @@ Route::middleware('pro.auth')->group(function () {
     Route::get('/note/rpm-agreement/{note}', 'NoteController@rpmAgreement')->name('rpm-agreement');
     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('/note-segment-view-by-name/{note}/{segmentInternalName}/{view}', 'NoteController@noteSegmentViewByName')->name('note-segment-view-by-name');
     Route::get('/chart-segment-view/{patient}/{segmentInternalName}/{view}', 'NoteController@chartSegmentView')->name('chart-segment-view');
     Route::get('/note-rhs-sidebar/{patient}/{note}', 'NoteController@rhsSidebar')->name('note-rhs-sidebar');
     Route::get('/medications-center/{patient}/{note}', 'NoteController@medicationsCenter')->name('medications-center');