don't close datepicker after choosing the day and closing it from the button only

Viewed 25

I want to prevent the dialog from closing after choosing the day and closing it from the button only

This is because I want to make a notification to the user before closing the dialog so that he can close it or choose another day

            var arrDay = "";
        var departDay = "";
        halfDates = [
            @foreach ($shifts as $shift)
                (new Date('{{ $shift }}')).toDateString(),
            @endforeach
        ];
        fullDays = [
            @foreach ($fullDays as $day)
                (new Date('{{$day}}')).toDateString(),
            @endforeach
        ];
        $(".js-ui-datepicker").focus(function(){
            $(".js-ui-datepicker")
            .datepicker({
                minDate: 0,
                showButtonPanel: true,
                beforeShowDay: function(day){
                    if (halfDates.includes(day.toDateString())) {
                        return [true, 'halfDay', 'You Can Select Have Day, The Other have Is Reserved'];
                    }else if(fullDays.includes(day.toDateString())){
                        return [false,'fullDay', "you can't selec This Day Because It's Fully Reserved"];
                    }else{
                        return [true, ''];
                    }
                },
                onSelect: function(day, inst){
                    departDay = (new Date(day));
                }
            })
            .datepicker("show");
            
            if(!inserted_date2){
                $('.ui-datepicker-header').after('<div class="text-center p-2 calendar-note" style="font-size:15px">'+'النصف الاحمر يعني ان جزء من اليوم محجوز'+'</div>');
                inserted_date2 = true;
            }
            // $('.ui-datepicker-calendar').after('<span>'+'االنص الاحمر يعني ان نصف اليوم محجوز'+'</span>');
        });
0 Answers
Related