ソースを参照

Dashboard - show appt info with client-pro assoc notifs

Vijayakrishnan 3 年 前
コミット
7deb50f259
2 ファイル変更38 行追加5 行削除
  1. 9 0
      app/Models/Client.php
  2. 29 5
      resources/views/app/dashboard.blade.php

+ 9 - 0
app/Models/Client.php

@@ -313,6 +313,15 @@ class Client extends Model
             ->limit(5);
     }
 
+    public function nextAppointment() {
+        return Appointment
+            ::where('client_id', $this->id)
+            ->where('raw_date', '>=', DB::raw('NOW()'))
+            ->whereIn('status', ['CONFIRMED', 'CREATED'])
+            ->orderBy('start_time')
+            ->first();
+    }
+
     public function appointmentsFromLastWeek()
     {
 

+ 29 - 5
resources/views/app/dashboard.blade.php

@@ -271,8 +271,20 @@
                             <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
-                                        <span class="d-inline-block width-150px"><a href="/patients/view/{{$assoc->patient->uid}}" class="">{{$assoc->patient->displayName()}}</a>.</span>
+                                    <div class="d-flex align-items-start bg-light mb-2 px-2 py-1">
+                                        <div class="flex-grow-1">
+                                            You are now the MCP for
+                                            <a href="/patients/view/{{$assoc->patient->uid}}" class="">{{$assoc->patient->displayName()}}</a>
+                                            <?php $nextAppt = $assoc->patient->nextAppointment(); ?>
+                                            @if($nextAppt)
+                                                <div class="font-size-11">
+                                                    <span class="text-secondary font-size-11">Appt.</span>
+                                                    {{$nextAppt->pro->displayName()}}
+                                                    <span class="text-secondary font-size-11">on</span>
+                                                    {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
+                                                </div>
+                                            @endif
+                                        </div>
                                         <a href="#" class="ack-client-pro-change ml-3" data-uid="{{$assoc->uid}}">Stamp</a>
                                     </div>
                                 @endforeach
@@ -283,9 +295,21 @@
                             <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
-                                        <span class="d-inline-block width-150px"><a href="/patients/view/{{$assoc->patient->uid}}" class="">{{$assoc->patient->displayName()}}</a>.</span>
-                                        <a href="#" class="ack-client-pro-change ml-3" data-uid="{{$assoc->uid}}">Stamp</a>
+                                    <div class="d-flex align-items-start bg-light mb-2 px-2 py-1">
+                                        <div class="flex-grow-1">
+                                            You are now the Care Coordinator for
+                                            <a href="/patients/view/{{$assoc->patient->uid}}" class="">{{$assoc->patient->displayName()}}</a>
+                                            <?php $nextAppt = $assoc->patient->nextAppointment(); ?>
+                                            @if($nextAppt)
+                                                <div class="font-size-11">
+                                                    <span class="text-secondary font-size-11">Appt.</span>
+                                                    {{$nextAppt->pro->displayName()}}
+                                                    <span class="text-secondary font-size-11">on</span>
+                                                    {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
+                                                </div>
+                                            @endif
+                                        </div>
+                                        <a href="#" class="ack-client-pro-change" data-uid="{{$assoc->uid}}">Stamp</a>
                                     </div>
                                 @endforeach
                             </div>