diff --git a/frontend/views/site/index.php b/frontend/views/site/index.php index 67f1378..c505062 100755 --- a/frontend/views/site/index.php +++ b/frontend/views/site/index.php @@ -575,7 +575,7 @@ $coordinates['lon'] = empty($settings->lon) ? 0 : $settings->lon; составляет 0.1637 €/кВт∙ч для промышленных станций, установленных на крыше. diff --git a/frontend/web/js/product.js b/frontend/web/js/product.js index 18f2003..65e7fee 100644 --- a/frontend/web/js/product.js +++ b/frontend/web/js/product.js @@ -1,6 +1,18 @@ var phoneInput = document.querySelector('#cardProduct [type="tel"]'); var counter = document.querySelector('#cardProduct .product-counter__input'); var price = 0; +$('#order-product').click(function (e){ + e.preventDefault(); + var message='Сума: '; + message += $('#cardProduct .product-counter__value').text(); + message +='\nКод товара: ' + $('#product-code').val(); + message +='\nКількість: ' + counter.querySelector('input').value; + console.log(message + phoneInput.value); + var phone = '+38' + phoneInput.value; + if(phone.length===17){ + console.log('good') + } +}) if (phoneInput) { phoneInput.addEventListener('input', phoneHandleInput); } @@ -11,12 +23,15 @@ $('#cardProduct').on('show.bs.modal', function (e) { var itemPrice = counter.parentElement.querySelector('.product-counter__value'); itemPrice.innerHTML = `${price} ${itemPrice.dataset.currency}`; counter.querySelector('input').value = 1; + var sku = button.data('sku'); + $('#product-code').val(sku); + $('#cardProduct .product-code').text('Код товара ' + sku); }) + if(counter){ counterFunc(counter); } - function phoneHandleInput(e) { e.target.value = phoneMasks(e.target.value); } @@ -24,7 +39,7 @@ function phoneHandleInput(e) { function phoneMasks(phone) { return phone.replace(/\D/g, '') .replace(/^(\d)/, '($1') - .replace(/^(\(\d{3})(\d)/, '$1) $2') + .replace(/^(\(\d{3})(\d)/, '$1)$2') .replace(/(\d{3})(\d{1,7})/, '$1-$2') .replace(/(-\d{2})(\d{1,7})/, '$1-$2') .replace(/(-\d{2})\d+?$/, '$1'); @@ -56,9 +71,7 @@ function counterFunc(counter) { function increment(e) { e.preventDefault(); var value = Number(counter.querySelector('input').value); - //console.log(value); counter.querySelector('input').value = value + 1; - console.log(value); updateSummary(); } -- libgit2 0.21.4