Different periods depending on the day of the week

Home Forums Quform WordPress Different periods depending on the day of the week

This topic is: not resolved
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #35314
    brandworker
    Participant

    We are currently creating a small reservation facility using your tool. Here for we use the date and time field. Now we would like to integrate the opening hours here. That is, the visitor selects a Monday, Tuesday, Wednesday or Thursday in the calendar offers the time field 17:00 to 23:00 clock.
    If you choose a Friday, it offers 16:00 to 01:00 and Saturdays and Sundays other times.
    So is it possible to set different time periods for different days of the week?

    #35320
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #35352
    brandworker
    Participant

    Hello thank you that worked well.

    But one more question. Is it possible that you can say if someone books today that the earliest time is only 2 hours later? This works but if I then select tomorrow or next week, it also takes the current time plus 2 hours and not the complete period of the selected day.

    #35360
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #35364
    brandworker
    Participant
      jQuery(function ($) {
        var datepicker = $('.quform-field-1_4').data('kendoDatePicker'),
            timepicker = $('.quform-field-1_5').data('kendoTimePicker');
    
        if (window.kendo && datepicker && timepicker) {
            datepicker.setOptions({
                change: function () {
                    var date = datepicker.value();
    
                    if (date) {
                        var dayOfWeek = date.getDay(),
                            times = [];
    
                        if (dayOfWeek === 0) { // Sun
                             times = [
                                '10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00',
                                '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', 
                                '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00',
                                '20:30', '21:00'
                            ];
                        } else if (dayOfWeek === 1) { // Mon
                            times = [
                                '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00',
                                '20:30', '21:00', '21:30', '22:00'
                            ];
                        } else if (dayOfWeek === 2) { // Tue
                            times = [
                                '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00',
                                '20:30', '21:00', '21:30', '22:00'
                            ];
                        } else if (dayOfWeek === 3) { // Wed
                            times = [
                                '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00',
                                '20:30', '21:00', '21:30', '22:00'
                            ];
                        } else if (dayOfWeek === 4) { // Thu
                            times = [
                                '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00',
                                '20:30', '21:00', '21:30', '22:00'
                            ];
                        } else if (dayOfWeek === 5) { // Fri
                            times = [
                                '16:00', '16:30', 
                                '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00',
                                '20:30', '21:00', '21:30', '22:00', '22:30', '23:00', '23:30',
                                '00:00'
                            ];
                        } else if (dayOfWeek === 6) { // Sat
                             times = [
                                '12:00', '12:30', '13:00',
                                '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', 
                                '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00',
                                '20:30', '21:00', '21:30', '22:00', '22:30', '23:00', '23:30',
                                '00:00'
                            ];
                        }
    
                        var dates = [],
                            i = 0,
                            length = times.length,
                            d;
    
                        for ( ; i < length; i++) {
                            d = kendo.parseDate(times[i]);
    
                            if (d instanceof Date) {
                                dates.push(d);
                            }
                        }
    
                        timepicker.setOptions({ dates: dates });
                    }
                }
            });
        }
    });   

    We are in Germany (German) 24 Hour

    #35371
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #35589
    laboulbene
    Participant

    Hi,
    first of all thank you for that tip.

    I need to avoid people to book on Monday.

    When I put :
    } else if (dayOfWeek === 1) { // Mon
    times = [];
    the time picker is still present and full.

    I need to deny booking on Monday.

    Any help would be appreciated.
    Thanks in advance
    Ludovic

    #35593
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #35598
    laboulbene
    Participant

    Hi,
    thank you for the answer, but it don’t works.
    A you can see on screen captures I have copied and paste the code, using code snippet and replace the unique ID with my mine (7_4)

    If I try to book, there is an Ajax error

    Thanks for your help

    Attachments:
    You must be logged in to view attached files.
    #35606
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy