Warning: Undefined variable $DirVersionFolder in /home/drsimple/public_html/App/Controllers/Application.php on line 392
/*
* Código de propriedade da empresa SimplesTI.
* É restrita qualquer alteração, cópia ou
* utilização não autorizada do mesmo.
* Todos os direitos reservados. SimplesTI - 2018
*/
const Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timerProgressBar: true,
onOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer);
toast.addEventListener('mouseleave', Swal.resumeTimer);
},
});
var swal_errors = {
atualIndex: 0,
errors: [],
show: function () {
'use strict';
if (this.errors[this.atualIndex])
Toast.fire(this.errors[this.atualIndex]).then(() => {
this.errors.splice(this.atualIndex, 1);
// this.atualIndex++;
this.show();
})
}
}
function serializeForm(form) {
var formSerialized = new FormData($(form).get(0));
return formSerialized;
}
function postAjax(form, url, campo) {
var formData = serializeForm(form);
$.ajax({
type: "POST",
data: formData,
url: url,
contentType: false,
processData: false,
cache: false,
headers: {
'Cache-Control': 'no-cache'
},
beforeSend: function () {
$("#preLoaderPage").show();
},
complete: function () {
$("#preLoaderPage").hide();
},
success: function (data) {
$('#' + campo).html(data);
}
});
}
$(document).on('submit', 'form', function (e) {
if ($(this).attr('ajax') == 'true') {
e.preventDefault();
postAjax($(this), $(this).attr('action'), $(this).attr('result'), $(this).attr('preloader'));
}
});