PageSourceSearch

https://www.rishabhsoft.com/wp-content/themes/hello-theme-child-master/assets/js/custom-calender-js.js?ver=568

js rishabhsoft.com collected 2026-10-03 19:04:24 UTC 16,705 bytes, 370 lines download raw bytes

1(function ($) {
2    'use strict';
3
4    // Function to convert date to yyyy-mm-dd format
5    function convertToDateFormat(date) {
6        var d = new Date(date);
7        var year = d.getFullYear();
8        var month = ('0' + (d.getMonth() + 1)).slice(-2); // Get month (0-indexed)
9        var day = ('0' + d.getDate()).slice(-2); // Get day
10        return year + '-' + month + '-' + day;
11    }
12
13    function getDateInfo(date) {
14        // Create a new Date object from the input
15        var d = new Date(date);
16
17        // Get the day name, month name, and the date
18        var dayName = d.toLocaleString('default', {
19            weekday: 'long'
20        });
21        var monthName = d.toLocaleString('default', {
22            month: 'long'
23        });
24        var monthShortName = d.toLocaleString('default', {
25            month: 'short'
26        });
27        var day = d.getDate();
28        var year = d.getFullYear();
29
30        // Format the result
31        return {
32            dayName: dayName,
33            monthName: monthName,
34            day: day,
35            year: year,
36            monthShortName: monthShortName
37        };
38    }
39
40    function formatTimeToAMPM(time) {
41        // Split the time string into hours and minutes
42        var timeParts = time.split(':');
43        var hours = parseInt(timeParts[0]);
44        var minutes = timeParts[1];
45        var period = 'AM';
46
47        // Convert 24-hour time to 12-hour time
48        if (hours >= 12) {
49            period = 'PM';
50            if (hours > 12) {
51                hours -= 12; // Convert hour greater than 12 to 12-hour format
52            }
53        } else if (hours === 0) {
54            hours = 12; // Special case for midnight
55        }
56
57        // Format the hours and minutes
58        var formattedTime = ('0' + hours).slice(-2) + ':' + minutes + ' ' + period;
59        return formattedTime;
60    }
61
62    /**
63     * Datepicker configuration - START
64     */
65    $(function () {
66        var disabledDates = [
67            '05/26/2025', '04/07/2025', '09/01/2025', '11/27/2025', '11/28/2025', '12/25/2025' // Dates to disable
68        ];
69        $("#datepicker").datepicker({
70            beforeShowDay: $.datepicker.noWeekends,
71            minDate: 1,
72            nextText: "",
73            prevText: "",
74            maxDate: "+1m",
75            beforeShowDay: function (date) {
76                var day = date.getDay(); // Get the day of the week (0 = Sunday, 6 = Saturday)
77                var string = $.datepicker.formatDate('mm/dd/yy', date); // Format date as mm/dd/yyyy 
78                if (day == 0 || day == 6) {
79                    return [false]; // Return false to disable Saturday (6) and Sunday (0)
80                }
81
82                return [disabledDates.indexOf(string) == -1]; // Disable if date matches
83            },
84            onSelect: function (date) {
85                var selectedTimeZone = $("#time_zone option:selected").text();
86                var meetingData = getDateInfo(date);
87                var formattedDate = convertToDateFormat(date);
88                var d = new Date(date);
89                $(".date-and-timezone-section").hide();
90                $(".selected-date").html(meetingData['dayName'] + " " + meetingData['day'] + " " + meetingData['monthName']);
91                $(".cal_time, .next-btn-time-selected, .get-in-touch-section").attr("date-data", date);
92                $(".selected-timezone").html(selectedTimeZone);
93                $(".get-in-touch-section").attr("timezone-data", $("#time_zone option:selected").val());
94                $(".timeslot-tab").show();
95                $(".mettings-details .meeting-date-time-duration .meeting-date-time-duration-value, .metting-details-succuss .meeting-date-time-duration .meeting-date-time-duration-value").html(date);
96                $(".mettings-details .meeting-time-zone-value, .metting-details-succuss .meeting-time-zone-value").html(selectedTimeZone);
97                $('.tabs-wrapper').hide();
98                $.ajax({
99                    url: ajaxurl,
100                    type: "POST",
101                    data: {
102                        action: "check_available_call_slots",
103                        selectedDate: formattedDate,
104                    },
105                    success: function (responseData) {
106                        $('.tabs-wrapper').hide();
107                        $('.cal_time.time-slot').each(function () {
108                            if ($(this).hasClass('hide-time-slots')) {
109                                $(this).removeClass("hide-time-slots");
110                            }
111                        });
112                        if (responseData.success && responseData.data.schedule_times_slots) {
113                            var scheduleTimes = responseData.data.schedule_times_slots; // Array of times to hide 
114                            console.log('founded');
115                            // Loop through each time slot in the array
116                            $.each(scheduleTimes, function (index, time) {
117                                // Find the elements with the corresponding time and hide them
118                                $('.time-slot[data-time="' + time + '"]').addClass('hide-time-slots');
119                                $('.time-slot[data-time="' + time + '"]').parent().addClass('hide-time-slots');
120                            });
121                        } else if (responseData.success && responseData.data.schedule_times_slots === 0) {
122                            $(".timeslot-tab").removeClass("hide-time-slots");
123
124                        }
125                    },
126                    error: function (xhr, status, error) {
127                        console.log("Error:", error);
128                        console.log("Response Text:", xhr.responseText);
129                        console.log("Status:", status);
130                    }
131                });
132            },
133        });
134    });
135    /**
136     * Datepicker configuration - END
137     */
138    $(document).ready(function () { 
139
140        $('.search-nav.mobile-serach-icon').click(function () { 
141            $(".search-nav.mobile-close-icon").removeClass('d-none');
142            $(".search-nav.mobile-serach").removeClass('d-none');
143            $(this).addClass("d-none");
144        });
145        $('.search-nav.mobile-close-icon').click(function () { 
146            $(".search-nav.mobile-serach").addClass('d-none');
147            $('.search-nav.mobile-serach-icon').removeClass('d-none');
148            $(this).addClass("d-none");
149        });
150
151        /**
152         * Hide show tab in footer section - START
153         */
154        $('.send-request-section').show();
155        $('.schedule-a-call-section').hide();
156        $('.send-request-btn').click(function () {
157            $('.send-request-section').show();
158            $(this).addClass('active');
159            $(".schedule-a-call-btn").removeClass('active');
160            $('.schedule-a-call-section').hide();
161        });
162        $('.schedule-a-call-btn').click(function () {
163            $('.send-request-section').hide();
164            $(this).addClass('active');
165            $(".send-request-btn").removeClass('active');
166            $('.schedule-a-call-section').show();
167        });
168        /**
169         * Hide show tab in footer section - END
170         */
171        /**
172         * Back aerrow - click event - START
173         */
174        $('.back-aerrow').click(function () {
175            var backStepNo = $(this).attr("back-step");
176            //1: First step 2: secound step or else means 2nd step
177            if (backStepNo == 1) {
178                $('.tabs-wrapper').show();
179                $(".date-and-timezone-section").show();
180                $(".schedule-call-section").hide();
181                $(".timeslot-tab").hide();
182            } else if (backStepNo == 2) {
183                $(".schedule-call-section").hide();
184                $(".timeslot-tab").show();
185            } else {
186                $(".schedule-call-section").show();
187                $(".timeslot-tab").show();
188            }
189        });
190        /**
191         * Back aerrow - click event - END
192         */
193        /**
194         * Timeslot click event - START
195         */
196        $('.cal_time').click(function () {
197            $(".cal_time").each(function () {
198                $(this).parent().removeClass('selected-timeslot');
199            });
200            $(this).parent().addClass('selected-timeslot');
201            var callTime = $(this).attr('time-data');
202            var callDate = $(this).attr('date-data');
203            var meetingData = getDateInfo(callDate);
204            var FirstTime = callTime.split('-');
205            var meetingTime1 = formatTimeToAMPM(FirstTime[0].slice(0, -2));
206            var meetingTime2 = formatTimeToAMPM(FirstTime[1].slice(0, -2));
207            $(".get-in-touch-section").attr("time-data", callTime);
208            $(".mettings-details .meeting-date-time-duration .meeting-date-time-duration-value").html(meetingTime1 + " - " + meetingTime2 + ", " + meetingData['dayName'] + ", " + meetingData['day'] + " " + meetingData['monthShortName'] + " " + meetingData['year']);
209            $(".metting-details-succuss .meeting-date-time-duration .meeting-date-time-duration-value").html(meetingTime1 + " - " + meetingTime2 + ", " + meetingData['dayName'] + ", " + meetingData['day'] + " " + meetingData['monthShortName'] + " " + meetingData['year']);
210            $(".next-btn-time-selected").addClass('d-none');
211            $(this).next().removeClass('d-none');
212        });
213        /**
214         * Timeslot click event - END
215         * Timeslot next btn event - START
216         */
217        $('.next-btn-time-selected').click(function () {
218            $(".timeslot-tab").hide();
219            $(".schedule-call-section").show();
220
221        });
222        /**
223         * Timeslot next btn event - END
224         * Submit meeting form - START
225         */
226        function submitFormWithCaptcha(token) {
227            //var formData = new FormData($("#schedule-call")[0]);
228            //formData.append('recaptcha_token', token); 
229            $.ajax({
230                url: ajaxurl, // PHP file that will handle form submission and reCAPTCHA verification
231                type: 'POST',
232                data: {
233                    action: "check_google_captcha_calendar",
234                    recaptcha_token: token,
235                },
236                success: function (response) {
237                    if (response.success) {
238                        // Handle successful form submission
239                        submissionOfscheduleCall();
240                        // $('#response-message').html('<p>Form submitted successfully!</p>');
241                    } else {
242                        // Handle failed reCAPTCHA verification
243                        $('#response-message').html('<p>There was an error with your submission. Please try again.</p>');
244                    }
245                },
246                error: function () {
247                    $('#response-message').html('<p>There was an error with your submission. Please try again.</p>');
248                }
249            });
250        }
251        $("#schedule-call").submit(function (event) {
252
253            /* stop form from submitting normally */
254
255            event.preventDefault();
256            // Trigger reCAPTCHA to get the token
257            grecaptcha.ready(function () {
258                grecaptcha.execute('6Lc6kGcsAAAAAKzzvXPcZ8yFuw3EQ6MDLCSk7Qnd', { action: 'submit' }).then(function (token) {
259                    // Perform AJAX request to submit the form with reCAPTCHA token
260                    submitFormWithCaptcha(token);
261                });
262            });
263        });
264
265        function submissionOfscheduleCall() {
266
267            var meetingTime = $('.get-in-touch-section').attr('time-data');
268            var meetingTime = meetingTime.split('-');
269            meetingTime = formatTimeToAMPM(meetingTime[0].slice(0, -2));
270            var meetingStartTime = convertToDateFormat($('.get-in-touch-section').attr('date-data')) + " " + meetingTime;
271            /** Get user details from ipinfo token - START */
272
273            $.get("https://ipinfo.io/json?token=da24f799156824", function (response) {
274                const detectedTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
275                const trackingData = {
276                    timezone: response.timezone, // Timezone from IP info API
277                    detectedTimezone: detectedTimezone, // Detected timezone from the browser
278                    ip: response.ip,
279                    city: response.city,
280                    region: response.region,
281                    country: response.country,
282                    postal: response.postal,
283                    browser: navigator.userAgent,
284                    pageTitle: document.title,
285                    pageURL: window.location.href
286                };
287                var call_details = JSON.stringify({
288                // Tracking Info
289                'IPTimezone': trackingData.timezone,
290                'DetectedTimezone':trackingData.detectedTimezone,
291                'IP': trackingData.ip,
292                'Country': trackingData.country,
293                'Region': trackingData.region,
294                'City': trackingData.city,
295                'PostalCode': trackingData.postal,
296                'Browser': trackingData.browser,
297                'pageName': trackingData.pageTitle,
298                'pageURL': trackingData.pageURL,
299                'Timezone': $('.get-in-touch-section').attr('timezone-data'),
300                "FirstName" : $('#name').val(),
301                'Starttime': meetingStartTime,
302                'Agenda': $('#msg').val(),
303                'RequiredAttendees': $('#email').val(),
304                'OptionalAttendees': $('#email_optional').val(),
305                'Message': $('#msg').val(),
306                'PhoneNumber' : $('#mob_number').val(),
307            });
308            $.ajax({
309                url: "https://prod-24.centralindia.logic.azure.com:443/workflows/f120bb1277334ef490f22ff8eb9769b9/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=4gRnfy-jINByG_gC8o4ObkkQiH9oslqPt507qUWlMA4",
310                contentType: "application/json; charset=utf-8",
311                type: "POST",
312                data: call_details,
313                headers: {
314                    'X-Requested-With': 'XMLHttpRequest',
315                    'Content-Type': 'application/json',
316                },
317                dataType: 'json',
318                success: function (data, textStatus, jqXHR) {
319                    if (jqXHR.status === 202) {
320                        console.log('Response code is 202: Accepted');
321                        $(".schedule-call-section").hide();
322                        $("#result").show();
323
324                    } else {
325                        console.log('Response code is not 202');
326                        $(".schedule-call-section").show();
327                    }
328                }
329            }).fail(function (xhr, status, error) {
330                // Check if status code is 202 or not
331                if (xhr.status === 202) {
332                    $(".schedule-call-section").hide();
333                    $("#result").show();
334                    // If response is 202, also send the data to WordPress
335                    $.ajax({
336                        url: ajaxurl,
337                        type: "POST",
338                        data: {
339                            action: "add_schedule_call_detail",
340                            name: $('#name').val(),
341                            email: $('#email').val(),
342                            starttime: meetingStartTime,
343                            timezone: $('.get-in-touch-section').attr('timezone-data'),
344                            subject: "Project Planning Meeting Create Test",
345                            optional_attendees: $('#email_optional').val(),
346                            message: $('#msg').val(),
347                            phone_number : $('#mob_number').val(),
348                        },
349                        success: function (response) {
350                            console.log("Data submited:", response);
351                        },
352                        error: function (xhr, status, error) {
353                            console.log("Error:", error);
354                            console.log("Response Text:", xhr.responseText);
355                            console.log("Status:", status);
356                        }
357                    });
358                } else {
359                    $(".schedule-call-section").show();
360                }
361            });
362                //Ajax over
363            }); 
364            /** Get user details from ipinfo token - END */
365
366        }// Captcha validation END
367
368    });
369
370})(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.