This commit is contained in:
2025-09-25 03:03:31 +05:00
commit ae480cf2f6
2768 changed files with 1485826 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

View File

@@ -0,0 +1,3 @@
$(function () {
})();

View File

@@ -0,0 +1,362 @@
const Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 3000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
});
document.addEventListener('DOMContentLoaded', function(e) {
Event.listen('cartsUpdatedFromSidebar', event => {
showProductShowButton();
})
let pageURL = new URL(location);
if (pageURL.searchParams.has('sorting')) {
document.getElementById('SortBy').value = pageURL.searchParams.get('sorting');
}
let productPerPageSelect = document.getElementById('show-product-count-select');
if (pageURL.searchParams.has('perPage')) {
productPerPageSelect.value = pageURL.searchParams.get('perPage');
} else {
if (productPerPageSelect) {
productPerPageSelect.value = 32;
}
}
});
function subscribeUserToNewsletter(event) {
event.preventDefault();
$.ajax({
method: event.target.method,
url: event.target.action,
data: Object.fromEntries(new FormData(event.target).entries()),
success: (response) => {
Swal.fire('Üstünlikli goşuldy', '', 'success');
},
error: (exception) => {
Swal.fire('Üstünlikli goşuldy', '', 'success') ;
}
});
}
function loginAction(event) {
event.preventDefault();
// let phoneINPUT = document.getElementById('PopupCustomerPhoneContainer');
let verificationINPUT = document.getElementById('PopupCustomerVerificationCodeContainer');
$.ajax({
method: event.target.method,
url: window.Lara.routes.auth.twoFactor,
data: Object.fromEntries(new FormData(event.target).entries()),
success(response) {
console.log({response});
if (response.message == 'Login') {
window.location.reload(true);
}
if (response.message != 'success') {
return;
}
verificationINPUT.classList.remove('d-none');
verificationINPUT.setAttribute('required', 'required');
},
error(exception) {
console.log({exception});
// Swal.fire('Üstünlikli goşuldy', '', 'success') ;
},
done(data) {
console.log({a: data});
}
});
}
function updateLikeCount() {
let wishlistCount = document.getElementById('wishlist-count');
// let sidebarWishlistCount = document.getElementById('sidebar-wishlist-count');
$.ajax({
method: 'POST',
url: window.Lara.routes.products.likeCount,
data: {_token: document.querySelector('meta[name=csrf-token]').getAttribute('value')},
success: (response) => {
wishlistCount.innerText = response.count;
},
error: (exception) => {
console.log({exception});
}
});
}
function toggleProductLike(event, elem, id) {
event.preventDefault();
if (! window.Lara.auth.status) {
return;
}
let formData = {
id: id,
_token: document.querySelector('meta[name=csrf-token]').getAttribute('value'),
};
$.ajax({
method: 'POST',
url: window.Lara.routes.products.like,
data: formData,
success: (response) => {
if (response.attached) {
document.getElementById(id + '-favourite-icon-dislike')?.classList.add('d-none');
document.getElementById(id + '-favourite-icon-like')?.classList.remove('d-none');
Toast.fire({
icon: 'success',
title: window.Lara.translations.favouries.liked
})
} else {
document.getElementById(id + '-favourite-icon-dislike')?.classList.remove('d-none');
document.getElementById(id + '-favourite-icon-like')?.classList.add('d-none');
Toast.fire({
icon: 'info',
title: window.Lara.translations.favouries.unliked
})
}
Event.fire('likesUpdated');
},
error: (exception) => {
console.log({exception});
}
});
}
function toggleLikeProductShowButton(event, product_id) {
let addToLikeButtonMessage = document.getElementById('add-to-like-button-message');
let addedToLikeButtonMessage = document.getElementById('added-to-like-button-message');
toggleProductLike(event, event.target, product_id);
if (addToLikeButtonMessage.classList.contains('d-none')) {
addToLikeButtonMessage.classList.remove('d-none');
addToLikeButtonMessage.classList.add('d-flex');
addedToLikeButtonMessage.classList.remove('d-flex');
addedToLikeButtonMessage.classList.add('d-none');
} else {
addToLikeButtonMessage.classList.add('d-none');
addToLikeButtonMessage.classList.remove('d-flex');
addedToLikeButtonMessage.classList.add('d-flex');
addedToLikeButtonMessage.classList.remove('d-none');
}
}
function addToCart(product_id, with_count) {
if (! window.Lara.auth.status) {
return;
}
let quantity = with_count ? document.getElementById('product-quantity')?.value : null;
product_id = window.Lara.productOnCart ? window.Lara.productOnCart : product_id;
let formData = {
product_id: product_id,
_token: document.querySelector('meta[name=csrf-token]').getAttribute('value'),
quantity: quantity
};
$.ajax({
method: 'POST',
url: window.Lara.routes.carts.add,
data: formData,
success: (response) => {
Event.fire('cartsUpdated');
},
error: (exception) => {
if (exception.status == 422) {
if (validationMessage = exception.responseJSON.data.validations['product_out_of_stock_count']) {
alert(validationMessage);
}
}
}
});
}
function removeCartItem(product_id) {
if (! window.Lara.auth.status) {
return;
}
let formData = {
product_id: product_id,
_token: document.querySelector('meta[name=csrf-token]').getAttribute('value'),
};
fetch(window.Lara.routes.carts.remove, {
method: 'POST',
headers: {
'Accept': 'application/json, text/plain, */*',
'Content-Type': 'application/json'
},
credentials: 'same-origin',
body: JSON.stringify(formData)
}).then(response => response.json())
.then(data => {
Event.fire('cartsUpdated');
});
}
function updateCart(product_id, increment_by_one) {
if (! window.Lara.auth.status) {
return;
}
let quantity = new Number(document.getElementById('product-quantity')?.value);
if (increment_by_one || quantity == 0) {
quantity += 1;
}
let formData = {
product_id: product_id,
_token: document.querySelector('meta[name=csrf-token]').getAttribute('value'),
quantity: quantity
};
$.ajax({
method: 'POST',
url: window.Lara.routes.carts.update,
data: formData,
success: (response) => {
Event.fire('cartsUpdated');
},
error: (exception) => {
console.log({exception});
}
});
}
function updateProductShowButton() {
let addToCartMessage = document.getElementById('add-to-cart-button-message');
let removeFromCartMessage = document.getElementById('remove-from-cart-button-message');
let removeTrashIcon = document.getElementById('remove-from-cart-trash');
addToCartMessage.classList.remove('d-flex');
addToCartMessage.classList.add('d-none');
removeFromCartMessage.classList.remove('d-none');
removeFromCartMessage.classList.add('d-flex');
removeTrashIcon.classList.remove('d-none');
}
function showProductShowButton() {
let addToCartMessage = document.getElementById('add-to-cart-button-message');
let removeFromCartMessage = document.getElementById('remove-from-cart-button-message');
let removeTrashIcon = document.getElementById('remove-from-cart-trash');
let productQuantity = document.getElementById('product-quantity');
addToCartMessage.classList.remove('d-none');
addToCartMessage.classList.add('d-flex');
removeFromCartMessage.classList.remove('d-flex');
removeFromCartMessage.classList.add('d-none');
removeTrashIcon.classList.add('d-none');
productQuantity.value = 1;
}
function productShowCounterChanged(product_id, event) {
let addToCartMessage = document.getElementById('add-to-cart-button-message');
if (! addToCartMessage.classList.contains('d-flex')) {
updateCart(product_id, event.type == 'click');
}
}
async function postData(url = '', data = {}) {
const response = await fetch(url, {
method: 'POST',
mode: 'cors',
cache: 'no-cache',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json'
},
referrerPolicy: 'no-referrer',
body: JSON.stringify(data)
});
return response.json();
}
async function globalSearch(q) {
let response = await fetch(window.Lara.routes.app.globalSearch + '?q=' + q);
return response.json();
}
function addSorting(value) {
addUrlParam('sorting', value);
}
function addUrlParam(key, value, update = true) {
let pageURL = new URL(location);
pageURL.searchParams.delete(key)
pageURL.searchParams.append(key, value);
if (update) {
location.href = pageURL.href;
}
}
function sideScroll(element,direction,speed,distance,step){
scrollAmount = 0;
var slideTimer = setInterval(function(){
if (direction == 'left'){
element.scrollLeft -= step;
} else {
element.scrollLeft += step;
}
scrollAmount += step;
if (scrollAmount >= distance) {
window.clearInterval(slideTimer);
}
}, speed);
}
function scrollToClosest(position, elem, selector, points = 1000) {
if (position == 'left') {
let box = $(elem).parent().find(selector);
let x = ((box.width() / 2)) + box.scrollLeft();
box.animate({
scrollLeft: x,
});
// $(elem).parent().find(selector).scrollLeft(-points);
} else {
// $(elem).parent().find(selector).scrollLeft(+points);
}
}
// function orderDeliveryTimeChanged(event) {
// let clientTime = document.getElementById('order-client-time-container');
// if (event.target.value == 'standart') {
// clientTime.classList.remove('d-none');
// } else {
// clientTime.classList.add('d-none');
// }
// }

