Procházet zdrojové kódy

Ability to open training appts. in HRM2

Vijayakrishnan před 4 roky
rodič
revize
bb8059bcaa

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

@@ -101,6 +101,7 @@ class AppointmentController extends Controller
                 "clientUid" => $appointment->client->uid,
                 "proId" => $appointment->pro->id,
                 "proUid" => $appointment->pro->uid,
+                "isTrainingEvent" => !!$appointment->client->shadowOfPro,
                 "proName" => $appointment->pro->displayName(),
                 "start" => convertToTimezone($appointment->start_time, $timeZone),
                 "end" => convertToTimezone($appointment->end_time, $timeZone),

+ 4 - 0
app/Models/Pro.php

@@ -442,4 +442,8 @@ class Pro extends Model
         return $locations;
     }
 
+    public function shadowClient() {
+        return $this->hasOne(Client::class, 'id', 'shadow_client_id');
+    }
+
 }

+ 2 - 0
config/app.php

@@ -61,6 +61,8 @@ return [
 
     'backend_ws_url' => env('BACKEND_WS_URL'),
 
+    'hrm2_url' => env('HRM2_URL'),
+
     'asset_version' => 1,
 
     /*

+ 7 - 0
public/css/style.css

@@ -1656,4 +1656,11 @@ th.only-screen, td.only-screen {
 #simpleSMSReminderComponent input[type="time"] {
     max-width: 90px;
     min-width: unset !important;
+}
+form.non-interactive .form-content {
+    opacity: 0.5;
+    cursor: not-allowed;
+}
+form.non-interactive .form-content * {
+    pointer-events: none;
 }

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

@@ -243,12 +243,19 @@
             </form>
         </div>
         <div class="stag-popup stag-popup-sm mcp-theme-1" stag-popup-key="client-edit-appointment">
-            <form method="POST" action="/api/appointment/update" id="editApptForm">
+            <form method="POST" action="/api/appointment/update" id="editApptForm"
+                  :class="editAppointment.isTrainingEvent ? 'non-interactive' : ''">
                 <h3 class="stag-popup-title">
                     <span>Edit Appointment</span>
+                    <a native target="_blank" v-if="editAppointment.isTrainingEvent" class="ml-3"
+                       :href="'{{config('app.hrm2_url')}}/patients/view/' + editAppointment.clientUid + '/calendar/' + editAppointment.uid">
+                        <i class="fa fa-external-link-alt"></i>
+                        Open in HRM
+                    </a>
                     <a href="#" class="ml-auto text-secondary"
                        onclick="return closeStagPopup()"><i class="fa fa-times-circle"></i></a>
                 </h3>
+                <div class="form-content" :title="editAppointment.isTrainingEvent ? 'Training appointment. Please open in HRM.' : ''">
                 <input type="hidden" name="uid" :value="editAppointment.uid">
                 <div class="row mb-2">
                     <div class="col-3 text-secondary">
@@ -361,6 +368,7 @@
                     <button class="btn btn-sm btn-default border"
                             onclick="return closeStagPopup()">Cancel</button>
                 </div>
+                </div>
             </form>
         </div>
     </div>
@@ -411,6 +419,7 @@
                             title: '',
                             description: '',
                             status: '',
+                            isTrainingEvent: false,
                         },
 
                         // availability
@@ -772,6 +781,7 @@
                             this.inProgress = false;
                             this.editAppointment.uid = this.selectedEvent.extendedProps.appointmentUid;
                             this.editAppointment.clientName = this.selectedEvent.extendedProps.clientName;
+                            this.editAppointment.clientUid = this.selectedEvent.extendedProps.clientUid;
                             this.editAppointment.proUid = this.selectedEvent.extendedProps.proUid;
                             this.editAppointment.date = this.dateStr(this.selectedEvent.start);
                             this.editAppointment.startTime = this.timeStr(this.selectedEvent.start);
@@ -780,6 +790,7 @@
                             this.editAppointment.title = this.selectedEvent.extendedProps._title;
                             this.editAppointment.description = this.selectedEvent.extendedProps.description;
                             this.editAppointment.status = this.selectedEvent.extendedProps.status;
+                            this.editAppointment.isTrainingEvent = this.selectedEvent.extendedProps.isTrainingEvent;
                             Vue.nextTick(function() {
                                 $('#editApptPro').trigger('change');
                                 showStagPopup('client-edit-appointment', true);