\r\nHours with availability include:` + finalReturnString;
}
else{
//
var suggestionBox = document.getElementById('wlme_slot_suggestion_container');
suggestionBox.style.display = 'block';
var suggestionBoxHTML = document.getElementById('wlme_slot_suggestion_datacontainer');
suggestionBoxHTML.innerHTML = `${responseFromAi.reason}`;
}
jQuery('.delay-loader').hide();
}
else{
if(responseFromAi.resource){
let finalAssign = responseFromAi.resource;
let finalNotes = notes;
if(finalAssign.length > 1){
finalNotes+= ` Suggested Resources: ${finalAssign}`
finalAssign = finalAssign[0];
}
script.src = wlme_url+'api/add_party_remotely_widget?size='+size+'&name='+encodeURIComponent(name)+'&phone='+phone+'¬es='+encodeURIComponent(finalNotes)+moreCMDType+passEmailData+'&place_id=10898770107&assignment='+encodeURIComponent(finalAssign)+'&source='+extra_source+moreExtraParams;
}
else{
script.src = wlme_url+'api/add_party_remotely_widget?size='+size+'&name='+encodeURIComponent(name)+'&phone='+phone+'¬es='+encodeURIComponent(notes)+moreCMDType+passEmailData+'&place_id=10898770107'+selAssignment+'&source='+extra_source+moreExtraParams;
}
jQuery('.delay-loader').hide();
}
}
});
}
else{
script.src = wlme_url+'api/add_party_remotely_widget?size='+size+'&name='+encodeURIComponent(name)+'&phone='+phone+'¬es='+encodeURIComponent(notes)+moreCMDType+passEmailData+'&place_id=10898770107'+selAssignment+'&source='+extra_source+moreExtraParams;
}
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 = '(928) 474-7455';
myPhone = myPhone.replace('(','');
myPhone = myPhone.replace(')','');
myPhone = myPhone.replace(' ','-');
var m_here = 'here';
var waitMsg = "You've been added to the waitlist at Fargo's Steakhouse ("+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.toUpperCase();
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/10898770107';
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/10898770107?q='+parRequestId;
}
}else{
var newPartyId = results.newpartyid;
var linkURL = 'https://waitlist.me/n/10898770107?'+newPartyId;
}
var myPhone = '(928) 474-7455';
myPhone = myPhone.replace('(','');
myPhone = myPhone.replace(')','');
myPhone = myPhone.replace(' ','-');
var m_here = 'here';
var waitMsg = "You've been added to the waitlist at Fargo's Steakhouse ("+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=10920370140'+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);
}
}
}
}