View File

@@ -0,0 +1 @@
createApp({data:function(){return{locale:window.Lara.locale,routes:window.Lara.routes,likedProducts:[],wishlist_count:0}},methods:{routeFor:function(t){return this.routes.products.show.replace("slug",t)},imageFor:function(t){return t+" 1x, "+t+" 2x"},getLikedProducts:function(){var t=this;fetch(this.routes.user.likesCount).then((function(t){return t.json()})).then((function(e){t.wishlist_count=e.count,document.getElementById("wishlist-count").innerText=e.count,Array.from(document.getElementsByClassName("favourites-icon-count")).forEach((function(t){t.innerText=e.count}))})),fetch(this.routes.user.likes).then((function(t){return t.json()})).then((function(e){t.likedProducts=e.data}))},clearWishlist:function(){this.likedProducts=[],this.wishlist_count=0,postData(this.routes.likes.clear,{_token:document.querySelector("meta[name=csrf-token]").getAttribute("value")}).then((function(t){return"success"==t.message?location.reload(!0):""}))}},mounted:function(){var t=this;window.Lara.auth.status&&this.getLikedProducts(),Event.listen("likesUpdated",(function(e){t.getLikedProducts()})),Event.listen("clearWishlist",(function(e){t.clearWishlist()}))}}).mount("#likes-sidebar");

