PageSourceSearch

https://aelys.fr/modules/storelocator/views/js/store_cal.js

js aelys.fr collected 2026-10-07 15:21:22 UTC 5,720 bytes, 120 lines download raw bytes

1/*
2*
3* DISCLAIMER
4*
5* Do not edit or add to this file.
6* You are not authorized to modify, copy or redistribute this file.
7* Permissions are reserved by FME Modules.
8*
9*  @author    FMM Modules
10*  @copyright FME Modules 2021
11*  @license   Single domain
12*/
13
14$(document).ready(function() {
15    initPickupDate(default_store);
16});
17
18function initPickupDate(id_store) {
19    if (FMESL_PICKUP_STORE == 1 && $.inArray(st_page, ['order', 'orderopc']) >= 0) {
20        getStoreDates(id_store);
21    }
22}
23
24function getStoreDates(id_store) {
25    var request = {
26        url: searchUrl,
27        method: 'get',
28        dataType: 'json',
29        data: {
30            ajax: 1,
31            id_store: id_store,
32            action: 'getStoreDates'
33        },
34        success: function(response) {
35            if (response.success) {
36                var dateOptions = {
37                    locale: locale,
38                    minuteIncrement: 1,
39                    noCalendar: false,
40                    minDate: "today",
41                    maxDate: maxDate,
42                    dateFormat: "Y-m-d",
43                    minuteIncrement: 5,
44                    monthSelectorType: 'static',
45                    "disable": [
46                        function(date) {
47                            if (typeof response !== 'undefined' && response.disabled !== 'undefined' && response.disabled != null) {
48                                return (($.inArray(moment(date).format('YYYY-MM-DD') , response.disabled.split(',')) >= 0));
49                            }
50                            return false;
51                        }
52                    ],
53                };
54
55                var pickuptime = null;
56                $('.pickuptime').each(function(e) {
57                    switch ($(this).attr('data-type')) {
58                        case 'date':
59                            dateOptions.defaultDate = preselectedPickupDate;
60                            dateOptions.enableTime = false;
61                            dateOptions.onChange = function(selectedDates, dateStr, instance) {
62                                if ($('#pickup_time_wrapper').length) {
63                                    if (typeof dateStr === 'undefined' || !dateStr) {
64                                        $('#pickup_time_wrapper').hide();
65                                    } else {
66                                        $('#pickup_time_wrapper').show();
67                                        var weekday = moment(dateStr).format('d');
68                                        if (typeof response.timeslot !== 'undefined' && response.timeslot.length > 1) {
69                                            // set opening hours
70                                            if (false !== response.timeslot[weekday].minTime) {
71                                                pickuptime.config.minTime = response.timeslot[weekday].minTime;
72                                                pickuptime.set("minTime" , response.timeslot[weekday].minTime);
73                                                defaultHour = response.timeslot[weekday].minDate;
74                                            }
75                                            // set closing hours
76                                            if (false !== response.timeslot[weekday].maxTime) {
77                                                pickuptime.config.maxTime = response.timeslot[weekday].maxTime;
78                                                pickuptime.set("maxTime" , response.timeslot[weekday].maxTime);
79                                            }
80
81                                            // set default pickup hours
82                                            if (false !== response.timeslot[weekday].defaultHour) {
83                                                pickuptime.config.defaultHour = response.timeslot[weekday].defaultHour;
84                                                pickuptime.set("defaultHour" , response.timeslot[weekday].defaultHour);
85                                            }
86
87                                            // set default pickup minutes
88                                            if (false !== response.timeslot[weekday].defaultMinute) {
89                                                pickuptime.config.defaultMinute = response.timeslot[weekday].defaultMinute;
90                                                pickuptime.set("defaultMinute" , response.timeslot[weekday].defaultMinute);
91                                            }
92                                        }
93                                    }
94                                }
95                            };
96                            flatpickr($(this), dateOptions);
97                            break;
98                        case 'time':
99                            dateOptions.defaultDate = preselectedPickupTime;
100                            dateOptions.enableTime = true;
101                            dateOptions.noCalendar = true;
102                            dateOptions.dateFormat = 'H:i';
103                            dateOptions.onChange = [];
104                            dateOptions.onReady = function() {
105                                if (!$.trim($('input[name=storelocator_pickup_date').val())) {
106                                    $('#pickup_time_wrapper').hide();
107                                }
108                            };
109                            pickuptime = flatpickr($(this), dateOptions);
110                            break;
111                    }
112                });
113            }
114        },
115        error: function(jqXHR, textStatus, errorThrown) {
116            alert('Error: ' + textStatus + '<br>' + errorThrown);
117        }
118    }
119    $.ajax(request);
120}

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.