//datepicker for online reservation request form jQuery(document).ready(function($) { jQuery('.wpcf7-form-control-wrap.guests select').change(function(){ var temp_ele = jQuery(this); if(temp_ele.val() == '9+'){ alert('Thanks for thinking of Margaux’s Restaurant for your event!\nFor parties over 8 people, please call us to check availability\nPrivate rooms are available for larger party accommodations.\nCall us at 919-846-9846 to check availability!'); temp_ele.val(''); jQuery('#fancybox-content').trigger('click'); } }); $('.wpcf7-form input.datepicker').datepicker({ minDate: 0, dateFormat: 'DD, MM d, yy', showOn: 'both', buttonImage: 'https://margauxsrestaurant.com/wp-content/uploads/2019/10/970099-20.png', beforeShowDay: function(date) { var disabledDays = [ "12-25-2020","12-24-2020","1-1-2021" ]; var hasDays = [ "12-18-20","12-19-20" ]; var m = date.getMonth() + 1; var d = date.getDate(); var y = date.getFullYear(); var theDate = m + '-' + d + '-' + y; if($.inArray(theDate, disabledDays) != -1) { return [false]; } else if($.inArray(theDate, hasDays) != -1) { return [true]; } else { var day = date.getDay(); return [(day != 0)]; } }, onSelect: function(dateText) { dateStr = $.datepicker.parseDate('DD, MM d, yy', dateText); if(dateText.indexOf('November 26') != -1){ $('.wpcf7-form input.datepicker').datepicker('setDate'); alert('Thanks for thinking of Margaux’s Restaurant for your Thanksgiving Day plans!\n\nThanksgiving To Go Menu\n\n$200 Feeds Family of Four\n\nPlease Call 919-846-9846 To Place Order.\n\nAll Orders Must Be Placed By November 20th.\n\nOrders Will Be Picked Up 9a-11:30a on Thanksgiving Morning.'); jQuery('#menu_fancybox_action').trigger('click'); return; } else if(dateText.indexOf('December 31') != -1) { var new_years = confirm('Thanks for thinking of Margaux’s Restaurant for your New Year’s Eve plans!\n\nNew Year’s Eve reservation available NOW via phone only.\n\nPlease note that this year our Prix Fixe menu will not be available.\n\nMore info to come on limited menu ala carte with chef specials & special To-Go menu!\n\nStay tuned!\n\nTo secure your reservation please call us at 919-846-9846.'); $('.wpcf7-form input.datepicker').datepicker('setDate'); if(new_years){ window.location = 'https://margauxsrestaurant.com/new-years-eve-reservations'; return; } return; } else if(dateText.indexOf('February 14') != -1){ //dateText.indexOf('February 13') != -1 || var new_thanksgiving = confirm('Thanks for thinking of Margaux’s Restaurant for your Valentine’s plans! We look forward to celebrating with you!\n\nBecause this is a very special day and we always have a packed house, we require a credit card to reserve your table on Friday Feb 14th, 2020.\n\nWe will be open from 5:30PM to 10PM and will have a 3 Course Prix Fixe menu available at $59.95PP.\n\nTo secure your reservation please call us at 919-846-9846.\n\n'); $('.wpcf7-form input.datepicker').datepicker('setDate'); if(new_thanksgiving){ window.location = 'https://margauxsrestaurant.com/menus/valentines-day'; return; } return; } else if(dateText.indexOf('February 15') != -1){ //dateText.indexOf('February 14') != -1 || var new_thanksgiving = confirm('Thanks for thinking of Margaux’s Restaurant for your Valentine’s plans! We look forward to celebrating with you!\n\nBecause this is a very special day and we always have a packed house, we require a credit card to reserve your table on Saturday Feb 15th, 2020.\n\nWe will be open from 5:30PM to 10PM and will have a 3 Course Prix Fixe menu available at $59.95PP.\n\nTo secure your reservation please call us at 919-846-9846.\n\n'); $('.wpcf7-form input.datepicker').datepicker('setDate'); if(new_thanksgiving){ window.location = 'https://margauxsrestaurant.com/menus/valentines-day'; return; } return; } else if(dateText.indexOf('May 12') != -1){ $('.wpcf7-form input.datepicker').datepicker('setDate'); alert('Thanks for thinking of Margaux’s Restaurant for your Mother’s Day plans!\nWe look forward to celebrating with you!\nBecause this is a very special day and we always have a packed house, we require a credit card to reserve your table on Sunday May 12th, 2019.\nWe will be open from 11AM to 2:30PM and will have a Prix Fixe package at $42.95PP and $15.95 Per Child.\nTo secure your reservation please call us at 919-846-9846.'); jQuery('#menu_fancybox_action').trigger('click'); return; } else if(dateText.indexOf('April 12') != -1){ $('.wpcf7-form input.datepicker').datepicker('setDate'); alert('Thanks for thinking of Margaux’s Restaurant for your Easter Day plans!\n\nWe look forward to celebrating with you!\n\nBecause this is a very special day and we always have a packed house, we require a credit card to reserve your table on Sunday April 12th, 2020.\n\nWe will be open from 11AM to 2PM and will have a Prix Fixe package at $39.95PP and $15.95 Per Child.\n\nTo secure your reservation please call us at 919-846-9846.\n'); jQuery('#menu_fancybox_action').trigger('click'); return; } weekday = $.datepicker.formatDate('DD', dateStr); hour = ''; $('.wpcf7-form #res-hour').empty(); $('.wpcf7-form #res-min').empty(); $('.wpcf7-form #res-hour').append(""); $('.wpcf7-form #res-min').append(""); $('.wpcf7-form #res-hour option[value=""]').attr("selected", "selected"); $('.wpcf7-form #res-min option[value=""]').attr("selected", "selected"); $('.wpcf7-form #res-hour').change(function() { $('.wpcf7-form #res-min').empty(); hour = $(this).val(); //$('.wpcf7-form #res-min').append(""); //$('.wpcf7-form #res-min').prepend(""); //$('.wpcf7-form #res-min option[value="00"]').attr("selected", "selected"); $('.wpcf7-form #res-min option:eq(2)').prop('selected', true); if(dateText == 'Friday, December 18, 2020'){ if ($('#res-hour').val() == '5') { $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); } else if ($('#res-hour').val() == '6') { $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); } else if ($('#res-hour').val() == '7') { $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); } else if ($('#res-hour').val() == '8') { $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); } } else if(dateText == 'Saturday, December 19, 2020'){ if ($('#res-hour').val() == '5') { $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); } else if ($('#res-hour').val() == '6') { $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); } else if ($('#res-hour').val() == '7') { $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); } else if ($('#res-hour').val() == '8') { $('.wpcf7-form #res-min').append(''); $('.wpcf7-form #res-min').append(''); } } else { if (hour == '5' || hour == '11') { $('.wpcf7-form #res-min').append(""); $('.wpcf7-form #res-min').append(""); $('.wpcf7-form #res-min').append(""); $('.wpcf7-form #res-min').append(""); } else if (hour == '1') { $('.wpcf7-form #res-min').append(""); $('.wpcf7-form #res-min').append(""); } else if (hour == '8' && (weekday === 'Monday' || weekday === 'Tuesday' || weekday === 'Wednesday' || weekday === 'Thursday')) { $('.wpcf7-form #res-min').append(""); $('.wpcf7-form #res-min').append(""); } else { $('.wpcf7-form #res-min').append(""); $('.wpcf7-form #res-min').append(""); $('.wpcf7-form #res-min').append(""); $('.wpcf7-form #res-min').append(""); } } }); if(dateText == 'Friday, December 18, 2020'){ $('.wpcf7-form #res-hour').append(''); $('.wpcf7-form #res-hour').append(''); $('.wpcf7-form #res-hour').append(''); $('.wpcf7-form #res-hour').append(''); } else if(dateText == 'Saturday, December 19, 2020'){ $('.wpcf7-form #res-hour').append(''); $('.wpcf7-form #res-hour').append(''); $('.wpcf7-form #res-hour').append(''); $('.wpcf7-form #res-hour').append(''); } else { $('.wpcf7-form #res-hour').append(""); $('.wpcf7-form #res-hour').append(""); $('.wpcf7-form #res-hour').append(""); $('.wpcf7-form #res-hour').append(""); /*if (weekday === 'Friday' || weekday === 'Saturday') { $('.wpcf7-form #res-hour').append(""); }*/ } } }).attr("readOnly", true); $('.wpcf7-form input.datepickerspecial').datepicker({ minDate: 0, dateFormat: 'MM d, yy', showOn: 'both', buttonImage: 'https://margauxsrestaurant.com/wp-content/uploads/2019/10/970099-20.png' }) });