1import { 2 trans, 3 setLocale, 4 PLEASE_ENTER_A_VALID_EMAIL_ADDRESS, 5 VALIDATION_CHOOSE_AMOUNT, 6} from '../translator.js'; 7import { Modal } from 'bootstrap'; 8 9setLocale(LOCALE); 10 11const voucher = { 12 13 check: function () { 14 15 const myModalAlternative = new Modal('#modalGiftVoucher', {}) 16 17 if($('#giftVoucherForm').length) { 18 19 const emailInput = $(".input-email"); 20 voucher.init(emailInput); 21 22 if(emailInput.val() && $('.priceChoices:checked').length) { 23 myModalAlternative.show(); 24 } else { 25 26 if(!emailInput.val()) { 27 emailInput.addClass('error'); 28 emailInput.next('.msg-error').text(trans(PLEASE_ENTER_A_VALID_EMAIL_ADDRESS, {}, 'validators')).show(); 29 $("#btnSubmit").addClass('my-auto'); 30 } 31 32 if($('.priceChoices:checked').length === 0) { 33 $("#list-price").next('.msg-error').text(trans(VALIDATION_CHOOSE_AMOUNT)).show(); 34 } 35 } 36 } else { 37 if($('.form-check-input:checked').length || $('#voucher_freeAmount').val()) { 38 myModalAlternative.show(); 39 } 40 } 41 }, 42 init: function (emailInput) { 43 44 emailInput.removeClass('error'); 45 emailInput.next('.msg-error').text(''); 46 $("#btnSubmit").removeClass('my-auto'); 47 48 $("#list-price").next('.msg-error').text('').show(); 49 } 50} 51 52 53// For inputs Radio 54let checksVoucherPrice = document.getElementsByClassName('form-check-input'); 55 56if(checksVoucherPrice) { 57 58 for (let check of checksVoucherPrice) { 59 check.addEventListener('change', () => { 60 document.getElementById('btnModalVoucher').removeAttribute('disabled'); 61 document.getElementById('voucherNumber').innerText = parseFloat(check.value); 62 }) 63 } 64} 65 66// For inputs Text 67let inputFreeAmount = document.getElementById('voucher_freeAmount'); 68 69if(inputFreeAmount) { 70 71 inputFreeAmount.addEventListener('input', () => { 72 document.getElementById('btnModalVoucher').removeAttribute('disabled'); 73 document.getElementById('voucherNumber').innerText = parseFloat(inputFreeAmount.value); 74 }) 75} 76 77$(document).on('click', "#btnModalVoucher" , voucher.check) 78 79// Validation form SaferPay 80/* 81if (document.getElementById('voucherForm')) { 82 let voucherForm = document.getElementById('voucherForm'); 83 voucherForm.addEventListener('submit', (e) => { 84 e.preventDefault(); 85 86 const formData = new FormData(voucherForm); 87 88 fetch(`/${locale}/cadeaux/valid-voucher-form`, {body: formData, method: 'POST'}) 89 .then(response => response.json()) 90 .then(response => { 91 if (response.status === 'ok') { 92 window.open(`${response.message.body.RedirectUrl}`, '_blank'); 93 voucherForm.reset(); 94 $('#modalGiftVoucher').modal('hide'); 95 96 document.querySelector('.modal-backdrop').style.display = 'none'; 97 //window.open(response.message); 98 //voucherForm.reset(); 99 //document.getElementById('contentModalVoucher').innerHTML = `<h3 class="red">${response.message}</h3>` 100 } 101 }); 102 }); 103} 104*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.