var wlme_url = "https://waitlist.me/";
var extra_source = "";
var extra_contactId = "";
var extra_placeId = "";
var es_sourceView = "";
var wlme_timer;
var extra_perk_data = "";
if(extra_source != ""){
extra_perk_data = "es="+extra_source;
}
if(extra_placeId != ""){
if(extra_perk_data != ""){
extra_perk_data += "&";
}
extra_perk_data += "es_placeid="+extra_placeId;
}
if(extra_contactId != ""){
if(extra_perk_data != ""){
extra_perk_data += "&";
}
extra_perk_data += "es_contactid="+extra_contactId;
}
if(es_sourceView != ""){
if(extra_perk_data != ""){
extra_perk_data += "&";
}
extra_perk_data += "es_view="+es_sourceView;
}
if(extra_perk_data != ""){
extra_perk_data = "&"+extra_perk_data;
}
if(extra_source == "" || extra_contactId == "" || extra_placeId == ""){
extra_source = "widget";
}
var perkDomain = "https://perklist.uc.r.appspot.com/";
var allDaySlots = ["12:00 AM","00:05 AM", "00:10 AM", "00:15 AM", "00:20 AM", "00:25 AM", "00:30 AM", "00:35 AM", "00:40 AM", "00:45 AM", "00:50 AM", "00:55 AM", "01:00 AM", "01:05 AM", "01:10 AM", "01:15 AM", "01:20 AM", "01:25 AM", "01:30 AM", "01:35 AM", "01:40 AM", "01:45 AM", "01:50 AM", "01:55 AM", "02:00 AM", "02:05 AM", "02:10 AM", "02:15 AM", "02:20 AM", "02:25 AM", "02:30 AM", "02:35 AM", "02:40 AM", "02:45 AM", "02:50 AM", "02:55 AM", "03:00 AM", "03:05 AM", "03:10 AM", "03:15 AM", "03:20 AM", "03:25 AM", "03:30 AM", "03:35 AM", "03:40 AM", "03:45 AM", "03:50 AM", "03:55 AM", "04:00 AM", "04:05 AM", "04:10 AM", "04:15 AM", "04:20 AM", "04:25 AM", "04:30 AM", "04:35 AM", "04:40 AM", "04:45 AM", "04:50 AM", "04:55 AM", "05:00 AM", "05:05 AM", "05:10 AM", "05:15 AM", "05:20 AM", "05:25 AM", "05:30 AM", "05:35 AM", "05:40 AM", "05:45 AM", "05:50 AM", "05:55 AM", "06:00 AM", "06:05 AM", "06:10 AM", "06:15 AM", "06:20 AM", "06:25 AM", "06:30 AM", "06:35 AM", "06:40 AM", "06:45 AM", "06:50 AM", "06:55 AM", "07:00 AM", "07:05 AM", "07:10 AM", "07:15 AM", "07:20 AM", "07:25 AM", "07:30 AM", "07:35 AM", "07:40 AM", "07:45 AM", "07:50 AM", "07:55 AM", "08:00 AM", "08:05 AM", "08:10 AM", "08:15 AM", "08:20 AM", "08:25 AM", "08:30 AM", "08:35 AM", "08:40 AM", "08:45 AM", "08:50 AM", "08:55 AM", "09:00 AM", "09:05 AM", "09:10 AM", "09:15 AM", "09:20 AM", "09:25 AM", "09:30 AM", "09:35 AM", "09:40 AM", "09:45 AM", "09:50 AM", "09:55 AM", "10:00 AM", "10:05 AM", "10:10 AM", "10:15 AM", "10:20 AM", "10:25 AM", "10:30 AM", "10:35 AM", "10:40 AM", "10:45 AM", "10:50 AM", "10:55 AM", "11:00 AM", "11:05 AM", "11:10 AM", "11:15 AM", "11:20 AM", "11:25 AM", "11:30 AM", "11:35 AM", "11:40 AM", "11:45 AM", "11:50 AM", "11:55 AM", "12:00 PM", "12:05 PM", "12:10 PM", "12:15 PM", "12:20 PM", "12:25 PM", "12:30 PM", "12:35 PM", "12:40 PM", "12:45 PM", "12:50 PM", "12:55 PM", "01:00 PM", "01:05 PM", "01:10 PM", "01:15 PM", "01:20 PM", "01:25 PM", "01:30 PM", "01:35 PM", "01:40 PM", "01:45 PM", "01:50 PM", "01:55 PM", "02:00 PM", "02:05 PM", "02:10 PM", "02:15 PM", "02:20 PM", "02:25 PM", "02:30 PM", "02:35 PM", "02:40 PM", "02:45 PM", "02:50 PM", "02:55 PM", "03:00 PM", "03:05 PM", "03:10 PM", "03:15 PM", "03:20 PM", "03:25 PM", "03:30 PM", "03:35 PM", "03:40 PM", "03:45 PM", "03:50 PM", "03:55 PM", "04:00 PM", "04:05 PM", "04:10 PM", "04:15 PM", "04:20 PM", "04:25 PM", "04:30 PM", "04:35 PM", "04:40 PM", "04:45 PM", "04:50 PM", "04:55 PM", "05:00 PM", "05:05 PM", "05:10 PM", "05:15 PM", "05:20 PM", "05:25 PM", "05:30 PM", "05:35 PM", "05:40 PM", "05:45 PM", "05:50 PM", "05:55 PM", "06:00 PM", "06:05 PM", "06:10 PM", "06:15 PM", "06:20 PM", "06:25 PM", "06:30 PM", "06:35 PM", "06:40 PM", "06:45 PM", "06:50 PM", "06:55 PM", "07:00 PM", "07:05 PM", "07:10 PM", "07:15 PM", "07:20 PM", "07:25 PM", "07:30 PM", "07:35 PM", "07:40 PM", "07:45 PM", "07:50 PM", "07:55 PM", "08:00 PM", "08:05 PM", "08:10 PM", "08:15 PM", "08:20 PM", "08:25 PM", "08:30 PM", "08:35 PM", "08:40 PM", "08:45 PM", "08:50 PM", "08:55 PM", "09:00 PM", "09:05 PM", "09:10 PM", "09:15 PM", "09:20 PM", "09:25 PM", "09:30 PM", "09:35 PM", "09:40 PM", "09:45 PM", "09:50 PM", "09:55 PM", "10:00 PM", "10:05 PM", "10:10 PM", "10:15 PM", "10:20 PM", "10:25 PM", "10:30 PM", "10:35 PM", "10:40 PM", "10:45 PM", "10:50 PM", "10:55 PM", "11:00 PM", "11:05 PM", "11:10 PM", "11:15 PM", "11:20 PM", "11:25 PM", "11:30 PM", "11:35 PM", "11:40 PM", "11:45 PM", "11:50 PM", "11:55 PM"];
var timeIncrements = '15';
var incrementBy = 1;
if(timeIncrements == 10){
incrementBy = 2;
}else if(timeIncrements == 15){
incrementBy = 3;
}else if(timeIncrements == 30){
incrementBy = 6;
}else if(timeIncrements == 60){
incrementBy = 12;
}
var newTimeSlots = '';
for(var a = 0; a < allDaySlots.length; a += incrementBy){
newTimeSlots += '';
}
var wlme_time_expired ='
' +
'
' +
' ' +
'
' +
'
' +
'
' +
' ' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
';
var wlme_inactive='' +
'
' +
' Widget Inactive' +
'
' +
'
' +
'
' +
'
' +
'
';
var wlme_html_main='' +
'
' +
' Mission Chinese Food Waitlist' +
'
' +
' ' +
'
' +
'
No one on waitlist
' +
'
' +
' ' +
' ' +
' ' +
'
' +
' ' +
' ' +
'
Waitlist Me
' +
'
';
var wlme_html_add ='' +
'
' +
' Add Yourself' +
'
' +
'
' +
'
' +
' '+
'
' +
'' +
'
' +
'
'+
'
' +
'
'+
'' +
'
' +
'
' +
'
' +
'' +
'
' +
' '+
'
' +
' ' +
'
' +
' ' +
'
' +
'
' +
''+
''+
'
' +
'
' +
'
Date :
' +
'
'+
'
' +
'
' +
'
' +
'
Business is closed on the selected day.
' +
'
' +
'
' +
'
'+
'
'+
'
' +
'
' +
'
'+
'
' +
'
' +
' Waitlist Me' +
'
' +
'
';
var wlme_html_success='' +
'
' +
' Request Sent' +
'
' +
'
' +
'
' +
' Your request has been sent. If you provided a phone number you should receive a confirmation text when your request is confirmed.' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
';
var addButtonText = "+Add";
var wlme_html_slot_suggestion = '';
var wlme_parentelim=document.getElementById('wlme_inclscript').parentElement;
var wlme_div = document.createElement("div");
wlme_div.id="wlme_main"
wlme_div.style.lineHeight = "normal"
wlme_div.style.position = "relative";
if (document.getElementById("wlme_placeholder")) {
document.getElementById('wlme_placeholder').parentElement.removeChild(document.getElementById('wlme_placeholder'));
}
wlme_div.innerHTML=(wlme_html_main + wlme_html_add + wlme_html_success+wlme_html_slot_suggestion);
wlme_parentelim.appendChild(wlme_div);
var wlme_init_seconds = 0;
window.onload = function() {
if(document.getElementById('wlme_curr_timestamp'))
{
if(document.getElementById('wlme_curr_timestamp').value!="")
{
setInterval(wlme_startCurrentTimer, 1000)
}
}
}
function wlme_startCurrentTimer(){
wlme_init_seconds = parseInt(wlme_init_seconds) + 1;
}
function wlme_showAddYourself(cmdType)
{
document.getElementById('wlme_container').style.display='none';
document.getElementById('wlme_container2').style.display='none';
document.getElementById('wlme_container1').style.display='block';
if(cmdType == 'reservation'){
document.getElementById('wlme_reservationrow').style.display = 'block';
document.getElementById('txthidecurrentcmd').value='reservation';
}else{
document.getElementById('wlme_reservationrow').style.display = 'none';
document.getElementById('txthidecurrentcmd').value='waitlist';
}
var showEmailOn = 'none';
var emailRequired = 'no';
if(document.getElementById('txt_collectemail')){
showEmailOn = document.getElementById('txt_collectemail').value;
}
if(document.getElementById('txt_collectemail_required')){
emailRequired = document.getElementById('txt_collectemail_required').value;
}
if(document.getElementById('div_wlme_collect_email')){
document.getElementById('div_wlme_collect_email').style.display = 'none';
}
if(document.getElementById('wlme_email')){
document.getElementById('wlme_email').placeholder = "Email (optional)";
}
if(showEmailOn != 'none'){
if(cmdType == 'waitlist'){
if(showEmailOn == 'waitlist' || showEmailOn == 'both'){
if(document.getElementById('div_wlme_collect_email')){
document.getElementById('div_wlme_collect_email').style.display = 'block';
}
if(emailRequired == 'waitlist' || emailRequired == 'both'){
if(document.getElementById('wlme_email')){
document.getElementById('wlme_email').placeholder = "Email";
}
}
}
}else{
if(showEmailOn == 'reservations' || showEmailOn == 'both'){
if(document.getElementById('div_wlme_collect_email')){
document.getElementById('div_wlme_collect_email').style.display = 'block';
}
if(emailRequired == 'reservations' || emailRequired == 'both'){
if(document.getElementById('wlme_email')){
document.getElementById('wlme_email').placeholder = "Email";
}
}
}
}
}
if(document.getElementById('wlme_name'))
{
document.getElementById('wlme_name').focus();
}
}
var globalSetETAMessage = '';
if(document.getElementById('wlme_country_code_cont')){
document.getElementById('wlme_country_code_cont').innerHTML = ''
}
var wlme_today = new Date();
wlme_today.setHours(0);
wlme_today.setMinutes(0);
wlme_today.setSeconds(0);
var wlme_todayYear = wlme_today.getFullYear();
var wlme_todayMonth = wlme_today.getMonth();
wlme_todayMonth = parseInt(wlme_todayMonth)+1;
if(wlme_todayMonth < 10 ){
wlme_todayMonth = '0'+wlme_todayMonth;
}
var wlme_todayDate = wlme_today.getDate();
if(wlme_todayDate < 10 ){
wlme_todayDate = '0'+wlme_todayDate;
}
var wlme_TodayDateStr = wlme_todayYear+'-'+wlme_todayMonth+'-'+wlme_todayDate;
var wlme_currDate = new Date(wlme_todayYear,(wlme_todayMonth-1),wlme_todayDate);
var wlme_newdate = new Date(wlme_currDate);
wlme_newdate.setDate(wlme_newdate.getDate() + 1);
var wlme_nd = new Date(wlme_newdate);
var wlme_next_year = wlme_nd.getFullYear();
var wlme_next_month = parseInt(wlme_nd.getMonth()+1);
if(wlme_next_month < 10 ){
wlme_next_month = '0'+wlme_next_month;
}
var wlme_next_date = wlme_nd.getDate();
if(wlme_next_date < 10 ){
wlme_next_date = '0'+wlme_next_date;
}
var nextDateStr = wlme_next_year+'-'+wlme_next_month+'-'+wlme_next_date;
var wlme_currDayArr = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
var m_s_jan = "Jan";
var m_s_feb = "Feb";
var m_s_mar = "Mar";
var m_s_apr = "Apr";
var m_s_may = "May";
var m_s_jun = "Jun";
var m_s_jul = "Jul";
var m_s_aug = "Aug";
var m_s_sep = "Sep";
var m_s_oct = "Oct";
var m_s_nov = "Nov";
var m_s_dec = "Dec";
var wlme_currMonArr = [m_s_jan, m_s_feb, m_s_mar, m_s_apr, m_s_may, m_s_jun, m_s_jul, m_s_aug, m_s_sep, m_s_oct, m_s_nov, m_s_dec];
var wlme_currDAY = wlme_nd.getDay();
var wlme_currMON = wlme_nd.getMonth();
var myDayName = (wlme_currDayArr[wlme_currDAY]);
var setDayName = myDayName.toLowerCase();
setDayName = setDayName.replace(/\s+/g,'');
if(setDayName == "sun"){
}
if(setDayName == "mon"){
}
if(setDayName == "tue"){
}
if(setDayName == "wed"){
}
if(setDayName == "thu"){
}
if(setDayName == "fri"){
}
if(setDayName == "sat"){
}
var wlme_next_day_disp_str = myDayName+' '+wlme_currMonArr[wlme_currMON]+' '+wlme_next_date+', '+wlme_next_year;
var makeWLME_Date = '';
if(document.getElementById('wlme_date_section_date')){
document.getElementById('wlme_date_section_date').innerHTML = makeWLME_Date;
document.getElementById("wlme_res_date").onchange = function() { updateDateTimeSlots() };
updateDateTimeSlots();
}
function resetAllOptionValues(){
var select = document.getElementById("datetime_avail_slot");
select.options.length = 0;
var selectOp = document.getElementById("datetime_avail_slot");
selectOp.options[selectOp.options.length] = new Option("Select Time", "", false, false);
for(var a = 0; a < allDaySlots.length; a += incrementBy){
var opValues = allDaySlots[a];
selectOp.options[selectOp.options.length] = new Option(opValues, opValues, false, false);
}
}
function updateDateTimeSlots(){
var _resDate = document.getElementById('wlme_res_date').value;
var _resDateArray = _resDate.split('-');
var selResDate = _resDateArray[0]+'/'+_resDateArray[1]+'/'+_resDateArray[2];
var _resMonth = parseInt(_resDateArray[1]) - 1;
var _reservationDate = new Date(parseInt(_resDateArray[0]), parseInt(_resMonth), parseInt(_resDateArray[2]), 0, 0, 1, 1);
var _wlme_weekDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
var _reservationDayName = _wlme_weekDays[_reservationDate.getDay()];
var busHourStruct = document.getElementById('business_hour_structrue').value;
var _match_dayHour = '';
var busi_Arr = busHourStruct.split(',');
for(var a_h = 0; a_h < busi_Arr.length; a_h++){
var day_Arr = busi_Arr[a_h].split('-');
if(day_Arr[0] == _reservationDayName){
var match_dayVal = day_Arr[1].replace(/^\s*|\s*$/g,'');
if(match_dayVal == 'Closed'){
_match_dayHour = 'all_closed';
}else if(match_dayVal == 'All_Day'){
_match_dayHour = 'all_open';
}else if(match_dayVal == 'Specific_Hours'){
if(day_Arr[2].replace(/^\s*|\s*$/g,'')!=''){
_match_dayHour = day_Arr[2].replace(/^\s*|\s*$/g,'');
}
}
}
}
if(_match_dayHour != ''){
resetAllOptionValues();
if(_match_dayHour == 'all_closed'){
document.getElementById('business_day_closed').style.display = 'block';
var select = document.getElementById("datetime_avail_slot");
select.options.length = 0;
var selectOp = document.getElementById("datetime_avail_slot");
selectOp.options[selectOp.options.length] = new Option("Select Time", "", false, false);
}else if(_match_dayHour == 'all_open'){
document.getElementById('business_day_closed').style.display = 'none';
resetAllOptionValues();
}else{
document.getElementById('business_day_closed').style.display = 'none';
var makeEnableLists = '';
var dayHourArr = _match_dayHour.split('@@');
for(var dh = 0; dh < dayHourArr.length; dh++){
var hRange = dayHourArr[dh];
var startEndRange = hRange.split('#');
var frm_hour = startEndRange[0].replace(/^\s*|\s*$/g,'');
var to_hour = startEndRange[1].replace(/^\s*|\s*$/g,'');
var wlme_from_Hour_Arr = frm_hour.split(' ');
var wlme_from_ampm = wlme_from_Hour_Arr[1];
var wlme_from_hourMin = wlme_from_Hour_Arr[0].split(":");
var wlme_from_h = wlme_from_hourMin[0];
var wlme_from_m = wlme_from_hourMin[1];
var wlme_from_date_stamp = new Date(Date.parse(selResDate+" "+wlme_from_h+":"+wlme_from_m+" "+wlme_from_ampm) );
if(to_hour.trim() == '12:00 am'){
to_hour = '00:01 am';
}
var wlme_to_Hour_Arr = to_hour.split(' ');
var wlme_to_ampm = wlme_to_Hour_Arr[1];
var wlme_to_hourMin = wlme_to_Hour_Arr[0].split(":");
var wlme_to_h = wlme_to_hourMin[0];
var wlme_to_m = wlme_to_hourMin[1];
var wlme_to_date_stamp = new Date(Date.parse(selResDate+" "+wlme_to_h+":"+wlme_to_m+" "+wlme_to_ampm) );
for(var sl = 0; sl < allDaySlots.length; sl++){
var selectionOP = allDaySlots[sl].toLowerCase();
if(selectionOP.trim() == '12:00 am'){
selectionOP = '00:01 am';
}
var hourMinuteAMPM = selectionOP.split(' ');
var hourMinute = hourMinuteAMPM[0].split(':');
var selHour = parseInt(hourMinute[0]);
var selMinute = parseInt(hourMinute[1]);
var selAmPm = hourMinuteAMPM[1];
var mySelectedDate = new Date(Date.parse(selResDate+" "+selHour+":"+selMinute+" "+selAmPm) );
if(mySelectedDate >= wlme_from_date_stamp && mySelectedDate <= wlme_to_date_stamp){
if(makeEnableLists != ''){
makeEnableLists += ',';
}
makeEnableLists += allDaySlots[sl];
}
}
}
if(makeEnableLists != ''){
var enabledArray = makeEnableLists.split(',');
var tempArray = [];
var op = document.getElementById("datetime_avail_slot").getElementsByTagName("option");
for (var i = 0; i < op.length; i++) {
if(enabledArray.includes(op[i].value) ){
tempArray.push(op[i].value);
}
}
var select = document.getElementById("datetime_avail_slot");
select.options.length = 0;
var selectOp = document.getElementById("datetime_avail_slot");
selectOp.options[selectOp.options.length] = new Option("Select Time", "", false, false);
for(var a = 0; a < tempArray.length; a++){
var opValues = tempArray[a];
selectOp.options[selectOp.options.length] = new Option(opValues, opValues, false, false);
}
}
}
}
}
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
function wlme_addData()
{
var continueExecution=1;
if(document.getElementById('blackout_data') ){
if( document.getElementById('blackout_data').value.replace(/^\s*|\s*$/g,'') != ''){
var blackOutData = document.getElementById('blackout_data').value;
var wlme_time_stamp = document.getElementById('wlme_curr_timestamp').value.replace(/^\s*|\s*$/g,'');
var wlme_time_Arr = wlme_time_stamp.split(',');
var wlme_currsTimes = new Date(wlme_time_Arr[0],wlme_time_Arr[1],wlme_time_Arr[2],wlme_time_Arr[3],wlme_time_Arr[4],wlme_time_Arr[5],0,0);
wlme_currsTimes.setSeconds(parseInt(wlme_currsTimes.getSeconds()) + parseInt(wlme_init_seconds));
var wlme_new_Year = wlme_currsTimes.getFullYear();
var wlme_new_month = wlme_currsTimes.getMonth();
var wlme_new_date = wlme_currsTimes.getDate();
var newDateStr = parseInt( parseInt(wlme_new_month)+1)+'-'+parseInt(wlme_new_date)+'-'+parseInt(wlme_new_Year);
var todaySetDate = new Date(newDateStr);
var blackOutData = document.getElementById('blackout_data').value;
var blackOutArr = blackOutData.split('@#@#@#@');
for(var a = 0; a < blackOutArr.length; a++){
var blackOutD = blackOutArr[a];
var blackOutDArr = blackOutD.split('@@');
var chkDateArr = blackOutDArr[0].split('-'); //Y-m-d
var chkDateStr = chkDateArr[1]+'-'+chkDateArr[2]+'-'+chkDateArr[0];
var chkDate = new Date(chkDateStr);
if(todaySetDate.getTime() == chkDate.getTime()){
if(blackOutDArr[1] == "closed" || blackOutDArr[1] == "no widget display"){
continueExecution = 0;
wlme_reload();
}
}
}
}
}
if(document.getElementById('display_hour_structrue'))
{
if(document.getElementById('display_hour_structrue').value.replace(/^\s*|\s*$/g,'') != "")
{
var wlme_disp_hour_struct = document.getElementById('display_hour_structrue').value.replace(/^\s*|\s*$/g,'');
var wlme_time_stamp = document.getElementById('wlme_curr_timestamp').value.replace(/^\s*|\s*$/g,'');
var wlme_time_Arr = wlme_time_stamp.split(',');
var wlme_currsTimes = new Date(wlme_time_Arr[0],wlme_time_Arr[1],wlme_time_Arr[2],wlme_time_Arr[3],wlme_time_Arr[4],wlme_time_Arr[5],0,0);
wlme_currsTimes.setSeconds(parseInt(wlme_currsTimes.getSeconds()) + parseInt(wlme_init_seconds));
var wlme_curr_timestamp = wlme_currsTimes.getTime();
var wlme_new_Year = wlme_currsTimes.getFullYear();
var wlme_new_month = wlme_currsTimes.getMonth();
var wlme_new_date = wlme_currsTimes.getDate();
var wlme_new_hour = wlme_currsTimes.getHours();
var wlme_new_minute = wlme_currsTimes.getMinutes();
var wlme_new_seconds = wlme_currsTimes.getSeconds();
var wlme_weekDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
var wlme_dayName = wlme_weekDays[wlme_currsTimes.getDay()];
var wlme_hour_Arr = wlme_disp_hour_struct.split(",");
var wlme_from_Hour = '';
var wlme_to_Hour = '';
var wlme_match_dayValue = '';
var wlme_match_dayHours = '';
for(var wlme_a = 0; wlme_a < wlme_hour_Arr.length; wlme_a++)
{
var wlme_day_Arr = wlme_hour_Arr[wlme_a].split('-');
if(wlme_day_Arr[0] == wlme_dayName){
wlme_match_dayValue = wlme_day_Arr[1].replace(/^\s*|\s*$/g,'');
if(wlme_match_dayValue == 'Specific_Hours'){
if(wlme_day_Arr[2].replace(/^\s*|\s*$/g,'')!='')
{
wlme_match_dayHours = wlme_day_Arr[2].replace(/^\s*|\s*$/g,'');
}
}
}
}
if(wlme_match_dayValue == 'All_Day'){
continueExecution=1;
}else if(wlme_match_dayValue == 'Closed'){
continueExecution = 0;
var showMsg = 0;
if (typeof jQuery != 'undefined'){
if(typeof jAlert != 'undefined'){
jAlert('Sorry, we can\'t accept your request at this time.','OK', function(){
$("#wlme_name").focus();
});
showMsg = 1
}
}
if(showMsg == 0){
alert("Sorry, we can\'t accept your request at this time.");
}
wlme_reload();
}else{
if(wlme_match_dayHours == ''){
continueExecution=1;
}else{
continueExecution = 0;
var dayHourArr = wlme_match_dayHours.split('@@');
for(var dh = 0; dh < dayHourArr.length; dh++){
if(continueExecution == 0){
var hourTimeParts = dayHourArr[dh].split('#');
wlme_from_Hour = hourTimeParts[0].replace(/^\s*|\s*$/g,'');
wlme_to_Hour = hourTimeParts[1].replace(/^\s*|\s*$/g,'');
if(wlme_from_Hour.trim() == '12:00 am'){
wlme_from_Hour = '00:01 am';
}
if(wlme_to_Hour.trim() == '12:00 am'){
wlme_to_Hour = '00:01 am';
}
var wlme_from_Hour_Arr = wlme_from_Hour.split(' ');
var wlme_from_ampm = wlme_from_Hour_Arr[1];
var wlme_from_hourMin = wlme_from_Hour_Arr[0].split(":");
var wlme_from_h = wlme_from_hourMin[0];
var wlme_from_m = wlme_from_hourMin[1];
if(wlme_from_ampm == 'pm' && wlme_from_h!='12')
{
wlme_from_h = parseInt(wlme_from_h) + 12;
}
var wlme_from_date_stamp = new Date(wlme_new_Year, wlme_new_month, wlme_new_date, wlme_from_h, wlme_from_m, 0).getTime();
var wlme_to_Hour_Arr = wlme_to_Hour.split(' ');
var wlme_to_ampm = wlme_to_Hour_Arr[1];
var wlme_to_hourMin = wlme_to_Hour_Arr[0].split(":");
var wlme_to_h = wlme_to_hourMin[0];
var wlme_to_m = wlme_to_hourMin[1];
if(wlme_to_ampm == 'pm' && wlme_to_h!='12')
{
wlme_to_h = parseInt(wlme_to_h) + 12;
}
var wlme_to_date_stamp = new Date(wlme_new_Year, wlme_new_month, wlme_new_date, wlme_to_h, wlme_to_m, 59).getTime();
if(wlme_curr_timestamp >= wlme_from_date_stamp && wlme_curr_timestamp <= wlme_to_date_stamp)
{
continueExecution = 1;
}else{
continueExecution = 0;
}
}
}
}
}
if(continueExecution == 0 )
{
var showMsg = 0;
if (typeof jQuery != 'undefined'){
if(typeof jAlert != 'undefined'){
jAlert('Sorry, we can\'t accept your request at this time.','OK', function(){
$("#wlme_name").focus();
});
showMsg = 1
}
}
if(showMsg == 0){
alert("Sorry, we can\'t accept your request at this time.");
}
if (typeof setupWLMEAutoWidth == 'function' || typeof loadHostedWidgetPage == 'function')
{
wlme_reload("hosted");
}else{
wlme_reload();
}
return;
}
}
}
if(document.getElementById('specific_hour_struct'))
{
if(document.getElementById('specific_hour_struct').value.replace(/^\s*|\s*$/g,'') != "")
{
var wlme_hour_struct = document.getElementById('specific_hour_struct').value.replace(/^\s*|\s*$/g,'');
var wlme_time_stamp = document.getElementById('wlme_curr_timestamp').value.replace(/^\s*|\s*$/g,'');
var wlme_time_Arr = wlme_time_stamp.split(',');
var wlme_currsTimes = new Date(wlme_time_Arr[0],wlme_time_Arr[1],wlme_time_Arr[2],wlme_time_Arr[3],wlme_time_Arr[4],wlme_time_Arr[5],0,0);
wlme_currsTimes.setSeconds(parseInt(wlme_currsTimes.getSeconds()) + parseInt(wlme_init_seconds));
var wlme_curr_timestamp = wlme_currsTimes.getTime(); /// EQ MAIN
var wlme_new_Year = wlme_currsTimes.getFullYear();
var wlme_new_month = wlme_currsTimes.getMonth();
var wlme_new_date = wlme_currsTimes.getDate();
var wlme_new_hour = wlme_currsTimes.getHours();
var wlme_new_minute = wlme_currsTimes.getMinutes();
var wlme_new_seconds = wlme_currsTimes.getSeconds();
var wlme_weekDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
var wlme_dayName = wlme_weekDays[wlme_currsTimes.getDay()];
var wlme_hour_Arr = wlme_hour_struct.split(",");
var wlme_from_Hour = '';
var wlme_to_Hour = '';
var wlme_match_dayValue = '';
var wlme_match_dayHours = '';
for(var wlme_a = 0; wlme_a < wlme_hour_Arr.length; wlme_a++)
{
var wlme_day_Arr = wlme_hour_Arr[wlme_a].split('-');
if(wlme_day_Arr[0] == wlme_dayName)
{
wlme_match_dayValue = wlme_day_Arr[1].replace(/^\s*|\s*$/g,'');
if(wlme_match_dayValue == 'Specific_Hours'){
if(wlme_day_Arr[2].replace(/^\s*|\s*$/g,'')!='')
{
wlme_match_dayHours = wlme_day_Arr[2].replace(/^\s*|\s*$/g,'');
}
}
}
}
if(wlme_match_dayValue == 'All_Day'){
continueExecution=1;
}else if(wlme_match_dayValue == 'Closed'){
continueExecution = 0;
var showMsg = 0;
if (typeof jQuery != 'undefined'){
if(typeof jAlert != 'undefined'){
jAlert('You are trying to book outside the scheduled time.','OK', function(){
$("#wlme_name").focus();
});
showMsg = 1
}
}
if(showMsg == 0){
alert("You are trying to book outside the scheduled time.");
}
wlme_reload();
}else{
if(wlme_match_dayHours == ''){
continueExecution=1;
}else{
continueExecution = 0;
var dayHourArr = wlme_match_dayHours.split('@@');
for(var dh = 0; dh < dayHourArr.length; dh++){
if(continueExecution == 0){
var hourTimeParts = dayHourArr[dh].split('#');
wlme_from_Hour = hourTimeParts[0].replace(/^\s*|\s*$/g,'');
wlme_to_Hour = hourTimeParts[1].replace(/^\s*|\s*$/g,'');
if(wlme_from_Hour.trim() == '12:00 am'){
wlme_from_Hour = '00:01 am';
}
if(wlme_to_Hour.trim() == '12:00 am'){
wlme_to_Hour = '00:01 am';
}
var wlme_from_Hour_Arr = wlme_from_Hour.split(' ');
var wlme_from_ampm = wlme_from_Hour_Arr[1];
var wlme_from_hourMin = wlme_from_Hour_Arr[0].split(":");
var wlme_from_h = wlme_from_hourMin[0];
var wlme_from_m = wlme_from_hourMin[1];
if(wlme_from_ampm == 'pm' && wlme_from_h!='12')
{
wlme_from_h = parseInt(wlme_from_h) + 12;
}
var wlme_from_date_stamp = new Date(wlme_new_Year, wlme_new_month, wlme_new_date, wlme_from_h, wlme_from_m, 0).getTime();
var wlme_to_Hour_Arr = wlme_to_Hour.split(' ');
var wlme_to_ampm = wlme_to_Hour_Arr[1];
var wlme_to_hourMin = wlme_to_Hour_Arr[0].split(":");
var wlme_to_h = wlme_to_hourMin[0];
var wlme_to_m = wlme_to_hourMin[1];
if(wlme_to_ampm == 'pm' && wlme_to_h!='12')
{
wlme_to_h = parseInt(wlme_to_h) + 12;
}
var wlme_to_date_stamp = new Date(wlme_new_Year, wlme_new_month, wlme_new_date, wlme_to_h, wlme_to_m, 59).getTime();
if(wlme_curr_timestamp >= wlme_from_date_stamp && wlme_curr_timestamp <= wlme_to_date_stamp)
{
continueExecution = 1;
}else{
continueExecution = 0;
}
}
}
}
}
if(continueExecution == 0 )
{
var showMsg = 0;
if (typeof jQuery != 'undefined'){
if(typeof jAlert != 'undefined'){
jAlert('You are trying to book outside the scheduled time.','OK', function(){
$("#wlme_name").focus();
});
showMsg = 1
}
}
if(showMsg == 0){
alert("You are trying to book outside the scheduled time.");
}
if (typeof setupWLMEAutoWidth == 'function' || typeof loadHostedWidgetPage == 'function')
{
wlme_reload("hosted");
}else{
wlme_reload();
}
}
}
}
if(continueExecution==1)
{
if(document.getElementById('wlme_name').value=="")
{
var showMsg = 0
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert('You must enter your name.','OK', function(){
$("#wlme_name").focus();
});
showMsg = 1
return;
}
}
if(showMsg == 0)
{
alert("You must enter your name.");
document.getElementById('wlme_name').focus();
return;
}
}
if(document.getElementById('wlme_size').value!="")
{
var x=document.getElementById('wlme_size').value
var regex=/^[0-9]+$/;
if (!x.match(regex))
{
var showMsg = 0
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert('You must input number in party size','OK', function(){
$("#wlme_size").focus();
});
showMsg = 1
return;
}
}
if(showMsg == 0)
{
alert("You must input number in party size");
document.getElementById('wlme_size').focus();
return;
}
}
else if (x<=0 || x>99)
{
var showMsg = 0
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert('Party size must be from 1 to 99','OK', function(){
$("#wlme_size").focus();
});
showMsg = 1
return;
}
}
if(showMsg == 0)
{
alert("Party size must be from 1 to 99");
document.getElementById('wlme_size').focus();
return;
}
}
}
else
{
var showMsg = 0
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert('You must enter party size.','OK', function(){
$("#wlme_size").focus();
});
showMsg = 1
return
}
}
if(showMsg == 0)
{
alert("You must enter party size.");
document.getElementById('wlme_size').focus();
return
}
}
if(document.getElementById('wlme_phone').value!="")
{
var x=document.getElementById('wlme_phone').value
x = x.replace(/\D/g,'')
var regex=/^[0-9]+$/;
if (!x.match(regex))
{
var showMsg = 0
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert('You must input only numbers in phone','OK', function(){
$("#wlme_phone").focus();
});
showMsg = 1
return
}
}
if(showMsg == 0)
{
alert("You must input only numbers in phone");
document.getElementById('wlme_phone').focus();
return;
}
}
else
{
if(document.getElementById('wlme_suresh').value == "1")
{
if (x.length != 10)
{
var showMsg = 0
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert('You must enter 10 digit Phone number','OK', function(){
$("#wlme_phone").focus();
});
showMsg = 1
return
}
}
if(showMsg == 0)
{
alert("You must enter 10 digit Phone number");
document.getElementById('wlme_phone').focus();
return;
}
}
}
}
}
else
{
var showMsg = 0
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert('You must enter a phone number.','OK', function(){
$("#wlme_phone").focus();
});
showMsg = 1
return
}
}
if(showMsg == 0)
{
alert("You must enter a phone number.");
document.getElementById('wlme_phone').focus();
return
}
}
if(document.getElementById('wlme_notes')){
}
var size = document.getElementById('wlme_size').value
if (size=="") size=0;
var name = document.getElementById('wlme_name').value
var currWaitType = document.getElementById('txthidecurrentcmd').value;
var showEmail = 'no';
var emailRequired = 'no';
if(document.getElementById('txt_collectemail_required')){
emailRequired = document.getElementById('txt_collectemail_required').value;
}
if(document.getElementById('txt_collectemail')){
showEmail = document.getElementById('txt_collectemail').value;
if(showEmail == 'none'){
showEmail = 'no';
}
}
var readEmail = '';
var allToAddEntry = 1;
var frm_hour = '';
var to_hour = '';
var match_dayVal = '';
var match_dayHour = '';
var match_fullDayName = '';
var enteryDayHours = '';
var partySizeIssue = 0;
var partyMinSizeIssue = 0;
var partyMaxSizeIssue = 0;
var partySizeRest = 0;
var restrictMinSize = 2;
var restrictMaxSize = 15;
var waitPartySizeIssue = 0;
var waitPartyMinSizeIssue = 0;
var waitPartyMaxSizeIssue = 0;
var waitPartySizeRest = 0;
var waitRestrictMinSize = 2;
var waitRestrictMaxSize = 15;
var resPastDateSelection = 0;
var bussResLimit = 0;
if(showEmail != 'no'){
if(document.getElementById('wlme_email')){
readEmail = document.getElementById('wlme_email').value;
}
if( (showEmail == 'waitlist' || showEmail == 'both') && currWaitType == 'waitlist'){
if(emailRequired == 'waitlist' || emailRequired == 'both'){
if(readEmail == ''){
if (typeof jQuery != 'undefined'){
if(typeof jAlert != 'undefined'){
jAlert('You must enter your Email.','OK', function(){
});
return
}else{
alert('You must enter your Email.');
return
}
}else{
alert('You must enter your Email.');
return
}
}
}
}else if( (showEmail == 'reservations' || showEmail == 'both') && currWaitType == 'reservation'){
if(emailRequired == 'reservations' || emailRequired == 'both'){
if(readEmail == ''){
if (typeof jQuery != 'undefined'){
if(typeof jAlert != 'undefined'){
jAlert('You must enter your Email.','OK', function(){
});
return
}else{
alert('You must enter your Email.');
return
}
}else{
alert('You must enter your Email.');
return
}
}
}
}
if(readEmail.replace(/^\s*|\s*$/g,'') != ''){
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(readEmail)) {
if (typeof jQuery != 'undefined'){
if(typeof jAlert != 'undefined'){
jAlert('You must enter valid Email.','OK', function(){
});
return
}else{
alert('You must enter valid Email.');
return
}
}else{
alert('You must enter valid Email.');
return
}
}
}
}
if(currWaitType == 'waitlist'){
waitPartySizeRest = document.getElementById('wait_partysizerestriction').value;
if(waitPartySizeRest == 'True'){
waitPartySizeRest = 1;
}else{
waitPartySizeRest = 0;
}
waitRestrictMinSize = document.getElementById('wait_businesshour_min_partysize').value;
waitRestrictMaxSize = document.getElementById('wait_businesshour_max_partysize').value;
if(document.getElementById('wlme_size')){
var wait_currPartySize = document.getElementById('wlme_size').value;
wait_currPartySize = parseInt(wait_currPartySize);
if(waitPartySizeRest == 1 && wait_currPartySize> 0){
if(wait_currPartySize < parseInt(waitRestrictMinSize) || wait_currPartySize > parseInt(waitRestrictMaxSize) ){
waitPartySizeIssue = 1;
}
if(wait_currPartySize < parseInt(waitRestrictMinSize)){
waitPartyMinSizeIssue = 1;
}
if(wait_currPartySize > parseInt(waitRestrictMaxSize)){
waitPartyMaxSizeIssue = 1;
}
}
if(waitPartySizeIssue == 1){
var showWaitRestMsg = '';
if(waitPartyMinSizeIssue == 1){
var minSizeMsg = 'Join Waitlist are limited to groups of more than [min_partysize] people';
showWaitRestMsg = minSizeMsg.replace('[min_partysize]', waitRestrictMinSize);
}
if(waitPartyMaxSizeIssue == 1){
var maxSizeMsg = 'Join Waitlist are limited to groups of less than [max_partysize] people';
showWaitRestMsg = maxSizeMsg.replace('[max_partysize]', waitRestrictMaxSize);
}
if (typeof jQuery != 'undefined'){
if(typeof jAlert != 'undefined'){
jAlert(showWaitRestMsg,'OK', function(){
});
return
}else{
alert(showWaitRestMsg);
return
}
}else{
alert(showWaitRestMsg);
return
}
}
}
}
var selAssignment = '';
if(document.getElementById('txthide_assignmentdisplay')){
if (document.getElementById('txthide_assignmentdisplay').value == 'Optional' || document.getElementById('txthide_assignmentdisplay').value == 'Required' ){
var selAssign = document.getElementById('wlme_sel_resource').value;
if(document.getElementById('txthide_assignmentdisplay').value == 'Required'){
if(selAssign == ''){
var showMsg = 0
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert('Please enter Assignments','OK', function(){
$("#txthide_assignmentdisplay").focus();
});
showMsg = 1
return
}
}
if(showMsg == 0)
{
alert("Please enter Assignments");
document.getElementById('txthide_assignmentdisplay').focus();
return;
}
}
}
if(selAssign == ''){
selAssignment = ''
}else{
selAssignment = '&assignment='+encodeURIComponent(selAssign);
}
}
}
var out_size_hour_msg = 'Please choose a time between [start_time] and [end_time].';
var business_close_msg = 'Closed on [DAY]. Please choose another day';
var business_day_ahead = 30
var dayRangeError = 0;
if(currWaitType == "reservation")
{
partySizeRest = document.getElementById('partysizerestriction').value;
if(partySizeRest == 'True'){
partySizeRest = 1;
}else{
partySizeRest = 0;
}
restrictMinSize = document.getElementById('businesshour_min_partysize').value;
restrictMaxSize = document.getElementById('businesshour_max_partysize').value;
business_res_limit = document.getElementById('business_res_limit').value;
if(business_res_limit == 'True'){
business_res_limit = 1;
}else{
business_res_limit = 0;
}
out_size_hour_msg = document.getElementById('outside_hour_msg').value;
business_day_ahead = document.getElementById('business_days_ahead').value;
if(document.getElementById('business_close_msg') && document.getElementById('business_close_msg').value.replace(/^\s*|\s*$/g,'')!=''){
business_close_msg = document.getElementById('business_close_msg').value;
}
if(document.getElementById('datetime_avail_slot')){
var selETADateTime = document.getElementById('datetime_avail_slot').value;
//04:00 PM
if(selETADateTime == ""){
var showMsg = 0
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert('You must select Hours.','OK', function(){
$("#datetime_avail_slot").focus();
});
showMsg = 1
return
}
}
if(showMsg == 0)
{
alert("You must select Hours.");
document.getElementById('datetime_avail_slot').focus();
return false;
}
return false;
}
var selETADateTimeSPLIT = selETADateTime.split(' ');
var timeSLOT = selETADateTimeSPLIT[0];
var timeSLOTARRAY = timeSLOT.split(':');
var eta_ampm = selETADateTimeSPLIT[1];
var eta_hours = timeSLOTARRAY[0];
var eta_minutes = parseInt(timeSLOTARRAY[1]);
if (eta_ampm =="PM" && parseInt(eta_hours) < 12 ){
eta_hours = parseInt(eta_hours)+parseInt(12);
}
if(eta_minutes < 10)
{
eta_minutes = '0'+eta_minutes
}
}else{
var eta_hours = parseInt(document.getElementById('wlme_res_hour').value);
var eta_minutes = parseInt(document.getElementById('wlme_res_minute').value);
if(eta_hours==-1){
var showMsg = 0
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert('You must select Hours.','OK', function(){
$("#wlme_res_hour").focus();
});
showMsg = 1
return
}
}
if(showMsg == 0)
{
alert("You must select Hours.");
document.getElementById('wlme_res_hour').focus();
return false;
}
}
if(eta_minutes==-1){
var showMsg = 0
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert('You must select Minutes.','OK', function(){
$("#wlme_res_minute").focus();
});
showMsg = 1
return
}
}
if(showMsg == 0)
{
alert("You must select Minutes.");
document.getElementById('wlme_res_minute').focus();
return false;
}
}
eta_hours = parseInt(document.getElementById('wlme_res_hour').value);
eta_minutes = parseInt(document.getElementById('wlme_res_minute').value);
var eta_ampm = document.getElementById('wlme_res_ampm').value;
if (eta_ampm =="am" && parseInt(eta_hours)==12){
eta_hours = 0;
}
if (eta_ampm =="pm" && parseInt(eta_hours) < 12 ){
eta_hours = parseInt(eta_hours)+parseInt(12);
}
if(eta_minutes < 10)
{
eta_minutes = '0'+eta_minutes
}
}
var wlme_sel_date = document.getElementById('wlme_res_date').value;
var wlmeResDateArr = wlme_sel_date.split('-');
var sundayVar = 'Sunday';
var mondayVar = 'Monday';
var tuesdayVar = 'Tuesday';
var wednesdayVar = 'Wednesday';
var thursdayVar = 'Thursday';
var fridayVar = 'Friday';
var saturdayVar = 'Saturday';
var moreWeekDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
var moreFullDays = [sundayVar, mondayVar, tuesdayVar, wednesdayVar, thursdayVar, fridayVar, saturdayVar];
var selResDate = wlmeResDateArr[0]+'/'+wlmeResDateArr[1]+'/'+wlmeResDateArr[2];
if(document.getElementById('datetime_avail_slot')){
var selETADateTime = document.getElementById('datetime_avail_slot').value;
var selETADateTimeSPLIT = selETADateTime.split(' ');
var timeSLOT = selETADateTimeSPLIT[0];
var timeSLOTARRAY = timeSLOT.split(':');
var selResAMPM = selETADateTimeSPLIT[1];
var selResHour = timeSLOTARRAY[0];
var selResMinute = parseInt(timeSLOTARRAY[1]);
}else{
var selResHour = parseInt(document.getElementById('wlme_res_hour').value);
var selResMinute = parseInt(document.getElementById('wlme_res_minute').value);
var selResAMPM = document.getElementById('wlme_res_ampm').value;
}
var mySelectedDate = new Date(Date.parse(selResDate+" "+selResHour+":"+selResMinute+" "+selResAMPM) );
/* ########################################################################## */
var selectedGetTime = mySelectedDate.getTime();
var wlme_time_stamp2 = document.getElementById('wlme_curr_timestamp').value.replace(/^\s*|\s*$/g,'');
var wlme_time_Arr2 = wlme_time_stamp2.split(',');
var wlme_currsTimes2 = new Date(wlme_time_Arr2[0],wlme_time_Arr2[1],wlme_time_Arr2[2],wlme_time_Arr2[3],wlme_time_Arr2[4],wlme_time_Arr2[5],0,0);
wlme_currsTimes2.setSeconds(parseInt(wlme_currsTimes2.getSeconds()) + parseInt(wlme_init_seconds));
var wlme_curr_timestamp2 = wlme_currsTimes2.getTime();
var wlme_new_Year2 = wlme_currsTimes2.getFullYear();
var wlme_new_month2 = wlme_currsTimes2.getMonth();
var wlme_new_date2 = wlme_currsTimes2.getDate();
var wlme_new_hour2 = wlme_currsTimes2.getHours();
var wlme_new_minute2 = wlme_currsTimes2.getMinutes();
var wlme_new_seconds2 = wlme_currsTimes2.getSeconds();
var myServerDateTime = new Date(wlme_new_Year2, wlme_new_month2, wlme_new_date2, wlme_new_hour2, wlme_new_minute2, wlme_new_seconds2);
var myServerTime = myServerDateTime.getTime();
if(myServerTime > selectedGetTime){
allToAddEntry = 0;
resPastDateSelection = 1;
}
/* ######################################################################### */
var resDay = moreWeekDays[mySelectedDate.getDay()];
match_fullDayName = moreFullDays[mySelectedDate.getDay()];
var businessStruct = document.getElementById('business_hour_structrue').value;
var busi_Arr = businessStruct.split(',');
for(var a_h = 0; a_h < busi_Arr.length; a_h++)
{
var day_Arr = busi_Arr[a_h].split('-');
if(day_Arr[0] == resDay)
{
match_dayVal = day_Arr[1].replace(/^\s*|\s*$/g,'');
if(match_dayVal == 'Specific_Hours'){
if(day_Arr[2].replace(/^\s*|\s*$/g,'')!='')
{
match_dayHour = day_Arr[2].replace(/^\s*|\s*$/g,'');
enteryDayHours = match_dayHour;
}
}
}
}
if(match_dayVal == 'All_Day'){
allToAddEntry = 1;
}else if(match_dayVal == 'Closed'){
allToAddEntry = 0;
}else
{
if(match_dayHour == ''){
allToAddEntry = 1;
}else{
allToAddEntry = 0;
var dayHourArr = match_dayHour.split('@@');
for(var dh = 0; dh < dayHourArr.length; dh++){
if(allToAddEntry == 0){
var hourTimeParts = dayHourArr[dh].split('#');
frm_hour = hourTimeParts[0].replace(/^\s*|\s*$/g,'');
to_hour = hourTimeParts[1].replace(/^\s*|\s*$/g,'');
var wlme_from_Hour_Arr = frm_hour.split(' ');
var wlme_from_ampm = wlme_from_Hour_Arr[1];
var wlme_from_hourMin = wlme_from_Hour_Arr[0].split(":");
var wlme_from_h = wlme_from_hourMin[0];
var wlme_from_m = wlme_from_hourMin[1];
var wlme_from_date_stamp = new Date(Date.parse(selResDate+" "+wlme_from_h+":"+wlme_from_m+" "+wlme_from_ampm) );
if(to_hour.trim() == '12:00 am'){
//to_hour = '12:00 pm';
to_hour = '00:01 am';
}
var wlme_to_Hour_Arr = to_hour.split(' ');
var wlme_to_ampm = wlme_to_Hour_Arr[1];
var wlme_to_hourMin = wlme_to_Hour_Arr[0].split(":");
var wlme_to_h = wlme_to_hourMin[0];
var wlme_to_m = wlme_to_hourMin[1];
var wlme_to_date_stamp = new Date(Date.parse(selResDate+" "+wlme_to_h+":"+wlme_to_m+" "+wlme_to_ampm) );
if(mySelectedDate >= wlme_from_date_stamp && mySelectedDate <= wlme_to_date_stamp)
{
allToAddEntry = 1;
}else{
allToAddEntry = 0;
}
}
}
}
}
var wlme_curr_timezone = document.getElementById('wlme_res_timezone').value;
var wlme_eta_time = wlme_sel_date+' '+eta_hours+':'+eta_minutes+':00';
var moreCMDType = "&estimated_arrival_time="+wlme_eta_time+"&currtimezone="+wlme_curr_timezone;
if(document.getElementById('wlme_size'))
{
var currPartySize = document.getElementById('wlme_size').value;
currPartySize = parseInt(currPartySize);
if(partySizeRest == 1 && currPartySize> 0){
if(currPartySize < parseInt(restrictMinSize) || currPartySize > parseInt(restrictMaxSize) ){
partySizeIssue = 1;
allToAddEntry = 0;
}
if(currPartySize < parseInt(restrictMinSize)){
partyMinSizeIssue = 1;
}
if(currPartySize > parseInt(restrictMaxSize)){
partyMaxSizeIssue = 1;
}
}
}
if(document.getElementById('txt_advanceschedule_min') && document.getElementById('txt_advanceschedule_min').value.replace(/^\s*|\s*$/g,'')!=''){
var minTime = document.getElementById('txt_advanceschedule_min').value.replace(/^\s*|\s*$/g,'');
minTime = parseInt(minTime);
if(minTime > 0){
var wlme_time_stamp2 = document.getElementById('wlme_curr_timestamp').value.replace(/^\s*|\s*$/g,'');
var wlme_time_Arr2 = wlme_time_stamp2.split(',');
var wlme_currsTimes2 = new Date(wlme_time_Arr2[0],wlme_time_Arr2[1],wlme_time_Arr2[2],wlme_time_Arr2[3],wlme_time_Arr2[4],wlme_time_Arr2[5],0,0);
var newMinuteToSecond = parseInt(minTime) * 60;
wlme_currsTimes2.setSeconds(parseInt(wlme_currsTimes2.getSeconds()) + parseInt(wlme_init_seconds) + parseInt(newMinuteToSecond));
var wlme_new_Year2 = wlme_currsTimes2.getFullYear();
var wlme_new_month2 = wlme_currsTimes2.getMonth();
var wlme_new_date2 = wlme_currsTimes2.getDate();
var wlme_new_hour2 = wlme_currsTimes2.getHours();
var wlme_new_minute2 = wlme_currsTimes2.getMinutes();
var wlme_new_second2 = wlme_currsTimes2.getSeconds();
var newSTR = wlme_new_Year2+"-"+wlme_new_month2+"-"+wlme_new_date2+" "+wlme_new_hour2+":"+wlme_new_minute2+":"+wlme_new_second2;
if(selectedGetTime < wlme_currsTimes2.getTime()){
var minTimeAdvanceMsg = '';
var beforeSchTimeMsg = "You must schedule a time at least [BEFORE_TIME] in advance of the current time.";
if(minTime < 1440){
var minToHourIs = minTime / 60;
if(minToHourIs > 1){
minTimeAdvanceMsg = minToHourIs+' hours';
}else{
minTimeAdvanceMsg = minToHourIs+' hour';
}
}else{
var minToDayIs = minTime / 60;
minToDayIs = minToDayIs / 24;
if(minToDayIs > 1){
minTimeAdvanceMsg = minToDayIs+' days';
}else{
minTimeAdvanceMsg = minToDayIs+' day';
}
}
beforeSchTimeMsg = beforeSchTimeMsg.replace('[BEFORE_TIME]', minTimeAdvanceMsg);
alert(beforeSchTimeMsg);
return;
}
}
}
if(document.getElementById('business_days_ahead') && document.getElementById('business_days_ahead').value.replace(/^\s*|\s*$/g,'')!=''){
if(business_res_limit == 1)
{
business_day_ahead = parseInt(business_day_ahead);
var todayDateObj = new Date();
var todayFullYear = todayDateObj.getFullYear();
var todayCurrMonth = todayDateObj.getMonth();
todayCurrMonth = parseInt(todayCurrMonth) + 1;
var todayCurrDate = todayDateObj.getDate();
var todayDateStr = todayFullYear+"/"+todayCurrMonth+"/"+todayCurrDate;
var todayD = new Date(Date.parse(todayDateStr));
var dayAfter = new Date(todayD);
if(parseInt(business_day_ahead) >0 ){
dayAfter.setDate(dayAfter.getDate() + parseInt(business_day_ahead));
dayAfter.setHours(23);
dayAfter.setMinutes(59);
dayAfter.setSeconds(59);
if( mySelectedDate > dayAfter){
dayRangeError = 1;
allToAddEntry = 0;
}
}else{
if(parseInt(business_day_ahead) == 0 ){
var dayAfter = new Date();
dayAfter.setHours(23);
dayAfter.setMinutes(59);
dayAfter.setSeconds(59);
if( mySelectedDate > dayAfter){
dayRangeError = 1;
allToAddEntry = 0;
}
}
}
}
}
if(document.getElementById('blackout_data') ){
var errorDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
if(document.getElementById('blackout_data').value.replace(/^\s*|\s*$/g,'') != ''){
var blackOutData = document.getElementById('blackout_data').value;
var blackOutDataArray = blackOutData.split('@#@#@#@');
var selDateArray = wlme_sel_date.split('-'); //Y-m-d
var sYear = parseInt(selDateArray[0]);
var sMonth = parseInt(selDateArray[1]);
sMonth = sMonth - 1;
var sDate = parseInt(selDateArray[2]);
var selDateMatch = new Date(sYear, sMonth, sDate);
for(var b = 0; b < blackOutDataArray.length; b++){
var bParts = blackOutDataArray[b].split('@@');
var bDateArray = bParts[0].split('-'); //Y-m-d
var chkDateStr = bDateArray[1]+'-'+bDateArray[2]+'-'+bDateArray[0];
var chkDateStr_match = bDateArray[0]+'-'+bDateArray[1]+'-'+bDateArray[2];
var mYear = parseInt(bDateArray[0]);
var mMonth = parseInt(bDateArray[1]);
mMonth = mMonth - 1;
var mDate = parseInt(bDateArray[2]);
var chkDate = new Date(mYear, mMonth, mDate);
if(selDateMatch.getTime() == chkDate.getTime()){
var bType = bParts[1];
if (bType == "closed" || bType == "no reservations"){
allToAddEntry = 0;
var errorDayName = errorDays[chkDate.getDay()];
var blackDayErrorMsg = "Sorry, we aren't accepting reservations for [DAY_NAME], [party_date]";
blackDayErrorMsg = blackDayErrorMsg.replace('[DAY_NAME]', errorDayName);
blackDayErrorMsg = blackDayErrorMsg.replace('[party_date]', chkDateStr.replace(/-/gi,'/'));
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert(blackDayErrorMsg,'OK', function(){
});
}else{
alert(blackDayErrorMsg);
}
}else{
alert(blackDayErrorMsg);
}
return;
}
}
}
}
}
}else{
var moreCMDType = "&estimated_arrival_time=";
}
if(resPastDateSelection == 1){
allToAddEntry = 0;
}
if(allToAddEntry == 0){
if(resPastDateSelection == 1){
var pastDateSelectionIssue = 'Please select valid future date time';
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert(pastDateSelectionIssue,'OK', function(){
});
}else{
alert(pastDateSelectionIssue);
}
}else{
alert(pastDateSelectionIssue);
}
}
else{
if(dayRangeError == 1){
var advanceDayMsg = "You can only make a reservation [number_of_days] days in advance";
advanceDayMsg = advanceDayMsg.replace('[number_of_days]', business_day_ahead);
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert(advanceDayMsg,'OK', function(){
});
}else{
alert(advanceDayMsg);
}
}else{
alert(advanceDayMsg);
}
}else
{
if(partySizeIssue == 1)
{
var partyMinMsgIssue = 'Reservations are limited to groups of more than [min_partysize] people';
partyMinMsgIssue = partyMinMsgIssue.replace('[min_partysize]', restrictMinSize);
var partyMaxMsgIssue = 'Reservations are limited to groups of less than [max_partysize] people';
partyMaxMsgIssue = partyMaxMsgIssue.replace('[max_partysize]', restrictMaxSize);
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
if( partyMinSizeIssue == 1){
jAlert(partyMinMsgIssue,'OK', function(){
});
}
if(partyMaxSizeIssue == 1){
jAlert(partyMaxMsgIssue,'OK', function(){
});
}
}else{
if( partyMinSizeIssue == 1){
alert(partyMinMsgIssue);
}
if(partyMaxSizeIssue == 1){
alert(partyMaxMsgIssue);
}
}
}else{
if( partyMinSizeIssue == 1){
alert(partyMinMsgIssue);
}
if(partyMaxSizeIssue == 1){
alert(partyMaxMsgIssue);
}
}
}
else
{
if(match_dayVal == 'Closed'){
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
business_close_msg = business_close_msg.replace('[DAY]', match_fullDayName);
jAlert(business_close_msg,'OK', function(){
});
}else{
business_close_msg = business_close_msg.replace('[DAY]', match_fullDayName);
alert(business_close_msg);
}
}else{
business_close_msg = business_close_msg.replace('[DAY]', match_fullDayName);
alert(business_close_msg);
}
}else{
var dateObj1 = new Date();
var fullYear1 = dateObj1.getFullYear();
var currMonth1 = dateObj1.getMonth();
currMonth1 = parseInt(currMonth1) + 1;
var currDate1 = dateObj1.getDate();
var dateStr1 = fullYear1+"/"+currMonth1+"/"+currDate1;
var strArr1 = enteryDayHours.split('@@');
var myHourLists1 = new Array();
for(var s = 0; s < strArr1.length; s++){
var stHourArr1 = strArr1[s].split('#');
var stHour1 = stHourArr1[0].trim();
var setDate1 = new Date(Date.parse(dateStr1+" "+stHour1));
setDate1 = setDate1.getTime();
myHourLists1.push({name: strArr1[s].trim(), val: setDate1});
}
myHourLists1.sort(function(a,b) {
return a.val - b.val;
});
var newFromToHTML = '';
for(var a = 0; a < myHourLists1.length; a++){
if(newFromToHTML == ''){
newFromToHTML = myHourLists1[a].name;
}else{
newFromToHTML += '@@'+myHourLists1[a].name;
}
}
enteryDayHours = newFromToHTML;
enteryDayHours = enteryDayHours.replace(/#/g, ' and ');
enteryDayHours = enteryDayHours.replace(/@@/g, ' or ');
//enteryDayHours = enteryDayHours.replace(/12:00 am/g, '12:00 pm');
out_size_hour_msg = out_size_hour_msg.replace('[start_time] and [end_time]', enteryDayHours);
out_size_hour_msg = out_size_hour_msg.replace('[start_time] [m_and] [end_time]', enteryDayHours);
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert(out_size_hour_msg,'OK', function(){
});
}else{
alert(out_size_hour_msg);
}
}else{
alert(out_size_hour_msg);
}
}
}
}
}
}else
{
var phone = '';
var phone = document.getElementById('wlme_phone').value;
phone = phone.replace(/\D/g,'');
if(document.getElementById('wlme_suresh')){
var coutryC = document.getElementById('wlme_suresh').value;
coutryC = coutryC.replace(/^\s*|\s*$/g,'');
phone = "(%2B"+coutryC+")"+phone;
}
var notes = ''
if(document.getElementById('wlme_notes') )
{
notes = document.getElementById('wlme_notes').value
}
var script = document.createElement('script');
checkAddHosted = 0;
script.onload = function() {
if (typeof setupWLMEAutoWidth == 'function') {
checkAddHosted = 1;
}
}
var passEmailData = '';
if(readEmail != ''){
passEmailData = '&email='+encodeURIComponent(readEmail);
}
var moreExtraParams = "";
if(extra_contactId != ""){
moreExtraParams = '&es_contactid='+extra_contactId;
}
if(extra_placeId != ""){
moreExtraParams += '&es_placeid='+extra_placeId;
}
enableDisableAddButton('disable');
script.src = wlme_url+'api/add_party_remotely_widget?size='+size+'&name='+encodeURIComponent(name)+'&phone='+phone+'¬es='+encodeURIComponent(notes)+moreCMDType+passEmailData+'&place_id=12362140506'+selAssignment+'&source='+extra_source+moreExtraParams;
/*
var currentDayMatchRule = '';
if(currWaitType == "reservation"){
var chkDate = new Date(wlme_sel_date);
var selectedDay = moreWeekDays[chkDate.getDay()];
var schRules = document.getElementById('txtschedlingrules').value;
var schRuleArr = schRules.split('###');
for(var rule = 0; rule < schRuleArr.length; rule++){
var fullDayRule = schRuleArr[rule];
var fullDayRuleArr = fullDayRule.split('=');
if(fullDayRuleArr[0] == selectedDay){
currentDayMatchRule = fullDayRuleArr[1]+'='+fullDayRuleArr[2]+'='+fullDayRuleArr[3]+'='+fullDayRuleArr[4];
}
}
}*/
document.body.appendChild(script);
if(extra_source != "" && extra_placeId != "" && extra_contactId != ""){
if(currWaitType == "waitlist"){
return;
}
}
if(currWaitType == "reservation")
{
var eta_msg_ = document.getElementById('waitlist_eta_confirm_msg').value;
if(eta_msg_.indexOf('[') > -1 && eta_msg_.indexOf(']') > -1)
{
eta_msg_ = eta_msg_.replace('[size]', ''+currPartySize+'');
var wlme_sel_dateArr = wlme_sel_date.split('-');
var new_wlme_sel_date = wlme_sel_dateArr[1]+'-'+wlme_sel_dateArr[2]+'-'+wlme_sel_dateArr[0];
if(eta_hours > 12){
eta_hours = parseInt(eta_hours) - 12;
}
eta_msg_ = eta_msg_.replace('[eta]', ''+new_wlme_sel_date+' '+eta_hours+':'+eta_minutes+' '+eta_ampm+'');
}else{
}
globalSetETAMessage = eta_msg_;
/*if(currentDayMatchRule != '' && currentDayMatchRule != '-1=-1=-1=-1'){
document.getElementById('wlme_req_sent_msg').innerHTML = eta_msg_;
}else{*/
enableDisableAddButton('disable');
//}
}else
{
if(document.getElementById('wlme_container'))
{
document.getElementById('wlme_container').style.display='none';
}
document.getElementById('wlme_container2').style.display='block';
document.getElementById('wlme_container1').style.display='none';
if(document.getElementById('set_auto_auto_add_pref') || document.getElementById('set_auto_auto_add_pref').value == 'disabled'){
var myPhone = '(415) 863-2800';
myPhone = myPhone.replace('(','');
myPhone = myPhone.replace(')','');
myPhone = myPhone.replace(' ','-');
var m_here = 'here';
var waitMsg = "You've been added to the waitlist at Mission Chinese Food ("+myPhone+"). Visit here to check your place in line.";
if(document.getElementById('txthide_widgetconfirm_msg') && document.getElementById('txthide_widgetconfirm_msg').value != ''){
waitMsg = document.getElementById('txthide_widgetconfirm_msg').value;
}
waitMsg = waitMsg.replace('[link]', m_here);
document.getElementById('wlme_req_sent_msg').innerHTML = waitMsg;
if(document.getElementById('hide_auto_refresh_widget')) {
if( document.getElementById('hide_auto_refresh_widget').value == "True"){
if (typeof setupWLMEAutoWidth == 'function' || typeof loadHostedWidgetPage == 'function')
{
wlme_timer=setTimeout('wlme_reload("hosted")', 7000);
}else{
wlme_timer=setTimeout('wlme_reload()', 7000);
}
}
}
}
else
{
if (typeof setupWLMEAutoWidth == 'function' || typeof loadHostedWidgetPage == 'function')
{
wlme_timer=setTimeout('wlme_reload("hosted")', 7000);
}else{
wlme_timer=setTimeout('wlme_reload()', 7000);
}
}
}
}
}else
{
if (typeof setupWLMEAutoWidth == 'function' || typeof loadHostedWidgetPage == 'function')
{
wlme_reload("hosted");
}else{
wlme_reload();
}
}
}
function isHTMLString(str) {
var a = document.createElement('div');
a.innerHTML = str;
for (var c = a.childNodes, i = c.length; i--; ) {
if (c[i].nodeType == 1) return true;
}
return false;
}
function enableDisableAddButton(cmd){
if(cmd == 'enable'){
document.getElementById('wlme_btnadddata').disabled = false;
//document.getElementById('wlme_btnadddata').value = addButtonText;
document.getElementById('wlme_btnadddata').innerText = addButtonText;
}else{
document.getElementById('wlme_btnadddata').disabled = true;
//document.getElementById('wlme_btnadddata').value = 'Please wait';
document.getElementById('wlme_btnadddata').innerText = 'Please wait';
}
}
function closeSlotSuggestion(){
enableDisableAddButton('enable');
var suggestionBoxHTML = document.getElementById('wlme_slot_suggestion_datacontainer');
suggestionBoxHTML.innerHTML = '';
var suggestionBox = document.getElementById('wlme_slot_suggestion_container');
suggestionBox.style.display = 'none';
}
function selectNewTimeSlot(selTime){
if(confirm('Schedule for '+selTime+'?')){
var newSelTimeArray = selTime.split(' ');
var selTimeHourMinute = newSelTimeArray[0];
var selTimeAMPM = newSelTimeArray[1];
var selTimeHourMinuteArray = selTimeHourMinute.split(':');
var selTimeHour = selTimeHourMinuteArray[0];
var selTimeMinute = selTimeHourMinuteArray[1];
selTimeHour = selTimeHour.replace(/^\s*|\s*$/g,'');
if(selTimeHour.length == 1){
selTimeHour = "0"+selTimeHour;
selTime = selTimeHour+":"+selTimeMinute+" "+selTimeAMPM;
}
document.getElementById('datetime_avail_slot').value = selTime;
closeSlotSuggestion();
wlme_addData();
}
}
function wlme_callResponseInfo(results)
{
if(results.checkscheduleerror != null){
if(isHTMLString(results.checkscheduleerror) ){
var suggestionBox = document.getElementById('wlme_slot_suggestion_container');
suggestionBox.style.display = 'block';
var suggestionBoxHTML = document.getElementById('wlme_slot_suggestion_datacontainer');
suggestionBoxHTML.innerHTML = results.checkscheduleerror;
}else{
if (typeof jQuery != 'undefined')
{
if(typeof jAlert != 'undefined')
{
jAlert(results.checkscheduleerror,'OK', function(){
});
enableDisableAddButton('enable');
return;
}else{
alert(results.checkscheduleerror);
enableDisableAddButton('enable');
return;
}
}else{
alert(results.checkscheduleerror);
enableDisableAddButton('enable');
return;
}
}
document.getElementById('wlme_btnadddata').disabled = false;
document.getElementById('wlme_btnadddata').value = addButtonText;
}else
{
var esContactId = "";
var esContactSource = "";
var esPartyRequestId = "";
var esNewPartyId = "";
var esRequestType = "waitlist";
var esRequestStatus = "Pending confirmation";
var esQuotedTime = "";
var esPlaceId = "";
var esRequestTime = "";
var esETATime = "";
if(results.es_contactid != null && results.es_source != null && results.es_placeid != null){
esContactId = results.es_contactid;
esContactSource = results.es_source;
esPlaceId = results.es_placeid;
if(results.partyrequrestid != null){
esPartyRequestId = results.partyrequrestid;
}
if(results.newpartyid != null){
esNewPartyId = results.newpartyid;
esRequestStatus = "Confirmed";
esQuotedTime = "0";
}
if(results.requesttype != null){
esRequestType = results.requesttype;
}
if(results.es_eta != null){
esETATime = results.es_eta;
}
var __wlme_currentDateOb = new Date();
var __wlme_new_Year = __wlme_currentDateOb.getFullYear();
var __wlme_new_month = __wlme_currentDateOb.getMonth();
__wlme_new_month = parseInt(__wlme_new_month) + 1;
if(__wlme_new_month < 10){
__wlme_new_month = "0"+__wlme_new_month;
}
var __wlme_new_date = __wlme_currentDateOb.getDate();
if(__wlme_new_date < 10){
__wlme_new_date = "0"+__wlme_new_date;
}
var __wlme_new_hour = __wlme_currentDateOb.getHours();
if(__wlme_new_hour < 10){
__wlme_new_hour = "0"+__wlme_new_hour;
}
var __wlme_new_minute = __wlme_currentDateOb.getMinutes();
if(__wlme_new_minute < 10){
__wlme_new_minute = "0"+__wlme_new_minute;
}
var __wlme_new_seconds = __wlme_currentDateOb.getSeconds();
if(__wlme_new_seconds < 10){
__wlme_new_seconds = "0"+__wlme_new_seconds;
}
esRequestTime = __wlme_new_Year+"-"+__wlme_new_month+"-"+__wlme_new_date+" "+__wlme_new_hour+":"+__wlme_new_minute+":"+__wlme_new_seconds;
}
if(esContactId != "" && esContactSource != "" && esPlaceId != ""){
var perkCallingURL = perkDomain+"api/v2/update_reservation_party_waitlist";
var waitlistCustomURL = 'https://waitlist.me/n/missionchinesefood';
var post_json_data = {
secret_key: "wmTrgUfA_vipdig",
request_id: esPartyRequestId,
reservation_id: esNewPartyId,
status: esRequestStatus,
place_id: esPlaceId,
contact_id: esContactId,
is_passed: 'false',
r_type: esRequestType,
eta: esETATime
}
if(esRequestType == "waitlist"){
post_json_data['request_time'] = esRequestTime
post_json_data['quoted_time'] = esQuotedTime
}
fetch(perkCallingURL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(post_json_data)
})
.then(response => response.json())
.then(data => {
// Handle the response data if needed
var newURL = waitlistCustomURL;
if(esNewPartyId == ""){
newURL += '?q='+esPartyRequestId;
}else{
newURL += '?'+newPartyId;
}
if(esRequestType == "waitlist"){
var postJSONDATA = {
__newcommand: 'public_waitlist',
__perkmessage: newURL,
}
try{
window.parent.parent.postMessage(
postJSONDATA,
'*'
)
}catch (error) {
}
try{
var posttodevice = JSON.stringify(postJSONDATA);
window.AndroidInterface.receiveMessage(posttodevice);
}catch (error) {
}
}else{
var postJSONDATA = {
__newcommand: 'show_reservations',
__perkmessage: "",
}
try{
window.parent.parent.postMessage(
postJSONDATA,
'*'
)
}catch (error) {
}
try{
var posttodevice = JSON.stringify(postJSONDATA);
window.AndroidInterface.receiveMessage(posttodevice);
}catch (error) {
}
}
})
.catch(error => {
//console.log("Error Generate;");
// Handle any errors
});
}
if(results.requesttype == null){
esRequestType = "waitlist";
var reloadPage = 1;
if (results.newpartyid == null){
if(results.partyrequrestid == null){
if (typeof setupWLMEAutoWidth == 'function' || typeof loadHostedWidgetPage == 'function')
{
wlme_timer=setTimeout('wlme_reload("hosted")', 7000);
}else{
wlme_timer=setTimeout('wlme_reload()', 7000);
}
}else{
var parRequestId = results.partyrequrestid;
var linkURL = 'https://waitlist.me/n/missionchinesefood?q='+parRequestId;
}
}else{
var newPartyId = results.newpartyid;
var linkURL = 'https://waitlist.me/n/missionchinesefood?'+newPartyId;
}
var myPhone = '(415) 863-2800';
myPhone = myPhone.replace('(','');
myPhone = myPhone.replace(')','');
myPhone = myPhone.replace(' ','-');
var m_here = 'here';
var waitMsg = "You've been added to the waitlist at Mission Chinese Food ("+myPhone+"). Visit here to check your place in line.";
if(document.getElementById('txthide_widgetconfirm_msg') && document.getElementById('txthide_widgetconfirm_msg').value != ''){
waitMsg = document.getElementById('txthide_widgetconfirm_msg').value;
}
waitMsg = waitMsg.replace('[link]', ""+m_here+"");
document.getElementById('wlme_req_sent_msg').innerHTML = waitMsg;
if(document.getElementById('hide_auto_refresh_widget')) {
if( document.getElementById('hide_auto_refresh_widget').value == "True"){
if (typeof setupWLMEAutoWidth == 'function' || typeof loadHostedWidgetPage == 'function')
{
wlme_timer=setTimeout('wlme_reload("hosted")', 7000);
}else{
wlme_timer=setTimeout('wlme_reload()', 7000);
}
}
}
if(document.getElementById('widget_html_area')){
document.getElementById('widget_html_area').style.display = 'none';
}
if(document.getElementById('confirm_html_area')){
document.getElementById('confirm_html_area').style.display = 'block';
}
}else if(results.requesttype == 'reservation'){
if(document.getElementById('wlme_container'))
{
document.getElementById('wlme_container').style.display='none';
}
document.getElementById('wlme_container2').style.display='block';
document.getElementById('wlme_container1').style.display='none';
document.getElementById('wlme_req_sent_title').innerHTML = 'Request Sent';
document.getElementById('wlme_req_sent_msg').innerHTML = globalSetETAMessage;
if(document.getElementById('widget_html_area')){
document.getElementById('widget_html_area').style.display = 'none';
}
if(document.getElementById('confirm_html_area')){
document.getElementById('confirm_html_area').style.display = 'block';
}
}
}
}
function wlme_reload(chkHosted)
{
if(document.getElementById('wlme_curr_timestamp'))
{
if(document.getElementById('wlme_curr_timestamp').value!="")
{
wlme_init_seconds = 0;
}
}
var chkHosted = (chkHosted == null) ? '' : chkHosted;
if(chkHosted == 'hosted')
{
window.location.reload();
}else
{
clearTimeout(wlme_timer);
var offsetHeight = document.getElementById('wlme_main').offsetHeight;
var offsetWidth = document.getElementById('wlme_main').offsetWidth;
var parentelim=document.getElementById('wlme_inclscript').parentElement;
var div = document.createElement("div");
div.id="wlme_placeholder"
div.style.height = offsetHeight + "px";
div.style.width = offsetWidth + "px";
document.getElementById('wlme_inclscript').parentElement.removeChild(document.getElementById('wlme_inclscript'));
document.getElementById('wlme_main').parentElement.removeChild(document.getElementById('wlme_main'));
parentelim.appendChild(div);
var script = document.createElement('script');
script.id= 'wlme_inclscript';
script.onload = function() { if (typeof setupWLMEAutoWidth == 'function') {
setupWLMEAutoWidth();
}
}
script.src = wlme_url+'load_widget_script/?wg=12350811612'+extra_perk_data;
parentelim.appendChild(script);
if(document.getElementById('confirm_html_area')){
document.getElementById('confirm_html_area').style.display = 'none';
}
if(document.getElementById('widget_html_area')){
document.getElementById('widget_html_area').style.display = 'block';
}
}
}
if(es_sourceView != ""){
if(typeof wlme_showAddYourself === 'function'){
if(es_sourceView == "waitlist" || es_sourceView == "reservation"){
if(document.getElementById('wlme_container') || document.getElementById('wlme_container2') || document.getElementById('wlme_container1') ){
wlme_showAddYourself(es_sourceView);
}
}
}
}