Просмотр исходного кода

Fix mc on fresh page load + open intake on "next patient"

Vijayakrishnan Krishnan 4 лет назад
Родитель
Сommit
632f662927

+ 13 - 0
public/js/mc.js

@@ -99,6 +99,16 @@ $(document).ready(function () {
     if(typeof initializeCalendar !== 'undefined') {
         initializeCalendar();
     }
+    if(typeof initIntakeEvents !== 'undefined') {
+        initIntakeEvents();
+    }
+
+    // replace history on fresh load
+    var target = window.top.location.pathname;
+    if (target.indexOf('/mc') === 0) {
+        target = target.split('/mc')[1];
+    }
+    window.top.history.pushState(target, null, '/mc' + target);
 });
 function enableTimeSpecificFields(_checked, _valueClass, _rangeClass) {
     if(_valueClass) $('.' + _valueClass).prop('disabled', _checked);
@@ -199,6 +209,9 @@ function onFastLoaded(_data, _href, _history) {
         if(typeof initializeCalendar !== 'undefined') {
             initializeCalendar();
         }
+        if(typeof initIntakeEvents !== 'undefined') {
+            initIntakeEvents();
+        }
 
         // push state
         if (_history) {

+ 13 - 11
resources/views/app/patient/intake.blade.php

@@ -242,16 +242,18 @@
     </style>
 
     <script>
-    	document.querySelectorAll('button.add').forEach(button =>
-    		button.addEventListener('click', function(){
-    			const parent = this.closest('li'),
-    			newEl = parent.previousElementSibling.cloneNode(true),
-    			newInput = newEl.querySelector('input')
+        function initIntakeEvents() {
+            document.querySelectorAll('button.add').forEach(button =>
+                button.addEventListener('click', function(){
+                    const parent = this.closest('li'),
+                        newEl = parent.previousElementSibling.cloneNode(true),
+                        newInput = newEl.querySelector('input')
 
-    			newInput.value = ''
-    			parent.before(newEl)
-    			newInput.focus()
-    		})
-    	)
+                    newInput.value = ''
+                    parent.before(newEl)
+                    newInput.focus()
+                })
+            )
+        }
 	</script>
-@endsection
+@endsection

+ 1 - 1
resources/views/app/video/call.blade.php

@@ -121,7 +121,7 @@
                                 self.startOpenTokSession();
 
                                 // navigate to this patient on LHS
-                                window.top.openInLHS('/patients/view/' + self.clientUid, true, false);
+                                window.top.openInLHS('/patients/view/' + self.clientUid + '/intake', true, false);
                             }
                         }
                     }, 'json');

+ 3 - 0
resources/views/layouts/patient.blade.php

@@ -30,6 +30,9 @@
                         <li class="nav-item">
                             <a class="nav-link" href="{{ route('patients.view.history', ['patient' => $patient]) }}">History</a>
                         </li>
+                        <li class="nav-item">
+                            <a class="nav-link" href="/patients/view/{{ $patient->uid }}/intake">Intake</a>
+                        </li>
                         <?php /*
                         <li class="nav-item">
                             <a class="nav-link" href="{{ route('patients.view.care-plan', ['patient' => $patient]) }}">Care Plan</a>