Czyszczenie kodu i dodanie przytwierdzonego przycisku na spodzie na mobilce
This commit is contained in:
12
README.md
12
README.md
@@ -7,6 +7,8 @@ Pliki związane z OSCOP. Żeby działał trzeba stworzyć kopie jednego komponen
|
||||
4. style.css w Less/CSS
|
||||
5. Dodatkowo Trzeba będzie zrobić przekierowanie (można nawet dodatkiem) po kliknięciu na "Przejdź dalej" do strony "place-order.php"
|
||||
|
||||
W przypadku zamieszczania OSCOPa w panelu za pomocą COP trzeba najpierw szablon z OSCOPem opublikować na jakiś nieużywany język
|
||||
|
||||
## Punkty odbioru na jednej mapie ##
|
||||
### Ikony markera na mapie ###
|
||||
Aby dodać zdjęcie ikony: moderacja -> cms -> Zarządzanie plikami dla CMS. Żeby dodać nową ikonę trzeba dodać nowy obiekt w mapMarkerUrls. Można do tam wybrać link url do ikony, rozmiar, klasę. Póki co umieszczone:
|
||||
@@ -45,6 +47,11 @@ Znajdują się już podmienione w pliku wydzielonyScriptLiteraly.js. Trzeba się
|
||||
- Autouzupełnianie metod płatności i dostawy w edycji
|
||||
- Autouzupełnianie metod płatności i dostawy na podstawie poprzednio wykonanego zakupu(za pomocą localStorage, czyli tylko w obszarze jednej przeglądarki na jednym urządzeniu)
|
||||
|
||||
|
||||
|
||||
|
||||
- Przytwierdzony przycisk zakupowy
|
||||
|
||||
### Wady ###
|
||||
- Nie ma faktury na inne dane(żeby nie używać tego samego zapytania co OSCOP Idosella, żeby nie pobierało opłat)
|
||||
- próba edycji zamówienia jak jest edycja zamówienia na punkty może się wywalać(za mało punktów lojalnościowych)
|
||||
@@ -54,9 +61,10 @@ Znajdują się już podmienione w pliku wydzielonyScriptLiteraly.js. Trzeba się
|
||||
- Limit znaków | Wydłużanie się okienka od uwag do sklepu|kuriera
|
||||
- W przypadku punktów odbioru na jednej mapie, można zamienić metody dostawy wymagające punkty odbioru na jeden wspólny.
|
||||
- Przekreślona cena|Omnibus w wypadku gdy produkt jest w promocji
|
||||
- Przyklejony przycisk "Zamawiam i płacę" wraz z ceną i regulaminem
|
||||
- ApplePay na Iphone na górze reszta schowana
|
||||
- Klient wybierze inposta nie trzeba danych osobowych? domyślnie podaje kreseczki spigen.pl
|
||||
- Przytwierdzony przycisk zakupowy
|
||||
- Express Checkout dodatkiem co przenosi z wybranym towarem na OSCOPa
|
||||
|
||||
### Rozliczenie ###
|
||||
- Wersja lifetime
|
||||
@@ -70,3 +78,5 @@ Znajdują się już podmienione w pliku wydzielonyScriptLiteraly.js. Trzeba się
|
||||
- nie można wybierać hurtownika w place-order
|
||||
- Jak się klika Zamów bez rejestracji to jest faktura na inne dane. Schować?
|
||||
- BADANIE KONWERSJI PODCZAS WDROŻENIA DLA KLIENTÓW
|
||||
- W przypadku wdrożenia na stary szablon za pomocą COP sprawdź czy kolorystyka się zgadza bo czasami to wtedy się psuje
|
||||
- PROBLEM Z PRZEKIEROWANIEM!!!! - Przy nowszej wersji szablonu standardowego, przy przekierowaniu widać jeszcze przez chwilę poprzednią stronę. Dodatkowo kod w script.js związany z ładowaniem strony rozwala przekierowanie
|
||||
1918
index.xslt
1918
index.xslt
File diff suppressed because it is too large
Load Diff
351
mapy/oneMap.js
351
mapy/oneMap.js
@@ -37,7 +37,7 @@ const deliveryPickupPoints = [];
|
||||
let finpostjs = false;
|
||||
// Funkcja inicjująca mapę
|
||||
function loadMap() {
|
||||
var htmlContent = `
|
||||
const htmlContent = `
|
||||
<div id="fbs_z02_cover">
|
||||
<div id="fbs_z02_wrapper" class="dialog_fbs_z02">
|
||||
<a id="fbs_z02_close" href="#close"></a>
|
||||
@@ -113,10 +113,12 @@ function loadMap() {
|
||||
document.querySelector('.asideContainer_pickup').innerHTML = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Funkcja obsługująca dostawy z mapą
|
||||
function createEventsInpost(ITEM_ID) {
|
||||
var ITEM_FOR_MAP = '#item_' + ITEM_ID;
|
||||
var oscItem = document.querySelector(ITEM_FOR_MAP).closest('.osc_item');
|
||||
const ITEM_FOR_MAP = '#item_' + ITEM_ID;
|
||||
const oscItem = document.querySelector(ITEM_FOR_MAP).closest('.osc_item');
|
||||
|
||||
document.querySelector(ITEM_FOR_MAP).addEventListener('click', function (e) {
|
||||
const deliveryValue = ITEM_FOR_MAP.slice(1);
|
||||
@@ -129,18 +131,9 @@ function loadMap() {
|
||||
// Jesli nie ma informacji potrzebnej do mapy, zapisz wiadomosc do errora
|
||||
let errorMessage = "";
|
||||
|
||||
if(!clientStreet){
|
||||
errorMessage += `${<iai:variable vid="Wpisz ulicę i numer domu klienta"/>} <br>`;
|
||||
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"/>)
|
||||
}
|
||||
if(!clientStreet) errorMessage += addAddressErrorForMap("street");
|
||||
if(!clientZipCode) errorMessage += addAddressErrorForMap("zipcode");
|
||||
if(!clientCity) errorMessage += addAddressErrorForMap("city");
|
||||
|
||||
// Zablokuj wybranie mapy jak nie ma adresu
|
||||
if(errorMessage !== ""){
|
||||
@@ -170,7 +163,6 @@ function loadMap() {
|
||||
if(!suggestions) return;
|
||||
else suggestions.remove();
|
||||
});
|
||||
htmlContent = '';
|
||||
}
|
||||
|
||||
// Wstaw adres klienta
|
||||
@@ -249,6 +241,17 @@ function getAddressInfo(query){
|
||||
};
|
||||
return document.getElementById(`client_${query}`).value;
|
||||
}
|
||||
// Wiadomość errora, gdyby niebyło informacji adresowych przy otwieraniu mapy
|
||||
const addressErrorMessagesForMap = {
|
||||
"street": `${<iai:variable vid="Wpisz ulicę i numer domu klienta"/>}`,
|
||||
"zipcode": `${<iai:variable vid="Podaj kod pocztowy adresu dostawy"/>}`,
|
||||
"city": `${<iai:variable vid="Wpisz miasto odbiorcy przesyłki"/>}`,
|
||||
}
|
||||
function addAddressErrorForMap(query){
|
||||
addErrorMessage(document.getElementById(`client_${query}`), addressErrorMessagesForMap[query]);
|
||||
return `${addressErrorMessagesForMap[query]} <br>`;
|
||||
}
|
||||
|
||||
// Utworzenie informacji o punkcie odbioru
|
||||
function createPickuppointInfo(selectedPoint, deliveryPointId, name, streetText, cityText, zipcodeText, courierId){
|
||||
// Pokazanie elementu fselectedPoint
|
||||
@@ -298,10 +301,10 @@ function toggleMapList(e){
|
||||
|
||||
e.target.dataset.show = ifList ? "map" : "list";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// DANE KLIENTA
|
||||
|
||||
document.getElementById("cop_seection1").addEventListener("click", (e) => {
|
||||
document.getElementById("bm-oscop-section1").addEventListener("click", (e) => {
|
||||
// Pokazanie się okna od logowania
|
||||
if(e.target.classList.contains("get_signin")) showSigninModal();
|
||||
|
||||
@@ -314,11 +317,11 @@ document.getElementById("cop_seection1").addEventListener("click", (e) => {
|
||||
}
|
||||
|
||||
// Ukrycie/Pokazanie hasła
|
||||
if(e.target.id === "toggle_password") return togglePassword(e.target);
|
||||
if(e.target.id === "toggle-password") return togglePassword(e.target);
|
||||
|
||||
// Sprawdzenie czy kliknięcie było na firmę, czy na osobę prywatną
|
||||
if(e.target.id === "client_type1") return document.querySelectorAll("#cop_seection1 .firm-group").forEach(el => el.classList.add("--fade-in"));
|
||||
if(e.target.id === "client_type2") return document.querySelectorAll("#cop_seection1 .firm-group").forEach(el => el.classList.remove("--fade-in"));
|
||||
if(e.target.id === "client_type1") return document.querySelectorAll("#bm-oscop-section1 .firm-group").forEach(el => el.classList.add("--fade-in"));
|
||||
if(e.target.id === "client_type2") return document.querySelectorAll("#bm-oscop-section1 .firm-group").forEach(el => el.classList.remove("--fade-in"));
|
||||
|
||||
// Sprawdzenie czy dostawa na inny adres czy nie
|
||||
if(e.target.id === "deliver_to_billingaddr"){
|
||||
@@ -360,24 +363,24 @@ function togglePassword(el){
|
||||
// Pokaż popup logowania
|
||||
function showSigninModal(){
|
||||
app_shop.fn.signinModal = new Modal({
|
||||
element: $("#signin-form-ajax"),
|
||||
element: $("#signin-form"),
|
||||
classList: "--fade-in-modal",
|
||||
afterShow: ()=>{
|
||||
disablePageScroll();
|
||||
document.querySelector(".signin_login_input").addEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin_pass_input").addEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin-form__login").addEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin-form__pass").addEventListener("keydown", logInOnEnter);
|
||||
},
|
||||
beforeClose: ()=>{
|
||||
enablePageScroll();
|
||||
document.querySelector(".signin_login_input").removeEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin_pass_input").removeEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin-form__login").removeEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin-form__pass").removeEventListener("keydown", logInOnEnter);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Pokaż(true)/Schowaj(false) formularz dostawy na inny adres
|
||||
function showDeliveryForm(style){
|
||||
const deliveryWrapper = document.querySelector(".ajax_cop #client_new_additional .delivery_box.cn_wrapper");
|
||||
const deliveryWrapper = document.querySelector(".bm-oscop__container #client_new_additional .delivery_box.cn_wrapper");
|
||||
if((style && deliveryWrapper.classList.contains("--more")) || (!style && !deliveryWrapper.classList.contains("--more"))) return;
|
||||
|
||||
// Formularz dostawy na inny adres
|
||||
@@ -452,15 +455,15 @@ const SIGNIN = (signinInput) => JSON.stringify({
|
||||
});
|
||||
|
||||
function logInOnEnter(e){
|
||||
if(e.key==="Enter") logInToAccount(false)
|
||||
if(e.key === "Enter") logInToAccount(false)
|
||||
}
|
||||
const signinForm = document.querySelector(".signin-form_box_text form");
|
||||
const signinForm = document.querySelector(".signin-form__container form");
|
||||
if(signinForm) signinForm.addEventListener("submit", logInToAccount);
|
||||
|
||||
async function logInToAccount(event){
|
||||
if(event) event.preventDefault();
|
||||
const login = document.querySelector(".signin_login_input").value;
|
||||
const password = document.querySelector(".signin_pass_input").value;
|
||||
const login = document.querySelector(".signin-form__login").value;
|
||||
const password = document.querySelector(".signin-form__pass").value;
|
||||
const loginStatus = await fetchData({
|
||||
data: SIGNIN(`
|
||||
login: "${login.replace(/"/g, '\\"')}",
|
||||
@@ -497,7 +500,7 @@ function getClientNew(){
|
||||
success: function (e, a) {
|
||||
app_shop.fn.load(
|
||||
"place-order.php",
|
||||
[["#cop_seection1", "#cop_seection1"]],
|
||||
[["#bm-oscop-section1", "#bm-oscop-section1"]],
|
||||
function () {
|
||||
history.go(-1);
|
||||
},
|
||||
@@ -643,8 +646,8 @@ function handleShowSigninModalFromEmailModal(e){
|
||||
showSigninModal();
|
||||
}
|
||||
|
||||
// EventListener zmian w kontenerze cop_seection1
|
||||
document.getElementById("cop_seection1").addEventListener("change", (e) => {
|
||||
// EventListener zmian w kontenerze bm-oscop-section1
|
||||
document.getElementById("bm-oscop-section1").addEventListener("change", (e) => {
|
||||
const validateRequestId = ["client_zipcode", "delivery_zipcode", "client_nip", "client_email"];
|
||||
const notEmptyFieldsId = ["client_firstname", "client_lastname", "client_city", "delivery_firstname", "delivery_lastname", "delivery_city", "client_firm"];
|
||||
|
||||
@@ -662,17 +665,13 @@ const notEmptyFieldsId = ["client_firstname", "client_lastname", "client_city",
|
||||
|
||||
// Walidacja ulicy i numeru domu
|
||||
if(e.target.id === "client_street" || e.target.id === "delivery_street") validateStreet(e.target);
|
||||
|
||||
// Walidacja numeru telefonu
|
||||
if(e.target.id === "client_phone" || e.target.id === "delivery_phone") validatePhone(e.target);
|
||||
|
||||
// Walidacja loginu i hasła rejestracji
|
||||
if(e.target.classList.contains("register__login")) testLogin();
|
||||
if(e.target.classList.contains("register__password")) testPassword();
|
||||
|
||||
// Walidacja imienia nazwiska miasta i firmy(wymagające po prostu nie bycia pustym)
|
||||
if(notEmptyFieldsId.includes(e.target.id)) validateNotEmpty(e.target);
|
||||
|
||||
// Sprawdzenie czy firma w dostawie na inny adres została wpisana
|
||||
if(e.target.id === "delivery_additional"){
|
||||
if(e.target.value.length > 0) addSuccess(e.target);
|
||||
@@ -818,7 +817,7 @@ function getNewPaymentsAndDeliveries(data = null) {
|
||||
throwAjaxError(a);
|
||||
app_shop.fn.ajaxLoadSite(0);
|
||||
},
|
||||
success: function (e) {
|
||||
success: async function (e) {
|
||||
let prepaidMarkup = "";
|
||||
|
||||
// Stworzenie markupa dla metod dostaw
|
||||
@@ -834,13 +833,12 @@ function getNewPaymentsAndDeliveries(data = null) {
|
||||
|
||||
// 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
|
||||
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");
|
||||
if(previousDeliveries) previousDeliveries.remove();
|
||||
document.querySelector(".ajax_cop .step2_sub").insertAdjacentHTML("beforeend",deliveryMarkup);
|
||||
document.getElementById("bm-oscop-deliveries").insertAdjacentHTML("beforeend",deliveryMarkup);
|
||||
|
||||
// Stworzenie metod płatności
|
||||
let prepaidsMethodMarkup = "";
|
||||
@@ -878,7 +876,7 @@ const checkedPayment = paymentValue === method.id;
|
||||
ifPaymentCard = true;
|
||||
}
|
||||
else{
|
||||
prepaidsMethodMarkup += markup;
|
||||
prepaidsMethodMarkup += markup;
|
||||
// Okienko vouchera
|
||||
if(method.id === 2){
|
||||
prepaidsMethodMarkup += `
|
||||
@@ -904,8 +902,8 @@ const checkedPayment = paymentValue === method.id;
|
||||
}
|
||||
}
|
||||
});
|
||||
prepaidsTransferMarkup +="</div></div></label>";
|
||||
prepaidsCardMarkup +="</div></div></label>";
|
||||
prepaidsTransferMarkup += "</div></div></label>";
|
||||
prepaidsCardMarkup += "</div></div></label>";
|
||||
|
||||
// Dołączenie metody płatność przy odbiorze
|
||||
if(e.dvp.length) prepaidsMethodMarkup += `
|
||||
@@ -922,16 +920,22 @@ const checkedPayment = paymentValue === method.id;
|
||||
// Wstawienie metod płatności na stronę
|
||||
const previousPayments = document.getElementById("osc_prepaids_method");
|
||||
if(previousPayments) previousPayments.remove();
|
||||
document.querySelector(".ajax_cop #checkout_step3_1 .step3_sub").insertAdjacentHTML("beforeend", `<div id="osc_prepaids_method"> ${ifPaymentTransfer ? prepaidsTransferMarkup : ""}${ifPaymentCard ? prepaidsCardMarkup : ""}${prepaidsMethodMarkup}</div>`);
|
||||
document.getElementById("bm-oscop-payments").insertAdjacentHTML("beforeend", `<div id="osc_prepaids_method"> ${ifPaymentTransfer ? prepaidsTransferMarkup : ""}${ifPaymentCard ? prepaidsCardMarkup : ""}${prepaidsMethodMarkup}</div>`);
|
||||
|
||||
// Wstawienie błędu jeśli metody płatności są puste
|
||||
const currentPayments = document.getElementById("osc_prepaids_method");
|
||||
if(document.getElementById("osc_prepaids_method").innerHTML === "") currentPayments.insertAdjacentHTML("beforeend",'<div class="menu_messages_warning" id="menu_messages_warning"><div class="menu_messages_message_sub"><p>' + <iai:variable vid="Brak metod płatności"/> + <iai:variable vid="w celu uzyskania informacji jak skompletować zamówienie"/> + ', <a href="/contact.php">' + `${<iai:variable vid="skontaktuj się z nami"/>}` + "</a></p></div></div>");
|
||||
|
||||
|
||||
// Przygotowanie informacji o dostawie do obliczenia daty dostawy
|
||||
const deliveryDateInfo = {deliveryVal: null, delivery: null, pickuppoint: null};
|
||||
const firstInput = document.querySelector("#osc_order1 input");
|
||||
if(firstInput) changeDeliveryInfoObject(deliveryDateInfo, firstInput);
|
||||
|
||||
// Wstawienie pickuppoint jeśli edycja i istnieje
|
||||
if(data?.pickupData !== undefined && data?.pickupData !== null){
|
||||
const selectedShipping = document.querySelector(`#cop_seection2 input#${deliveryId}`);
|
||||
checkPrevPickupPoint(
|
||||
const selectedShipping = document.querySelector(`#bm-oscop-section2 input#${deliveryId}`);
|
||||
const pointExists = await checkPrevPickupPoint(
|
||||
selectedShipping.parentElement.querySelector(".fselectedPoint"),
|
||||
data.pickupData.id,
|
||||
data.pickupData.name,
|
||||
@@ -939,12 +943,13 @@ const checkedPayment = paymentValue === method.id;
|
||||
data.pickupData.address.city,
|
||||
data.pickupData.address.postcode,
|
||||
data.deliveryMethodId
|
||||
).then(pointExists=>{
|
||||
)
|
||||
// Odznaczenie punktu jeśli punkt odbioru nie istnieje(Wcześniej był zaznaczony przy edycji)
|
||||
if(!pointExists) selectedShipping.checked = false;
|
||||
});
|
||||
else changeDeliveryInfoObject(deliveryDateInfo, selectedShipping);
|
||||
}// Sprawdzenie czy użytkownik ma zapisane poprzednio użyte metody w przeglądarce(tylko przy pierwszym załadowaniu strony)
|
||||
else if(firstTimeLoadPage && prevOrderInfo && prevOrderInfo?.prevCountry === document.getElementById("client_region").value){
|
||||
// POPRZEDNIa PŁATNOSC
|
||||
const prevPaymentMethod = prevOrderInfo.prevPaymentMethod;
|
||||
|
||||
// Zaznaczenie metod płatności które nie tworzą popupa
|
||||
@@ -956,7 +961,7 @@ const checkedPayment = paymentValue === method.id;
|
||||
cloneElement(document.getElementById(paymentMethodId));
|
||||
}
|
||||
|
||||
// Poprzednia dostawa
|
||||
// POPRZEDNIA DOSTAWA
|
||||
const prevDeliveryMethod = prevOrderInfo.prevDeliveryMethod;
|
||||
const prevDeliveryInput = document.querySelector(`input#${prevDeliveryMethod.id}`);
|
||||
|
||||
@@ -964,7 +969,7 @@ const checkedPayment = paymentValue === method.id;
|
||||
if(prevDeliveryInput){
|
||||
// Sprawdzenie czy dostawa miała punkt odbioru
|
||||
if(prevDeliveryMethod.fselectedPoint){
|
||||
checkPrevPickupPoint(
|
||||
const pointExists = await checkPrevPickupPoint(
|
||||
prevDeliveryInput.parentElement.querySelector(".fselectedPoint"),
|
||||
prevDeliveryMethod.fselectedPoint.deliveryPointId,
|
||||
prevDeliveryMethod.fselectedPoint.name,
|
||||
@@ -972,12 +977,12 @@ const checkedPayment = paymentValue === method.id;
|
||||
prevDeliveryMethod.fselectedPoint.city,
|
||||
prevDeliveryMethod.fselectedPoint.zipcode,
|
||||
prevDeliveryMethod.fselectedPoint.courierId
|
||||
).then(pointExists=>{
|
||||
)
|
||||
if(pointExists) prevDeliveryInput.checked = true;
|
||||
});
|
||||
}else{
|
||||
prevDeliveryInput.checked = true;
|
||||
}
|
||||
changeDeliveryInfoObject(deliveryDateInfo, prevDeliveryInput);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -986,16 +991,17 @@ const checkedPayment = paymentValue === method.id;
|
||||
if(paymentValue && checkedPayment && (checkedPayment.dataset.group === "card" || checkedPayment.dataset.group === "transfer")){
|
||||
cloneElement(checkedPayment);
|
||||
}
|
||||
|
||||
// Przeładowanie mapy
|
||||
loadMap();
|
||||
|
||||
// Zmiana daty dostawy i pokazanych opcji dostawy
|
||||
if(deliveryDateInfo.deliveryVal && deliveryDateInfo.delivery && deliveryDateInfo.pickuppoint) calculateDeliveryDate(deliveryDateInfo.deliveryVal, deliveryDateInfo.delivery, deliveryDateInfo.pickuppoint);
|
||||
|
||||
// Przeliczenie kosztu dostawy
|
||||
calculateBasketCost();
|
||||
// Zmiana daty dostawy i pokazanych opcji dostawy
|
||||
const firstInput = document.getElementById("osc_order1 input");
|
||||
if(firstInput) deliveryDate(firstInput.value, firstInput.dataset.delivery, firstInput.dataset.pickuppoint);
|
||||
calculateBasketCost();
|
||||
|
||||
app_shop.fn.ajaxLoadSite(0);
|
||||
|
||||
firstTimeLoadPage = false;
|
||||
},
|
||||
});
|
||||
@@ -1104,10 +1110,10 @@ function checkPrevShipping(){
|
||||
// Przeliczenie kosztu i czasu dostawy i zapisanie nowej metody dostawy
|
||||
function changeCurrentShippingInfo(shippingMethod){
|
||||
calculateBasketCost();
|
||||
deliveryDate(shippingMethod.value, shippingMethod.dataset.delivery, shippingMethod.dataset.pickuppoint);
|
||||
calculateDeliveryDate(shippingMethod.value, shippingMethod.dataset.delivery, shippingMethod.dataset.pickuppoint);
|
||||
app_shop.vars.checkedShipping = shippingMethod.value;
|
||||
}
|
||||
document.getElementById("cop_seection2").addEventListener("click", e => {
|
||||
document.getElementById("bm-oscop-section2").addEventListener("click", e => {
|
||||
// Kliknięcie na dostawe
|
||||
if(e.target.name === "shipping"){
|
||||
// Wyczyszczenie wszystkich zaznaczonych punktów odbioru
|
||||
@@ -1183,7 +1189,7 @@ function removePrevClone(){
|
||||
const prevClone = document.querySelector(".osc_item-clone");
|
||||
if(!prevClone) return;
|
||||
const cloneGroupName = prevClone.querySelector("input").dataset.group;
|
||||
document.getElementById(`payitem_${cloneGroupName}`).closest(".osc_item").style.display="flex";
|
||||
document.getElementById(`payitem_${cloneGroupName}`).closest(".osc_item").style.display="grid";
|
||||
prevClone.remove();
|
||||
}
|
||||
|
||||
@@ -1244,7 +1250,7 @@ function changeDeliveryOptions(){
|
||||
if(document.getElementById("payitem_cash") && document.getElementById("payitem_cash").checked) changePrepaidDvp("none", "block");
|
||||
else changePrepaidDvp("block", "none");
|
||||
|
||||
document.querySelectorAll("#checkout_step2_1 input").forEach((el) => el.checked = false);
|
||||
document.querySelectorAll("#bm-oscop-deliveries input").forEach((el) => el.checked = false);
|
||||
app_shop.vars.checkedShipping = "";
|
||||
calculateBasketCost();
|
||||
}
|
||||
@@ -1319,10 +1325,11 @@ function calculateBasketCost() {
|
||||
const deliveryCostEl = document.querySelector("#order2_shipping_value .operation_value");
|
||||
const productsPointsEl = document.querySelector("#order2_products_points .operation_value");
|
||||
const summaryPointsEl = document.getElementById("summary-points");
|
||||
const attatchedSummaryPointsEl = document.getElementById("attatched-points");
|
||||
// Przygotowanie informacji o metodzie dostawy i platnosci
|
||||
const orderInfo = {
|
||||
delivery: document.querySelector('.ajax_cop input[name="shipping"]:checked') ? document.querySelector('.ajax_cop input[name="shipping"]:checked').value : "0-1",
|
||||
payform_id: document.querySelector('.ajax_cop input[name="payform_id"]:checked') ? document.querySelector('.ajax_cop input[name="payform_id"]:checked').value : "cash"
|
||||
delivery: document.querySelector('.bm-oscop__container input[name="shipping"]:checked') ? document.querySelector('.bm-oscop__container input[name="shipping"]:checked').value : "0-1",
|
||||
payform_id: document.querySelector('.bm-oscop__container input[name="payform_id"]:checked') ? document.querySelector('.bm-oscop__container input[name="payform_id"]:checked').value : "cash"
|
||||
}
|
||||
xhrs && 4 != xhrs.readyState && 0 != xhrs.readyState && xhrs.abort(),
|
||||
xhrs = $.ajax({
|
||||
@@ -1358,13 +1365,17 @@ const summaryPointsEl = document.getElementById("summary-points");
|
||||
productsPointsEl.parentElement.style.display = "flex";
|
||||
summaryPointsEl.innerHTML = `+ ${t.products_worth_at_points} ${<iai:variable vid="pkt"/>}.`;
|
||||
summaryPointsEl.style.display = "block";
|
||||
attatchedSummaryPointsEl.innerHTML = `+ ${t.products_worth_at_points} ${<iai:variable vid="pkt"/>}.`;
|
||||
attatchedSummaryPointsEl.style.display = "block";
|
||||
}else {
|
||||
productsPointsEl.parentElement.style.display = "none";
|
||||
summaryPointsEl.style.display = "none";
|
||||
attatchedSummaryPointsEl.style.display = "none";
|
||||
}
|
||||
|
||||
// Cena całkowita
|
||||
document.getElementById("summary-cost").innerHTML = formatPrice(t.total_to_pay, t.currency_sign) + "<small>" + <iai:variable vid="brutto"/> + "</small>";
|
||||
document.getElementById("attatched-cost").innerHTML = formatPrice(t.total_to_pay, t.currency_sign);
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -1382,25 +1393,48 @@ function formatPrice(price, currencySign) {
|
||||
};
|
||||
|
||||
// Funkcja od ustalenia daty dostawy
|
||||
function deliveryDate(deliveryVal, delivery, pickuppoint) {
|
||||
function calculateDeliveryDate(deliveryVal, delivery, pickuppoint) {
|
||||
const deliveryMessageEl = document.querySelector("#order2_shiptime span:not(.operation_value)");
|
||||
const attatchedMessageEl = document.querySelector("#attatched-shiptime span:not(.operation_value)");
|
||||
const deliveryDateEl = document.querySelector("#order2_shiptime .operation_value");
|
||||
const attatchedDateEl = document.querySelector("#attatched-shiptime .operation_value");
|
||||
const date = delivery.split("#");
|
||||
|
||||
// Wybranie nazwy zaleznie czy dostawa jest do twojego mieszkania czy nie
|
||||
if(deliveryVal === "0-0" || deliveryVal === "0-1" || pickuppoint === "y") deliveryMessageEl.innerHTML = `${<iai:variable vid="Odbiór zamówienia możliwy"/>}:`;
|
||||
else deliveryMessageEl.innerHTML = `${<iai:variable vid="Przesyłka powinna być u Ciebie"/>}:`;
|
||||
if(deliveryVal === "0-0" || deliveryVal === "0-1" || pickuppoint === "y"){
|
||||
deliveryMessageEl.innerHTML = `${<iai:variable vid="Odbiór zamówienia możliwy"/>}:`;
|
||||
attatchedMessageEl.innerHTML = `${<iai:variable vid="Odbiór zamówienia możliwy"/>}:`;
|
||||
}
|
||||
else{
|
||||
deliveryMessageEl.innerHTML = `${<iai:variable vid="Przesyłka powinna być u Ciebie"/>}:`;
|
||||
attatchedMessageEl.innerHTML = `${<iai:variable vid="Przesyłka powinna być u Ciebie"/>}:`;
|
||||
}
|
||||
|
||||
if(date[4]>0) deliveryDateEl.innerHTML = `${<iai:variable vid="za"/>} ` + parseInt(date[5]) + ` ${<iai:variable vid="dni"/>} `;
|
||||
if(date[4]>0) {
|
||||
deliveryDateEl.innerHTML = `${<iai:variable vid="za"/>} ` + parseInt(date[5]) + ` ${<iai:variable vid="dni"/>} `;
|
||||
attatchedDateEl.innerHTML = `${<iai:variable vid="za"/>} ` + parseInt(date[5]) + ` ${<iai:variable vid="dni"/>} `;
|
||||
}
|
||||
else{
|
||||
if(parseInt(date[5]) === 0) deliveryDateEl.innerHTML = <iai:variable vid="Dzisiaj"/>;
|
||||
else deliveryDateEl.innerHTML = orderTxt[`shipping${parseInt(date[3])}`];
|
||||
if(parseInt(date[5]) === 0){
|
||||
deliveryDateEl.innerHTML = <iai:variable vid="Dzisiaj"/>;
|
||||
attatchedDateEl.innerHTML = <iai:variable vid="Dzisiaj"/>;
|
||||
}
|
||||
else{
|
||||
deliveryDateEl.innerHTML = orderTxt[`shipping${parseInt(date[3])}`];
|
||||
attatchedDateEl.innerHTML = orderTxt[`shipping${parseInt(date[3])}`];
|
||||
}
|
||||
}
|
||||
};
|
||||
// Zmiana informacji o dostawie
|
||||
function changeDeliveryInfoObject(deliveryObject, deliveryElement){
|
||||
deliveryObject.deliveryVal = deliveryElement.value;
|
||||
deliveryObject.delivery = deliveryElement.dataset.delivery;
|
||||
deliveryObject.pickuppoint = deliveryElement.dataset.pickuppoint;
|
||||
}
|
||||
|
||||
// Obsługa klilnięć na elementy w podsumowaniu
|
||||
document.getElementById("cop_seection3").addEventListener("click", (e) => {
|
||||
const productsContainer = document.getElementById("checkout_step3_3");
|
||||
document.getElementById("bm-oscop-section3").addEventListener("click", (e) => {
|
||||
const productsContainer = document.querySelector(".summary__container");
|
||||
|
||||
// Kliknięcie na przyciski "Pokaż pozozostałe produkty" i "Zwiń listę"
|
||||
const togggleProducts = e.target.closest(".order_products_action");
|
||||
@@ -1412,40 +1446,98 @@ const productsContainer = document.getElementById("checkout_step3_3");
|
||||
productsContainer.classList.add("--more");
|
||||
togggleProducts.querySelector("span").innerHTML = `${<iai:variable vid="Zwiń listę"/>}`;
|
||||
}
|
||||
checkIfShowAttatched();
|
||||
return;
|
||||
}
|
||||
|
||||
// Kliknięcie na checkbox(nie zaznacz wszystkie i nie kod rabatowy)
|
||||
if(e.target.type === "checkbox" && e.target.id !== "checkall-terms" && e.target.id !== "rebate_option"){
|
||||
if(e.target.type === "checkbox" && e.target.id !== "checkall-terms" && e.target.id !== "rebate-option"){
|
||||
document.querySelector(".bm-oscop__attatched-checkbox").classList.remove("--error");
|
||||
|
||||
const checkboxAllTerms = document.getElementById("checkall-terms");
|
||||
if(e.target.checked === false) checkboxAllTerms.checked = false;
|
||||
const attatchedcheckboxAllTerms = document.getElementById("attatched-checkall-terms");
|
||||
if(e.target.checked === false) {
|
||||
checkboxAllTerms.checked = false;
|
||||
attatchedcheckboxAllTerms.checked = false;
|
||||
// usuniecie bledu jesli jest na przyczepionym przycisku zakupowym
|
||||
document.querySelector(".bm-oscop__attatched-checkbox").classList.remove("--error");
|
||||
}
|
||||
else{
|
||||
const termsInputs = document.querySelectorAll(".order2_terms_wrapper input:not(#checkall-terms)");
|
||||
let checkedCount = 0;
|
||||
termsInputs.forEach(el => el.checked === true ? checkedCount++ : "");
|
||||
if(checkedCount === termsInputs.length) checkboxAllTerms.checked = true;
|
||||
if(checkedCount === termsInputs.length) {
|
||||
checkboxAllTerms.checked = true;
|
||||
attatchedcheckboxAllTerms.checked = true;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Kliknięcie na przycisk "Zaznacz wszystkie"
|
||||
if(e.target.id === "checkall-terms"){
|
||||
const termsInputs = document.querySelectorAll(".order2_terms_wrapper input:not(#checkall-terms)");
|
||||
let checkAll = false;
|
||||
|
||||
termsInputs.forEach(el => el.checked === false ? checkAll = true : "");
|
||||
termsInputs.forEach(function (el) {
|
||||
if(checkAll) el.checked = true;
|
||||
else el.checked = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(e.target.id === "checkall-terms") return toggleAllTerms();
|
||||
|
||||
// Usuń error na regulaminie
|
||||
if(e.target.id === "order2_terms_conditions" || e.target.id === "order2_cancel"){
|
||||
e.target.parentElement.querySelector("span").classList.remove("text-danger");
|
||||
e.target.parentElement.querySelector("a").classList.remove("text-danger");
|
||||
}
|
||||
})
|
||||
});
|
||||
function toggleAllTerms(){
|
||||
removeErrorOnTerms();
|
||||
|
||||
const termsInputs = document.querySelectorAll(".order2_terms_wrapper input:not(#checkall-terms)");
|
||||
let checkAll = false;
|
||||
|
||||
termsInputs.forEach(el => el.checked === false ? checkAll = true : "");
|
||||
termsInputs.forEach(function (el) {
|
||||
el.checked = checkAll;
|
||||
});
|
||||
|
||||
document.getElementById("checkall-terms").checked = checkAll;
|
||||
document.getElementById("attatched-checkall-terms").checked = checkAll;
|
||||
}
|
||||
|
||||
function removeErrorOnTerms(){
|
||||
document.querySelector(".bm-oscop__attatched-checkbox").classList.remove("--error");
|
||||
document.querySelector(".order2_terms_conditions span").classList.remove("text-danger");
|
||||
document.querySelector(".order2_terms_conditions a").classList.remove("text-danger");
|
||||
document.querySelector(".order2_cancel span").classList.remove("text-danger");
|
||||
document.querySelector(".order2_cancel a").classList.remove("text-danger");
|
||||
}
|
||||
|
||||
// PRZYCISK ZAKUPU PRZYTWIERDZONY NA DÓŁ STRONY
|
||||
function checkIfShowAttatched(){
|
||||
const attatchedEl = document.querySelector("#attatched-summary .bm-oscop__attatched-container");
|
||||
const summaryCheckAllPos = document.getElementById("checkall-terms").getBoundingClientRect();
|
||||
// Sprawdzenie czy pokazać przytwierdzony przycisk do zakupu
|
||||
|
||||
if(summaryCheckAllPos.top >= window.innerHeight - attatchedEl.offsetHeight){
|
||||
attatchedEl.style.opacity = "1";
|
||||
attatchedEl.closest("#attatched-summary").style.zIndex = "30";
|
||||
}
|
||||
else{
|
||||
attatchedEl.style.opacity = "0";
|
||||
attatchedEl.closest("#attatched-summary").style.zIndex = "-1";
|
||||
}
|
||||
|
||||
// Sprawdzenie czy pokazywać cenę
|
||||
const summaryEl = document.querySelector(".order2_summary");
|
||||
|
||||
// Przeliczana wysokość elementu przytwierdzonego przycisku zakupu na wypadek gdyby cena miała display: none
|
||||
const attatchedElHeight = attatchedEl.querySelector(".bm-oscop__attatched-price").style.display === "none" ? (summaryEl.offsetHeight + attatchedEl.offsetHeight) : attatchedEl.offsetHeight
|
||||
|
||||
if(summaryEl.getBoundingClientRect().top >= window.innerHeight - attatchedElHeight){
|
||||
attatchedEl.querySelector(".bm-oscop__attatched-price").style.display = "block";
|
||||
}else{
|
||||
attatchedEl.querySelector(".bm-oscop__attatched-price").style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("scroll", e=>{
|
||||
checkIfShowAttatched()
|
||||
});
|
||||
document.getElementById("attatched-checkall-terms").addEventListener("click", toggleAllTerms);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// KOD RABATOWY (funkcje)
|
||||
@@ -1475,7 +1567,7 @@ const DEACTIVATE_REBATE_CODE = () => JSON.stringify({
|
||||
})
|
||||
|
||||
// Aktywacja kodu rabatowego
|
||||
const rebateCode = document.getElementById("rebate_code");
|
||||
const rebateCode = document.getElementById("rebate-code");
|
||||
async function updateCode(){
|
||||
if(rebateCode.value.trim() === ""){
|
||||
addError(rebateCode);
|
||||
@@ -1546,7 +1638,7 @@ const activeCodeEl = document.getElementById("active-code");
|
||||
// Zmień wartości
|
||||
activeCodeEl.innerHTML = show ? rebateCode.value : "";
|
||||
showInput = error ? true : false;
|
||||
document.getElementById("rebate_option").checked = error ? true : false;
|
||||
document.getElementById("rebate-option").checked = error ? true : false;
|
||||
if(!error) rebateCode.value = "";
|
||||
else activeCodeEl.innerHTML = "";
|
||||
}
|
||||
@@ -1555,7 +1647,7 @@ const activeCodeEl = document.getElementById("active-code");
|
||||
let showInput = false;
|
||||
document.querySelector(".rebate").addEventListener("click", (e) => {
|
||||
// Rozwinięcie opcji rabatowej
|
||||
if(e.target.id === "rebate_option" || e.target.classList.contains("rebate__active_change")){
|
||||
if(e.target.id === "rebate-option" || e.target.classList.contains("rebate__active-change")){
|
||||
showInput = !showInput;
|
||||
if(showInput) rebateCodeContainer.classList.add("--fade-in");
|
||||
else rebateCodeContainer.classList.remove("--fade-in");
|
||||
@@ -1563,7 +1655,7 @@ document.querySelector(".rebate").addEventListener("click", (e) => {
|
||||
|
||||
// Kliknięcie na zrealizuj i dezaktywuj
|
||||
if(e.target.className.includes("rebate__code-realize")) updateCode();
|
||||
if(e.target.classList.contains("rebate__active_remove")) removeCode();
|
||||
if(e.target.classList.contains("rebate__active-remove")) removeCode();
|
||||
});
|
||||
|
||||
|
||||
@@ -1617,19 +1709,23 @@ async function validateFormInputs(query){
|
||||
}
|
||||
|
||||
// Obsługa złożenia zamówienia
|
||||
document.querySelector(".order2_button_order").addEventListener("click", async () => {
|
||||
document.querySelectorAll(".order2_button_order").forEach(btnEl=>{
|
||||
btnEl.addEventListener("click", handleBuyOnClick);
|
||||
})
|
||||
|
||||
async function handleBuyOnClick(){
|
||||
const termsConditionsInput = document.getElementById("order2_terms_conditions");
|
||||
const cancelConditionsInput = document.getElementById("order2_cancel");
|
||||
try {
|
||||
app_shop.fn.ajaxLoadSite(1);
|
||||
app_shop.vars.validation = 1;
|
||||
// Sprawdzenie pól formularza
|
||||
const x = await validateAllInputs();
|
||||
if(x === false) app_shop.vars.validation = 0;
|
||||
const allInputsCorrectlyValidated = await validateAllInputs();
|
||||
if(allInputsCorrectlyValidated === false) app_shop.vars.validation = 0;
|
||||
|
||||
// Znalezienie obecnie zaznaczonej metody dostawy i płatności
|
||||
const deliveryMethod = document.querySelector(".ajax_cop [name=shipping]:checked");
|
||||
const paymentMethod = document.querySelector(".ajax_cop [name=payform_id]:checked");
|
||||
const deliveryMethod = document.querySelector(".bm-oscop__container [name=shipping]:checked");
|
||||
const paymentMethod = document.querySelector(".bm-oscop__container [name=payform_id]:checked");
|
||||
|
||||
// Sprawdzenie czy użytkownik zaakceptował regulamin
|
||||
if(!termsConditionsInput.checked || !cancelConditionsInput.checked){
|
||||
@@ -1665,25 +1761,29 @@ const cancelConditionsInput = document.getElementById("order2_cancel");
|
||||
let alertMessage = "";
|
||||
|
||||
// Element sprawdzający czy regulamin jest zaznaczony
|
||||
let termsAndConditions = termsConditionsInput.checked && cancelConditionsInput.checked;
|
||||
if(!termsAndConditions) alertMessage += `${<iai:variable vid="Zatwierdź"/>} ${<iai:variable vid="Regulamin"/>}!<br/>`;
|
||||
const termsAndConditions = termsConditionsInput.checked && cancelConditionsInput.checked;
|
||||
if(!termsAndConditions){
|
||||
document.querySelector(".bm-oscop__attatched-checkbox").classList.add("--error");
|
||||
alertMessage += `${<iai:variable vid="Zatwierdź"/>} ${<iai:variable vid="Regulamin"/>}!<br/>`;
|
||||
}
|
||||
// Sprawdź metodę płatności i dostawy(scrollowanie do formularza ważniejsze)
|
||||
if(!document.querySelector(`input[name="shipping"]:checked`)){
|
||||
scrolledToElement = errorEl || document.querySelector("#bm-oscop-deliveries h2");
|
||||
alertMessage += `${<iai:variable vid="Proszę wybrać dostępną metodę dostawy"/>}<br/>`;
|
||||
}
|
||||
if(!document.querySelector(`input[name="payform_id"]:checked`)){
|
||||
scrolledToElement = errorEl || document.querySelector("#bm-oscop-payments h2");
|
||||
alertMessage += `${<iai:variable vid="Proszę wybrać metodę płatności"/>}<br/>`;
|
||||
}
|
||||
// Błąd w formularzu
|
||||
if(errorEl){
|
||||
scrolledToElement = errorEl;
|
||||
alertMessage += `${<iai:variable vid="W formularzu wystąpiły błędy"/>}<br/>`;
|
||||
}// Sprawdź metodę płatności i dostawy(scrollowanie do formularza ważniejsze)
|
||||
if(!document.querySelector(`input[name="payform_id"]:checked`)){
|
||||
scrolledToElement = errorEl || document.querySelector("#checkout_step3_1 h2");
|
||||
alertMessage += `${<iai:variable vid="Proszę wybrać metodę płatności"/>}<br/>`;
|
||||
}
|
||||
if(!document.querySelector(`input[name="shipping"]:checked`)){
|
||||
scrolledToElement = errorEl || document.querySelector("#checkout_step2_1 h2");
|
||||
alertMessage += `${<iai:variable vid="Proszę wybrać dostępną metodę dostawy"/>}`;
|
||||
|
||||
alertMessage += `${<iai:variable vid="W formularzu wystąpiły błędy"/>}`;
|
||||
}
|
||||
|
||||
// Jeśli użytkownik zatwierdził regulamin, przescrolluj do elementu z błędem
|
||||
if(termsAndConditions) scrollToHeight(scrolledToElement);
|
||||
if(scrolledToElement) scrollToHeight(scrolledToElement);
|
||||
|
||||
|
||||
// Pokaż error i przerwij składanie zamówienia
|
||||
Alertek.show_alert(alertMessage);
|
||||
@@ -1702,13 +1802,15 @@ const cancelConditionsInput = document.getElementById("order2_cancel");
|
||||
console.log(e);
|
||||
alert("blad");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Przescrolluj do
|
||||
function scrollToHeight(scrollToEl){
|
||||
let yOffset = -45;
|
||||
if(app_shop.vars.view === 1) yOffset = -100;
|
||||
if(app_shop.vars.view === 2) yOffset = -75;
|
||||
const y = scrollToEl.getBoundingClientRect().top + window.pageYOffset + yOffset;
|
||||
|
||||
window.scrollTo({top: y, behavior: 'smooth'});
|
||||
}
|
||||
|
||||
@@ -1724,7 +1826,7 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
// Weź dane klienta
|
||||
const email = document.getElementById("client_email").value;
|
||||
const phone = document.getElementById("client_phone").value;
|
||||
const clientType = document.querySelector('.ajax_cop [name="client_type"]:checked').value;
|
||||
const clientType = document.querySelector('.bm-oscop__container [name="client_type"]:checked').value;
|
||||
const firmname = clientType === "firm" ? document.getElementById("client_firm").value : "";
|
||||
const nip = clientType === "firm" ? document.getElementById("client_nip").value : "";
|
||||
let firstname = document.getElementById("client_firstname").value;
|
||||
@@ -1757,7 +1859,7 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
else rebateCode = "";
|
||||
|
||||
let voucherCode;
|
||||
if(document.querySelector(".ajax_cop #payitem_2") && document.querySelector(".ajax_cop #payitem_2").checked) voucherCode = document.querySelector(".ajax_cop #order_voucher_id").value;
|
||||
if(document.querySelector(".bm-oscop__container #payitem_2") && document.querySelector(".bm-oscop__container #payitem_2").checked) voucherCode = document.querySelector(".bm-oscop__container #order_voucher_id").value;
|
||||
|
||||
// Jeśli zalogowany użytkownik jest firmą i nie ma imienia i nazwiska
|
||||
if (clientType.disabled && clientType.value === "firm") {
|
||||
@@ -1770,8 +1872,8 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
lastname = lastname.replace(/[&\/\\#,+()$~%.'":*?<>{}!@~`^_]/g, "");
|
||||
|
||||
// Dodatkowe informacje (uwagi, faktura, punkt odbioru)
|
||||
const shopRemarks = document.getElementById("shop_remarks").checked ? document.querySelector(".ajax_cop [name=remarks]").value : "";
|
||||
const deliveryRemarks = document.getElementById("courier_remarks").checked ? document.querySelector(".ajax_cop [name=deliverer_remarks]").value : "";
|
||||
const shopRemarks = document.getElementById("shop_remarks").checked ? document.querySelector(".bm-oscop__container [name=remarks]").value : "";
|
||||
const deliveryRemarks = document.getElementById("courier_remarks").checked ? document.querySelector(".bm-oscop__container [name=deliverer_remarks]").value : "";
|
||||
|
||||
const invoiceOption = document.querySelector("input[name=invoice]:checked").value;
|
||||
const pickuppoint = document.querySelector("#osc_order1 input:checked").dataset.pickuppoint === "y" ? document.querySelector("#osc_order1 input:checked").parentElement.querySelector("label [name=pickup_point]").value : "";
|
||||
@@ -1847,7 +1949,7 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
}
|
||||
|
||||
function checkNewsletter(logged, regular){
|
||||
if(document.querySelector(`.ajax_cop [name=${logged}]`)) return document.querySelector(`.ajax_cop [name=${logged}]`).value ? 1 : 0;
|
||||
if(document.querySelector(`.bm-oscop__container [name=${logged}]`)) return document.querySelector(`.bm-oscop__container [name=${logged}]`).value ? 1 : 0;
|
||||
else if(document.querySelector(regular)) return document.querySelector(regular).checked ? 1 : 0;
|
||||
else return 0;
|
||||
}
|
||||
@@ -2015,13 +2117,13 @@ function enablePageScroll(){
|
||||
app_shop.fn.load = function(_url,target,callback,paramets) {
|
||||
if(app_shop.vars.xhr && app_shop.vars.xhr.readystate != 4) app_shop.vars.xhr.abort();
|
||||
$(target).addClass('load-content');
|
||||
for(var i=0; target.length > i ; i++) $(target[i][0]).addClass('load-content');
|
||||
for(let i=0; target.length > i ; i++) $(target[i][0]).addClass('load-content');
|
||||
|
||||
app_shop.vars.xhr = $.ajax({
|
||||
url: _url+paramets,
|
||||
timeout: 16000,
|
||||
success: function(data,textStatus) {
|
||||
for(var i=0; target.length > i ; i++) $(target[i][0]).removeClass('load-content').html($(data).find(target[i][1]).html());
|
||||
for(let i=0; target.length > i ; i++) $(target[i][0]).removeClass('load-content').html($(data).find(target[i][1]).html());
|
||||
app_shop.fn.change_url(_url);
|
||||
app_shop.fn.evalJSFromHtml(data);
|
||||
if(callback) callback();
|
||||
@@ -2036,12 +2138,7 @@ function throwAjaxError(e) {
|
||||
-1 !== $.inArray(e, ["nocontent", "error", "timeout", "abort", "parsererror"]) && (console.log("Error:" + e), Alertek.show_alert( "Błąd podczas logowania, proszę spróbować ponownie" + " (" + e + ": " + $.now() + ")"), $.cookie("off_opc", !0));
|
||||
};
|
||||
async function fetchData(options = {}) {
|
||||
const {
|
||||
data,
|
||||
link,
|
||||
linkParameter = '',
|
||||
alert = true
|
||||
} = options;
|
||||
const {data,link,linkParameter = '',alert = true} = options;
|
||||
if (!data) return false;
|
||||
try {
|
||||
const response = await fetch(`${link || app_shop.urls.graphql || '/graphql/v1/'}${linkParameter}`, {
|
||||
@@ -2074,7 +2171,7 @@ function initOSCOP(){
|
||||
// Element z numerem edycji jeśli jest
|
||||
const editNumber = document.getElementById("edit-number");
|
||||
|
||||
if(document.querySelector(".ajax_cop").childElementCount && !editNumber) changeRegion(null);
|
||||
if(document.querySelector(".bm-oscop__container").childElementCount && !editNumber) changeRegion(null);
|
||||
|
||||
// Jeśli edycja zamówienia uzupełnij dane (niewiadomo jak z voucherem bo go się nie da edytować)
|
||||
if(editNumber){
|
||||
@@ -2158,7 +2255,6 @@ if(editNumber){
|
||||
|
||||
// Pobranie danych o edytowanym zamówieniu
|
||||
async function getEditData(){
|
||||
|
||||
const data = await fetchData({
|
||||
data: ORDER_DETAILS(`OrderDetailsInput: {
|
||||
orderNumber: ${editNumber.value},
|
||||
@@ -2194,7 +2290,7 @@ if(editNumber){
|
||||
if(differentDelivery){
|
||||
// Pokazanie formularza dodatkowej dostawy
|
||||
document.getElementById("deliver_to_billingaddr").checked = true;
|
||||
document.querySelector(".ajax_cop #client_new_additional .delivery_box.cn_wrapper").classList.add("--more");
|
||||
document.querySelector(".bm-oscop__container #client_new_additional .delivery_box.cn_wrapper").classList.add("--more");
|
||||
document.querySelector(".delivery__address-list-button").classList.add("--fade-in");
|
||||
|
||||
fillInput(document.getElementById("delivery_firstname"), orderDetails.client.deliveryData.firstname);
|
||||
@@ -2234,5 +2330,8 @@ if(editNumber){
|
||||
input.parentElement.classList.add("--success", "has-success");
|
||||
}
|
||||
}
|
||||
|
||||
// Sprawdzenie czy schować przyczepiony przycisk od zakupu
|
||||
checkIfShowAttatched()
|
||||
}
|
||||
initOSCOP();
|
||||
@@ -12,4 +12,7 @@ if(window.location.pathname.includes("return.html") && window.location.search.in
|
||||
}
|
||||
|
||||
// Przekierowanie ze strony order1 na OSCOP
|
||||
if(window.location.pathname.includes("order1.html") || window.location.pathname.includes("order1.php")) window.location = "/place-order.php";
|
||||
if(window.location.pathname.includes("order1.html") || window.location.pathname.includes("order1.php")){
|
||||
app_shop.fn.ajaxLoadSite(1);// W starszych szablonach nie działa i trzeba zakomentować
|
||||
window.location = "/place-order.php";
|
||||
}
|
||||
@@ -40,7 +40,7 @@ const deliveryPickupPoints = [];
|
||||
let finpostjs = false;
|
||||
// Funkcja inicjująca mapę
|
||||
function loadMap() {
|
||||
var htmlContent = `
|
||||
const htmlContent = `
|
||||
<div id="fbs_z02_cover">
|
||||
<div id="fbs_z02_wrapper" class="dialog_fbs_z02">
|
||||
<a id="fbs_z02_close" href="#close"></a>
|
||||
@@ -116,10 +116,12 @@ function loadMap() {
|
||||
document.querySelector('.asideContainer_pickup').innerHTML = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Funkcja obsługująca dostawy z mapą
|
||||
function createEventsInpost(ITEM_ID) {
|
||||
var ITEM_FOR_MAP = '#item_' + ITEM_ID;
|
||||
var oscItem = document.querySelector(ITEM_FOR_MAP).closest('.osc_item');
|
||||
const ITEM_FOR_MAP = '#item_' + ITEM_ID;
|
||||
const oscItem = document.querySelector(ITEM_FOR_MAP).closest('.osc_item');
|
||||
|
||||
document.querySelector(ITEM_FOR_MAP).addEventListener('click', function (e) {
|
||||
const deliveryValue = ITEM_FOR_MAP.slice(1);
|
||||
@@ -132,18 +134,9 @@ function loadMap() {
|
||||
// Jesli nie ma informacji potrzebnej do mapy, zapisz wiadomosc do errora
|
||||
let errorMessage = "";
|
||||
|
||||
if(!clientStreet){
|
||||
errorMessage += `${<iai:variable vid="Wpisz ulicę i numer domu klienta"/>} <br>`;
|
||||
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"/>)
|
||||
}
|
||||
if(!clientStreet) errorMessage += addAddressErrorForMap("street");
|
||||
if(!clientZipCode) errorMessage += addAddressErrorForMap("zipcode");
|
||||
if(!clientCity) errorMessage += addAddressErrorForMap("city");
|
||||
|
||||
// Zablokuj wybranie mapy jak nie ma adresu
|
||||
if(errorMessage !== ""){
|
||||
@@ -176,7 +169,6 @@ function loadMap() {
|
||||
if(!suggestions) return;
|
||||
else suggestions.remove();
|
||||
});
|
||||
htmlContent = '';
|
||||
}
|
||||
|
||||
// Wstaw adres klienta
|
||||
@@ -245,6 +237,17 @@ function getAddressInfo(query){
|
||||
};
|
||||
return document.getElementById(`client_${query}`).value;
|
||||
}
|
||||
// Wiadomość errora, gdyby niebyło informacji adresowych przy otwieraniu mapy
|
||||
const addressErrorMessagesForMap = {
|
||||
"street": `${<iai:variable vid="Wpisz ulicę i numer domu klienta"/>}`,
|
||||
"zipcode": `${<iai:variable vid="Podaj kod pocztowy adresu dostawy"/>}`,
|
||||
"city": `${<iai:variable vid="Wpisz miasto odbiorcy przesyłki"/>}`,
|
||||
}
|
||||
function addAddressErrorForMap(query){
|
||||
addErrorMessage(document.getElementById(`client_${query}`), addressErrorMessagesForMap[query]);
|
||||
return `${addressErrorMessagesForMap[query]} <br>`;
|
||||
}
|
||||
|
||||
// Utworzenie informacji o punkcie odbioru
|
||||
function createPickuppointInfo(selectedPoint, deliveryPointId, name, streetText, cityText, zipcodeText, courierId){
|
||||
// Pokazanie elementu fselectedPoint
|
||||
@@ -294,10 +297,10 @@ function toggleMapList(e){
|
||||
|
||||
e.target.dataset.show = ifList ? "map" : "list";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// DANE KLIENTA
|
||||
|
||||
document.getElementById("cop_seection1").addEventListener("click", (e) => {
|
||||
document.getElementById("bm-oscop-section1").addEventListener("click", (e) => {
|
||||
// Pokazanie się okna od logowania
|
||||
if(e.target.classList.contains("get_signin")) showSigninModal();
|
||||
|
||||
@@ -310,11 +313,11 @@ document.getElementById("cop_seection1").addEventListener("click", (e) => {
|
||||
}
|
||||
|
||||
// Ukrycie/Pokazanie hasła
|
||||
if(e.target.id === "toggle_password") return togglePassword(e.target);
|
||||
if(e.target.id === "toggle-password") return togglePassword(e.target);
|
||||
|
||||
// Sprawdzenie czy kliknięcie było na firmę, czy na osobę prywatną
|
||||
if(e.target.id === "client_type1") return document.querySelectorAll("#cop_seection1 .firm-group").forEach(el => el.classList.add("--fade-in"));
|
||||
if(e.target.id === "client_type2") return document.querySelectorAll("#cop_seection1 .firm-group").forEach(el => el.classList.remove("--fade-in"));
|
||||
if(e.target.id === "client_type1") return document.querySelectorAll("#bm-oscop-section1 .firm-group").forEach(el => el.classList.add("--fade-in"));
|
||||
if(e.target.id === "client_type2") return document.querySelectorAll("#bm-oscop-section1 .firm-group").forEach(el => el.classList.remove("--fade-in"));
|
||||
|
||||
// Sprawdzenie czy dostawa na inny adres czy nie
|
||||
if(e.target.id === "deliver_to_billingaddr"){
|
||||
@@ -356,24 +359,24 @@ function togglePassword(el){
|
||||
// Pokaż popup logowania
|
||||
function showSigninModal(){
|
||||
app_shop.fn.signinModal = new Modal({
|
||||
element: $("#signin-form-ajax"),
|
||||
element: $("#signin-form"),
|
||||
classList: "--fade-in-modal",
|
||||
afterShow: ()=>{
|
||||
disablePageScroll();
|
||||
document.querySelector(".signin_login_input").addEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin_pass_input").addEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin-form__login").addEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin-form__pass").addEventListener("keydown", logInOnEnter);
|
||||
},
|
||||
beforeClose: ()=>{
|
||||
enablePageScroll();
|
||||
document.querySelector(".signin_login_input").removeEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin_pass_input").removeEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin-form__login").removeEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin-form__pass").removeEventListener("keydown", logInOnEnter);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Pokaż(true)/Schowaj(false) formularz dostawy na inny adres
|
||||
function showDeliveryForm(style){
|
||||
const deliveryWrapper = document.querySelector(".ajax_cop #client_new_additional .delivery_box.cn_wrapper");
|
||||
const deliveryWrapper = document.querySelector(".bm-oscop__container #client_new_additional .delivery_box.cn_wrapper");
|
||||
if((style && deliveryWrapper.classList.contains("--more")) || (!style && !deliveryWrapper.classList.contains("--more"))) return;
|
||||
|
||||
// Formularz dostawy na inny adres
|
||||
@@ -448,15 +451,15 @@ const SIGNIN = (signinInput) => JSON.stringify({
|
||||
});
|
||||
|
||||
function logInOnEnter(e){
|
||||
if(e.key==="Enter") logInToAccount(false)
|
||||
if(e.key === "Enter") logInToAccount(false)
|
||||
}
|
||||
const signinForm = document.querySelector(".signin-form_box_text form");
|
||||
const signinForm = document.querySelector(".signin-form__container form");
|
||||
if(signinForm) signinForm.addEventListener("submit", logInToAccount);
|
||||
|
||||
async function logInToAccount(event){
|
||||
if(event) event.preventDefault();
|
||||
const login = document.querySelector(".signin_login_input").value;
|
||||
const password = document.querySelector(".signin_pass_input").value;
|
||||
const login = document.querySelector(".signin-form__login").value;
|
||||
const password = document.querySelector(".signin-form__pass").value;
|
||||
const loginStatus = await fetchData({
|
||||
data: SIGNIN(`
|
||||
login: "${login.replace(/"/g, '\\"')}",
|
||||
@@ -493,7 +496,7 @@ function getClientNew(){
|
||||
success: function (e, a) {
|
||||
app_shop.fn.load(
|
||||
"place-order.php",
|
||||
[["#cop_seection1", "#cop_seection1"]],
|
||||
[["#bm-oscop-section1", "#bm-oscop-section1"]],
|
||||
function () {
|
||||
history.go(-1);
|
||||
},
|
||||
@@ -639,8 +642,8 @@ function handleShowSigninModalFromEmailModal(e){
|
||||
showSigninModal();
|
||||
}
|
||||
|
||||
// EventListener zmian w kontenerze cop_seection1
|
||||
document.getElementById("cop_seection1").addEventListener("change", (e) => {
|
||||
// EventListener zmian w kontenerze bm-oscop-section1
|
||||
document.getElementById("bm-oscop-section1").addEventListener("change", (e) => {
|
||||
const validateRequestId = ["client_zipcode", "delivery_zipcode", "client_nip", "client_email"];
|
||||
const notEmptyFieldsId = ["client_firstname", "client_lastname", "client_city", "delivery_firstname", "delivery_lastname", "delivery_city", "client_firm"];
|
||||
|
||||
@@ -658,17 +661,13 @@ document.getElementById("cop_seection1").addEventListener("change", (e) => {
|
||||
|
||||
// Walidacja ulicy i numeru domu
|
||||
if(e.target.id === "client_street" || e.target.id === "delivery_street") validateStreet(e.target);
|
||||
|
||||
// Walidacja numeru telefonu
|
||||
if(e.target.id === "client_phone" || e.target.id === "delivery_phone") validatePhone(e.target);
|
||||
|
||||
// Walidacja loginu i hasła rejestracji
|
||||
if(e.target.classList.contains("register__login")) testLogin();
|
||||
if(e.target.classList.contains("register__password")) testPassword();
|
||||
|
||||
// Walidacja imienia nazwiska miasta i firmy(wymagające po prostu nie bycia pustym)
|
||||
if(notEmptyFieldsId.includes(e.target.id)) validateNotEmpty(e.target);
|
||||
|
||||
// Sprawdzenie czy firma w dostawie na inny adres została wpisana
|
||||
if(e.target.id === "delivery_additional"){
|
||||
if(e.target.value.length > 0) addSuccess(e.target);
|
||||
@@ -830,13 +829,12 @@ function getNewPaymentsAndDeliveries(data = null) {
|
||||
|
||||
// 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
|
||||
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");
|
||||
if(previousDeliveries) previousDeliveries.remove();
|
||||
document.querySelector(".ajax_cop .step2_sub").insertAdjacentHTML("beforeend",deliveryMarkup);
|
||||
document.getElementById("bm-oscop-deliveries").insertAdjacentHTML("beforeend",deliveryMarkup);
|
||||
|
||||
// Stworzenie metod płatności
|
||||
let prepaidsMethodMarkup = "";
|
||||
@@ -874,7 +872,7 @@ function getNewPaymentsAndDeliveries(data = null) {
|
||||
ifPaymentCard = true;
|
||||
}
|
||||
else{
|
||||
prepaidsMethodMarkup += markup;
|
||||
prepaidsMethodMarkup += markup;
|
||||
// Okienko vouchera
|
||||
if(method.id === 2){
|
||||
prepaidsMethodMarkup += `
|
||||
@@ -900,8 +898,8 @@ function getNewPaymentsAndDeliveries(data = null) {
|
||||
}
|
||||
}
|
||||
});
|
||||
prepaidsTransferMarkup +="</div></div></label>";
|
||||
prepaidsCardMarkup +="</div></div></label>";
|
||||
prepaidsTransferMarkup += "</div></div></label>";
|
||||
prepaidsCardMarkup += "</div></div></label>";
|
||||
|
||||
// Dołączenie metody płatność przy odbiorze
|
||||
if(e.dvp.length) prepaidsMethodMarkup += `
|
||||
@@ -918,7 +916,7 @@ function getNewPaymentsAndDeliveries(data = null) {
|
||||
// Wstawienie metod płatności na stronę
|
||||
const previousPayments = document.getElementById("osc_prepaids_method");
|
||||
if(previousPayments) previousPayments.remove();
|
||||
document.querySelector(".ajax_cop #checkout_step3_1 .step3_sub").insertAdjacentHTML("beforeend", `<div id="osc_prepaids_method"> ${ifPaymentTransfer ? prepaidsTransferMarkup : ""}${ifPaymentCard ? prepaidsCardMarkup : ""}${prepaidsMethodMarkup}</div>`);
|
||||
document.getElementById("bm-oscop-payments").insertAdjacentHTML("beforeend", `<div id="osc_prepaids_method"> ${ifPaymentTransfer ? prepaidsTransferMarkup : ""}${ifPaymentCard ? prepaidsCardMarkup : ""}${prepaidsMethodMarkup}</div>`);
|
||||
|
||||
// Wstawienie błędu jeśli metody płatności są puste
|
||||
const currentPayments = document.getElementById("osc_prepaids_method");
|
||||
@@ -932,7 +930,7 @@ function getNewPaymentsAndDeliveries(data = null) {
|
||||
|
||||
// Wstawienie pickuppoint jeśli edycja i istnieje
|
||||
if(data?.pickupData !== undefined && data?.pickupData !== null){
|
||||
const selectedShipping = document.querySelector(`#cop_seection2 input#${deliveryId}`);
|
||||
const selectedShipping = document.querySelector(`#bm-oscop-section2 input#${deliveryId}`);
|
||||
const pointExists = await checkPrevPickupPoint(
|
||||
selectedShipping.parentElement.querySelector(".fselectedPoint"),
|
||||
data.pickupData.id,
|
||||
@@ -1111,7 +1109,7 @@ function changeCurrentShippingInfo(shippingMethod){
|
||||
calculateDeliveryDate(shippingMethod.value, shippingMethod.dataset.delivery, shippingMethod.dataset.pickuppoint);
|
||||
app_shop.vars.checkedShipping = shippingMethod.value;
|
||||
}
|
||||
document.getElementById("cop_seection2").addEventListener("click", e => {
|
||||
document.getElementById("bm-oscop-section2").addEventListener("click", e => {
|
||||
// Kliknięcie na dostawe
|
||||
if(e.target.name === "shipping"){
|
||||
// Wyczyszczenie wszystkich zaznaczonych punktów odbioru
|
||||
@@ -1187,7 +1185,7 @@ function removePrevClone(){
|
||||
const prevClone = document.querySelector(".osc_item-clone");
|
||||
if(!prevClone) return;
|
||||
const cloneGroupName = prevClone.querySelector("input").dataset.group;
|
||||
document.getElementById(`payitem_${cloneGroupName}`).closest(".osc_item").style.display="flex";
|
||||
document.getElementById(`payitem_${cloneGroupName}`).closest(".osc_item").style.display="grid";
|
||||
prevClone.remove();
|
||||
}
|
||||
|
||||
@@ -1248,7 +1246,7 @@ function changeDeliveryOptions(){
|
||||
if(document.getElementById("payitem_cash") && document.getElementById("payitem_cash").checked) changePrepaidDvp("none", "block");
|
||||
else changePrepaidDvp("block", "none");
|
||||
|
||||
document.querySelectorAll("#checkout_step2_1 input").forEach((el) => el.checked = false);
|
||||
document.querySelectorAll("#bm-oscop-deliveries input").forEach((el) => el.checked = false);
|
||||
app_shop.vars.checkedShipping = "";
|
||||
calculateBasketCost();
|
||||
}
|
||||
@@ -1323,10 +1321,11 @@ function calculateBasketCost() {
|
||||
const deliveryCostEl = document.querySelector("#order2_shipping_value .operation_value");
|
||||
const productsPointsEl = document.querySelector("#order2_products_points .operation_value");
|
||||
const summaryPointsEl = document.getElementById("summary-points");
|
||||
const attatchedSummaryPointsEl = document.getElementById("attatched-points");
|
||||
// Przygotowanie informacji o metodzie dostawy i platnosci
|
||||
const orderInfo = {
|
||||
delivery: document.querySelector('.ajax_cop input[name="shipping"]:checked') ? document.querySelector('.ajax_cop input[name="shipping"]:checked').value : "0-1",
|
||||
payform_id: document.querySelector('.ajax_cop input[name="payform_id"]:checked') ? document.querySelector('.ajax_cop input[name="payform_id"]:checked').value : "cash"
|
||||
delivery: document.querySelector('.bm-oscop__container input[name="shipping"]:checked') ? document.querySelector('.bm-oscop__container input[name="shipping"]:checked').value : "0-1",
|
||||
payform_id: document.querySelector('.bm-oscop__container input[name="payform_id"]:checked') ? document.querySelector('.bm-oscop__container input[name="payform_id"]:checked').value : "cash"
|
||||
}
|
||||
xhrs && 4 != xhrs.readyState && 0 != xhrs.readyState && xhrs.abort(),
|
||||
xhrs = $.ajax({
|
||||
@@ -1362,13 +1361,17 @@ function calculateBasketCost() {
|
||||
productsPointsEl.parentElement.style.display = "flex";
|
||||
summaryPointsEl.innerHTML = `+ ${t.products_worth_at_points} ${<iai:variable vid="pkt"/>}.`;
|
||||
summaryPointsEl.style.display = "block";
|
||||
attatchedSummaryPointsEl.innerHTML = `+ ${t.products_worth_at_points} ${<iai:variable vid="pkt"/>}.`;
|
||||
attatchedSummaryPointsEl.style.display = "block";
|
||||
}else {
|
||||
productsPointsEl.parentElement.style.display = "none";
|
||||
summaryPointsEl.style.display = "none";
|
||||
attatchedSummaryPointsEl.style.display = "none";
|
||||
}
|
||||
|
||||
// Cena całkowita
|
||||
document.getElementById("summary-cost").innerHTML = formatPrice(t.total_to_pay, t.currency_sign) + "<small>" + <iai:variable vid="brutto"/> + "</small>";
|
||||
document.getElementById("attatched-cost").innerHTML = formatPrice(t.total_to_pay, t.currency_sign);
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -1388,17 +1391,34 @@ function formatPrice(price, currencySign) {
|
||||
// Funkcja od ustalenia daty dostawy
|
||||
function calculateDeliveryDate(deliveryVal, delivery, pickuppoint) {
|
||||
const deliveryMessageEl = document.querySelector("#order2_shiptime span:not(.operation_value)");
|
||||
const attatchedMessageEl = document.querySelector("#attatched-shiptime span:not(.operation_value)");
|
||||
const deliveryDateEl = document.querySelector("#order2_shiptime .operation_value");
|
||||
const attatchedDateEl = document.querySelector("#attatched-shiptime .operation_value");
|
||||
const date = delivery.split("#");
|
||||
|
||||
// Wybranie nazwy zaleznie czy dostawa jest do twojego mieszkania czy nie
|
||||
if(deliveryVal === "0-0" || deliveryVal === "0-1" || pickuppoint === "y") deliveryMessageEl.innerHTML = `${<iai:variable vid="Odbiór zamówienia możliwy"/>}:`;
|
||||
else deliveryMessageEl.innerHTML = `${<iai:variable vid="Przesyłka powinna być u Ciebie"/>}:`;
|
||||
if(deliveryVal === "0-0" || deliveryVal === "0-1" || pickuppoint === "y"){
|
||||
deliveryMessageEl.innerHTML = `${<iai:variable vid="Odbiór zamówienia możliwy"/>}:`;
|
||||
attatchedMessageEl.innerHTML = `${<iai:variable vid="Odbiór zamówienia możliwy"/>}:`;
|
||||
}
|
||||
else{
|
||||
deliveryMessageEl.innerHTML = `${<iai:variable vid="Przesyłka powinna być u Ciebie"/>}:`;
|
||||
attatchedMessageEl.innerHTML = `${<iai:variable vid="Przesyłka powinna być u Ciebie"/>}:`;
|
||||
}
|
||||
|
||||
if(date[4]>0) deliveryDateEl.innerHTML = `${<iai:variable vid="za"/>} ` + parseInt(date[5]) + ` ${<iai:variable vid="dni"/>} `;
|
||||
if(date[4]>0) {
|
||||
deliveryDateEl.innerHTML = `${<iai:variable vid="za"/>} ` + parseInt(date[5]) + ` ${<iai:variable vid="dni"/>} `;
|
||||
attatchedDateEl.innerHTML = `${<iai:variable vid="za"/>} ` + parseInt(date[5]) + ` ${<iai:variable vid="dni"/>} `;
|
||||
}
|
||||
else{
|
||||
if(parseInt(date[5]) === 0) deliveryDateEl.innerHTML = <iai:variable vid="Dzisiaj"/>;
|
||||
else deliveryDateEl.innerHTML = orderTxt[`shipping${parseInt(date[3])}`];
|
||||
if(parseInt(date[5]) === 0){
|
||||
deliveryDateEl.innerHTML = <iai:variable vid="Dzisiaj"/>;
|
||||
attatchedDateEl.innerHTML = <iai:variable vid="Dzisiaj"/>;
|
||||
}
|
||||
else{
|
||||
deliveryDateEl.innerHTML = orderTxt[`shipping${parseInt(date[3])}`];
|
||||
attatchedDateEl.innerHTML = orderTxt[`shipping${parseInt(date[3])}`];
|
||||
}
|
||||
}
|
||||
};
|
||||
// Zmiana informacji o dostawie
|
||||
@@ -1409,8 +1429,8 @@ function changeDeliveryInfoObject(deliveryObject, deliveryElement){
|
||||
}
|
||||
|
||||
// Obsługa klilnięć na elementy w podsumowaniu
|
||||
document.getElementById("cop_seection3").addEventListener("click", (e) => {
|
||||
const productsContainer = document.getElementById("checkout_step3_3");
|
||||
document.getElementById("bm-oscop-section3").addEventListener("click", (e) => {
|
||||
const productsContainer = document.querySelector(".summary__container");
|
||||
|
||||
// Kliknięcie na przyciski "Pokaż pozozostałe produkty" i "Zwiń listę"
|
||||
const togggleProducts = e.target.closest(".order_products_action");
|
||||
@@ -1422,40 +1442,98 @@ document.getElementById("cop_seection3").addEventListener("click", (e) => {
|
||||
productsContainer.classList.add("--more");
|
||||
togggleProducts.querySelector("span").innerHTML = `${<iai:variable vid="Zwiń listę"/>}`;
|
||||
}
|
||||
checkIfShowAttatched();
|
||||
return;
|
||||
}
|
||||
|
||||
// Kliknięcie na checkbox(nie zaznacz wszystkie i nie kod rabatowy)
|
||||
if(e.target.type === "checkbox" && e.target.id !== "checkall-terms" && e.target.id !== "rebate_option"){
|
||||
if(e.target.type === "checkbox" && e.target.id !== "checkall-terms" && e.target.id !== "rebate-option"){
|
||||
document.querySelector(".bm-oscop__attatched-checkbox").classList.remove("--error");
|
||||
|
||||
const checkboxAllTerms = document.getElementById("checkall-terms");
|
||||
if(e.target.checked === false) checkboxAllTerms.checked = false;
|
||||
const attatchedcheckboxAllTerms = document.getElementById("attatched-checkall-terms");
|
||||
if(e.target.checked === false) {
|
||||
checkboxAllTerms.checked = false;
|
||||
attatchedcheckboxAllTerms.checked = false;
|
||||
// usuniecie bledu jesli jest na przyczepionym przycisku zakupowym
|
||||
document.querySelector(".bm-oscop__attatched-checkbox").classList.remove("--error");
|
||||
}
|
||||
else{
|
||||
const termsInputs = document.querySelectorAll(".order2_terms_wrapper input:not(#checkall-terms)");
|
||||
let checkedCount = 0;
|
||||
termsInputs.forEach(el => el.checked === true ? checkedCount++ : "");
|
||||
if(checkedCount === termsInputs.length) checkboxAllTerms.checked = true;
|
||||
if(checkedCount === termsInputs.length) {
|
||||
checkboxAllTerms.checked = true;
|
||||
attatchedcheckboxAllTerms.checked = true;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Kliknięcie na przycisk "Zaznacz wszystkie"
|
||||
if(e.target.id === "checkall-terms"){
|
||||
const termsInputs = document.querySelectorAll(".order2_terms_wrapper input:not(#checkall-terms)");
|
||||
let checkAll = false;
|
||||
|
||||
termsInputs.forEach(el => el.checked === false ? checkAll = true : "");
|
||||
termsInputs.forEach(function (el) {
|
||||
if(checkAll) el.checked = true;
|
||||
else el.checked = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(e.target.id === "checkall-terms") return toggleAllTerms();
|
||||
|
||||
// Usuń error na regulaminie
|
||||
if(e.target.id === "order2_terms_conditions" || e.target.id === "order2_cancel"){
|
||||
e.target.parentElement.querySelector("span").classList.remove("text-danger");
|
||||
e.target.parentElement.querySelector("a").classList.remove("text-danger");
|
||||
}
|
||||
})
|
||||
});
|
||||
function toggleAllTerms(){
|
||||
removeErrorOnTerms();
|
||||
|
||||
const termsInputs = document.querySelectorAll(".order2_terms_wrapper input:not(#checkall-terms)");
|
||||
let checkAll = false;
|
||||
|
||||
termsInputs.forEach(el => el.checked === false ? checkAll = true : "");
|
||||
termsInputs.forEach(function (el) {
|
||||
el.checked = checkAll;
|
||||
});
|
||||
|
||||
document.getElementById("checkall-terms").checked = checkAll;
|
||||
document.getElementById("attatched-checkall-terms").checked = checkAll;
|
||||
}
|
||||
|
||||
function removeErrorOnTerms(){
|
||||
document.querySelector(".bm-oscop__attatched-checkbox").classList.remove("--error");
|
||||
document.querySelector(".order2_terms_conditions span").classList.remove("text-danger");
|
||||
document.querySelector(".order2_terms_conditions a").classList.remove("text-danger");
|
||||
document.querySelector(".order2_cancel span").classList.remove("text-danger");
|
||||
document.querySelector(".order2_cancel a").classList.remove("text-danger");
|
||||
}
|
||||
|
||||
// PRZYCISK ZAKUPU PRZYTWIERDZONY NA DÓŁ STRONY
|
||||
function checkIfShowAttatched(){
|
||||
const attatchedEl = document.querySelector("#attatched-summary .bm-oscop__attatched-container");
|
||||
const summaryCheckAllPos = document.getElementById("checkall-terms").getBoundingClientRect();
|
||||
// Sprawdzenie czy pokazać przytwierdzony przycisk do zakupu
|
||||
|
||||
if(summaryCheckAllPos.top >= window.innerHeight - attatchedEl.offsetHeight){
|
||||
attatchedEl.style.opacity = "1";
|
||||
attatchedEl.closest("#attatched-summary").style.zIndex = "30";
|
||||
}
|
||||
else{
|
||||
attatchedEl.style.opacity = "0";
|
||||
attatchedEl.closest("#attatched-summary").style.zIndex = "-1";
|
||||
}
|
||||
|
||||
// Sprawdzenie czy pokazywać cenę
|
||||
const summaryEl = document.querySelector(".order2_summary");
|
||||
|
||||
// Przeliczana wysokość elementu przytwierdzonego przycisku zakupu na wypadek gdyby cena miała display: none
|
||||
const attatchedElHeight = attatchedEl.querySelector(".bm-oscop__attatched-price").style.display === "none" ? (summaryEl.offsetHeight + attatchedEl.offsetHeight) : attatchedEl.offsetHeight
|
||||
|
||||
if(summaryEl.getBoundingClientRect().top >= window.innerHeight - attatchedElHeight){
|
||||
attatchedEl.querySelector(".bm-oscop__attatched-price").style.display = "block";
|
||||
}else{
|
||||
attatchedEl.querySelector(".bm-oscop__attatched-price").style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("scroll", e=>{
|
||||
checkIfShowAttatched()
|
||||
});
|
||||
document.getElementById("attatched-checkall-terms").addEventListener("click", toggleAllTerms);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// KOD RABATOWY (funkcje)
|
||||
@@ -1485,7 +1563,7 @@ const DEACTIVATE_REBATE_CODE = () => JSON.stringify({
|
||||
})
|
||||
|
||||
// Aktywacja kodu rabatowego
|
||||
const rebateCode = document.getElementById("rebate_code");
|
||||
const rebateCode = document.getElementById("rebate-code");
|
||||
async function updateCode(){
|
||||
if(rebateCode.value.trim() === ""){
|
||||
addError(rebateCode);
|
||||
@@ -1556,7 +1634,7 @@ function toggleActiveCode(show, error=false){
|
||||
// Zmień wartości
|
||||
activeCodeEl.innerHTML = show ? rebateCode.value : "";
|
||||
showInput = error ? true : false;
|
||||
document.getElementById("rebate_option").checked = error ? true : false;
|
||||
document.getElementById("rebate-option").checked = error ? true : false;
|
||||
if(!error) rebateCode.value = "";
|
||||
else activeCodeEl.innerHTML = "";
|
||||
}
|
||||
@@ -1565,7 +1643,7 @@ function toggleActiveCode(show, error=false){
|
||||
let showInput = false;
|
||||
document.querySelector(".rebate").addEventListener("click", (e) => {
|
||||
// Rozwinięcie opcji rabatowej
|
||||
if(e.target.id === "rebate_option" || e.target.classList.contains("rebate__active_change")){
|
||||
if(e.target.id === "rebate-option" || e.target.classList.contains("rebate__active-change")){
|
||||
showInput = !showInput;
|
||||
if(showInput) rebateCodeContainer.classList.add("--fade-in");
|
||||
else rebateCodeContainer.classList.remove("--fade-in");
|
||||
@@ -1573,7 +1651,7 @@ document.querySelector(".rebate").addEventListener("click", (e) => {
|
||||
|
||||
// Kliknięcie na zrealizuj i dezaktywuj
|
||||
if(e.target.className.includes("rebate__code-realize")) updateCode();
|
||||
if(e.target.classList.contains("rebate__active_remove")) removeCode();
|
||||
if(e.target.classList.contains("rebate__active-remove")) removeCode();
|
||||
});
|
||||
|
||||
|
||||
@@ -1627,19 +1705,23 @@ async function validateFormInputs(query){
|
||||
}
|
||||
|
||||
// Obsługa złożenia zamówienia
|
||||
document.querySelector(".order2_button_order").addEventListener("click", async () => {
|
||||
document.querySelectorAll(".order2_button_order").forEach(btnEl=>{
|
||||
btnEl.addEventListener("click", handleBuyOnClick);
|
||||
})
|
||||
|
||||
async function handleBuyOnClick(){
|
||||
const termsConditionsInput = document.getElementById("order2_terms_conditions");
|
||||
const cancelConditionsInput = document.getElementById("order2_cancel");
|
||||
try {
|
||||
app_shop.fn.ajaxLoadSite(1);
|
||||
app_shop.vars.validation = 1;
|
||||
// Sprawdzenie pól formularza
|
||||
const x = await validateAllInputs();
|
||||
if(x === false) app_shop.vars.validation = 0;
|
||||
const allInputsCorrectlyValidated = await validateAllInputs();
|
||||
if(allInputsCorrectlyValidated === false) app_shop.vars.validation = 0;
|
||||
|
||||
// Znalezienie obecnie zaznaczonej metody dostawy i płatności
|
||||
const deliveryMethod = document.querySelector(".ajax_cop [name=shipping]:checked");
|
||||
const paymentMethod = document.querySelector(".ajax_cop [name=payform_id]:checked");
|
||||
const deliveryMethod = document.querySelector(".bm-oscop__container [name=shipping]:checked");
|
||||
const paymentMethod = document.querySelector(".bm-oscop__container [name=payform_id]:checked");
|
||||
|
||||
// Sprawdzenie czy użytkownik zaakceptował regulamin
|
||||
if(!termsConditionsInput.checked || !cancelConditionsInput.checked){
|
||||
@@ -1675,25 +1757,29 @@ document.querySelector(".order2_button_order").addEventListener("click", async (
|
||||
let alertMessage = "";
|
||||
|
||||
// Element sprawdzający czy regulamin jest zaznaczony
|
||||
let termsAndConditions = termsConditionsInput.checked && cancelConditionsInput.checked;
|
||||
if(!termsAndConditions) alertMessage += `${<iai:variable vid="Zatwierdź"/>} ${<iai:variable vid="Regulamin"/>}!<br/>`;
|
||||
const termsAndConditions = termsConditionsInput.checked && cancelConditionsInput.checked;
|
||||
if(!termsAndConditions){
|
||||
document.querySelector(".bm-oscop__attatched-checkbox").classList.add("--error");
|
||||
alertMessage += `${<iai:variable vid="Zatwierdź"/>} ${<iai:variable vid="Regulamin"/>}!<br/>`;
|
||||
}
|
||||
// Sprawdź metodę płatności i dostawy(scrollowanie do formularza ważniejsze)
|
||||
if(!document.querySelector(`input[name="shipping"]:checked`)){
|
||||
scrolledToElement = errorEl || document.querySelector("#bm-oscop-deliveries h2");
|
||||
alertMessage += `${<iai:variable vid="Proszę wybrać dostępną metodę dostawy"/>}<br/>`;
|
||||
}
|
||||
if(!document.querySelector(`input[name="payform_id"]:checked`)){
|
||||
scrolledToElement = errorEl || document.querySelector("#bm-oscop-payments h2");
|
||||
alertMessage += `${<iai:variable vid="Proszę wybrać metodę płatności"/>}<br/>`;
|
||||
}
|
||||
// Błąd w formularzu
|
||||
if(errorEl){
|
||||
scrolledToElement = errorEl;
|
||||
alertMessage += `${<iai:variable vid="W formularzu wystąpiły błędy"/>}<br/>`;
|
||||
}// Sprawdź metodę płatności i dostawy(scrollowanie do formularza ważniejsze)
|
||||
if(!document.querySelector(`input[name="payform_id"]:checked`)){
|
||||
scrolledToElement = errorEl || document.querySelector("#checkout_step3_1 h2");
|
||||
alertMessage += `${<iai:variable vid="Proszę wybrać metodę płatności"/>}<br/>`;
|
||||
}
|
||||
if(!document.querySelector(`input[name="shipping"]:checked`)){
|
||||
scrolledToElement = errorEl || document.querySelector("#checkout_step2_1 h2");
|
||||
alertMessage += `${<iai:variable vid="Proszę wybrać dostępną metodę dostawy"/>}`;
|
||||
|
||||
alertMessage += `${<iai:variable vid="W formularzu wystąpiły błędy"/>}`;
|
||||
}
|
||||
|
||||
// Jeśli użytkownik zatwierdził regulamin, przescrolluj do elementu z błędem
|
||||
if(termsAndConditions) scrollToHeight(scrolledToElement);
|
||||
if(scrolledToElement) scrollToHeight(scrolledToElement);
|
||||
|
||||
|
||||
// Pokaż error i przerwij składanie zamówienia
|
||||
Alertek.show_alert(alertMessage);
|
||||
@@ -1712,13 +1798,15 @@ document.querySelector(".order2_button_order").addEventListener("click", async (
|
||||
console.log(e);
|
||||
alert("blad");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Przescrolluj do
|
||||
function scrollToHeight(scrollToEl){
|
||||
let yOffset = -45;
|
||||
if(app_shop.vars.view === 1) yOffset = -100;
|
||||
if(app_shop.vars.view === 2) yOffset = -75;
|
||||
const y = scrollToEl.getBoundingClientRect().top + window.pageYOffset + yOffset;
|
||||
|
||||
window.scrollTo({top: y, behavior: 'smooth'});
|
||||
}
|
||||
|
||||
@@ -1734,7 +1822,7 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
// Weź dane klienta
|
||||
const email = document.getElementById("client_email").value;
|
||||
const phone = document.getElementById("client_phone").value;
|
||||
const clientType = document.querySelector('.ajax_cop [name="client_type"]:checked').value;
|
||||
const clientType = document.querySelector('.bm-oscop__container [name="client_type"]:checked').value;
|
||||
const firmname = clientType === "firm" ? document.getElementById("client_firm").value : "";
|
||||
const nip = clientType === "firm" ? document.getElementById("client_nip").value : "";
|
||||
let firstname = document.getElementById("client_firstname").value;
|
||||
@@ -1767,7 +1855,7 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
else rebateCode = "";
|
||||
|
||||
let voucherCode;
|
||||
if(document.querySelector(".ajax_cop #payitem_2") && document.querySelector(".ajax_cop #payitem_2").checked) voucherCode = document.querySelector(".ajax_cop #order_voucher_id").value;
|
||||
if(document.querySelector(".bm-oscop__container #payitem_2") && document.querySelector(".bm-oscop__container #payitem_2").checked) voucherCode = document.querySelector(".bm-oscop__container #order_voucher_id").value;
|
||||
|
||||
// Jeśli zalogowany użytkownik jest firmą i nie ma imienia i nazwiska
|
||||
if (clientType.disabled && clientType.value === "firm") {
|
||||
@@ -1780,8 +1868,8 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
lastname = lastname.replace(/[&\/\\#,+()$~%.'":*?<>{}!@~`^_]/g, "");
|
||||
|
||||
// Dodatkowe informacje (uwagi, faktura, punkt odbioru)
|
||||
const shopRemarks = document.getElementById("shop_remarks").checked ? document.querySelector(".ajax_cop [name=remarks]").value : "";
|
||||
const deliveryRemarks = document.getElementById("courier_remarks").checked ? document.querySelector(".ajax_cop [name=deliverer_remarks]").value : "";
|
||||
const shopRemarks = document.getElementById("shop_remarks").checked ? document.querySelector(".bm-oscop__container [name=remarks]").value : "";
|
||||
const deliveryRemarks = document.getElementById("courier_remarks").checked ? document.querySelector(".bm-oscop__container [name=deliverer_remarks]").value : "";
|
||||
|
||||
const invoiceOption = document.querySelector("input[name=invoice]:checked").value;
|
||||
const pickuppoint = document.querySelector("#osc_order1 input:checked").dataset.pickuppoint === "y" ? document.querySelector("#osc_order1 input:checked").parentElement.querySelector("label [name=pickup_point]").value : "";
|
||||
@@ -1857,7 +1945,7 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
}
|
||||
|
||||
function checkNewsletter(logged, regular){
|
||||
if(document.querySelector(`.ajax_cop [name=${logged}]`)) return document.querySelector(`.ajax_cop [name=${logged}]`).value ? 1 : 0;
|
||||
if(document.querySelector(`.bm-oscop__container [name=${logged}]`)) return document.querySelector(`.bm-oscop__container [name=${logged}]`).value ? 1 : 0;
|
||||
else if(document.querySelector(regular)) return document.querySelector(regular).checked ? 1 : 0;
|
||||
else return 0;
|
||||
}
|
||||
@@ -2025,13 +2113,13 @@ function enablePageScroll(){
|
||||
app_shop.fn.load = function(_url,target,callback,paramets) {
|
||||
if(app_shop.vars.xhr && app_shop.vars.xhr.readystate != 4) app_shop.vars.xhr.abort();
|
||||
$(target).addClass('load-content');
|
||||
for(var i=0; target.length > i ; i++) $(target[i][0]).addClass('load-content');
|
||||
for(let i=0; target.length > i ; i++) $(target[i][0]).addClass('load-content');
|
||||
|
||||
app_shop.vars.xhr = $.ajax({
|
||||
url: _url+paramets,
|
||||
timeout: 16000,
|
||||
success: function(data,textStatus) {
|
||||
for(var i=0; target.length > i ; i++) $(target[i][0]).removeClass('load-content').html($(data).find(target[i][1]).html());
|
||||
for(let i=0; target.length > i ; i++) $(target[i][0]).removeClass('load-content').html($(data).find(target[i][1]).html());
|
||||
app_shop.fn.change_url(_url);
|
||||
app_shop.fn.evalJSFromHtml(data);
|
||||
if(callback) callback();
|
||||
@@ -2046,12 +2134,7 @@ function throwAjaxError(e) {
|
||||
-1 !== $.inArray(e, ["nocontent", "error", "timeout", "abort", "parsererror"]) && (console.log("Error:" + e), Alertek.show_alert( "Błąd podczas logowania, proszę spróbować ponownie" + " (" + e + ": " + $.now() + ")"), $.cookie("off_opc", !0));
|
||||
};
|
||||
async function fetchData(options = {}) {
|
||||
const {
|
||||
data,
|
||||
link,
|
||||
linkParameter = '',
|
||||
alert = true
|
||||
} = options;
|
||||
const {data,link,linkParameter = '',alert = true} = options;
|
||||
if (!data) return false;
|
||||
try {
|
||||
const response = await fetch(`${link || app_shop.urls.graphql || '/graphql/v1/'}${linkParameter}`, {
|
||||
@@ -2084,7 +2167,7 @@ function initOSCOP(){
|
||||
// Element z numerem edycji jeśli jest
|
||||
const editNumber = document.getElementById("edit-number");
|
||||
|
||||
if(document.querySelector(".ajax_cop").childElementCount && !editNumber) changeRegion(null);
|
||||
if(document.querySelector(".bm-oscop__container").childElementCount && !editNumber) changeRegion(null);
|
||||
|
||||
// Jeśli edycja zamówienia uzupełnij dane (niewiadomo jak z voucherem bo go się nie da edytować)
|
||||
if(editNumber){
|
||||
@@ -2168,7 +2251,6 @@ function initOSCOP(){
|
||||
|
||||
// Pobranie danych o edytowanym zamówieniu
|
||||
async function getEditData(){
|
||||
|
||||
const data = await fetchData({
|
||||
data: ORDER_DETAILS(`OrderDetailsInput: {
|
||||
orderNumber: ${editNumber.value},
|
||||
@@ -2204,7 +2286,7 @@ function initOSCOP(){
|
||||
if(differentDelivery){
|
||||
// Pokazanie formularza dodatkowej dostawy
|
||||
document.getElementById("deliver_to_billingaddr").checked = true;
|
||||
document.querySelector(".ajax_cop #client_new_additional .delivery_box.cn_wrapper").classList.add("--more");
|
||||
document.querySelector(".bm-oscop__container #client_new_additional .delivery_box.cn_wrapper").classList.add("--more");
|
||||
document.querySelector(".delivery__address-list-button").classList.add("--fade-in");
|
||||
|
||||
fillInput(document.getElementById("delivery_firstname"), orderDetails.client.deliveryData.firstname);
|
||||
@@ -2244,5 +2326,8 @@ function initOSCOP(){
|
||||
input.parentElement.classList.add("--success", "has-success");
|
||||
}
|
||||
}
|
||||
|
||||
// Sprawdzenie czy schować przyczepiony przycisk od zakupu
|
||||
checkIfShowAttatched()
|
||||
}
|
||||
initOSCOP();
|
||||
@@ -40,7 +40,7 @@ const deliveryPickupPoints = [];
|
||||
let finpostjs = false;
|
||||
// Funkcja inicjująca mapę
|
||||
function loadMap() {
|
||||
var htmlContent = `
|
||||
const htmlContent = `
|
||||
<div id="fbs_z02_cover">
|
||||
<div id="fbs_z02_wrapper" class="dialog_fbs_z02">
|
||||
<a id="fbs_z02_close" href="#close"></a>
|
||||
@@ -116,10 +116,12 @@ function loadMap() {
|
||||
document.querySelector('.asideContainer_pickup').innerHTML = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Funkcja obsługująca dostawy z mapą
|
||||
function createEventsInpost(ITEM_ID) {
|
||||
var ITEM_FOR_MAP = '#item_' + ITEM_ID;
|
||||
var oscItem = document.querySelector(ITEM_FOR_MAP).closest('.osc_item');
|
||||
const ITEM_FOR_MAP = '#item_' + ITEM_ID;
|
||||
const oscItem = document.querySelector(ITEM_FOR_MAP).closest('.osc_item');
|
||||
|
||||
document.querySelector(ITEM_FOR_MAP).addEventListener('click', function (e) {
|
||||
const deliveryValue = ITEM_FOR_MAP.slice(1);
|
||||
@@ -132,18 +134,9 @@ function loadMap() {
|
||||
// Jesli nie ma informacji potrzebnej do mapy, zapisz wiadomosc do errora
|
||||
let errorMessage = "";
|
||||
|
||||
if(!clientStreet){
|
||||
errorMessage += `${<iai:variable vid="Wpisz nazwę ulicy lub miejscowości i numer domu"/>} <br>`;
|
||||
addErrorMessage(document.getElementById("client_street"), <iai:variable vid="Wpisz nazwę ulicy lub miejscowości i numer domu"/>)
|
||||
}
|
||||
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"/>)
|
||||
}
|
||||
if(!clientStreet) errorMessage += addAddressErrorForMap("street");
|
||||
if(!clientZipCode) errorMessage += addAddressErrorForMap("zipcode");
|
||||
if(!clientCity) errorMessage += addAddressErrorForMap("city");
|
||||
|
||||
// Zablokuj wybranie mapy jak nie ma adresu
|
||||
if(errorMessage !== ""){
|
||||
@@ -176,7 +169,6 @@ function loadMap() {
|
||||
if(!suggestions) return;
|
||||
else suggestions.remove();
|
||||
});
|
||||
htmlContent = '';
|
||||
}
|
||||
|
||||
// Wstaw adres klienta
|
||||
@@ -245,6 +237,17 @@ function getAddressInfo(query){
|
||||
};
|
||||
return document.getElementById(`client_${query}`).value;
|
||||
}
|
||||
// Wiadomość errora, gdyby niebyło informacji adresowych przy otwieraniu mapy
|
||||
const addressErrorMessagesForMap = {
|
||||
"street": `${<iai:variable vid="Wpisz ulicę i numer domu klienta"/>}`,
|
||||
"zipcode": `${<iai:variable vid="Podaj kod pocztowy adresu dostawy"/>}`,
|
||||
"city": `${<iai:variable vid="Wpisz miasto odbiorcy przesyłki"/>}`,
|
||||
}
|
||||
function addAddressErrorForMap(query){
|
||||
addErrorMessage(document.getElementById(`client_${query}`), addressErrorMessagesForMap[query]);
|
||||
return `${addressErrorMessagesForMap[query]} <br>`;
|
||||
}
|
||||
|
||||
// Utworzenie informacji o punkcie odbioru
|
||||
function createPickuppointInfo(selectedPoint, deliveryPointId, name, streetText, cityText, zipcodeText, courierId){
|
||||
// Pokazanie elementu fselectedPoint
|
||||
@@ -294,10 +297,10 @@ function toggleMapList(e){
|
||||
|
||||
e.target.dataset.show = ifList ? "map" : "list";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// DANE KLIENTA
|
||||
|
||||
document.getElementById("cop_seection1").addEventListener("click", (e) => {
|
||||
document.getElementById("bm-oscop-section1").addEventListener("click", (e) => {
|
||||
// Pokazanie się okna od logowania
|
||||
if(e.target.classList.contains("get_signin")) showSigninModal();
|
||||
|
||||
@@ -310,11 +313,11 @@ document.getElementById("cop_seection1").addEventListener("click", (e) => {
|
||||
}
|
||||
|
||||
// Ukrycie/Pokazanie hasła
|
||||
if(e.target.id === "toggle_password") return togglePassword(e.target);
|
||||
if(e.target.id === "toggle-password") return togglePassword(e.target);
|
||||
|
||||
// Sprawdzenie czy kliknięcie było na firmę, czy na osobę prywatną
|
||||
if(e.target.id === "client_type1") return document.querySelectorAll("#cop_seection1 .firm-group").forEach(el => el.classList.add("--fade-in"));
|
||||
if(e.target.id === "client_type2") return document.querySelectorAll("#cop_seection1 .firm-group").forEach(el => el.classList.remove("--fade-in"));
|
||||
if(e.target.id === "client_type1") return document.querySelectorAll("#bm-oscop-section1 .firm-group").forEach(el => el.classList.add("--fade-in"));
|
||||
if(e.target.id === "client_type2") return document.querySelectorAll("#bm-oscop-section1 .firm-group").forEach(el => el.classList.remove("--fade-in"));
|
||||
|
||||
// Sprawdzenie czy dostawa na inny adres czy nie
|
||||
if(e.target.id === "deliver_to_billingaddr"){
|
||||
@@ -356,24 +359,24 @@ function togglePassword(el){
|
||||
// Pokaż popup logowania
|
||||
function showSigninModal(){
|
||||
app_shop.fn.signinModal = new Modal({
|
||||
element: $("#signin-form-ajax"),
|
||||
element: $("#signin-form"),
|
||||
classList: "--fade-in-modal",
|
||||
afterShow: ()=>{
|
||||
disablePageScroll();
|
||||
document.querySelector(".signin_login_input").addEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin_pass_input").addEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin-form__login").addEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin-form__pass").addEventListener("keydown", logInOnEnter);
|
||||
},
|
||||
beforeClose: ()=>{
|
||||
enablePageScroll();
|
||||
document.querySelector(".signin_login_input").removeEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin_pass_input").removeEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin-form__login").removeEventListener("keydown", logInOnEnter);
|
||||
document.querySelector(".signin-form__pass").removeEventListener("keydown", logInOnEnter);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Pokaż(true)/Schowaj(false) formularz dostawy na inny adres
|
||||
function showDeliveryForm(style){
|
||||
const deliveryWrapper = document.querySelector(".ajax_cop #client_new_additional .delivery_box.cn_wrapper");
|
||||
const deliveryWrapper = document.querySelector(".bm-oscop__container #client_new_additional .delivery_box.cn_wrapper");
|
||||
if((style && deliveryWrapper.classList.contains("--more")) || (!style && !deliveryWrapper.classList.contains("--more"))) return;
|
||||
|
||||
// Formularz dostawy na inny adres
|
||||
@@ -448,15 +451,15 @@ const SIGNIN = (signinInput) => JSON.stringify({
|
||||
});
|
||||
|
||||
function logInOnEnter(e){
|
||||
if(e.key==="Enter") logInToAccount(false)
|
||||
if(e.key === "Enter") logInToAccount(false)
|
||||
}
|
||||
const signinForm = document.querySelector(".signin-form_box_text form");
|
||||
const signinForm = document.querySelector(".signin-form__container form");
|
||||
if(signinForm) signinForm.addEventListener("submit", logInToAccount);
|
||||
|
||||
async function logInToAccount(event){
|
||||
if(event) event.preventDefault();
|
||||
const login = document.querySelector(".signin_login_input").value;
|
||||
const password = document.querySelector(".signin_pass_input").value;
|
||||
const login = document.querySelector(".signin-form__login").value;
|
||||
const password = document.querySelector(".signin-form__pass").value;
|
||||
const loginStatus = await fetchData({
|
||||
data: SIGNIN(`
|
||||
login: "${login.replace(/"/g, '\\"')}",
|
||||
@@ -493,7 +496,7 @@ function getClientNew(){
|
||||
success: function (e, a) {
|
||||
app_shop.fn.load(
|
||||
"place-order.php",
|
||||
[["#cop_seection1", "#cop_seection1"]],
|
||||
[["#bm-oscop-section1", "#bm-oscop-section1"]],
|
||||
function () {
|
||||
history.go(-1);
|
||||
},
|
||||
@@ -639,8 +642,8 @@ function handleShowSigninModalFromEmailModal(e){
|
||||
showSigninModal();
|
||||
}
|
||||
|
||||
// EventListener zmian w kontenerze cop_seection1
|
||||
document.getElementById("cop_seection1").addEventListener("change", (e) => {
|
||||
// EventListener zmian w kontenerze bm-oscop-section1
|
||||
document.getElementById("bm-oscop-section1").addEventListener("change", (e) => {
|
||||
const validateRequestId = ["client_zipcode", "delivery_zipcode", "client_nip", "client_email"];
|
||||
const notEmptyFieldsId = ["client_firstname", "client_lastname", "client_city", "delivery_firstname", "delivery_lastname", "delivery_city", "client_firm"];
|
||||
|
||||
@@ -658,17 +661,13 @@ document.getElementById("cop_seection1").addEventListener("change", (e) => {
|
||||
|
||||
// Walidacja ulicy i numeru domu
|
||||
if(e.target.id === "client_street" || e.target.id === "delivery_street") validateStreet(e.target);
|
||||
|
||||
// Walidacja numeru telefonu
|
||||
if(e.target.id === "client_phone" || e.target.id === "delivery_phone") validatePhone(e.target);
|
||||
|
||||
// Walidacja loginu i hasła rejestracji
|
||||
if(e.target.classList.contains("register__login")) testLogin();
|
||||
if(e.target.classList.contains("register__password")) testPassword();
|
||||
|
||||
// Walidacja imienia nazwiska miasta i firmy(wymagające po prostu nie bycia pustym)
|
||||
if(notEmptyFieldsId.includes(e.target.id)) validateNotEmpty(e.target);
|
||||
|
||||
// Sprawdzenie czy firma w dostawie na inny adres została wpisana
|
||||
if(e.target.id === "delivery_additional"){
|
||||
if(e.target.value.length > 0) addSuccess(e.target);
|
||||
@@ -830,13 +829,12 @@ function getNewPaymentsAndDeliveries(data = null) {
|
||||
|
||||
// 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
|
||||
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");
|
||||
if(previousDeliveries) previousDeliveries.remove();
|
||||
document.querySelector(".ajax_cop .step2_sub").insertAdjacentHTML("beforeend",deliveryMarkup);
|
||||
document.getElementById("bm-oscop-deliveries").insertAdjacentHTML("beforeend",deliveryMarkup);
|
||||
|
||||
// Stworzenie metod płatności
|
||||
let prepaidsMethodMarkup = "";
|
||||
@@ -874,7 +872,7 @@ function getNewPaymentsAndDeliveries(data = null) {
|
||||
ifPaymentCard = true;
|
||||
}
|
||||
else{
|
||||
prepaidsMethodMarkup += markup;
|
||||
prepaidsMethodMarkup += markup;
|
||||
// Okienko vouchera
|
||||
if(method.id === 2){
|
||||
prepaidsMethodMarkup += `
|
||||
@@ -900,8 +898,8 @@ function getNewPaymentsAndDeliveries(data = null) {
|
||||
}
|
||||
}
|
||||
});
|
||||
prepaidsTransferMarkup +="</div></div></label>";
|
||||
prepaidsCardMarkup +="</div></div></label>";
|
||||
prepaidsTransferMarkup += "</div></div></label>";
|
||||
prepaidsCardMarkup += "</div></div></label>";
|
||||
|
||||
// Dołączenie metody płatność przy odbiorze
|
||||
if(e.dvp.length) prepaidsMethodMarkup += `
|
||||
@@ -918,7 +916,7 @@ function getNewPaymentsAndDeliveries(data = null) {
|
||||
// Wstawienie metod płatności na stronę
|
||||
const previousPayments = document.getElementById("osc_prepaids_method");
|
||||
if(previousPayments) previousPayments.remove();
|
||||
document.querySelector(".ajax_cop #checkout_step3_1 .step3_sub").insertAdjacentHTML("beforeend", `<div id="osc_prepaids_method"> ${ifPaymentTransfer ? prepaidsTransferMarkup : ""}${ifPaymentCard ? prepaidsCardMarkup : ""}${prepaidsMethodMarkup}</div>`);
|
||||
document.getElementById("bm-oscop-payments").insertAdjacentHTML("beforeend", `<div id="osc_prepaids_method"> ${ifPaymentTransfer ? prepaidsTransferMarkup : ""}${ifPaymentCard ? prepaidsCardMarkup : ""}${prepaidsMethodMarkup}</div>`);
|
||||
|
||||
// Wstawienie błędu jeśli metody płatności są puste
|
||||
const currentPayments = document.getElementById("osc_prepaids_method");
|
||||
@@ -932,7 +930,7 @@ function getNewPaymentsAndDeliveries(data = null) {
|
||||
|
||||
// Wstawienie pickuppoint jeśli edycja i istnieje
|
||||
if(data?.pickupData !== undefined && data?.pickupData !== null){
|
||||
const selectedShipping = document.querySelector(`#cop_seection2 input#${deliveryId}`);
|
||||
const selectedShipping = document.querySelector(`#bm-oscop-section2 input#${deliveryId}`);
|
||||
const pointExists = await checkPrevPickupPoint(
|
||||
selectedShipping.parentElement.querySelector(".fselectedPoint"),
|
||||
data.pickupData.id,
|
||||
@@ -1007,7 +1005,7 @@ changeDeliveryInfoObject(deliveryDateInfo, prevDeliveryInput);
|
||||
// Stworzenie kontenera na "przelewy online" lub "karta platnicza"
|
||||
function createPaymentContainerMarkup(method){
|
||||
const operationName = method === "transfer" ? <iai:variable vid="Przelew online"/> : <iai:variable vid="Karta płatnicza"/>;
|
||||
const methodName = method === "transfer" ? <iai:variable vid="banków"/> : <iai:variable vid="kart płatniczych"/>;
|
||||
const methodName = method === "transfer" ? "banków" : "kart płatniczych";
|
||||
return `<label class="osc_item" for="payitem_${method}">
|
||||
<input id="payitem_${method}" value="no_${method}" type="radio" name="payform_id" data-group="${method}"/>
|
||||
<div class="photo">
|
||||
@@ -1017,8 +1015,8 @@ function createPaymentContainerMarkup(method){
|
||||
<span>${operationName}</span>
|
||||
</div>
|
||||
<div class="osc_item-modal ${method}__methods">
|
||||
<h2>${<iai:variable vid="Lista"/>} ${methodName}</h2>
|
||||
<span>${<iai:variable vid="Wybierz z"/>} ${methodName}</span>
|
||||
<h2>Lista ${methodName}</h2>
|
||||
<span>Wybierz z ${methodName}</span>
|
||||
<div class="payments-container">`;
|
||||
}
|
||||
|
||||
@@ -1111,7 +1109,7 @@ function changeCurrentShippingInfo(shippingMethod){
|
||||
calculateDeliveryDate(shippingMethod.value, shippingMethod.dataset.delivery, shippingMethod.dataset.pickuppoint);
|
||||
app_shop.vars.checkedShipping = shippingMethod.value;
|
||||
}
|
||||
document.getElementById("cop_seection2").addEventListener("click", e => {
|
||||
document.getElementById("bm-oscop-section2").addEventListener("click", e => {
|
||||
// Kliknięcie na dostawe
|
||||
if(e.target.name === "shipping"){
|
||||
// Wyczyszczenie wszystkich zaznaczonych punktów odbioru
|
||||
@@ -1187,7 +1185,7 @@ function removePrevClone(){
|
||||
const prevClone = document.querySelector(".osc_item-clone");
|
||||
if(!prevClone) return;
|
||||
const cloneGroupName = prevClone.querySelector("input").dataset.group;
|
||||
document.getElementById(`payitem_${cloneGroupName}`).closest(".osc_item").style.display="flex";
|
||||
document.getElementById(`payitem_${cloneGroupName}`).closest(".osc_item").style.display="grid";
|
||||
prevClone.remove();
|
||||
}
|
||||
|
||||
@@ -1248,7 +1246,7 @@ function changeDeliveryOptions(){
|
||||
if(document.getElementById("payitem_cash") && document.getElementById("payitem_cash").checked) changePrepaidDvp("none", "block");
|
||||
else changePrepaidDvp("block", "none");
|
||||
|
||||
document.querySelectorAll("#checkout_step2_1 input").forEach((el) => el.checked = false);
|
||||
document.querySelectorAll("#bm-oscop-deliveries input").forEach((el) => el.checked = false);
|
||||
app_shop.vars.checkedShipping = "";
|
||||
calculateBasketCost();
|
||||
}
|
||||
@@ -1323,10 +1321,11 @@ function calculateBasketCost() {
|
||||
const deliveryCostEl = document.querySelector("#order2_shipping_value .operation_value");
|
||||
const productsPointsEl = document.querySelector("#order2_products_points .operation_value");
|
||||
const summaryPointsEl = document.getElementById("summary-points");
|
||||
const attatchedSummaryPointsEl = document.getElementById("attatched-points");
|
||||
// Przygotowanie informacji o metodzie dostawy i platnosci
|
||||
const orderInfo = {
|
||||
delivery: document.querySelector('.ajax_cop input[name="shipping"]:checked') ? document.querySelector('.ajax_cop input[name="shipping"]:checked').value : "0-1",
|
||||
payform_id: document.querySelector('.ajax_cop input[name="payform_id"]:checked') ? document.querySelector('.ajax_cop input[name="payform_id"]:checked').value : "cash"
|
||||
delivery: document.querySelector('.bm-oscop__container input[name="shipping"]:checked') ? document.querySelector('.bm-oscop__container input[name="shipping"]:checked').value : "0-1",
|
||||
payform_id: document.querySelector('.bm-oscop__container input[name="payform_id"]:checked') ? document.querySelector('.bm-oscop__container input[name="payform_id"]:checked').value : "cash"
|
||||
}
|
||||
xhrs && 4 != xhrs.readyState && 0 != xhrs.readyState && xhrs.abort(),
|
||||
xhrs = $.ajax({
|
||||
@@ -1362,13 +1361,17 @@ function calculateBasketCost() {
|
||||
productsPointsEl.parentElement.style.display = "flex";
|
||||
summaryPointsEl.innerHTML = `+ ${t.products_worth_at_points} ${<iai:variable vid="pkt"/>}.`;
|
||||
summaryPointsEl.style.display = "block";
|
||||
attatchedSummaryPointsEl.innerHTML = `+ ${t.products_worth_at_points} ${<iai:variable vid="pkt"/>}.`;
|
||||
attatchedSummaryPointsEl.style.display = "block";
|
||||
}else {
|
||||
productsPointsEl.parentElement.style.display = "none";
|
||||
summaryPointsEl.style.display = "none";
|
||||
attatchedSummaryPointsEl.style.display = "none";
|
||||
}
|
||||
|
||||
// Cena całkowita
|
||||
document.getElementById("summary-cost").innerHTML = formatPrice(t.total_to_pay, t.currency_sign) + "<small>" + <iai:variable vid="brutto"/> + "</small>";
|
||||
document.getElementById("attatched-cost").innerHTML = formatPrice(t.total_to_pay, t.currency_sign);
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -1388,17 +1391,34 @@ function formatPrice(price, currencySign) {
|
||||
// Funkcja od ustalenia daty dostawy
|
||||
function calculateDeliveryDate(deliveryVal, delivery, pickuppoint) {
|
||||
const deliveryMessageEl = document.querySelector("#order2_shiptime span:not(.operation_value)");
|
||||
const attatchedMessageEl = document.querySelector("#attatched-shiptime span:not(.operation_value)");
|
||||
const deliveryDateEl = document.querySelector("#order2_shiptime .operation_value");
|
||||
const attatchedDateEl = document.querySelector("#attatched-shiptime .operation_value");
|
||||
const date = delivery.split("#");
|
||||
|
||||
// Wybranie nazwy zaleznie czy dostawa jest do twojego mieszkania czy nie
|
||||
if(deliveryVal === "0-0" || deliveryVal === "0-1" || pickuppoint === "y") deliveryMessageEl.innerHTML = `${<iai:variable vid="Odbiór zamówienia możliwy"/>}:`;
|
||||
else deliveryMessageEl.innerHTML = `${<iai:variable vid="Przesyłka powinna być u Ciebie"/>}:`;
|
||||
if(deliveryVal === "0-0" || deliveryVal === "0-1" || pickuppoint === "y"){
|
||||
deliveryMessageEl.innerHTML = `${<iai:variable vid="Odbiór zamówienia możliwy"/>}:`;
|
||||
attatchedMessageEl.innerHTML = `${<iai:variable vid="Odbiór zamówienia możliwy"/>}:`;
|
||||
}
|
||||
else{
|
||||
deliveryMessageEl.innerHTML = `${<iai:variable vid="Przesyłka powinna być u Ciebie"/>}:`;
|
||||
attatchedMessageEl.innerHTML = `${<iai:variable vid="Przesyłka powinna być u Ciebie"/>}:`;
|
||||
}
|
||||
|
||||
if(date[4]>0) deliveryDateEl.innerHTML = `${<iai:variable vid="za"/>} ` + parseInt(date[5]) + ` ${<iai:variable vid="dni"/>} `;
|
||||
if(date[4]>0) {
|
||||
deliveryDateEl.innerHTML = `${<iai:variable vid="za"/>} ` + parseInt(date[5]) + ` ${<iai:variable vid="dni"/>} `;
|
||||
attatchedDateEl.innerHTML = `${<iai:variable vid="za"/>} ` + parseInt(date[5]) + ` ${<iai:variable vid="dni"/>} `;
|
||||
}
|
||||
else{
|
||||
if(parseInt(date[5]) === 0) deliveryDateEl.innerHTML = <iai:variable vid="Dzisiaj"/>;
|
||||
else deliveryDateEl.innerHTML = orderTxt[`shipping${parseInt(date[3])}`];
|
||||
if(parseInt(date[5]) === 0){
|
||||
deliveryDateEl.innerHTML = <iai:variable vid="Dzisiaj"/>;
|
||||
attatchedDateEl.innerHTML = <iai:variable vid="Dzisiaj"/>;
|
||||
}
|
||||
else{
|
||||
deliveryDateEl.innerHTML = orderTxt[`shipping${parseInt(date[3])}`];
|
||||
attatchedDateEl.innerHTML = orderTxt[`shipping${parseInt(date[3])}`];
|
||||
}
|
||||
}
|
||||
};
|
||||
// Zmiana informacji o dostawie
|
||||
@@ -1409,8 +1429,8 @@ function changeDeliveryInfoObject(deliveryObject, deliveryElement){
|
||||
}
|
||||
|
||||
// Obsługa klilnięć na elementy w podsumowaniu
|
||||
document.getElementById("cop_seection3").addEventListener("click", (e) => {
|
||||
const productsContainer = document.getElementById("checkout_step3_3");
|
||||
document.getElementById("bm-oscop-section3").addEventListener("click", (e) => {
|
||||
const productsContainer = document.querySelector(".summary__container");
|
||||
|
||||
// Kliknięcie na przyciski "Pokaż pozozostałe produkty" i "Zwiń listę"
|
||||
const togggleProducts = e.target.closest(".order_products_action");
|
||||
@@ -1422,40 +1442,98 @@ document.getElementById("cop_seection3").addEventListener("click", (e) => {
|
||||
productsContainer.classList.add("--more");
|
||||
togggleProducts.querySelector("span").innerHTML = `${<iai:variable vid="Zwiń listę"/>}`;
|
||||
}
|
||||
checkIfShowAttatched();
|
||||
return;
|
||||
}
|
||||
|
||||
// Kliknięcie na checkbox(nie zaznacz wszystkie i nie kod rabatowy)
|
||||
if(e.target.type === "checkbox" && e.target.id !== "checkall-terms" && e.target.id !== "rebate_option"){
|
||||
if(e.target.type === "checkbox" && e.target.id !== "checkall-terms" && e.target.id !== "rebate-option"){
|
||||
document.querySelector(".bm-oscop__attatched-checkbox").classList.remove("--error");
|
||||
|
||||
const checkboxAllTerms = document.getElementById("checkall-terms");
|
||||
if(e.target.checked === false) checkboxAllTerms.checked = false;
|
||||
const attatchedcheckboxAllTerms = document.getElementById("attatched-checkall-terms");
|
||||
if(e.target.checked === false) {
|
||||
checkboxAllTerms.checked = false;
|
||||
attatchedcheckboxAllTerms.checked = false;
|
||||
// usuniecie bledu jesli jest na przyczepionym przycisku zakupowym
|
||||
document.querySelector(".bm-oscop__attatched-checkbox").classList.remove("--error");
|
||||
}
|
||||
else{
|
||||
const termsInputs = document.querySelectorAll(".order2_terms_wrapper input:not(#checkall-terms)");
|
||||
let checkedCount = 0;
|
||||
termsInputs.forEach(el => el.checked === true ? checkedCount++ : "");
|
||||
if(checkedCount === termsInputs.length) checkboxAllTerms.checked = true;
|
||||
if(checkedCount === termsInputs.length) {
|
||||
checkboxAllTerms.checked = true;
|
||||
attatchedcheckboxAllTerms.checked = true;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Kliknięcie na przycisk "Zaznacz wszystkie"
|
||||
if(e.target.id === "checkall-terms"){
|
||||
const termsInputs = document.querySelectorAll(".order2_terms_wrapper input:not(#checkall-terms)");
|
||||
let checkAll = false;
|
||||
|
||||
termsInputs.forEach(el => el.checked === false ? checkAll = true : "");
|
||||
termsInputs.forEach(function (el) {
|
||||
if(checkAll) el.checked = true;
|
||||
else el.checked = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(e.target.id === "checkall-terms") return toggleAllTerms();
|
||||
|
||||
// Usuń error na regulaminie
|
||||
if(e.target.id === "order2_terms_conditions" || e.target.id === "order2_cancel"){
|
||||
e.target.parentElement.querySelector("span").classList.remove("text-danger");
|
||||
e.target.parentElement.querySelector("a").classList.remove("text-danger");
|
||||
}
|
||||
})
|
||||
});
|
||||
function toggleAllTerms(){
|
||||
removeErrorOnTerms();
|
||||
|
||||
const termsInputs = document.querySelectorAll(".order2_terms_wrapper input:not(#checkall-terms)");
|
||||
let checkAll = false;
|
||||
|
||||
termsInputs.forEach(el => el.checked === false ? checkAll = true : "");
|
||||
termsInputs.forEach(function (el) {
|
||||
el.checked = checkAll;
|
||||
});
|
||||
|
||||
document.getElementById("checkall-terms").checked = checkAll;
|
||||
document.getElementById("attatched-checkall-terms").checked = checkAll;
|
||||
}
|
||||
|
||||
function removeErrorOnTerms(){
|
||||
document.querySelector(".bm-oscop__attatched-checkbox").classList.remove("--error");
|
||||
document.querySelector(".order2_terms_conditions span").classList.remove("text-danger");
|
||||
document.querySelector(".order2_terms_conditions a").classList.remove("text-danger");
|
||||
document.querySelector(".order2_cancel span").classList.remove("text-danger");
|
||||
document.querySelector(".order2_cancel a").classList.remove("text-danger");
|
||||
}
|
||||
|
||||
// PRZYCISK ZAKUPU PRZYTWIERDZONY NA DÓŁ STRONY
|
||||
function checkIfShowAttatched(){
|
||||
const attatchedEl = document.querySelector("#attatched-summary .bm-oscop__attatched-container");
|
||||
const summaryCheckAllPos = document.getElementById("checkall-terms").getBoundingClientRect();
|
||||
// Sprawdzenie czy pokazać przytwierdzony przycisk do zakupu
|
||||
|
||||
if(summaryCheckAllPos.top >= window.innerHeight - attatchedEl.offsetHeight){
|
||||
attatchedEl.style.opacity = "1";
|
||||
attatchedEl.closest("#attatched-summary").style.zIndex = "30";
|
||||
}
|
||||
else{
|
||||
attatchedEl.style.opacity = "0";
|
||||
attatchedEl.closest("#attatched-summary").style.zIndex = "-1";
|
||||
}
|
||||
|
||||
// Sprawdzenie czy pokazywać cenę
|
||||
const summaryEl = document.querySelector(".order2_summary");
|
||||
|
||||
// Przeliczana wysokość elementu przytwierdzonego przycisku zakupu na wypadek gdyby cena miała display: none
|
||||
const attatchedElHeight = attatchedEl.querySelector(".bm-oscop__attatched-price").style.display === "none" ? (summaryEl.offsetHeight + attatchedEl.offsetHeight) : attatchedEl.offsetHeight
|
||||
|
||||
if(summaryEl.getBoundingClientRect().top >= window.innerHeight - attatchedElHeight){
|
||||
attatchedEl.querySelector(".bm-oscop__attatched-price").style.display = "block";
|
||||
}else{
|
||||
attatchedEl.querySelector(".bm-oscop__attatched-price").style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("scroll", e=>{
|
||||
checkIfShowAttatched()
|
||||
});
|
||||
document.getElementById("attatched-checkall-terms").addEventListener("click", toggleAllTerms);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// KOD RABATOWY (funkcje)
|
||||
@@ -1485,7 +1563,7 @@ const DEACTIVATE_REBATE_CODE = () => JSON.stringify({
|
||||
})
|
||||
|
||||
// Aktywacja kodu rabatowego
|
||||
const rebateCode = document.getElementById("rebate_code");
|
||||
const rebateCode = document.getElementById("rebate-code");
|
||||
async function updateCode(){
|
||||
if(rebateCode.value.trim() === ""){
|
||||
addError(rebateCode);
|
||||
@@ -1513,7 +1591,7 @@ async function updateCode(){
|
||||
// Pokazanie błędu
|
||||
const { message } = rebateStatus?.data?.activateRebateCode?.error;
|
||||
addError(rebateCode);
|
||||
addErrorMessage(rebateCode, <iai:variable vid="Podany kod rabatowy nie istnieje"/>);
|
||||
addErrorMessage(rebateCode, message);
|
||||
// Schowaj kod (show=false, error=true)
|
||||
toggleActiveCode(false, true);
|
||||
}
|
||||
@@ -1556,7 +1634,7 @@ function toggleActiveCode(show, error=false){
|
||||
// Zmień wartości
|
||||
activeCodeEl.innerHTML = show ? rebateCode.value : "";
|
||||
showInput = error ? true : false;
|
||||
document.getElementById("rebate_option").checked = error ? true : false;
|
||||
document.getElementById("rebate-option").checked = error ? true : false;
|
||||
if(!error) rebateCode.value = "";
|
||||
else activeCodeEl.innerHTML = "";
|
||||
}
|
||||
@@ -1565,7 +1643,7 @@ function toggleActiveCode(show, error=false){
|
||||
let showInput = false;
|
||||
document.querySelector(".rebate").addEventListener("click", (e) => {
|
||||
// Rozwinięcie opcji rabatowej
|
||||
if(e.target.id === "rebate_option" || e.target.classList.contains("rebate__active_change")){
|
||||
if(e.target.id === "rebate-option" || e.target.classList.contains("rebate__active-change")){
|
||||
showInput = !showInput;
|
||||
if(showInput) rebateCodeContainer.classList.add("--fade-in");
|
||||
else rebateCodeContainer.classList.remove("--fade-in");
|
||||
@@ -1573,7 +1651,7 @@ document.querySelector(".rebate").addEventListener("click", (e) => {
|
||||
|
||||
// Kliknięcie na zrealizuj i dezaktywuj
|
||||
if(e.target.className.includes("rebate__code-realize")) updateCode();
|
||||
if(e.target.classList.contains("rebate__active_remove")) removeCode();
|
||||
if(e.target.classList.contains("rebate__active-remove")) removeCode();
|
||||
});
|
||||
|
||||
|
||||
@@ -1627,19 +1705,23 @@ async function validateFormInputs(query){
|
||||
}
|
||||
|
||||
// Obsługa złożenia zamówienia
|
||||
document.querySelector(".order2_button_order").addEventListener("click", async () => {
|
||||
document.querySelectorAll(".order2_button_order").forEach(btnEl=>{
|
||||
btnEl.addEventListener("click", handleBuyOnClick);
|
||||
})
|
||||
|
||||
async function handleBuyOnClick(){
|
||||
const termsConditionsInput = document.getElementById("order2_terms_conditions");
|
||||
const cancelConditionsInput = document.getElementById("order2_cancel");
|
||||
try {
|
||||
app_shop.fn.ajaxLoadSite(1);
|
||||
app_shop.vars.validation = 1;
|
||||
// Sprawdzenie pól formularza
|
||||
const x = await validateAllInputs();
|
||||
if(x === false) app_shop.vars.validation = 0;
|
||||
const allInputsCorrectlyValidated = await validateAllInputs();
|
||||
if(allInputsCorrectlyValidated === false) app_shop.vars.validation = 0;
|
||||
|
||||
// Znalezienie obecnie zaznaczonej metody dostawy i płatności
|
||||
const deliveryMethod = document.querySelector(".ajax_cop [name=shipping]:checked");
|
||||
const paymentMethod = document.querySelector(".ajax_cop [name=payform_id]:checked");
|
||||
const deliveryMethod = document.querySelector(".bm-oscop__container [name=shipping]:checked");
|
||||
const paymentMethod = document.querySelector(".bm-oscop__container [name=payform_id]:checked");
|
||||
|
||||
// Sprawdzenie czy użytkownik zaakceptował regulamin
|
||||
if(!termsConditionsInput.checked || !cancelConditionsInput.checked){
|
||||
@@ -1675,25 +1757,29 @@ document.querySelector(".order2_button_order").addEventListener("click", async (
|
||||
let alertMessage = "";
|
||||
|
||||
// Element sprawdzający czy regulamin jest zaznaczony
|
||||
let termsAndConditions = termsConditionsInput.checked && cancelConditionsInput.checked;
|
||||
if(!termsAndConditions) alertMessage += `${<iai:variable vid="Zatwierdź"/>} ${<iai:variable vid="53833_terms_001a"/>}!<br/>`;
|
||||
const termsAndConditions = termsConditionsInput.checked && cancelConditionsInput.checked;
|
||||
if(!termsAndConditions){
|
||||
document.querySelector(".bm-oscop__attatched-checkbox").classList.add("--error");
|
||||
alertMessage += `${<iai:variable vid="Zatwierdź"/>} ${<iai:variable vid="Regulamin"/>}!<br/>`;
|
||||
}
|
||||
// Sprawdź metodę płatności i dostawy(scrollowanie do formularza ważniejsze)
|
||||
if(!document.querySelector(`input[name="shipping"]:checked`)){
|
||||
scrolledToElement = errorEl || document.querySelector("#bm-oscop-deliveries h2");
|
||||
alertMessage += `${<iai:variable vid="Proszę wybrać dostępną metodę dostawy"/>}<br/>`;
|
||||
}
|
||||
if(!document.querySelector(`input[name="payform_id"]:checked`)){
|
||||
scrolledToElement = errorEl || document.querySelector("#bm-oscop-payments h2");
|
||||
alertMessage += `${<iai:variable vid="Proszę wybrać metodę płatności"/>}<br/>`;
|
||||
}
|
||||
// Błąd w formularzu
|
||||
if(errorEl){
|
||||
scrolledToElement = errorEl;
|
||||
alertMessage += `${<iai:variable vid="W formularzu wystąpiły błędy"/>}<br/>`;
|
||||
}// Sprawdź metodę płatności i dostawy(scrollowanie do formularza ważniejsze)
|
||||
if(!document.querySelector(`input[name="payform_id"]:checked`)){
|
||||
scrolledToElement = errorEl || document.querySelector("#checkout_step3_1 h2");
|
||||
alertMessage += `${<iai:variable vid="Proszę wybrać metodę płatności"/>}<br/>`;
|
||||
}
|
||||
if(!document.querySelector(`input[name="shipping"]:checked`)){
|
||||
scrolledToElement = errorEl || document.querySelector("#checkout_step2_1 h2");
|
||||
alertMessage += `${<iai:variable vid="Proszę wybrać dostępną metodę dostawy"/>}`;
|
||||
|
||||
alertMessage += `${<iai:variable vid="W formularzu wystąpiły błędy"/>}`;
|
||||
}
|
||||
|
||||
// Jeśli użytkownik zatwierdził regulamin, przescrolluj do elementu z błędem
|
||||
if(termsAndConditions) scrollToHeight(scrolledToElement);
|
||||
if(scrolledToElement) scrollToHeight(scrolledToElement);
|
||||
|
||||
|
||||
// Pokaż error i przerwij składanie zamówienia
|
||||
Alertek.show_alert(alertMessage);
|
||||
@@ -1712,13 +1798,15 @@ document.querySelector(".order2_button_order").addEventListener("click", async (
|
||||
console.log(e);
|
||||
alert("blad");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Przescrolluj do
|
||||
function scrollToHeight(scrollToEl){
|
||||
let yOffset = -45;
|
||||
if(app_shop.vars.view === 1) yOffset = -100;
|
||||
if(app_shop.vars.view === 2) yOffset = -75;
|
||||
const y = scrollToEl.getBoundingClientRect().top + window.pageYOffset + yOffset;
|
||||
|
||||
window.scrollTo({top: y, behavior: 'smooth'});
|
||||
}
|
||||
|
||||
@@ -1734,7 +1822,7 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
// Weź dane klienta
|
||||
const email = document.getElementById("client_email").value;
|
||||
const phone = document.getElementById("client_phone").value;
|
||||
const clientType = document.querySelector('.ajax_cop [name="client_type"]:checked').value;
|
||||
const clientType = document.querySelector('.bm-oscop__container [name="client_type"]:checked').value;
|
||||
const firmname = clientType === "firm" ? document.getElementById("client_firm").value : "";
|
||||
const nip = clientType === "firm" ? document.getElementById("client_nip").value : "";
|
||||
let firstname = document.getElementById("client_firstname").value;
|
||||
@@ -1767,7 +1855,7 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
else rebateCode = "";
|
||||
|
||||
let voucherCode;
|
||||
if(document.querySelector(".ajax_cop #payitem_2") && document.querySelector(".ajax_cop #payitem_2").checked) voucherCode = document.querySelector(".ajax_cop #order_voucher_id").value;
|
||||
if(document.querySelector(".bm-oscop__container #payitem_2") && document.querySelector(".bm-oscop__container #payitem_2").checked) voucherCode = document.querySelector(".bm-oscop__container #order_voucher_id").value;
|
||||
|
||||
// Jeśli zalogowany użytkownik jest firmą i nie ma imienia i nazwiska
|
||||
if (clientType.disabled && clientType.value === "firm") {
|
||||
@@ -1780,8 +1868,8 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
lastname = lastname.replace(/[&\/\\#,+()$~%.'":*?<>{}!@~`^_]/g, "");
|
||||
|
||||
// Dodatkowe informacje (uwagi, faktura, punkt odbioru)
|
||||
const shopRemarks = document.getElementById("shop_remarks").checked ? document.querySelector(".ajax_cop [name=remarks]").value : "";
|
||||
const deliveryRemarks = document.getElementById("courier_remarks").checked ? document.querySelector(".ajax_cop [name=deliverer_remarks]").value : "";
|
||||
const shopRemarks = document.getElementById("shop_remarks").checked ? document.querySelector(".bm-oscop__container [name=remarks]").value : "";
|
||||
const deliveryRemarks = document.getElementById("courier_remarks").checked ? document.querySelector(".bm-oscop__container [name=deliverer_remarks]").value : "";
|
||||
|
||||
const invoiceOption = document.querySelector("input[name=invoice]:checked").value;
|
||||
const pickuppoint = document.querySelector("#osc_order1 input:checked").dataset.pickuppoint === "y" ? document.querySelector("#osc_order1 input:checked").parentElement.querySelector("label [name=pickup_point]").value : "";
|
||||
@@ -1857,7 +1945,7 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
}
|
||||
|
||||
function checkNewsletter(logged, regular){
|
||||
if(document.querySelector(`.ajax_cop [name=${logged}]`)) return document.querySelector(`.ajax_cop [name=${logged}]`).value ? 1 : 0;
|
||||
if(document.querySelector(`.bm-oscop__container [name=${logged}]`)) return document.querySelector(`.bm-oscop__container [name=${logged}]`).value ? 1 : 0;
|
||||
else if(document.querySelector(regular)) return document.querySelector(regular).checked ? 1 : 0;
|
||||
else return 0;
|
||||
}
|
||||
@@ -2025,13 +2113,13 @@ function enablePageScroll(){
|
||||
app_shop.fn.load = function(_url,target,callback,paramets) {
|
||||
if(app_shop.vars.xhr && app_shop.vars.xhr.readystate != 4) app_shop.vars.xhr.abort();
|
||||
$(target).addClass('load-content');
|
||||
for(var i=0; target.length > i ; i++) $(target[i][0]).addClass('load-content');
|
||||
for(let i=0; target.length > i ; i++) $(target[i][0]).addClass('load-content');
|
||||
|
||||
app_shop.vars.xhr = $.ajax({
|
||||
url: _url+paramets,
|
||||
timeout: 16000,
|
||||
success: function(data,textStatus) {
|
||||
for(var i=0; target.length > i ; i++) $(target[i][0]).removeClass('load-content').html($(data).find(target[i][1]).html());
|
||||
for(let i=0; target.length > i ; i++) $(target[i][0]).removeClass('load-content').html($(data).find(target[i][1]).html());
|
||||
app_shop.fn.change_url(_url);
|
||||
app_shop.fn.evalJSFromHtml(data);
|
||||
if(callback) callback();
|
||||
@@ -2043,15 +2131,10 @@ app_shop.fn.load = function(_url,target,callback,paramets) {
|
||||
return app_shop.vars.xhr;
|
||||
};
|
||||
function throwAjaxError(e) {
|
||||
-1 !== $.inArray(e, ["nocontent", "error", "timeout", "abort", "parsererror"]) && (console.log("Error:" + e), Alertek.show_alert( `${<iai:variable vid="Błąd podczas logowania, proszę spróbować ponownie"/>}` + " (" + e + ": " + $.now() + ")"), $.cookie("off_opc", !0));
|
||||
-1 !== $.inArray(e, ["nocontent", "error", "timeout", "abort", "parsererror"]) && (console.log("Error:" + e), Alertek.show_alert( "Błąd podczas logowania, proszę spróbować ponownie" + " (" + e + ": " + $.now() + ")"), $.cookie("off_opc", !0));
|
||||
};
|
||||
async function fetchData(options = {}) {
|
||||
const {
|
||||
data,
|
||||
link,
|
||||
linkParameter = '',
|
||||
alert = true
|
||||
} = options;
|
||||
const {data,link,linkParameter = '',alert = true} = options;
|
||||
if (!data) return false;
|
||||
try {
|
||||
const response = await fetch(`${link || app_shop.urls.graphql || '/graphql/v1/'}${linkParameter}`, {
|
||||
@@ -2084,7 +2167,7 @@ function initOSCOP(){
|
||||
// Element z numerem edycji jeśli jest
|
||||
const editNumber = document.getElementById("edit-number");
|
||||
|
||||
if(document.querySelector(".ajax_cop").childElementCount && !editNumber) changeRegion(null);
|
||||
if(document.querySelector(".bm-oscop__container").childElementCount && !editNumber) changeRegion(null);
|
||||
|
||||
// Jeśli edycja zamówienia uzupełnij dane (niewiadomo jak z voucherem bo go się nie da edytować)
|
||||
if(editNumber){
|
||||
@@ -2168,7 +2251,6 @@ function initOSCOP(){
|
||||
|
||||
// Pobranie danych o edytowanym zamówieniu
|
||||
async function getEditData(){
|
||||
|
||||
const data = await fetchData({
|
||||
data: ORDER_DETAILS(`OrderDetailsInput: {
|
||||
orderNumber: ${editNumber.value},
|
||||
@@ -2204,7 +2286,7 @@ function initOSCOP(){
|
||||
if(differentDelivery){
|
||||
// Pokazanie formularza dodatkowej dostawy
|
||||
document.getElementById("deliver_to_billingaddr").checked = true;
|
||||
document.querySelector(".ajax_cop #client_new_additional .delivery_box.cn_wrapper").classList.add("--more");
|
||||
document.querySelector(".bm-oscop__container #client_new_additional .delivery_box.cn_wrapper").classList.add("--more");
|
||||
document.querySelector(".delivery__address-list-button").classList.add("--fade-in");
|
||||
|
||||
fillInput(document.getElementById("delivery_firstname"), orderDetails.client.deliveryData.firstname);
|
||||
@@ -2244,5 +2326,8 @@ function initOSCOP(){
|
||||
input.parentElement.classList.add("--success", "has-success");
|
||||
}
|
||||
}
|
||||
|
||||
// Sprawdzenie czy schować przyczepiony przycisk od zakupu
|
||||
checkIfShowAttatched()
|
||||
}
|
||||
initOSCOP();
|
||||
Reference in New Issue
Block a user