!(function (y, k) {
async function T(e) {
const t = await fetch("/checkout/current-cart");
var a = await t.json();
(k = a), Object.assign(e, k);
}
y(function () {
var cartTitle = '
{VARIANT_QUANTITY_PRESENTATION}{VARIANT_PRICE}
',
d =
'
Descontos: {CART_DISCOUNT_TOTAL}
',
m =
'
',
u = "
Nenhum produto em seu carrinho.
";
function p(e) {
var t = [];
if (
(0 < e.items.length && (t = y.merge(t, e.items)),
e.sales && 0 < e.sales.length)
)
for (var a = 0; a < e.sales.length; a++)
t = y.merge(t, e.sales[a].items);
return t;
}
async function t(e) {
y(".shopping-cart-content")
.empty()
.append(
'
'
),
await T(e);
var t = SHOW_PRODUCT_PRICE
? y.number(e.totalWithDiscount, 2, ",", ".")
: "",
a = y(".shopping-cart-content").empty(),
o = p(e);
if (e && 0 != o.length) {
a.append(cartTitle);
a.append(productsContainer);
let productName = "";
let divWrapper = "";
for (var i = 0, n = 0; n < o.length; n++) {
var s = o[n],
r = SHOW_PRODUCT_PRICE
? "R$ " + y.number(s.totalPriceWithDiscount, 2, ",", ".")
: "",
l = s.quantity;
s.variant.isFractionalStock && (l = 1),
(productName = s.name.split(" ("));
divWrapper = document.querySelectorAll(".products-container");
if (innerWidth < 991 || screen.width < 991) {
a.append(
c
.replace(
"{PRODUCT_IMAGE}",
s.image ||
"/bundles/flexyftwostore/img/product-placeholder.gif"
)
.replace("{VARIANT_NAME}", productName[0])
.replace("{VARIANT_PRICE}", r)
.replace(
"{VARIANT_QUANTITY_PRESENTATION}",
"Quantidade: " + w(s.quantity)
)
),
(i += l);
} else {
[...divWrapper].forEach((div) => {
div.insertAdjacentHTML(
"beforeend",
c
.replace(
"{PRODUCT_IMAGE}",
s.image ||
"/bundles/flexyftwostore/img/product-placeholder.gif"
)
.replace("{VARIANT_NAME}", productName[0])
.replace("{VARIANT_PRICE}", r)
.replace(
"{VARIANT_QUANTITY_PRESENTATION}",
"Quantidade: " + w(s.quantity)
)
);
});
// divWrapper.insertAdjacentHTML( 'beforeend', c.replace("{PRODUCT_IMAGE}", s.image || "/bundles/flexyftwostore/img/product-placeholder.gif").replace("{VARIANT_NAME}", productName[0]).replace("{VARIANT_PRICE}", r).replace("{VARIANT_QUANTITY_PRESENTATION}", "Quantidade: " + w(s.quantity))),
i += l;
}
}
0 < e.salePromotionDiscountTotal &&
SHOW_PRODUCT_PRICE &&
a.append(
d.replace(
"{CART_DISCOUNT_TOTAL}",
"R$ " + y.number(e.salePromotionDiscountTotal, 2, ",", ".")
)
),
window.innerWidth < 991 || screen.width < 991
? y(".cart-items-count").html(
'
' + Number(i) + ""
)
: y(".cart-items-count").html(Number(i)),
a.append(m.replace("{CART_TOTAL}", "R$ " + t));
} else a.html(u);
}
function a(e) {
for (var t = p(e), a = 0, o = 0; o < t.length; o++) {
var i = t[o],
n = i.quantity;
a += n = i.variant.isFractionalStock ? 1 : n;
}
window.innerWidth < 991 || screen.width < 991
? y(".cart-items-count").html(
'
' + Number(a) + ""
)
: y(".cart-items-count").html(Number(a));
}
function i(e, t) {
if (!(t && t < e)) return 1;
alert(
"Não foi possível adicionar " +
e +
" produtos ao carrinho. Atualmente possuímos apenas " +
t
);
}
var o = 0,
n = y("#header"),
s = y("#header-main-fixed"),
r = y(".header-bg"),
l = y(".top-header-bg"),
v = document.getElementById("gotop"),
f = null != v;
y(window).scroll(function () {
var e = y(this).scrollTop();
o < e
? 50 < e &&
(n.addClass("header-top-fixed"),
n.find(".header-top-row").addClass("dis-n"),
r.addClass("header-bg-fixed"),
s.addClass("header-main-fixed"),
l.addClass("top-header-bg-fix"),
f && (v.style.display = "block"))
: e < 50 &&
(n.removeClass("header-top-fixed"),
n.find(".header-top-row").removeClass("dis-n"),
s.removeClass("header-main-fixed"),
r.removeClass("header-bg-fixed"),
l.removeClass("top-header-bg-fix"),
f && (v.style.display = "none")),
(o = e);
}),
y(".top-page").click(function () {
(document.body.scrollTop = 0), (document.documentElement.scrollTop = 0);
}),
y("#nav-bestseller .next").click(function () {
y("#owl-bestseller").trigger("owl.next");
}),
y("#nav-bestseller .prev").click(function () {
y("#owl-bestseller").trigger("owl.prev");
}),
y("#owl-bestseller").owlCarousel({
items: 4,
itemsCustom: !1,
itemsDesktop: [1199, 3],
itemsDesktopSmall: [980, 2],
itemsTablet: [630, 1],
itemsTabletSmall: !1,
itemsMobile: [479, 1],
singleItem: !1,
itemsScaleUp: !1,
responsive: !0,
responsiveRefreshRate: 200,
responsiveBaseWidth: window,
autoPlay: !1,
stopOnHover: !1,
navigation: !1,
}),
y("#nav-summer-sale .next").click(function () {
y("#owl-summer-sale").trigger("owl.next");
}),
y("#nav-summer-sale .prev").click(function () {
y("#owl-summer-sale").trigger("owl.prev");
}),
y("#owl-summer-sale").owlCarousel({
items: 3,
itemsCustom: !1,
itemsDesktop: [1199, 2],
itemsDesktopSmall: [980, 2],
itemsTablet: [630, 1],
itemsTabletSmall: !1,
itemsMobile: [479, 1],
singleItem: !1,
itemsScaleUp: !1,
responsive: !0,
responsiveRefreshRate: 200,
responsiveBaseWidth: window,
autoPlay: !1,
stopOnHover: !1,
navigation: !1,
}),
y("#nav-child .next").click(function () {
y("#owl-child").trigger("owl.next");
}),
y("#nav-child .prev").click(function () {
y("#owl-child").trigger("owl.prev");
}),
y("#owl-child").owlCarousel({
items: 3,
itemsCustom: !1,
itemsDesktop: [1199, 2],
itemsDesktopSmall: [980, 2],
itemsTablet: [630, 1],
itemsTabletSmall: !1,
itemsMobile: [479, 1],
singleItem: !1,
itemsScaleUp: !1,
responsive: !0,
responsiveRefreshRate: 200,
responsiveBaseWidth: window,
autoPlay: !1,
stopOnHover: !1,
navigation: !1,
}),
y("#nav-tabs .next").click(function () {
y("#owl-new").trigger("owl.next"),
y("#owl-featured").trigger("owl.next");
}),
y("#nav-tabs .prev").click(function () {
y("#owl-new").trigger("owl.prev"),
y("#owl-featured").trigger("owl.prev");
}),
y("#owl-new").owlCarousel({
items: 4,
itemsCustom: !1,
itemsDesktop: [1199, 3],
itemsDesktopSmall: [980, 2],
itemsTablet: [630, 1],
itemsTabletSmall: !1,
itemsMobile: [479, 1],
singleItem: !1,
itemsScaleUp: !1,
responsive: !0,
responsiveRefreshRate: 200,
responsiveBaseWidth: window,
autoPlay: !1,
stopOnHover: !1,
navigation: !1,
}),
y("#owl-featured").owlCarousel({
items: 4,
itemsCustom: !1,
itemsDesktop: [1199, 3],
itemsDesktopSmall: [980, 2],
itemsTablet: [630, 1],
itemsTabletSmall: !1,
itemsMobile: [479, 1],
singleItem: !1,
itemsScaleUp: !1,
responsive: !0,
responsiveRefreshRate: 200,
responsiveBaseWidth: window,
autoPlay: !1,
stopOnHover: !1,
navigation: !1,
}),
y("#nav-tabs2 .next").click(function () {
y("#owl-new2").trigger("owl.next"),
y("#owl-featured2").trigger("owl.next");
}),
y("#nav-tabs2 .prev").click(function () {
y("#owl-new2").trigger("owl.prev"),
y("#owl-featured2").trigger("owl.prev");
}),
y("#owl-new2").owlCarousel({
items: 3,
itemsCustom: !1,
itemsDesktop: [1199, 2],
itemsDesktopSmall: [980, 2],
itemsTablet: [630, 1],
itemsTabletSmall: !1,
itemsMobile: [479, 1],
singleItem: !1,
itemsScaleUp: !1,
responsive: !0,
responsiveRefreshRate: 200,
responsiveBaseWidth: window,
autoPlay: !1,
stopOnHover: !1,
navigation: !1,
}),
y("#owl-featured2").owlCarousel({
items: 3,
itemsCustom: !1,
itemsDesktop: [1199, 2],
itemsDesktopSmall: [980, 2],
itemsTablet: [630, 1],
itemsTabletSmall: !1,
itemsMobile: [479, 1],
singleItem: !1,
itemsScaleUp: !1,
responsive: !0,
responsiveRefreshRate: 200,
responsiveBaseWidth: window,
autoPlay: !1,
stopOnHover: !1,
navigation: !1,
}),
y("#owl-partners").owlCarousel({
items: 5,
itemsCustom: !1,
itemsDesktop: [1199, 4],
itemsDesktopSmall: [980, 3],
itemsTablet: [630, 1],
itemsTabletSmall: !1,
itemsMobile: [479, 1],
singleItem: !1,
itemsScaleUp: !1,
responsive: !0,
responsiveRefreshRate: 200,
responsiveBaseWidth: window,
autoPlay: !0,
stopOnHover: !1,
navigation: !1,
}),
y("#owl-home-slider").owlCarousel({
items: 1,
itemsCustom: !1,
itemsDesktop: [1199, 1],
itemsDesktopSmall: [980, 1],
itemsTablet: [630, 1],
itemsTabletSmall: !1,
itemsMobile: [479, 1],
singleItem: !1,
itemsScaleUp: !1,
responsive: !0,
responsiveRefreshRate: 200,
responsiveBaseWidth: window,
autoPlay: !0,
stopOnHover: !1,
navigation: !1,
}),
y(function () {
y(".dropdown").hover(
function () {
y(this).addClass("open");
},
function () {
y(this).removeClass("open");
}
);
});
y("body").find(".holder").length ||
y("body").append("
"),
y("div.holder").jPages({
containerID: "products",
previous: ".feature-block a[data-role='prev']",
next: ".feature-block a[data-role='next']",
animation: "fadeInRight",
perPage: 4,
}),
y(".revolution").revolution({
delay: 9e3,
startwidth: 1170,
startheight: 500,
hideThumbs: 10,
fullWidth: "on",
fullScreen: "on",
navigationType: "none",
navigationArrows: "solo",
navigationStyle: "round",
navigationHAlign: "center",
navigationVAlign: "bottom",
navigationHOffset: 30,
navigationVOffset: 30,
soloArrowLeftHalign: "left",
soloArrowLeftValign: "center",
soloArrowLeftHOffset: 20,
soloArrowLeftVOffset: 0,
soloArrowRightHalign: "right",
soloArrowRightValign: "center",
soloArrowRightHOffset: 20,
soloArrowRightVOffset: 0,
touchenabled: "on",
}),
y(".tool_tip").tooltip(),
y("#product-zoom").elevateZoom({
zoomType: "inner",
cursor: "crosshair",
zoomWindowFadeIn: 500,
zoomWindowFadeOut: 750,
});
var e = y("#gal1"),
e =
(e.find("a[data-image]").hover(function () {
y(".product-media-details").removeClass("video");
var e = y(this).attr("data-image"),
t = y(this).attr("data-zoom-image");
y("#product-zoom").data("elevateZoom").swaptheimage(e, t);
}),
e.find("a[data-video]").on("mouseover", function () {
var e = y(this),
t = y(".product-media-details"),
a = t.find(".product-video");
a.find("iframe").remove(),
a.append('
'),
new YT.Player("player", {
width: "100%",
videoId: e.data("video"),
events: {
onReady: function (e) {
e.target.playVideo();
},
},
});
t.addClass("video");
}),
new Date().getTime()),
e = new Date(e + 864e5);
function h() {
var e, t, a;
y("[name='customer[type]']").length &&
((e = y("[name='customer[type]']").val()),
(a = (t = y("#customer_customerType")).find("option")),
"cpf" == e
? (y(".cpf").show().find(":input").attr("required", "required"),
y(".cnpj").hide().find(":input").removeAttr("required"),
t.val(
a
.filter(function () {
return "B2C" == y(this).text();
})
.val()
))
: (y(".cnpj")
.show()
.find(":input:not(#check):not(#customer_taxationRegime)")
.attr("required", "required"),
y(".cpf").hide().find(":input").removeAttr("required"),
t.val(
a
.filter(function () {
return "B2B" == y(this).text();
})
.val()
)));
}
function g(e) {
return (e = e.replace(/\./g, "")), parseFloat(e.replace(/,/g, "."));
}
function w(e) {
return (e =
-1 < (e = e.toString()).indexOf(".")
? (e = Number(e).toFixed(3)).replace(".", ",")
: e);
}
y(".time").countdown({
date: e,
yearsAndMonths: !0,
leadingZero: !0,
}),
y(".ul-side-category li a").click(function () {
var e = y(this).next();
return (
!e.hasClass("sub-category") ||
("none" === e.css("display")
? y(this).next().slideDown()
: (y(this).next().slideUp(),
y(this).next().find(".sub-category").slideUp()),
!1)
);
}),
y("[name='customer[type]']").on("change blur", function () {
h();
}),
y(".cart-sumary .header-mini-cart").on("click", function (e) {
t(e);
}),
y("#check").on("change click", function () {
y(this).is(":checked")
? y("#customer_cnpj_stateRegistration")
.addClass("readonly")
.attr("readonly", "readonly")
.val("ISENTO")
: y("#customer_cnpj_stateRegistration")
.removeClass("readonly")
.removeAttr("readonly")
.val("");
}),
y(".main-category-block label").on("click", function () {
window.location.href = y(this).data("url");
}),
y("#partners img")
.on("mouseenter", function (e) {
var t = y(this);
t.data("src", t.attr("src")).attr("src", t.data("hover"));
})
.on("mouseleave", function (e) {
var t = y(this);
t.attr("src", t.data("src"));
}),
y(".product-related-carousel").owlCarousel({
items: 6,
itemsCustom: !1,
itemsDesktop: [1199, 3],
itemsDesktopSmall: [980, 2],
itemsTablet: [630, 1],
itemsTabletSmall: !1,
itemsMobile: [479, 1],
singleItem: !1,
itemsScaleUp: !1,
responsive: !0,
responsiveRefreshRate: 200,
responsiveBaseWidth: window,
autoPlay: !0,
stopOnHover: !0,
navigation: !1,
}),
y(".product-related-nav .next").click(function () {
y(y(this).data("carousel")).trigger("owl.next");
}),
y(".product-related-nav .prev").click(function () {
y(y(this).data("carousel")).trigger("owl.prev");
}),
y(".flexy-cart-product-quantity, .input-number-inf")
.on("focus", function (e) {
var t = y(this);
t.data("quantity", g(t.val()));
})
.on("blur", function (e) {
var t = y(this);
t.val() && t.val() != t.data("quantity")
? t.trigger("change")
: t.val(t.data("quantity"));
}),
y("body").on(
"cart-success",
".flexy-add-to-cart, .flexy-add-to-booking",
".other-btn",
function (e, t) {
a(t),
(window.innerWidth < 991 || screen.width < 991) &&
alert("Produto adicionado ao carrinho!");
}
),
y("body").on("cart-error", function (e, t) {
alert(t);
}),
y("#create-gift-list-form").on("submit", function () {
if (
(y("#create-gift-list-button").attr("disabled", !0),
y(this).attr("data-sent"))
)
return !1;
y(this).attr("data-sent", "data-sent");
});
var b,
e = y(".flexy-weight-mask");
e.mask("#######0,000", {
placeholder: "0,000",
reverse: !0,
});
e.on("keyup", function (e) {
clearTimeout(b),
(b = setTimeout(function () {
!(function (e, t, a) {
var o = a.data("stock");
if (i(g(t), o)) return 1;
a.val(w(o)).trigger("change"),
e.preventDefault(),
e.stopImmediatePropagation();
})(e, y(this).val(), y(this)) || y(this).trigger("blur");
}, 1200));
}),
e.on("keydown", function (e) {
clearTimeout(b);
}),
y(".stock-verified").on("change keypress keyup keydown", function (e) {
var t = y(this);
i(Number(t.val()), t.data("stock")) ||
(t.val(w(t.data("stock"))).trigger("change"),
e.preventDefault(),
e.stopImmediatePropagation());
}),
h(),
a(k);
}),
new WOW().init();
})(jQuery, CART),
(function () {
var t = [],
a = new Set([]);
function o(e) {
return t.indexOf(e);
}
function e() {
$(".search-box").animate(
{
opacity: "toggle",
},
500,
function () {}
),
$(".search-modal-background").animate(
{
opacity: "toggle",
},
500,
function () {}
);
}
$(function () {
$(".additional-add-to-cart").on("click", function () {
var e = $(this).data("variant-id");
-1 < o(e)
? (t.splice(o(e), 1), alert("Produto removido!"))
: (t.push(e), alert("Produto adicionado!")),
$(".main_cart_add").data("additional-variant-ids", t);
});
}),
$(function () {
$(".additional-to-cart").on("click", function () {
var e = $(this).data("addition-id");
a.add(e),
$(".flexy-add-to-cart, .flexy-add-to-booking").one(
"cart-error",
function () {
a.delete(e);
}
);
});
}),
$(function () {
$(".search-box-toggle").click(function () {
e(), $(".search-input").focus();
}),
$(".search-modal-background").click(function () {
e();
});
}),
$(function () {
$(".coupon-validate").on("keyup", function (e) {
$(this).val(
$(this)
.val()
.replace(/[^0-9a-zA-Z_]/g, "")
);
});
}),
$(function () {
$("#zipCodeCart").on("keyup", function (e) {
var t, a;
9 === $(this).val().length &&
((container = $(".cep_validate")),
(t = "https://viacep.com.br/ws/" + $(this).val() + "/json/"),
((a = new XMLHttpRequest()).onreadystatechange = function () {
if (4 == a.readyState && 200 == a.status) {
var e = JSON.parse(a.responseText);
if (e.erro)
return (
$("#calculation_cep").attr("disabled", !0),
container.html(
"
Este CEP não existe.
Favor informe um CEP válido "
),
$(".shipping-estimate").hide(),
!1
);
}
e.logradouro &&
($(".cep_validate").html(""),
$("#calculation_cep").attr("disabled", !1),
$("#calculation_cep").focus());
}),
a.open("GET", t, !0),
a.send()),
0 === $(this).val().length && $(".cep_validate").html("");
});
}),
$(function () {
$("#zipCode").click(function () {
var e, a;
-1 !== window.location.pathname.indexOf("quote") &&
((e = $(".flexy-input-postcode").val()),
(e =
[location.protocol, "//", location.host, location.pathname].join(
""
) +
"?zipCode=" +
e),
(a = ""),
$(".f2-quote-observation").each(function () {
var e = $(this).data("observation"),
t = $(this).val();
a += "&" + e + "=" + t;
}),
(window.location = e + a));
});
}),
$(function () {
$(".copy-to-clipboard").click(function () {
let e = $(this);
var t = e.data("text");
let a = document.createElement("input");
document.body.appendChild(a),
a.setAttribute("id", "dummy_id"),
(document.getElementById("dummy_id").value = t),
a.select(),
document.execCommand("copy"),
document.body.removeChild(a),
e.find(".fa-check").length ||
((t = document.createElement("span")),
e.append(t),
$(t).addClass("fa fa-check")),
e.fadeOut(300).fadeIn(300).prop("title", "Copiado!");
});
}),
$(function () {
$(".payment-box .nav-tabs [role=tab]").on("click", function () {
var e = $("[name='checkout[paymentMethod][0][name]']:checked").val();
let t = new RegExp("payment.method.creditcard..+");
t.test(e) || $("#installments-tax").hide();
});
});
})();
document.addEventListener("DOMContentLoaded", function (event) {
let headerHeight = $("#header").height() || 118;
if (window.innerWidth > 991 || screen.width > 991) {
if (headerHeight) {
document.querySelector("body").style.paddingTop = headerHeight + "px";
} else {
document.querySelector("body").style.paddingTop = 118 + "px";
}
} else {
document.querySelector("body").style.paddingTop = headerHeight + "px";
}
$("svg#open-menu").on("click", () => {
$(".menu-mobile-container").css("transform", "translate(0)");
});
$("svg#esc-menu").on("click", () => {
$(".menu-mobile-container").css("transform", "translate(-100%)");
});
const catBannerWidth = $("a.category-link").width();
const catBannerWidthMobile = $(".category-link-carousel").width();
window.innerWidth > 991 || screen.width > 991
? $("a.category-link-carousel").css("height", catBannerWidth)
: $("a.category-link-carousel").css("height", catBannerWidthMobile);
var maxHeight = 0;
$(".deposition-div").each(function () {
if ($(this).height() > maxHeight) {
maxHeight = $(this).height();
}
});
var maxHeight2 = 0;
if (window.innerWidth < 991 || screen.width < 991) {
$(".sign-in-container").each(function () {
if ($(this).height() > maxHeight2) {
maxHeight2 = $(this).height();
}
});
}
var maxHeight3 = 0;
$(".equal-pi").each(function () {
if ($(this).height() > maxHeight3) {
maxHeight3 = $(this).height();
}
return maxHeight3;
});
document.querySelectorAll(".each-worker-space").forEach((item) => {
item.style.height = maxHeight3 + "px";
});
var maxVal = 0;
$(".category-item").each(function () {
if ($(this).attr("data-slick-index") > maxVal) {
maxVal = $(this).attr("data-slick-index");
}
return maxVal;
});
let allCategoryCarouselItems = [
...document.querySelectorAll(".category-item"),
];
allCategoryCarouselItems.forEach((item, index) => {
if ($(item).attr("data-slick-index") === maxVal) {
$(item).addClass("last-item");
}
});
const brandsBannerMobile = $(".brands-banner-item.slick-slide").width();
window.innerWidth < 991 || screen.width < 991
? $(".brands-banner-item.slick-slide").css("height", brandsBannerMobile)
: "";
$(".brands-banner-item.slick-slide:after").css("width", brandsBannerMobile);
$(".deposition-div").height(maxHeight);
$("body").on("click", ".additional-to-cart", function (event) {
var e = $(this).data("addition-id");
t.add(e),
$(".flexy-add-to-cart").one("cart-error", function () {
t.delete(e);
});
});
$("body").on("click", ".btn-qty button.remove", function (event) {
let inputQty = $(this).parents(".btn-qty").find(".product-quantity");
let qty = parseFloat($(inputQty).val());
if (qty > 1) {
$(inputQty).val(qty - 1);
}
});
$("body").on("click", ".btn-qty button.add", function (event) {
let inputQty = $(this).parents(".btn-qty").find(".product-quantity");
let qty = parseFloat($(inputQty).val());
$(inputQty).val(qty + 1);
});
$("body").on("click", ".btn-qty-2 button.remove-2", function (event) {
let inputQty = $(this).parents(".btn-qty-2").find(".product-quantity");
let qty = parseFloat($(inputQty).val());
if (qty > 1) {
$(inputQty).val(qty - 1);
}
});
$("body").on("click", ".btn-qty-2 button.add-2", function (event) {
let inputQty = $(this).parents(".btn-qty-2").find(".product-quantity");
let qty = parseFloat($(inputQty).val());
$(inputQty).val(qty + 1);
});
$("body").on("click", ".btn-add-to-cart-qty", function (event) {
var $this = $(this);
var inputQty = $this
.parents(".controls-add-cart")
.find(".product-quantity");
var qty = parseFloat($(inputQty).val());
var additionalIds = $this.data("additional-variant-ids") || [];
var dc = $this.data("distributioncenter") || [];
var varId = $this.data("variant-id");
var attrVal = {};
$.ajax({
url: "/cart/add",
type: "post",
dataType: "json",
data: {
id: varId,
quantity: qty,
additionalVariantId: additionalIds,
distributionCenter: dc,
attributeValues: attrVal,
},
beforeSend: function () {
$this
.parents(".controls-add-cart")
.find(".btn-add-to-cart-qty")
.attr("disabled", !0);
},
success: function (e) {
window.location.href = "/cart";
},
error: function (e) {
alert(e.responseJSON.error);
$(inputQty).val(qty);
},
}).always(function () {
$this
.parents(".controls-add-cart")
.find(".btn-add-to-cart-qty")
.removeAttr("disabled");
});
});
$("body").on("click", ".other-btn", function (event) {
var $this = $(this);
var inputQty = $this
.parents(".controls-add-cart")
.find(".product-quantity");
var qty = parseFloat($(inputQty).val());
var additionalIds = $this.data("additional-variant-ids") || [];
var dc = $this.data("distributioncenter") || [];
var varId = $this.data("variant-id");
var attrVal = {};
$.ajax({
url: "/cart/add",
type: "post",
dataType: "json",
data: {
id: varId,
quantity: qty,
additionalVariantId: additionalIds,
distributionCenter: dc,
attributeValues: attrVal,
},
beforeSend: function () {
$this
.parents(".controls-add-cart")
.find(".btn-add-to-cart-qty")
.attr("disabled", !0);
},
success: function (e) {
$this
.parents(".controls-add-cart")
.find(".btn-add-to-cart-qty")
.trigger("cart-success", [e.cart]);
// $('.header-mini-cart').addClass('open')
// setTimeout(function() {
// $('.header-mini-cart').removeClass('open')
// }, 3500)
},
error: function (e) {
alert(e.responseJSON.error);
$(inputQty).val(qty);
},
}).always(function () {
$this
.parents(".controls-add-cart")
.find(".btn-add-to-cart-qty")
.removeAttr("disabled");
});
});
$(".buy-more-modal").on("click", function () {
$("#custom-products-modal").modal("hide");
});
$(".go-to-cart-more-modal").on("click", function () {
$("#custom-products-modal").modal("hide");
window.location.href = "/cart";
});
$("body").on("click", ".btn-add-to-cart-qty-2", function (event) {
var $this = $(this);
var dataCustomProducts = $this.data("personalized-product");
var inputQty = $this
.parent()
.parent()
.parent()
.find(".input-group.btn-qty")
.find("input.quantity");
var qty = parseFloat($(inputQty).val());
var additionalIds = $this.data("additional-variant-ids") || [];
var dc = $this.data("distributioncenter") || [];
var varId = $this.data("variant-id");
var attrVal = {};
$.ajax({
url: "/cart/add",
type: "post",
dataType: "json",
data: {
id: varId,
quantity: qty,
additionalVariantId: additionalIds,
distributionCenter: dc,
attributeValues: attrVal,
},
beforeSend: function () {
$this
.parents(".controls-add-cart")
.find(".btn-add-to-cart-qty")
.attr("disabled", !0);
},
success: function (e) {
if (dataCustomProducts) {
$("#custom-products-modal").modal("show")
setTimeout(function () {
window.location.href = "/checkout";
}, 5000)
} else {
window.location.href = "/cart";
}
},
error: function (e) {
alert(e.responseJSON.error);
$(inputQty).val(qty);
},
}).always(function () {
$this
.parents(".controls-add-cart")
.find(".btn-add-to-cart-qty")
.removeAttr("disabled");
});
});
$("body").on("click", ".other-btn-2", function (event) {
var $this = $(this);
var dataCustomProducts = $this.data("personalized-product");
var inputQty = $this
.parent()
.parent()
.find(".input-group.btn-qty")
.find("input.quantity");
var qty = parseFloat($(inputQty).val());
var additionalIds = $this.data("additional-variant-ids") || [];
var dc = $this.data("distributioncenter") || [];
var varId = $this.data("variant-id");
var attrVal = {};
$.ajax({
url: "/cart/add",
type: "post",
dataType: "json",
data: {
id: varId,
quantity: qty,
additionalVariantId: additionalIds,
distributionCenter: dc,
attributeValues: attrVal,
},
beforeSend: function () {
$this
.parents(".controls-add-cart")
.find(".btn-add-to-cart-qty")
.attr("disabled", !0);
},
success: function (e) {
if (dataCustomProducts) {
$("#custom-products-modal").modal("show")
}
$this
.parent()
.find(".btn-add-to-cart-qty")
.trigger("cart-success", [e.cart]);
},
error: function (e) {
alert(e.responseJSON.error);
$(inputQty).val(qty);
},
}).always(function () {
$this
.parents(".controls-add-cart")
.find(".btn-add-to-cart-qty")
.removeAttr("disabled");
});
});
if (window.innerWidth > 991 || screen.width > 991) {
let pagination = $(".paginate-pagination.paginate-pagination-0").width();
let pagination2 = pagination + 70;
let calcPag = "calc(100% - " + pagination2 + "px" + ")";
if (pagination) {
let pagContainer = $(".title-container-lp-worker");
pagContainer.css("width", calcPag);
}
} else {
let pagination = $(".paginate-pagination.paginate-pagination-0").width();
let pagination2 = pagination + 42;
let calcPag = "calc(100% - " + pagination2 + "px" + ")";
if (pagination) {
let pagContainer = $(".title-container-lp-worker");
pagContainer.css("width", calcPag);
}
}
$("body").on(
"cart-success",
[".flexy-add-to-cart", ".other-btn", ".other-btn-2"],
function (e, t) {
var o;
(o = $(".header-mini-cart")).trigger("click");
$("#header").addClass("header-scroll-up")
if (window.innerWidth > 991 || screen.width > 991) {
o.addClass("open");
window.setTimeout(function () {
o.removeClass("open");
$("#header").removeClass("header-scroll-up")
}, 5000);
}
}
);
$("body").on("cart-error", function (e, t) {
alert(t);
});
let headerScroll = $("#header")
let lastScrollTop = 0;
$(window).scroll(function(event){
let st = $(this).scrollTop();
if (st > lastScrollTop){
headerScroll.removeClass("header-scroll-up");
} else {
headerScroll.addClass("header-scroll-up").animate( "slow" );
}
lastScrollTop = st;
});
$(".seller-main-banner").slick({
dots: true,
speed: 300,
arrows: true,
slidesToShow: 1,
infinite: true,
swipeToSlide: true,
autoplay: true,
prevArrow:
'
',
nextArrow:
'
',
autoplaySpeed: 6000,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
infinite: true,
swipeToSlide: true,
},
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
infinite: true,
swipeToSlide: true,
},
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
infinite: true,
swipeToSlide: true,
},
},
],
});
$(".seller-main-banner-mobile").slick({
infinite: true,
dots: true,
speed: 300,
arrows: true,
slidesToShow: 1,
autoplay: true,
prevArrow:
'
',
nextArrow:
'
',
autoplay: false,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
},
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
},
},
],
});
document.addEventListener("DOMContentLoaded", function (event) {
$(".slick-main-banner-pdp").slick({
dots: true,
speed: 300,
arrows: true,
slidesToShow: 1,
infinite: false,
swipeToSlide: true,
autoplay: false,
prevArrow:
'
',
nextArrow:
'
',
autoplaySpeed: 6000,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
infinite: false,
swipeToSlide: true,
},
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
infinite: false,
swipeToSlide: true,
},
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
infinite: false,
swipeToSlide: true,
},
},
],
});
});
document.addEventListener("DOMContentLoaded", function (event) {
$(".slick-main-banner-pdp-mobile").slick({
infinite: false,
dots: true,
speed: 300,
arrows: true,
slidesToShow: 1,
prevArrow:
'
',
nextArrow:
'
',
autoplay: false,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: false,
},
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
},
},
],
});
});
$(".shelf-container").slick({
infinite: false,
dots: false,
speed: 300,
arrows: true,
slidesToShow: 5,
slidesToScroll: 5,
prevArrow:
'
',
nextArrow:
'
',
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 4,
slidesToScroll: 4,
infinite: true,
},
},
{
breakpoint: 600,
settings: {
slidesToShow: 2,
slidesToScroll: 2,
swipeToSlide: true,
arrows: true,
},
},
{
breakpoint: 480,
settings: {
slidesToShow: 2,
slidesToScroll: 2,
swipeToSlide: true,
arrows: true,
},
},
],
});
});