samedi 9 mai 2020

Disable date for selected days in datepicker

I have an online appointment form in my Laravel application with some filed Select Doctor and datepicker.

Suppose doctor A will be available in clinic at Saturday, Monday and Wednesday. And doctor B will be available at Sunday, Tuesday, Thursday. So while any patient choose doctor A from the Select Doctor field, all the dates with Saturday, Monday and Wednesday will be activated in the datepicker calendar and other dates will be deactivated.

I have already deactivated some selected dates of datepicker calendar. But can't disable date for selected days in datepicker.

html

<input class="form-control" id="appointment_datepicker" name="appointment_datepicker" type="text" placeholder="Select Date" value="">

ajax

    $.ajax({

      url:"",
      type: 'GET',
      data: {_token :token, branch_id_appointment : branch_id_appointment, doctor_id_appointment : doctor_id_appointment},
      success:function(msg){

        $('#appointment_datepicker').datepicker('option', 'beforeShowDay', function(date){
                var day = jQuery.datepicker.formatDate('yy-mm-dd', date);
                return [ msg.indexOf(day) == -1 ] //here msg is the Array of selected Dates which are activated in the datepicker calendar
            });                    
    }
});

Calendar enter image description here

How to solve the issue ? Anybody Help Please ? Thanks in Advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire