Explorar o código

Lifestyle modules - undo changes feature

Vijayakrishnan %!s(int64=3) %!d(string=hai) anos
pai
achega
ca647fe442

+ 7 - 0
resources/views/app/patient/modules/_undo_changes.blade.php

@@ -0,0 +1,7 @@
+@if($point->lastChildReview && $point->lastChildReview->added_in_note_id === $note->id)
+    <div class="d-block mb-2">
+        <a href="#" class="px-1 text-left" title="Undo Changes" v-on:click.prevent="undoChanges()">
+            <i class="fa fa-undo"></i> Undo Changes
+        </a>
+    </div>
+@endif

+ 13 - 1
resources/views/app/patient/modules/lifestyle_general/edit.blade.php

@@ -37,7 +37,6 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 }
 ?>
 <div class="p-3 mcp-theme-1">
-
     <div visit-moe close-on-save close-on-cancel class="d-block">
         <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
@@ -47,6 +46,8 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 
             <div id="edit-univ_sub_lifestyle_general-container">
 
+                @include('app.patient.modules._undo_changes', compact('point'))
+
                 <div class="row">
                     <div class="col-md-12">
                         <h5 class="bg-light p-1 font-weight-bold">GETTING STARTED</h5>
@@ -434,6 +435,17 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
                         let parent = $('#edit-univ_sub_lifestyle_general-container').closest('form');
                         parent.find('[name="data"]').val(JSON.stringify(this.data));
                         autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
                     }
                 }
             });

+ 14 - 0
resources/views/app/patient/modules/lifestyle_nutrition/edit.blade.php

@@ -77,6 +77,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 }
 ?>
 <div class="p-3 mcp-theme-1">
+
     <div visit-moe close-on-save close-on-cancel class="d-block">
         <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
@@ -86,6 +87,8 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 
             <div id="edit-univ_sub_nutrition_assessment-container">
 
+                @include('app.patient.modules._undo_changes', compact('point'))
+
                 <!-- 4-leaf survey -->
                 <p class="font-weight-bold my-3 font-size-14"><i>The 4Leaf Survey</i></p>
                 <div class="d-flex align-items-baseline mb-3">
@@ -1288,6 +1291,17 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
                         let parent = $('#edit-univ_sub_nutrition_assessment-container').closest('form');
                         parent.find('[name="data"]').val(JSON.stringify(this.data));
                         autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
                     }
                 }
             });

+ 15 - 0
resources/views/app/patient/modules/lifestyle_physical_activity/edit.blade.php

@@ -38,6 +38,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 }
 ?>
 <div class="p-3 mcp-theme-1">
+
     <div visit-moe close-on-save close-on-cancel class="d-block">
         <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
@@ -46,6 +47,9 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
             <input type="hidden" name="data" value="{{json_encode($contentData)}}">
 
             <div id="edit-univ_sub_physical_activity_assessment-container">
+
+                @include('app.patient.modules._undo_changes', compact('point'))
+
                 <p class="font-weight-bold my-3 font-size-14"><i>Exercise</i></p>
                 <p><b>EXERCISE HABITS: AEROBIC/CARDIO TRAINING</b></p>
                 <div class="d-flex align-items-baseline mb-3">
@@ -399,6 +403,17 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
                         let parent = $('#edit-univ_sub_physical_activity_assessment-container').closest('form');
                         parent.find('[name="data"]').val(JSON.stringify(this.data));
                         autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
                     }
                 }
             });

+ 15 - 0
resources/views/app/patient/modules/lifestyle_sleep/edit.blade.php

@@ -53,6 +53,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 }
 ?>
 <div class="p-3 mcp-theme-1">
+
     <div visit-moe close-on-save close-on-cancel class="d-block">
         <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
@@ -61,6 +62,9 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
             <input type="hidden" name="data" value="{{json_encode($contentData)}}">
 
             <div id="edit-univ_sub_sleep_assessment-container">
+
+                @include('app.patient.modules._undo_changes', compact('point'))
+
                 <div class="row">
                     <div class="col-md-12">
                         <h5 class="bg-light p-1 font-weight-bold">GETTING STARTED</h5>
@@ -795,6 +799,17 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
                         let parent = $('#edit-univ_sub_sleep_assessment-container').closest('form');
                         parent.find('[name="data"]').val(JSON.stringify(this.data));
                         autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
                     }
                 }
             });

+ 14 - 0
resources/views/app/patient/modules/lifestyle_social/edit.blade.php

@@ -30,6 +30,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 }
 ?>
 <div class="p-3 mcp-theme-1">
+
     <div visit-moe close-on-save close-on-cancel class="d-block">
         <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
@@ -39,6 +40,8 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 
             <div id="edit-univ_sub_social_relationships_assessment-container">
 
+                @include('app.patient.modules._undo_changes', compact('point'))
+
                 <div class="row">
                     <div class="col-md-12">
                         <h5 class="bg-light p-1 font-weight-bold">PURPOSE AND CONNECTION</h5>
@@ -280,6 +283,17 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
                         let parent = $('#edit-univ_sub_social_relationships_assessment-container').closest('form');
                         parent.find('[name="data"]').val(JSON.stringify(this.data));
                         autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
                     }
                 }
             });

+ 15 - 0
resources/views/app/patient/modules/lifestyle_stress/edit.blade.php

@@ -57,6 +57,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 }
 ?>
 <div class="p-3 mcp-theme-1">
+
     <div visit-moe close-on-save close-on-cancel class="d-block">
         <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
@@ -65,6 +66,9 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
             <input type="hidden" name="data" value="{{json_encode($contentData)}}">
 
             <div id="edit-univ_sub_stress_assessment-container">
+
+                @include('app.patient.modules._undo_changes', compact('point'))
+
                 <p class="font-weight-bold my-3 font-size-14"><i>Mental Health</i></p>
                 <p><b>PERCEIVED STRESS</b></p>
                 <div class="d-flex align-items-baseline mb-3">
@@ -684,6 +688,17 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
                         let parent = $('#edit-univ_sub_stress_assessment-container').closest('form');
                         parent.find('[name="data"]').val(JSON.stringify(this.data));
                         autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
                     }
                 }
             });

+ 14 - 0
resources/views/app/patient/modules/lifestyle_substances/edit.blade.php

@@ -59,6 +59,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 }
 ?>
 <div class="p-3 mcp-theme-1">
+
     <div visit-moe close-on-save close-on-cancel class="d-block">
         <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
@@ -68,6 +69,8 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 
             <div id="edit-univ_sub_substance_use_assessment-container">
 
+                @include('app.patient.modules._undo_changes', compact('point'))
+
                 <div class="row">
                     <div class="col-md-12">
                         <h5 class="bg-light p-1 font-weight-bold">SMOKING AND SUBSTANCE HISTORY</h5>
@@ -954,6 +957,17 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
                         let parent = $('#edit-univ_sub_substance_use_assessment-container').closest('form');
                         parent.find('[name="data"]').val(JSON.stringify(this.data));
                         autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
                     }
                 }
             });