Browse Source

Appointment overhaul (wip)

Vijayakrishnan 3 năm trước cách đây
mục cha
commit
232c4c3b36

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

@@ -259,7 +259,7 @@ class AppointmentController extends Controller
 
                 // make already booked slots unavailable
                 $proAppointments = $appointments->filter(function ($record) use ($proId, $pro) {
-                    return ($record->pro_id == $proId || $record->client_id == $pro->shadow_client_id) && !in_array($record->status, ['CANCELLED', 'COMPLETED', 'ABANDONED']);
+                    return ($record->pro_id == $proId || $record->client_id == $pro->shadow_client_id) && !in_array($record->status, ['CANCELLED', 'COMPLETED']);
                 });
                 foreach ($proAppointments as $appointment) {
                     if ($appointment->start_time && $appointment->end_time) {

+ 3 - 5
app/Http/Controllers/HomeController.php

@@ -391,9 +391,8 @@ class HomeController extends Controller
             ->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')
+            ->where('appointment.status', '!=', 'CREATED') // WIP: ALIX overhaul
             ->where('appointment.status', '!=', 'COMPLETED')
-            ->where('appointment.status', '!=', 'ABANDONED')
             ->where('appointment.pro_id', $performerProID)
             ->where('client.mcp_pro_id', $performerProID)
             ->orderBy('appointment.start_time', 'DESC')
@@ -405,9 +404,8 @@ class HomeController extends Controller
             ->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')
+            ->where('appointment.status', '!=', 'CREATED') // WIP: ALIX overhaul
             ->where('appointment.status', '!=', 'COMPLETED')
-            ->where('appointment.status', '!=', 'ABANDONED')
             ->where('client.default_na_pro_id', $performerProID)
             ->orderBy('appointment.start_time', 'DESC')
             ->get();
@@ -599,7 +597,7 @@ WHERE cl.shadow_pro_id IS NULL
             OR client.rme_pro_id = {$performer->pro->id}
             OR client.physician_pro_id = {$performer->pro->id}
             OR client.id in (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = {$performer->pro->id})
-            OR client.id in (SELECT client_id FROM appointment WHERE status NOT IN ('CANCELLED', 'ABANDONED') AND pro_id = {$performer->pro->id})
+            OR client.id in (SELECT client_id FROM appointment WHERE status NOT IN ('CANCELLED') AND pro_id = {$performer->pro->id})
         )";
 
         $numMeasurements = DB::select(

+ 2 - 2
app/Models/Pro.php

@@ -505,7 +505,7 @@ WHERE
                     ->orWhere('physician_pro_id', $proID)
                     ->orWhere('default_na_pro_id', $proID)
                     ->orWhereRaw('id IN (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = ?)', [$proID])
-                    ->orWhereRaw('id IN (SELECT client_id FROM appointment WHERE status NOT IN (\'CANCELLED\', \'ABANDONED\') AND pro_id = ?)', [$proID])
+                    ->orWhereRaw('id IN (SELECT client_id FROM appointment WHERE status NOT IN (\'CANCELLED\') AND pro_id = ?)', [$proID])
                     ->orWhereRaw('id IN (SELECT mcp_pro_id FROM client_program WHERE client_id = client.id AND is_active = TRUE)')
                     ->orWhereRaw('id IN (SELECT manager_pro_id FROM client_program WHERE client_id = client.id AND is_active = TRUE)')
                     ->orWhereRaw('id IN (SELECT client_id FROM note WHERE ally_pro_id = ? AND is_cancelled = FALSE)', [$proID]);;
@@ -529,7 +529,7 @@ WHERE
                     ->orWhere('physician_pro_id', $proID)
                     ->orWhere('default_na_pro_id', $proID)
                     ->orWhereRaw('id IN (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = ?)', [$proID])
-                    ->orWhereRaw('id IN (SELECT client_id FROM appointment WHERE status NOT IN (\'CANCELLED\', \'ABANDONED\') AND pro_id = ?)', [$proID])
+                    ->orWhereRaw('id IN (SELECT client_id FROM appointment WHERE status NOT IN (\'CANCELLED\') AND pro_id = ?)', [$proID])
                     ->orWhereRaw('id IN (SELECT mcp_pro_id FROM client_program WHERE client_id = client.id AND is_active = TRUE)')
                     ->orWhereRaw('id IN (SELECT manager_pro_id FROM client_program WHERE client_id = client.id AND is_active = TRUE)')
                     ->orWhereRaw('id IN (SELECT client_id FROM note WHERE ally_pro_id = ? AND is_cancelled = FALSE)', [$proID]);

+ 10 - 17
resources/views/app/dashboard-admin.blade.php

@@ -266,7 +266,7 @@
                                                         <span class="text-secondary font-size-11">on</span>
                                                         {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
                                                     </div>
-                                                    @if($nextAppt->status === 'CREATED')
+                                                    @if($nextAppt->status === 'PENDING') {{-- WIP: ALIX overhaul --}}
                                                         <div
                                                             class="text-warning-mellow font-weight-bold font-size-11 mt-1">
                                                             <i class="fa fa-exclamation-triangle"></i>
@@ -279,10 +279,10 @@
                                                             Confirmed by the patient
                                                         </div>
                                                     @endif
-                                                    @if($nextAppt->status === 'REJECTED')
+                                                    @if($nextAppt->status === 'CANCELLED')
                                                         <div class="text-danger font-weight-bold font-size-11 mt-1">
                                                             <i class="fa fa-stop"></i>
-                                                            Rejected by the patient
+                                                            Cancelled
                                                         </div>
                                                     @endif
                                                 @endif
@@ -310,7 +310,7 @@
                                                         <span class="text-secondary font-size-11">on</span>
                                                         {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
                                                     </div>
-                                                    @if($nextAppt->status === 'CREATED')
+                                                    @if($nextAppt->status === 'PENDING') {{-- WIP: ALIX overhaul --}}
                                                         <div
                                                             class="text-warning-mellow font-weight-bold font-size-11 mt-1">
                                                             <i class="fa fa-exclamation-triangle"></i>
@@ -323,10 +323,10 @@
                                                             Confirmed by the patient
                                                         </div>
                                                     @endif
-                                                    @if($nextAppt->status === 'REJECTED')
+                                                    @if($nextAppt->status === 'CANCELLED')
                                                         <div class="text-danger font-weight-bold font-size-11 mt-1">
                                                             <i class="fa fa-stop"></i>
-                                                            Rejected by the patient
+                                                            Cancelled
                                                         </div>
                                                     @endif
                                                 @endif
@@ -464,11 +464,10 @@
                                         <select v-model="filterStatus"
                                                 class="form-control form-control-sm">
                                             <option value="">All</option>
-                                            <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>
                                 </div>
@@ -494,7 +493,7 @@
                                             <span class="small d-inline-block pl-2 text-secondary font-weight-normal">@{{ event.clientSummary }}</span>
                                         </div>
                                         <div class="d-flex align-items-baseline">
-                                            <div v-if="event.status === 'CREATED'"
+                                            <div v-if="event.status === 'PENDING'"
                                                  class="text-warning-mellow font-weight-bold">
                                                 <i class="fa fa-exclamation-triangle"></i>
                                                 Confirmation pending
@@ -504,11 +503,6 @@
                                                 <i class="fa fa-check"></i>
                                                 Confirmed by the patient
                                             </div>
-                                            <div v-else-if="event.status === 'REJECTED'"
-                                                 class="text-danger font-weight-bold">
-                                                <i class="fa fa-stop"></i>
-                                                Rejected by the patient
-                                            </div>
                                             <div v-else class="text-secondary">
                                                 Status: <b>@{{ event.status }}</b>
                                             </div>
@@ -527,11 +521,10 @@
                                         <select v-model="event.newStatus"
                                                 class="form-control form-control-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"
@@ -587,7 +580,7 @@
                         tab: '{{ request()->input('tab') ? request()->input('tab') : 'measurements' }}',
                         datesWithEvents: [],
                         selectedDate: '{{ date('Y-m-d') }}',
-                        selectedStatus: 'CREATED',
+                        selectedStatus: 'PENDING',
                         events: [],
                         numEventsForDate: 0,
                         filterStatus: '',

+ 12 - 14
resources/views/app/dashboard-dna.blade.php

@@ -266,7 +266,7 @@
                                                         <span class="text-secondary font-size-11">on</span>
                                                         {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
                                                     </div>
-                                                    @if($nextAppt->status === 'CREATED')
+                                                    @if($nextAppt->status === 'PENDING') {{-- WIP: ALIX overhaul --}}
                                                         <div
                                                             class="text-warning-mellow font-weight-bold font-size-11 mt-1">
                                                             <i class="fa fa-exclamation-triangle"></i>
@@ -279,10 +279,10 @@
                                                             Confirmed by the patient
                                                         </div>
                                                     @endif
-                                                    @if($nextAppt->status === 'REJECTED')
+                                                    @if($nextAppt->status === 'CANCELLED')
                                                         <div class="text-danger font-weight-bold font-size-11 mt-1">
                                                             <i class="fa fa-stop"></i>
-                                                            Rejected by the patient
+                                                            Cancelled
                                                         </div>
                                                     @endif
                                                 @endif
@@ -310,7 +310,7 @@
                                                         <span class="text-secondary font-size-11">on</span>
                                                         {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
                                                     </div>
-                                                    @if($nextAppt->status === 'CREATED')
+                                                    @if($nextAppt->status === 'PENDING')
                                                         <div
                                                             class="text-warning-mellow font-weight-bold font-size-11 mt-1">
                                                             <i class="fa fa-exclamation-triangle"></i>
@@ -323,10 +323,10 @@
                                                             Confirmed by the patient
                                                         </div>
                                                     @endif
-                                                    @if($nextAppt->status === 'REJECTED')
+                                                    @if($nextAppt->status === 'CANCELLED')
                                                         <div class="text-danger font-weight-bold font-size-11 mt-1">
                                                             <i class="fa fa-stop"></i>
-                                                            Rejected by the patient
+                                                            Cancelled
                                                         </div>
                                                     @endif
                                                 @endif
@@ -464,11 +464,10 @@
                                         <select v-model="filterStatus"
                                                 class="form-control form-control-sm">
                                             <option value="">All</option>
-                                            <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>
                                 </div>
@@ -494,7 +493,7 @@
                                             <span class="small d-inline-block pl-2 text-secondary font-weight-normal">@{{ event.clientSummary }}</span>
                                         </div>
                                         <div class="d-flex align-items-baseline">
-                                            <div v-if="event.status === 'CREATED'"
+                                            <div v-if="event.status === 'PENDING'"
                                                  class="text-warning-mellow font-weight-bold">
                                                 <i class="fa fa-exclamation-triangle"></i>
                                                 Confirmation pending
@@ -504,10 +503,10 @@
                                                 <i class="fa fa-check"></i>
                                                 Confirmed by the patient
                                             </div>
-                                            <div v-else-if="event.status === 'REJECTED'"
+                                            <div v-else-if="event.status === 'CANCELLED'"
                                                  class="text-danger font-weight-bold">
                                                 <i class="fa fa-stop"></i>
-                                                Rejected by the patient
+                                                Cancelled
                                             </div>
                                             <div v-else class="text-secondary">
                                                 Status: <b>@{{ event.status }}</b>
@@ -527,11 +526,10 @@
                                         <select v-model="event.newStatus"
                                                 class="form-control form-control-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"
@@ -587,7 +585,7 @@
                         tab: '{{ request()->input('tab') ? request()->input('tab') : 'measurements' }}',
                         datesWithEvents: [],
                         selectedDate: '{{ date('Y-m-d') }}',
-                        selectedStatus: 'CREATED',
+                        selectedStatus: 'PENDING',
                         events: [],
                         numEventsForDate: 0,
                         filterStatus: '',

+ 8 - 8
resources/views/app/patient/appointment-calendar.blade.php

@@ -816,7 +816,7 @@
                                                             ev.editable = true;
 
                                                             // active/all
-                                                            if(['CANCELLED', 'COMPLETED', 'ABANDONED'].indexOf(ev.status) !== -1) {
+                                                            if(['CANCELLED', 'COMPLETED'].indexOf(ev.status) !== -1) {
                                                                 if(self.eventTypes === 'APPOINTMENTS_ALL' || self.eventTypes === 'BOTH_ALL') {
                                                                     displayEvents.push(ev);
                                                                 }
@@ -863,7 +863,7 @@
                                     if (arg.event.extendedProps.type === 'availability') {
                                         classes.push('availability');
                                     }
-                                    if (['CANCELLED', 'COMPLETED', 'ABANDONED'].indexOf(arg.event.extendedProps.status) !== -1) {
+                                    if (['CANCELLED', 'COMPLETED'].indexOf(arg.event.extendedProps.status) !== -1) {
                                         classes.push('inactive-appointment');
                                     }
                                     if (arg.event.extendedProps.type === 'appointment') {
@@ -1172,10 +1172,10 @@
                                 return false;
                             }
 
-                            // confirming if changing to cancelled, completed or abandoned
+                            // confirming if changing to cancelled, completed
                             if(this.selectedEvent.extendedProps.status !== this.editAppointment.status &&
-                                ['CANCELLED', 'COMPLETED', 'ABANDONED'].indexOf(this.editAppointment.status) !== -1) {
-                                if(!window.confirm('CANCELLED, COMPLETED and ABANDONED appointments will ' +
+                                ['CANCELLED', 'COMPLETED'].indexOf(this.editAppointment.status) !== -1) {
+                                if(!window.confirm('CANCELLED and COMPLETED appointments will ' +
                                     'not be displayed in the calendar by default.\n\n' +
                                     'Are you sure you want to update the status of this appointment to ' + this.editAppointment.status + '?')) {
                                     return false;
@@ -1209,10 +1209,10 @@
                                 return false;
                             }
 
-                            // confirming if changing to cancelled, completed or abandoned
+                            // confirming if changing to cancelled, completed
                             if(this.selectedEvent.extendedProps.status !== this.editAppointment.status &&
-                                ['CANCELLED', 'COMPLETED', 'ABANDONED'].indexOf(this.editAppointment.status) !== -1) {
-                                if(!window.confirm('CANCELLED, COMPLETED and ABANDONED appointments will ' +
+                                ['CANCELLED', 'COMPLETED'].indexOf(this.editAppointment.status) !== -1) {
+                                if(!window.confirm('CANCELLED and COMPLETED appointments will ' +
                                     'not be displayed in the calendar by default.\n\n' +
                                     'Are you sure you want to update the status of this appointment to ' + this.editAppointment.status + '?')) {
                                     return false;

+ 5 - 5
resources/views/app/practice-management/calendar.blade.php

@@ -534,7 +534,7 @@
                                                             ev.editable = false;
 
                                                             // active/all
-                                                            if(['CANCELLED', 'COMPLETED', 'ABANDONED'].indexOf(ev.status) !== -1) {
+                                                            if(['CANCELLED', 'COMPLETED'].indexOf(ev.status) !== -1) {
                                                                 if(self.eventTypes === 'APPOINTMENTS_ALL' || self.eventTypes === 'BOTH_ALL') {
                                                                     displayEvents.push(ev);
                                                                 }
@@ -578,7 +578,7 @@
                                     if (arg.event.extendedProps.type === 'availability') {
                                         classes.push('availability');
                                     }
-                                    if (['CANCELLED', 'COMPLETED', 'ABANDONED'].indexOf(arg.event.extendedProps.status) !== -1) {
+                                    if (['CANCELLED', 'COMPLETED'].indexOf(arg.event.extendedProps.status) !== -1) {
                                         classes.push('inactive-appointment');
                                     }
                                     if (arg.event.extendedProps.type === 'appointment') {
@@ -746,10 +746,10 @@
                                 return false;
                             }
 
-                            // confirming if changing to cancelled, completed or abandoned
+                            // confirming if changing to cancelled, completed
                             if(this.selectedEvent.extendedProps.status !== this.editAppointment.status &&
-                                ['CANCELLED', 'COMPLETED', 'ABANDONED'].indexOf(this.editAppointment.status) !== -1) {
-                                if(!window.confirm('CANCELLED, COMPLETED and ABANDONED appointments will ' +
+                                ['CANCELLED', 'COMPLETED'].indexOf(this.editAppointment.status) !== -1) {
+                                if(!window.confirm('CANCELLED and COMPLETED appointments will ' +
                                     'not be displayed in the calendar by default.\n\n' +
                                     'Are you sure you want to update the status of this appointment to ' + this.editAppointment.status + '?')) {
                                     return false;