From 0bb9b2102531a7bf2549b628d8ad79ee2a7b91d1 Mon Sep 17 00:00:00 2001 From: "pawel.gaca" Date: Mon, 25 Nov 2024 13:52:34 +0100 Subject: [PATCH] Poprawa przeliczania ceny dostawy --- style.css | 64 +++++++++++++++++++++++++++++++++++++++++++++ wydzielonyScript.js | 57 ++++++++++++++++++---------------------- 2 files changed, 90 insertions(+), 31 deletions(-) diff --git a/style.css b/style.css index a1f3a3e..2b10f0b 100644 --- a/style.css +++ b/style.css @@ -1781,4 +1781,68 @@ div.asideContainer_pickup { .modal__content #signin-form{ display: block!important; +} + +.--place-order-page{ + @media (min-width: 757px) { + div.asideContainer_pickup { + width: 330px; + margin-top: 0; + max-height: 500px; + } + } + + label.pickup_point { + border: 2px solid transparent; + border-bottom: 1px solid rgba(0, 0, 0, 0.2); + color: #333; + cursor: pointer; + font-size: 12px; + padding: 10px 10px 10px 47px; + position: relative; + width: 100%; + } + input:checked + label.pickup_point { + border: 2px solid @primary_color; + background: #fff; + z-index: 10; + border-radius: 5px; + } + + #e-invoice_dialog { + display: none; + } + #e-invoice_dialog .big_label, + #e-invoice_dialog .headline { + padding-top: 0; + } + #e-invoice_dialog div { + border: 1px solid #c4c7c8; + padding: 25px; + background: url('/gfx/standards/e-invoice_leaf.png?r=1732180575') 95% center no-repeat; + } + #e-invoice_dialog div > span { + font-size: 2.33em; + line-height: 1em; + font-weight: bold; + display: block; + margin-bottom: 25px; + } + #e-invoice_dialog div > span font { + color: #CA4C56; + display: block; + } + #e-invoice_dialog div p { + width: 80%; + margin-bottom: 25px; + } + #e-invoice_dialog div button { + display: block; + margin: 0 auto; + } + .order2_terms_wrapper_sub input { + margin-left: -17px; + margin-right: 5px; + vertical-align: middle; + } } \ No newline at end of file diff --git a/wydzielonyScript.js b/wydzielonyScript.js index 6a70e74..9c52c9f 100644 --- a/wydzielonyScript.js +++ b/wydzielonyScript.js @@ -699,8 +699,8 @@ function createPickuppointInfo(selectedPoint, deliveryPointId, name, streetText, + - `); } @@ -908,6 +908,7 @@ async function logInToAccount(event){ if(event) event.preventDefault(); const login = document.querySelector(".signin-form__login").value; const password = document.querySelector(".signin-form__pass").value; + app_shop.fn.ajaxLoadSite(1); const loginStatus = await fetchData({ data: SIGNIN(` login: "${login.replace(/"/g, '\\"')}", @@ -916,16 +917,13 @@ async function logInToAccount(event){ linkParameter: '?mutation=signin', alert: false, }); + app_shop.fn.ajaxLoadSite(0); if (loginStatus.errors) { Alertek.show_alert(`${}`); return; } app_shop.fn.signinModal.closeModal(); getClientNew(); - - // Ustaw numer kraju przy telefonie - setPhoneCountryNumberAtStart("client"); - setPhoneCountryNumberAtStart("delivery"); if(document.querySelector(".order2_terms_wrapper_sub.email")) document.querySelector(".order2_terms_wrapper_sub.email").remove(); if(document.querySelector(".order2_terms_wrapper_sub.sms")) document.querySelector(".order2_terms_wrapper_sub.sms").remove(); @@ -933,31 +931,26 @@ async function logInToAccount(event){ // Zalogowanie/inicjacja użytkownika function getClientNew(){ - app_shop.fn.ajaxLoadSite(1); + // Przygotowanie jesli użytkownik nie jest zalogowany if(!document.querySelector(".--logged")) document.getElementById("client_form").remove(); document.querySelector(".step1_sub").insertAdjacentHTML("beforeend",''); - $.ajax({ - url: "/client-new.php?ajax=true&set_render=content", - timeout: 16e3, - complete: function (e, a) { - throwAjaxError(a); - app_shop.fn.ajaxLoadSite(0); + + app_shop.fn.load( + "place-order.php", + [["#bm-oscop-section1", "#bm-oscop-section1"]], + function () { + history.go(-1); }, - success: function (e, a) { - app_shop.fn.load( - "place-order.php", - [["#bm-oscop-section1", "#bm-oscop-section1"]], - function () { - history.go(-1); - }, - "?set_render=content" - ).then(() => { - changeRegion(); - }) - }, - }); + "?set_render=content" + ).then(() => { + changeRegion(); + + // Ustaw numer kraju przy telefonie + setPhoneCountryNumberAtStart("client"); + setPhoneCountryNumberAtStart("delivery"); + }) }; function createPhoneCodeList(){ @@ -1375,7 +1368,7 @@ async function changeRegion(payAndDelData = null) { linkParameter: '?mutation=setRegion', }); const { status } = regionStatus?.data?.setRegion || {}; - if (status !== 'success') return alert("Błąd podczas zmiany kraju. Przeładuj stronę jeszcze raz."); + if (status !== 'success') return alert(); // Waliduj numery telefonu dla kraju if(!firstTimeLoadPage){ @@ -1868,6 +1861,7 @@ return `
} +app_shop.txt.week_day0 = ; app_shop.txt.week_day1 = ; app_shop.txt.week_day2 = ; app_shop.txt.week_day3 = ; @@ -1875,6 +1869,7 @@ app_shop.txt.week_day4 = ; app_shop.txt.week_day5 = ; app_shop.txt.week_day6 = ; app_shop.txt.week_day7 = ; +app_shop.txt.week_day8 = ; app_shop.txt.month_name1 = ; app_shop.txt.month_name2 = ; @@ -1980,7 +1975,7 @@ function prepareDeliveryMarkup(method, deliveryId){
${}: - ${orderTxt[`shipping${parseInt(method.deliveryTime.weekDay)}`]} ${deliveryDate} + ${app_shop.txt[`week_day${parseInt(method.deliveryTime.weekDay)}`]} ${deliveryDate}
${method.courier.pickupPoint === true ? `` : ""} ${shippingCalendarAndHours} @@ -2062,7 +2057,7 @@ document.getElementById("bm-oscop-section2").addEventListener("click", e => { if(e.target.dataset.working_days) e.target.dataset.working_days.split("#").map(function (e) {return parseInt(e, 10);}); // Zapisanie jako poprzednia metoda płatności jeśli nie wymaga wyboru punktu odbioru - if(e.target.dataset.pickuppoint === "n"){ + if(e.target.dataset.pickuppoint === "false"){ prevShipping=e.target; // Przeliczenie kosztu dostawy i czasu dostawy @@ -2286,7 +2281,7 @@ function calculateBasketCost() { dataType: "json", data: orderInfo, success: function (t) { - document.querySelector("#order2_products_worth .operation_value").innerHTML = formatPrice(t.products_worth, t.currency_sign) + "" + orderTxt.gross + ""; + document.querySelector("#order2_products_worth .operation_value").innerHTML = formatPrice(t.products_worth, t.currency_sign) + "" + + ""; // Sprawdź cene dostawy if(t.shipping_undefined) deliveryCostEl.parentElement.style.display = "none"; @@ -2369,8 +2364,8 @@ function calculateDeliveryDate(deliveryVal, delivery, pickuppoint) { attatchedDateEl.innerHTML = ; } else{ - deliveryDateEl.innerHTML = orderTxt[`shipping${parseInt(date[3])}`]; - attatchedDateEl.innerHTML = orderTxt[`shipping${parseInt(date[3])}`]; + deliveryDateEl.innerHTML = app_shop.txt[`week_day${parseInt(date[3])}`]; + attatchedDateEl.innerHTML = app_shop.txt[`week_day${parseInt(date[3])}`]; } } };