diff --git a/local/modules/ClickAndCollect/templates/frontOffice/default/order-delivery-extra.html b/local/modules/ClickAndCollect/templates/frontOffice/default/order-delivery-extra.html index a5dece6e..91d48535 100644 --- a/local/modules/ClickAndCollect/templates/frontOffice/default/order-delivery-extra.html +++ b/local/modules/ClickAndCollect/templates/frontOffice/default/order-delivery-extra.html @@ -109,5 +109,20 @@ initMapCnc(); }); + $("#form-cart-delivery").off('submit').submit(function(ev) { + if ($('[delivery-mode=cnc]').is(':checked')) { + + // On RAZ les éventuelles sélections préalables. + if (typeof $('input[name=pdr-choosen-day]:checked').val() != 'undefined') + $('input[name=pdr-choosen-day]:checked').prop("checked", false); + if (typeof $('input[name=lps-choosen-day]:checked').val() != 'undefined') + $('input[name=lps-choosen-day]:checked').prop("checked", false); + + if ($('input[name=cnc-choosen-day]:checked').length === 0) { + alert("Veuillez choisir un point Click and Collect."); + ev.preventDefault(); + } + } + }); diff --git a/local/modules/LivraisonParSecteurs/templates/frontOffice/default/order-delivery-extra.html b/local/modules/LivraisonParSecteurs/templates/frontOffice/default/order-delivery-extra.html index 65d97ea5..e9552526 100644 --- a/local/modules/LivraisonParSecteurs/templates/frontOffice/default/order-delivery-extra.html +++ b/local/modules/LivraisonParSecteurs/templates/frontOffice/default/order-delivery-extra.html @@ -85,27 +85,19 @@ }); $("#form-cart-delivery").off('submit').submit(function(ev) { - if ($('[delivery-mode=lps]').is(':checked') - && - $('input[name=lps-choosen-day]:checked').length === 0) { - alert("Veuillez choisir un jour de livraison."); - ev.preventDefault(); - } + if ($('[delivery-mode=lps]').is(':checked')) { - if ($('[delivery-mode=pdr]').is(':checked') - && - $('input[name=pdr-choosen-day]:checked').length === 0) { - alert("Veuillez choisir un point de retrait."); - ev.preventDefault(); - } + // On RAZ les éventuelles sélections préalables. + if (typeof $('input[name=cnc-choosen-day]:checked').val() != 'undefined') + $('input[name=cnc-choosen-day]:checked').prop("checked", false); + if (typeof $('input[name=pdr-choosen-day]:checked').val() != 'undefined') + $('input[name=pdr-choosen-day]:checked').prop("checked", false); - if ($('[delivery-mode=cnc]').is(':checked') - && - $('input[name=cnc-choosen-day]:checked').length === 0) { - alert("Veuillez choisir un point Click and Collect."); - ev.preventDefault(); + if ($('input[name=lps-choosen-day]:checked').length === 0) { + alert("Veuillez choisir un jour de livraison."); + ev.preventDefault(); + } } }); - diff --git a/local/modules/PointRetrait/templates/frontOffice/default/order-delivery-extra.html b/local/modules/PointRetrait/templates/frontOffice/default/order-delivery-extra.html index c80eda78..039306f7 100644 --- a/local/modules/PointRetrait/templates/frontOffice/default/order-delivery-extra.html +++ b/local/modules/PointRetrait/templates/frontOffice/default/order-delivery-extra.html @@ -215,4 +215,20 @@ initMaps(); } + $("#form-cart-delivery").off('submit').submit(function(ev) { + if ($('[delivery-mode=pdr]').is(':checked')) { + + // On RAZ les éventuelles sélections préalables. + if (typeof $('input[name=cnc-choosen-day]:checked').val() != 'undefined') + $('input[name=cnc-choosen-day]:checked').prop("checked", false); + if (typeof $('input[name=lps-choosen-day]:checked').val() != 'undefined') + $('input[name=lps-choosen-day]:checked').prop("checked", false); + + if ($('input[name=pdr-choosen-day]:checked').length === 0) { + alert("Veuillez choisir un point de retrait."); + ev.preventDefault(); + } + } + }); + \ No newline at end of file