فهرست منبع

Merge branch 'cleanup' of https://rav.triplestart.com/tigerphp/stagfe2 into cleanup

Peter Muturi 1 سال پیش
والد
کامیت
cb5853cb30
3فایلهای تغییر یافته به همراه115 افزوده شده و 7 حذف شده
  1. 26 3
      app/Models/Pro.php
  2. 4 4
      resources/views/app/rd/dashboard.blade.php
  3. 85 0
      resources/views/app/rd/dashboard/notifications.blade.php

+ 26 - 3
app/Models/Pro.php

@@ -777,9 +777,9 @@ WHERE
             ->count();
 
         $reimbursement = [];
-        $reimbursement["currentBalance"] =  $performer->pro->balance;
+        $reimbursement["currentBalance"] =  $this->performer->pro->balance;
         $reimbursement["nextPaymentDate"] = '--';
-        $lastPayment = ProTransaction::where('pro_id', $performerProID)->where('plus_or_minus', 'PLUS')->orderBy('created_at', 'DESC')->first();
+        $lastPayment = ProTransaction::where('pro_id', $this->performer->pro->id)->where('plus_or_minus', 'PLUS')->orderBy('created_at', 'DESC')->first();
         if ($lastPayment) {
             $reimbursement["lastPayment"] =  $lastPayment->amount;
             $reimbursement["lastPaymentDate"] = $lastPayment->created_at;
@@ -1492,10 +1492,22 @@ ORDER BY cm.created_at DESC
             return $clientQuery->where('default_na_pro_id', $myId);
         })
             ->where('is_status_acknowledgement_from_appointment_pro_pending', true)
-            ->where('raw_date', '>=', DB::raw('NOW()'))
+            // ->where('raw_date', '>=', DB::raw('NOW()'))
             ->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){

+ 4 - 4
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">
@@ -222,7 +222,7 @@
                                         </strong>
                                     </div>
                                     <div class="card-body p-0">
-                                        @include('app.dna.dashboard.messages')
+                                        @include('app.rd.dashboard.messages')
                                     </div>
                                 </div>
 

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

@@ -0,0 +1,85 @@
+<?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']))
+    <div class="card mb-4">
+        <div class="card-header pl-2">
+            <strong>
+                Appointment Status Changes
+            </strong>
+        </div>
+        <div class="card-body">
+            @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
+        </div>
+    </div>
+@endif
+@if (count($apptsPending['decision']))
+    <div class="card mb-4">
+        <div class="card-header pl-2">
+            <strong>
+                Appointment Confirmation Changes
+            </strong>
+        </div>
+        <div class="card-body">
+            @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
+        </div>
+    </div>
+@endif