Sfoglia il codice sorgente

rx wiz add/edit: logic updates

Vijayakrishnan 3 anni fa
parent
commit
d0fd24bfc8

+ 2 - 2
resources/views/app/patient/wizard-partials/common-fields.blade.php

@@ -22,13 +22,13 @@
             <label class="my-0 d-inline-flex align-items-center">
                 <input type="radio" name="additionReasonCategory" value="ON_INTAKE"
                         {{$point && $point->addition_reason_category === 'ON_INTAKE' ? 'checked' : ''}}
-                        {{$point && $point->added_in_note_id === $note->id ? '' : 'readonly disabled'}}>
+                        {{$point && $point->added_in_note_id !== $note->id ? 'readonly disabled' : ''}}>
                 <span class="ml-1">Pre-existing</span>
             </label>
             <label class="ml-3 my-0 d-inline-flex align-items-center">
                 <input type="radio" name="additionReasonCategory" value="DURING_VISIT"
                         {{$point && $point->addition_reason_category === 'DURING_VISIT' ? 'checked' : ''}}
-                        {{$point && $point->added_in_note_id === $note->id ? '' : 'readonly disabled'}}>
+                        {{$point && $point->added_in_note_id !== $note->id ? 'readonly disabled' : ''}}>
                 <span class="ml-1">Added during this visit (as part of my plan)</span>
             </label>
         </div>

+ 8 - 4
resources/views/app/patient/wizard-partials/common-script.blade.php

@@ -1,3 +1,7 @@
+function __reset(_input) {
+    _input.val(_input.attr('value') ? _input.attr('value') : '');
+}
+
 parentSegment.find('[name="isRemoved"]')
     .off('change')
     .on('change', function () {
@@ -26,8 +30,8 @@ parentSegment.find('[name="additionReasonCategory"]')
         }
         if(form.find('[name="additionReasonCategory"]:checked').val() === 'ON_INTAKE') {
             form.find('[if-addition-on-intake]').removeClass('d-none');
-            form.find('[data-name="start_date"]').val('');
-            form.find('[data-name="prescriber"]').val('');
+            __reset(form.find('[data-name="start_date"]'));
+            __reset(form.find('[data-name="prescriber"]'));
         }
         else if(form.find('[name="additionReasonCategory"]:checked').val() === 'DURING_VISIT') {
             form.find('[if-addition-during-visit]').removeClass('d-none');
@@ -50,8 +54,8 @@ parentSegment.find('[name="removalReasonCategory"]')
         }
         if(form.find('[name="removalReasonCategory"]:checked').val() === 'ON_INTAKE') {
             form.find('[if-removal-on-intake]').removeClass('d-none');
-            form.find('[name="removalEffectiveDate"]').val('');
-            form.find('[name="removalReasonMemo"]').val('');
+            __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');