Wprowadzenie drobnych poprawek i przekierowania ze strony order1 na place-order
This commit is contained in:
@@ -129,9 +129,18 @@ function loadMap() {
|
|||||||
// Jesli nie ma informacji potrzebnej do mapy, zapisz wiadomosc do errora
|
// Jesli nie ma informacji potrzebnej do mapy, zapisz wiadomosc do errora
|
||||||
let errorMessage = "";
|
let errorMessage = "";
|
||||||
|
|
||||||
if(!clientStreet) errorMessage += `${<iai:variable vid="Wpisz ulicę i numer domu klienta"/>} <br>`;
|
if(!clientStreet){
|
||||||
if(!clientZipCode) errorMessage += `${<iai:variable vid="Podaj kod pocztowy adresu dostawy"/>} <br>`;
|
errorMessage += `${<iai:variable vid="Wpisz ulicę i numer domu klienta"/>} <br>`;
|
||||||
if(!clientCity) errorMessage += `${<iai:variable vid="Wpisz miasto odbiorcy przesyłki"/>}`;
|
addErrorMessage(document.getElementById("client_street"), <iai:variable vid="Wpisz ulicę i numer domu klienta"/>)
|
||||||
|
}
|
||||||
|
if(!clientZipCode){
|
||||||
|
errorMessage += `${<iai:variable vid="Podaj kod pocztowy adresu dostawy"/>} <br>`;
|
||||||
|
addErrorMessage(document.getElementById("client_zipcode"), <iai:variable vid="Podaj kod pocztowy adresu dostawy"/>)
|
||||||
|
}
|
||||||
|
if(!clientCity){
|
||||||
|
errorMessage += `${<iai:variable vid="Wpisz miasto odbiorcy przesyłki"/>}`;
|
||||||
|
addErrorMessage(document.getElementById("client_city"), <iai:variable vid="Wpisz miasto odbiorcy przesyłki"/>)
|
||||||
|
}
|
||||||
|
|
||||||
// Zablokuj wybranie mapy jak nie ma adresu
|
// Zablokuj wybranie mapy jak nie ma adresu
|
||||||
if(errorMessage !== ""){
|
if(errorMessage !== ""){
|
||||||
@@ -762,7 +771,7 @@ const SET_REGION = (setRegionInput) => JSON.stringify({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Zmiana regionu dostawy
|
// Zmiana regionu dostawy
|
||||||
async function changeRegion(payAndDelData = null, firstLoad = false) {
|
async function changeRegion(payAndDelData = null) {
|
||||||
// Pobranie informacji o regionie z formularza
|
// Pobranie informacji o regionie z formularza
|
||||||
const clientRegion = document.getElementById("client_region").value;
|
const clientRegion = document.getElementById("client_region").value;
|
||||||
const deliveryRegion = document.getElementById("deliver_to_billingaddr").checked ? document.getElementById("delivery_region").value : clientRegion;
|
const deliveryRegion = document.getElementById("deliver_to_billingaddr").checked ? document.getElementById("delivery_region").value : clientRegion;
|
||||||
@@ -780,11 +789,11 @@ async function changeRegion(payAndDelData = null, firstLoad = false) {
|
|||||||
if (status !== 'success') return alert("Błąd podczas zmiany kraju. Przeładuj stronę jeszcze raz.");
|
if (status !== 'success') return alert("Błąd podczas zmiany kraju. Przeładuj stronę jeszcze raz.");
|
||||||
|
|
||||||
// Pobranie nowych metod płatności i dostaw
|
// Pobranie nowych metod płatności i dostaw
|
||||||
getNewPaymentsAndDeliveries(payAndDelData, firstLoad);
|
getNewPaymentsAndDeliveries(payAndDelData);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Załadowanie metod dostaw i płatności
|
// Załadowanie metod dostaw i płatności
|
||||||
function getNewPaymentsAndDeliveries(data = null, firstLoad = false) {
|
function getNewPaymentsAndDeliveries(data = null) {
|
||||||
// Wyczyszczenie zapisanych poprzednich metod płatności
|
// Wyczyszczenie zapisanych poprzednich metod płatności
|
||||||
prevPayment = undefined;
|
prevPayment = undefined;
|
||||||
prevShipping = undefined;
|
prevShipping = undefined;
|
||||||
@@ -822,6 +831,10 @@ function getNewPaymentsAndDeliveries(data = null, firstLoad = false) {
|
|||||||
e.dvp.forEach(function (method) {
|
e.dvp.forEach(function (method) {
|
||||||
dvpMarkup += prepareDeliveryMarkup(method, deliveryId);
|
dvpMarkup += prepareDeliveryMarkup(method, deliveryId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Dane do zaznaczenia płatności i dostawy jeśli wcześniej na tej przeglądarce(localStorage) było już zamówienie
|
||||||
|
const prevOrderInfo = JSON.parse(localStorage.getItem("prevOrderInfo"));
|
||||||
|
console.log(prevOrderInfo);
|
||||||
|
|
||||||
// Wstawienie metod dostaw na strone
|
// Wstawienie metod dostaw na strone
|
||||||
const deliveryMarkup = `<div id="osc_order1"><div id="osc_order1_prepaid" style="${paymentValue === "cash" ? "display:none;" : "display:block;"}">${prepaidMarkup}</div><div id="osc_order1_dvp" style="${paymentValue === "cash" ? "display:block;" : "display:none;"}">${dvpMarkup}</div></div>`;
|
const deliveryMarkup = `<div id="osc_order1"><div id="osc_order1_prepaid" style="${paymentValue === "cash" ? "display:none;" : "display:block;"}">${prepaidMarkup}</div><div id="osc_order1_dvp" style="${paymentValue === "cash" ? "display:block;" : "display:none;"}">${dvpMarkup}</div></div>`;
|
||||||
@@ -931,8 +944,8 @@ const checkedPayment = paymentValue === method.id;
|
|||||||
if(!pointExists) selectedShipping.checked = false;
|
if(!pointExists) selectedShipping.checked = false;
|
||||||
});
|
});
|
||||||
}// Sprawdzenie czy użytkownik ma zapisane poprzednio użyte metody w przeglądarce(tylko przy pierwszym załadowaniu strony)
|
}// Sprawdzenie czy użytkownik ma zapisane poprzednio użyte metody w przeglądarce(tylko przy pierwszym załadowaniu strony)
|
||||||
else if(firstLoad && localStorage.getItem("prevCountry") && localStorage.getItem("prevCountry") === document.getElementById("client_region").value){
|
else if(firstTimeLoadPage && prevOrderInfo && prevOrderInfo?.prevCountry === document.getElementById("client_region").value){
|
||||||
const prevPaymentMethod = JSON.parse(localStorage.getItem("prevPaymentMethod"));
|
const prevPaymentMethod = prevOrderInfo.prevPaymentMethod;
|
||||||
|
|
||||||
// Zaznaczenie metod płatności które nie tworzą popupa
|
// Zaznaczenie metod płatności które nie tworzą popupa
|
||||||
if(prevPaymentMethod.id !== "payitem_2" && prevPaymentMethod.group !== "card" && prevPaymentMethod.group !== "transfer"){
|
if(prevPaymentMethod.id !== "payitem_2" && prevPaymentMethod.group !== "card" && prevPaymentMethod.group !== "transfer"){
|
||||||
@@ -944,7 +957,7 @@ const checkedPayment = paymentValue === method.id;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Poprzednia dostawa
|
// Poprzednia dostawa
|
||||||
const prevDeliveryMethod = JSON.parse(localStorage.getItem("prevDeliveryMethod"));
|
const prevDeliveryMethod = prevOrderInfo.prevDeliveryMethod;
|
||||||
const prevDeliveryInput = document.querySelector(`input#${prevDeliveryMethod.id}`);
|
const prevDeliveryInput = document.querySelector(`input#${prevDeliveryMethod.id}`);
|
||||||
|
|
||||||
// Sprawdzenie czy istnieje metoda dostawy (na wypadek gdyby była usunięta lub klient zamawiał do innego kraju)
|
// Sprawdzenie czy istnieje metoda dostawy (na wypadek gdyby była usunięta lub klient zamawiał do innego kraju)
|
||||||
@@ -982,6 +995,8 @@ const checkedPayment = paymentValue === method.id;
|
|||||||
if(firstInput) deliveryDate(firstInput.value, firstInput.dataset.delivery, firstInput.dataset.pickuppoint);
|
if(firstInput) deliveryDate(firstInput.value, firstInput.dataset.delivery, firstInput.dataset.pickuppoint);
|
||||||
calculateBasketCost();
|
calculateBasketCost();
|
||||||
app_shop.fn.ajaxLoadSite(0);
|
app_shop.fn.ajaxLoadSite(0);
|
||||||
|
|
||||||
|
firstTimeLoadPage = false;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -1874,9 +1889,13 @@ function sendOrder(data){
|
|||||||
} : false
|
} : false
|
||||||
};
|
};
|
||||||
|
|
||||||
localStorage.setItem("prevPaymentMethod", JSON.stringify(usedPaymentMethod));
|
const prevOrderInfo = {
|
||||||
localStorage.setItem("prevDeliveryMethod", JSON.stringify(usedDeliveryMethod));
|
prevPaymentMethod: usedPaymentMethod,
|
||||||
localStorage.setItem("prevCountry", usedCountry);
|
prevDeliveryMethod: usedDeliveryMethod,
|
||||||
|
prevCountry: usedCountry
|
||||||
|
}
|
||||||
|
|
||||||
|
localStorage.setItem("prevOrderInfo", JSON.stringify(prevOrderInfo));
|
||||||
|
|
||||||
// Przeniesienie na stonę informacji o zamóieniu
|
// Przeniesienie na stonę informacji o zamóieniu
|
||||||
window.location.href = e.location;
|
window.location.href = e.location;
|
||||||
@@ -2047,11 +2066,12 @@ async function fetchData(options = {}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let firstTimeLoadPage = true;
|
||||||
function initOSCOP(){
|
function initOSCOP(){
|
||||||
// Element z numerem edycji jeśli jest
|
// Element z numerem edycji jeśli jest
|
||||||
const editNumber = document.getElementById("edit-number");
|
const editNumber = document.getElementById("edit-number");
|
||||||
|
|
||||||
if(document.querySelector(".ajax_cop").childElementCount && !editNumber) changeRegion(null, true);
|
if(document.querySelector(".ajax_cop").childElementCount && !editNumber) changeRegion(null);
|
||||||
|
|
||||||
// Jeśli edycja zamówienia uzupełnij dane (niewiadomo jak z voucherem bo go się nie da edytować)
|
// Jeśli edycja zamówienia uzupełnij dane (niewiadomo jak z voucherem bo go się nie da edytować)
|
||||||
if(editNumber){
|
if(editNumber){
|
||||||
@@ -2135,6 +2155,7 @@ if(editNumber){
|
|||||||
|
|
||||||
// Pobranie danych o edytowanym zamówieniu
|
// Pobranie danych o edytowanym zamówieniu
|
||||||
async function getEditData(){
|
async function getEditData(){
|
||||||
|
|
||||||
const data = await fetchData({
|
const data = await fetchData({
|
||||||
data: ORDER_DETAILS(`OrderDetailsInput: {
|
data: ORDER_DETAILS(`OrderDetailsInput: {
|
||||||
orderNumber: ${editNumber.value},
|
orderNumber: ${editNumber.value},
|
||||||
@@ -2187,9 +2208,9 @@ if(editNumber){
|
|||||||
|
|
||||||
// Metody płatności i dostaw
|
// Metody płatności i dostaw
|
||||||
if(document.getElementById("delivery_region").value !== document.getElementById("client_region").value) changeRegion(orderData);
|
if(document.getElementById("delivery_region").value !== document.getElementById("client_region").value) changeRegion(orderData);
|
||||||
else getNewPaymentsAndDeliveries(orderData, true);
|
else getNewPaymentsAndDeliveries(orderData);
|
||||||
// Jeśli nie było dostawy na inny adres uzupełnij metody dostaw i płatności
|
// Jeśli nie było dostawy na inny adres uzupełnij metody dostaw i płatności
|
||||||
}else getNewPaymentsAndDeliveries(orderData, true);
|
}else getNewPaymentsAndDeliveries(orderData);
|
||||||
|
|
||||||
// Uzupełnienie uwag dla sklepu/kuriera
|
// Uzupełnienie uwag dla sklepu/kuriera
|
||||||
if(orderDetails.remarks){
|
if(orderDetails.remarks){
|
||||||
|
|||||||
10
script.js
10
script.js
@@ -1,9 +1,15 @@
|
|||||||
// Zmiana linku po anulowaniu zamówienia;
|
// Zmiana linku po anulowaniu zamówienia;
|
||||||
setTimeout(function() {
|
if(window.location.pathname.includes("return.html") && window.location.search.includes("ordercancel_ok")){
|
||||||
|
const returnButtonInterval = setInterval(function() {
|
||||||
const returnPage = document.querySelector(".return_page");
|
const returnPage = document.querySelector(".return_page");
|
||||||
const returnButton = document.querySelector("#retbut_ordercancel_ok");
|
const returnButton = document.querySelector("#retbut_ordercancel_ok");
|
||||||
|
|
||||||
if(returnPage && returnButton){
|
if(returnPage && returnButton){
|
||||||
returnButton.href = returnButton.href.replace("&order_number", "&order_number");
|
returnButton.href = returnButton.href.replace("&order_number", "&order_number");
|
||||||
|
clearInterval(returnButtonInterval);
|
||||||
}
|
}
|
||||||
}, 50);
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Przekierowanie ze strony order1 na OSCOP
|
||||||
|
if(window.location.pathname.includes("order1.html")) window.location = "/place-order.php";
|
||||||
@@ -51,6 +51,9 @@
|
|||||||
.has-feedback.--error .form-control{
|
.has-feedback.--error .form-control{
|
||||||
border-color: @less_iaicolorscheme_danger_color;
|
border-color: @less_iaicolorscheme_danger_color;
|
||||||
}
|
}
|
||||||
|
.has-feedback.--error.has-error .f-label{
|
||||||
|
color: @less_iaicolorscheme_danger_color;
|
||||||
|
}
|
||||||
// Zmiana fontsize na 16px na desktop
|
// Zmiana fontsize na 16px na desktop
|
||||||
.order__voucher_headlines strong, .order__voucher_button, #signin-form-ajax .signin_button, .delivery__address-list-firstname, .delivery__address-list-lastname, .osc_item-modal h2, .propose_title, #e-invoice_dialog .btn, #checkout_step2_2 h3, #summary-points, #fbs_z02_wrapper .big_label, .propose_main .button_password_recover, .rebate__title{
|
.order__voucher_headlines strong, .order__voucher_button, #signin-form-ajax .signin_button, .delivery__address-list-firstname, .delivery__address-list-lastname, .osc_item-modal h2, .propose_title, #e-invoice_dialog .btn, #checkout_step2_2 h3, #summary-points, #fbs_z02_wrapper .big_label, .propose_main .button_password_recover, .rebate__title{
|
||||||
font-size: 1.6rem!important;
|
font-size: 1.6rem!important;
|
||||||
|
|||||||
@@ -132,9 +132,18 @@ function loadMap() {
|
|||||||
// Jesli nie ma informacji potrzebnej do mapy, zapisz wiadomosc do errora
|
// Jesli nie ma informacji potrzebnej do mapy, zapisz wiadomosc do errora
|
||||||
let errorMessage = "";
|
let errorMessage = "";
|
||||||
|
|
||||||
if(!clientStreet) errorMessage += `${<iai:variable vid="Wpisz ulicę i numer domu klienta"/>} <br>`;
|
if(!clientStreet){
|
||||||
if(!clientZipCode) errorMessage += `${<iai:variable vid="Podaj kod pocztowy adresu dostawy"/>} <br>`;
|
errorMessage += `${<iai:variable vid="Wpisz ulicę i numer domu klienta"/>} <br>`;
|
||||||
if(!clientCity) errorMessage += `${<iai:variable vid="Wpisz miasto odbiorcy przesyłki"/>}`;
|
addErrorMessage(document.getElementById("client_street"), <iai:variable vid="Wpisz ulicę i numer domu klienta"/>)
|
||||||
|
}
|
||||||
|
if(!clientZipCode){
|
||||||
|
errorMessage += `${<iai:variable vid="Podaj kod pocztowy adresu dostawy"/>} <br>`;
|
||||||
|
addErrorMessage(document.getElementById("client_zipcode"), <iai:variable vid="Podaj kod pocztowy adresu dostawy"/>)
|
||||||
|
}
|
||||||
|
if(!clientCity){
|
||||||
|
errorMessage += `${<iai:variable vid="Wpisz miasto odbiorcy przesyłki"/>}`;
|
||||||
|
addErrorMessage(document.getElementById("client_city"), <iai:variable vid="Wpisz miasto odbiorcy przesyłki"/>)
|
||||||
|
}
|
||||||
|
|
||||||
// Zablokuj wybranie mapy jak nie ma adresu
|
// Zablokuj wybranie mapy jak nie ma adresu
|
||||||
if(errorMessage !== ""){
|
if(errorMessage !== ""){
|
||||||
@@ -758,7 +767,7 @@ const SET_REGION = (setRegionInput) => JSON.stringify({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Zmiana regionu dostawy
|
// Zmiana regionu dostawy
|
||||||
async function changeRegion(payAndDelData = null, firstLoad = false) {
|
async function changeRegion(payAndDelData = null) {
|
||||||
// Pobranie informacji o regionie z formularza
|
// Pobranie informacji o regionie z formularza
|
||||||
const clientRegion = document.getElementById("client_region").value;
|
const clientRegion = document.getElementById("client_region").value;
|
||||||
const deliveryRegion = document.getElementById("deliver_to_billingaddr").checked ? document.getElementById("delivery_region").value : clientRegion;
|
const deliveryRegion = document.getElementById("deliver_to_billingaddr").checked ? document.getElementById("delivery_region").value : clientRegion;
|
||||||
@@ -776,11 +785,11 @@ async function changeRegion(payAndDelData = null, firstLoad = false) {
|
|||||||
if (status !== 'success') return alert("Błąd podczas zmiany kraju. Przeładuj stronę jeszcze raz.");
|
if (status !== 'success') return alert("Błąd podczas zmiany kraju. Przeładuj stronę jeszcze raz.");
|
||||||
|
|
||||||
// Pobranie nowych metod płatności i dostaw
|
// Pobranie nowych metod płatności i dostaw
|
||||||
getNewPaymentsAndDeliveries(payAndDelData, firstLoad);
|
getNewPaymentsAndDeliveries(payAndDelData);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Załadowanie metod dostaw i płatności
|
// Załadowanie metod dostaw i płatności
|
||||||
function getNewPaymentsAndDeliveries(data = null, firstLoad = false) {
|
function getNewPaymentsAndDeliveries(data = null) {
|
||||||
// Wyczyszczenie zapisanych poprzednich metod płatności
|
// Wyczyszczenie zapisanych poprzednich metod płatności
|
||||||
prevPayment = undefined;
|
prevPayment = undefined;
|
||||||
prevShipping = undefined;
|
prevShipping = undefined;
|
||||||
@@ -819,6 +828,10 @@ function getNewPaymentsAndDeliveries(data = null, firstLoad = false) {
|
|||||||
dvpMarkup += prepareDeliveryMarkup(method, deliveryId);
|
dvpMarkup += prepareDeliveryMarkup(method, deliveryId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Dane do zaznaczenia płatności i dostawy jeśli wcześniej na tej przeglądarce(localStorage) było już zamówienie
|
||||||
|
const prevOrderInfo = JSON.parse(localStorage.getItem("prevOrderInfo"));
|
||||||
|
console.log(prevOrderInfo);
|
||||||
|
|
||||||
// Wstawienie metod dostaw na strone
|
// Wstawienie metod dostaw na strone
|
||||||
const deliveryMarkup = `<div id="osc_order1"><div id="osc_order1_prepaid" style="${paymentValue === "cash" ? "display:none;" : "display:block;"}">${prepaidMarkup}</div><div id="osc_order1_dvp" style="${paymentValue === "cash" ? "display:block;" : "display:none;"}">${dvpMarkup}</div></div>`;
|
const deliveryMarkup = `<div id="osc_order1"><div id="osc_order1_prepaid" style="${paymentValue === "cash" ? "display:none;" : "display:block;"}">${prepaidMarkup}</div><div id="osc_order1_dvp" style="${paymentValue === "cash" ? "display:block;" : "display:none;"}">${dvpMarkup}</div></div>`;
|
||||||
const previousDeliveries = document.getElementById("osc_order1");
|
const previousDeliveries = document.getElementById("osc_order1");
|
||||||
@@ -927,8 +940,8 @@ function getNewPaymentsAndDeliveries(data = null, firstLoad = false) {
|
|||||||
if(!pointExists) selectedShipping.checked = false;
|
if(!pointExists) selectedShipping.checked = false;
|
||||||
});
|
});
|
||||||
}// Sprawdzenie czy użytkownik ma zapisane poprzednio użyte metody w przeglądarce(tylko przy pierwszym załadowaniu strony)
|
}// Sprawdzenie czy użytkownik ma zapisane poprzednio użyte metody w przeglądarce(tylko przy pierwszym załadowaniu strony)
|
||||||
else if(firstLoad && localStorage.getItem("prevCountry") && localStorage.getItem("prevCountry") === document.getElementById("client_region").value){
|
else if(firstTimeLoadPage && prevOrderInfo && prevOrderInfo?.prevCountry === document.getElementById("client_region").value){
|
||||||
const prevPaymentMethod = JSON.parse(localStorage.getItem("prevPaymentMethod"));
|
const prevPaymentMethod = prevOrderInfo.prevPaymentMethod;
|
||||||
|
|
||||||
// Zaznaczenie metod płatności które nie tworzą popupa
|
// Zaznaczenie metod płatności które nie tworzą popupa
|
||||||
if(prevPaymentMethod.id !== "payitem_2" && prevPaymentMethod.group !== "card" && prevPaymentMethod.group !== "transfer"){
|
if(prevPaymentMethod.id !== "payitem_2" && prevPaymentMethod.group !== "card" && prevPaymentMethod.group !== "transfer"){
|
||||||
@@ -940,7 +953,7 @@ function getNewPaymentsAndDeliveries(data = null, firstLoad = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Poprzednia dostawa
|
// Poprzednia dostawa
|
||||||
const prevDeliveryMethod = JSON.parse(localStorage.getItem("prevDeliveryMethod"));
|
const prevDeliveryMethod = prevOrderInfo.prevDeliveryMethod;
|
||||||
const prevDeliveryInput = document.querySelector(`input#${prevDeliveryMethod.id}`);
|
const prevDeliveryInput = document.querySelector(`input#${prevDeliveryMethod.id}`);
|
||||||
|
|
||||||
// Sprawdzenie czy istnieje metoda dostawy (na wypadek gdyby była usunięta lub klient zamawiał do innego kraju)
|
// Sprawdzenie czy istnieje metoda dostawy (na wypadek gdyby była usunięta lub klient zamawiał do innego kraju)
|
||||||
@@ -978,6 +991,8 @@ function getNewPaymentsAndDeliveries(data = null, firstLoad = false) {
|
|||||||
if(firstInput) deliveryDate(firstInput.value, firstInput.dataset.delivery, firstInput.dataset.pickuppoint);
|
if(firstInput) deliveryDate(firstInput.value, firstInput.dataset.delivery, firstInput.dataset.pickuppoint);
|
||||||
calculateBasketCost();
|
calculateBasketCost();
|
||||||
app_shop.fn.ajaxLoadSite(0);
|
app_shop.fn.ajaxLoadSite(0);
|
||||||
|
|
||||||
|
firstTimeLoadPage = false;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -1870,9 +1885,13 @@ function sendOrder(data){
|
|||||||
} : false
|
} : false
|
||||||
};
|
};
|
||||||
|
|
||||||
localStorage.setItem("prevPaymentMethod", JSON.stringify(usedPaymentMethod));
|
const prevOrderInfo = {
|
||||||
localStorage.setItem("prevDeliveryMethod", JSON.stringify(usedDeliveryMethod));
|
prevPaymentMethod: usedPaymentMethod,
|
||||||
localStorage.setItem("prevCountry", usedCountry);
|
prevDeliveryMethod: usedDeliveryMethod,
|
||||||
|
prevCountry: usedCountry
|
||||||
|
}
|
||||||
|
|
||||||
|
localStorage.setItem("prevOrderInfo", JSON.stringify(prevOrderInfo));
|
||||||
|
|
||||||
// Przeniesienie na stonę informacji o zamóieniu
|
// Przeniesienie na stonę informacji o zamóieniu
|
||||||
window.location.href = e.location;
|
window.location.href = e.location;
|
||||||
@@ -2043,11 +2062,12 @@ async function fetchData(options = {}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let firstTimeLoadPage = true;
|
||||||
function initOSCOP(){
|
function initOSCOP(){
|
||||||
// Element z numerem edycji jeśli jest
|
// Element z numerem edycji jeśli jest
|
||||||
const editNumber = document.getElementById("edit-number");
|
const editNumber = document.getElementById("edit-number");
|
||||||
|
|
||||||
if(document.querySelector(".ajax_cop").childElementCount && !editNumber) changeRegion(null, true);
|
if(document.querySelector(".ajax_cop").childElementCount && !editNumber) changeRegion(null);
|
||||||
|
|
||||||
// Jeśli edycja zamówienia uzupełnij dane (niewiadomo jak z voucherem bo go się nie da edytować)
|
// Jeśli edycja zamówienia uzupełnij dane (niewiadomo jak z voucherem bo go się nie da edytować)
|
||||||
if(editNumber){
|
if(editNumber){
|
||||||
@@ -2131,6 +2151,7 @@ function initOSCOP(){
|
|||||||
|
|
||||||
// Pobranie danych o edytowanym zamówieniu
|
// Pobranie danych o edytowanym zamówieniu
|
||||||
async function getEditData(){
|
async function getEditData(){
|
||||||
|
|
||||||
const data = await fetchData({
|
const data = await fetchData({
|
||||||
data: ORDER_DETAILS(`OrderDetailsInput: {
|
data: ORDER_DETAILS(`OrderDetailsInput: {
|
||||||
orderNumber: ${editNumber.value},
|
orderNumber: ${editNumber.value},
|
||||||
@@ -2183,9 +2204,9 @@ function initOSCOP(){
|
|||||||
|
|
||||||
// Metody płatności i dostaw
|
// Metody płatności i dostaw
|
||||||
if(document.getElementById("delivery_region").value !== document.getElementById("client_region").value) changeRegion(orderData);
|
if(document.getElementById("delivery_region").value !== document.getElementById("client_region").value) changeRegion(orderData);
|
||||||
else getNewPaymentsAndDeliveries(orderData, true);
|
else getNewPaymentsAndDeliveries(orderData);
|
||||||
// Jeśli nie było dostawy na inny adres uzupełnij metody dostaw i płatności
|
// Jeśli nie było dostawy na inny adres uzupełnij metody dostaw i płatności
|
||||||
}else getNewPaymentsAndDeliveries(orderData, true);
|
}else getNewPaymentsAndDeliveries(orderData);
|
||||||
|
|
||||||
// Uzupełnienie uwag dla sklepu/kuriera
|
// Uzupełnienie uwag dla sklepu/kuriera
|
||||||
if(orderDetails.remarks){
|
if(orderDetails.remarks){
|
||||||
|
|||||||
Reference in New Issue
Block a user