Sfoglia il codice sorgente

Require add/remove reason category is active/not-active respy

Vijayakrishnan 3 anni fa
parent
commit
655e0662d1

+ 1 - 1
resources/views/app/patient/allergies-center.blade.php

@@ -161,7 +161,7 @@ list($allergies, $counts) = Point::getPointsOfCategoryExtended($patient, 'ALLERG
 
         <div class="d-flex align-items-center">
             <div class="mt-1 w-100 border p-3 bg-aliceblue border-info rounded">
-                <form action="/api/visitPoint/addTopLevel" class="mcp-theme-1 w-100" id="frm-add-allergy">
+                <form action="/api/visitPoint/addTopLevel" class="mcp-theme-1 w-100" id="frm-add-allergy" novalidate>
                     <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
                     <input type="hidden" name="category" value="ALLERGY">
                     <input type="hidden" name="data">

+ 1 - 1
resources/views/app/patient/careteam-center.blade.php

@@ -196,7 +196,7 @@ list($careTeamMembers, $counts) = Point::getPointsOfCategoryExtended($patient, '
 
         <div class="d-flex align-items-center">
             <div class="mt-1 w-100 border p-3 bg-aliceblue border-info rounded">
-                <form action="/api/visitPoint/addTopLevel" class="mcp-theme-1 w-100" id="frm-add-care-team-member">
+                <form action="/api/visitPoint/addTopLevel" class="mcp-theme-1 w-100" id="frm-add-care-team-member" novalidate>
                     <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
                     <input type="hidden" name="category" value="CARE_TEAM_MEMBER">
                     <input type="hidden" name="data">

+ 1 - 1
resources/views/app/patient/goals-center.blade.php

@@ -157,7 +157,7 @@ list($goals, $counts) = Point::getPointsOfCategoryExtended($patient, 'GOAL', $no
 
         <div class="d-flex align-items-center">
             <div class="mt-1 w-100 border p-3 bg-aliceblue border-info rounded">
-                <form action="/api/visitPoint/addTopLevel" class="mcp-theme-1 w-100" id="frm-add-goal">
+                <form action="/api/visitPoint/addTopLevel" class="mcp-theme-1 w-100" id="frm-add-goal" novalidate>
                     <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
                     <input type="hidden" name="category" value="GOAL">
                     <input type="hidden" name="data">

+ 1 - 1
resources/views/app/patient/medications-center.blade.php

@@ -172,7 +172,7 @@ list($medications, $counts) = Point::getPointsOfCategoryExtended($patient, 'MEDI
     <div class="d-flex align-items-center">
         <div class="mt-1 w-100 border p-3 bg-aliceblue border-info rounded">
             <!--<a href="#" start show class="btn btn-sm btn btn-outline-primary">+ Add new medication, prescribed during this visit</a>-->
-            <form action="/api/visitPoint/addTopLevel" class="mcp-theme-1 w-100" id="frm-add-medication">
+            <form action="/api/visitPoint/addTopLevel" class="mcp-theme-1 w-100" id="frm-add-medication" novalidate>
                 <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
                 <input type="hidden" name="category" value="MEDICATION">
                 <input type="hidden" name="data">

+ 1 - 1
resources/views/app/patient/problems-center.blade.php

@@ -189,7 +189,7 @@ $ccSegment = $note->getSegmentByInternalName('chief_complaint');
 
         <div class="d-flex align-items-center">
             <div class="mt-1 w-100 border p-3 bg-aliceblue border-info rounded">
-                <form action="/api/visitPoint/addTopLevel" class="mcp-theme-1 w-100" id="frm-add-problem">
+                <form action="/api/visitPoint/addTopLevel" class="mcp-theme-1 w-100" id="frm-add-problem" novalidate>
                     <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
                     <input type="hidden" name="category" value="PROBLEM">
                     <input type="hidden" name="data">

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

@@ -2,11 +2,11 @@
     <span class="font-weight-bold">Is this {{$label}} active?</span>
     <div class="d-flex align-items-baseline mt-1">
         <label class="my-0 d-inline-flex align-items-center">
-            <input type="radio" name="isRemoved" value="0" {{!$point || !$point->is_removed ? 'checked' : ''}}>
+            <input type="radio" name="isRemoved" required value="0" {{!$point || !$point->is_removed ? 'checked' : ''}}>
             <span class="ml-1">Yes</span>
         </label>
         <label class="ml-3 my-0 d-inline-flex align-items-center">
-            <input type="radio" name="isRemoved" value="1" {{$point && $point->is_removed ? 'checked' : ''}}>
+            <input type="radio" name="isRemoved" required value="1" {{$point && $point->is_removed ? 'checked' : ''}}>
             <span class="ml-1">No</span>
         </label>
     </div>

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

@@ -153,15 +153,27 @@ parentSegment.find('#frm-add-{{$label}}')
 
         let form = $(this);
 
+        // require additionReasonCategory if active
+        form.find('[name="additionReasonCategory"]').removeAttr('required');
+        if(!form.find('[name="additionReasonCategory"]:checked').length) {
+            if(form.find('[name="isRemoved"][value="0"]').is(':checked')) {
+                form.find('[name="additionReasonCategory"]').attr('required', 'required');
+            }
+        }
+
+        // require removalReasonCategory if not active
+        form.find('[name="removalReasonCategory"]').removeAttr('required');
+        if(!form.find('[name="removalReasonCategory"]:checked').length) {
+            if(form.find('[name="isRemoved"][value="1"]').is(':checked')) {
+                form.find('[name="removalReasonCategory"]').attr('required', 'required');
+            }
+        }
+
         if (!form[0].checkValidity()) {
             form[0].reportValidity();
             return false;
         }
 
-        if(!form.find('[name="additionReasonCategory"]:checked').length) {
-            form.find('[name="additionReasonCategory"][value="ON_INTAKE"]').prop('checked', true);
-        }
-
         // add [data-name] values to payload
         let dataField = form.find('[name="data"]').first();
         let parsed = null;