Vijayakrishnan 3 лет назад
Родитель
Сommit
dd4cf20f85

+ 1 - 34
app/Http/Controllers/HomeController.php

@@ -386,38 +386,6 @@ class HomeController extends Controller
             ->whereNull('current_client_pro_change_decision_id')
             ->get();
 
-        $proApptUpdates = AppointmentConfirmationDecision
-            ::select('appointment_confirmation_decision.uid', 'client.name_first', 'client.name_last', 'appointment.start_time')
-            ->rightJoin('appointment', 'appointment.id', '=', 'appointment_confirmation_decision.appointment_id')
-            ->rightJoin('client', 'client.id', '=', 'appointment.client_id')
-            ->where('appointment_confirmation_decision.was_acknowledged_by_appointment_pro', false)
-            ->where('appointment.status', '!=', 'CREATED') // WIP: ALIX overhaul
-            ->where('appointment.status', '!=', 'COMPLETED')
-            ->where('appointment.pro_id', $performerProID)
-            ->where('client.mcp_pro_id', $performerProID)
-            ->orderBy('appointment.start_time', 'DESC')
-            ->get();
-
-        $naApptUpdates = AppointmentConfirmationDecision
-            ::select('appointment_confirmation_decision.uid', 'client.name_first', 'client.name_last', 'pro.name_first as pro_name_first', 'pro.name_last as pro_name_last', 'appointment.start_time')
-            ->rightJoin('appointment', 'appointment.id', '=', 'appointment_confirmation_decision.appointment_id')
-            ->rightJoin('client', 'client.id', '=', 'appointment.client_id')
-            ->rightJoin('pro', 'pro.id', '=', 'appointment.pro_id')
-            ->where('appointment_confirmation_decision.was_acknowledged_by_client_default_na', false)
-            ->where('appointment.status', '!=', 'CREATED') // WIP: ALIX overhaul
-            ->where('appointment.status', '!=', 'COMPLETED')
-            ->where('client.default_na_pro_id', $performerProID)
-            ->orderBy('appointment.start_time', 'DESC')
-            ->get();
-
-//        $naApptUpdates = AppointmentConfirmationDecision
-//            ::join('appointment', 'appointment.id', '=', 'appointment_confirmation_decision.appointment_id')
-//            ->join('client', 'client.id', '=', 'appointment.client_id')
-//            ->where('client.default_na_pro_id', $performerProID)
-//            ->where('appointment_confirmation_decision.was_acknowledged_by_client_default_na', false)
-//            ->orderBy('appointment.start_time DESC')
-//            ->get();
-
         // unstamped client memos
         // for mcp
         $mcpClientMemos = DB::select(
@@ -554,8 +522,7 @@ WHERE cl.shadow_pro_id IS NULL
             'incomingReports', 'tickets', 'supplyOrders',
             'numERx', 'numLabs', 'numImaging', 'numSupplyOrders',
             'newMCPAssociations', 'newNAAssociations',
-            'mcpClientMemos', 'naClientMemos',
-            'proApptUpdates', 'naApptUpdates'));
+            'mcpClientMemos', 'naClientMemos'));
     }
 
     private function dashboard_DNA(Request $request){

+ 22 - 0
app/Models/Pro.php

@@ -491,6 +491,28 @@ WHERE
         }
     }
 
