[\\s\\S]*?',
'gi');
var oldHtml;
do {
oldHtml = html;
html = html.replace(tagOrComment, '');
} while (html !== oldHtml);
return html.replace(/ {
if (currentRequest !== null && autocompleteRequest) {
currentRequest.abort();
}
return new Promise((resolve, reject) => {
const ajaxOptions = {
url: url,
method: method,
dataType: dataType,
processData: true,
contentType: contentType,
data: data,
success: (result) => {
resolve(result);
},
error: (error) => {
Swal.fire('Ocurrió algo inesperado', '', 'warning');
console.log(error);
setTimeout(() => {
$("#shader").fadeOut();
}, 300);
reject(false);
},
complete: () => {
//$("#shader").fadeOut();
}
};
if (dataType.toLowerCase() === 'formdata') {
ajaxOptions.contentType = false;
ajaxOptions.processData = false;
}
currentRequest = $.ajax(ajaxOptions);
});
};
getParameter = (sParam) => {
var sPageURL = window.location.search.substring(1),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
}
}
return false;
};
goTo = (url, params, isParamater = true) => {
$('#shader').fadeIn();
let newParams = [];
let value = getParameter('search');
if (value != null && value != '' && value != undefined) {
if (value?.includes('$')) newParams = value.replaceAll(`'`, '').split('$');
else newParams.push(value.replaceAll(`'`, ''));
if (newParams.includes(params)) newParams.splice(newParams.indexOf(params), 1);
else newParams.push(params);
} else {
newParams.push(params)
}
window.location = isParamater
? (newParams.length == 0 ? url : `${url}?search=${newParams.filter((item, i) => newParams.indexOf(item) === i).join('$')}`)
: `${url}/${params}`;
};
launchMenu = () => {
let elementStatus = false;
const className = $('#menu-landing').attr('class');
console.log(className);
if (className.includes('hide')) elementStatus = true;
else if (className.includes('show')) elementStatus = false;
console.log(elementStatus);
$('#menu-landing').removeClass();
if (elementStatus) {
$('#menu-landing').addClass(className.replace('hide', 'show'));
$('body').css({ 'overflow': 'hidden' });
}
else {
$('#menu-landing').addClass(className.replace('show', 'hide'));
$('body').css({ 'overflow': 'auto' });
}
console.log(true);
};
closeModal = (id) => {
$(`#${id}`).modal('hide');
};
showAppModal = () => {
$('#app-modal').modal('show');
};
showWhatsAppModal = (isFirstTime = false) => {
//initGeoLocation()
// .then(({ city, state }) => {
// if (city && state) {
// console.log("Estado:", state);
// console.log("Ciudad:", city);
// } else {
// console.warn("No se pudo obtener ubicación");
// }
// })
// .finally(() => {
$('#business-federal_entity-container_general').load('/Authentication/GetStates', { from: "general" }, (response, status, xhr) => {
if (status != 'success') {
$('#business-federal_entity-container').html(alertMessage);
}
if (!isFirstTime) $('#whatsapp-modal').modal('show');
});
$('#business-municipality_entity-container_general').load('/Authentication/GetMunicipalitiesByState', { state: 0, from: "general" }, (response, status, xhr) => {
if (status != 'success') {
$('#business-municipality_entity-container_general').html(alertMessage);
}
});
//});
};