1$(document).ready(function(){ 2 if (typeof jQuery.datetimepicker !== 'undefined') { 3 jQuery.datetimepicker.setLocale(actual_lang); 4 5 $('.js-date-picker:not(input[type="date"]):not(input[type="datetime-local"])').each(function () { 6 let pickerType = $(this).data('type'); 7 8 let minTime, maxTime, minDate, maxDate; 9 let format = 'Y.m.d'; 10 let time_pick_step = 1; 11 12 if ($(this).data('min') !== '' && $(this).data('min') !== undefined) { 13 if (pickerType === 'date_time') { 14 let temp = $(this).data('min').split(" "); 15 minDate = temp[0]; 16 minTime = temp[1]; 17 } else { 18 minDate = $(this).data('min'); 19 } 20 } 21 22 if ($(this).data('max') !== '' && $(this).data('max') !== undefined) { 23 if (pickerType === 'date_time') { 24 let temp = $(this).data('max').split(" "); 25 maxDate = temp[0]; 26 maxTime = temp[1]; 27 } else { 28 maxDate = $(this).data('max'); 29 } 30 } 31 32 if (pickerType === 'date_time') { 33 format = 'Y.m.d H:i'; 34 if ($(this).data('time-picker-step') !== '' && $(this).data('time-picker-step') !== undefined) { 35 time_pick_step = parseInt($(this).data('time-picker-step')); 36 } 37 } 38 39 let options = { 40 timepicker: (pickerType === 'date_time'), 41 formatDate: 'Y-m-d', 42 format: format, 43 defaultSelect: false, 44 step: time_pick_step, 45 dayOfWeekStart: 1, 46 scrollInput: false, 47 scrollMonth: false, 48 validateOnBlur: false, 49 onChangeDateTime: function (currentDateTime, $input) { 50 if (!currentDateTime) return; 51 52 let actMinTime = minTime; 53 let actMaxTime = maxTime; 54 let realMinTime = false; 55 let realMaxTime = false; 56 57 if (typeof opening_hours !== 'undefined') { 58 if (opening_hours[currentDateTime.getDay()] !== undefined) { 59 realMinTime = opening_hours[currentDateTime.getDay()]['start']; 60 realMaxTime = opening_hours[currentDateTime.getDay()]['end']; 61 } 62 } 63 64 if (realMinTime) { 65 if (actMinTime < realMinTime) actMinTime = realMinTime; 66 } 67 68 if (realMaxTime) { 69 if (actMaxTime > realMaxTime) actMaxTime = realMaxTime; 70 } 71 72 let y = currentDateTime.getFullYear(); 73 let m = String(currentDateTime.getMonth() + 1).padStart(2, '0'); 74 let d = String(currentDateTime.getDate()).padStart(2, '0'); 75 let selectedDate = y + '-' + m + '-' + d; 76 77 if (selectedDate === minDate) { 78 this.setOptions({ minTime: actMinTime, maxTime: realMaxTime }); 79 } else if (selectedDate === maxDate) { 80 this.setOptions({ minTime: realMinTime, maxTime: actMaxTime }); 81 } else { 82 this.setOptions({ minTime: realMinTime, maxTime: realMaxTime }); 83 } 84 85 $input.datetimepicker('hide').datetimepicker('show'); 86 } 87 }; 88 89 if (minDate !== undefined) options['minDate'] = minDate; 90 if (maxDate !== undefined) options['maxDate'] = maxDate; 91 if (minTime !== undefined) options['minTime'] = minTime; 92 if (maxTime !== undefined) options['maxTime'] = maxTime; 93 94 if ($(this).data('holiday-disabled') === 1) { 95 options['disabledDates'] = config_plus['holiday_list']; 96 } 97 98 let disabled_days = []; 99 if ($(this).data('weekend-disabled') === 1) { 100 disabled_days = [0,6]; 101 } 102 if ($(this).data('use-opening-hours') === 1 && typeof opening_hours !== 'undefined') { 103 for (let i = 0; i <= 6; i++) { 104 if (opening_hours[i] === undefined) { 105 if ($.inArray(i, disabled_days) === -1) disabled_days.push(i); 106 } 107 } 108 } 109 if (disabled_days.length > 0) { 110 options['disabledWeekDays'] = disabled_days; 111 } 112 113 $(this).datetimepicker( 114 options 115 ); 116 }); 117 } 118});
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.