Răsfoiți Sursa

Show new patients to MCPs and NAs + ability to "accept" the assignment

Vijayakrishnan 3 ani în urmă
părinte
comite
88cad9290c
1 a modificat fișierele cu 48 adăugiri și 0 ștergeri
  1. 48 0
      resources/views/app/dashboard.blade.php

+ 48 - 0
resources/views/app/dashboard.blade.php

@@ -152,6 +152,29 @@
             </div>
             <div class="col-md-9">
 
+                <!-- new associations -->
+                @if(count($newMCPAssociations))
+                    <div class="mb-3 border rounded px-3 py-2 ack-container">
+                        <p class="pt-1 mb-2"><b>New Patients</b></p>
+                        @foreach($newMCPAssociations as $assoc)
+                            <div class="mb-1">You have been assigned as the MCP for {{$assoc->patient->displayName()}}.
+                            <a href="#" class="ack-client-pro-change" data-uid="{{$assoc->uid}}">Acknowledge</a>
+                            </div>
+                        @endforeach
+                    </div>
+                @endif
+
+                @if(count($newNAAssociations))
+                    <div class="mb-3 border rounded px-3 py-2 ack-container">
+                        <p class="pt-1 mb-2"><b>New Patients</b></p>
+                        @foreach($newNAAssociations as $assoc)
+                            <div class="mb-1">You have been assigned as the Care Coordinator for {{$assoc->patient->displayName()}}.
+                                <a href="#" class="ack-client-pro-change" data-uid="{{$assoc->uid}}">Acknowledge</a>
+                            </div>
+                        @endforeach
+                    </div>
+                @endif
+
                 <ul class="nav nav-tabs">
                     <li class="nav-item">
                         <a native data-tab="appointments" class="nav-link"
@@ -599,6 +622,31 @@
                     });
                     return false;
                 });
+
+            $(document)
+                .off('click', '.ack-client-pro-change')
+                .on('click', '.ack-client-pro-change', function() {
+                    let trigger = $(this).text('…');
+                    $.post('/api/clientProPage/accept', {
+                        uid: $(this).attr('data-uid')
+                    }, _data => {
+                        if(!hasResponseError(_data)) {
+                            trigger.hide();
+                            let doneElem = $('<i class="text-success fa fa-check"></i>');
+                            doneElem.insertAfter(trigger);
+                            setTimeout(() => {
+                                let ackContainer = trigger.closest('.ack-container');
+                                trigger.closest('div').slideUp('fast', function() {
+                                    $(this).remove();
+                                    if(!ackContainer.find('>div').length) {
+                                        ackContainer.remove();
+                                    }
+                                });
+                            }, 500);
+                        }
+                    }, 'json');
+                    return false;
+                });
         }
         addMCInitializer('pro-dashboard', init, '#pro-dashboard-container');
     })();