From 8462d4932cf9a8b1b94964de6bddc7a448fb447f Mon Sep 17 00:00:00 2001 From: "pawel.gaca" Date: Tue, 16 Jan 2024 10:07:07 +0100 Subject: [PATCH] =?UTF-8?q?Naprawa=20buga=20zwi=C4=85zanego=20z=20walidacj?= =?UTF-8?q?=C4=85=20kodu=20pocztowego?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mapy/oneMap.js | 13 ++++++------- style.css | 5 +++-- wydzielonyScript.js | 13 ++++++------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/mapy/oneMap.js b/mapy/oneMap.js index a7d3a64..5d08307 100644 --- a/mapy/oneMap.js +++ b/mapy/oneMap.js @@ -765,8 +765,6 @@ async function changeRegion(payAndDelData = null, firstLoad = false) { // Pobranie informacji o regionie z formularza const clientRegion = document.getElementById("client_region").value; const deliveryRegion = document.getElementById("deliver_to_billingaddr").checked ? document.getElementById("delivery_region").value : clientRegion; - - // Zmiana regionu const regionStatus = await this.fetchData({ @@ -1592,11 +1590,11 @@ async function validateAllInputs(){ allGood = await validateRequest(document.getElementById("client_nip"), true) && allGood; } // Sprawdzenie reszty pól - allGood = validateFormInputs("client") && allGood; + allGood = await validateFormInputs("client") && allGood; } // Sprawdzanie pól dostawy na inny adres if(document.getElementById("deliver_to_billingaddr").checked){ - allGood = validateFormInputs("delivery") && allGood; + allGood = await validateFormInputs("delivery") && allGood; allGood = validatePhone(document.getElementById("delivery_phone")) && allGood; } return allGood @@ -1616,12 +1614,13 @@ async function validateFormInputs(query){ // Obsługa złożenia zamówienia const termsConditionsInput = document.getElementById("order2_terms_conditions"); const cancelConditionsInput = document.getElementById("order2_cancel"); -document.querySelector(".order2_button_order").addEventListener("click", () => { +document.querySelector(".order2_button_order").addEventListener("click", async () => { try { app_shop.fn.ajaxLoadSite(1); app_shop.vars.validation = 1; // Sprawdzenie pól formularza - if(validateAllInputs() === false) app_shop.vars.validation = 0; + const x = await validateAllInputs(); + if(x === false) app_shop.vars.validation = 0; // Znalezienie obecnie zaznaczonej metody dostawy i płatności const deliveryMethod = document.querySelector(".ajax_cop [name=shipping]:checked"); @@ -1682,7 +1681,7 @@ document.querySelector(".order2_button_order").addEventListener("click", () => { }); // Przescrolluj do function scrollToHeight(scrollToEl){ - const yOffset = -45; + const yOffset = app_shop.vars.view === 1 ? -100 : -45; const y = scrollToEl.getBoundingClientRect().top + window.pageYOffset + yOffset; window.scrollTo({top: y, behavior: 'smooth'}); } diff --git a/style.css b/style.css index 3bff47a..36169dd 100644 --- a/style.css +++ b/style.css @@ -518,8 +518,9 @@ cursor: pointer; display: flex; align-items: center; - top: 0; - height: 100%; + top: 12%; + height: 75%; + background: #fff; } #toggle_password:hover{ color: @less_iaicolorscheme_background_active_color; diff --git a/wydzielonyScript.js b/wydzielonyScript.js index 949a7f7..43d93ea 100644 --- a/wydzielonyScript.js +++ b/wydzielonyScript.js @@ -762,8 +762,6 @@ async function changeRegion(payAndDelData = null, firstLoad = false) { const clientRegion = document.getElementById("client_region").value; const deliveryRegion = document.getElementById("deliver_to_billingaddr").checked ? document.getElementById("delivery_region").value : clientRegion; - - // Zmiana regionu const regionStatus = await this.fetchData({ data: SET_REGION(`SetRegionInput: { @@ -1588,11 +1586,11 @@ async function validateAllInputs(){ allGood = await validateRequest(document.getElementById("client_nip"), true) && allGood; } // Sprawdzenie reszty pól - allGood = validateFormInputs("client") && allGood; + allGood = await validateFormInputs("client") && allGood; } // Sprawdzanie pól dostawy na inny adres if(document.getElementById("deliver_to_billingaddr").checked){ - allGood = validateFormInputs("delivery") && allGood; + allGood = await validateFormInputs("delivery") && allGood; allGood = validatePhone(document.getElementById("delivery_phone")) && allGood; } return allGood @@ -1612,12 +1610,13 @@ async function validateFormInputs(query){ // Obsługa złożenia zamówienia const termsConditionsInput = document.getElementById("order2_terms_conditions"); const cancelConditionsInput = document.getElementById("order2_cancel"); -document.querySelector(".order2_button_order").addEventListener("click", () => { +document.querySelector(".order2_button_order").addEventListener("click", async () => { try { app_shop.fn.ajaxLoadSite(1); app_shop.vars.validation = 1; // Sprawdzenie pól formularza - if(validateAllInputs() === false) app_shop.vars.validation = 0; + const x = await validateAllInputs(); + if(x === false) app_shop.vars.validation = 0; // Znalezienie obecnie zaznaczonej metody dostawy i płatności const deliveryMethod = document.querySelector(".ajax_cop [name=shipping]:checked"); @@ -1678,7 +1677,7 @@ document.querySelector(".order2_button_order").addEventListener("click", () => { }); // Przescrolluj do function scrollToHeight(scrollToEl){ - const yOffset = -45; + const yOffset = app_shop.vars.view === 1 ? -100 : -45; const y = scrollToEl.getBoundingClientRect().top + window.pageYOffset + yOffset; window.scrollTo({top: y, behavior: 'smooth'}); }