View File

@@ -0,0 +1 @@
createApp({data:function(){return{routes:window.Lara.routes,locale:window.Lara.locale,all_categories:window.Lara.navigation.categories,categories_dropdown_hidden:!0,categories_to_show:new Object,activeLinks:[]}},methods:{hideCategoryDropdown:function(){this.categories_dropdown_hidden=!0},showCategoriesDropdown:function(){this.categories_dropdown_hidden=!1},showCategoriesFor:function(o){var t=this;this.categories_to_show=this.all_categories.find((function(t){return t.id==o})),this.all_categories.forEach((function(o){return t.activeLinks[o.slug]=!1})),this.activeLinks[this.categories_to_show.slug]=!0},categoryShowRouteFor:function(o){return this.routes.categories.products.replace("slug",o)}},mounted:function(){var o=this;this.all_categories.forEach((function(t,e){0==e?(o.categories_to_show=t,o.activeLinks[t.slug]=!0):o.activeLinks[t.slug]=!1})),Event.listen("showCategoriesDropdownEvent",(function(){o.showCategoriesDropdown()}))}}).mount("#categories-navigation");

View File

@@ -0,0 +1 @@
document.addEventListener("DOMContentLoaded",(function(){var e=document.getElementById("pagination-next"),a=document.querySelector('div[data-widget="carousel-container"]');if(e){var n=!1,t=!1;elementAppeared(e,(function(){if(!n&&!t){n=!0,e.innerText="Ýüklenilýär";var r=new URL(location.href);r.searchParams.set("page",new URL(e.href).searchParams.get("page")),r.searchParams.has("sorting")&&r.searchParams.set("sorting",r.searchParams.get("sorting")),history.pushState({},"",r.href),$.ajax(location.href,{success:function(r){r.pagination.next_page_url||(e.style.display="none",t=!0),e.href=r.pagination.next_page_url,a.insertAdjacentHTML("beforeend",r.products),n=!1,new LazyLoad({elements_selector:".lazyload",threshold:100})}})}}))}}));