Current path: home/webdevt/cryptoimpot.fr/public/dist/js/
?? Go up: /home/webdevt/cryptoimpot.fr/public/dist
$(document).ready(function () {
$("button#submit").click(function (event) {
event.preventDefault();
$.ajax({
type: "POST",
url: "/fiscalite-crypto-test-questionnaire-regime-occasionnel-particulier-professionnel", //process to mail
data: $('#form-activite').serialize(),
success: function (data) {
console.log(data);
if (data && data.success && data.success.messages.length > 0) {
for (var i = 0; i < data.success.messages.length; i++) {
var message = data.success.messages[i];
var color = message.color;
var progressbar = '<div class="progress">';
if (color == 'vert') {
progressbar += '<div class="progress-bar bg-success " role="progressbar" style="width: 90%" aria-valuenow="90" aria-valuemin="0" aria-valuemax="100"></div>';
} else if (color == 'bleu') {
progressbar += '<div class="progress-bar bg-primary" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>';
} else if (color == 'jaune') {
progressbar += '<div class="progress-bar bg-secondary" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>';
} else if (color == 'orange') {
progressbar += '<div class="progress-bar bg-warning" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>';
} else if (color == 'rouge') {
progressbar += '<div class="progress-bar bg-danger" role="progressbar" style="width: 90%" aria-valuenow="90" aria-valuemin="0" aria-valuemax="100"></div>';
}
progressbar += '</div>';
swal.fire({
// content: progressbar,
// type: 'error',
// title: message.header,
// text: message.body + progressbar,
// footer: message.footer
title: '<h3>' + message.header + '</h3>',
icon: 'success',
html:
message.body + '<br><br>' + progressbar,
// showCloseButton: true,
// showCancelButton: true,
focusConfirm: false,
confirmButtonText:
'<i class="fa fa-thumbs-up"></i> OK!',
confirmButtonAriaLabel: 'OK!',
// cancelButtonText:
// '<i class="fa fa-thumbs-down"></i>',
// cancelButtonAriaLabel: 'Thumbs down'
}).then(function () {
// location.reload();
});
console.log(data.exchange);
// $('#container-file-' + data.exchange).html('');
// $('#container-delete-button-trade-' + data.exchange).hide();
}
// Swal.fire({
// type: 'success',
// title: message.header,
// text: message.body + progressbar,
// footer: message.footer
// }).then(function () {
//// location.reload();
// });
console.log(data.exchange);
// $('#container-file-' + data.exchange).html('');
// $('#container-delete-button-trade-' + data.exchange).hide();
} else if (data && data.error && data.error.messages.length > 0) {
for (var i = 0; i < data.error.messages.length; i++)
{
var message = data.error.messages[i];
swal.fire({
// content: progressbar,
// type: 'error',
// title: message.header,
// text: message.body + progressbar,
// footer: message.footer
title: '<h3>' + message.header + '</h3>',
icon: 'error',
html:
message.body,
// showCloseButton: true,
// showCancelButton: true,
focusConfirm: false,
confirmButtonText:
'<i class="fa fa-thumbs-up"></i> OK!',
confirmButtonAriaLabel: 'OK!',
// cancelButtonText:
// '<i class="fa fa-thumbs-down"></i>',
// cancelButtonAriaLabel: 'Thumbs down'
}).then(function () {
});
console.log(data.exchange);
// $('#container-file-' + data.exchange).html('');
// $('#container-delete-button-trade-' + data.exchange).hide();
}
}
},
error: function () {
alert("failure");
}
});
});
});