浏览代码

Flowsheets - init via mc initializer

Vijayakrishnan 4 年之前
父节点
当前提交
82f1faa3d7
共有 1 个文件被更改,包括 12 次插入9 次删除
  1. 12 9
      resources/views/app/patient/flowsheets.blade.php

+ 12 - 9
resources/views/app/patient/flowsheets.blade.php

@@ -3,7 +3,7 @@
     <?php $pro->pro_type = 'ADMIN'; ?>
     <link href="/select2/select2.min.css" rel="stylesheet" />
     <script src="/select2/select2.min.js"></script>
-    <div>
+    <div id="flowsheetsComponent">
         <div class="d-flex align-items-center pb-3">
             <h4 class="font-weight-bold m-0">Flowsheets</h4>
             {{-- progams filter --}}
@@ -149,14 +149,17 @@
             $('tbody[data-program-uid="' + _uid + '"]').addClass('collapsed');
             return false;
         }
-        $(document).ready(function() {
-            window.setTimeout(() => {
-                let td = $('.flowsheets-table').find('td').last().get(0);
-                if(td) {
-                    td.scrollIntoView({block: "nearest", behavior: "smooth"});
-                }
-            }, 50);
-        });
+        (function() {
+            function init() {
+                window.setTimeout(() => {
+                    let td = $('.flowsheets-table').find('td').last().get(0);
+                    if(td) {
+                        td.scrollIntoView({block: "nearest", behavior: "smooth"});
+                    }
+                }, 50);
+            }
+            addMCInitializer('flowsheets', init, '#flowsheetsComponent');
+        }).call(window);
     </script>
 
     @endif