diff --git a/public/js/airtime/schedule/full-calendar-functions.js b/public/js/airtime/schedule/full-calendar-functions.js
index 337be235d..2b35f670d 100644
--- a/public/js/airtime/schedule/full-calendar-functions.js
+++ b/public/js/airtime/schedule/full-calendar-functions.js
@@ -21,6 +21,42 @@ function dayClick(date, allDay, jsEvent, view) {
var x;
}
+function viewDisplay( view ) {
+
+ if(view.name === 'agendaDay' || view.name === 'agendaWeek') {
+
+ var select = $('.schedule_change_slots');
+ var calendarEl = this;
+
+ if(select.length === 0) {
+
+ select = $('')
+ .append('')
+ .append('')
+ .append('')
+ .append('')
+ .append('')
+ .change(function(){
+ var x = $(this).val();
+ var opt = view.calendar.options;
+ opt.slotMinutes = parseInt(x);
+ opt.events = getFullCalendarEvents;
+ $(calendarEl).fullCalendar('destroy');
+ $(calendarEl).fullCalendar(opt);
+ });
+
+ $('.fc-header-left tbody tr:first')
+ .append('
| ')
+ .append(' | ')
+ .find('td:last')
+ .append(select);
+
+ var slotMin = view.calendar.options.slotMinutes;
+ $('.schedule_change_slots option[value="'+slotMin+'"]').attr('selected', 'selected');
+ }
+ }
+}
+
function eventRender(event, element, view) {
//element.qtip({
// content: event.description
diff --git a/public/js/airtime/schedule/schedule.js b/public/js/airtime/schedule/schedule.js
index cc26e1647..1ebf49f0f 100644
--- a/public/js/airtime/schedule/schedule.js
+++ b/public/js/airtime/schedule/schedule.js
@@ -190,7 +190,8 @@ function scheduleRefetchEvents() {
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
}
-$(document).ready(function() {
+$(window).load(function() {
+ var mainHeight = document.documentElement.clientHeight - 200 - 50;
$('#schedule_calendar').fullCalendar({
header: {
@@ -206,10 +207,12 @@ $(document).ready(function() {
agenda: 'H:mm{ - H:mm}',
month: 'H:mm{ - H:mm}'
},
-
+ contentHeight: mainHeight,
+
events: getFullCalendarEvents,
//callbacks (in full-calendar-functions.js)
+ viewDisplay: viewDisplay,
dayClick: dayClick,
eventRender: eventRender,
eventAfterRender: eventAfterRender,
@@ -219,12 +222,6 @@ $(document).ready(function() {
eventDrop: eventDrop,
eventResize: eventResize
});
-});
-
-$(window).load(function() {
- var mainHeight = document.documentElement.clientHeight - 200 - 50;
- $('#schedule_calendar').fullCalendar('option', 'contentHeight', mainHeight);
- $('#schedule_calendar').fullCalendar('render');
});