+    public function getAppointmentsPendingStatusChangeAck() {
+        return Appointment::where('pro_id', $this->id)
+            ->where('is_status_acknowledgement_from_appointment_pro_pending', true)
+            ->where('raw_date', '>=', DB::raw('NOW()'))
+            ->orderBy('raw_date', 'asc')
+            ->get();
+    }
+    public function getAppointmentsPendingDecisionAck() {
+        return Appointment::where('pro_id', $this->id)
+            ->where('is_decision_acknowledgement_from_appointment_pro_pending', true)
+            ->where('raw_date', '>=', DB::raw('NOW()'))
+            ->orderBy('raw_date', 'asc')
+            ->get();
+    }
+    public function getAppointmentsPendingTimeChangeAck() {
+        return Appointment::where('pro_id', $this->id)
+            ->where('is_time_change_acknowledgement_from_appointment_pro_pending', true)
+            ->where('raw_date', '>=', DB::raw('NOW()'))
+            ->orderBy('raw_date', 'asc')
+            ->get();
+    }
+
     public function getAccessibleClientsQuery($_search = false) {
         $proID = $this->id;
         $query = Client::whereNull('shadow_pro_id');

+ 0 - 57
resources/views/app/dashboard-admin.blade.php

@@ -191,63 +191,6 @@
                     <div class="row">
                         <div class="col-6">
 
-                            <!-- Appointment Updates -->
-                            @if(count($proApptUpdates))
-                                <div class="mb-3 border rounded px-3 py-2 ack-container">
-                                    <p class="pt-1 mb-2"><b>Appointment Updates</b></p>
-                                    <table class="table table-sm table-hover table-bordered mb-0">
-                                        <thead>
-                                        <tr>
-                                            <th>Client</th>
-                                            <th>Appt. Date/Time</th>
-                                            <th>Status</th>
-                                            <th></th>
-                                        </tr>
-                                        </thead>
-                                        <tbody>
-                                        @foreach($proApptUpdates as $update)
-                                            <tr>
-                                                <td>{{$update->name_first}} {{$update->name_last}}</td>
-                                                <td>{{friendlier_date_time($update->start_time)}}</td>
-                                                <td>{{$update->status}}</td>
-                                                <td><a href="#" class="ack-pro-appt-update" data-uid="{{$update->uid}}">Acknowledge</a>
-                                                </td>
-                                            </tr>
-                                        @endforeach
-                                        </tbody>
-                                    </table>
-                                </div>
-                            @endif
-
-                            @if(count($naApptUpdates))
-                                <div class="mb-3 border rounded px-3 py-2 ack-container">
-                                    <p class="pt-1 mb-2"><b>Appointment Updates</b></p>
-                                    <table class="table table-sm table-hover table-bordered mb-0">
-                                        <thead>
-                                        <tr>
-                                            <th>Client</th>
-                                            <th>Pro</th>
-                                            <th>Appt. Date/Time</th>
-                                            <th>Status</th>
-                                            <th></th>
-                                        </tr>
-                                        </thead>
-                                        <tbody>
-                                        @foreach($naApptUpdates as $update)
-                                            <tr>
-                                                <td>{{$update->name_first}} {{$update->name_last}}</td>
-                                                <td>{{$update->pro_name_first}} {{$update->pro_name_last}}</td>
-                                                <td>{{friendlier_date_time($update->start_time)}}</td>
-                                                <td>{{$update->status}}</td>
-                                                <td><a href="#" class="ack-na-appt-update" data-uid="{{$update->uid}}">Acknowledge</a>
-                                                </td>
-                                            </tr>
-                                        @endforeach
-                                        </tbody>
-                                    </table>
-                                </div>
-                            @endif
-
                         <!-- new associations -->
                             @if(count($newMCPAssociations))
                                 <div class="mb-3 border rounded px-3 py-2 ack-container">

+ 0 - 57
resources/views/app/dashboard-dna.blade.php

@@ -191,63 +191,6 @@
                     <div class="row">
                         <div class="col-6">
 
-                            <!-- Appointment Updates -->
-                            @if(count($proApptUpdates))
-                                <div class="mb-3 border rounded px-3 py-2 ack-container">
-                                    <p class="pt-1 mb-2"><b>Appointment Updates</b></p>
-                                    <table class="table table-sm table-hover table-bordered mb-0">
-                                        <thead>
-                                        <tr>
-                                            <th>Client</th>
-                                            <th>Appt. Date/Time</th>
-                                            <th>Status</th>
-                                            <th></th>
-                                        </tr>
-                                        </thead>
-                                        <tbody>
-                                        @foreach($proApptUpdates as $update)
-                                            <tr>
-                                                <td>{{$update->name_first}} {{$update->name_last}}</td>
-                                                <td>{{friendlier_date_time($update->start_time)}}</td>
-                                                <td>{{$update->status}}</td>
-                                                <td><a href="#" class="ack-pro-appt-update" data-uid="{{$update->uid}}">Acknowledge</a>
-                                                </td>
-                                            </tr>
-                                        @endforeach
-                                        </tbody>
-                                    </table>
-                                </div>
-                            @endif
-
-                            @if(count($naApptUpdates))
-                                <div class="mb-3 border rounded px-3 py-2 ack-container">
-                                    <p class="pt-1 mb-2"><b>Appointment Updates</b></p>
-                                    <table class="table table-sm table-hover table-bordered mb-0">
-                                        <thead>
-                                        <tr>
-                                            <th>Client</th>
-                                            <th>Pro</th>
-                                            <th>Appt. Date/Time</th>
-                                            <th>Status</th>
-                                            <th></th>
-                                        </tr>
-                                        </thead>
-                                        <tbody>
-                                        @foreach($naApptUpdates as $update)
-                                            <tr>
-                                                <td>{{$update->name_first}} {{$update->name_last}}</td>
-                                                <td>{{$update->pro_name_first}} {{$update->pro_name_last}}</td>
-                                                <td>{{friendlier_date_time($update->start_time)}}</td>
-                                                <td>{{$update->status}}</td>
-                                                <td><a href="#" class="ack-na-appt-update" data-uid="{{$update->uid}}">Acknowledge</a>
-                                                </td>
-                                            </tr>
-                                        @endforeach
-                                        </tbody>
-                                    </table>
-                                </div>
-                            @endif
-
                         <!-- new associations -->
                             @if(count($newMCPAssociations))
                                 <div class="mb-3 border rounded px-3 py-2 ack-container">

+ 1 - 1
resources/views/app/dashboard-mcp.blade.php

@@ -293,7 +293,7 @@
                                         Notifications
                                     </strong>
                                 </div>
-                                <div class="card-body">
+                                <div class="card-body px-3 py-2">
                                     @include('app.mcp.dashboard.notifications')
                                 </div>
                             </div>

+ 67 - 1
resources/views/app/mcp/dashboard/notifications.blade.php

@@ -1 +1,67 @@
-<h1>Notifications</h1>
+<?php
+    $apptsPending = [
+        'status' => $pro->getAppointmentsPendingStatusChangeAck(),
+        'decision' => $pro->getAppointmentsPendingDecisionAck(),
+        // 'time' => $pro->getAppointmentsPendingTimeChangeAck()
+    ];
+?>
+@if(!count($apptsPending['status']) && !count($apptsPending['decision'])/* && !count($apptsPending['time'])*/)
+    No appointment changes
+@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>
+                <b>{{$appt->client->displayName()}}</b>
+                <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>
+            <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>
+        </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">
+            <b>{{$appt->client->displayName()}}</b>
+            <span class="ml-2">{{friendlier_date_time($appt->start_time)}}</span>
+            <span class="ml-2">{{$appt->latestConfirmationDecision->decision_enum}}</span>
+            <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>
+        </div>
+    @endforeach
+@endif
+{{--@if(count($apptsPending['time']))
+    <b class="text-secondary my-2 d-block">Appointment Timing Changes</b>
+    @foreach($apptsPending['time'] as $appt)
+        <div class="d-flex mb-1">
+            <b>{{$appt->client->displayName()}}</b>
+            <span class="ml-2">{{friendlier_date_time($appt->start_time)}}</span>
+            <a class="ml-auto">
+                Acknowledge
+            </a>
+        </div>
+    @endforeach
+@endif--}}

+ 1 - 1
resources/views/app/patient/partials/appointment-confirmation.blade.php

@@ -1,5 +1,5 @@
 <div class="d-flex" id="appointment-confirmation">
-    <div class="flex-grow-1"> {{-- ALIX overhaul --}}
+    <div class="flex-grow-1">
         @if($appointment->status === 'PENDING' && !$appointment->latest_confirmation_request_at && !$appointment->latest_confirmation_decision_at)
             <b class="text-warning-mellow">Not requested yet</b>
             <div>