'); } if(event.title) { element.find('.fc-title').html(event.title); } var timeHtml = ''; var timeText = ''; if (timeText) { timeHtml = '
' + htmlEscape(timeText) + ''; } /** Modal when click **/ modalInfo = {}; modalInfo['title'] = (event.title); var textWith = 'with'; var textLevel = 'level'; if(event.trainer) { modalInfo['trainer'] = textWith + ' ' + event.trainer; } if(event.level) { modalInfo['level'] = textLevel + ' ' + event.level; } modalInfo['time'] = timeHtml; modalInfo['categoryName'] = event.categoryName === undefined ? '' : event.categoryName; modalInfo['backgroundColor'] = event.backgroundColor === undefined ? '' : htmlEscape(event.backgroundColor); modalInfo['catColor'] = event.catColor === undefined ? '' : htmlEscape(event.catColor); modalInfo['popup_bgImage'] = event.popup_bgImage; modalInfo['url'] = htmlEscape(event.url); modalInfo['excerpt'] = event.excerpt; /* Remove htmlEscape*/ if(event.address != '') { modalInfo['address'] = htmlEscape(event.address); } modalInfo['register_link'] = event.register === undefined ? '' : htmlEscape(event.register); element.append('
'); }, eventAfterAllRender: function( view ) { if ( jQuery('.noo-class-schedule-shortcode').width() ' + ' - ' + holidays[i]['description'] + ''); } } } /** End Style holiday **/ ModalEffectsInit(); } }); $('.fc-prev-button').attr('data-from', '2016-05-01').attr('data-to', '2016-05-31'); $('.fc-next-button').attr('data-from', '2016-07-01').attr('data-to', '2016-07-31'); var schedule_layout = 'grid'; var fc_body = '.fc-body'; if(schedule_layout == 'list') { fc_body = '.fc-list-table'; } // Filter Active in first load $(".noo-class-schedule #schedule_filter_66dcedde34493 ul li").first().find('a').addClass('selected'); $(".noo-class-schedule #schedule_filter_66dcedde34493 a").on("click", function(e){ e.preventDefault(); var $this = $(this); $.ajax({ type: 'POST', url: nooTimetableParams.ajax_url, data: { action : 'noo_class_filter', class_category : $this.data("filter"), filter_type: 'category', from: $this.attr('data-from'), to: $this.attr('data-to'), shorcode_attr : '{"title":"Shortcode - Noo Schedule","sub_title":"","schedule_layout":"grid","min_time":"6:00:00","max_time":"23:00:00","content_height":"","source":"class","default_view":"month","event_cat":"all","teacher_of_class":"no","address_of_class":"no","item_limit":2,"hide_time_range":"","class":"","show_time_column":"yes","show_weekends":["sat","sun"],"show_cate_filter":"yes","filter_layout":"list","filter_type":"category","class_cat":"all","class_level":"all","class_trainer":"all","show_filter":"yes","class_filter_layout":"list","class_show_all_tab":"yes","show_all_tab":"yes","general_header_toolbar":"yes","general_header_day":"yes","custom_general_default_date":"true","general_default_date":"2016-06-18","general_navigate_link":"disable","general_popup":"yes","general_popup_time":"yes","general_popup_title":"no","general_popup_level":"yes","general_popup_thumb":"no","general_popup_adress_trainer":"no","general_popup_excerpt":"no","general_popup_style":"1","show_export":"no","show_category":"no","class_show_category":"yes","class_item_style":"categoryColor","class_show_icon":"no","event_split":"yes","event_item_style":"background_none","event_show_icon":"no","general_header_background":"#26b5f0","general_header_color":"#d7eff9","general_today_column":"#ffffff","general_holiday_background":"#cf3d6f"}', sercurity : 'e95b9176bb' }, beforeSend: function() { $this.closest('.noo-class-schedule').find(fc_body).addClass('overlay-loading-tripped'); $this.closest('.noo-class-schedule').find(".class-schedule-filter a.selected") .removeClass("selected") .removeClass('class-schedule-infi-pulse'); $this .addClass("selected") .addClass('class-schedule-infi-pulse'); }, success: function(res){ var newsource = res.events_data; $this.closest('.noo-class-schedule').find(fc_body).removeClass('overlay-loading-tripped'); $this.closest('.noo-class-schedule').find(".class-schedule-filter a.selected") .removeClass("selected") .removeClass('class-schedule-infi-pulse'); $this .addClass("selected") .removeClass('class-schedule-infi-pulse'); if(newsource){ $("#noo_class_schedule_66dcedde34492").fullCalendar('removeEventSource', source_noo_class_schedule_66dcedde34492) $("#noo_class_schedule_66dcedde34492").fullCalendar('refetchEvents'); $("#noo_class_schedule_66dcedde34492").fullCalendar('addEventSource', newsource); $("#noo_class_schedule_66dcedde34492").fullCalendar('refetchEvents'); source_noo_class_schedule_66dcedde34492 = newsource; } }, error: function () { location.reload(); } }); }); $('body').on("click", ".noo-class-schedule #noo_class_schedule_66dcedde34492 .fc-toolbar .fc-prev-button, .noo-class-schedule #noo_class_schedule_66dcedde34492 .fc-toolbar .fc-next-button", function(e){ e.preventDefault(); var $this = $(this); $this.prop('disabled', true); var filterObj = $this.parents('.noo-class-schedule').find('.noo-filters'); var filterSelected = filterObj.find('a.selected'); $.ajax({ type: 'POST', url: nooTimetableParams.ajax_url, data: { action : 'noo_class_filter', class_category : filterSelected.data("filter"), from: $this.attr('data-from'), to: $this.attr('data-to'), shorcode_attr : '{"title":"Shortcode - Noo Schedule","sub_title":"","schedule_layout":"grid","min_time":"6:00:00","max_time":"23:00:00","content_height":"","source":"class","default_view":"month","event_cat":"all","teacher_of_class":"no","address_of_class":"no","item_limit":2,"hide_time_range":"","class":"","show_time_column":"yes","show_weekends":["sat","sun"],"show_cate_filter":"yes","filter_layout":"list","filter_type":"category","class_cat":"all","class_level":"all","class_trainer":"all","show_filter":"yes","class_filter_layout":"list","class_show_all_tab":"yes","show_all_tab":"yes","general_header_toolbar":"yes","general_header_day":"yes","custom_general_default_date":"true","general_default_date":"2016-06-18","general_navigate_link":"disable","general_popup":"yes","general_popup_time":"yes","general_popup_title":"no","general_popup_level":"yes","general_popup_thumb":"no","general_popup_adress_trainer":"no","general_popup_excerpt":"no","general_popup_style":"1","show_export":"no","show_category":"no","class_show_category":"yes","class_item_style":"categoryColor","class_show_icon":"no","event_split":"yes","event_item_style":"background_none","event_show_icon":"no","general_header_background":"#26b5f0","general_header_color":"#d7eff9","general_today_column":"#ffffff","general_holiday_background":"#cf3d6f"}', sercurity : 'e95b9176bb' }, beforeSend: function() { $this.closest('.noo-class-schedule').find(fc_body).addClass('overlay-loading-tripped'); }, success: function(res){ var newsource = res.events_data; var sche_wrap = $this.closest('.noo-class-schedule'); sche_wrap.find(fc_body).removeClass('overlay-loading-tripped'); if(newsource){ $("#noo_class_schedule_66dcedde34492").fullCalendar('removeEventSource', source_noo_class_schedule_66dcedde34492) $("#noo_class_schedule_66dcedde34492").fullCalendar('refetchEvents') $("#noo_class_schedule_66dcedde34492").fullCalendar('addEventSource', newsource) $("#noo_class_schedule_66dcedde34492").fullCalendar('refetchEvents'); source_noo_class_schedule_66dcedde34492 = newsource; } filterObj.find('a').attr( 'data-from', res.datetime.cur_from); filterObj.find('a').attr( 'data-to', res.datetime.cur_to); //sche_wrap.find('.res-sche-navigation h3').html(label_start + ' - ' + label_end); var _nav_prev = sche_wrap.find('.fc-toolbar .fc-prev-button'); var _nav_next = sche_wrap.find('.fc-toolbar .fc-next-button'); _nav_prev.attr( 'data-from', res.datetime.prev_from ); _nav_prev.attr( 'data-to', res.datetime.prev_to ); _nav_next.attr( 'data-from', res.datetime.next_from ); _nav_next.attr( 'data-to', res.datetime.next_to ); /** Style holiday in month view **/ //holidayRestyle(); var holidays = res.holidays_data; var el = $('.fc-month-view'); var holidayMoment; for(var i = 0; i ' + ' - ' + holidays[i]['description'] + ''); } } $this.prop('disabled', false); /** End Style holiday **/ }, error: function () { //location.reload(); } }); }); $( window ).resize(function() { var $sch_view = $("#noo_class_schedule_66dcedde34492").find('.fc-view'); if ( !$.trim( $sch_view.html() ) ) { $("#noo_class_schedule_66dcedde34492").find('.fc-toolbar').find('.fc-prev-button').click(); $("#noo_class_schedule_66dcedde34492").find('.fc-toolbar').find('.fc-next-button').click(); } }); // Download iCal button onclick listener $("#export_timetable_66dcedde34496").on('click',function(){ // setup ics var cal = ics(); // go through each event from the json and add an event for it to ics $.each(source_noo_class_schedule_66dcedde34492,function(i, $event){ var _desc = $event.categoryName; var _location = $event.address; cal.addEvent($event.title, _desc, _location, $event.start, $event.end, $event.url); }); cal.download('ical-class-chedule', '.ics'); return false; }); $('.md-modal').addClass('md-modal-init'); });