Schedule Adults - Amsterdam Dance Centre (2024)

Week

'); data = {}; data['week'] = current_week; data['year'] = current_year; data['SortBy'] = 'time'; if (current_teacher > 0) { data['TeacherID'] = current_teacher; } if (current_location > 0) { data['LocationID'] = current_location; } if (current_classtype > 0) { data['ClassTypeID'] = current_classtype; } jQuery.ajax({ type: "POST", dataType: "json", url: url, data: data, //crossDomain: true, success: onPostSuccess, error: onPostError, }); function onPostSuccess(json) {// set locations select values var locations = json.data.locations; set_select_options(jQuery('select#locations'), locations); // set teachers select values var teachers = json.data.teachers; set_select_options(jQuery('select#teachers'), teachers); set_teacher_modals(teachers); // set classtypes select values var classtypes = json.data.classtypes; set_select_options(jQuery('select#classtypes'), classtypes); set_classtype_modals(classtypes); var classes = json.data.classes; if (schedule_display == 'blocks') { set_classes_blocks(classes); } else { set_classes(classes); } } function onPostError(json) { set_error_msg(json['statusText'] + ' - ' + json['responseText']); } function set_select_options(jQueryselect, data) { // empty out, if anything exists jQueryselect.find('option').remove(); // set empty values if (jQueryselect.attr('id') == 'teachers') { empty_text = 'All teachers'; } else if (jQueryselect.attr('id') == 'classtypes') { empty_text = 'All classes'; } else if (jQueryselect.attr('id') == 'locations') { empty_text = 'All locations'; } jQueryselect .append(jQuery('

') .attr('value', 0) .text(empty_text)); // set select values jQuery.each(data, function(i) { var item = data[i]; jQueryselect .append(jQuery('

') .attr('value', item.id) .text(item.Name)); if (jQueryselect.attr('id') == 'teachers') { jQueryselect.val(current_teacher); } else if (jQueryselect.attr('id') == 'classtypes') { jQueryselect.val(current_classtype); } else if (jQueryselect.attr('id') == 'locations') { jQueryselect.val(current_location); } }); // end each loop for setting select items } // end set select_options function set_teacher_modals(data) { jQuery.each(data, function(i) { var item = data[i]; var modal_id = 'modal_teacher_' + item.id; var modal_title = item.Name; var image = ''; var role = ''; var bio = ''; if (item.LinkThumbLarge) { image = 'Schedule Adults - Amsterdam Dance Centre (1)'; } if (item.Role != null) { role = '

' + item.Role + '

'; } if (item.Bio != null) { bio = '

' + item.Bio + '

'; } jQuery('#os-modals').append('\

\

\

\

' ); }); // end each loop } // end set_teacher_modals function set_classtype_modals(data) { jQuery.each(data, function(i) { var item = data[i]; var modal_id = 'modal_classtype_' + item.id; var modal_title = item.Name; var image = ''; var description = ''; if (item.LinkThumbLarge) { image = 'Schedule Adults - Amsterdam Dance Centre (2)'; } if (item.Description) { description = item.Description; } jQuery('#os-modals').append('\

\

\

\

\

\ \

\

\

\ ' + image + '\

' + modal_title + '

\

\

' + description + '

\

\ \

\

\

\

\

' ); }); // end each loop } // end set_clastype_modals } // end get_classes function set_error_msg(error_msg) { // remove loading text jQuery('#os-classes').empty(); jQuery('#os-classes').html('
' + error_msg); } function set_classes(classes) { /* * Process info returned by API */ // remove loading text jQuery('#os-classes').empty(); var weekdays = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ] ; // set classes in div#os-classes for (i = 0; i < weekdays.length; i++) { var weekday = weekdays[i] var data = classes[weekday].classes var date = classes[weekday].date // console.log(date); var res = date.split('-'); // split the date datestring = res[2] + ' ' + getMonthName(res[1]) + ' ' + res[0]; if ( data.length > 0 ) { jQuery('#os-classes') .append('

\

' + getDayName(i + 1) + ' ' + datestring + '

\

\

') // add header jQuery('div#' + weekday + '_classes') .append('

\

Time

\

Class

\

Level

\

Teacher

\

Location

\

Book

\

'); // add classes jQuery.each(data, function(i) { var item = data[i]; //console.log(item); if (item.Subteacher == true) { subteacher = ' (sub)'; } else { subteacher = ''; } var teacherID = item.TeacherID; var classtypeID = item.ClassTypeID; var teacher_modal_id = 'modal_teacher_' + item.TeacherID; var classtype_modal_id = 'modal_classtype_' + item.ClassTypeID; if (item.Cancelled == true || item.Holiday == true) { row_class = '"os-row openstudio_class"'; cancelled_description = '(Cancelled)'; if (item.Cancelled == true) { cancelled_description = '(Cancelled - ' + item.CancelledDescription + ')'; } if (item.Holiday == true) { cancelled_description = '(Cancelled - ' + item.HolidayDescription + ')'; } classtype_display = item.ClassType + '
' + cancelled_description + ''; teacher_display = item.Teacher + ' ' + subteacher; } else { row_class = '"os-row openstudio_class"'; classtype_display = item.ClassType; teacher_display = '' + item.Teacher + ' ' + subteacher + ''; }var BookingStatus = item.BookingStatus;if (item.BookingStatus == 'not_yet_open') {BookingStatus = 'Book from
' + item.BookingOpen;} else if (item.BookingStatus == 'ok') {BookingStatus = 'Book';} else if (item.BookingStatus == 'full') {BookingStatus = 'Full';} else {BookingStatus = item.BookingStatus;} jQuery('div#' + weekday + '_classes') .append('

