Poprawa przeliczania ceny dostawy

This commit is contained in:
2024-11-25 13:52:34 +01:00
parent 6007ecec4d
commit 0bb9b21025
2 changed files with 90 additions and 31 deletions

View File

@@ -1781,4 +1781,68 @@ div.asideContainer_pickup {
.modal__content #signin-form{ .modal__content #signin-form{
display: block!important; 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;
}
} }

View File

@@ -699,8 +699,8 @@ function createPickuppointInfo(selectedPoint, deliveryPointId, name, streetText,
</span> </span>
</div> </div>
</div> </div>
<input type="hidden" name="pickup_point" value="${deliveryPointId}">
</label> </label>
<input type="hidden" name="pickup_point" value="${deliveryPointId}">
`); `);
} }
@@ -908,6 +908,7 @@ async function logInToAccount(event){
if(event) event.preventDefault(); if(event) event.preventDefault();
const login = document.querySelector(".signin-form__login").value; const login = document.querySelector(".signin-form__login").value;
const password = document.querySelector(".signin-form__pass").value; const password = document.querySelector(".signin-form__pass").value;
app_shop.fn.ajaxLoadSite(1);
const loginStatus = await fetchData({ const loginStatus = await fetchData({
data: SIGNIN(` data: SIGNIN(`
login: "${login.replace(/"/g, '\\"')}", login: "${login.replace(/"/g, '\\"')}",
@@ -916,16 +917,13 @@ async function logInToAccount(event){
linkParameter: '?mutation=signin', linkParameter: '?mutation=signin',
alert: false, alert: false,
}); });
app_shop.fn.ajaxLoadSite(0);
if (loginStatus.errors) { if (loginStatus.errors) {
Alertek.show_alert(`${<iai:variable vid="Podany login lub hasło nie jest poprawne"/>}`); Alertek.show_alert(`${<iai:variable vid="Podany login lub hasło nie jest poprawne"/>}`);
return; return;
} }
app_shop.fn.signinModal.closeModal(); app_shop.fn.signinModal.closeModal();
getClientNew(); 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.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(); 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 // Zalogowanie/inicjacja użytkownika
function getClientNew(){ function getClientNew(){
app_shop.fn.ajaxLoadSite(1);
// Przygotowanie jesli użytkownik nie jest zalogowany // Przygotowanie jesli użytkownik nie jest zalogowany
if(!document.querySelector(".--logged")) document.getElementById("client_form").remove(); if(!document.querySelector(".--logged")) document.getElementById("client_form").remove();
document.querySelector(".step1_sub").insertAdjacentHTML("beforeend",'<div class="signup"></div>'); document.querySelector(".step1_sub").insertAdjacentHTML("beforeend",'<div class="signup"></div>');
$.ajax({
url: "/client-new.php?ajax=true&set_render=content", app_shop.fn.load(
timeout: 16e3, "place-order.php",
complete: function (e, a) { [["#bm-oscop-section1", "#bm-oscop-section1"]],
throwAjaxError(a); function () {
app_shop.fn.ajaxLoadSite(0); history.go(-1);
}, },
success: function (e, a) { "?set_render=content"
app_shop.fn.load( ).then(() => {
"place-order.php", changeRegion();
[["#bm-oscop-section1", "#bm-oscop-section1"]],
function () { // Ustaw numer kraju przy telefonie
history.go(-1); setPhoneCountryNumberAtStart("client");
}, setPhoneCountryNumberAtStart("delivery");
"?set_render=content" })
).then(() => {
changeRegion();
})
},
});
}; };
function createPhoneCodeList(){ function createPhoneCodeList(){
@@ -1375,7 +1368,7 @@ async function changeRegion(payAndDelData = null) {
linkParameter: '?mutation=setRegion', linkParameter: '?mutation=setRegion',
}); });
const { status } = regionStatus?.data?.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(<iai:variable vid="Błąd podczas zmiany kraju. Przeładuj stronę jeszcze raz."/>);
// Waliduj numery telefonu dla kraju // Waliduj numery telefonu dla kraju
if(!firstTimeLoadPage){ if(!firstTimeLoadPage){
@@ -1868,6 +1861,7 @@ return `<div class="osc_item" for="payitem_${method}">
} }
app_shop.txt.week_day0 = <iai:variable vid="Dzisiaj"/>;
app_shop.txt.week_day1 = <iai:variable vid="Poniedziałek"/>; app_shop.txt.week_day1 = <iai:variable vid="Poniedziałek"/>;
app_shop.txt.week_day2 = <iai:variable vid="Wtorek"/>; app_shop.txt.week_day2 = <iai:variable vid="Wtorek"/>;
app_shop.txt.week_day3 = <iai:variable vid="Środa"/>; app_shop.txt.week_day3 = <iai:variable vid="Środa"/>;
@@ -1875,6 +1869,7 @@ app_shop.txt.week_day4 = <iai:variable vid="Czwartek"/>;
app_shop.txt.week_day5 = <iai:variable vid="Piątek"/>; app_shop.txt.week_day5 = <iai:variable vid="Piątek"/>;
app_shop.txt.week_day6 = <iai:variable vid="Sobota"/>; app_shop.txt.week_day6 = <iai:variable vid="Sobota"/>;
app_shop.txt.week_day7 = <iai:variable vid="Niedziela"/>; app_shop.txt.week_day7 = <iai:variable vid="Niedziela"/>;
app_shop.txt.week_day8 = <iai:variable vid="jutro"/>;
app_shop.txt.month_name1 = <iai:variable vid="Stycznia"/>; app_shop.txt.month_name1 = <iai:variable vid="Stycznia"/>;
app_shop.txt.month_name2 = <iai:variable vid="Lutego"/>; app_shop.txt.month_name2 = <iai:variable vid="Lutego"/>;
@@ -1980,7 +1975,7 @@ function prepareDeliveryMarkup(method, deliveryId){
</div> </div>
<div class="delivery_date"> <div class="delivery_date">
${<iai:variable vid="Przewidywana dostawa"/>}: ${<iai:variable vid="Przewidywana dostawa"/>}:
<strong>${orderTxt[`shipping${parseInt(method.deliveryTime.weekDay)}`]} ${deliveryDate}</strong> <strong>${app_shop.txt[`week_day${parseInt(method.deliveryTime.weekDay)}`]} ${deliveryDate}</strong>
</div> </div>
${method.courier.pickupPoint === true ? `<div class="fselectedPoint" style="padding:0;display:none;" for="item_${method.courier.fullId}"></div>` : ""} ${method.courier.pickupPoint === true ? `<div class="fselectedPoint" style="padding:0;display:none;" for="item_${method.courier.fullId}"></div>` : ""}
${shippingCalendarAndHours} ${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);}); 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 // 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; prevShipping=e.target;
// Przeliczenie kosztu dostawy i czasu dostawy // Przeliczenie kosztu dostawy i czasu dostawy
@@ -2286,7 +2281,7 @@ function calculateBasketCost() {
dataType: "json", dataType: "json",
data: orderInfo, data: orderInfo,
success: function (t) { success: function (t) {
document.querySelector("#order2_products_worth .operation_value").innerHTML = formatPrice(t.products_worth, t.currency_sign) + "<small>" + orderTxt.gross + "</small>"; document.querySelector("#order2_products_worth .operation_value").innerHTML = formatPrice(t.products_worth, t.currency_sign) + "<small>" + <iai:variable vid="brutto"/> + "</small>";
// Sprawdź cene dostawy // Sprawdź cene dostawy
if(t.shipping_undefined) deliveryCostEl.parentElement.style.display = "none"; if(t.shipping_undefined) deliveryCostEl.parentElement.style.display = "none";
@@ -2369,8 +2364,8 @@ function calculateDeliveryDate(deliveryVal, delivery, pickuppoint) {
attatchedDateEl.innerHTML = <iai:variable vid="Dzisiaj"/>; attatchedDateEl.innerHTML = <iai:variable vid="Dzisiaj"/>;
} }
else{ else{
deliveryDateEl.innerHTML = orderTxt[`shipping${parseInt(date[3])}`]; deliveryDateEl.innerHTML = app_shop.txt[`week_day${parseInt(date[3])}`];
attatchedDateEl.innerHTML = orderTxt[`shipping${parseInt(date[3])}`]; attatchedDateEl.innerHTML = app_shop.txt[`week_day${parseInt(date[3])}`];
} }
} }
}; };