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{
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>
</div>
</div>
<input type="hidden" name="pickup_point" value="${deliveryPointId}">
</label>
<input type="hidden" name="pickup_point" value="${deliveryPointId}">
`);
}
@@ -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(`${<iai:variable vid="Podany login lub hasło nie jest poprawne"/>}`);
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",'<div class="signup"></div>');
$.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(<iai:variable vid="Błąd podczas zmiany kraju. Przeładuj stronę jeszcze raz."/>);
// Waliduj numery telefonu dla kraju
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_day2 = <iai:variable vid="Wtorek"/>;
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_day6 = <iai:variable vid="Sobota"/>;
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_name2 = <iai:variable vid="Lutego"/>;
@@ -1980,7 +1975,7 @@ function prepareDeliveryMarkup(method, deliveryId){
</div>
<div class="delivery_date">
${<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>
${method.courier.pickupPoint === true ? `<div class="fselectedPoint" style="padding:0;display:none;" for="item_${method.courier.fullId}"></div>` : ""}
${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) + "<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
if(t.shipping_undefined) deliveryCostEl.parentElement.style.display = "none";
@@ -2369,8 +2364,8 @@ function calculateDeliveryDate(deliveryVal, delivery, pickuppoint) {
attatchedDateEl.innerHTML = <iai:variable vid="Dzisiaj"/>;
}
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])}`];
}
}
};