1(function($) 2{ 3 4 bookneticHooks.addAction('booking_panel_loaded', function ( booknetic ) 5 { 6 let booking_panel_js = booknetic.panel_js; 7 8 booking_panel_js.on('click', '.booknetic_calendar_days:not(.booknetic_calendar_empty_day)[data-date]', function() 9 { 10 var date = $(this).data('date'); 11 12 booking_panel_js.find(".booknetic_times_list").empty(); 13 14 var times = date in booknetic.calendarDateTimes['dates'] ? booknetic.calendarDateTimes['dates'][ date ] : []; 15 var time_show_format = booknetic.time_show_format == 2 ? 2 : 1; 16 17 for( var i = 0; i < times.length; i++ ) 18 { 19 var time_badge = ''; 20 if( times[i]['weight'] > 0 && !( 'hide_available_slots' in booknetic.calendarDateTimes && booknetic.calendarDateTimes['hide_available_slots'] == 'on' ) ) 21 { 22 time_badge = '<div class="booknetic_time_group_num">' + times[i]['weight'] + ' / ' + times[i]['max_capacity'] + '</div>'; 23 } 24 25 let html = '<div class="booknetic_time_element" data-time="' + times[i]['start_time'] + '" data-endtime="' + times[i]['end_time'] + '" data-date-original="' + times[i]['date'] + '"><div>' + times[i]['start_time_format'] + '</div>' + (time_show_format == 1 ? '<div>' + times[i]['end_time_format'] + '</div>' : '') + time_badge + '</div>'; 26 var res = bookneticHooks.doFilter('bkntc_date_time_load' , html ,times[i] ,booknetic); 27 28 booking_panel_js.find(".booknetic_times_list").append(res); 29 } 30 31 booking_panel_js.find(".booknetic_times_list").scrollTop(0); 32 // booking_panel_js.find(".booknetic_times_list").getNiceScroll().resize(); 33 34 booking_panel_js.find(".booknetic_calendar_selected_day").removeClass('booknetic_calendar_selected_day'); 35 36 $(this).addClass('booknetic_calendar_selected_day'); 37 38 booking_panel_js.find(".booknetic_times_title").text( $(this).data('date-format') ); 39 40 if( booknetic.dateBasedService ) 41 { 42 booking_panel_js.find(".booknetic_times_list > [data-time]:eq(0)").trigger('click'); 43 } 44 else if( booknetic.isMobileView() ) 45 { 46 $('html,body').animate({scrollTop: parseInt(booking_panel_js.find('.booknetic_time_div').offset().top) - 100}, 1000); 47 } 48 }).on('click', '.booknetic_prev_month', function () 49 { 50 var month = booknetic.calendarMonth - 1; 51 var year = booknetic.calendarYear; 52 53 if( month < 0 ) 54 { 55 month = 11; 56 year--; 57 } 58 59 booknetic.nonRecurringCalendar( year, month, true, true ); 60 }).on('click', '.booknetic_next_month', function () 61 { 62 var month = booknetic.calendarMonth + 1; 63 var year = booknetic.calendarYear; 64 65 if( month > 11 ) 66 { 67 month = 0; 68 year++; 69 } 70 71 booknetic.nonRecurringCalendar( year, month, true, true ); 72 }).on('click', '.booknetic_times_list > div', function () 73 { 74 booking_panel_js.find('.booknetic_selected_time').removeClass('booknetic_selected_time'); 75 $(this).addClass('booknetic_selected_time'); 76 77 if( booking_panel_js.find('#booknetic_bring_someone_section').length == 0 ) 78 { 79 booknetic.stepManager.goForward(); 80 } 81 }).on('change', '#booknetic_bring_someone_checkbox', function(event) 82 { 83 if( $(this).is(':checked') ) 84 { 85 booking_panel_js.find('.booknetic_number_of_brought_customers').removeClass('d-none'); 86 } 87 else 88 { 89 booking_panel_js.find('.booknetic_number_of_brought_customers').addClass('d-none'); 90 } 91 92 booknetic.handleScroll(); 93 }); 94 95 }); 96 97 bookneticHooks.addFilter('step_validation_date_time' , function ( result , booknetic ) 98 { 99 let booking_panel_js = booknetic.panel_js; 100
101 if( booknetic.getSelected.serviceIsRecurring() ) 102 { 103 var service_repeat_type = booknetic.serviceData['repeat_type']; 104 105 if( service_repeat_type == 'weekly' ) 106 { 107 if( booking_panel_js.find('.booknetic_times_days_of_week_area > .booknetic_active_day').length == 0 ) 108 { 109 return { 110 status: false, 111 errorMsg: booknetic.__('select_week_days') 112 }; 113 } 114 else 115 { 116 var timeNotSelected = false; 117 booking_panel_js.find('.booknetic_times_days_of_week_area > .booknetic_active_day').each(function () 118 { 119 if( $(this).find('.booknetic_wd_input_time').val() == null ) 120 { 121 timeNotSelected = true; 122 return; 123 } 124 }); 125 126 if( timeNotSelected ) 127 { 128 return { 129 status: false, 130 errorMsg: booknetic.__('date_time_is_wrong') 131 }; 132 } 133 } 134 } 135 else if( service_repeat_type == 'monthly' ) 136 { 137 138 } 139 140 if( booknetic.getSelected.recurringStartDate() == '' ) 141 { 142 return { 143 status: false, 144 errorMsg: booknetic.__('select_start_date') 145 }; 146 } 147 148 if( booknetic.getSelected.recurringEndDate() == '' ) 149 { 150 return { 151 status: false, 152 errorMsg: booknetic.__('select_end_date') 153 }; 154 } 155 156 } 157 else 158 { 159 if( booknetic.getSelected.date_in_customer_timezone() == '') 160 { 161 return { 162 status: false, 163 errorMsg: booknetic.__('select_date') 164 }; 165 } 166 167 if( booknetic.getSelected.time() == '') 168 { 169 return { 170 status: false, 171 errorMsg: booknetic.__('select_time') 172 }; 173 } 174 } 175 176 return result 177 }); 178 179 bookneticHooks.addAction('before_step_loading', function( booknetic, new_step_id, old_step_id ) 180 { 181 if( new_step_id !== 'date_time' ) 182 return; 183 184 booknetic.stepManager.loadStandartSteps( new_step_id, old_step_id ); 185 }); 186 187 bookneticHooks.addAction('loaded_step', function( booknetic, new_step_id, old_step_id, ajaxData ) 188 { 189 if( new_step_id !== 'date_time' ) 190 return; 191 192 let booking_panel_js = booknetic.panel_js; 193 194 booknetic.serviceData = null; 195 booknetic.dateBasedService = ajaxData['service_info']['date_based']; 196 booknetic.serviceMaxCapacity = ajaxData['service_info']['max_capacity']; 197 198 if( ajaxData['service_type'] === 'non_recurring' ) 199 { 200 booknetic.calendarDateTimes = ajaxData['data']; 201 booknetic.time_show_format = ajaxData['time_show_format']; 202 203 let calendarStartYear = ajaxData['calendar_start_year']; 204 let calendarStartMonth = (typeof ajaxData['calendar_start_month'] === 'undefined' ? undefined : ajaxData['calendar_start_month'] -1 ); 205 206 if ( booknetic.checkIfNoDatesAvailable( ajaxData ) ) 207 { 208 let date = new Date( calendarStartYear, calendarStartMonth + 1 ); 209 210 booknetic.nonRecurringCalendar(date.getFullYear(), date.getMonth(), true, true ); 211 } 212 else 213 { 214 booknetic.nonRecurringCalendar(calendarStartYear, calendarStartMonth, false ); 215 } 216 217 booknetic.addGroupAppointmentsCounterForBookneticCalendarDays(); 218 } 219 else 220 { 221 booknetic.serviceData = ajaxData['service_info']; 222 booknetic.initRecurringElements(); 223 } 224 }); 225 226})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.