Jelajahi Sumber

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

Vijayakrishnan 3 tahun lalu
induk
melakukan
60e4f92c3e
1 mengubah file dengan 11 tambahan dan 0 penghapusan
  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();
 
+                    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 => {
                         hideMask();
                         updateAllSegmentsInResponse(_data);
+                        if(closeOnSave) {
+                            noteSection.removeClass('edit');
+                        }
                     }, 'json');
                     return false;
                 });
@@ -98,6 +106,9 @@
                 .off('click.visit-moe-cancel')
                 .on('click.visit-moe-cancel', function() {
                     $(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;
                 });
         }