Browse Source

Flowsheets - init via mc initializer

Vijayakrishnan 4 years ago
parent
commit
82f1faa3d7
1 changed files with 12 additions and 9 deletions
  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