Explorar el Código

All wizards - copying subj/plan values into new row - fix

Vijayakrishnan hace 3 años
padre
commit
2ad892bfb9

+ 13 - 1
resources/views/app/patient/wizard-partials/common-script.blade.php

@@ -835,12 +835,15 @@ function getOrCreateRowAfter(_tr) {
     let tr = getRowAfter(_tr);
     if(!tr.length) {
         tr = newRow(_tr).insertAfter(_tr);
+        __initRTEs(parentSegment.find('[note-rte]:not(.ql-container)'));
     }
     return tr;
 }
 
 function createRowAfter(_tr) {
-    return newRow(_tr).insertAfter(_tr);
+    let tr = newRow(_tr).insertAfter(_tr);
+    __initRTEs(parentSegment.find('[note-rte]:not(.ql-container)'));
+    return tr;
 }
 
 function newRow(_tr) {
@@ -849,6 +852,13 @@ function newRow(_tr) {
     newTr.find('textarea').attr('rows', 1).css({minHeight: '', height: ''});
     newTr.find('[stag-suggest-initialized]').removeAttr('stag-suggest-initialized');
     newTr.find('.stag-suggestions-container').remove();
+    newTr.find('div[note-rte][key][bucket]').each(function() {
+        let newRTE = $('<div note-rte class="rte-holder" ' +
+            'key="' + $(this).attr('key') + '" ' +
+            'bucket="' + $(this).attr('bucket') + '" ' +
+            '/>');
+        $(this).closest('td').empty().append(newRTE);
+    });
     return newTr;
 }
 
@@ -957,6 +967,7 @@ parentSegment
         let isFirst = (tr.index() === 0);
         if(isFirst) {
             newRow(tr).insertAfter(tr);
+            __initRTEs(parentSegment.find('[note-rte]:not(.ql-container)'));
         }
         tr.remove();
         return false;
@@ -967,6 +978,7 @@ parentSegment
     .on('click.add-line', '.stag-sheet .add-line', function() {
         let tr = $(this).closest('tr');
         newRow(tr).insertAfter(tr);
+        __initRTEs(parentSegment.find('[note-rte]:not(.ql-container)'));
         initStagSuggest();
         return false;
     });