Kaynağa Gözat

Fix blank client name in appts. modal

Vijayakrishnan 4 yıl önce
ebeveyn
işleme
db43ce90f6

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

@@ -567,34 +567,15 @@
                                                 }
                                             }
                                             successCallback(displayEvents);
-                                            $('.fc .availability').each(function () {
-                                                $(this).parent('.fc-timegrid-event-harness').css('pointer-events', 'none');
-                                            });
-
-                                            @if($currentAppointment)
-                                            if(!self.editHonored) {
-                                                window.setTimeout(function() {
-                                                    let allEvents = self.calendar.getEvents();
-                                                    if(allEvents) {
-                                                        let currentEvent = allEvents.filter(function(_ev) {
-                                                            return _ev.extendedProps.appointmentUid === '{{ $currentAppointment->uid }}';
-                                                        });
-                                                        if(currentEvent) currentEvent = currentEvent[0];
-                                                        if(currentEvent) {
-                                                            self.selectedEvent = currentEvent;
-                                                            self.showEditAppointmentModal();
-                                                            self.editHonored = true;
-                                                        }
-                                                    }
-                                                }, 250);
-                                            }
-                                            @endif
                                         }
                                         else {
                                             failureCallback('Unable to refresh appointments!');
                                         }
                                     }, 'json');
                                 },
+                                eventDidMount: function(view) {
+                                    self.afterRenderingEvents();
+                                },
                                 eventClassNames: function(arg) {
                                     let classes = [];
                                     if (arg.event.extendedProps.clientOnly) {
@@ -652,6 +633,30 @@
                             });
                             this.calendar.render();
                         },
+                        afterRenderingEvents: function() {
+                            let self = this;
+                            $('.fc .availability').each(function () {
+                                $(this).parent('.fc-timegrid-event-harness').css('pointer-events', 'none');
+                            });
+                            @if($currentAppointment)
+                            if(!self.editHonored) {
+                                window.setTimeout(function() {
+                                    let allEvents = self.calendar.getEvents();
+                                    if(allEvents) {
+                                        let currentEvent = allEvents.filter(function(_ev) {
+                                            return _ev.extendedProps.appointmentUid === '{{ $currentAppointment->uid }}';
+                                        });
+                                        if(currentEvent) currentEvent = currentEvent[0];
+                                        if(currentEvent) {
+                                            self.selectedEvent = currentEvent;
+                                            self.showEditAppointmentModal();
+                                            self.editHonored = true;
+                                        }
+                                    }
+                                }, 250);
+                            }
+                            @endif
+                        },
                         dateStr: function(_dateTime) {
                             return _dateTime.getFullYear() + "-" +
                                 ("0"+(_dateTime.getMonth()+1)).slice(-2) + "-" +