Parcourir la source

Appointment overhaul (wip)

Vijayakrishnan il y a 3 ans
Parent
commit
dde22f64bf

+ 1 - 7
app/Http/Controllers/AppointmentController.php

@@ -78,7 +78,7 @@ class AppointmentController extends Controller
 
                 $shortStatus = '';
                 switch($appointment->status) {
-                    case 'CREATED':
+                    case 'PENDING':
                         $shortStatus = 'new';
                         break;
                     case 'CONFIRMED':
@@ -90,12 +90,6 @@ class AppointmentController extends Controller
                     case 'COMPLETED':
                         $shortStatus = 'done';
                         break;
-                    case 'ABANDONED':
-                        $shortStatus = 'aban';
-                        break;
-                    case 'REJECTED':
-                        $shortStatus = 'rej';
-                        break;
                 }
 
                 if(count($proIds) === 1) {

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

@@ -337,7 +337,7 @@
                         tab: '{{ request()->input('tab') ? request()->input('tab') : 'measurements' }}',
                         datesWithEvents: [],
                         selectedDate: '{{ date('Y-m-d') }}',
-                        selectedStatus: 'CREATED',
+                        selectedStatus: 'PENDING',
                         events: [],
                         numEventsForDate: 0,
                         filterStatus: '',

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

@@ -38,11 +38,10 @@
                 <select v-model="event.newStatus"
                         class="form-control input-sm bg-light"
                         v-on:change="updateStatus(event)">
-                    <option value="CREATED">CREATED</option>
+                    <option value="PENDING">PENDING</option>
                     <option value="CONFIRMED">CONFIRMED</option>
                     <option value="CANCELLED">CANCELLED</option>
                     <option value="COMPLETED">COMPLETED</option>
-                    <option value="ABANDONED">ABANDONED</option>
                 </select>
                 <div v-if="selectedDate === '{{ date('Y-m-d') }}'"
                      class="pt-1 text-right"

+ 1 - 3
resources/views/app/patient/appointments.blade.php

@@ -15,12 +15,10 @@
             <select class="ml-2 max-width-200px form-control form-control-sm"
                     onchange="fastLoad('/patients/view/{{$patient->uid}}/appointments/{{$forPro}}/' + this.value, true, false, false)">
                 <option value="all" {{ $status === 'all' ? 'selected' : '' }}>All Appointments</option>
-                <option value="created" {{ $status === 'created' ? 'selected' : '' }}>New Appointments</option>
+                <option value="pending" {{ $status === 'pending' ? 'selected' : '' }}>Pending Appointments</option>
                 <option value="confirmed" {{ $status === 'confirmed' ? 'selected' : '' }}>Confirmed Appointments</option>
                 <option value="cancelled" {{ $status === 'cancelled' ? 'selected' : '' }}>Cancelled Appointments</option>
                 <option value="completed" {{ $status === 'completed' ? 'selected' : '' }}>Completed Appointments</option>
-                <option value="abandoned" {{ $status === 'abandoned' ? 'selected' : '' }}>Abandoned Appointments</option>
-                <option value="rejected" {{ $status === 'rejected' ? 'selected' : '' }}>Rejected Appointments</option>
             </select>
         </div>
         <table class="table table-striped table-sm table-bordered mb-0">

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

@@ -1,23 +1,20 @@
 <div class="d-flex" id="appointment-confirmation">
-    <div class="flex-grow-1">
-        @if($appointment->status === 'CREATED' && !$appointment->latest_confirmation_request_at && !$appointment->latest_confirmation_decision_at)
+    <div class="flex-grow-1"> {{-- ALIX overhaul --}}
+        @if($appointment->status === 'PENDING' && !$appointment->latest_confirmation_request_at && !$appointment->latest_confirmation_decision_at)
             <b class="text-warning-mellow">Not requested yet</b>
             <div>
                 @include('app.patient.partials.appointment-request-confirmation', ['label' => 'Request Confirmation'])
             </div>
         @endif
         @if($appointment->latest_confirmation_decision_at)
-            @if($appointment->status === 'CONFIRMED')
+            @if($appointment->latestConfirmationDecision->accepted_or_rejected_or_waived === 'ACCEPTED')
                 <div class="text-nowrap">
-                    <b class="text-success">{{ucwords($appointment->status)}}</b>
+                    <b class="text-success">{{ucwords($appointment->latestConfirmationDecision->accepted_or_rejected_or_waived)}}</b>
                     <span class="text-secondary ml-1">on {{friendlier_date_time(convertToTimezone($appointment->latest_confirmation_decision_at, 'US/Eastern'))}}</span>
                 </div>
-                <div>
-                    @include('app.patient.partials.appointment-request-confirmation', ['label' => 'Re-request Confirmation'])
-                </div>
-            @elseif($appointment->status === 'REJECTED')
+            @elseif($appointment->latestConfirmationDecision->accepted_or_rejected_or_waived === 'REJECTED')
                 <div class="text-nowrap">
-                    <b class="text-warning-mellow">{{ucwords($appointment->status)}}</b>
+                    <b class="text-warning-mellow">{{ucwords($appointment->latestConfirmationDecision->accepted_or_rejected_or_waived)}}</b>
                     <span class="text-secondary ml-1">on {{friendlier_date_time(convertToTimezone($appointment->latest_confirmation_decision_at, 'US/Eastern'))}}</span>
                 </div>
                 <div>
@@ -25,18 +22,30 @@
                         Re-schedule
                     </a>
                 </div>
+            @elseif($appointment->latestConfirmationDecision->accepted_or_rejected_or_waived === 'WAIVED')
+                <div class="text-nowrap">
+                    <b class="text-warning-mellow">{{ucwords($appointment->latestConfirmationDecision->accepted_or_rejected_or_waived)}}</b>
+                    <span class="text-secondary ml-1">on {{friendlier_date_time(convertToTimezone($appointment->latest_confirmation_decision_at, 'US/Eastern'))}}</span>
+                </div>
             @endif
-            @if($appointment->latestConfirmationDecision)
+            @if($appointment->latestConfirmationDecision && $appointment->latestConfirmationDecision->memo)
                 <div class="my-1 border text-sm px-2 py-1 bg-white max-width-300px">
-                    <b>Client feedback:</b><br>
-                    {{$appointment->latestConfirmationDecision->memo}}
+                    <span>Client feedback:</span>
+                    <span class="pl-2">{{ $appointment->latestConfirmationDecision->memo }}</span>
                 </div>
             @endif
-        @elseif($appointment->latest_confirmation_request_at) {{-- requested but not confirmed yet --}}
+        @endif
+        @if($appointment->latest_confirmation_request_at) {{-- requested but not confirmed yet --}}
             <div class="text-nowrap">
                 <b class="text-primary">Requested</b>
                 <span class="text-secondary ml-1">on {{friendlier_date_time(convertToTimezone($appointment->latest_confirmation_request_at, 'US/Eastern'))}}</span>
             </div>
+            @if($appointment->is_request_pending)
+                <div class="text-sm">
+                    <i class="fa fa-exclamation-triangle text-warning-mellow"></i>
+                    Request Pending
+                </div>
+            @endif
             <div>
                 @include('app.patient.partials.appointment-request-confirmation', ['label' => 'Re-request Confirmation'])
             </div>

+ 2 - 3
resources/views/app/patient/partials/appointments.blade.php

@@ -31,11 +31,10 @@
                                 <div class="mb-2">
                                     <select class="form-control form-control-sm bg-light" name="status" required>
                                         <option value="">-- select --</option>
-                                        <option {{ $appointment->status === 'CREATED' ? 'selected' : '' }} value="CREATED">CREATED</option>
+                                        <option {{ $appointment->status === 'PENDING' ? 'selected' : '' }} value="PENDING">PENDING</option>
                                         <option {{ $appointment->status === 'CONFIRMED' ? 'selected' : '' }} value="CONFIRMED">CONFIRMED</option>
                                         <option {{ $appointment->status === 'CANCELLED' ? 'selected' : '' }} value="CANCELLED">CANCELLED</option>
                                         <option {{ $appointment->status === 'COMPLETED' ? 'selected' : '' }} value="COMPLETED">COMPLETED</option>
-                                        <option {{ $appointment->status === 'ABANDONED' ? 'selected' : '' }} value="ABANDONED">ABANDONED</option>
                                     </select>
                                 </div>
                                 <div>
@@ -44,7 +43,7 @@
                                 </div>
                             </form>
                         </div>
-                        @if($appointment->status === 'CREATED')
+                        @if($appointment->status === 'PENDING')
                             <div moe class="ml-2">
                                 <a href="#" start show class="text-sm font-weight-bold">Req. Conf.</a>
                                 <form url="/api/appointment/sendConfirmationRequestViaSms">