Эх сурвалжийг харах

Note UI update => no more hardcoded ref to 'soap_visit'

Vijayakrishnan 3 жил өмнө
parent
commit
eac1d34014

+ 18 - 0
app/Models/Note.php

@@ -83,6 +83,24 @@ class Note extends Model
             ->orderBy('position_index', 'asc');
     }
 
+    public function segmentsLeft()
+    {
+        return $this->hasMany(Segment::class, 'note_id', 'id')
+            ->whereRaw("(left_or_right IS NULL OR left_or_right = 'LEFT')")
+            ->where('id', '!=', $this->core_segment_id) // dont include core-segment
+            ->where('is_active', true)
+            ->orderBy('position_index', 'asc');
+    }
+
+    public function segmentsRight()
+    {
+        return $this->hasMany(Segment::class, 'note_id', 'id')
+            ->where('left_or_right', 'RIGHT')
+            ->where('id', '!=', $this->core_segment_id) // dont include core-segment
+            ->where('is_active', true)
+            ->orderBy('position_index', 'asc');
+    }
+
     public function coreSegment()
     {
         return $this->hasOne(Segment::class, 'id', 'core_segment_id');

+ 5 - 9
public/css/style.css

@@ -2198,10 +2198,6 @@ body.in-iframe .main-row > .sidebar {
     max-height: calc(100vh - 55px);
     background-color: #fff;
 }
-.note-container.note_template_soap_visit .note-lhs-tree {
-    width: 0 !important;
-    opacity: 0 !important;
-}
 .note-container .note-lhs-tree:hover {
     overflow: overlay;
 }
@@ -2233,7 +2229,6 @@ body.in-iframe .main-row > .sidebar {
     color: #333;
 }
 .note-container .note-lhs-tree>.note-tree-node>a:not([data-non-segment-target]) {
-    font-weight: bold;
     color: #333;
 }
 .note-container .note-lhs-tree .note-tree-node>a:hover {
@@ -2291,20 +2286,21 @@ body.in-iframe .main-row > .sidebar {
     padding-left: 4rem;
 }
 
-.note-container:not(.note_template_soap_visit) .note-rhs-sidebar {
+.note-container .note-rhs-sidebar {
     min-width: 180px;
     max-width: 180px;
     align-self: stretch;
     border-right: 1px solid #ddd;
+    border-left: 1px solid #ddd;
     height: 300px;
     overflow: hidden;
     max-height: calc(100vh - 55px);
     background-color: #fff;
 }
-.note-container:not(.note_template_soap_visit) .note-rhs-sidebar:hover {
+.note-container .note-rhs-sidebar:hover {
     overflow: overlay;
 }
-.note-container:not(.note_template_soap_visit) .note-rhs-sidebar.fixed {
+.note-container .note-rhs-sidebar.fixed {
     position: fixed;
     top: 55px;
     right: 0;
@@ -2312,7 +2308,7 @@ body.in-iframe .main-row > .sidebar {
     height: calc(100vh - 55px) !important;
     z-index: 1;
 }
-.note-container:not(.note_template_soap_visit) .note-rhs-sidebar.fixed ~ .note-rhs-content {
+.note-container .note-rhs-sidebar.fixed ~ .note-rhs-content {
     margin-right: 180px;
 }
 .spot-highlight {

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

@@ -39,6 +39,8 @@
         $segmentMap[$segment->segmentTemplate->internal_name] = $segment;
     endforeach;
 
+    $hasRightSegments = $isVisitTemplateBased && !!count($note->segmentsRight);
+
     ?>
     <div id="note-single-header" class="pb-3 d-flex align-items-start screen-only zero-height note_template_{{$note->visitTemplate ? $note->visitTemplate->internal_name : ''}}">
         <h6 class="my-0 text-secondary d-flex align-items-center w-100">
@@ -349,7 +351,7 @@
                     @if(!$note->is_signed_by_hcp || $pro->pro_type === 'ADMIN')
                         <div moe class="ml-auto">
                             <a href="" show start><i class="fa fa-edit"></i></a>
-                            <form url="/api/note/updateMethod" {!! $isVisitTemplateBased && $note->visitTemplate->internal_name === 'soap_visit' ? 'hook="onNoteMethodUpdate"' : '' !!}>
+                            <form url="/api/note/updateMethod" hook="onNoteMethodUpdate">
                                 <input type="hidden" name="uid" value="{{$note->uid}}">
                                 <div class="mb-2">
                                     <select name="method" class="form-control form-control-sm note-method-select" required>
@@ -539,13 +541,13 @@
         </div>
         <div class="card-body p-0">
             <div class="note-container note_template_{{$note->visitTemplate ? $note->visitTemplate->internal_name : ''}}">
-                @if($isVisitTemplateBased && !$doesVisitTemplateUiConfigExist && $note->visitTemplate->internal_name !== 'soap_visit')
+                @if(!$hasRightSegments)
                     @include('app.patient.note.lhs-tree')
                 @endif
                 <div class="note-rhs-content">
                 <div>
                 <div class="border-bottom pb-3">
-                    <div class="{{$isVisitTemplateBased && $note->visitTemplate->internal_name === 'soap_visit' ? 'd-flex align-items-stretch' : ''}}">
+                    <div class="{{$hasRightSegments ? 'd-flex align-items-stretch' : ''}}">
                         <?php
                         $shortCutsObject = [];
                         foreach ($pro->allShortcuts() as $shortcut) {
@@ -615,7 +617,7 @@
                         $shortcuts = "";
                         $latestSectionTS = 0;
                         ?>
-                        <div class="{{ $note->is_signed_by_hcp ? 'note-signed-by-hcp' : '' }} {{$isVisitTemplateBased && $note->visitTemplate->internal_name === 'soap_visit' ? 'w-30 border-right note-left-panel stag-scrollbar' : ''}}">
+                        <div class="{{ $note->is_signed_by_hcp ? 'note-signed-by-hcp' : '' }} {{$hasRightSegments ? 'w-30 border-right note-left-panel stag-scrollbar' : ''}}">
                             <div class="min-width-300px stag-scrollbar">
                                 @if($isVisitTemplateBased && $doesVisitTemplateLayoutExist)
                                     @include($visitLayoutPath)
@@ -628,7 +630,7 @@
                                 @endif
                             </div>
                         </div>
-                        @if($isVisitTemplateBased && $note->visitTemplate->internal_name === 'soap_visit')
+                        @if($hasRightSegments)
                         <div class="w-70 border-left note-right-panel stag-scrollbar">
                             <div class="min-width-700px">
                                 @include('app.patient.note.note-segment-list-rhs')
@@ -646,13 +648,10 @@
                     @include('app.patient.handouts-list', compact('patient', 'handouts'))
                 </div>
 
-                @if($isVisitTemplateBased && $doesVisitTemplateUiConfigExist)
-
-                @else
                 <div class="p-3 border-bottom screen-only" data-non-segment-section="Prescriptions">
                     @include('app.patient.prescriptions.list', compact('patient', 'note'))
                 </div>
-                @endif
+
 
                 <div class="p-3 border-bottom screen-only" data-non-segment-section="Supply Orders Summary">
                     <div class="">
@@ -2449,7 +2448,7 @@
                 @endif
 
                 </div>
-                @if($isVisitTemplateBased && !$note->is_signed_by_hcp && $note->visitTemplate->internal_name !== 'soap_visit')
+                @if(!$hasRightSegments)
                     @include('app.patient.note.rhs-sidebar')
                 @endif
             </div>
@@ -2464,11 +2463,10 @@
     <script>
         (function() {
             function init() {
-                @if($note->visitTemplate->internal_name !== 'soap_visit')
+                @if(!$hasRightSegments)
                 fixTreeTopAndHeight();
                 $(window).on('resize', fixTreeTopAndHeight);
                 $(window).on('scroll', fixTreeTopAndHeight);
-                @endif
                 $('.note-tree-node>a[data-segment-uid]')
                     .off('click.scroll-to-segment')
                     .on('click.scroll-to-segment', function() {
@@ -2495,6 +2493,7 @@
                          $(this).parent().find('>.note-tree-children>.note-tree-node>a[data-segment-uid]').first().trigger('click');
                          return false;
                     });
+                @endif
                 $(document)
                     .off('click.scroll-to-non-segment', '[data-non-segment-target]')
                     .on('click.scroll-to-non-segment', '[data-non-segment-target]', function() {
@@ -2550,12 +2549,14 @@
             addMCInitializer('note-tree', init, '#note-lhs-tree');
         })();
     </script>
-        @if($isVisitTemplateBased && $note->visitTemplate->internal_name === 'soap_visit')
+        @if($isVisitTemplateBased)
         <script>
             (function() {
                 function init() {
+                    @if($hasRightSegments)
                     initVSplitter('stag-note', $('.note-left-panel'), $('.note-right-panel'));
                     initStagScrollbar({{$note->is_signed_by_hcp ? 1 : 34}});
+                    @endif
                     addMCHook('onNoteMethodUpdate', function() {
                         $('.visit-segment[data-segment-template-name="disclaimers"]').find('.refresh-segment').trigger('click');
                         fastReload();

+ 1 - 5
resources/views/app/patient/note/note-segment-list-rhs.blade.php

@@ -2,14 +2,11 @@
     <?php
     $previousHeading = null;
     $previousSubHeading = null;
-	$rhsSegments = config('app.note_rhs_segments');
 
     $suggestionModeOn = request()->get('suggestion_mode') == 'on' && $note->is_signed_by_hcp 
 
     ?>
-    @foreach($rhsSegments as $segmentIName)
-		<?php $segment = $note->getSegmentByInternalName($segmentIName); ?>
-		@if(!!$segment)
+    @foreach($note->segmentsRight as $segment)
 		<?php
 		if ($segment->heading !== $previousHeading) {
 			if (!empty($previousHeading)) {
@@ -35,7 +32,6 @@
 				@include('app.patient.note.segment')
 			@endif
 		</div>
-        @endif
     @endforeach
     <?php
     if (!empty($previousHeading)) {

+ 8 - 20
resources/views/app/patient/note/note-segment-list.blade.php

@@ -6,7 +6,7 @@
     $previousHeading = null;
     $previousSubHeading = null;
     ?>
-    @foreach($note->segments as $segment)
+    @foreach($note->segmentsLeft as $segment)
         <?php
         if ($segment->heading !== $previousHeading) {
             if (!empty($previousHeading)) {
@@ -26,25 +26,13 @@
             $previousHeading = $segment->heading;
         }
         ?>
-		@if($note->visitTemplate->internal_name !== 'soap_visit')
-			<div class="{{$segment->segmentTemplate->internal_name === 'medrisk_vigilence' ? 'd-none' : ''}}">
-                @if($suggestionModeOn)
-                    @include('app.patient.note.segment.suggestions_and_updates')
-                @else 
-                    @include('app.patient.note.segment')
-                @endif
-			</div>
-		@else
-			@if(in_array($segment->segmentTemplate->internal_name, config('app.note_lhs_segments')))
-				<div>
-                    @if($suggestionModeOn)
-                        @include('app.patient.note.segment.suggestions_and_updates')
-                    @else 
-                        @include('app.patient.note.segment')
-                    @endif
-				</div>
-			@endif
-		@endif
+        <div class="{{$segment->segmentTemplate->internal_name === 'medrisk_vigilence' ? 'd-none' : ''}}">
+            @if($suggestionModeOn)
+                @include('app.patient.note.segment.suggestions_and_updates')
+            @else
+                @include('app.patient.note.segment')
+            @endif
+        </div>
     @endforeach
     <?php
     if (!empty($previousHeading)) {

+ 12 - 7
resources/views/app/patient/note/rhs-sidebar.blade.php

@@ -1,4 +1,4 @@
-<div class="note-rhs-sidebar {{$note->visitTemplate && $note->visitTemplate->internal_name === 'soap_visit' ? '' : 'border-left'}}" id="note-rhs-sidebar">
+<div class="note-rhs-sidebar" id="note-rhs-sidebar">
     <?php
     $allergies = \App\Models\Point::getPointsOfCategory($patient, "ALLERGY");
     $medications = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");
@@ -8,7 +8,8 @@
     $prescriptions = $patient->prescriptionsCreatedInNote($note);
     $tracker = \App\Models\Point::getGlobalSingletonOfCategory($patient, 'NO_KNOWN_TRACKER');
     ?>
-    <div id="active-allergies" class="p-2 border-bottom c-pointer on-hover-aliceblue"
+    <div id="active-allergies"
+         class="p-2 border-bottom c-pointer on-hover-aliceblue {{$note->is_signed_by_hcp ? 'events-none' : ''}}"
          open-in-stag-popup
          mc-initer="allergies-center-{{$note->id}}"
          title="Allergies Center"
@@ -38,7 +39,8 @@
             @endif
         @endif
     </div>
-    <div id="active-medications" class="p-2 border-bottom c-pointer on-hover-aliceblue"
+    <div id="active-medications"
+         class="p-2 border-bottom c-pointer on-hover-aliceblue {{$note->is_signed_by_hcp ? 'events-none' : ''}}"
          open-in-stag-popup
          mc-initer="medications-center-{{$note->id}}"
          title="Medications Center"
@@ -65,7 +67,8 @@
             @endif
         @endif
     </div>
-    <div id="active-problems" class="p-2 border-bottom c-pointer on-hover-aliceblue"
+    <div id="active-problems"
+         class="p-2 border-bottom c-pointer on-hover-aliceblue {{$note->is_signed_by_hcp ? 'events-none' : ''}}"
          open-in-stag-popup
          mc-initer="problems-center-{{$note->id}}"
          title="Problems Center"
@@ -87,7 +90,8 @@
             <span class="px-1 text-secondary">-</span>
         @endif
     </div>
-    <div id="active-goals" class="p-2 border-bottom c-pointer on-hover-aliceblue"
+    <div id="active-goals"
+         class="p-2 border-bottom c-pointer on-hover-aliceblue {{$note->is_signed_by_hcp ? 'events-none' : ''}}"
          open-in-stag-popup
          mc-initer="goals-center-{{$note->id}}"
          title="Goals Center"
@@ -109,7 +113,8 @@
             <span class="px-1 text-secondary">-</span>
         @endif
     </div>
-    <div id="active-careteam" class="p-2 border-bottom c-pointer on-hover-aliceblue"
+    <div id="active-careteam"
+         class="p-2 border-bottom c-pointer on-hover-aliceblue {{$note->is_signed_by_hcp ? 'events-none' : ''}}"
          open-in-stag-popup
          mc-initer="careteam-center-{{$note->id}}"
          title="Care Team Center"
@@ -120,7 +125,7 @@
             <i class="fa fa-external-link-alt text-primary ml-1"></i>
         </div>
     </div>
-    <div id="note-prescriptions" class="p-2 border-bottom c-pointer on-hover-aliceblue" data-non-segment-target="Prescriptions">
+    <div id="note-prescriptions" class="p-2 border-bottom c-pointer on-hover-aliceblue {{$note->is_signed_by_hcp ? 'events-none' : ''}}" data-non-segment-target="Prescriptions">
         <div class="font-weight-bold mb-2">
             ERx &amp; Orders
         </div>