2110 lines
90 KiB
PHP
2110 lines
90 KiB
PHP
|
|
<?php
|
|
global $vPage, $strCode, $vDomaine, $tabEvenement, $strStep, $strLangue, $arrTermesModalButtons, $strValidationMembership;
|
|
|
|
if (fxCookiesAllowMarketing()) {
|
|
if (isset($tabEvenement['general']) && trim($tabEvenement['general']['eve_plugins']) != '') {
|
|
echo trim($tabEvenement['general']['eve_plugins']);
|
|
}
|
|
}
|
|
|
|
if (fxCookiesAllowAnalytics()) {
|
|
echo $vGoogleAnalytics;
|
|
}
|
|
|
|
if ($strLangue == 'fr') {
|
|
$mem_login = "compte";
|
|
} else {
|
|
$mem_login = "account";
|
|
}
|
|
$message_login = afficheTexte('listeatt_textlogin', 0, 1, 1);
|
|
|
|
|
|
$message = str_replace('%url%', $mem_login, $message_login);
|
|
|
|
?>
|
|
<script>
|
|
$('.btn_liste_attente').click(function (e) {
|
|
e.preventDefault();
|
|
let epr_id = $(this).data('epr_id');
|
|
$.ajax({
|
|
url: '../ajax_liste_attente.php', // Remplacez par votre script de validation
|
|
type: 'POST',
|
|
data: {
|
|
epr_id: epr_id,
|
|
lang: "<?php echo($strLangue);?>",
|
|
textnew: "<?php afficheTexte('listeatt_textnew', 1, 1, 1); ?>",
|
|
textins: "<?php afficheTexte('listeatt_textins', 1, 1, 1); ?>",
|
|
textlogin: "<?php echo $message ?>"
|
|
}, // Ajoutez vos paramètres nécessaires
|
|
dataType: 'json',
|
|
success: function (response) {
|
|
let message = "";
|
|
|
|
if (response.success) {
|
|
message = response.message;
|
|
} else {
|
|
message = response.message;
|
|
}
|
|
|
|
// Appel de Bootbox après que le message est défini
|
|
bootbox.confirm({
|
|
title: "<?php echo ($strLangue == 'fr') ? 'Liste' : 'Waitlist'; ?>",
|
|
message: message,
|
|
buttons: {
|
|
confirm: {
|
|
label: '<?php echo ($strLangue == 'fr') ? 'Ok' : 'OK'; ?>',
|
|
className: 'btn btn-success rounded-0'
|
|
},
|
|
cancel: {
|
|
label: '',
|
|
className: 'd-none' // Cache le bouton Annuler
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
|
|
}
|
|
});
|
|
},
|
|
error: function () {
|
|
let message = "<?php echo ($strLangue == 'fr') ? 'Erreur de connexion au serveur' : 'Server connection error'; ?>";
|
|
|
|
bootbox.alert({
|
|
title: "<?php echo ($strLangue == 'fr') ? 'Erreur' : 'Error'; ?>",
|
|
message: message
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
</script>
|
|
<?php if (fxCookiesAllowMarketing()) { ?>
|
|
<script>
|
|
window.fbAsyncInit = function () {
|
|
FB.init({
|
|
appId: '<?php echo fxGetVariable('fb_app_id'); ?>',
|
|
autoLogAppEvents: true,
|
|
xfbml: true,
|
|
version: 'v3.2'
|
|
});
|
|
};
|
|
|
|
(function (d, s, id) {
|
|
var js, fjs = d.getElementsByTagName(s)[0];
|
|
if (d.getElementById(id)) {
|
|
return;
|
|
}
|
|
js = d.createElement(s);
|
|
js.id = id;
|
|
js.src = "https://connect.facebook.net/<?php echo $strLangue; ?>_CA/sdk.js";
|
|
fjs.parentNode.insertBefore(js, fjs);
|
|
}(document, 'script', 'facebook-jssdk'));
|
|
</script>
|
|
<?php } ?>
|
|
<script src="https://www.google.com/recaptcha/api.js?render=<?php echo RECAPTCHA_SITE_KEY; ?>&hl=<?php echo $strLangue;
|
|
if ($strLangue == 'fr') {
|
|
echo '-CA';
|
|
} ?>"></script>
|
|
<script src="<?php echo $vDomaine; ?>/plugins/select2-4.0.13/dist/js/i18n/<?php echo $strLangue; ?>.js"></script>
|
|
<?php
|
|
if ($strLangue == 'fr') {
|
|
?>
|
|
<script type="text/javascript"
|
|
src="<?php echo $vDomaine; ?>/plugins/bootstrap-select/js/i18n/defaults-fr_FR.js"></script>
|
|
<script type="text/javascript" src="<?php echo $vDomaine; ?>/plugins/jqery.validate-1.19.1/messages_fr.js"></script>
|
|
<script src="<?php echo $vDomaine; ?>/plugins/flatpickr-4.6.13/dist/l10n/fr.js"></script>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<script type="text/javascript"
|
|
src="<?php echo $vDomaine; ?>/plugins/bootstrap-select/js/i18n/defaults-en_US.min.js"></script>
|
|
<?php
|
|
}
|
|
?>
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
var $preloader = $('#preloader');
|
|
var $preloader_text = $('#preloader_text');
|
|
var $body = $('body');
|
|
|
|
if (window.Ms1Loader) {
|
|
Ms1Loader.init({
|
|
src: '<?php echo $vDomaine; ?>/images/ms1-runner-loader.gif?v=<?php echo _VERSION_CODE; ?>',
|
|
labelWait: <?php echo json_encode(afficheTexte('preloader_wait', 0, 0, 1), JSON_UNESCAPED_UNICODE); ?>
|
|
});
|
|
}
|
|
|
|
// MSIN-4436 — Loader dès le clic vers gestion qtés/dossards v2 (attente serveur PHP).
|
|
var strNavLoaderMsg = <?php echo json_encode(afficheTexte('preloader_wait', 0, 0, 1), JSON_UNESCAPED_UNICODE); ?>;
|
|
$(document).on('click', 'a[href*="inc_tableau_gestion_epreuves"]', function (e) {
|
|
if (e.defaultPrevented || e.which !== 1 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
|
|
return;
|
|
}
|
|
var strTarget = this.getAttribute('target');
|
|
if (strTarget && strTarget !== '_self') {
|
|
return;
|
|
}
|
|
var strHref = this.getAttribute('href');
|
|
if (!strHref || strHref.charAt(0) === '#') {
|
|
return;
|
|
}
|
|
if (window.Ms1Loader) {
|
|
Ms1Loader.show(strNavLoaderMsg || undefined);
|
|
} else {
|
|
$preloader_text.html(strNavLoaderMsg || '…');
|
|
$preloader.show();
|
|
}
|
|
});
|
|
|
|
function ms1LoaderInlineHtml() {
|
|
return window.Ms1Loader ? Ms1Loader.inlineHtml() : '<div class="inscr-gestion-muted" style="padding:10px;">…</div>';
|
|
}
|
|
|
|
try {
|
|
$("input[type='text']").each(function () {
|
|
$(this).attr("autocomplete", "<?php echo uniqid(); ?>");
|
|
});
|
|
} catch (e) {
|
|
}
|
|
$("form").keypress(function (e) {
|
|
//Enter key
|
|
if ($(this).attr("id") !== "frm_contact") {
|
|
if (e.which == 13) {
|
|
return false;
|
|
} }
|
|
});
|
|
bsCustomFileInput.init();
|
|
$('[data-toggle="tooltip"]').tooltip({
|
|
boundary: 'window'
|
|
});
|
|
$('[data-toggle="popover"]').popover({
|
|
container: 'body',
|
|
html: true,
|
|
placement: 'bottom',
|
|
sanitize: false
|
|
});
|
|
// if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
|
|
// $('.selectpicker').selectpicker('mobile');
|
|
// }
|
|
//$('[data-toggle="popover-x"]').popoverX({placement: 'auto'});
|
|
$(".btn_delete_part_supplementaire").click(function (event) {
|
|
event.preventDefault();
|
|
var strAnswer = confirm("Are you sure you want to delete?");
|
|
if (strAnswer == true) {
|
|
window.location = $(this).attr('href');
|
|
}
|
|
});
|
|
$(".btn_page_prec").click(function () {
|
|
document.location.href = $(this).data('code');
|
|
return false;
|
|
});
|
|
$('.select2-single').select2({
|
|
language: '<?php echo $strLangue; ?>',
|
|
minimumResultsForSearch: Infinity,
|
|
theme: "bootstrap4",
|
|
width: 'elemment'
|
|
});
|
|
$('.select2-multi').select2({
|
|
language: '<?php echo $strLangue; ?>',
|
|
minimumResultsForSearch: Infinity,
|
|
theme: "bootstrap4",
|
|
width: 'elemment'
|
|
});
|
|
$('.select2-multi').on('select2:opening select2:closing', function (event) {
|
|
var $searchfield = $(this).parent().find('.select2-search__field');
|
|
$searchfield.prop('disabled', true);
|
|
});
|
|
<?php
|
|
if (isset($_SESSION['com_info'])) {
|
|
?>
|
|
$('.btn_logout').click(function (e) {
|
|
e.preventDefault();
|
|
|
|
bootbox.confirm({
|
|
title: "<?php afficheTexte('confirm-logout-title', 1, 1, 1); ?>",
|
|
message: "<?php afficheTexte('confirm-logout-message', 1, 1, 1); ?>",
|
|
buttons: {
|
|
confirm: {
|
|
label: '<?php afficheTexte('confirm-logout-btn-confirm', 1, 1, 1); ?>',
|
|
className: 'btn btn-primary rounded-0'
|
|
},
|
|
cancel: {
|
|
label: '<?php afficheTexte('confirm-logout-btn-cancel', 1, 1, 1); ?>',
|
|
className: 'btn btn-secondary rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
document.location.href = '<?php echo $vDomaine; ?>/logout.php?lang=<?php echo $strLangue; ?>';
|
|
}
|
|
}
|
|
});
|
|
});
|
|
<?php
|
|
}
|
|
|
|
switch ($vPage) {
|
|
case 'compte.php':
|
|
case 'mobile.php':
|
|
if ($footer_script == true) {
|
|
?>
|
|
|
|
|
|
$('.btn_update_prod').click(function () {
|
|
var $id = $(this).data('id');
|
|
var $key = $(this).data('key');
|
|
var $table = $(this).data('table');
|
|
var $preloader = $('#preloader');
|
|
|
|
bootbox.confirm({
|
|
title: "ATTENTION",
|
|
message: "Êtes-vous certain de vouloir mettre en PROD ?",
|
|
buttons: {
|
|
confirm: {
|
|
label: 'Oui',
|
|
className: 'btn btn-primary rounded-0'
|
|
},
|
|
cancel: {
|
|
label: 'Non',
|
|
className: 'btn btn-secondary rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
$preloader.show();
|
|
$.post('<?php echo $vDomaine; ?>/superadm/ajax_update_prod.php', 't=' + $table + '&id=' + $id + '&key=' + $key, function ($resultajax) {
|
|
|
|
window.location.reload();
|
|
|
|
}, 'json');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
$(".btn_activation").on("click", function (event) {
|
|
event.preventDefault();
|
|
var $preloader = $('#preloader');
|
|
$preloader.show();
|
|
var $link = $(this);
|
|
var $action = $link.data('action');
|
|
var $table = $link.data('table');
|
|
var $field = $link.data('field');
|
|
var $key = $link.data('key');
|
|
var $valeur = $link.data('valeur');
|
|
var $id = $link.data('id');
|
|
|
|
$.post('<?php echo $vDomaine; ?>/superadm/enregistrer.php', 'action=' + $action + '&table=' + $table + '&field=' + $field + '&key=' + $key + '&valeur=' + $valeur + '&id=' + $id, function ($result) {
|
|
if ($result.state == 'success') {
|
|
$link.toggleClass('btn-danger');
|
|
$link.toggleClass('btn-success');
|
|
|
|
if ($result.pnq_cadeau != '') { // insérer la date du update
|
|
var $field_date = '#' + $field + '_date_' + $id;
|
|
$($field_date).text($result.pnq_cadeau);
|
|
}
|
|
|
|
if ($valeur == 1) {
|
|
$link.data('valeur', 0);
|
|
$link.html('<i class="fa fa-check" aria-hidden="true"></i>');
|
|
} else {
|
|
$link.data('valeur', 1);
|
|
$link.html('<i class="fa fa-times" aria-hidden="true"></i>');
|
|
}
|
|
} else {
|
|
alert($result.state);
|
|
}
|
|
|
|
$preloader.fadeOut();
|
|
}, 'json');
|
|
});
|
|
|
|
|
|
$(".btn_remis").on("click", function (event) {
|
|
event.preventDefault();
|
|
var $link = $(this);
|
|
var $action = $link.data('action');
|
|
var $table = $link.data('table');
|
|
var $field = $link.data('field');
|
|
var $key = $link.data('key');
|
|
var $valeur = $link.data('valeur');
|
|
var $id = $link.data('id');
|
|
|
|
// Execute reellement la bascule du statut "dossard recupere".
|
|
function doRemis() {
|
|
var $preloader = $('#preloader');
|
|
$preloader.show();
|
|
|
|
// console.log('https://ms1inscriptiondev.interne.ca/superadm/enregistrer.php?action=' + $action + '&table=' + $table + '&field=' + $field + '&key=' + $key + '&valeur=' + $valeur + '&id=' + $id );
|
|
|
|
$.post('<?php echo $vDomaine; ?>/superadm/enregistrer.php', 'par_id=<?php echo($_SESSION['com_info']['com_id']); ?> & par=<?php echo($_SESSION['com_info']['com_prenom'] . ' ' . $_SESSION['com_info']['com_nom']); ?> & action=' + $action + '&table=' + $table + '&field=' + $field + '&key=' + $key + '&valeur=' + $valeur + '&id=' + $id, function ($result) {
|
|
if ($result.state == 'success') {
|
|
$link.toggleClass('btn-primary');
|
|
$link.toggleClass('btn-success');
|
|
//console.log($result);
|
|
|
|
var $field_date = '#date_' + $id;
|
|
$($field_date).text($result.result.no_bib_remis_date
|
|
);
|
|
var $field_par = '#par_' + $id;
|
|
$($field_par).text($result.result.no_bib_remis_par
|
|
);
|
|
|
|
|
|
if ($valeur == 1) {
|
|
$link.data('valeur', 0);
|
|
$link.html('<i class="fa fa-check" aria-hidden="true"></i>');
|
|
} else {
|
|
$link.data('valeur', 1);
|
|
$link.html('<i class="fa fa-sharp fa-regular fa-square fa-2xs" aria-hidden="true"></i>');
|
|
}
|
|
} else {
|
|
alert(($result && ($result.message || $result.state)) || 'Erreur');
|
|
}
|
|
|
|
$preloader.fadeOut();
|
|
}, 'json');
|
|
}
|
|
|
|
// Retrait de la mention "dossard recupere" (valeur 0 = on enleve) -> confirmation.
|
|
// La pose (valeur 1) reste immediate. Standard projet : bootbox.confirm.
|
|
if ($valeur == 0) {
|
|
bootbox.confirm({
|
|
title: "<?php if ($strLangue == 'fr') { ?>Confirmation<?php } else { ?>Confirmation<?php } ?>",
|
|
message: "<?php if ($strLangue == 'fr') { ?>Êtes-vous certain de vouloir retirer la mention « dossard récupéré » pour ce participant ?<?php } else { ?>Are you sure you want to remove the "bib retrieved" status for this participant?<?php } ?>",
|
|
buttons: {
|
|
confirm: {
|
|
label: '<?php if ($strLangue == 'fr') { ?>Retirer<?php } else { ?>Remove<?php } ?>',
|
|
className: 'btn btn-danger rounded-0'
|
|
},
|
|
cancel: {
|
|
label: '<?php afficheTexte('confirm-btn-cancel', 1, 1, 1); ?>',
|
|
className: 'btn btn-secondary rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
doRemis();
|
|
}
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
|
|
doRemis();
|
|
});
|
|
|
|
$('body').on("click", ".link_confirmation", function (e) {
|
|
e.preventDefault();
|
|
|
|
var $no_panier = $(this).data('no_panier');
|
|
var $no_commande = $(this).data('no_commande');
|
|
var $lng = $(this).data('lng');
|
|
|
|
bootbox.confirm({
|
|
title: "Confirmation",
|
|
message: "<?php if ($strLangue == 'fr') { ?>Êtes-vous certain de vouloir envoyer la confirmation de la commande<?php } else { ?>Are you sure you want to send the confirmation for order<?php } ?> <strong>" + $no_commande + "</strong> ?",
|
|
buttons: {
|
|
confirm: {
|
|
label: '<?php if ($strLangue == 'fr') { ?>Renvoyer<?php } else { ?>Resend<?php } ?>',
|
|
className: 'btn btn-primary rounded-0'
|
|
},
|
|
cancel: {
|
|
label: '<?php afficheTexte('confirm-logout-btn-cancel', 1, 1, 1); ?>',
|
|
className: 'btn btn-secondary rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
if (window.Ms1Loader) {
|
|
Ms1Loader.show(<?php echo json_encode(afficheTexte('preloader_wait', 0, 0, 1), JSON_UNESCAPED_UNICODE); ?>);
|
|
} else {
|
|
$preloader.show();
|
|
}
|
|
$.post('<?php echo $vDomaine; ?>/ajax_confirmation.php', 'no_panier=' + $no_panier + '&lng=' + $lng, function ($result) {
|
|
if (window.Ms1Loader) {
|
|
Ms1Loader.hide();
|
|
} else {
|
|
$preloader.fadeOut('slow');
|
|
}
|
|
bootbox.alert($result.state);
|
|
}, 'json').fail(function () {
|
|
if (window.Ms1Loader) {
|
|
Ms1Loader.hide();
|
|
} else {
|
|
$preloader.fadeOut('slow');
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
$(".btn_edit_event_promo").click(function () {
|
|
intEprId = $(this).data('epr_id');
|
|
intPecId = $(this).val();
|
|
code = $(this).data('eve_code');
|
|
|
|
if ('<?php echo $strLangue ?>' == 'fr') {
|
|
strpath = '/reserver/';
|
|
} else {
|
|
strpath = '/book/';
|
|
}
|
|
|
|
// MSIN-4474 — ramener à la liste d'origine après Enregistrer / Annuler
|
|
document.location.href = '<?php echo $vDomaine; ?>' + strpath + code + '/' + intEprId
|
|
+ '?promoteur=1&action=mod&pec_id=' + intPecId
|
|
+ '&return_url=' + encodeURIComponent(window.location.href);
|
|
});
|
|
<?php
|
|
}
|
|
?>
|
|
$(".btn_edit_event_client").click(function () {
|
|
intEprId = $(this).data('epr_id');
|
|
intPecId = $(this).val();
|
|
code = $(this).data('eve_code');
|
|
|
|
if ('<?php echo $strLangue ?>' == 'fr') {
|
|
strpath = '/reserver/';
|
|
} else {
|
|
strpath = '/book/';
|
|
}
|
|
|
|
document.location.href = '<?php echo $vDomaine; ?>' + strpath + code + '/' + intEprId + '?action=mod&pec_id=' + intPecId;
|
|
});
|
|
$(".liste_inscriptions").click(function () {
|
|
$("#table_liste").toggle();
|
|
});
|
|
$(".btn_modifier_compte").click(function () {
|
|
if ('<?php echo $strLangue ?>' == 'fr') {
|
|
document.location.href = '/compte/modifiercompte';
|
|
} else {
|
|
document.location.href = '/account/modifiercompte'
|
|
}
|
|
});
|
|
<?php
|
|
if (isset($arrFormsTransfert) && count($arrFormsTransfert) > 0) {
|
|
foreach ($arrFormsTransfert as $pec_id) {
|
|
?>
|
|
$('#frm_xfer_<?php echo $pec_id; ?>')
|
|
.validate({
|
|
rules: {
|
|
tra_nom_<?php echo $pec_id; ?>: "required",
|
|
tra_prenom_<?php echo $pec_id; ?>: "required",
|
|
tra_courriel_<?php echo $pec_id; ?>: {
|
|
required: true,
|
|
email: true
|
|
}
|
|
},
|
|
messages: {
|
|
tra_nom_<?php echo $pec_id; ?>: "<?php afficheTexte('transfert_validation-tra_nom-required'); ?>",
|
|
tra_prenom_<?php echo $pec_id; ?>: "<?php afficheTexte('transfert_validation-tra_prenom-required'); ?>",
|
|
tra_courriel_<?php echo $pec_id; ?>: {
|
|
required: "<?php afficheTexte('transfert_validation-tra_courriel-required'); ?>",
|
|
email: "<?php afficheTexte('transfert_validation-tra_courriel-email'); ?>"
|
|
}
|
|
},
|
|
/* errorLabelContainer: $(this).prev(), */
|
|
submitHandler: function (form) {
|
|
var $postData = $(form).serialize();
|
|
var $list = $('.xfer_list_<?php echo $pec_id; ?>');
|
|
|
|
$.post($(form).attr('action'), $postData + '&ajax=1', function (data) {
|
|
$(form).prev().slideUp(750, function () {
|
|
$(form).prev().hide();
|
|
$(form).prev().html(data.message);
|
|
$(form).prev().slideDown('slow');
|
|
});
|
|
$body.stop().animate({
|
|
scrollTop: ($(form).prev().offset().top - 100)
|
|
}, 1500);
|
|
|
|
if (data.state == 'success') {
|
|
$list.slideUp(750, function () {
|
|
$list.hide();
|
|
$list.html(data.liste);
|
|
$list.slideDown('slow');
|
|
});
|
|
|
|
$(form).trigger('reset');
|
|
}
|
|
}, 'json');
|
|
|
|
return false;
|
|
}
|
|
});
|
|
<?php
|
|
}
|
|
?>
|
|
$body.on("click", ".btn_cancel_transfert", function () {
|
|
var $no_transfert = $(this).data('no_transfert');
|
|
var $list = $(this).closest('div.xfer_list');
|
|
|
|
if (confirm("<?php if ($strLangue == 'fr') { ?>Êtes-vous certain de vouloir annuler cette demande de transfert ?<?php } else { ?>Are you sure you want to cancel this transfer request?<?php } ?>")) {
|
|
$.post('<?php echo $vDomaine; ?>/ajax_transfert.php', 'a=<?php echo urlencode(base64_encode('cancel')); ?>&id=' + $no_transfert + '&lang=<?php echo $strLangue; ?>&ajax=1', function ($result) {
|
|
if ($result.state == 'success') {
|
|
$list.prev().slideUp(750, function () {
|
|
$list.prev().hide();
|
|
$list.prev().html($result.message);
|
|
$list.prev().slideDown('slow');
|
|
});
|
|
$body.stop().animate({
|
|
scrollTop: ($list.prev().offset().top - 100)
|
|
}, 1500);
|
|
|
|
$list.slideUp(750, function () {
|
|
$list.hide();
|
|
$list.html($result.liste);
|
|
$list.slideDown('slow');
|
|
});
|
|
} else {
|
|
$list.prev().slideUp(750, function () {
|
|
$list.prev().hide();
|
|
$list.prev().html($result.message);
|
|
$list.prev().slideDown('slow');
|
|
});
|
|
$body.stop().animate({
|
|
scrollTop: ($list.prev().offset().top - 100)
|
|
}, 1500);
|
|
}
|
|
}, 'json');
|
|
}
|
|
|
|
return false;
|
|
});
|
|
|
|
$body.on("click", ".btn_resend_transfert", function () {
|
|
var $no_transfert = $(this).data('no_transfert');
|
|
var $list = $(this).closest('div.xfer_list');
|
|
|
|
if (confirm("<?php if ($strLangue == 'fr') { ?>Êtes-vous certain de vouloir envoyer de nouveau cette demande de transfert ?<?php } else { ?>Are you sure you want to resend this transfer request?<?php } ?>")) {
|
|
$.post('<?php echo $vDomaine; ?>/ajax_transfert.php', 'a=<?php echo urlencode(base64_encode('resend')); ?>&id=' + $no_transfert + '&lang=<?php echo $strLangue; ?>&ajax=1', function ($result) {
|
|
if ($result.state == 'success') {
|
|
$list.prev().slideUp(750, function () {
|
|
$list.prev().hide();
|
|
$list.prev().html($result.message);
|
|
$list.prev().slideDown('slow');
|
|
});
|
|
$body.stop().animate({
|
|
scrollTop: ($list.prev().offset().top - 100)
|
|
}, 1500);
|
|
|
|
$list.slideUp(750, function () {
|
|
$list.hide();
|
|
$list.html($result.liste);
|
|
$list.slideDown('slow');
|
|
});
|
|
} else {
|
|
$list.prev().slideUp(750, function () {
|
|
$list.prev().hide();
|
|
$list.prev().html($result.message);
|
|
$list.prev().slideDown('slow');
|
|
});
|
|
$body.stop().animate({
|
|
scrollTop: ($list.prev().offset().top - 100)
|
|
}, 1500);
|
|
}
|
|
}, 'json');
|
|
}
|
|
|
|
return false;
|
|
});
|
|
<?php
|
|
}
|
|
?>
|
|
$(".btn_cancel_event_promo,.btn_retablir_event_promo,.btn_cancel_event_client,.btn_retablir_event_client").click(function () {
|
|
var intEprId = $(this).data('epr_id');
|
|
var intPecId = $(this).val();
|
|
var code = $(this).data('eve_code');
|
|
var $btn_id = $(this).attr('id').split('_');
|
|
var $btn_annuler = $("#annuler_" + $btn_id[1]);
|
|
var $btn_retablir = $("#retablir_" + $btn_id[1]);
|
|
var $btn_modifier = $("#modifier_" + $btn_id[1]);
|
|
var $inscrFiche = $(this).closest('.inscr-gestion-fiche');
|
|
$preloader_text.html('<?php afficheTexte('preloader_wait', 1, 0, 1); ?>');
|
|
$body.css('cursor', 'wait');
|
|
$preloader.show();
|
|
|
|
$.post('<?php echo $vDomaine; ?>/ajax_compte.php', 'a=annuler-retablir-inscription&lng=<?php echo $strLangue; ?>&code=' + code + '&epr_id=' + intEprId + '&pec_id=' + intPecId, function ($result) {
|
|
if ($result.state == 'success') {
|
|
if ($inscrFiche.length) {
|
|
window.location.reload();
|
|
return;
|
|
}
|
|
if ($result.action == 'annuler') {
|
|
$btn_annuler.toggleClass('d-none');
|
|
$btn_modifier.toggleClass('d-none');
|
|
$btn_retablir.toggleClass('d-none');
|
|
$btn_annuler.closest('tr').toggleClass('table-danger');
|
|
} else if ($result.action == 'retablir') {
|
|
$btn_retablir.toggleClass('d-none');
|
|
$btn_annuler.toggleClass('d-none');
|
|
$btn_modifier.toggleClass('d-none');
|
|
$btn_annuler.closest('tr').toggleClass('table-danger');
|
|
}
|
|
} else {
|
|
// alert('ERREUR');
|
|
}
|
|
}, 'json');
|
|
|
|
$preloader.fadeOut('slow');
|
|
$body.css('cursor', 'default');
|
|
});
|
|
$(".more_link").click(function (e) {
|
|
e.preventDefault();
|
|
var $span_link = $(this).find('span');
|
|
var $block = $('.more_block');
|
|
|
|
$block.slideToggle('slow', function () {
|
|
if ($block.is(':visible')) {
|
|
$span_link.html('<i class="fa fa-minus ml-2" aria-hidden="true"></i>');
|
|
} else {
|
|
$span_link.html('<i class="fa fa-plus ml-2" aria-hidden="true"></i>');
|
|
}
|
|
});
|
|
});
|
|
$(".xfer_link").click(function (e) {
|
|
e.preventDefault();
|
|
var $pec_id = $(this).data('pec_id');
|
|
var $span_link = $(this).find('span');
|
|
var $xfer_block = $('.xfer_block_' + $pec_id);
|
|
|
|
$xfer_block.slideToggle('slow', function () {
|
|
if ($xfer_block.is(':visible')) {
|
|
$span_link.html('<i class="fa fa-minus ml-2" aria-hidden="true"></i>');
|
|
} else {
|
|
$span_link.html('<i class="fa fa-plus ml-2" aria-hidden="true"></i>');
|
|
}
|
|
});
|
|
});
|
|
$(".donation_link").click(function (e) {
|
|
e.preventDefault();
|
|
var $pec_id = $(this).data('pec_id');
|
|
var $span_link = $(this).find('span');
|
|
var $donation_block = $('.donation_block_' + $pec_id);
|
|
|
|
$donation_block.slideToggle('slow', function () {
|
|
if ($donation_block.is(':visible')) {
|
|
$span_link.html('<i class="fa fa-minus ml-2" aria-hidden="true"></i>');
|
|
} else {
|
|
$span_link.html('<i class="fa fa-plus ml-2" aria-hidden="true"></i>');
|
|
}
|
|
});
|
|
});
|
|
$(".vr_link").click(function (e) {
|
|
e.preventDefault();
|
|
var $pec_id = $(this).data('pec_id');
|
|
var $span_link = $(this).find('span');
|
|
var $donation_block = $('.vr_block_' + $pec_id);
|
|
|
|
$donation_block.slideToggle('slow', function () {
|
|
if ($donation_block.is(':visible')) {
|
|
$span_link.html('<i class="fa fa-minus ml-2" aria-hidden="true"></i>');
|
|
} else {
|
|
$span_link.html('<i class="fa fa-plus ml-2" aria-hidden="true"></i>');
|
|
}
|
|
});
|
|
});
|
|
<?php
|
|
if (isset($arrFormsObjectifsDons)) {
|
|
foreach ($arrFormsObjectifsDons as $array) {
|
|
foreach ($array as $pec_id => $forms) {
|
|
foreach ($forms as $form) {
|
|
?>
|
|
$('#<?php echo $form; ?>')
|
|
.validate({
|
|
rules: {
|
|
montant: {
|
|
number: true
|
|
}
|
|
},
|
|
messages: {
|
|
montant: {
|
|
required: "<?php afficheTexte('objectifs_dons_validation-montant-required'); ?>",
|
|
number: "<?php afficheTexte('objectifs_dons_validation-montant-number'); ?>",
|
|
min: "<?php afficheTexte('objectifs_dons_validation-montant-minlength'); ?>"
|
|
}
|
|
},
|
|
submitHandler: function (form) {
|
|
var $postData = $(form).serialize();
|
|
var $list = $('.donation_list_<?php echo $pec_id; ?>');
|
|
var $msg = $('#msg_<?php echo $pec_id; ?>');
|
|
|
|
$msg.slideUp(750, function () {
|
|
$msg.hide();
|
|
|
|
$.post($(form).attr('action'), $postData + '&ajax=1', function (data) {
|
|
$msg.slideUp(750, function () {
|
|
$msg.hide();
|
|
$msg.html(data.message);
|
|
$msg.slideDown('slow');
|
|
});
|
|
$body.stop().animate({
|
|
scrollTop: ($msg.offset().top - 100)
|
|
}, 1500);
|
|
}, 'json');
|
|
|
|
return false;
|
|
});
|
|
}
|
|
});
|
|
<?php
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// LOGS
|
|
if (isset($arrFormsLogSettings)) {
|
|
foreach ($arrFormsLogSettings as $array) {
|
|
foreach ($array as $pec_id => $forms) {
|
|
foreach ($forms as $form) {
|
|
?>
|
|
$('#<?php echo $form; ?>')
|
|
.validate({
|
|
rules: {
|
|
montant: {
|
|
number: true
|
|
}
|
|
},
|
|
messages: {
|
|
montant: {
|
|
required: "<?php afficheTexte('objectifs_dons_validation-montant-required'); ?>",
|
|
number: "<?php afficheTexte('objectifs_dons_validation-montant-number'); ?>",
|
|
min: "<?php afficheTexte('objectifs_dons_validation-montant-minlength'); ?>"
|
|
}
|
|
},
|
|
submitHandler: function (form) {
|
|
var $postData = $(form).serialize();
|
|
var $list = $('.log_settings_list_<?php echo $pec_id; ?>');
|
|
var $msg = $list.prev();
|
|
|
|
$.post($(form).attr('action'), $postData + '&ajax=1', function (data) {
|
|
$msg.slideUp(750, function () {
|
|
$msg.html(data.message);
|
|
$msg.slideDown('slow');
|
|
});
|
|
$body.stop().animate({
|
|
scrollTop: ($msg.offset().top - 100)
|
|
}, 1500);
|
|
}, 'json');
|
|
|
|
return false;
|
|
}
|
|
});
|
|
<?php
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (isset($arrFormsAddLogs)) {
|
|
foreach ($arrFormsAddLogs as $array) {
|
|
foreach ($array as $pec_id => $forms) {
|
|
foreach ($forms as $form) {
|
|
?>
|
|
$('#<?php echo $form; ?>')
|
|
.validate({
|
|
rules: {},
|
|
messages: {
|
|
rlq_distance: {
|
|
required: "<?php afficheTexte('rlq_distance_validation-montant-required'); ?>",
|
|
number: "<?php afficheTexte('rlq_distance_validation-montant-required'); ?>"
|
|
},
|
|
rlq_date: {
|
|
required: "<?php afficheTexte('objectifs_dons_validation-montant-required'); ?>"
|
|
}
|
|
},
|
|
submitHandler: function (form) {
|
|
var $postData = $(form).serialize();
|
|
var $list = $('.log_list_<?php echo $pec_id; ?>');
|
|
var $msg = $('#msg_<?php echo $pec_id; ?>');
|
|
|
|
$.post($(form).attr('action'), $postData + '&ajax=1', function ($result) {
|
|
if ($result.state == 'success') {
|
|
$(form).trigger("reset");
|
|
$list.prev().slideUp(750, function () {
|
|
$list.prev().hide();
|
|
$list.prev().html($result.message);
|
|
$list.prev().slideDown('slow');
|
|
});
|
|
$body.stop().animate({
|
|
scrollTop: ($list.prev().offset().top - 100)
|
|
}, 1500);
|
|
|
|
$list.slideUp(750, function () {
|
|
$list.hide();
|
|
$list.html($result.liste);
|
|
$list.slideDown('slow');
|
|
});
|
|
} else {
|
|
$list.prev().slideUp(750, function () {
|
|
$list.prev().hide();
|
|
$list.prev().html($result.message);
|
|
$list.prev().slideDown('slow');
|
|
});
|
|
$body.stop().animate({
|
|
scrollTop: ($list.prev().offset().top - 100)
|
|
}, 1500);
|
|
}
|
|
}, 'json');
|
|
return false;
|
|
}
|
|
});
|
|
<?php
|
|
}
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
$body.on("click", ".btn_delete_log_course", function () {
|
|
var $id = $(this).data('rlq_id');
|
|
var $list = $(this).closest('div.log_list');
|
|
|
|
bootbox.confirm({
|
|
title: "Confirmation",
|
|
message: "<?php if ($strLangue == 'fr') { ?>Êtes-vous certain de vouloir effacer cette entrée ?<?php } else { ?>Are you sure you want to delete this entry?<?php } ?>",
|
|
buttons: {
|
|
confirm: {
|
|
label: '<?php if ($strLangue == 'fr') { ?>Oui<?php } else { ?>Yes<?php } ?>',
|
|
className: 'btn btn-success rounded-0'
|
|
},
|
|
cancel: {
|
|
label: '<?php if ($strLangue == 'fr') { ?>Non<?php } else { ?>No<?php } ?>',
|
|
className: 'btn btn-danger rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
$.post('<?php echo $vDomaine; ?>/ajax_logs_course.php', 'a=<?php echo urlencode(base64_encode('del')); ?>&id=' + $id + '&lang=<?php echo $strLangue; ?>&ajax=1', function ($result) {
|
|
if ($result.state == 'success') {
|
|
$list.prev().slideUp(750, function () {
|
|
$list.prev().hide();
|
|
$list.prev().html($result.message);
|
|
$list.prev().slideDown('slow');
|
|
});
|
|
$body.stop().animate({
|
|
scrollTop: ($list.prev().offset().top - 100)
|
|
}, 1500);
|
|
|
|
$lis.slideUp(750, function () {
|
|
$list.hide();
|
|
$list.html($result.liste);
|
|
$list.slideDown('slow');
|
|
});
|
|
} else {
|
|
$list.prev().slideUp(750, function () {
|
|
$list.prev().hide();
|
|
$list.prev().html($result.message);
|
|
$list.prev().slideDown('slow');
|
|
});
|
|
$body.stop().animate({
|
|
scrollTop: ($list.prev().offset().top - 100)
|
|
}, 1500);
|
|
}
|
|
}, 'json');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
<?php
|
|
/*************
|
|
* ADHÉSIONS *
|
|
**************/
|
|
if (isset($arrFormsMembership) && count($arrFormsMembership) > 0) {
|
|
foreach ($arrFormsMembership as $strNumeroMembership) {
|
|
?>
|
|
const form_<?php echo $strNumeroMembership; ?> = $('#frm_membership_<?php echo $strNumeroMembership; ?>');
|
|
const validator_<?php echo $strNumeroMembership; ?> = form_<?php echo $strNumeroMembership; ?>.validate({
|
|
rules: {},
|
|
messages: {},
|
|
errorPlacement: function (error, element) {
|
|
error.appendTo(element.parent("div"));
|
|
},
|
|
submitHandler: function (form) {
|
|
var postData = new FormData(form);
|
|
var msg = $('.msg_<?php echo $strNumeroMembership; ?>');
|
|
//window.location.href = $(form).attr('action') + '?' + $postData;
|
|
$.ajax({
|
|
url: $(form).attr('action'),
|
|
type: "POST",
|
|
data: postData,
|
|
dataType: 'json',
|
|
contentType: false,
|
|
cache: false,
|
|
processData: false,
|
|
beforeSend: function () {
|
|
msg.fadeOut();
|
|
$preloader.show();
|
|
},
|
|
success: function (result) {
|
|
if (result.state == 'success') {
|
|
window.location.href = '<?php echo $vDomaine . '/' . afficheTexte('adhesions_link_retour_url', 0) . '?no=' . $strNumeroMembership; ?>';
|
|
} else {
|
|
msg.html(result.message).fadeIn();
|
|
scrollToTop();
|
|
$preloader.hide();
|
|
}
|
|
},
|
|
error: function (e) {
|
|
msg.html(e.responseText).fadeIn();
|
|
scrollToTop();
|
|
$preloader.hide();
|
|
}
|
|
});
|
|
return false;
|
|
}
|
|
});
|
|
<?php
|
|
}
|
|
}
|
|
|
|
if (isset($arrCalMembership) && count($arrCalMembership) > 0) {
|
|
foreach ($arrCalMembership as $array) {
|
|
?>
|
|
const <?php echo $array[0]; ?> =
|
|
document.querySelector('#<?php echo $array[0]; ?>');
|
|
flatpickr(<?php echo $array[0]; ?>, {
|
|
<?php
|
|
if (isset($array[1]) && count($array[1]) > 0) {
|
|
$tabParam = $array[1];
|
|
|
|
foreach ($tabParam as $strParam => $strValue) {
|
|
echo $strParam . ': ' . $strValue . ',';
|
|
}
|
|
}
|
|
?>
|
|
allowInput: true,
|
|
clickOpens: false,
|
|
locale: '<?php echo $strLangue; ?>',
|
|
position: 'auto right',
|
|
positionElement: <?php echo $array[0]; ?>,
|
|
wrap: true
|
|
});
|
|
<?php
|
|
}
|
|
}
|
|
if (isset($arrTelMembership) && count($arrTelMembership) > 0) {
|
|
foreach ($arrTelMembership as $strInput) {
|
|
?>
|
|
$('#<?php echo $strInput; ?>').mask('000-000-0000');
|
|
<?php
|
|
}
|
|
}
|
|
|
|
if (isset($strValidationMembership))
|
|
echo $strValidationMembership;
|
|
?>
|
|
$body.on("click", ".btn_delete_file_membership", function () {
|
|
var no = $(this).data('no');
|
|
var mq = $(this).data('mq');
|
|
var mr = $(this).data('mr');
|
|
|
|
bootbox.confirm({
|
|
title: "<?php afficheTexte('confirm-title', 1, 1, 1); ?>",
|
|
message: "<?php echo afficheTexte('confirm-adhesions-delete', 0) ?>",
|
|
buttons: {
|
|
confirm: {
|
|
label: '<?php afficheTexte('confirm-btn-confirm', 1, 1, 1); ?>',
|
|
className: 'btn btn-success rounded-0'
|
|
},
|
|
cancel: {
|
|
label: '<?php afficheTexte('confirm-btn-cancel', 1, 1, 1); ?>',
|
|
className: 'btn btn-danger rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
$.post('<?php echo $vDomaine; ?>/ajax_compte.php', 'a=<?php echo urlencode('membership_delete_file'); ?>&no=' + no + '&mq=' + mq + '&mr=' + mr + '&lng=<?php echo $strLangue; ?>&ajax=1', function ($result) {
|
|
if ($result.state == 'success') {
|
|
window.location.href = '<?php echo $vDomaine . '/' . afficheTexte('adhesions_link_retour_url', 0) . '?no='; ?>' + no;
|
|
} else {
|
|
msg.html(result.message).fadeIn();
|
|
scrollToTop();
|
|
}
|
|
}, 'json');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
<?php
|
|
/*********************
|
|
* TALEAU PROMOTEUR *
|
|
*********************/
|
|
?>
|
|
$body.on("click", ".btn_qte", function () {
|
|
var int_epr_id = $(this).data('epr_id');
|
|
var int_qte = $("#qte_restante_" + int_epr_id).val();
|
|
|
|
if (int_qte >= 0) {
|
|
$preloader_text.html('<?php afficheTexte('preloader_wait', 1, 0, 1); ?>');
|
|
$preloader.show();
|
|
// alert('<?php echo $vDomaine; ?>/ajax_promoteur.php?a=qte&epr_id=' + int_epr_id + '&qte=' + int_qte + '&lang=<?php echo $strLangue; ?>');
|
|
|
|
$.post('<?php echo $vDomaine; ?>/ajax_promoteur.php', 'a=qte&epr_id=' + int_epr_id + '&qte=' + int_qte + '&lang=<?php echo $strLangue; ?>', function ($result) {
|
|
|
|
|
|
if ($result.state == 'success') {
|
|
let array = $result.data;
|
|
// console.log(array);
|
|
|
|
for (let epr_id in array) {
|
|
|
|
if (epr_id == 'total') {
|
|
$('#qte_origine_total').text(array[epr_id]['qte_origine_total']);
|
|
$('#qte_restante_total').text(array[epr_id]['qte_restante_total']);
|
|
$('#qte_inscrits_total').text(array[epr_id]['qte_inscrits_total']);
|
|
$('#qte_courante_total').text(array[epr_id]['qte_courante_total']);
|
|
$('#qte_ajustement_total').text(array[epr_id]['qte_ajustement_total']);
|
|
|
|
} else {
|
|
$('#qte_origine_' + epr_id).text(array[epr_id]['qte_origine']);
|
|
$('#qte_restante_' + epr_id).val(array[epr_id]['qte_restante']);
|
|
|
|
|
|
$('#qte_inscrits_' + epr_id).text(array[epr_id]['qte_inscrits']);
|
|
$('#qte_courante_' + epr_id).text(array[epr_id]['qte_courante']);
|
|
$('#qte_ajustement_' + epr_id).text(array[epr_id]['qte_ajustement']);
|
|
$('#qte_checkin_' + epr_id).text(array[epr_id]['qte_checkin']);
|
|
|
|
let dispoBadge = document.querySelector('.epr-row[data-epr-id="' + epr_id + '"] .epr-header-summary--dispo');
|
|
if (dispoBadge && array[epr_id]['qte_restante'] !== undefined) {
|
|
let labelParts = dispoBadge.textContent.split(':');
|
|
let label = labelParts.length > 1 ? labelParts[0].trim() : 'Disponibles';
|
|
dispoBadge.textContent = label + ' : ' + array[epr_id]['qte_restante'];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, 'json');
|
|
|
|
$preloader.fadeOut('slow');
|
|
} else {
|
|
bootbox.alert({
|
|
title: "<?php afficheTexte('alert-title', 1, 1, 1); ?>",
|
|
message: "<?php afficheTexte('promoteur_bad_qte_update'); ?>",
|
|
buttons: {
|
|
ok: {
|
|
label: '<?php afficheTexte('alert-btn-ok', 1, 1, 1); ?>',
|
|
className: 'btn btn-primary rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
$body.on("click", ".btn_bib", function () {
|
|
var str_action = $(this).data('action');
|
|
var int_epr_id = $(this).data('epr_id');
|
|
|
|
switch (str_action) {
|
|
case 'no_equipe':
|
|
case 'no_bib':
|
|
int_par_id = $(this).data('par_id');
|
|
int_pec_id = $(this).data('pec_id');
|
|
int_eve_id = $(this).data('eve_id');
|
|
|
|
if (str_action == 'no_bib') {
|
|
str_new_no_bib = $("#txt_no_bib_p" + int_par_id).val();
|
|
} else if (str_action == 'no_equipe') {
|
|
str_new_no_bib = $("#txt_no_bib_e" + int_par_id).val();
|
|
}
|
|
|
|
(function (action, parId, pecId, eveId, eprId, newBib) {
|
|
// Champ de saisie du dossard (pour pouvoir restaurer l'ancienne valeur).
|
|
var $bibInput = $((action == 'no_equipe' ? '#txt_no_bib_e' : '#txt_no_bib_p') + parId);
|
|
|
|
// Restaure le dossard precedemment enregistre (valeur de reference du champ).
|
|
function restoreBib() {
|
|
if ($bibInput.length) { $bibInput.val($bibInput[0].defaultValue); }
|
|
}
|
|
|
|
// Enregistrement reel du dossard (chemin legacy promoteur, inchange).
|
|
function saveBib() {
|
|
$preloader_text.html('<?php afficheTexte('preloader_wait', 1, 0, 1); ?>');
|
|
$preloader.show();
|
|
$.post('<?php echo $vDomaine; ?>/ajax_promoteur.php', 'a=' + action + '&eve_id=' + eveId + '&new_no_bib=' + newBib + '&pec_id=' + pecId + '&epr_id=' + eprId + '&par_id=' + parId + '&lang=<?php echo $strLangue; ?>', function ($result) {
|
|
// Memorise la valeur enregistree comme nouvelle reference, pour qu'un
|
|
// futur "Annuler" restaure bien CE dossard (et non l'original a l'ouverture).
|
|
if ($result && $result.state == 'success' && $bibInput.length) {
|
|
$bibInput[0].defaultValue = newBib;
|
|
}
|
|
}, 'json');
|
|
$preloader.fadeOut('slow');
|
|
}
|
|
|
|
var bibTrim = (newBib == null ? '' : ('' + newBib)).trim();
|
|
// Suppression d'un dossard (champ vide) : aucun controle de doublon.
|
|
if (bibTrim === '') { saveBib(); return; }
|
|
|
|
// Garde-fou "dossard en double" dans l'evenement. La politique
|
|
// (warn / block / allow) est decidee cote serveur — par evenement a terme.
|
|
$.post('<?php echo $vDomaine; ?>/ajax_inscr_gestion.php', {
|
|
a: 'bib_duplicate_check',
|
|
par_id: parId,
|
|
no_bib: bibTrim,
|
|
type: action,
|
|
lang: '<?php echo $strLangue; ?>'
|
|
}, function (chk) {
|
|
if (!chk || chk.state !== 'ok' || !chk.duplicate) { saveBib(); return; }
|
|
|
|
var lignes = (chk.who || []).map(function (w) {
|
|
return '<li><strong>' + w.name + '</strong>' + (w.epreuve ? ' — ' + w.epreuve : '') + '</li>';
|
|
}).join('');
|
|
|
|
// Politique bloquante (prevue pour le futur) : interdiction pure.
|
|
if (chk.policy === 'block') {
|
|
restoreBib();
|
|
bootbox.alert({
|
|
title: "<?php if ($strLangue == 'fr') { ?>Dossard déjà utilisé<?php } else { ?>Bib already used<?php } ?>",
|
|
message: "<?php if ($strLangue == 'fr') { ?>Ce dossard est déjà assigné à :<?php } else { ?>This bib is already assigned to:<?php } ?><ul style=\"margin:8px 0;\">" + lignes + "</ul><?php if ($strLangue == 'fr') { ?>Les doublons sont interdits pour cet événement.<?php } else { ?>Duplicates are not allowed for this event.<?php } ?>",
|
|
buttons: { ok: { label: '<?php afficheTexte('alert-btn-ok', 1, 1, 1); ?>', className: 'btn btn-primary rounded-0' } }
|
|
});
|
|
return;
|
|
}
|
|
|
|
// Politique d'avertissement (defaut actuel) : confirmation du doublon.
|
|
bootbox.confirm({
|
|
title: "<?php if ($strLangue == 'fr') { ?>Dossard en double<?php } else { ?>Duplicate bib<?php } ?>",
|
|
message: "<?php if ($strLangue == 'fr') { ?>Ce dossard est déjà assigné à :<?php } else { ?>This bib is already assigned to:<?php } ?><ul style=\"margin:8px 0;\">" + lignes + "</ul><?php if ($strLangue == 'fr') { ?>Voulez-vous vraiment assigner ce dossard en double ?<?php } else { ?>Do you really want to assign this bib as a duplicate?<?php } ?>",
|
|
buttons: {
|
|
confirm: { label: '<?php if ($strLangue == 'fr') { ?>Assigner quand même<?php } else { ?>Assign anyway<?php } ?>', className: 'btn btn-warning rounded-0' },
|
|
cancel: { label: '<?php afficheTexte('confirm-btn-cancel', 1, 1, 1); ?>', className: 'btn btn-secondary rounded-0' }
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
saveBib();
|
|
} else {
|
|
// "Non" : on ne touche pas a la base et on remet l'ancien dossard dans la fiche.
|
|
restoreBib();
|
|
}
|
|
}
|
|
});
|
|
}, 'json').fail(function () {
|
|
// Echec du controle : on n'empeche pas l'enregistrement (mode non bloquant).
|
|
saveBib();
|
|
});
|
|
})(str_action, int_par_id, int_pec_id, int_eve_id, int_epr_id, str_new_no_bib);
|
|
break;
|
|
case 'edit':
|
|
$("#row_action_" + int_epr_id).val('defaut');
|
|
if ($("#num_bib_range_start_" + int_epr_id).prop('disabled')) {
|
|
$(this).html('<i class="fa fa-times" aria-hidden="true"></i>');
|
|
$(this).tooltip('dispose');
|
|
$(this).prop('title', '<?php afficheTexte('promoteur_bib_close'); ?>');
|
|
$(this).tooltip();
|
|
|
|
$("#num_bib_range_start_" + int_epr_id).prop('disabled', false);
|
|
$("#num_bib_range_finish_dispo_" + int_epr_id).prop('disabled', false);
|
|
$("#num_dernier_dossard_" + int_epr_id).prop('disabled', false);
|
|
$("#num_dernier_dossard_" + int_epr_id).prop('readonly', true);
|
|
$("#sel_assignment_type_" + int_epr_id).prop('disabled', false);
|
|
|
|
// afficher le bouton "assigner"
|
|
$("#btn_bib_assign_" + int_epr_id).show();
|
|
$("#btn_bib_delete_" + int_epr_id).show();
|
|
|
|
$("#bib_options_bibandteam_" + int_epr_id).show();
|
|
$("#bib_options_fromlast_" + int_epr_id).show();
|
|
|
|
$("#num_bib_range_start_" + int_epr_id).focus();
|
|
} else {
|
|
$("#bib_options_bibandteam_" + int_epr_id).hide();
|
|
$("#bib_options_fromlast_" + int_epr_id).hide();
|
|
|
|
$(this).html('<i class="fa fa-pencil-square-o" aria-hidden="true"></i>');
|
|
$(this).tooltip('dispose');
|
|
$(this).prop('title', '<?php afficheTexte('promoteur_bib_edit'); ?>');
|
|
$(this).tooltip();
|
|
|
|
$("#num_bib_range_start_" + int_epr_id).prop('disabled', true);
|
|
$("#num_bib_range_finish_dispo_" + int_epr_id).prop('disabled', true);
|
|
$("#num_dernier_dossard_" + int_epr_id).prop('disabled', true);
|
|
$("#num_dernier_dossard_" + int_epr_id).prop('readonly', false);
|
|
$("#sel_assignment_type_" + int_epr_id).prop('disabled', true);
|
|
|
|
// afficher le bouton "assigner"
|
|
$("#btn_bib_assign_" + int_epr_id).hide();
|
|
$("#btn_bib_delete_" + int_epr_id).hide();
|
|
}
|
|
break;
|
|
case 'assign':
|
|
|
|
var range_start = parseInt($("#num_bib_range_start_" + int_epr_id).val());
|
|
var qty_booked = parseInt($("#qty_booked_" + int_epr_id).html());
|
|
|
|
if ($("#num_bib_range_start_" + int_epr_id).val() == '' ||
|
|
$("#num_bib_range_finish_dispo_" + int_epr_id).val() == '') {
|
|
bootbox.alert({
|
|
title: "<?php afficheTexte('alert-title', 1, 1, 1); ?>",
|
|
message: "<?php afficheTexte('promoteur_bib_no_range_start'); ?>",
|
|
buttons: {
|
|
ok: {
|
|
label: '<?php afficheTexte('alert-btn-ok', 1, 1, 1); ?>',
|
|
className: 'btn btn-primary rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
$("#num_bib_range_start_" + int_epr_id).focus();
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
bootbox.confirm({
|
|
title: "<?php afficheTexte('confirm-title', 1, 1, 1); ?>",
|
|
message: "<?php afficheTexte('promoteur_bib_assign');?>",
|
|
buttons: {
|
|
confirm: {
|
|
label: '<?php afficheTexte('confirm-btn-confirm', 1, 1, 1); ?>',
|
|
className: 'btn btn-success rounded-0'
|
|
},
|
|
cancel: {
|
|
label: '<?php afficheTexte('confirm-btn-cancel', 1, 1, 1); ?>',
|
|
className: 'btn btn-danger rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
$("#frm_bib_" + int_epr_id).submit();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
break;
|
|
case 'delete':
|
|
int_eve_id = $(this).data('eve_id');
|
|
|
|
bootbox.confirm({
|
|
title: "<?php afficheTexte('confirm-title', 1, 1, 1); ?>",
|
|
message: "<?php afficheTexte('promoteur_bib_reset'); ?>",
|
|
buttons: {
|
|
confirm: {
|
|
label: '<?php afficheTexte('confirm-btn-confirm', 1, 1, 1); ?>',
|
|
className: 'btn btn-success rounded-0'
|
|
},
|
|
cancel: {
|
|
label: '<?php afficheTexte('confirm-btn-cancel', 1, 1, 1); ?>',
|
|
className: 'btn btn-danger rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
document.location.href = '<?php echo $vDomaine . $strPage ?>/bib_assignment?a=reset&epr_id=' + int_epr_id + '&promoteur_eve_id=' + int_eve_id;
|
|
}
|
|
}
|
|
});
|
|
break;
|
|
case 'view':
|
|
var int_bib_type = $(this).data('bib_type');
|
|
$("#row_action_" + int_epr_id).val('view');
|
|
// MSIN-4148
|
|
// document.location.href = '<?php echo $vDomaine . $strPage ?>/bib_assignment?a=view&type=' + int_bib_type + '&epr_id=' + int_epr_id;
|
|
document.location.href = '<?php echo $vDomaine . $strPage ?>/bib_assignment?type=' + int_bib_type + '&epr_id=' + int_epr_id;
|
|
break;
|
|
}
|
|
});
|
|
|
|
|
|
$('#modal_teammates').on('show.bs.modal', function (event) {
|
|
var button = $(event.relatedTarget);
|
|
var modal = $(this);
|
|
var int_pec_id = button.data('pec_id');
|
|
var int_epr_id = button.data('epr_id');
|
|
var int_eve_id = button.data('eve_id');
|
|
|
|
$.post('<?php echo $vDomaine; ?>/ajax_promoteur.php', 'a=teammates&eve_id=' + int_eve_id + '&pec_id=' + int_pec_id + '&epr_id=' + int_epr_id + '&lang=<?php echo $strLangue; ?>', function ($result) {
|
|
if ($result.state == 'success') {
|
|
modal.find('.modal-title').text($result.team);
|
|
modal.find('.modal-body').html($result.members);
|
|
} else {
|
|
modal.find('.modal-title').text($result.state);
|
|
modal.find('.modal-body').html('');
|
|
}
|
|
}, 'json');
|
|
});
|
|
<?php
|
|
break;
|
|
case 'reserver.php':
|
|
// MSIN-4474 — même périmètre que le HTML (inc_fx_reserver) : accès legacy, v2 ou admin
|
|
$intPecIdSwitch = isset($_GET['pec_id']) ? $_GET['pec_id'] : 0;
|
|
$intPromoteurSwitch = isset($_GET['promoteur']) ? $_GET['promoteur'] : 0;
|
|
if (($tabEvenement['general']['eve_epreuve_modifiable'] == 1 || $tabEvenement['general']['eve_epreuve_modifiable_client'] == 1) && $strAction == 'mod' && !isset($_SESSION['no_panier']) && fxCheckAccesEpreuve('mod', $intEpreuve, $tabEvenement['general']['eve_id'], $intPecIdSwitch, $intPromoteurSwitch, '')) { // si le promoteur ou le participant peut changer l'épreuve
|
|
?>
|
|
$("#sel_epreuve").change(function () {
|
|
$("#btn_changer_epreuve").show();
|
|
$("#btn_changer_epreuve_cancel").show();
|
|
$("#new_epr_id").val($(this).val());
|
|
});
|
|
$("#btn_changer_epreuve_cancel").click(function () {
|
|
$("#div_btn").hide();
|
|
window.location.reload(true);
|
|
});
|
|
$("#btn_changer_epreuve").click(function () {
|
|
var strPage = '<?php if ($strLangue == 'fr') {
|
|
echo 'reserver';
|
|
} else {
|
|
echo 'book';
|
|
} ?>';
|
|
|
|
var strUrl = $("#eve_label_url").val();
|
|
var strPromoteur = '<?php if (!empty($_GET['promoteur']) && $_GET['promoteur'] == 1) {
|
|
echo '&promoteur=1';
|
|
} else {
|
|
echo '';
|
|
} ?>';
|
|
// MSIN-4474 — préserver return_url au switch d'épreuve
|
|
var strReturn = '';
|
|
var $returnUrl = $("#return_url");
|
|
if ($returnUrl.length && $returnUrl.val()) {
|
|
strReturn = '&return_url=' + encodeURIComponent($returnUrl.val());
|
|
}
|
|
document.location.href = '<?php echo $vDomaine?>/' + strPage + '/' + strUrl + '/' + $("#sel_epreuve").val() + '?action=mod&switch=true' + strPromoteur + '&pec_id=<?php echo isset($_GET['pec_id']) ? $_GET['pec_id'] : ''; ?>' + strReturn;
|
|
});
|
|
$("#frm_participant").valid();
|
|
<?php
|
|
}
|
|
?>
|
|
$(".delete_fichier").click(function () {
|
|
var $no_panier = $(this).data('no_panier');
|
|
var $panier = $(this).data('panier');
|
|
var $file = $(this).data('file');
|
|
var $id = $(this).data('id');
|
|
|
|
bootbox.confirm({
|
|
title: "Confirmation",
|
|
message: "<?php if ($strLangue == 'fr') { ?>Êtes-vous certain de vouloir effacer ce fichier?<?php } else { ?>Are you sure you want to this file?<?php } ?>",
|
|
buttons: {
|
|
confirm: {
|
|
label: '<?php afficheTexte('confirm-btn-confirm', 1, 1, 1); ?>',
|
|
className: 'btn btn-success rounded-0'
|
|
},
|
|
cancel: {
|
|
label: '<?php afficheTexte('confirm-btn-cancel', 1, 1, 1); ?>',
|
|
className: 'btn btn-danger rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
$.post('<?php echo $vDomaine; ?>/ajax_file.php', 'no_panier=' + $no_panier + '&panier=' + $panier + '&file=' + $file + '&id=' + $id, function ($result) {
|
|
if ($result.state != 'error') {
|
|
window.location.reload(true);
|
|
}
|
|
}, 'json');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
<?php
|
|
break;
|
|
case 'panier.php':
|
|
switch ($strStep) {
|
|
case 'somaire':
|
|
?>
|
|
$('#btn_empty').click(function () {
|
|
bootbox.confirm({
|
|
title: "<?php afficheTexte('confirm-empty-cart -title'); ?>",
|
|
message: "<?php afficheTexte('confirm-empty-cart -message'); ?>",
|
|
buttons: {
|
|
confirm: {
|
|
label: '<?php afficheTexte('confirm-empty-cart -btn-confirm'); ?>',
|
|
className: 'btn btn-success rounded-0'
|
|
},
|
|
cancel: {
|
|
label: '<?php afficheTexte('confirm-empty-cart -btn-cancel'); ?>',
|
|
className: 'btn btn-danger rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
document.location.href = '<?php echo $vDomaine; ?>/vider_panier.php';
|
|
}
|
|
}
|
|
});
|
|
});
|
|
<?php
|
|
break;
|
|
case 'checkout':
|
|
?>
|
|
var $frm_panier = $('#frm_panier');
|
|
|
|
$frm_panier.validate({
|
|
rules: {
|
|
ccnumber: {
|
|
required: true,
|
|
digits: true,
|
|
minlength: 16
|
|
},
|
|
ccmonth: "required",
|
|
ccyear: "required",
|
|
cvv: {
|
|
required: true,
|
|
digits: true,
|
|
minlength: 3
|
|
}
|
|
},
|
|
messages: {
|
|
ccnumber: {
|
|
required: "<?php afficheTexte('checkout_validation-ccnumber-required'); ?>",
|
|
digits: "<?php afficheTexte('checkout_validation-ccnumber-digits'); ?>",
|
|
minlength: "<?php afficheTexte('checkout_validation-ccnumber-minlength'); ?>"
|
|
},
|
|
ccmonth: "<?php afficheTexte('checkout_validation-ccmonth-required'); ?>",
|
|
ccyear: "<?php afficheTexte('checkout_validation-ccyear-required'); ?>",
|
|
cvv: {
|
|
required: "<?php afficheTexte('checkout_validation-cvv-required'); ?>",
|
|
digits: "<?php afficheTexte('checkout_validation-cvv-digits'); ?>",
|
|
minlength: "<?php afficheTexte('checkout_validation-cvv-minlength'); ?>"
|
|
}
|
|
},
|
|
errorLabelContainer: $(".form-message")
|
|
});
|
|
|
|
var $card_mc = $('#card_mc');
|
|
var $card_visa = $('#card_visa');
|
|
|
|
/* $('#ccnumber').validateCreditCard(function(result) {
|
|
$card_mc.removeClass();
|
|
$card_visa.removeClass();
|
|
|
|
if (result.card_type != null) {
|
|
if (result.valid) {
|
|
$(this).removeClass();
|
|
|
|
switch (result.card_type.name) {
|
|
case 'visa':
|
|
$card_visa.addClass('active');
|
|
$card_mc.addClass('inactive');
|
|
break;
|
|
case 'mastercard':
|
|
$card_visa.addClass('inactive');
|
|
$card_mc.addClass('active');
|
|
break;
|
|
}
|
|
} else {
|
|
$(this).addClass('error');
|
|
$("#form_message").html('Mauvais type de carte!');
|
|
}
|
|
}
|
|
}, {
|
|
accept: ['visa', 'mastercard']
|
|
}); */
|
|
|
|
$('#btn_prev').click(function () {
|
|
document.location.href = '<?php echo $vDomaine; ?>/<?php echo $strPage; ?>/somaire/<?php echo $tabEvenement['general']['eve_label_url']?>';
|
|
});
|
|
|
|
$('#btn_cancel').click(function () {
|
|
bootbox.confirm({
|
|
title: "<?php afficheTexte('confirm-cancel-order-title'); ?>",
|
|
message: "<?php afficheTexte('confirm-cancel-order-message'); ?>",
|
|
buttons: {
|
|
confirm: {
|
|
label: '<?php afficheTexte('confirm-cancel-order-btn-confirm'); ?>',
|
|
className: 'btn btn-success rounded-0'
|
|
},
|
|
cancel: {
|
|
label: '<?php afficheTexte('confirm-cancel-order-btn-cancel'); ?>',
|
|
className: 'btn btn-danger rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
document.location.href = '<?php echo $vDomaine; ?>/vider_panier.php';
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
$('#btn_checkout').click(function () {
|
|
if ($frm_panier.valid()) {
|
|
var $termes = $('input.chk_termes[type=checkbox]:not(:checked)');
|
|
|
|
if (!$termes.length) {
|
|
var $preloader = $('#preloader');
|
|
var $preloader_text = $('#preloader_text');
|
|
$preloader_text.html('<?php afficheTexte('preloader_wait', 1, 0, 1); ?>');
|
|
$preloader.show();
|
|
grecaptcha.ready(function () {
|
|
grecaptcha.execute('<?php echo RECAPTCHA_SITE_KEY; ?>', {action: 'achat'}).then(function (token) {
|
|
document.getElementById('g-recaptcha-response').value = token;
|
|
$("#frm_panier").submit();
|
|
$('body').css('cursor', 'wait');
|
|
});
|
|
});
|
|
} else {
|
|
var str_alert = "<?php afficheTexte('terme_accepter') ?>";
|
|
|
|
/*if ($termes.data('pop_up') == 'location_policy') {
|
|
str_alert = $("#chk_location_policy").data('msg') + "\n" + str_alert;
|
|
}*/
|
|
|
|
alert(str_alert);
|
|
}
|
|
} else {
|
|
|
|
alert("<?php afficheTexte('form-credit') ?>");
|
|
}
|
|
});
|
|
<?php
|
|
if (isset($arrTermesModalButtons) && count($arrTermesModalButtons) > 0) {
|
|
foreach($arrTermesModalButtons as $index => $bouton) {
|
|
?>
|
|
var $chk<?php echo $index; ?> = $("#<?php echo str_replace('btn_accept', 'chk', $bouton); ?>");
|
|
var $div<?php echo $index; ?> = $("#<?php echo str_replace('btn_accept', 'div', $bouton); ?>");
|
|
|
|
$("#<?php echo $bouton; ?>").click(function (e) {
|
|
$chk<?php echo $index; ?>.show();
|
|
$chk<?php echo $index; ?>.prop("checked", true);
|
|
$div<?php echo $index; ?>.modal("hide");
|
|
});
|
|
$chk<?php echo $index; ?>.click(function (e) {
|
|
e.preventDefault();
|
|
$div<?php echo $index; ?>.modal("show");
|
|
});
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
|
|
|
|
|
|
// MSIN-3855 checkout Create the Card Fields Component and define callbacks
|
|
<?php
|
|
require_once('paypaladv_checkout.php');
|
|
?>
|
|
// fin paypal adv
|
|
|
|
var $creditcard = $("#creditcard");
|
|
<?php
|
|
if ($intPaiement == 0 || $intPaiement == 2) {
|
|
?>
|
|
$creditcard.css("display", "inline");
|
|
<?php
|
|
} else {
|
|
?>
|
|
$creditcard.css("display", "none");
|
|
<?php
|
|
}
|
|
?>
|
|
var $paiment_checked = $("input[name='chk_paiement']:checked");
|
|
var $chk_paiement = $("input[name='chk_paiement']");
|
|
|
|
$chk_paiement.change(function () {
|
|
if ($(this).val() == '2') {
|
|
$("#creditcard").css("display", "inline");
|
|
} else {
|
|
$("#creditcard").css("display", "none");
|
|
}
|
|
});
|
|
|
|
$("input[name='acheteur']").change(function () {
|
|
$preloader_text.html('<?php afficheTexte('preloader_wait', 1, 0, 1); ?>');
|
|
$preloader.show();
|
|
|
|
$.post('<?php echo $vDomaine; ?>/ajax_adresse.php', 'no_panier=<?php echo $_SESSION['no_panier']; ?>&acheteur=' + $(this).val() + '&langue=<?php echo $strLangue; ?>', function ($result) {
|
|
if ($result.state == 'success') {
|
|
$('#adresse_acheteur').html($result.adresse);
|
|
}
|
|
}, 'json');
|
|
|
|
$preloader.fadeOut('slow');
|
|
});
|
|
<?php
|
|
break;
|
|
}
|
|
break;
|
|
case 'evenements.php':
|
|
if (fxCookiesAllowMarketing() && isset($blnPopup) && $blnPopup) {
|
|
?>
|
|
var now, lastTimePopupShowed;
|
|
now = +new Date();
|
|
|
|
if (localStorage.getItem('lastTimePopupShowed') !== null) {
|
|
lastTimePopupShowed = localStorage.getItem('lastTimePopupShowed');
|
|
}
|
|
|
|
if (((now - lastTimePopupShowed) >= (5 * 60 * 1000)) || !lastTimePopupShowed) {
|
|
setTimeout(function () {
|
|
$.magnificPopup.open({
|
|
items: {
|
|
src: '#popup-modal',
|
|
type: 'inline'
|
|
},
|
|
closeOnBgClick: false,
|
|
tClose: ''
|
|
});
|
|
}, 1500);
|
|
|
|
localStorage.setItem('lastTimePopupShowed', now);
|
|
}
|
|
<?php
|
|
}
|
|
break;
|
|
case 'dons.php': #dons2017 #MSIN-1987
|
|
if ($strDonation != '' && isset($tabRules) && isset($tabMessages)) {
|
|
?>
|
|
|
|
var $form = $("#frm_dons");
|
|
|
|
var validator = $form.validate({
|
|
ignore: ".ignore,:hidden:not(input[type='hidden'])",
|
|
rules: {
|
|
txt_don: {
|
|
required: true,
|
|
min: 1
|
|
},
|
|
ccnumber: {
|
|
required: true,
|
|
digits: true,
|
|
minlength: 16
|
|
},
|
|
ccmonth: "required",
|
|
ccyear: "required",
|
|
cvv: {
|
|
required: true,
|
|
digits: true,
|
|
minlength: 3
|
|
},
|
|
<?php echo implode(',', $tabRules); ?>
|
|
},
|
|
messages: {
|
|
sel_don: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer une valeur<?php } else { ?>Please enter a value<?php } ?>",
|
|
txt_don: {
|
|
required: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer une valeur<?php } else { ?>Please enter a value<?php } ?>",
|
|
min: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer une valeur plus grande que 0<?php } else { ?>Please enter a value greater than 0<?php } ?>"
|
|
},
|
|
sel_recu: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer une valeur<?php } else { ?>Please enter a value<?php } ?>",
|
|
sel_anonyme: "<?php if ($strLangue == 'fr') { ?>Veuillez entrer une valeur<?php } else { ?>Please enter a value<?php } ?>",
|
|
ccnumber: {
|
|
required: "<?php afficheTexte('checkout_validation-ccnumber-required'); ?>",
|
|
digits: "<?php afficheTexte('checkout_validation-ccnumber-digits'); ?>",
|
|
minlength: "<?php afficheTexte('checkout_validation-ccnumber-minlength'); ?>"
|
|
},
|
|
ccmonth: "<?php afficheTexte('checkout_validation-ccmonth-required'); ?>",
|
|
ccyear: "<?php afficheTexte('checkout_validation-ccyear-required'); ?>",
|
|
cvv: {
|
|
required: "<?php afficheTexte('checkout_validation-cvv-required'); ?>",
|
|
digits: "<?php afficheTexte('checkout_validation-cvv-digits'); ?>",
|
|
minlength: "<?php afficheTexte('checkout_validation-cvv-minlength'); ?>"
|
|
},
|
|
<?php echo implode(',', $tabMessages); ?>
|
|
},
|
|
submitHandler: function (form) {
|
|
var $data = $(form).serialize();
|
|
var $montant = 0;
|
|
|
|
if ($('#sel_don').val() == 'other') {
|
|
$montant = $('#txt_don').val();
|
|
} else {
|
|
$montant = $('#sel_don').val();
|
|
}
|
|
|
|
bootbox.confirm({
|
|
title: "<?php afficheTexte('confirm-title'); ?>",
|
|
message: '<?php afficheTexte('confirm-don-message'); ?><div class="h1 my-3">' + $montant + ' $</div>',
|
|
buttons: {
|
|
confirm: {
|
|
label: '<?php afficheTexte('confirm-don-btn-confirm'); ?>',
|
|
className: 'btn btn-success rounded-0'
|
|
},
|
|
cancel: {
|
|
label: '<?php afficheTexte('confirm-don-btn-cancel'); ?>',
|
|
className: 'btn btn-danger rounded-0'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
var $preloader = $('#preloader');
|
|
var $preloader_text = $('#preloader_text');
|
|
$preloader_text.html('<?php afficheTexte('preloader_wait', 1, 0, 1); ?>');
|
|
$preloader.show();
|
|
$('body').css('cursor', 'wait');
|
|
|
|
form.submit();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
$('#btn_dons').click(function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
grecaptcha.ready(function () {
|
|
grecaptcha.execute('<?php echo RECAPTCHA_SITE_KEY; ?>', {action: 'donation'}).then(function (token) {
|
|
document.getElementById('g-recaptcha-response').value = token;
|
|
$('#frm_dons').submit();
|
|
});
|
|
});
|
|
});
|
|
var $chk_paiement = $("input[name='chk_paiement']");
|
|
|
|
$chk_paiement.change(function () {
|
|
if ($(this).val() == '2') {
|
|
$("#creditcard").css("display", "inline");
|
|
} else {
|
|
$("#creditcard").css("display", "none");
|
|
}
|
|
});
|
|
<?php
|
|
$intCtr = 1;
|
|
|
|
foreach ($tabCalendriers as $strCalendrier) {
|
|
?>
|
|
$('#<?php echo $strCalendrier; ?>').datepicker({
|
|
showOn: "both",
|
|
buttonImage: '<?php echo $vDomaine; ?>/images/date.png',
|
|
buttonImageOnly: true,
|
|
constrainInput: true,
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
dateFormat: 'yy-mm-dd',
|
|
showMonthAfterYear: true,
|
|
showAnim: 'slideDown',
|
|
yearRange: "<?php echo date('Y', strtotime($tabDates['min_date'])); ?>:<?php echo date('Y', strtotime($tabDates['max_date'])); ?>",
|
|
minDate: "<?php echo $tabDates['min_date']; ?>",
|
|
maxDate: "<?php echo $tabDates['max_date']; ?>",
|
|
onSelect: function (dateText, inst) {
|
|
var datePieces = dateText.split('-');
|
|
var month = datePieces[1];
|
|
var day = datePieces[2];
|
|
var year = datePieces[0];
|
|
$('select#<?php echo $strCalendrier; ?>-month').val(month);
|
|
$('select#<?php echo $strCalendrier; ?>-day').val(day);
|
|
$('select#<?php echo $strCalendrier; ?>-year').val(year);
|
|
validator.element("#<?php echo $strCalendrier; ?>");
|
|
}
|
|
});
|
|
|
|
function checkDays<?php echo $intCtr; ?>() {
|
|
var daysInMonth = new Date($('#<?php echo $strCalendrier; ?>-year').val(), $('#<?php echo $strCalendrier; ?>-month').val(), 0).getDate();
|
|
|
|
if ($('#<?php echo $strCalendrier; ?>-day').val() > daysInMonth) {
|
|
$('#<?php echo $strCalendrier; ?>-day').val(daysInMonth);
|
|
}
|
|
|
|
$('#<?php echo $strCalendrier; ?>-day option:gt(' + (daysInMonth) + ')').attr('disabled', true);
|
|
}
|
|
|
|
function fxSetDateInput<?php echo $intCtr; ?>() { // mettre la date modifiée dans le input du calendrier
|
|
$('#<?php echo $strCalendrier; ?>').val($('#<?php echo $strCalendrier; ?>-year').val() + '-' + $('#<?php echo $strCalendrier; ?>-month').val() + '-' + $('#<?php echo $strCalendrier; ?>-day').val());
|
|
// $('#<?php echo $strCalendrier; ?>').focus();
|
|
}
|
|
|
|
$('#<?php echo $strCalendrier; ?>-year').change(function () {
|
|
$('#<?php echo $strCalendrier; ?>-month option').removeAttr('disabled'); // Enable all months
|
|
|
|
$('#<?php echo $strCalendrier; ?>-month').change(); // Cascade changes
|
|
|
|
checkDays<?php echo $intCtr; ?>(); // Ensure only valid dates
|
|
fxSetDateInput<?php echo $intCtr; ?>();
|
|
validator.element("#<?php echo $strCalendrier; ?>");
|
|
});
|
|
$('#<?php echo $strCalendrier; ?>-month').change(function () {
|
|
$('#<?php echo $strCalendrier; ?>-day option').removeAttr('disabled'); // Enable all days
|
|
|
|
checkDays<?php echo $intCtr; ?>(); // Ensure only valid dates
|
|
fxSetDateInput<?php echo $intCtr; ?>();
|
|
validator.element("#<?php echo $strCalendrier; ?>");
|
|
});
|
|
$('#<?php echo $strCalendrier; ?>-day').change(function () {
|
|
fxSetDateInput<?php echo $intCtr; ?>();
|
|
validator.element("#<?php echo $strCalendrier; ?>");
|
|
});
|
|
<?php
|
|
$intCtr++;
|
|
}
|
|
|
|
if (isset($_SESSION['com_id'])) {
|
|
?>
|
|
change_value_compte();
|
|
<?php
|
|
}
|
|
?>
|
|
$('select').each(function () {
|
|
$(this).bind('change', function (e) {
|
|
//alert($(this).val());
|
|
//validator.resetForm();
|
|
validator.element($(this));
|
|
//validator.form();
|
|
});
|
|
});
|
|
var $last = $('#sel_don');
|
|
var $hidden = $('#div_txt_don');
|
|
var $field = $('#txt_don');
|
|
|
|
if ($last.val() == 'other') {
|
|
$hidden.show();
|
|
$form.valid();
|
|
}
|
|
|
|
$last.bind('change', function (e) {
|
|
$field.val('');
|
|
|
|
if ($last.val() == 'other') {
|
|
$hidden.show();
|
|
} else {
|
|
$hidden.hide();
|
|
}
|
|
|
|
validator.element($field);
|
|
});
|
|
|
|
// MSIN-3855 dons Create the Card Fields Component and define callbacks
|
|
<?php
|
|
require_once('paypaladv_dons.php');
|
|
?>
|
|
// fin paypal adv
|
|
<?php
|
|
}
|
|
break;
|
|
case 'index.php':
|
|
switch ($strCode) {
|
|
case 'contact':
|
|
?>
|
|
var box_details = $('#box_evenement_contact');
|
|
var sel_evenements = $('#sel_evenement_contact');
|
|
|
|
sel_evenements.change(function () {
|
|
let id = sel_evenements.val();
|
|
box_details.hide();
|
|
|
|
//document.location.href = '<?php echo $vDomaine; ?>/ajax_contact.php?a=<?php echo urlencode(base64_encode('contact')); ?>&id=' + id + '&lang=<?php echo $strLangue; ?>';
|
|
$.post('<?php echo $vDomaine; ?>/ajax_contact.php', 'a=<?php echo urlencode(base64_encode('contact')); ?>&id=' + id + '&lang=<?php echo $strLangue; ?>', function (result) {
|
|
box_details.html(result.details);
|
|
}, 'json');
|
|
|
|
box_details.fadeIn('slow');
|
|
});
|
|
|
|
|
|
|
|
|
|
<?php
|
|
}
|
|
break;
|
|
}
|
|
?>
|
|
$.validator.methods.email = function (value, element) {
|
|
return this.optional(element) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+\.[a-z]+/.test(value);
|
|
};
|
|
$(".scroll").click(function (event) {
|
|
event.preventDefault();
|
|
var $href = $(this).attr('href');
|
|
var $anchor = $($href).offset();
|
|
$('html, body').animate({scrollTop: $anchor.top}, 500, 'linear');
|
|
});
|
|
$(document).on('scroll', function () {
|
|
if ($(window).scrollTop() >= 200) {
|
|
$('.scroll-top-wrapper').addClass('show');
|
|
} else {
|
|
$('.scroll-top-wrapper').removeClass('show');
|
|
}
|
|
});
|
|
$('.scroll-top-wrapper').on('click', scrollToTop);
|
|
|
|
$preloader.fadeOut();
|
|
});
|
|
var jiraSubmitInProgress = false;
|
|
$(".send_jira").click(function (event) {
|
|
event.preventDefault();
|
|
if (jiraSubmitInProgress) {
|
|
return;
|
|
}
|
|
if (!frm_contact.checkValidity()) {
|
|
alert('Veuillez remplir tous les champs requis correctement.');
|
|
return; // Stopper si le formulaire n'est pas valide
|
|
}
|
|
jira_fx();
|
|
|
|
});
|
|
function jira_fx() {
|
|
const $btn = $('.send_jira');
|
|
const jiraErrorMsg = '<?php echo ($strLangue == 'fr')
|
|
? "Votre message n\\'a pas pu être envoyé. Veuillez réessayer dans quelques instants."
|
|
: "Your message could not be sent. Please try again in a few moments."; ?>';
|
|
const email = $('#txt_courriel').val();
|
|
const nom = $('#txt_nom').val();
|
|
const description = $('#txt_message').val();
|
|
const summary = $('#txt_sujet').val();
|
|
const typedemande = $('#typedemande').val();
|
|
const categorie_interne = $('#typedemande option:selected').data('categorie') || '';
|
|
|
|
jiraSubmitInProgress = true;
|
|
$btn.prop('disabled', true);
|
|
|
|
const postData = {
|
|
request_type: 'check_email',
|
|
email, nom, summary, description, typedemande, categorie_interne
|
|
};
|
|
|
|
return fetch('/ajax_jira.php', {
|
|
method: "POST",
|
|
headers: {
|
|
'Accept': 'application/json',
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify(postData)
|
|
})
|
|
.then(async response => {
|
|
const contentType = response.headers.get('content-type') || '';
|
|
if (!response.ok) {
|
|
const errorText = await response.text();
|
|
throw new Error(`Erreur HTTP ${response.status} :\n${errorText}`);
|
|
}
|
|
if (!contentType.includes("application/json")) {
|
|
const text = await response.text();
|
|
throw new Error("Réponse non-JSON :\n" + text);
|
|
}
|
|
return response.json();
|
|
})
|
|
.then(data => {
|
|
console.log('✅ Réponse JSON:', data);
|
|
if (data.success) {
|
|
document.location.href = '/page/contactsend/<?php echo $strLangue; ?>';
|
|
return;
|
|
}
|
|
alert(jiraErrorMsg);
|
|
jiraSubmitInProgress = false;
|
|
$btn.prop('disabled', false);
|
|
})
|
|
.catch(error => {
|
|
console.error("🔥 Erreur AJAX:", error.message);
|
|
alert(jiraErrorMsg);
|
|
jiraSubmitInProgress = false;
|
|
$btn.prop('disabled', false);
|
|
});
|
|
}
|
|
|
|
|
|
// fin
|
|
function fxSetValidation($intCountry) {
|
|
var $strInput = $('#par_telephone1_1');
|
|
if ($intCountry === '1') {
|
|
$("#par_codepostal_1").rules('add', {
|
|
postalCodeCA: true,
|
|
zipcodeUS: false
|
|
});
|
|
console.log('CA');
|
|
$strInput.unmask();
|
|
$strInput.mask('000-000-0000');
|
|
} else if ($intCountry === '234') {
|
|
$("#par_codepostal_1").rules('add', {
|
|
postalCodeCA: false,
|
|
zipcodeUS: true
|
|
});
|
|
console.log('USA');
|
|
$strInput.unmask();
|
|
$strInput.mask('000-000-0000');
|
|
} else {
|
|
$("#par_codepostal_1").rules('add', {
|
|
postalCodeCA: false,
|
|
zipcodeUS: false
|
|
});
|
|
console.log('Autre');
|
|
$strInput.unmask();
|
|
}
|
|
}
|
|
|
|
function scrollToTop() {
|
|
var verticalOffset = typeof (verticalOffset) != 'undefined' ? verticalOffset : 0;
|
|
var element = $('body');
|
|
var offset = element.offset();
|
|
var offsetTop = offset.top;
|
|
$('html, body').animate({scrollTop: offsetTop}, 500, 'linear');
|
|
}
|
|
|
|
// message paypaladvence
|
|
function translateErrorMessage(errorMessage) {
|
|
|
|
switch (errorMessage) {
|
|
case "OnlyVisaandMastercard":
|
|
return "<?php afficheTexte('OnlyVisaandMastercard', 1, 0, 1);?>";
|
|
|
|
case "INVALID_CVV":
|
|
return "<?php afficheTexte('checkout_validation-cvv-digits', 1, 0, 1);?>";
|
|
case "INVALID_NUMBER":
|
|
case "Invalid card number":
|
|
|
|
return "<?php afficheTexte('checkout_validation-ccnumber-required', 1, 0, 1);?>";
|
|
case "INVALID_EXPIRY":
|
|
return "<?php afficheTexte('checkout_validation-expiry', 1, 0, 1);?>";
|
|
case "checkout_validation-declined":
|
|
return "<?php afficheTexte('checkout_validation-declined', 1, 0, 1);?>";
|
|
default:
|
|
// return "Une erreur est survenue lors du traitement du paiement. Veuillez réessayer.";
|
|
console.log('pas traduit');
|
|
return errorMessage;
|
|
}
|
|
}
|
|
|
|
function detectCardType(number) {
|
|
// Simple card type detection based on the card number prefix
|
|
const visaPrefix = /^4[0-9]{12}(?:[0-9]{3})?$/;
|
|
const mastercardPrefix = /^5[1-5][0-9]{14}$/;
|
|
|
|
if (visaPrefix.test(number)) {
|
|
return 'visa';
|
|
} else if (mastercardPrefix.test(number)) {
|
|
return 'mastercard';
|
|
} else {
|
|
return 'unknown';
|
|
}
|
|
}
|
|
function preprod(value) {
|
|
// Ajoute un paramètre à l'URL (ici ?preprod=1)
|
|
// const url = new URL(window.location.href);
|
|
//url.searchParams.set('preprod', value);
|
|
addParamsAndReload({ preprod: value });
|
|
// Recharge la page avec le paramètre dans l'URL
|
|
// window.location.href = url.toString();
|
|
}
|
|
function addParamsAndReload(newParams) {
|
|
const url = new URL(window.location.href);
|
|
|
|
|
|
for (const [key, value] of Object.entries(newParams)) {
|
|
url.searchParams.set(key, value);
|
|
}
|
|
|
|
// Rediriger vers l'URL mise à jour
|
|
|
|
window.location.href = url.toString();
|
|
}
|
|
|
|
|
|
$(function() {
|
|
|
|
const params = new URLSearchParams(window.location.search);
|
|
const ref = params.get('ref');
|
|
|
|
if (ref) {
|
|
try {
|
|
const pecId = atob(ref);
|
|
const target = $('#pec_' + pecId);
|
|
|
|
if (target.length) {
|
|
$('html, body').animate({
|
|
scrollTop: target.offset().top - 100
|
|
}, 800);
|
|
|
|
target.addClass('table-warning');
|
|
}
|
|
} catch (e) {
|
|
console.log('Ref invalide');
|
|
}
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// MSIN-4435 — JS v2 : js/v2/*.js via fxV2RenderFooterScripts() (inc_footer.php)
|
|
|
|
</script>
|
|
|