浏览代码

BMI mgmt form - height in ft/in

Vijayakrishnan 3 年之前
父节点
当前提交
a6db80f887

+ 2 - 2
app/Helpers/helpers.php

@@ -677,9 +677,9 @@ if(!function_exists('vsValue')) {
     }
 }
 if(!function_exists('vsElement')) {
-    function vsElement($_v, $type, $name, $patient)
+    function vsElement($_v, $type, $name, $patient, $class = '')
     {
-        return '<input type="' . $type . '" class="form-control form-control-sm min-width-unset rounded-0" ' .
+        return '<input type="' . $type . '" class="form-control form-control-sm min-width-unset rounded-0 ' . $class . '" ' .
             'name="' . $name . '" ' .
             'value="' . (@($patient->{$_v}) ? $patient->{$_v} : '') . '">';
     }

+ 10 - 0
resources/views/app/patient/note/dashboard.blade.php

@@ -802,6 +802,16 @@
                                         });
 
                                 $('#bmi-management-settings [name="currentHeightInInches"]').trigger('change');
+
+                                let parentSegment = $('#bmi-management-settings');
+                                parentSegment.find('[heightFeetInput], [heightInchesInput]').off('change input paste');
+                                parentSegment.find('[heightFeetInput], [heightInchesInput]').on('change input paste', function () {
+                                    let inches = 0;
+                                    let ft = +(parentSegment.find('[heightFeetInput]').val()),
+                                        inc = +(parentSegment.find('[heightInchesInput]').val());
+                                    inches = Math.round(ft * 12 + inc);
+                                    parentSegment.find('[name="currentHeightInInches"]').val(inches).trigger('change');
+                                });
                             }
 
                             addMCInitializer('vitals-settings-{{$patient->uid}}', init, '#vitals-settings-{{$patient->uid}}')

+ 24 - 2
resources/views/app/patient/vitals-settings/bmi-management-form.blade.php

@@ -6,8 +6,19 @@
 
         <div class="mb-3 d-flex align-items-center">
             <span class="text-secondary min-width-140px">Current Height:</span>
-            <div class="width-100px mr-2"><?= vsElement('current_height_in_inches', 'number', 'currentHeightInInches', $patient) ?></div>
-            <span class="text-secondary">(in.)</span>
+            <div class="width-50px mr-1">
+                <input type="text" name="current_height_FT" class="form-control form-control-sm min-width-unset rounded-0"
+                       heightFeetInput
+                       value="{{feetFromInches($patient->current_height_in_inches)}}">
+            </div>
+            <span class="text-secondary mr-2">ft.</span>
+            <div class="width-50px mr-1">
+                <input type="text" name="current_height_IN" class="form-control form-control-sm min-width-unset rounded-0"
+                       heightInchesInput
+                       value="{{inchesAfterFeetFromInches($patient->current_height_in_inches)}}">
+            </div>
+            <span class="text-secondary mr-2">in.</span>
+            <?= vsElement('current_height_in_inches', 'hidden', 'currentHeightInInches', $patient) ?>
         </div>
 
         <hr class="my-3">
@@ -173,6 +184,17 @@
             for (let i = 1; i <= 4; i++) {
                 initICDAutoSuggest($('[name="whyIsWeightMonitoringNeededIcd' + i + '"]'), $('[name="whyIsWeightMonitoringNeededDescription' + i + '"]'));
             }
+
+            let parentSegment = $('#bmi-management-settings');
+            parentSegment.find('[heightFeetInput], [heightInchesInput]').off('change input paste');
+            parentSegment.find('[heightFeetInput], [heightInchesInput]').on('change input paste', function () {
+                debugger
+                let inches = 0;
+                let ft = +(parentSegment.find('[heightFeetInput]').val()),
+                    inc = +(parentSegment.find('[heightInchesInput]').val());
+                inches = Math.round(ft * 12 + inc);
+                parentSegment.find('[name="currentHeightInInches"]').val(inches).trigger('change');
+            });
         }
 
         addMCInitializer('bmi-management-settings', init, '#bmi-management-settings');