Este commit está contenido en:
2023-04-24 18:37:05 +05:30
padre edd3113258
commit d70c0637c2
Se han modificado 8 ficheros con 353 adiciones y 197 borrados
+178
Ver fichero
@@ -0,0 +1,178 @@
function indexInit(){
function init(){
initData();
}
async function initData(){
const ids = await getProductIdService();
if(!ids) return;
let dataAcc = [];
for(let i=0;i<ids.length;i++){
let currId = ids[i];
let {productid} = currId;
let resData =await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/itemtagscombination/productid/${productid}`,true);
if(resData.isError){
alert(resData.errorMsg.message);
return;
}
let res = resData.response;
res = JSON.parse(res.result);
dataAcc = [...dataAcc,...res.slice(0, 4)];
}
shuffleArray(dataAcc);
console.log(dataAcc);
let html = '';
for(let i=0;i<dataAcc.length;i++){
html += getCardHTML({...dataAcc[i],img:dataAcc[i].itemimageurl})
}
$('.slider-hero').html(html);
console.log(ids);
initSlider();
$('.topproductbtn').click(function (e){
let productid = $(e.target).data('productid');
let itemid = $(e.target).data('itemid');
let name = $(e.target).data('name');
debugger;
window.location.href = `/productdetails.html?productId=${productid}#itemid=${itemid}`;
});
}
function initSlider(){
$('.slider-hero').slick({
dots: false,
lazyLoad: 'ondemand',
// autoplay: true,
// autoplaySpeed: 1000,
slidesToShow: 4,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
infinite: true,
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
},
{
breakpoint: 1199,
settings: {
slidesToShow: 5,
slidesToScroll: 1,
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
}
},
{
breakpoint: 767,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
}
},
{
breakpoint: 575,
settings: {
autoplay: true,
slidesToShow: 3,
}
}
// You can unslick at a given breakpoint now by adding:
// settings: "unslick"
// instead of a settings object
]
});
$(".slick-prev").addClass("btn text-white");
$(".slick-next").addClass("btn text-white");
$(".slick-prev").html("←");
$(".slick-next").html("→")
}
function getCardHTML({itemname,img,sku,itemid,productid}){
let defaultImg = img ? imgServerNameBuild(img): `./dist/assets/imgs/nophoto.png`;
return ` <div class="card h-100 mx-1 text-center bg-gray-4 border-0">
<div class="card-body h-100">
<div class="d-flex flex-column h-100 justify-content-between">
<img src="${defaultImg}" class="w-100"/>
<p class="mb-0 fs-7 py-2">${itemname}</p>
<p class="fw-600 text-primary mb-0 topproductbtn" data-name="${itemname}" data-sku="${sku}" data-productid="${productid}" data-itemid="${itemid}">Buy Now</p>
</div>
</div>
</div>`;
return ` <div class="card h-100 mx-1 text-center bg-gray-4 border-0 top_sell">
<div class="card-body">
<img src="${defaultImg}" class="w-100"/>
<p class="mb-0 fs-7 py-2">${itemname}</p>
<p class="fw-600 text-primary mb-0" data-sku="${sku}" data-productid="${productid}" data-itemid="${itemid}">Buy Now</p>
</div>
</div>`;
}
function getProductIdService(){
return new Promise(async (reslove,reject)=>{
let resData =await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/getallproducts`,true);
if(resData.isError){
alert(resData.errorMsg.message);
return;
}
let res = resData.response;
res = JSON.parse(res.result);
let resultItem = [];
for(let i=0;i<res.length;i++){
if(resultItem.length == 2) break;
if(res[i].productname.includes('RAM ORA')||res[i].productname.includes('SSD ORA')){
resultItem.push(res[i]);
}
}
return reslove(resultItem)
});
}
init();
}
indexInit();
+63 -63
Ver fichero
@@ -1318,69 +1318,69 @@
// slidesToScroll: 3
// });
$('.slider-hero').slick({
dots: false,
lazyLoad: 'ondemand',
// autoplay: true,
// autoplaySpeed: 1000,
slidesToShow: 4,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
infinite: true,
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
},
{
breakpoint: 1199,
settings: {
slidesToShow: 5,
slidesToScroll: 1,
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
}
},
{
breakpoint: 767,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
}
},
{
breakpoint: 575,
settings: {
autoplay: true,
slidesToShow: 3,
}
}
// You can unslick at a given breakpoint now by adding:
// settings: "unslick"
// instead of a settings object
]
});
// $('.slider-hero').slick({
// dots: false,
// lazyLoad: 'ondemand',
// // autoplay: true,
// // autoplaySpeed: 1000,
// slidesToShow: 4,
// slidesToScroll: 1,
// responsive: [
// {
// breakpoint: 1024,
// settings: {
// slidesToShow: 3,
// slidesToScroll: 3,
// infinite: true,
// }
// },
// {
// breakpoint: 600,
// settings: {
// slidesToShow: 2,
// slidesToScroll: 2
// }
// },
// {
// breakpoint: 480,
// settings: {
// slidesToShow: 1,
// slidesToScroll: 1
// }
// },
// {
// breakpoint: 1199,
// settings: {
// slidesToShow: 5,
// slidesToScroll: 1,
// }
// },
// {
// breakpoint: 991,
// settings: {
// slidesToShow: 3,
// slidesToScroll: 1,
// }
// },
// {
// breakpoint: 767,
// settings: {
// slidesToShow: 3,
// slidesToScroll: 1,
// }
// },
// {
// breakpoint: 575,
// settings: {
// autoplay: true,
// slidesToShow: 3,
// }
// }
// // You can unslick at a given breakpoint now by adding:
// // settings: "unslick"
// // instead of a settings object
// ]
// });
//pres overview slider
$(".press_slider-hero").slick({
+3 -1
Ver fichero
@@ -1,7 +1,9 @@
let nav_html = `
<header class="header-area section-padding-1 transparent-bar">
<div class="header-large-device">
<div class="header-bottom sticky-bar" >
<div class="header-bottom sticky-bar" style="
background: #ed3838;
">
<div class="container">
<div class="header-bottom-flex">
<div class="logo-menu-wrap d-flex">
+1 -1
Ver fichero
@@ -371,7 +371,7 @@ debugger;
currentComb = itemtagscombinationRes[i];
location.hash = itemtagscombinationRes[i].itemname.trim();
// location.hash = itemtagscombinationRes[i].itemname.trim();
// $('.productname').html(itemtagscombinationRes[i].itemname);
// $('#skudetailitem').val(itemtagscombinationRes[i].sku)
+3 -2
Ver fichero
@@ -64,6 +64,7 @@ function ramProductsInit(){
$('.product_card_section').html(html);
$('.ramcard').click(function(e){
debugger;
let sku = $(e.target).data('itemid');
let itemid = $(e.target).data('itemid');
debugger;
@@ -82,9 +83,9 @@ function ramProductsInit(){
<!--desktop--->
<div class="col-sm-4 p-3">
<div class="product_card_1 shadow ram_card">
<div class="product_card_3 shadow ram_card">
<div class="card-item-header">
<div class="card-header-sub-1"><a class=" py-md-1" href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}">
<div class="card-header-sub-3"><a class=" py-md-1" href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}">
<img src="./dist/assets/imgs/Navbar/ora_ddr4_desktop.png" class="w-100 h-100"></a>
</div>
</div>
+8
Ver fichero
@@ -3,6 +3,14 @@ const uid = function(){
return Date.now().toString(36) + Math.random().toString(36).substr(2);
}
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}
function getCurrencySymbol(value=0) {
let type = 'INR'
if (type) {