瀏覽代碼

Merge branch 'b' into cleanup

Samson Mutunga 1 年之前
父節點
當前提交
01c3516400

+ 23 - 0
app/Models/Pro.php

@@ -1496,6 +1496,18 @@ ORDER BY cm.created_at DESC
             ->orderBy('raw_date', 'asc')
             ->get();
     }
+
+    public function getAppointmentsPendingStatusChangeAckAsRd() {
+        $myId = $this->id;
+        return Appointment::whereHas('client', function($clientQuery) use ($myId){
+            return $clientQuery->where('rd_pro_id', $myId);
+        })
+            ->where('is_status_acknowledgement_from_appointment_pro_pending', true)
+            ->where('raw_date', '>=', DB::raw('NOW()'))
+            ->orderBy('raw_date', 'asc')
+            ->get();
+    }
+
     public function getAppointmentsPendingDecisionAckAsDna() {
         $myId = $this->id;
         return Appointment::whereHas('client', function($clientQuery) use ($myId){
@@ -1506,6 +1518,17 @@ ORDER BY cm.created_at DESC
             ->orderBy('raw_date', 'asc')
             ->get();
     }
+    public function getAppointmentsPendingDecisionAckAsRd() {
+        $myId = $this->id;
+        return Appointment::whereHas('client', function($clientQuery) use ($myId){
+            return $clientQuery->where('rd_pro_id', $myId);
+        })
+            ->where('is_decision_acknowledgement_from_appointment_pro_pending', true)
+            ->where('raw_date', '>=', DB::raw('NOW()'))
+            ->orderBy('raw_date', 'asc')
+            ->get();
+    }
+
     public function getAppointmentsPendingTimeChangeAckAsDna() {
         $myId = $this->id;
         return Appointment::whereHas('client', function($clientQuery) use ($myId){

+ 3 - 3
resources/views/app/rd/dashboard.blade.php

@@ -210,9 +210,9 @@
                                         @include('app.rd.dashboard.client-charts-pending-my-review')
                                     </div>
                                 </div>
-
-
-
+                            </div>
+                            <div class="col-md-6 mcp-theme-1">
+                                @include('app.rd.dashboard.notifications')
                             </div>
                             <div class="col-md-6 mcp-theme-1">
                                 <div class="card mb-4">

+ 69 - 0
resources/views/app/rd/dashboard/notifications.blade.php

@@ -0,0 +1,69 @@
+<?php
+
+$apptsPending = [
+    'status' => $pro->getAppointmentsPendingStatusChangeAckAsRd(),
+    'decision' => $pro->getAppointmentsPendingDecisionAckAsRd(),
+];
+
+?>
+@if (!count($apptsPending['status']) && !count($apptsPending['decision']))
+    <div class="card mb-4">
+        <div class="card-header pl-2">
+            <strong>
+                Appointment Changes
+            </strong>
+        </div>
+        <div class="card-body">
+            No appointment changes
+        </div>
+    </div>
+@endif
+@if (count($apptsPending['status']))
+    <b class="text-secondary my-2 d-block">Appointment Status Changes</b>
+    @foreach ($apptsPending['status'] as $appt)
+        <div class="d-flex mb-1">
+            <div>
+                <a href="/patients/view/{{ $appt->client->uid }}"><b>{{ $appt->client->displayName() }}</b></a>
+                <span class="ml-2">{{ friendlier_date_time($appt->start_time) }}</span>
+                <span class="ml-2">{{ $appt->status }}</span>
+                @if ($appt->status_memo)
+                    <div class="text-secondary text-sm">{{ $appt->status_memo }} This is a status memo</div>
+                @endif
+            </div>
+            @if ($appt->pro_id == $pro->id)
+                <div moe relative class="ml-auto">
+                    <form show url="/api/appointment/acknowledgeStatusAsAppointmentPro">
+                        <input type="hidden" name="uid" value="{{ $appt->uid }}">
+                        <input type="hidden" name="currentStatus" value="{{ $appt->status }}">
+                        @if ($appt->status_memo !== null)
+                            <input type="hidden" name="currentStatusMemo" value="{{ $appt->status_memo }}">
+                        @endif
+                        <input type="hidden" name="currentRawDate" value="{{ $appt->raw_date }}">
+                        <input type="hidden" name="currentRawStartTime" value="{{ $appt->raw_start_time }}">
+                        <input type="hidden" name="currentRawEndTime" value="{{ $appt->raw_end_time }}">
+                        <input type="hidden" name="currentTimezone" value="{{ $appt->timezone }}">
+                        <button submit class="bg-transparent border-0 p-0 text-primary">Acknowledge</button>
+                    </form>
+                </div>
+            @endif
+        </div>
+    @endforeach
+@endif
+@if (count($apptsPending['decision']))
+    <b class="text-secondary my-2 d-block">Appointment Confirmation Changes</b>
+    @foreach ($apptsPending['decision'] as $appt)
+        <div class="d-flex mb-1">
+            <a href="/patients/view/{{ $appt->client->uid }}"><b>{{ $appt->client->displayName() }}</b></a>
+            <span class="ml-2">{{ friendlier_date_time($appt->start_time) }}</span>
+            <span class="ml-2">{{ $appt->latestConfirmationDecision->decision_enum }}</span>
+            @if ($appt->pro_id == $pro->id)
+                <div moe relative class="ml-auto">
+                    <form show url="/api/appointment/acknowledgeDecisionAsAppointmentPro">
+                        <input type="hidden" name="uid" value="{{ $appt->uid }}">
+                        <button submit class="bg-transparent border-0 p-0 text-primary">Acknowledge</button>
+                    </form>
+                </div>
+            @endif
+        </div>
+    @endforeach
+@endif