PageSourceSearch

https://romainmotier.ch/wp-content/plugins/booknetic/app/Frontend/…/steps/step_date_time.js?v=1.3.7&ver=1.3.7

js romainmotier.ch collected 2026-10-02 12:13:16 UTC 8,769 bytes, 238 lines download raw bytes

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                const modalBody = booknetic.panel_js.closest('.bkntc_booking_modal').find('.content .body');
47
48                if (modalBody.length > 0) {
49                    modalBody.animate({scrollTop: parseInt(booking_panel_js.find('.booknetic_time_div').offset().top) - 100}, 500);
50                    return
51                }
52
53                $('html,body').animate({scrollTop: parseInt(booking_panel_js.find('.booknetic_time_div').offset().top) - 100}, 1000);
54            }
55        }).on('click', '.booknetic_prev_month', function ()
56        {
57            var month = booknetic.calendarMonth - 1;
58            var year = booknetic.calendarYear;
59
60            if( month < 0 )
61            {
62                month = 11;
63                year--;
64            }
65
66            booknetic.nonRecurringCalendar( year, month, true, true );
67        }).on('click', '.booknetic_next_month', function ()
68        {
69            var month = booknetic.calendarMonth + 1;
70            var year = booknetic.calendarYear;
71
72            if( month > 11 )
73            {
74                month = 0;
75                year++;
76            }
77
78            booknetic.nonRecurringCalendar( year, month, true, true );
79        }).on('click', '.booknetic_times_list > div', function ()
80        {
81            booking_panel_js.find('.booknetic_selected_time').removeClass('booknetic_selected_time');
82            $(this).addClass('booknetic_selected_time');
83            const $nextStep = booknetic.stepManager.getNextStep();
84
85            if ($nextStep.length === 0) {
86                return
87            }
88
89            if( booking_panel_js.find('#booknetic_bring_someone_section').length == 0 )
90            {
91                booknetic.stepManager.goForward();
92            }
93        }).on('change', '#booknetic_bring_someone_checkbox', function(event)
94        {
95            if( $(this).is(':checked') )
96            {
97                booking_panel_js.find('.booknetic_number_of_brought_customers').removeClass('d-none');
98            }
99            else
100            {
101                booking_panel_js.find('.booknetic_number_of_brought_customers').addClass('d-none');
102            }
103
104            booknetic.handleScroll();
105        });
106
107    });
108
109    bookneticHooks.addFilter('step_validation_date_time' , function ( result , booknetic )
110    {
111        let booking_panel_js = booknetic.panel_js;
112
113        if( booknetic.getSelected.serviceIsRecurring() )
114        {
115            var service_repeat_type = booknetic.serviceData['repeat_type'];
116
117            if( service_repeat_type == 'weekly' )
118            {
119                if( booking_panel_js.find('.booknetic_times_days_of_week_area > .booknetic_active_day').length == 0 )
120                {
121                    return {
122                        status: false,
123                        errorMsg: booknetic.__('select_week_days')
124                    };
125                }
126                else
127                {
128                    var timeNotSelected = false;
129                    booking_panel_js.find('.booknetic_times_days_of_week_area > .booknetic_active_day').each(function ()
130                    {
131                        if( $(this).find('.booknetic_wd_input_time').val() == null )
132                        {
133                            timeNotSelected = true;
134                            return;
135                        }
136                    });
137
138                    if( timeNotSelected )
139                    {
140                        return {
141                            status: false,
142                            errorMsg: booknetic.__('date_time_is_wrong')
143                        };
144                    }
145                }
146            }
147            else if( service_repeat_type == 'monthly' )
148            {
149
150            }
151
152            if( booknetic.getSelected.recurringStartDate() == '' )
153            {
154                return {
155                    status: false,
156                    errorMsg: booknetic.__('select_start_date')
157                };
158            }
159
160            if( booknetic.getSelected.recurringEndDate() == '' )
161            {
162                return {
163                    status: false,
164                    errorMsg: booknetic.__('select_end_date')
165                };
166            }
167
168        }
169        else
170        {
171            if( booknetic.getSelected.date_in_customer_timezone() == '')
172            {
173                return {
174                    status: false,
175                    errorMsg: booknetic.__('select_date')
176                };
177            }
178
179            if( booknetic.getSelected.time() == '')
180            {
181                return {
182                    status: false,
183                    errorMsg: booknetic.__('select_time')
184                };
185            }
186        }
187
188        return result
189    });
190
191    bookneticHooks.addAction('before_step_loading', function( booknetic, new_step_id, old_step_id )
192    {
193        if( new_step_id !== 'date_time' )
194            return;
195
196        booknetic.stepManager.loadStandartSteps( new_step_id, old_step_id );
197    });
198
199    bookneticHooks.addAction('loaded_step', function( booknetic, new_step_id, old_step_id, ajaxData )
200    {
201        if( new_step_id !== 'date_time' )
202            return;
203
204        let booking_panel_js = booknetic.panel_js;
205
206        booknetic.serviceData = null;
207        booknetic.dateBasedService   = ajaxData['service_info']['date_based'];
208        booknetic.serviceMaxCapacity = ajaxData['service_info']['max_capacity'];
209
210        if( ajaxData['service_type'] === 'non_recurring' )
211        {
212            booknetic.calendarDateTimes = ajaxData['data'];
213            booknetic.time_show_format = ajaxData['time_show_format'];
214
215            let calendarStartYear = ajaxData['calendar_start_year'];
216            let calendarStartMonth = (typeof ajaxData['calendar_start_month'] === 'undefined' ? undefined : ajaxData['calendar_start_month'] -1 );
217
218            if ( booknetic.checkIfNoDatesAvailable( ajaxData ) )
219            {
220                let date = new Date( calendarStartYear, calendarStartMonth + 1 );
221
222                booknetic.nonRecurringCalendar(date.getFullYear(), date.getMonth(), true, true );
223            }
224            else
225            {
226                booknetic.nonRecurringCalendar(calendarStartYear, calendarStartMonth, false );
227            }
228
229            booknetic.addGroupAppointmentsCounterForBookneticCalendarDays();
230        }
231        else
232        {
233            booknetic.serviceData = ajaxData['service_info'];
234            booknetic.initRecurringElements();
235        }
236    });
237
238})(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.