Browse Source

Stag popup feature - [update-target]

Vijayakrishnan 3 years ago
parent
commit
e3923b6178

+ 1 - 1
config/app.php

@@ -65,7 +65,7 @@ return [
 
 
     'hrm2_url' => env('HRM2_URL'),
     'hrm2_url' => env('HRM2_URL'),
 
 
-    'asset_version' => 23,
+    'asset_version' => 24,
 
 
     'temp_dir' => env('TEMP_DIR'),
     'temp_dir' => env('TEMP_DIR'),
 
 

+ 11 - 4
public/js/stag-popup.js

@@ -50,7 +50,7 @@ function closeStagPopup(_noEvent = false) {
                 refreshDynamicStagPopup();
                 refreshDynamicStagPopup();
             }
             }
             else {
             else {
-                fastReload();
+                fastReload(popup.is('[update-target]') ? popup.attr('update-target') : '');
                 return;
                 return;
             }
             }
         }
         }
@@ -81,7 +81,7 @@ function convertContentLinksForInPopupNavigation(popup) {
         }
         }
     });
     });
 }
 }
-function openDynamicStagPopup(_url, initer, title, updateParent, style = '', replace = false) {
+function openDynamicStagPopup(_url, initer, title, updateParent, style = '', replace = false, updateTarget = null) {
     let url = _url;
     let url = _url;
     if(url.indexOf('popupmode') === -1) {
     if(url.indexOf('popupmode') === -1) {
         url += (url.indexOf('?') !== -1 ? '&' : '?') + 'popupmode=1';
         url += (url.indexOf('?') !== -1 ? '&' : '?') + 'popupmode=1';
@@ -134,6 +134,10 @@ function openDynamicStagPopup(_url, initer, title, updateParent, style = '', rep
                 popup.removeAttr('update-parent');
                 popup.removeAttr('update-parent');
             }
             }
             showStagPopup(url, true);
             showStagPopup(url, true);
+
+            if(updateTarget) {
+                popup.attr('update-target', updateTarget);
+            }
         }
         }
 
 
         if(initer) runMCInitializer(initer);
         if(initer) runMCInitializer(initer);
@@ -218,7 +222,9 @@ function hasResponseError(_data) {
                     trig.attr('mc-initer'),
                     trig.attr('mc-initer'),
                     trig.attr('title'),
                     trig.attr('title'),
                     trig.is('[update-parent]'),
                     trig.is('[update-parent]'),
-                    trig.attr('popup-style')
+                    trig.attr('popup-style'),
+                    false,
+                    trig.is('[update-target]') ? trig.attr('update-target') : null
                 );
                 );
                 return false;
                 return false;
             });
             });
@@ -233,7 +239,8 @@ function hasResponseError(_data) {
                     trig.attr('title'),
                     trig.attr('title'),
                     null, // will be inherited when replacing
                     null, // will be inherited when replacing
                     null, // will be inherited when replacing
                     null, // will be inherited when replacing
-                    true
+                    true,
+                    null
                 );
                 );
                 return false;
                 return false;
             });
             });

+ 33 - 30
resources/views/app/mcp/dashboard/measurements-pending-stamping.blade.php

@@ -1,37 +1,39 @@
+<div id="dashboard-measurements-pending-stamping">
 @if($measurementsPendingStamping && count($measurementsPendingStamping))
 @if($measurementsPendingStamping && count($measurementsPendingStamping))
     <table class="table table-sm table-striped mb-0">
     <table class="table table-sm table-striped mb-0">
-            <thead>
+        <thead>
+        <tr>
+            <th class="border-bottom-0 border-top-0 text-secondary">Patient</th>
+            <th class="border-bottom-0 border-top-0 text-secondary">Care Month</th>
+            <th class="border-bottom-0 border-top-0 text-secondary">Meas.</th>
+        </tr>
+        </thead>
+        <tbody>
+        @foreach($measurementsPendingStamping as $row)
             <tr>
             <tr>
-                <th class="border-bottom-0 border-top-0 text-secondary">Patient</th>
-                <th class="border-bottom-0 border-top-0 text-secondary">Care Month</th>
-                <th class="border-bottom-0 border-top-0 text-secondary">Meas.</th>
+                <td class="pl-2">
+                    <a href="{{ route('patients.view.dashboard', $row->patient) }}">
+                        {{$row->patient->displayName()}}
+                    </a>
+                </td>
+                <td>
+                    <a native target="_blank"
+                       open-in-stag-popup
+                       update-parent
+                       update-target="#dashboard-measurements-pending-stamping"
+                       mc-initer="cm-matrix-{{$row->patient->id}}"
+                       title="Care Month Matrix: {{date('M Y', strtotime($row->start_date))}}"
+                       href="/patient-care-month-matrix/{{$row->uid}}">
+                        {{ friendly_month($row->start_date) }}
+                    </a>
+                </td>
+                <td>
+                    {{ $row->rm_num_measurements_not_stamped_by_mcp }}
+                </td>
             </tr>
             </tr>
-            </thead>
-            <tbody>
-            @foreach($measurementsPendingStamping as $row)
-                <tr>
-                    <td class="pl-2">
-                        <a href="{{ route('patients.view.dashboard', $row->patient) }}">
-                            {{$row->patient->displayName()}}
-                        </a>
-                    </td>
-                    <td>
-                        <a native target="_blank"
-                           open-in-stag-popup
-                           update-parent
-                           mc-initer="cm-matrix-{{$row->patient->id}}"
-                           title="Care Month Matrix: {{date('M Y', strtotime($row->start_date))}}"
-                           href="/patient-care-month-matrix/{{$row->uid}}">
-                            {{ friendly_month($row->start_date) }}
-                        </a>
-                    </td>
-                    <td>
-                        {{ $row->rm_num_measurements_not_stamped_by_mcp }}
-                    </td>
-                </tr>
-            @endforeach
-            </tbody>
-        </table>
+        @endforeach
+        </tbody>
+    </table>
     <div class="m-2">
     <div class="m-2">
         {{ $measurementsPendingStamping->onEachSide(0)->withQueryString()->links() }}
         {{ $measurementsPendingStamping->onEachSide(0)->withQueryString()->links() }}
     </div>
     </div>
@@ -40,3 +42,4 @@
         No measurement pending stamping
         No measurement pending stamping
     </div>
     </div>
 @endif
 @endif
+</div>