|
@@ -57,6 +57,12 @@
|
|
<link href='/fullcalendar-5.3.2/lib/main.css' rel='stylesheet' />
|
|
<link href='/fullcalendar-5.3.2/lib/main.css' rel='stylesheet' />
|
|
<script src='/fullcalendar-5.3.2/lib/main.js'></script>
|
|
<script src='/fullcalendar-5.3.2/lib/main.js'></script>
|
|
|
|
|
|
|
|
+ <?php
|
|
|
|
+ if(!$currentAppointment || !$currentAppointment->id) {
|
|
|
|
+ $currentAppointment = false;
|
|
|
|
+ }
|
|
|
|
+ ?>
|
|
|
|
+
|
|
<div id="calendarApp">
|
|
<div id="calendarApp">
|
|
<div class="d-flex align-items-center mb-2">
|
|
<div class="d-flex align-items-center mb-2">
|
|
<h4 class="font-weight-bold m-0 font-size-16">
|
|
<h4 class="font-weight-bold m-0 font-size-16">
|
|
@@ -364,11 +370,11 @@
|
|
el: '#calendarApp',
|
|
el: '#calendarApp',
|
|
data: {
|
|
data: {
|
|
client: {!! json_encode($patient) !!},
|
|
client: {!! json_encode($patient) !!},
|
|
- eventTypes: 'BOTH',
|
|
|
|
|
|
+ eventTypes: '{{ $currentAppointment ? 'BOTH_ALL' : 'BOTH' }}',
|
|
calendar: null,
|
|
calendar: null,
|
|
proMeta: {!! json_encode($proMeta) !!},
|
|
proMeta: {!! json_encode($proMeta) !!},
|
|
proIds: ['{{ $pro->id }}'],
|
|
proIds: ['{{ $pro->id }}'],
|
|
- timezone: 'EASTERN',
|
|
|
|
|
|
+ timezone: '{{ $currentAppointment ? $currentAppointment->timezone : 'EASTERN' }}',
|
|
today: new Date('{{ date('Y-m-d 00:00:00') }}'),
|
|
today: new Date('{{ date('Y-m-d 00:00:00') }}'),
|
|
|
|
|
|
// user clicks/selection
|
|
// user clicks/selection
|
|
@@ -403,7 +409,8 @@
|
|
// availability
|
|
// availability
|
|
availability: {},
|
|
availability: {},
|
|
|
|
|
|
- inProgress: false
|
|
|
|
|
|
+ inProgress: false,
|
|
|
|
+ editHonored: false,
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
// init
|
|
// init
|
|
@@ -485,6 +492,12 @@
|
|
},
|
|
},
|
|
initCalendar: function () {
|
|
initCalendar: function () {
|
|
let self = this;
|
|
let self = this;
|
|
|
|
+ <?php
|
|
|
|
+ $initialDate = date('Y-m-d');
|
|
|
|
+ if($currentAppointment) {
|
|
|
|
+ $initialDate = trim(preg_replace("/ .*/", "", $currentAppointment->start_time));
|
|
|
|
+ }
|
|
|
|
+ ?>
|
|
this.calendar = new FullCalendar.Calendar($('.stag-fc-container')[0], {
|
|
this.calendar = new FullCalendar.Calendar($('.stag-fc-container')[0], {
|
|
headerToolbar: {
|
|
headerToolbar: {
|
|
left: 'prev,next today',
|
|
left: 'prev,next today',
|
|
@@ -492,7 +505,7 @@
|
|
right: 'dayGridMonth,timeGridWeek,timeGridDay'
|
|
right: 'dayGridMonth,timeGridWeek,timeGridDay'
|
|
},
|
|
},
|
|
initialView: 'timeGridWeek',
|
|
initialView: 'timeGridWeek',
|
|
- initialDate: '{{ date('Y-m-d') }}',
|
|
|
|
|
|
+ initialDate: '{{ $initialDate }}',
|
|
editable: true,
|
|
editable: true,
|
|
selectable: true,
|
|
selectable: true,
|
|
navLinks: true,
|
|
navLinks: true,
|
|
@@ -557,6 +570,25 @@
|
|
$('.fc .availability').each(function () {
|
|
$('.fc .availability').each(function () {
|
|
$(this).parent('.fc-timegrid-event-harness').css('pointer-events', 'none');
|
|
$(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 {
|
|
else {
|
|
failureCallback('Unable to refresh appointments!');
|
|
failureCallback('Unable to refresh appointments!');
|
|
@@ -577,6 +609,9 @@
|
|
if (['CANCELLED', 'COMPLETED', 'ABANDONED'].indexOf(arg.event.extendedProps.status) !== -1) {
|
|
if (['CANCELLED', 'COMPLETED', 'ABANDONED'].indexOf(arg.event.extendedProps.status) !== -1) {
|
|
classes.push('inactive-appointment');
|
|
classes.push('inactive-appointment');
|
|
}
|
|
}
|
|
|
|
+ if (arg.event.extendedProps.type === 'appointment') {
|
|
|
|
+ classes.push('appointment-' + arg.event.extendedProps.appointmentUid);
|
|
|
|
+ }
|
|
return classes;
|
|
return classes;
|
|
},
|
|
},
|
|
loading: function(bool) {
|
|
loading: function(bool) {
|
|
@@ -764,6 +799,7 @@
|
|
},
|
|
},
|
|
mounted: function() {
|
|
mounted: function() {
|
|
this.init();
|
|
this.init();
|
|
|
|
+ @if(!$currentAppointment)
|
|
if(localStorage.stagCalendarTZ) {
|
|
if(localStorage.stagCalendarTZ) {
|
|
this.timezone = localStorage.stagCalendarTZ;
|
|
this.timezone = localStorage.stagCalendarTZ;
|
|
Vue.nextTick(function() {
|
|
Vue.nextTick(function() {
|
|
@@ -776,6 +812,7 @@
|
|
$('#eventPros').trigger('change');
|
|
$('#eventPros').trigger('change');
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ @endif
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|