Răsfoiți Sursa

Wizards: 4-button UI for "add" forms

Vijayakrishnan 3 ani în urmă
părinte
comite
74780c862c

+ 25 - 3
resources/views/app/patient/wizard-partials/common-fields-add.blade.php

@@ -1,4 +1,26 @@
 <div class="mb-2">
+    <span class="font-weight-bold">Entry Type</span>
+    <div class="d-flex align-items-center mt-1">
+        <button data-entry-type="Pre-Existing"
+                class="btn-entry-type shadow-none btn btn-default border mr-2 bg-white">
+            Pre-Existing
+        </button>
+        <button data-entry-type="Added during this visit"
+                class="btn-entry-type shadow-none btn btn-default border mr-2 bg-white">
+            {{@$addVerbPT ? ucwords($addVerbPT) : 'Added'}} during this visit
+        </button>
+        <button data-entry-type="Historic"
+                class="btn-entry-type shadow-none btn btn-default border mr-2 bg-white">
+            Historic
+        </button>
+        <button data-entry-type="Removed during this visit"
+                class="btn-entry-type shadow-none btn btn-default border mr-2 bg-white">
+            Removed during this visit
+        </button>
+    </div>
+</div>
+
+<div class="mb-2 d-none">
     <span class="font-weight-bold">Is this {{$label}} currently active?</span>
     <div class="d-flex align-items-baseline mt-1">
         <label class="my-0 d-inline-flex align-items-center">
@@ -12,7 +34,7 @@
     </div>
 </div>
 
-<div if-active class="d-none">
+<div class="d-none">
 
     <hr class="mb-2 mt-0">
 
@@ -48,7 +70,7 @@
 
 </div>
 
-<div if-not-active class="d-none">
+<div class="d-none">
 
     <hr class="mb-2 mt-0">
 
@@ -148,7 +170,7 @@
     @if(1 || $patient->core_note_id !== $note->id) {{-- allow review/plan from core note --}}
 	<div class="row">
         @if(!@$noReview)
-            <div class="mb-2 col-md-6">
+            <div class="mb-2 col-md-6 pr-0">
                 <?php
                 $currentValue = '';
                 $previousValue = '';

+ 37 - 0
resources/views/app/patient/wizard-partials/common-script.blade.php

@@ -189,11 +189,15 @@ parentSegment.find('[name="removalReasonCategory"]')
         }
         if(form.find('[name="removalReasonCategory"]:checked').val() === 'ON_INTAKE') {
             form.find('[if-removal-on-intake]').removeClass('d-none');
+            __reset(form.find('[data-name="start_date"]'));
+            __reset(form.find('[data-name="prescriber"]'));
             __reset(form.find('[name="removalEffectiveDate"]'));
             __reset(form.find('[name="removalReasonMemo"]'));
         }
         else if(form.find('[name="removalReasonCategory"]:checked').val() === 'DURING_VISIT') {
             form.find('[if-removal-during-visit]').removeClass('d-none');
+            __reset(form.find('[data-name="start_date"]'));
+            __reset(form.find('[data-name="prescriber"]'));
             form.find('[name="removalEffectiveDate"]').val('{{$patient->core_note_id !== $note->id ? $note->effective_dateest : date("Y-m-d")}}');
             form.find('[name="removalReasonMemo"]').val('{{$patient->core_note_id !== $note->id ? ($note->hcpPro ? $note->hcpPro->displayName() : "")  : ""}}');
         }
@@ -507,4 +511,37 @@ parentSegment.find('.tracker-input')
         }, 'json');
     });
 
+parentSegment.find('.btn-entry-type')
+    .off('click')
+    .on('click', function() {
+        $(this).siblings().removeClass('btn-info').addClass('btn-default bg-white');
+        $(this).removeClass('btn-default bg-white').addClass('btn-info');
+
+        switch ($(this).attr('data-entry-type')) {
+            case 'Pre-Existing':
+                parentSegment.find('[name="removalReasonCategory"]').prop('checked', false).trigger('change');
+                parentSegment.find('[name="isRemoved"][value="0"]').prop('checked', true).trigger('change');
+                parentSegment.find('[name="additionReasonCategory"][value="ON_INTAKE"]').prop('checked', true).trigger('change');
+                break;
+            case 'Added during this visit':
+                parentSegment.find('[name="removalReasonCategory"]').prop('checked', false).trigger('change');
+                parentSegment.find('[name="isRemoved"][value="0"]').prop('checked', true).trigger('change');
+                parentSegment.find('[name="additionReasonCategory"][value="DURING_VISIT"]').prop('checked', true).trigger('change');
+                break;
+            case 'Historic':
+                parentSegment.find('[name="additionReasonCategory"]').prop('checked', false).trigger('change');
+                parentSegment.find('[name="isRemoved"][value="1"]').prop('checked', true).trigger('change');
+                parentSegment.find('[name="removalReasonCategory"][value="ON_INTAKE"]').prop('checked', true).trigger('change');
+                break;
+            case 'Removed during this visit':
+                parentSegment.find('[name="additionReasonCategory"]').prop('checked', false).trigger('change');
+                parentSegment.find('[name="isRemoved"][value="1"]').prop('checked', true).trigger('change');
+                parentSegment.find('[name="removalReasonCategory"][value="DURING_VISIT"]').prop('checked', true).trigger('change');
+                break;
+        }
+
+        return false;
+    });
+parentSegment.find('.btn-entry-type[data-entry-type="Pre-Existing"]').trigger('click');
+
 initStagSuggest();