\

' + item.Starttime + ' - ' + item.Endtime + '

\

' + classtype_display + '

\

' + item.Level + '

\

' + teacher_display + '

\

' + item.Location + '

\

' + BookingStatus + '

\

'); }); } // end data check if } // end for loop to populate classes in week // Functions for modals jQuery('span[data-toggle=os-modal]').on('click', function(event) { jQuery('body').css('overflow', 'hidden'); var target = jQuery(jQuery(this).attr('data-target')); target.fadeIn(); }); jQuery('.modal-header .close, .modal-backdrop, .os-modal-close button').click(function(event) { event.preventDefault(); modal_id = jQuery(this).closest('div.modal').attr('id'); modal = jQuery('#' + modal_id); close_modal(modal); }); function close_modal(modal) { jQuery('body').css('overflow', 'auto'); modal.fadeOut(); } } // end set classes function set_classes_blocks(classes) { /* * Process info returned by API */ // remove loading text jQuery('#os-classes').empty(); jQuery('#os-classes').append(''); var weekdays = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ] ; // set classes in div#os-classes for (i = 0; i < weekdays.length; i++) { var weekday = weekdays[i] var data = classes[weekday].classes var date = classes[weekday].date //console.log(date); var res = date.split('-'); // split the date datestring = res[2] + ' ' + getMonthName(res[1]) + ' ' + res[0]; jQuery('.seven-cols') .append('

\

\

' + getDayName(i + 1) + '
' + datestring + '

\

\

\

'); // add classes jQuery.each(data, function(i) { var item = data[i]; //console.log(item); if (item.Subteacher == true) { subteacher = ' (sub)'; } else { subteacher = ''; } if (item.Cancelled == true || item.Holiday == true) { row_class = '"openstudio_schedule_block_class line-through"'; } else { row_class = '"openstudio_schedule_block_class"'; } var teacher_modal_id = 'modal_teacher_' + item.TeacherID; var classtype_modal_id = 'modal_classtype_' + item.ClassTypeID; jQuery('div#' + weekday + '_classes') .append('

\

\

' + item.Starttime + ' - ' + item.Endtime + '

\

\

' + item.Location + '

\

'); }); } // end for loop to populate classes in week } // end set classes function getMonthName(month) { // returns 3 name of month months = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ]; return months[month - 1] } // end getMonthName function getDayName(iso_day) { days = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ] return days[iso_day - 1] } function set_week(week) { jQuery('#week').html(week); } function set_year(year) { jQuery('#year').html(year); } var url = "https://apiproxy.openstudioproject.com/adc/os_schedule_api"; var today = new Date(); var current_week = today.getWeek(); var current_year = today.getWeekYear(); set_week(current_week); set_year(current_year); current_teacher = 0; current_location = 0; current_classtype = 0; get_classes(); /* * Handlers for buttons and selects */ jQuery('#week_next').click(function() { console.log('clicked next ' + current_week); last_week = weeksInYear(current_year); if (current_week == last_week) { current_week = 1; current_year = current_year + 1; } else { current_week = current_week + 1; } set_week(current_week); set_year(current_year); get_classes(); }); jQuery('#week_prev').click(function() { if (current_week == 1) { current_year = current_year - 1; current_week = weeksInYear(current_year); } else { current_week = current_week - 1; } set_week(current_week); set_year(current_year); get_classes(); }); // handlers for selects, reload schedule when changing options jQuery('#teachers').change(function() { current_teacher = jQuery(this).val(); get_classes(); }); jQuery('#locations').change(function() { current_location = jQuery(this).val(); get_classes(); }); jQuery('#classtypes').change(function() { current_classtype = jQuery(this).val(); get_classes(); });

Schedule Adults - Amsterdam Dance Centre (2024)
Top Articles
Latest Posts
Article information

Author: Kerri Lueilwitz

Last Updated:

Views: 6650

Rating: 4.7 / 5 (47 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Kerri Lueilwitz

Birthday: 1992-10-31

Address: Suite 878 3699 Chantelle Roads, Colebury, NC 68599

Phone: +6111989609516

Job: Chief Farming Manager

Hobby: Mycology, Stone skipping, Dowsing, Whittling, Taxidermy, Sand art, Roller skating

Introduction: My name is Kerri Lueilwitz, I am a courageous, gentle, quaint, thankful, outstanding, brave, vast person who loves writing and wants to share my knowledge and understanding with you.