Browse Source

Visit moe - support for [close-on-save] and [close-on-cancel]

Vijayakrishnan 3 years ago
parent
commit
60e4f92c3e
1 changed files with 11 additions and 0 deletions
  1. 11 0
      resources/views/app/patient/note/segment_script.blade.php

+ 11 - 0
resources/views/app/patient/note/segment_script.blade.php

@@ -76,9 +76,17 @@
 
 
                     showMask();
                     showMask();
 
 
+                    let closeOnSave = false, noteSection = form.closest('.note-section');
+                    if($(this).closest('[visit-moe]').is('[close-on-save]')) {
+                        closeOnSave = true;
+                    }
+
                     $.post(form.attr('url'), form.serialize(), _data => {
                     $.post(form.attr('url'), form.serialize(), _data => {
                         hideMask();
                         hideMask();
                         updateAllSegmentsInResponse(_data);
                         updateAllSegmentsInResponse(_data);
+                        if(closeOnSave) {
+                            noteSection.removeClass('edit');
+                        }
                     }, 'json');
                     }, 'json');
                     return false;
                     return false;
                 });
                 });
@@ -98,6 +106,9 @@
                 .off('click.visit-moe-cancel')
                 .off('click.visit-moe-cancel')
                 .on('click.visit-moe-cancel', function() {
                 .on('click.visit-moe-cancel', function() {
                     $(this).closest('[visit-moe]').find('[url]:not([show])').hide();
                     $(this).closest('[visit-moe]').find('[url]:not([show])').hide();
+                    if($(this).closest('[visit-moe]').is('[close-on-cancel]')) {
+                        $(this).closest('.note-section').removeClass('edit');
+                    }
                     return false;
                     return false;
                 });
                 });
         }
         }