Powiększenie wysokości toggle password
This commit is contained in:
12
README.md
12
README.md
@@ -40,19 +40,21 @@ Trzeba je później podmienić w kodzie w Wydzielonym Javascript na np.:
|
||||
- Zablokowana edycja danych osobowych w trakcie zamówienia(klient dalej może wysłać zamówienie na inny adres).
|
||||
- Zmiana sposobów dostaw zależnie od państwa(Czasami się buguje, może to być zależne od plików cookies)
|
||||
- Sprawdzenie czy wpisano dobry bon towarowy przed złożeniem zamówienia
|
||||
- lepiej zabezpieczony numer telefonu(na standardzie to +2+++++++++1 przejdzie)
|
||||
- autouzupełnianie metod płatności i dostawy w edycji
|
||||
- autouzupełnianie metod płatności i dostawy na podstawie poprzednio wykonanego zakupu
|
||||
- Lepiej zabezpieczony numer telefonu(na standardzie to +2+++++++++1 przejdzie)
|
||||
- Autouzupełnianie metod płatności i dostawy w edycji
|
||||
- Autouzupełnianie metod płatności i dostawy na podstawie poprzednio wykonanego zakupu
|
||||
|
||||
### Wady ###
|
||||
- nie ma faktury na inne dane(żeby nie używać tego samego zapytania co OSCOP Idosella, na wszelki wypadek żeby nie pobierało opłat)
|
||||
- Nie ma faktury na inne dane(żeby nie używać tego samego zapytania co OSCOP Idosella, na wszelki wypadek żeby nie pobierało opłat)
|
||||
|
||||
### Dodatkowe pomysły do zrealizowania ###
|
||||
- sprawdzanie logina w trakcie pisania(może być słabe dla ochrony danych klienta)
|
||||
- Sprawdzanie logina w trakcie pisania(może być słabe dla ochrony danych klienta)
|
||||
- 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.
|
||||
- Na mobilce przyklejenie zamów na dół ekranu na wypadek gdyby zalogowany użytkownik miał już wybrany punkt odbioru
|
||||
- Przekreślona cena|Omnibus w wypadku gdy produkt jest w promocji
|
||||
|
||||
### Uwagi ###
|
||||
- Długie zdjęcia produktu źle wyglądają(najlepsze kwadratowe)
|
||||
- W przypadku edycji zamówienia z zapłatą za pobraniem nie można pobrać danych takiego zamówienia przed dokonaniem zapłaty. Idosell sprawdza ten problem w komunikacie na zooart6.
|
||||
- Dziwna rzecz którą zauważyłem. Jak składasz zamówienie wraz z zakładaniem konta, ale okazuje się że brakuje któregoś produktu w koszyku, to konto dalej się zakłada(ponieważ w takiej sytuacji najpierw zakłada się konto, a później składa się zamówienie)
|
||||
124
mapy/oneMap.js
124
mapy/oneMap.js
@@ -3,6 +3,7 @@ var stocks_list_more_txt=<iai:variable vid="więcej informacji"/>;var stocks_lis
|
||||
// MAPA
|
||||
|
||||
// Zmienna trzymająca informacje o customowych markerach
|
||||
// [wysokosc, szerokosc] w pikselach
|
||||
const defaultIconSize = [50,45];
|
||||
const mapMarkerIcons = {
|
||||
inpost: L.icon({
|
||||
@@ -31,10 +32,10 @@ function getMarkerIcon(courierId){
|
||||
else return mapMarkerIcons.default;
|
||||
}
|
||||
|
||||
// zmienne trzymające id dostaw z mapą i czy mapa już była załadowana
|
||||
// Zmienne trzymające id dostaw z mapą i czy mapa już była załadowana
|
||||
const deliveryPickupPoints = [] ;
|
||||
let finpostjs = false;
|
||||
// funkcja inicjująca mapę
|
||||
// Funkcja inicjująca mapę
|
||||
function loadMap() {
|
||||
var htmlContent = `
|
||||
<div id="fbs_z02_cover">
|
||||
@@ -99,7 +100,7 @@ function loadMap() {
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
// funkcja wyszukująca markery na mapie
|
||||
// Funkcja wyszukująca markery na mapie
|
||||
function runSearchPickup() {
|
||||
if (typeof mymap !== 'undefined') {
|
||||
mymap.eachLayer(function (layer) {
|
||||
@@ -178,7 +179,7 @@ function loadMap() {
|
||||
if (window.innerWidth < 757) document.getElementById("pickup_list_form").insertAdjacentElement("beforebegin",document.querySelector('.map_button_search'));
|
||||
if (!oscItem.querySelector('.fselectedPoint')) oscItem.insertAdjacentHTML("beforeend",`<label class="fselectedPoint" style="padding: 0px;" for="${deliveryValue}"></label>`);
|
||||
|
||||
// wyszukiwanie punktów odbioru na mapie
|
||||
// Wyszukiwanie punktów odbioru na mapie
|
||||
if (finpostjs) {
|
||||
pickup_sites.courierId = ITEM_ID;
|
||||
runSearchPickup();
|
||||
@@ -207,7 +208,7 @@ function loadMap() {
|
||||
const selectedPoint = document.querySelector('[name="shipping"]:checked').closest('.osc_item').querySelector('.fselectedPoint');
|
||||
selectedPoint.innerHTML = "";
|
||||
|
||||
// utworzenie informacji o punkcie odbioru
|
||||
// Utworzenie informacji o punkcie odbioru
|
||||
const deliveryId = document.querySelector('[name="pickup_point"]:checked').value;
|
||||
const chosenPoint = document.querySelector(`.asideContainer_pickup label[data-id="${deliveryId}"]`);
|
||||
const pickupName = chosenPoint.querySelector(".headerText").innerHTML;
|
||||
@@ -228,7 +229,7 @@ function loadMap() {
|
||||
}
|
||||
deliveryPickupPoints.forEach(point => createEventsInpost(point));
|
||||
}
|
||||
// zamknięcie mapy
|
||||
// Zamknięcie mapy
|
||||
function closeMap(){
|
||||
document.getElementById("fbs_z02_cover").style.display = "none";
|
||||
enablePageScroll();
|
||||
@@ -240,7 +241,7 @@ function getAddressInfo(query){
|
||||
};
|
||||
return document.getElementById(`client_${query}`).value;
|
||||
}
|
||||
// utworzenie informacji o punkcie odbioru
|
||||
// Utworzenie informacji o punkcie odbioru
|
||||
function createPickuppointInfo(selectedPoint, deliveryPointId, name, streetText, cityText, zipcodeText, courierId){
|
||||
// Pokazanie elementu fselectedPoint
|
||||
selectedPoint.style.display = "block";
|
||||
@@ -289,7 +290,7 @@ function toggleMapList(e){
|
||||
|
||||
e.target.dataset.show = ifList ? "map" : "list";
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// DANE KLIENTA
|
||||
|
||||
document.getElementById("cop_seection1").addEventListener("click", (e) => {
|
||||
@@ -371,10 +372,10 @@ function showDeliveryForm(style){
|
||||
const deliveryWrapper = document.querySelector(".ajax_cop #client_new_additional .delivery_box.cn_wrapper");
|
||||
if((style && deliveryWrapper.classList.contains("--more")) || (!style && !deliveryWrapper.classList.contains("--more"))) return;
|
||||
|
||||
// formularz dostawy na inny adres
|
||||
// Formularz dostawy na inny adres
|
||||
style ? deliveryWrapper.classList.add("--more") : deliveryWrapper.classList.remove("--more");
|
||||
|
||||
// przycisk od wybierania z listy adresów
|
||||
// Przycisk od wybierania z listy adresów
|
||||
listBtn = document.querySelector(".delivery__address-list-button");
|
||||
if(listBtn) style ? listBtn.classList.add("--fade-in") : listBtn.classList.remove("--fade-in");
|
||||
|
||||
@@ -417,7 +418,7 @@ function handleClickAddressList(e){
|
||||
changeRegion();
|
||||
}
|
||||
|
||||
// nadanie klasy aktywnemu adresowi
|
||||
// Nadanie klasy aktywnemu adresowi
|
||||
e.target.closest("ul").querySelectorAll("li").forEach(el => el.classList.remove("--active-address"));
|
||||
addressLi.classList.add("--active-address");
|
||||
|
||||
@@ -501,20 +502,20 @@ function getClientNew(){
|
||||
});
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// WALIDACJA
|
||||
|
||||
// wyczyść klasy walidacji
|
||||
// Wyczyść klasy walidacji
|
||||
function clearValidation(input){
|
||||
const wrapper = input.closest(".has-feedback")
|
||||
wrapper.classList.remove('--success', '--error', 'has-error', 'has-success');
|
||||
};
|
||||
// wyczyść wiadomość błędu
|
||||
// Wyczyść wiadomość błędu
|
||||
function removeErrorMessage(input) {
|
||||
const valMessage = input.closest('.has-feedback').querySelector('.validate_message');
|
||||
if(valMessage) valMessage.remove();
|
||||
};
|
||||
// dodaj klasy błędu
|
||||
// Dodaj klasy błędu
|
||||
function addError(input){
|
||||
clearValidation(input);
|
||||
removeErrorMessage(input);
|
||||
@@ -522,7 +523,7 @@ function addError(input){
|
||||
clearValidation(wrapper);
|
||||
wrapper.classList.add('--error', 'has-error');
|
||||
};
|
||||
// dodaj klasy sukcesu
|
||||
// Dodaj klasy sukcesu
|
||||
function addSuccess(input){
|
||||
clearValidation(input);
|
||||
removeErrorMessage(input);
|
||||
@@ -530,12 +531,12 @@ function addSuccess(input){
|
||||
clearValidation(wrapper);
|
||||
wrapper.classList.add('--success', 'has-success');
|
||||
};
|
||||
// dodaj error wraz z wiadomością
|
||||
// Dodaj error wraz z wiadomością
|
||||
function addErrorMessage(input, message){
|
||||
addError(input);
|
||||
input.closest('.has-feedback').insertAdjacentHTML("beforeend",`<span class="help-block validate_message text-danger">${message}.</span>`);
|
||||
}
|
||||
// waliduj elementy wymagające wysłania requesta (zipcode, nip)
|
||||
// Waliduj elementy wymagające wysłania requesta (zipcode, nip)
|
||||
async function validateRequest(target, order=false){
|
||||
const wrapper = target.closest(".has-feedback");
|
||||
let reqData = `${target.name}=${target.value}`;
|
||||
@@ -635,14 +636,14 @@ function handleShowSigninModalFromEmailModal(e){
|
||||
showSigninModal();
|
||||
}
|
||||
|
||||
// event listener zmian w kontenerze cop_seection1
|
||||
// EventListener zmian w kontenerze cop_seection1
|
||||
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"];
|
||||
document.getElementById("cop_seection1").addEventListener("change", (e) => {
|
||||
// walidacja zipcode, nipu i emaila
|
||||
// Walidacja zipcode, nipu i emaila
|
||||
if(validateRequestId.includes(e.target.id)) return validateRequest(e.target);
|
||||
|
||||
// zmiana regionu
|
||||
// Zmiana regionu
|
||||
if(e.target.name === "client_region" || e.target.name === "delivery_region") {
|
||||
const clientType = e.target.name.split("_")[0];
|
||||
validateRequest(document.getElementById(`${clientType}_zipcode`));
|
||||
@@ -667,7 +668,7 @@ document.getElementById("cop_seection1").addEventListener("change", (e) => {
|
||||
else clearValidation(e.target);
|
||||
};
|
||||
});
|
||||
// funkcje walidacji poszczególnych elementów
|
||||
// Funkcje walidacji poszczególnych elementów
|
||||
function validateStreet(streetEl){
|
||||
const streetParts = streetEl.value.split(" ");
|
||||
const addressNumber = Number(streetParts[streetParts.length-1][0]);
|
||||
@@ -742,7 +743,7 @@ document.querySelector("body").addEventListener("change", (e) => {
|
||||
}
|
||||
})
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// DOSTAWA I PŁATNOSĆI
|
||||
|
||||
const SET_REGION = (setRegionInput) => JSON.stringify({
|
||||
@@ -783,7 +784,7 @@ async function changeRegion(payAndDelData = null, firstLoad = false) {
|
||||
getNewPaymentsAndDeliveries(payAndDelData, firstLoad);
|
||||
};
|
||||
|
||||
// załadowanie metod dostaw i płatności
|
||||
// Załadowanie metod dostaw i płatności
|
||||
function getNewPaymentsAndDeliveries(data = null, firstLoad = false) {
|
||||
console.log("fn: order1_new");
|
||||
// Wyczyszczenie zapisanych poprzednich metod płatności
|
||||
@@ -867,7 +868,7 @@ const checkedPayment = paymentValue === method.id;
|
||||
}
|
||||
else{
|
||||
prepaidsMethodMarkup += markup;
|
||||
// okienko vouchera
|
||||
// Okienko vouchera
|
||||
if(method.id === 2){
|
||||
prepaidsMethodMarkup += `
|
||||
<div class="order__voucher_container osc_item-modal">
|
||||
@@ -944,13 +945,13 @@ const checkedPayment = paymentValue === method.id;
|
||||
cloneElement(document.getElementById(paymentMethodId));
|
||||
}
|
||||
|
||||
// poprzednia dostawa
|
||||
// Poprzednia dostawa
|
||||
const prevDeliveryMethod = JSON.parse(localStorage.getItem("prevDeliveryMethod"));
|
||||
const prevDeliveryInput = document.querySelector(`input#${prevDeliveryMethod.id}`);
|
||||
|
||||
// Sprawdzenie czy istnieje metoda płatności(na wypadek gdyby była usunięta lub klient zamawiał do innego kraju)
|
||||
// Sprawdzenie czy istnieje metoda dostawy (na wypadek gdyby była usunięta lub klient zamawiał do innego kraju)
|
||||
if(prevDeliveryInput){
|
||||
// sprawdzenie czy dostawa miała punkt odbioru
|
||||
// Sprawdzenie czy dostawa miała punkt odbioru
|
||||
if(prevDeliveryMethod.fselectedPoint){
|
||||
checkPrevPickupPoint(
|
||||
prevDeliveryInput.parentElement.querySelector(".fselectedPoint"),
|
||||
@@ -1006,7 +1007,7 @@ function createPaymentContainerMarkup(method){
|
||||
|
||||
// Przygotowanie html dla metod dostaw
|
||||
function prepareDeliveryMarkup(method, deliveryId){
|
||||
// zapisanie do listy dostaw z mapą
|
||||
// Zapisanie do listy dostaw z mapą
|
||||
if (method.pickuppoint === "y" && !deliveryPickupPoints.includes(method.id)) deliveryPickupPoints.push(method.id);
|
||||
const cost = Number(method.cost) === 0 ? <iai:variable vid="Gratis!"/> : method.cost_formatted;
|
||||
const disabled = method.minworthreached === "false" ? 'disabled="disabled"' : "";
|
||||
@@ -1018,7 +1019,7 @@ function prepareDeliveryMarkup(method, deliveryId){
|
||||
date.setDate(date.getDate()+method.time);
|
||||
const deliveryDate = date.toLocaleDateString('en-GB').replaceAll("/", ".");
|
||||
|
||||
// uzupełnienie markupa dla metod dostaw dvp
|
||||
// Uzupełnienie markupa dla metod dostaw dvp
|
||||
return `<label class="osc_item" for="item_${method.id}">
|
||||
<input id="item_${method.id}" value="${method.id}" type="radio" name="shipping" data-pickuppoint="${method.pickuppoint}" data-delivery="${method.time_days}#${method.time_hours}#${method.time_minutes}#${method.week_day}#${method.week_amount}#${method.time}" ${ifChecked ? "checked" : ""}>
|
||||
<div class="photo">
|
||||
@@ -1094,7 +1095,7 @@ function changeCurrentShippingInfo(shippingMethod){
|
||||
app_shop.vars.checkedShipping = shippingMethod.value;
|
||||
}
|
||||
document.getElementById("cop_seection2").addEventListener("click", e => {
|
||||
// kliknięcie na dostawe
|
||||
// Kliknięcie na dostawe
|
||||
if(e.target.name === "shipping"){
|
||||
// Wyczyszczenie wszystkich zaznaczonych punktów odbioru
|
||||
clearSelectedPoints();
|
||||
@@ -1103,7 +1104,7 @@ document.getElementById("cop_seection2").addEventListener("click", e => {
|
||||
if(app_shop.vars.checkedShipping === e.target.value) return;
|
||||
if(e.target.dataset.working_days) e.target.dataset.working_days.split("#").map(function (e) {return parseInt(e, 10);});
|
||||
|
||||
// zapisanie jako poprzednia metoda płatności jeśli nie wymaga wyboru punktu odbioru
|
||||
// Zapisanie jako poprzednia metoda płatności jeśli nie wymaga wyboru punktu odbioru
|
||||
if(e.target.dataset.pickuppoint === "n"){
|
||||
prevShipping=e.target;
|
||||
|
||||
@@ -1113,7 +1114,7 @@ document.getElementById("cop_seection2").addEventListener("click", e => {
|
||||
return;
|
||||
}
|
||||
|
||||
// kliknięcie na płatność
|
||||
// Kliknięcie na płatność
|
||||
if(e.target.name === "payform_id"){
|
||||
// Usunięcie klona poprzedniego przelewu online/ karty płatniczej
|
||||
removePrevClone();
|
||||
@@ -1198,17 +1199,17 @@ function showPaymentMethodModal(method){
|
||||
|
||||
// Metoda oblugujaca kliknieca w metody platnosci w popupie
|
||||
function handlePaymentMethodClick(e){
|
||||
// usuń poprzedni klon i stwórz nowy
|
||||
// Usuń poprzedni klon i stwórz nowy
|
||||
removePrevClone();
|
||||
cloneElement(e.target);
|
||||
|
||||
// zamkniecie modala
|
||||
// Zamkniecie modala
|
||||
ifChosenNewPaymentMethod = true;
|
||||
app_shop.fn.paymentModal.closeModal();
|
||||
return false;
|
||||
}
|
||||
function cloneElement(originalPaymentElement){
|
||||
// sklonowanie kliknietego elementu
|
||||
// Sklonowanie kliknietego elementu
|
||||
const clonedMethod = originalPaymentElement.closest(".osc_item").cloneNode(true);
|
||||
const clonedInput = clonedMethod.querySelector("input");
|
||||
|
||||
@@ -1235,7 +1236,7 @@ function changeDeliveryOptions(){
|
||||
calculateBasketCost();
|
||||
}
|
||||
|
||||
// zmień pokazane metody dostawy
|
||||
// Zmień pokazane metody dostawy
|
||||
function changePrepaidDvp(prepaidStyle, dvpStyle){
|
||||
const prepaid = document.getElementById("osc_order1_prepaid");
|
||||
const dvp = document.getElementById("osc_order1_dvp");
|
||||
@@ -1311,7 +1312,7 @@ const productsPointsEl = document.querySelector("#order2_products_points .operat
|
||||
const summaryCostEl = document.getElementById("summary-cost");
|
||||
const summaryPointsEl = document.getElementById("summary-points");
|
||||
function calculateBasketCost() {
|
||||
// przygotowanie informacji o metodzie dostawy i platnosci
|
||||
// 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"
|
||||
@@ -1344,7 +1345,7 @@ function calculateBasketCost() {
|
||||
checkShowPrice(totalRebateEl, Number(t.total_rebate_without_shipping), t.currency_sign);
|
||||
checkShowPrice(saldoValueEl, Number(t.payment_amount_from_client_balance), t.currency_sign);
|
||||
|
||||
// punkty zamówienia
|
||||
// Punkty zamówienia
|
||||
if(t.products_worth_at_points){
|
||||
productsPointsEl.innerHTML = `${t.products_worth_at_points} ${<iai:variable vid="pkt"/>}.`;
|
||||
productsPointsEl.parentElement.style.display = "flex";
|
||||
@@ -1361,14 +1362,14 @@ function calculateBasketCost() {
|
||||
});
|
||||
};
|
||||
|
||||
// funkcja od pokazania wybranej ceny (np rabat, ubezpieczenie...)
|
||||
// Funkcja od pokazania wybranej ceny (np rabat, ubezpieczenie...)
|
||||
function checkShowPrice(priceContainer, price, currencySign){
|
||||
priceContainer.innerHTML = formatPrice(price, currencySign);
|
||||
if(price && price > 0) priceContainer.parentElement.style.display = "flex";
|
||||
else priceContainer.parentElement.style.display = "none";
|
||||
};
|
||||
|
||||
// funkcja od formatowania ceny
|
||||
// Funkcja od formatowania ceny
|
||||
function formatPrice(price, currencySign) {
|
||||
return format_price(price, { mask: app_shop.vars.currency_format, currency: currencySign, currency_space: app_shop.vars.currency_space, currency_before_price: app_shop.vars.currency_before_value });
|
||||
};
|
||||
@@ -1466,7 +1467,7 @@ const DEACTIVATE_REBATE_CODE = () => JSON.stringify({
|
||||
}`,
|
||||
})
|
||||
|
||||
// aktywacja kodu rabatowego
|
||||
// Aktywacja kodu rabatowego
|
||||
const rebateCode = document.getElementById("rebate_code");
|
||||
async function updateCode(){
|
||||
if(rebateCode.value.trim() === ""){
|
||||
@@ -1500,7 +1501,7 @@ async function updateCode(){
|
||||
toggleActiveCode(false, true);
|
||||
}
|
||||
|
||||
// usunięcie aktywnego kodu rabatowego
|
||||
// Usunięcie aktywnego kodu rabatowego
|
||||
async function removeCode(){
|
||||
app_shop.fn.ajaxLoadSite(1);
|
||||
|
||||
@@ -1518,7 +1519,7 @@ async function removeCode(){
|
||||
}
|
||||
}
|
||||
|
||||
// zmień widoczność kodu rabatowego
|
||||
// Zmień widoczność kodu rabatowego
|
||||
const rebateOptionWrapper = document.querySelector(".rebate__options");
|
||||
const rebateCodeContainer = document.querySelector(".rebate__code");
|
||||
const rebateActiveWrapper = document.querySelector(".rebate__active");
|
||||
@@ -1531,14 +1532,14 @@ function toggleActiveCode(show, error=false){
|
||||
clearValidation(rebateCode);
|
||||
}
|
||||
|
||||
// zmień widoczność
|
||||
// Zmień widoczność
|
||||
rebateOptionWrapper.style.display = show ? "none" : "flex";
|
||||
rebateActiveWrapper.style.display = show ? "block" : "none";
|
||||
|
||||
if(!error) rebateCodeContainer.classList.remove("--fade-in");
|
||||
else rebateCodeContainer.classList.add("--fade-in");
|
||||
|
||||
// zmień wartości
|
||||
// Zmień wartości
|
||||
activeCodeEl.innerHTML = show ? rebateCode.value : "";
|
||||
showInput = error ? true : false;
|
||||
rebateOptionEl.checked = error ? true : false;
|
||||
@@ -1546,7 +1547,7 @@ function toggleActiveCode(show, error=false){
|
||||
else activeCodeEl.innerHTML = "";
|
||||
}
|
||||
|
||||
// eventListenery dla kodu rabatowego
|
||||
// EventListenery dla kodu rabatowego
|
||||
let showInput = false;
|
||||
const rebateCodeWrapper = document.querySelector(".rebate");
|
||||
rebateCodeWrapper.addEventListener("click", (e) => {
|
||||
@@ -1622,16 +1623,16 @@ document.querySelector(".order2_button_order").addEventListener("click", () => {
|
||||
// Sprawdzenie pól formularza
|
||||
if(validateAllInputs() === false) app_shop.vars.validation = 0;
|
||||
|
||||
// znalezienie obecnie zaznaczonej metody dostawy i płatności
|
||||
// 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");
|
||||
|
||||
// sprawdzenie czy użytkownik zaakceptował regulamin
|
||||
// Sprawdzenie czy użytkownik zaakceptował regulamin
|
||||
if(!termsConditionsInput.checked || !cancelConditionsInput.checked){
|
||||
app_shop.vars.validation = 0;
|
||||
showTermsError(termsConditionsInput);
|
||||
showTermsError(cancelConditionsInput);
|
||||
}// sprawdzenie czy użytkownik wybrał metodę dostawy i płatności (też sprawdzenie czy wybrał paczkomat i wpisał voucher)
|
||||
}// Sprawdzenie czy użytkownik wybrał metodę dostawy i płatności (też sprawdzenie czy wybrał paczkomat i wpisał voucher)
|
||||
else {
|
||||
if(deliveryMethod){
|
||||
if(deliveryMethod.dataset.pickuppoint === "y" && deliveryMethod.parentElement.querySelector(".fselectedPoint").innerHTML === "") orderValidationError(<iai:variable vid="Nie wybrano punktu odbioru"/>);
|
||||
@@ -1653,9 +1654,9 @@ document.querySelector(".order2_button_order").addEventListener("click", () => {
|
||||
}
|
||||
}
|
||||
|
||||
// przerwanie składania zamówienia jeśli w trakcie walidacji wystąpił błąd
|
||||
// Przerwanie składania zamówienia jeśli w trakcie walidacji wystąpił błąd
|
||||
if (app_shop.vars.validation === 0) {
|
||||
// scroll do elementów z błędem
|
||||
// Scroll do elementów z błędem
|
||||
if(document.getElementById("order2_terms_conditions").checked && document.getElementById("order2_cancel").checked){
|
||||
const errorEl = document.querySelector(".--error.has-error");
|
||||
if(errorEl) scrollToHeight(errorEl)
|
||||
@@ -1693,7 +1694,7 @@ function showTermsError(input){
|
||||
input.parentElement.querySelector("a").classList.add("text-danger");
|
||||
}
|
||||
}
|
||||
// złożenie zamówienia
|
||||
// Złożenie zamówienia
|
||||
function createOrder(deliveryMethod, paymentMethod){
|
||||
// Weź dane klienta
|
||||
const email = document.getElementById("client_email").value;
|
||||
@@ -1739,11 +1740,11 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
if (!lastname) lastname = (deliveryLastname) ? deliveryLastname : 'Firma';
|
||||
}
|
||||
|
||||
// czyszczenie imienia i nazwiska ze znaków specjalnych
|
||||
// Czyszczenie imienia i nazwiska ze znaków specjalnych
|
||||
firstname = firstname.replace(/[&\/\\#,+()$~%.'":*?<>{}!@~`^_]/g, "");
|
||||
lastname = lastname.replace(/[&\/\\#,+()$~%.'":*?<>{}!@~`^_]/g, "");
|
||||
|
||||
// dodatkowe informacje (uwagi, faktura, punkt odbioru)
|
||||
// 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 : "";
|
||||
|
||||
@@ -1787,7 +1788,7 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
},
|
||||
};
|
||||
|
||||
// złóż zamówienie jako zalogowany/niezalogowany użytkownik.
|
||||
// Złóż zamówienie jako zalogowany/niezalogowany użytkownik.
|
||||
if (document.querySelector(".--logged")) sendOrder(order);
|
||||
else {
|
||||
const clientData = new FormData();
|
||||
@@ -2032,7 +2033,9 @@ async function fetchData(options = {}) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// element z numerem edycji jeśli jest
|
||||
|
||||
function initOSCOP(){
|
||||
// Element z numerem edycji jeśli jest
|
||||
const editNumber = document.getElementById("edit-number");
|
||||
|
||||
if(document.querySelector(".ajax_cop").childElementCount && !editNumber) changeRegion(null, true);
|
||||
@@ -2128,8 +2131,9 @@ if(editNumber){
|
||||
linkParameter: "?query=orderDetails",
|
||||
alert: false,
|
||||
});
|
||||
|
||||
// Jesli error to zatrzymaj funkcje
|
||||
if(!data?.data?.orderDetails) return changeRegion();
|
||||
if(!data?.data?.orderDetails || !data) return changeRegion();
|
||||
|
||||
// Wstawienie danych
|
||||
insertEditData(data.data.orderDetails);
|
||||
@@ -2186,10 +2190,12 @@ if(editNumber){
|
||||
}
|
||||
|
||||
getEditData();
|
||||
// funkcja od uzupełnienia inputów
|
||||
// Funkcja od uzupełnienia inputów
|
||||
function fillInput(input, value){
|
||||
input.value = value;
|
||||
input.classList.add("focused");
|
||||
input.parentElement.classList.add("--success", "has-success");
|
||||
}
|
||||
}
|
||||
}
|
||||
initOSCOP();
|
||||
59
style.css
59
style.css
@@ -1,5 +1,5 @@
|
||||
.--place-order-page{
|
||||
// blokada przesuwania się text area
|
||||
// Blokada przesuwania się text area
|
||||
textarea{
|
||||
resize: none;
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
label:has(input:disabled){
|
||||
cursor: default;
|
||||
}
|
||||
// strzalki po prawej
|
||||
// Strzalki po prawej
|
||||
.--arrow-input{
|
||||
display: none;
|
||||
}
|
||||
@@ -44,35 +44,35 @@
|
||||
.bm-oscop__btn:hover{
|
||||
background-color: @less_iaicolorscheme_background_text_color!important;
|
||||
}
|
||||
// error
|
||||
// Error
|
||||
.has-feedback.--error .form-control{
|
||||
border-color: @less_iaicolorscheme_danger_color;
|
||||
}
|
||||
// zmiana fontsize na 16px na desktop
|
||||
// Zmiana fontsize na 16px na desktop
|
||||
.order__voucher_headlines strong, .order__voucher_button, #signin-form-ajax .signin_button, .delivery__address-list-firstname, .delivery__address-list-lastname, .osc_item-modal h2, .propose_title, #e-invoice_dialog .btn, #checkout_step2_2 h3, #summary-points, #fbs_z02_wrapper .big_label, .propose_main .button_password_recover, .rebate__title{
|
||||
font-size: 1.6rem!important;
|
||||
}
|
||||
// zmiana fontsize na 14px na desktop
|
||||
// Zmiana fontsize na 14px na desktop
|
||||
.rebate_option label, .order2_terms_checkall, .register_client_checkbox, .firm-form, #delivery_box_switcher label, #FBS_faktura, #checkout_step3_1 .name, .client_type-text, .headerText{
|
||||
font-size: 1.4rem!important;
|
||||
}
|
||||
// zmiana fontsize na 13px na desktop
|
||||
// Zmiana fontsize na 13px na desktop
|
||||
.cop_product_wrap, .order_pay_wrapper, .order2_shiptime, .signin_header, .delivery_date, #checkout_step2_2 .step3_sub.cop_box_sub span, .delivery__address-list-street, .delivery__address-list-city, .delivery__address-list-zipcode, .delivery__address-list-phone, .delivery__address-country_name, .propose_text, .propose_json_mail, .control-label, .register__hide-password::before, .f-label, #locationField .btn, .rebate__active-options button{
|
||||
font-size: 1.3rem!important;
|
||||
}
|
||||
// zmiana fontsize na 12px na desktop
|
||||
// Zmiana fontsize na 12px na desktop
|
||||
.comment, .delivery_date, #checkout_step2_1 .name, a.go__shopping, .order_products_action span, .needed-text, #fbs_z02_close::before, .pickup_point_sub div, .mapTooltipAdress, #cop_seection2 #checkout_step2_2 h3 span, .osc_item-modal span, #e-invoice_dialog p, .e-invoice_dialog, .cn_propose_desc, #mail_propose_signin, #mail_propose_close, .order__voucher_info{
|
||||
font-size: 1.2rem!important;
|
||||
}
|
||||
// zmiana grubości czcionki na 700
|
||||
// Zmiana grubości czcionki na 700
|
||||
#delivery_box_switcher label, #FBS_faktura > span, .client_type-text, #signin-form-ajax .signin_button, .delivery__address-list-firstname, .delivery__address-list-lastname, .propose_title, .button_password_recover, .client_type-text, .voucher-value, #active-code, .order2_terms_checkall, .order2_button_order, #fbs_z02_close, #locationField .btn, .btn.map_dir,.fbs02_btn, .register__option label, #e-invoice_dialog font, #e-invoice_dialog .btn, .rebate label, .--points{
|
||||
font-weight: 700;
|
||||
}
|
||||
// margin bottom 0
|
||||
// Zmiana margin bottom na 0
|
||||
#signin-form-ajax .f-group, .propose_main div:has(#mail_propose_close), #e-invoice_dialog .big_label, #cop_seection1 .form-group:last-child, .register__form, .register__item:last-of-type, #client_contact_info{
|
||||
margin-bottom: 0!important;
|
||||
}
|
||||
// transition
|
||||
// Transition
|
||||
.--hide{
|
||||
max-height: 0;
|
||||
height: 0;
|
||||
@@ -126,7 +126,7 @@
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
// modal vouchera
|
||||
// Modal vouchera
|
||||
.order__voucher_container {
|
||||
.order__voucher_headlines{
|
||||
display: flex;
|
||||
@@ -146,13 +146,13 @@
|
||||
top: -5px!important;
|
||||
}
|
||||
}
|
||||
// modal logowania
|
||||
// Modal logowania
|
||||
#signin-form-ajax .signin_button{
|
||||
width: 100%;
|
||||
margin-bottom: 1rem;
|
||||
padding: 1.4rem 0;
|
||||
}
|
||||
// modal listy adresów
|
||||
// Modal listy adresów
|
||||
.delivery__address-list-container{
|
||||
h2{
|
||||
padding-left: 1rem;
|
||||
@@ -277,7 +277,7 @@
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// inputy
|
||||
// Inputy
|
||||
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], select{
|
||||
border-radius: 8px!important;
|
||||
height: 38px!important;
|
||||
@@ -310,7 +310,7 @@
|
||||
select{
|
||||
cursor: pointer;
|
||||
}
|
||||
// ikony
|
||||
// Ikony
|
||||
i.icon-home:before {
|
||||
content: '\F015';
|
||||
}
|
||||
@@ -333,7 +333,7 @@
|
||||
content: "\F104";
|
||||
font-family: FontAwesome;
|
||||
}
|
||||
// ułożenie strony
|
||||
// Ułożenie strony
|
||||
.ajax_cop{
|
||||
display: grid!important;
|
||||
grid-template-columns: 5fr 3.5fr;
|
||||
@@ -343,7 +343,7 @@
|
||||
font-size: 2.2rem;
|
||||
padding-bottom: 1.5rem;
|
||||
}
|
||||
// cena gratis
|
||||
// Cena gratis
|
||||
.cost_free{
|
||||
color: #0BAC38;
|
||||
font-weight: 800;
|
||||
@@ -404,7 +404,7 @@
|
||||
.row {
|
||||
margin: 0 0px 0 -10px;
|
||||
}
|
||||
// kraj
|
||||
// Kraj
|
||||
.form-group.--region{
|
||||
position: relative;
|
||||
.control-label{
|
||||
@@ -443,7 +443,7 @@
|
||||
content: "\F106";
|
||||
}
|
||||
}
|
||||
// zalogowanie się
|
||||
// Zalogowanie się
|
||||
.signin{
|
||||
.get_signin{
|
||||
text-decoration: underline;
|
||||
@@ -515,10 +515,11 @@
|
||||
#toggle_password{
|
||||
position: absolute;
|
||||
right: 1.5rem;
|
||||
top: 1rem;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
}
|
||||
#toggle_password:hover{
|
||||
color: @less_iaicolorscheme_background_active_color;
|
||||
@@ -540,7 +541,7 @@
|
||||
.cn_wrapper{
|
||||
width: 100%!important;
|
||||
}
|
||||
// dostawa na inny adres
|
||||
// Dostawa na inny adres
|
||||
#client_new_additional{
|
||||
border-top: 1px solid #ccc;
|
||||
padding-top: 2.4rem;
|
||||
@@ -578,7 +579,7 @@
|
||||
margin-right: 1rem;
|
||||
}
|
||||
}
|
||||
// sekcja dostawa i płatności
|
||||
// Sekcja dostawa i płatności
|
||||
#cop_seection2{
|
||||
.osc_item {
|
||||
gap: 1.2rem;
|
||||
@@ -686,13 +687,12 @@
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
// sekcja podsumowanie
|
||||
// Sekcja podsumowanie
|
||||
#cop_seection3{
|
||||
position: sticky;
|
||||
top: 10px;
|
||||
align-self: flex-start;
|
||||
.summary__container{
|
||||
// background-color: @less_iaicolorscheme_gray_lighter_color;
|
||||
background-color: #f2f2f2;
|
||||
padding: 4rem 2rem 2rem 2rem;
|
||||
border-radius: 5px;
|
||||
@@ -948,15 +948,15 @@
|
||||
.delivery__address-list{
|
||||
grid-template-columns: 1fr!important;
|
||||
}
|
||||
// font size 12px
|
||||
// Zmiana fontsize na 12px mobile
|
||||
.cop_product_wrap_r .cop_quantity{
|
||||
font-size: 1.2rem!important;
|
||||
}
|
||||
// font size 13px
|
||||
// Zmiana fontsize na 13px mobile
|
||||
.delivery_date, .cop_product_wrap_r .cop_price, .order2_terms_wrapper_sub:not(.needed-text), #mail_propose_signin, #mail_propose_close {
|
||||
font-size: 1.3rem!important;
|
||||
}
|
||||
// font size 14px
|
||||
// Zmiana fontsize na 14px mobile
|
||||
.bm-oscop__btn, .cop_product_wrap_r .cop_product_name, .rebate__options, .order2_terms_wrapper_sub.newsletter, .propose_text, .propose_json_mail, .button_password_recover, #cop_seection2 #checkout_step2_2 h3, .rebate__title{
|
||||
font-size: 1.4rem!important;
|
||||
}
|
||||
@@ -1036,9 +1036,6 @@
|
||||
flex-direction: column;
|
||||
gap: 1.2rem;
|
||||
}
|
||||
.register .register__form .register__item #toggle_password{
|
||||
top: 1.4rem;
|
||||
}
|
||||
}
|
||||
.delivery_box.--more .form-group, .client_box .form-group, #client_contact_info .form-group{
|
||||
margin-bottom: 1.2rem!important;
|
||||
@@ -1133,7 +1130,7 @@
|
||||
font-size: 1.6rem!important;
|
||||
}
|
||||
}
|
||||
// modal elektroniczna faktura mobile
|
||||
// Modal elektroniczna faktura mobile
|
||||
.modal__wrapper:has(#e-invoice_dialog){
|
||||
padding: 2.4rem!important;
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ function getMarkerIcon(courierId){
|
||||
else return mapMarkerIcons.default;
|
||||
}
|
||||
|
||||
// zmienne trzymające id dostaw z mapą i czy mapa już była załadowana
|
||||
// Zmienne trzymające id dostaw z mapą i czy mapa już była załadowana
|
||||
const deliveryPickupPoints = [] ;
|
||||
let finpostjs = false;
|
||||
// funkcja inicjująca mapę
|
||||
// Funkcja inicjująca mapę
|
||||
function loadMap() {
|
||||
var htmlContent = `
|
||||
<div id="fbs_z02_cover">
|
||||
@@ -103,7 +103,7 @@ function loadMap() {
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
// funkcja wyszukująca markery na mapie
|
||||
// Funkcja wyszukująca markery na mapie
|
||||
function runSearchPickup() {
|
||||
if (typeof mymap !== 'undefined') {
|
||||
mymap.eachLayer(function (layer) {
|
||||
@@ -185,7 +185,7 @@ function loadMap() {
|
||||
if (window.innerWidth < 757) document.getElementById("pickup_list_form").insertAdjacentElement("beforebegin",document.querySelector('.map_button_search'));
|
||||
if (!oscItem.querySelector('.fselectedPoint')) oscItem.insertAdjacentHTML("beforeend",`<label class="fselectedPoint" style="padding: 0px;" for="${deliveryValue}"></label>`);
|
||||
|
||||
// wyszukiwanie punktów odbioru na mapie
|
||||
// Wyszukiwanie punktów odbioru na mapie
|
||||
if (finpostjs) {
|
||||
pickup_sites.courierId = ITEM_ID;
|
||||
runSearchPickup();
|
||||
@@ -204,7 +204,7 @@ function loadMap() {
|
||||
const selectedPoint = document.querySelector('[name="shipping"]:checked').closest('.osc_item').querySelector('.fselectedPoint');
|
||||
selectedPoint.innerHTML = "";
|
||||
|
||||
// utworzenie informacji o punkcie odbioru
|
||||
// Utworzenie informacji o punkcie odbioru
|
||||
const deliveryId = document.querySelector('[name="pickup_point"]:checked').value;
|
||||
const chosenPoint = document.querySelector(`.asideContainer_pickup label[data-id="${deliveryId}"]`);
|
||||
const pickupName = chosenPoint.querySelector(".headerText").innerHTML;
|
||||
@@ -225,7 +225,7 @@ function loadMap() {
|
||||
}
|
||||
deliveryPickupPoints.forEach(point => createEventsInpost(point));
|
||||
}
|
||||
// zamknięcie mapy
|
||||
// Zamknięcie mapy
|
||||
function closeMap(){
|
||||
document.getElementById("fbs_z02_cover").style.display = "none";
|
||||
enablePageScroll();
|
||||
@@ -237,7 +237,7 @@ function getAddressInfo(query){
|
||||
};
|
||||
return document.getElementById(`client_${query}`).value;
|
||||
}
|
||||
// utworzenie informacji o punkcie odbioru
|
||||
// Utworzenie informacji o punkcie odbioru
|
||||
function createPickuppointInfo(selectedPoint, deliveryPointId, name, streetText, cityText, zipcodeText, courierId){
|
||||
// Pokazanie elementu fselectedPoint
|
||||
selectedPoint.style.display = "block";
|
||||
@@ -286,7 +286,7 @@ function toggleMapList(e){
|
||||
|
||||
e.target.dataset.show = ifList ? "map" : "list";
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// DANE KLIENTA
|
||||
|
||||
document.getElementById("cop_seection1").addEventListener("click", (e) => {
|
||||
@@ -368,10 +368,10 @@ function showDeliveryForm(style){
|
||||
const deliveryWrapper = document.querySelector(".ajax_cop #client_new_additional .delivery_box.cn_wrapper");
|
||||
if((style && deliveryWrapper.classList.contains("--more")) || (!style && !deliveryWrapper.classList.contains("--more"))) return;
|
||||
|
||||
// formularz dostawy na inny adres
|
||||
// Formularz dostawy na inny adres
|
||||
style ? deliveryWrapper.classList.add("--more") : deliveryWrapper.classList.remove("--more");
|
||||
|
||||
// przycisk od wybierania z listy adresów
|
||||
// Przycisk od wybierania z listy adresów
|
||||
listBtn = document.querySelector(".delivery__address-list-button");
|
||||
if(listBtn) style ? listBtn.classList.add("--fade-in") : listBtn.classList.remove("--fade-in");
|
||||
|
||||
@@ -414,7 +414,7 @@ function handleClickAddressList(e){
|
||||
changeRegion();
|
||||
}
|
||||
|
||||
// nadanie klasy aktywnemu adresowi
|
||||
// Nadanie klasy aktywnemu adresowi
|
||||
e.target.closest("ul").querySelectorAll("li").forEach(el => el.classList.remove("--active-address"));
|
||||
addressLi.classList.add("--active-address");
|
||||
|
||||
@@ -498,20 +498,20 @@ function getClientNew(){
|
||||
});
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// WALIDACJA
|
||||
|
||||
// wyczyść klasy walidacji
|
||||
// Wyczyść klasy walidacji
|
||||
function clearValidation(input){
|
||||
const wrapper = input.closest(".has-feedback")
|
||||
wrapper.classList.remove('--success', '--error', 'has-error', 'has-success');
|
||||
};
|
||||
// wyczyść wiadomość błędu
|
||||
// Wyczyść wiadomość błędu
|
||||
function removeErrorMessage(input) {
|
||||
const valMessage = input.closest('.has-feedback').querySelector('.validate_message');
|
||||
if(valMessage) valMessage.remove();
|
||||
};
|
||||
// dodaj klasy błędu
|
||||
// Dodaj klasy błędu
|
||||
function addError(input){
|
||||
clearValidation(input);
|
||||
removeErrorMessage(input);
|
||||
@@ -519,7 +519,7 @@ function addError(input){
|
||||
clearValidation(wrapper);
|
||||
wrapper.classList.add('--error', 'has-error');
|
||||
};
|
||||
// dodaj klasy sukcesu
|
||||
// Dodaj klasy sukcesu
|
||||
function addSuccess(input){
|
||||
clearValidation(input);
|
||||
removeErrorMessage(input);
|
||||
@@ -527,12 +527,12 @@ function addSuccess(input){
|
||||
clearValidation(wrapper);
|
||||
wrapper.classList.add('--success', 'has-success');
|
||||
};
|
||||
// dodaj error wraz z wiadomością
|
||||
// Dodaj error wraz z wiadomością
|
||||
function addErrorMessage(input, message){
|
||||
addError(input);
|
||||
input.closest('.has-feedback').insertAdjacentHTML("beforeend",`<span class="help-block validate_message text-danger">${message}.</span>`);
|
||||
}
|
||||
// waliduj elementy wymagające wysłania requesta (zipcode, nip)
|
||||
// Waliduj elementy wymagające wysłania requesta (zipcode, nip)
|
||||
async function validateRequest(target, order=false){
|
||||
const wrapper = target.closest(".has-feedback");
|
||||
let reqData = `${target.name}=${target.value}`;
|
||||
@@ -632,14 +632,14 @@ function handleShowSigninModalFromEmailModal(e){
|
||||
showSigninModal();
|
||||
}
|
||||
|
||||
// event listener zmian w kontenerze cop_seection1
|
||||
// EventListener zmian w kontenerze cop_seection1
|
||||
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"];
|
||||
document.getElementById("cop_seection1").addEventListener("change", (e) => {
|
||||
// walidacja zipcode, nipu i emaila
|
||||
// Walidacja zipcode, nipu i emaila
|
||||
if(validateRequestId.includes(e.target.id)) return validateRequest(e.target);
|
||||
|
||||
// zmiana regionu
|
||||
// Zmiana regionu
|
||||
if(e.target.name === "client_region" || e.target.name === "delivery_region") {
|
||||
const clientType = e.target.name.split("_")[0];
|
||||
validateRequest(document.getElementById(`${clientType}_zipcode`));
|
||||
@@ -664,7 +664,7 @@ document.getElementById("cop_seection1").addEventListener("change", (e) => {
|
||||
else clearValidation(e.target);
|
||||
};
|
||||
});
|
||||
// funkcje walidacji poszczególnych elementów
|
||||
// Funkcje walidacji poszczególnych elementów
|
||||
function validateStreet(streetEl){
|
||||
const streetParts = streetEl.value.split(" ");
|
||||
const addressNumber = Number(streetParts[streetParts.length-1][0]);
|
||||
@@ -739,7 +739,7 @@ document.querySelector("body").addEventListener("change", (e) => {
|
||||
}
|
||||
})
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// DOSTAWA I PŁATNOSĆI
|
||||
|
||||
const SET_REGION = (setRegionInput) => JSON.stringify({
|
||||
@@ -780,7 +780,7 @@ async function changeRegion(payAndDelData = null, firstLoad = false) {
|
||||
getNewPaymentsAndDeliveries(payAndDelData, firstLoad);
|
||||
};
|
||||
|
||||
// załadowanie metod dostaw i płatności
|
||||
// Załadowanie metod dostaw i płatności
|
||||
function getNewPaymentsAndDeliveries(data = null, firstLoad = false) {
|
||||
console.log("fn: order1_new");
|
||||
// Wyczyszczenie zapisanych poprzednich metod płatności
|
||||
@@ -864,7 +864,7 @@ function getNewPaymentsAndDeliveries(data = null, firstLoad = false) {
|
||||
}
|
||||
else{
|
||||
prepaidsMethodMarkup += markup;
|
||||
// okienko vouchera
|
||||
// Okienko vouchera
|
||||
if(method.id === 2){
|
||||
prepaidsMethodMarkup += `
|
||||
<div class="order__voucher_container osc_item-modal">
|
||||
@@ -941,13 +941,13 @@ function getNewPaymentsAndDeliveries(data = null, firstLoad = false) {
|
||||
cloneElement(document.getElementById(paymentMethodId));
|
||||
}
|
||||
|
||||
// poprzednia dostawa
|
||||
// Poprzednia dostawa
|
||||
const prevDeliveryMethod = JSON.parse(localStorage.getItem("prevDeliveryMethod"));
|
||||
const prevDeliveryInput = document.querySelector(`input#${prevDeliveryMethod.id}`);
|
||||
|
||||
// Sprawdzenie czy istnieje metoda płatności(na wypadek gdyby była usunięta lub klient zamawiał do innego kraju)
|
||||
// Sprawdzenie czy istnieje metoda dostawy (na wypadek gdyby była usunięta lub klient zamawiał do innego kraju)
|
||||
if(prevDeliveryInput){
|
||||
// sprawdzenie czy dostawa miała punkt odbioru
|
||||
// Sprawdzenie czy dostawa miała punkt odbioru
|
||||
if(prevDeliveryMethod.fselectedPoint){
|
||||
checkPrevPickupPoint(
|
||||
prevDeliveryInput.parentElement.querySelector(".fselectedPoint"),
|
||||
@@ -1003,7 +1003,7 @@ function createPaymentContainerMarkup(method){
|
||||
|
||||
// Przygotowanie html dla metod dostaw
|
||||
function prepareDeliveryMarkup(method, deliveryId){
|
||||
// zapisanie do listy dostaw z mapą
|
||||
// Zapisanie do listy dostaw z mapą
|
||||
if (method.pickuppoint === "y" && !deliveryPickupPoints.includes(method.id)) deliveryPickupPoints.push(method.id);
|
||||
const cost = Number(method.cost) === 0 ? <iai:variable vid="Gratis!"/> : method.cost_formatted;
|
||||
const disabled = method.minworthreached === "false" ? 'disabled="disabled"' : "";
|
||||
@@ -1015,7 +1015,7 @@ function prepareDeliveryMarkup(method, deliveryId){
|
||||
date.setDate(date.getDate()+method.time);
|
||||
const deliveryDate = date.toLocaleDateString('en-GB').replaceAll("/", ".");
|
||||
|
||||
// uzupełnienie markupa dla metod dostaw dvp
|
||||
// Uzupełnienie markupa dla metod dostaw dvp
|
||||
return `<label class="osc_item" for="item_${method.id}">
|
||||
<input id="item_${method.id}" value="${method.id}" type="radio" name="shipping" data-pickuppoint="${method.pickuppoint}" data-delivery="${method.time_days}#${method.time_hours}#${method.time_minutes}#${method.week_day}#${method.week_amount}#${method.time}" ${ifChecked ? "checked" : ""}>
|
||||
<div class="photo">
|
||||
@@ -1091,7 +1091,7 @@ function changeCurrentShippingInfo(shippingMethod){
|
||||
app_shop.vars.checkedShipping = shippingMethod.value;
|
||||
}
|
||||
document.getElementById("cop_seection2").addEventListener("click", e => {
|
||||
// kliknięcie na dostawe
|
||||
// Kliknięcie na dostawe
|
||||
if(e.target.name === "shipping"){
|
||||
// Wyczyszczenie wszystkich zaznaczonych punktów odbioru
|
||||
clearSelectedPoints();
|
||||
@@ -1100,7 +1100,7 @@ document.getElementById("cop_seection2").addEventListener("click", e => {
|
||||
if(app_shop.vars.checkedShipping === e.target.value) return;
|
||||
if(e.target.dataset.working_days) e.target.dataset.working_days.split("#").map(function (e) {return parseInt(e, 10);});
|
||||
|
||||
// zapisanie jako poprzednia metoda płatności jeśli nie wymaga wyboru punktu odbioru
|
||||
// Zapisanie jako poprzednia metoda płatności jeśli nie wymaga wyboru punktu odbioru
|
||||
if(e.target.dataset.pickuppoint === "n"){
|
||||
prevShipping=e.target;
|
||||
|
||||
@@ -1110,7 +1110,7 @@ document.getElementById("cop_seection2").addEventListener("click", e => {
|
||||
return;
|
||||
}
|
||||
|
||||
// kliknięcie na płatność
|
||||
// Kliknięcie na płatność
|
||||
if(e.target.name === "payform_id"){
|
||||
// Usunięcie klona poprzedniego przelewu online/ karty płatniczej
|
||||
removePrevClone();
|
||||
@@ -1195,17 +1195,17 @@ function showPaymentMethodModal(method){
|
||||
|
||||
// Metoda oblugujaca kliknieca w metody platnosci w popupie
|
||||
function handlePaymentMethodClick(e){
|
||||
// usuń poprzedni klon i stwórz nowy
|
||||
// Usuń poprzedni klon i stwórz nowy
|
||||
removePrevClone();
|
||||
cloneElement(e.target);
|
||||
|
||||
// zamkniecie modala
|
||||
// Zamkniecie modala
|
||||
ifChosenNewPaymentMethod = true;
|
||||
app_shop.fn.paymentModal.closeModal();
|
||||
return false;
|
||||
}
|
||||
function cloneElement(originalPaymentElement){
|
||||
// sklonowanie kliknietego elementu
|
||||
// Sklonowanie kliknietego elementu
|
||||
const clonedMethod = originalPaymentElement.closest(".osc_item").cloneNode(true);
|
||||
const clonedInput = clonedMethod.querySelector("input");
|
||||
|
||||
@@ -1232,7 +1232,7 @@ function changeDeliveryOptions(){
|
||||
calculateBasketCost();
|
||||
}
|
||||
|
||||
// zmień pokazane metody dostawy
|
||||
// Zmień pokazane metody dostawy
|
||||
function changePrepaidDvp(prepaidStyle, dvpStyle){
|
||||
const prepaid = document.getElementById("osc_order1_prepaid");
|
||||
const dvp = document.getElementById("osc_order1_dvp");
|
||||
@@ -1308,7 +1308,7 @@ const productsPointsEl = document.querySelector("#order2_products_points .operat
|
||||
const summaryCostEl = document.getElementById("summary-cost");
|
||||
const summaryPointsEl = document.getElementById("summary-points");
|
||||
function calculateBasketCost() {
|
||||
// przygotowanie informacji o metodzie dostawy i platnosci
|
||||
// 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"
|
||||
@@ -1341,7 +1341,7 @@ function calculateBasketCost() {
|
||||
checkShowPrice(totalRebateEl, Number(t.total_rebate_without_shipping), t.currency_sign);
|
||||
checkShowPrice(saldoValueEl, Number(t.payment_amount_from_client_balance), t.currency_sign);
|
||||
|
||||
// punkty zamówienia
|
||||
// Punkty zamówienia
|
||||
if(t.products_worth_at_points){
|
||||
productsPointsEl.innerHTML = `${t.products_worth_at_points} ${<iai:variable vid="pkt"/>}.`;
|
||||
productsPointsEl.parentElement.style.display = "flex";
|
||||
@@ -1358,14 +1358,14 @@ function calculateBasketCost() {
|
||||
});
|
||||
};
|
||||
|
||||
// funkcja od pokazania wybranej ceny (np rabat, ubezpieczenie...)
|
||||
// Funkcja od pokazania wybranej ceny (np rabat, ubezpieczenie...)
|
||||
function checkShowPrice(priceContainer, price, currencySign){
|
||||
priceContainer.innerHTML = formatPrice(price, currencySign);
|
||||
if(price && price > 0) priceContainer.parentElement.style.display = "flex";
|
||||
else priceContainer.parentElement.style.display = "none";
|
||||
};
|
||||
|
||||
// funkcja od formatowania ceny
|
||||
// Funkcja od formatowania ceny
|
||||
function formatPrice(price, currencySign) {
|
||||
return format_price(price, { mask: app_shop.vars.currency_format, currency: currencySign, currency_space: app_shop.vars.currency_space, currency_before_price: app_shop.vars.currency_before_value });
|
||||
};
|
||||
@@ -1463,7 +1463,7 @@ const DEACTIVATE_REBATE_CODE = () => JSON.stringify({
|
||||
}`,
|
||||
})
|
||||
|
||||
// aktywacja kodu rabatowego
|
||||
// Aktywacja kodu rabatowego
|
||||
const rebateCode = document.getElementById("rebate_code");
|
||||
async function updateCode(){
|
||||
if(rebateCode.value.trim() === ""){
|
||||
@@ -1497,7 +1497,7 @@ async function updateCode(){
|
||||
toggleActiveCode(false, true);
|
||||
}
|
||||
|
||||
// usunięcie aktywnego kodu rabatowego
|
||||
// Usunięcie aktywnego kodu rabatowego
|
||||
async function removeCode(){
|
||||
app_shop.fn.ajaxLoadSite(1);
|
||||
|
||||
@@ -1515,7 +1515,7 @@ async function removeCode(){
|
||||
}
|
||||
}
|
||||
|
||||
// zmień widoczność kodu rabatowego
|
||||
// Zmień widoczność kodu rabatowego
|
||||
const rebateOptionWrapper = document.querySelector(".rebate__options");
|
||||
const rebateCodeContainer = document.querySelector(".rebate__code");
|
||||
const rebateActiveWrapper = document.querySelector(".rebate__active");
|
||||
@@ -1528,14 +1528,14 @@ function toggleActiveCode(show, error=false){
|
||||
clearValidation(rebateCode);
|
||||
}
|
||||
|
||||
// zmień widoczność
|
||||
// Zmień widoczność
|
||||
rebateOptionWrapper.style.display = show ? "none" : "flex";
|
||||
rebateActiveWrapper.style.display = show ? "block" : "none";
|
||||
|
||||
if(!error) rebateCodeContainer.classList.remove("--fade-in");
|
||||
else rebateCodeContainer.classList.add("--fade-in");
|
||||
|
||||
// zmień wartości
|
||||
// Zmień wartości
|
||||
activeCodeEl.innerHTML = show ? rebateCode.value : "";
|
||||
showInput = error ? true : false;
|
||||
rebateOptionEl.checked = error ? true : false;
|
||||
@@ -1543,7 +1543,7 @@ function toggleActiveCode(show, error=false){
|
||||
else activeCodeEl.innerHTML = "";
|
||||
}
|
||||
|
||||
// eventListenery dla kodu rabatowego
|
||||
// EventListenery dla kodu rabatowego
|
||||
let showInput = false;
|
||||
const rebateCodeWrapper = document.querySelector(".rebate");
|
||||
rebateCodeWrapper.addEventListener("click", (e) => {
|
||||
@@ -1619,16 +1619,16 @@ document.querySelector(".order2_button_order").addEventListener("click", () => {
|
||||
// Sprawdzenie pól formularza
|
||||
if(validateAllInputs() === false) app_shop.vars.validation = 0;
|
||||
|
||||
// znalezienie obecnie zaznaczonej metody dostawy i płatności
|
||||
// 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");
|
||||
|
||||
// sprawdzenie czy użytkownik zaakceptował regulamin
|
||||
// Sprawdzenie czy użytkownik zaakceptował regulamin
|
||||
if(!termsConditionsInput.checked || !cancelConditionsInput.checked){
|
||||
app_shop.vars.validation = 0;
|
||||
showTermsError(termsConditionsInput);
|
||||
showTermsError(cancelConditionsInput);
|
||||
}// sprawdzenie czy użytkownik wybrał metodę dostawy i płatności (też sprawdzenie czy wybrał paczkomat i wpisał voucher)
|
||||
}// Sprawdzenie czy użytkownik wybrał metodę dostawy i płatności (też sprawdzenie czy wybrał paczkomat i wpisał voucher)
|
||||
else {
|
||||
if(deliveryMethod){
|
||||
if(deliveryMethod.dataset.pickuppoint === "y" && deliveryMethod.parentElement.querySelector(".fselectedPoint").innerHTML === "") orderValidationError(<iai:variable vid="Nie wybrano punktu odbioru"/>);
|
||||
@@ -1650,9 +1650,9 @@ document.querySelector(".order2_button_order").addEventListener("click", () => {
|
||||
}
|
||||
}
|
||||
|
||||
// przerwanie składania zamówienia jeśli w trakcie walidacji wystąpił błąd
|
||||
// Przerwanie składania zamówienia jeśli w trakcie walidacji wystąpił błąd
|
||||
if (app_shop.vars.validation === 0) {
|
||||
// scroll do elementów z błędem
|
||||
// Scroll do elementów z błędem
|
||||
if(document.getElementById("order2_terms_conditions").checked && document.getElementById("order2_cancel").checked){
|
||||
const errorEl = document.querySelector(".--error.has-error");
|
||||
if(errorEl) scrollToHeight(errorEl)
|
||||
@@ -1690,7 +1690,7 @@ function showTermsError(input){
|
||||
input.parentElement.querySelector("a").classList.add("text-danger");
|
||||
}
|
||||
}
|
||||
// złożenie zamówienia
|
||||
// Złożenie zamówienia
|
||||
function createOrder(deliveryMethod, paymentMethod){
|
||||
// Weź dane klienta
|
||||
const email = document.getElementById("client_email").value;
|
||||
@@ -1736,11 +1736,11 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
if (!lastname) lastname = (deliveryLastname) ? deliveryLastname : 'Firma';
|
||||
}
|
||||
|
||||
// czyszczenie imienia i nazwiska ze znaków specjalnych
|
||||
// Czyszczenie imienia i nazwiska ze znaków specjalnych
|
||||
firstname = firstname.replace(/[&\/\\#,+()$~%.'":*?<>{}!@~`^_]/g, "");
|
||||
lastname = lastname.replace(/[&\/\\#,+()$~%.'":*?<>{}!@~`^_]/g, "");
|
||||
|
||||
// dodatkowe informacje (uwagi, faktura, punkt odbioru)
|
||||
// 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 : "";
|
||||
|
||||
@@ -1784,7 +1784,7 @@ function createOrder(deliveryMethod, paymentMethod){
|
||||
},
|
||||
};
|
||||
|
||||
// złóż zamówienie jako zalogowany/niezalogowany użytkownik.
|
||||
// Złóż zamówienie jako zalogowany/niezalogowany użytkownik.
|
||||
if (document.querySelector(".--logged")) sendOrder(order);
|
||||
else {
|
||||
const clientData = new FormData();
|
||||
@@ -2029,7 +2029,9 @@ async function fetchData(options = {}) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// element z numerem edycji jeśli jest
|
||||
|
||||
function initOSCOP(){
|
||||
// Element z numerem edycji jeśli jest
|
||||
const editNumber = document.getElementById("edit-number");
|
||||
|
||||
if(document.querySelector(".ajax_cop").childElementCount && !editNumber) changeRegion(null, true);
|
||||
@@ -2125,8 +2127,9 @@ if(editNumber){
|
||||
linkParameter: "?query=orderDetails",
|
||||
alert: false,
|
||||
});
|
||||
|
||||
// Jesli error to zatrzymaj funkcje
|
||||
if(!data?.data?.orderDetails) return changeRegion();
|
||||
if(!data?.data?.orderDetails || !data) return changeRegion();
|
||||
|
||||
// Wstawienie danych
|
||||
insertEditData(data.data.orderDetails);
|
||||
@@ -2183,10 +2186,12 @@ if(editNumber){
|
||||
}
|
||||
|
||||
getEditData();
|
||||
// funkcja od uzupełnienia inputów
|
||||
// Funkcja od uzupełnienia inputów
|
||||
function fillInput(input, value){
|
||||
input.value = value;
|
||||
input.classList.add("focused");
|
||||
input.parentElement.classList.add("--success", "has-success");
|
||||
}
|
||||
}
|
||||
}
|
||||
initOSCOP();
|
||||
Reference in New Issue
Block a user