"use strict";(self.webpackChunkapp_lapieza=self.webpackChunkapp_lapieza||[]).push([[891],{2891:($,f,c)=>{c.r(f),c.d(f,{StoresRoutingModule:()=>H});var u=c(5528),p=c(8834),g=c(9417),_=c(4909),m=c(5205),k=c(1653),n=c.n(k),d=(c(6503),c(6646)),S=c(9121),y=c(2599),t=c(8457),v=c(3108),P=c(7374),F=c(99);const T=()=>[5,4,3,2,1],R=()=>[1,2,3,4,5],j=()=>["facebook","google","twitter","instagram"],b=o=>["/product",o],I=()=>["/compare"];function D(o,l){if(1&o){const e=t.RV6();t.j41(0,"li")(1,"a",10),t.bIt("click",function(){const r=t.eBV(e).$implicit,s=t.XpG();return t.Njj(s.toggleCategory(r))}),t.EFF(2),t.k0s()()}if(2&o){const e=l.$implicit,i=t.XpG();t.R7$(),t.AVh("active",i.selectedCategories.includes(e)),t.R7$(),t.SpI(" ",e," ")}}function C(o,l){if(1&o&&(t.j41(0,"li"),t.nrm(1,"i",72),t.k0s()),2&o){const e=l.$implicit,i=t.XpG().$implicit;t.R7$(),t.AVh("fill",e<=i)}}function E(o,l){if(1&o){const e=t.RV6();t.j41(0,"li")(1,"div",69)(2,"input",70),t.bIt("change",function(){const r=t.eBV(e).$implicit,s=t.XpG();return t.Njj(s.toggleRating(r))}),t.k0s(),t.j41(3,"div",71)(4,"ul",44),t.DNE(5,C,2,2,"li",11),t.k0s(),t.j41(6,"span",55),t.EFF(7),t.k0s()()()()}if(2&o){const e=l.$implicit,i=t.XpG();t.R7$(2),t.Y8G("checked",i.selectedRatings.includes(e)),t.R7$(3),t.Y8G("ngForOf",t.lJ4(3,R)),t.R7$(2),t.SpI("(",e," Estrellas)")}}function x(o,l){if(1&o){const e=t.RV6();t.j41(0,"li")(1,"div",69)(2,"input",70),t.bIt("change",function(){const r=t.eBV(e).$implicit,s=t.XpG();return t.Njj(s.toggleDiscount(r))}),t.k0s(),t.j41(3,"label",71)(4,"span",73),t.EFF(5),t.nI1(6,"translate"),t.k0s()()()()}if(2&o){const e=l.$implicit,i=t.XpG();t.R7$(2),t.Y8G("checked",i.selectedDiscounts.includes(e)),t.R7$(3),t.Lme("",e,"% ",t.bMT(6,3,"off"),"")}}function w(o,l){if(1&o&&(t.j41(0,"li"),t.nrm(1,"i",72),t.k0s()),2&o){const e=l.$implicit,i=t.XpG();t.R7$(),t.AVh("fill",e<=(null==i.shopDetails?null:i.shopDetails.rating))}}function G(o,l){if(1&o&&(t.j41(0,"li")(1,"a",74),t.nrm(2,"i"),t.k0s()()),2&o){const e=l.$implicit;t.R7$(2),t.HbH("fa-brands fa-"+e)}}function M(o,l){if(1&o&&(t.j41(0,"li"),t.nrm(1,"i",72),t.k0s()),2&o){const e=l.$implicit,i=t.XpG().$implicit;t.R7$(),t.AVh("fill",e<=(i.rating||0))}}function J(o,l){if(1&o&&(t.j41(0,"del"),t.EFF(1),t.nI1(2,"currency"),t.k0s()),2&o){const e=t.XpG().$implicit;t.R7$(),t.JRh(t.ii3(2,1,e.stroked_price,"RD$","symbol","1.2-2"))}}function O(o,l){if(1&o&&(t.j41(0,"div")(1,"div",75)(2,"div",76)(3,"div",77)(4,"a",78),t.nrm(5,"img",79),t.k0s(),t.j41(6,"div"),t.nrm(7,"app-wishlist-button-icon",80),t.k0s(),t.j41(8,"ul",81)(9,"li",82)(10,"a",83),t.nrm(11,"i",84),t.k0s()(),t.j41(12,"li",85)(13,"a",78),t.nrm(14,"i",86),t.k0s()()()()(),t.j41(15,"div",87)(16,"div",88)(17,"span",89),t.EFF(18),t.k0s(),t.j41(19,"a",78)(20,"h5",73),t.EFF(21),t.k0s()(),t.j41(22,"p",90),t.EFF(23),t.k0s(),t.j41(24,"div",91)(25,"ul",44),t.DNE(26,M,2,2,"li",11),t.k0s(),t.j41(27,"span"),t.EFF(28),t.k0s()(),t.j41(29,"h5",92)(30,"span",93),t.EFF(31),t.nI1(32,"currency"),t.k0s(),t.DNE(33,J,3,6,"del",94),t.k0s(),t.nrm(34,"app-cart-button-icon",95),t.k0s()()()()),2&o){const e=l.$implicit;t.R7$(4),t.Y8G("routerLink",t.eq3(23,b,e.id)),t.R7$(),t.Y8G("src",e.thumbnail_image,t.B4B)("alt",e.name),t.R7$(2),t.Y8G("product",e)("productId",e.id),t.R7$(6),t.Y8G("routerLink",t.lJ4(25,I)),t.R7$(5),t.JRh(e.category||"General"),t.R7$(),t.Y8G("routerLink",t.eq3(26,b,e.id)),t.R7$(2),t.JRh(e.name),t.R7$(2),t.JRh(e.description||"No description"),t.R7$(3),t.Y8G("ngForOf",t.lJ4(28,R)),t.R7$(2),t.SpI("(",e.rating||0,")"),t.R7$(3),t.JRh(t.ii3(32,18,e.main_price,"RD$","symbol","1.2-2")),t.R7$(2),t.Y8G("ngIf",e.has_discount),t.R7$(),t.Y8G("productId",e.id)("variant",e.variant||"5x5x5")("weight",e.weight||0)("initialQuantity",1)}}function B(o,l){if(1&o){const e=t.RV6();t.j41(0,"li",64)(1,"a",65),t.bIt("click",function(){const r=t.eBV(e).$implicit,s=t.XpG();return t.Njj(s.goToPage(r))}),t.EFF(2),t.k0s()()}if(2&o){const e=l.$implicit,i=t.XpG();t.AVh("active",e===i.currentPage),t.R7$(2),t.JRh(e)}}let L=(()=>{class o{shopService;categoryService;route;zone;shopDetails;products=[];filteredProducts=[];categories=[];shopId=0;searchTerm="";selectedCategories=[];priceRange={min:0,max:2e4};selectedRatings=[];selectedDiscounts=[];sortBy="popularity";discountOptions=[10,20,30,40,50];currentPage=1;itemsPerPage=12;totalPages=1;ionRangeSliderInstance;constructor(e,i,r,s){this.shopService=e,this.categoryService=i,this.route=r,this.zone=s}deriveDescription(e){return`${e.name} - Un producto de calidad de ${e.category||"nuestra tienda"}.`}ngOnInit(){this.route.params.subscribe(e=>{this.shopId=+e.id,this.initializeTooltips(),this.fetchShopDetails(),this.fetchCategories(),this.fetchProducts()})}ngAfterViewInit(){console.log("Feather Icons:",d),this.initializeRangeSlider(),d.replace()}refreshFeatherIcons(){setTimeout(()=>{try{d.replace()}catch(e){console.error("Error refreshing feather icons:",e)}},0)}initializeTooltips(){try{[].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map(i=>new m.m_(i))}catch(e){console.error("Error initializing tooltips:",e)}}initializeRangeSlider(){setTimeout(()=>{const e=n()(".js-range-slider");e.length?(e.ionRangeSlider({type:"double",min:0,max:2e4,from:this.priceRange.min,to:this.priceRange.max,prefix:"RD$ ",step:100,prettify_enabled:!0,prettify_separator:".",values_separator:" - ",force_edges:!0,onChange:i=>{this.zone.run(()=>{this.priceRange.min=i.from,this.priceRange.max=i.to,this.applyFilters()})}}),this.ionRangeSliderInstance=e.data("ionRangeSlider")):console.error("Range slider element not found")},100)}fetchShopDetails(){this.shopService.getShopInfo(this.shopId).subscribe(e=>{console.log("Detalles de la tienda:",e),this.shopDetails=e.data,this.shopDetails.logo||console.warn("La propiedad logo no est\xe1 definida en shopDetails")},e=>{console.error("Error fetching shop details:",e)})}fetchProducts(){this.shopService.getTopFromThisSellerProducts(this.shopId).subscribe(e=>{this.products=e.data.map(i=>({...i,category:i.category||this.deriveCategory(i.name),quantity:0,main_price:this.extractPrice(i.main_price),stroked_price:this.extractPrice(i.stroked_price),rating:i.rating||0,description:i.description||this.deriveDescription(i)})),this.filteredProducts=[...this.products],this.categories=[...new Set(this.products.map(i=>i.category))],this.updatePagination(),this.applyFilters(),setTimeout(()=>{d.replace()},100)},e=>{console.error("Error fetching products:",e)})}fetchCategories(){this.categoryService.getAllCategories().subscribe(e=>{this.categories=e},e=>{console.error("Error fetching categories:",e)})}applyFilters(){let e=[...this.products];this.searchTerm?.trim()&&(e=e.filter(r=>r.name.toLowerCase().includes(this.searchTerm.toLowerCase().trim()))),this.selectedCategories.length>0&&(e=e.filter(r=>this.selectedCategories.includes(r.category))),(this.priceRange.min>=0||this.priceRange.max>0)&&(e=e.filter(r=>{const s=this.extractPrice(r.main_price);return s>=this.priceRange.min&&s<=this.priceRange.max})),this.selectedRatings.length>0&&(e=e.filter(r=>this.selectedRatings.includes(Math.floor(r.rating)))),this.selectedDiscounts.length>0&&(e=e.filter(r=>{if(!r.has_discount)return!1;const s=parseFloat(r.discount.replace("-","").replace("%",""));return this.selectedDiscounts.some(h=>s>=h)})),e=this.applySorting(e),this.totalPages=Math.ceil(e.length/this.itemsPerPage);const i=(this.currentPage-1)*this.itemsPerPage;this.filteredProducts=e.slice(i,i+this.itemsPerPage),setTimeout(()=>{d.replace()},0)}extractPrice(e){if("number"==typeof e)return e;try{return parseFloat(e.replace("RD$","").replace(/,/g,"").trim())}catch{return 0}}deriveCategory(e){return e.split(" ")[0]||"General"}applySorting(e){const i=[...e];switch(this.sortBy){case"price-low":return i.sort((r,s)=>this.extractPrice(r.main_price)-this.extractPrice(s.main_price));case"price-high":return i.sort((r,s)=>this.extractPrice(s.main_price)-this.extractPrice(r.main_price));case"name":return i.sort((r,s)=>r.name.localeCompare(s.name));default:return i.sort((r,s)=>s.sales-r.sales)}}toggleCategory(e){const i=this.selectedCategories.indexOf(e);-1===i?this.selectedCategories.push(e):this.selectedCategories.splice(i,1),this.currentPage=1,this.applyFilters()}toggleRating(e){console.log("Rating seleccionado:",e);const i=this.selectedRatings.indexOf(e);-1===i?this.selectedRatings.push(e):this.selectedRatings.splice(i,1),this.currentPage=1,this.applyFilters(),this.refreshFeatherIcons()}toggleDiscount(e){const i=this.selectedDiscounts.indexOf(e);-1===i?this.selectedDiscounts.push(e):this.selectedDiscounts.splice(i,1),this.currentPage=1,this.applyFilters()}clearFilters(){this.searchTerm="",this.selectedCategories=[],this.priceRange={min:0,max:2e4},this.selectedRatings=[],this.selectedDiscounts=[],this.sortBy="popularity",this.currentPage=1,this.filteredProducts=[...this.products],this.updateSlider(),this.updatePagination()}addToCart(e){e.quantity=e.quantity?e.quantity+1:1,console.log("Producto agregado al carrito:",e)}increaseQty(e){e.quantity=(e.quantity||0)+1}decreaseQty(e){e.quantity&&e.quantity>0&&e.quantity--}updateQty(e){(!e.quantity||e.quantity<0)&&(e.quantity=0)}updatePagination(){this.totalPages=Math.ceil(this.products.length/this.itemsPerPage),this.applyFilters()}prevPage(){this.currentPage>1&&(this.currentPage--,this.applyFilters())}nextPage(){this.currentPage<this.totalPages&&(this.currentPage++,this.applyFilters())}goToPage(e){this.currentPage=e,this.applyFilters()}getPages(){return Array.from({length:this.totalPages},(e,i)=>i+1)}getSortLabel(){switch(this.sortBy){case"price-low":return"price_low_to_high";case"price-high":return"price_high_to_low";case"name":return"a_to_z";default:return"popularity"}}updateSlider(){this.ionRangeSliderInstance&&this.ionRangeSliderInstance.update({from:this.priceRange.min,to:this.priceRange.max})}static \u0275fac=function(i){return new(i||o)(t.rXU(v.s),t.rXU(P.M),t.rXU(F.x),t.rXU(t.SKi))};static \u0275cmp=t.VBU({type:o,selectors:[["app-store-details"]],decls:151,vars:83,consts:[[1,"section-b-space","shop-section"],[1,"container-fluid-lg"],[1,"row"],[1,"col-xxl-3","col-lg-4"],[1,"left-box","wow","fadeInUp"],[1,"shop-left-sidebar"],[1,"back-button"],[1,"fa-solid","fa-arrow-left"],[1,"filter-category"],[1,"filter-title"],["href","javascript:void(0)",3,"click"],[4,"ngFor","ngForOf"],["id","accordionExample",1,"accordion","custom-accordion"],[1,"accordion-item"],["id","headingOne",1,"accordion-header"],["type","button","data-bs-toggle","collapse","data-bs-target","#collapseOne",1,"accordion-button"],["id","collapseOne",1,"accordion-collapse","collapse","show"],[1,"accordion-body"],[1,"form-floating","theme-form-floating-2","search-box"],["type","search","placeholder","Search ..",1,"form-control",3,"ngModelChange","input","ngModel"],["for","search"],["id","headingThree",1,"accordion-header"],["type","button","data-bs-toggle","collapse","data-bs-target","#collapseThree",1,"accordion-button","collapsed"],["id","collapseThree",1,"accordion-collapse","collapse","show"],[1,"range-slider"],["type","range","min","0","max","20000","step","100",1,"js-range-slider",3,"ngModelChange","input","ngModel"],[1,"price-range-display"],["id","headingSix",1,"accordion-header"],["type","button","data-bs-toggle","collapse","data-bs-target","#collapseSix",1,"accordion-button","collapsed",3,"click"],["id","collapseSix",1,"accordion-collapse","collapse","show"],[1,"category-list","custom-padding"],["id","headingFour",1,"accordion-header"],["type","button","data-bs-toggle","collapse","data-bs-target","#collapseFour",1,"accordion-button","collapsed"],["id","collapseFour",1,"accordion-collapse","collapse","show"],[1,"col-xxl-9","col-lg-8"],[1,"vendor-detail-box-2"],[1,"row","g-4"],[1,"col-xxl-2","col-md-3"],[1,"vendor-logo"],["alt","Shop Logo",1,"img-fluid",3,"src"],[1,"col-xxl-8","col-md-6"],[1,"vendor-name","p-center-left"],[1,"vendor-list-name"],[1,"product-rating","vendor-rating"],[1,"rating"],[1,"share-contact"],[1,"vendor-share"],[1,"vendor-content"],[1,"btn","btn-sm","btn-animation"],[1,"show-button"],[1,"filter-button-group","mt-0"],[1,"filter-button","d-inline-block","d-lg-none"],[1,"fa-solid","fa-filter"],[1,"top-filter-menu"],[1,"category-dropdown"],[1,"text-content"],[1,"dropdown"],["type","button","id","dropdownMenuButton1","data-bs-toggle","dropdown",1,"dropdown-toggle"],[1,"fa-solid","fa-angle-down"],[1,"dropdown-menu"],[1,"dropdown-item",3,"click"],[1,"row","g-sm-4","g-3","row-cols-xxl-4","row-cols-xl-3","row-cols-lg-2","row-cols-md-3","row-cols-2","product-list-section"],[1,"custom-pagination"],[1,"pagination","justify-content-center"],[1,"page-item"],["href","javascript:void(0)",1,"page-link",3,"click"],[1,"fa-solid","fa-angles-left"],["class","page-item",3,"active",4,"ngFor","ngForOf"],[1,"fa-solid","fa-angles-right"],[1,"form-check","ps-0","m-0","category-list-box"],["type","checkbox",1,"checkbox_animated",3,"change","checked"],[1,"form-check-label"],["data-feather","star"],[1,"name"],["href","javascript:void(0)"],[1,"product-box-4","h-100","wow","fadeInUp"],[1,"product-header"],[1,"product-image"],[3,"routerLink"],[1,"img-fluid","blur-up","lazyload",3,"src","alt"],[3,"product","productId"],[1,"option"],["data-bs-toggle","tooltip","data-bs-placement","top","title","Vista R\xe1pida"],["href","javascript:void(0)","data-bs-toggle","modal","data-bs-target","#view"],[1,"iconly-Show","icli"],["data-bs-toggle","tooltip","data-bs-placement","top","title","Comparar"],[1,"iconly-Swap","icli"],[1,"product-footer"],[1,"product-detail"],[1,"span-name"],[1,"text-content","mt-1","mb-2","product-content","pdescriptiontxt"],[1,"product-rating","mt-2"],[1,"price"],[1,"theme-color"],[4,"ngIf"],[3,"productId","variant","weight","initialQuantity"]],template:function(i,r){1&i&&(t.j41(0,"section",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"div",4)(5,"div",5)(6,"div",6)(7,"h3"),t.nrm(8,"i",7),t.EFF(9),t.nI1(10,"translate"),t.k0s()(),t.j41(11,"div",8)(12,"div",9)(13,"h3"),t.EFF(14),t.nI1(15,"translate"),t.k0s(),t.j41(16,"a",10),t.bIt("click",function(){return r.clearFilters()}),t.EFF(17),t.nI1(18,"translate"),t.k0s()(),t.j41(19,"ul"),t.DNE(20,D,3,3,"li",11),t.k0s()(),t.j41(21,"div",12)(22,"div",13)(23,"h2",14)(24,"button",15)(25,"span"),t.EFF(26),t.nI1(27,"translate"),t.k0s()()(),t.j41(28,"div",16)(29,"div",17)(30,"div",18)(31,"input",19),t.mxI("ngModelChange",function(h){return t.DH7(r.searchTerm,h)||(r.searchTerm=h),h}),t.bIt("input",function(){return r.applyFilters()}),t.k0s(),t.j41(32,"label",20),t.EFF(33),t.nI1(34,"translate"),t.k0s()()()()(),t.j41(35,"div",13)(36,"h2",21)(37,"button",22)(38,"span"),t.EFF(39),t.nI1(40,"translate"),t.k0s()()(),t.j41(41,"div",23)(42,"div",17)(43,"div",24)(44,"input",25),t.mxI("ngModelChange",function(h){return t.DH7(r.priceRange.min,h)||(r.priceRange.min=h),h}),t.bIt("input",function(){return r.applyFilters()}),t.k0s(),t.j41(45,"div",26)(46,"span"),t.EFF(47),t.nI1(48,"currency"),t.k0s(),t.EFF(49," - "),t.j41(50,"span"),t.EFF(51),t.nI1(52,"currency"),t.k0s()()()()()(),t.j41(53,"div",13)(54,"h2",27)(55,"button",28),t.bIt("click",function(){return r.refreshFeatherIcons()}),t.j41(56,"span"),t.EFF(57),t.nI1(58,"translate"),t.k0s()()(),t.j41(59,"div",29)(60,"div",17)(61,"ul",30),t.DNE(62,E,8,4,"li",11),t.k0s()()()(),t.j41(63,"div",13)(64,"h2",31)(65,"button",32)(66,"span"),t.EFF(67),t.nI1(68,"translate"),t.k0s()()(),t.j41(69,"div",33)(70,"div",17)(71,"ul",30),t.DNE(72,x,7,5,"li",11),t.k0s()()()()()()()(),t.j41(73,"div",34)(74,"div",35)(75,"div",36)(76,"div",37)(77,"div",38),t.nrm(78,"img",39),t.k0s()(),t.j41(79,"div",40)(80,"div",41)(81,"div")(82,"div",42)(83,"h3"),t.EFF(84),t.k0s(),t.j41(85,"div",43)(86,"ul",44),t.DNE(87,w,2,2,"li",11),t.k0s(),t.j41(88,"span"),t.EFF(89),t.k0s()()(),t.j41(90,"p"),t.EFF(91),t.k0s()()()(),t.j41(92,"div",37)(93,"div",45)(94,"div")(95,"div",46)(96,"h5"),t.EFF(97),t.nI1(98,"translate"),t.k0s(),t.j41(99,"ul"),t.DNE(100,G,3,2,"li",11),t.k0s()(),t.j41(101,"div",47)(102,"button",48),t.EFF(103),t.nI1(104,"translate"),t.k0s()()()()()()(),t.j41(105,"div",49)(106,"div",50)(107,"div",51)(108,"a"),t.nrm(109,"i",52),t.EFF(110),t.nI1(111,"translate"),t.k0s()()(),t.j41(112,"div",53)(113,"div",54)(114,"h5",55),t.EFF(115),t.nI1(116,"translate"),t.k0s(),t.j41(117,"div",56)(118,"button",57)(119,"span"),t.EFF(120),t.nI1(121,"translate"),t.k0s(),t.nrm(122,"i",58),t.k0s(),t.j41(123,"ul",59)(124,"li")(125,"a",60),t.bIt("click",function(){return r.sortBy="popularity"}),t.EFF(126),t.nI1(127,"translate"),t.k0s()(),t.j41(128,"li")(129,"a",60),t.bIt("click",function(){return r.sortBy="price-low"}),t.EFF(130),t.nI1(131,"translate"),t.k0s()(),t.j41(132,"li")(133,"a",60),t.bIt("click",function(){return r.sortBy="price-high"}),t.EFF(134),t.nI1(135,"translate"),t.k0s()(),t.j41(136,"li")(137,"a",60),t.bIt("click",function(){return r.sortBy="name"}),t.EFF(138),t.nI1(139,"translate"),t.k0s()()()()()()(),t.j41(140,"div",61),t.DNE(141,O,35,29,"div",11),t.k0s(),t.j41(142,"nav",62)(143,"ul",63)(144,"li",64)(145,"a",65),t.bIt("click",function(){return r.prevPage()}),t.nrm(146,"i",66),t.k0s()(),t.DNE(147,B,3,3,"li",67),t.j41(148,"li",64)(149,"a",65),t.bIt("click",function(){return r.nextPage()}),t.nrm(150,"i",68),t.k0s()()()()()()()()),2&i&&(t.R7$(9),t.SpI(" ",t.bMT(10,36,"back_text"),""),t.R7$(5),t.JRh(t.bMT(15,38,"filters")),t.R7$(3),t.JRh(t.bMT(18,40,"clear_all_text")),t.R7$(3),t.Y8G("ngForOf",r.categories),t.R7$(6),t.JRh(t.bMT(27,42,"search_text")),t.R7$(5),t.R50("ngModel",r.searchTerm),t.R7$(2),t.JRh(t.bMT(34,44,"search_text")),t.R7$(6),t.JRh(t.bMT(40,46,"price_range")),t.R7$(5),t.R50("ngModel",r.priceRange.min),t.R7$(3),t.JRh(t.ii3(48,48,r.priceRange.min,"RD$","symbol","1.2-2")),t.R7$(4),t.JRh(t.ii3(52,53,r.priceRange.max,"RD$","symbol","1.2-2")),t.R7$(6),t.JRh(t.bMT(58,58,"rating")),t.R7$(5),t.Y8G("ngForOf",t.lJ4(80,T)),t.R7$(5),t.JRh(t.bMT(68,60,"discount_text")),t.R7$(5),t.Y8G("ngForOf",r.discountOptions),t.R7$(6),t.Y8G("src",null==r.shopDetails?null:r.shopDetails.logo,t.B4B),t.R7$(6),t.JRh(null==r.shopDetails?null:r.shopDetails.name),t.R7$(3),t.Y8G("ngForOf",t.lJ4(81,R)),t.R7$(2),t.SpI("",null==r.shopDetails?null:r.shopDetails.rating," of 5"),t.R7$(2),t.JRh(null==r.shopDetails?null:r.shopDetails.description),t.R7$(6),t.JRh(t.bMT(98,62,"follow_us")),t.R7$(3),t.Y8G("ngForOf",t.lJ4(82,j)),t.R7$(3),t.JRh(t.bMT(104,64,"contact")),t.R7$(7),t.SpI(" ",t.bMT(111,66,"filters"),""),t.R7$(5),t.SpI("",t.bMT(116,68,"sort_by")," :"),t.R7$(5),t.JRh(t.bMT(121,70,r.getSortLabel())),t.R7$(6),t.JRh(t.bMT(127,72,"popularity")),t.R7$(4),t.JRh(t.bMT(131,74,"price_low_to_high")),t.R7$(4),t.JRh(t.bMT(135,76,"price_high_to_low")),t.R7$(4),t.JRh(t.bMT(139,78,"a_to_z")),t.R7$(3),t.Y8G("ngForOf",r.filteredProducts),t.R7$(3),t.AVh("disabled",1===r.currentPage),t.R7$(3),t.Y8G("ngForOf",r.getPages()),t.R7$(),t.AVh("disabled",r.currentPage===r.totalPages))},dependencies:[p.D,p.G,p.I,p.a2,u.m,u.R,g.YN,g.me,g.MR,g.BC,g.vS,_.h,_.D9,S.X,y.K],encapsulation:2})}return o})();const U=()=>({width:"100%",height:"100%","object-fit":"cover"});function Y(o,l){if(1&o&&(t.j41(0,"li"),t.nrm(1,"img",14),t.k0s()),2&o){const e=l.$implicit;t.R7$(),t.Aen(t.lJ4(4,U)),t.Y8G("src",e.thumbnail_image,t.B4B)("alt",e.name)}}function V(o,l){if(1&o&&(t.j41(0,"li"),t.EFF(1),t.k0s()),2&o){const e=t.XpG().$implicit,i=t.XpG();t.R7$(),t.SpI(" +",i.getRemainingProductsCount(e.id)," ")}}function A(o,l){1&o&&(t.j41(0,"li"),t.nrm(1,"i",32),t.k0s())}function X(o,l){if(1&o){const e=t.RV6();t.j41(0,"div",10)(1,"div",11)(2,"div",12)(3,"div",13),t.nrm(4,"img",14),t.k0s(),t.j41(5,"div",15)(6,"div")(7,"div",16)(8,"h6"),t.nrm(9,"img",17),t.EFF(10),t.k0s(),t.j41(11,"div",18)(12,"ul",19)(13,"li"),t.nrm(14,"i",20),t.k0s(),t.j41(15,"li"),t.nrm(16,"i",20),t.k0s(),t.j41(17,"li"),t.nrm(18,"i",20),t.k0s(),t.j41(19,"li"),t.nrm(20,"i",20),t.k0s(),t.j41(21,"li"),t.nrm(22,"i",21),t.k0s()(),t.j41(23,"h6",22),t.EFF(24),t.k0s()()(),t.j41(25,"h3"),t.EFF(26),t.k0s()(),t.j41(27,"label",23),t.EFF(28),t.j41(29,"a",24),t.EFF(30,"Productos"),t.k0s()()()(),t.j41(31,"div",25)(32,"div",26)(33,"button",27),t.bIt("click",function(){const r=t.eBV(e).$implicit,s=t.XpG();return t.Njj(s.navigateToStore(r.id))}),t.EFF(34," Ir a la Tienda "),t.nrm(35,"i",28),t.k0s(),t.j41(36,"ul",29),t.DNE(37,Y,2,5,"li",30)(38,V,2,1,"li",31)(39,A,2,0,"li",31),t.k0s()()()()()}if(2&o){const e=l.$implicit,i=t.XpG();t.R7$(4),t.FS9("alt",e.name),t.Y8G("src",e.logo,t.B4B),t.R7$(6),t.SpI(" ",e.verify_text,""),t.R7$(14),t.SpI("(",e.rating,")"),t.R7$(2),t.JRh(e.name),t.R7$(2),t.SpI("",e.products," "),t.R7$(9),t.Y8G("ngForOf",i.getVisibleTopProducts(e.id)),t.R7$(),t.Y8G("ngIf",i.getRemainingProductsCount(e.id)>0),t.R7$(),t.Y8G("ngIf",0===i.getTopProducts(e.id).length)}}const N=[{path:"",component:(()=>{class o{shopService;router;stores=[];currentPage=1;totalPages=1;storeTopProducts={};constructor(e,i){this.shopService=e,this.router=i}ngOnInit(){this.loadStores()}loadStores(){this.shopService.getAllShops(this.currentPage).subscribe({next:e=>{const i=e.data.map(r=>r.id);this.totalPages=e.meta.last_page,this.stores=[],this.storeTopProducts={},i.forEach(r=>{this.shopService.getShopInfo(r).subscribe({next:s=>{this.stores.push(s.data),this.loadTopProducts(r)},error:s=>{console.error(`Error loading store details for ID ${r}:`,s)}})})},error:e=>{console.error("Error loading stores:",e)}})}navigateToStore(e){this.router.navigate(["/stores",e])}loadTopProducts(e){this.shopService.getTopFromThisSellerProducts(e).subscribe({next:i=>{this.storeTopProducts[e]=i.data||[]},error:i=>{console.error(`Error loading top products for store ID ${e}:`,i),this.storeTopProducts[e]=[]}})}getTopProducts(e){return this.storeTopProducts[e]||[]}getVisibleTopProducts(e){return this.getTopProducts(e).slice(0,5)}getRemainingProductsCount(e){const i=this.getTopProducts(e).length;return i-Math.min(i,5)}nextPage(){this.currentPage<this.totalPages&&(this.currentPage++,this.loadStores())}previousPage(){this.currentPage>1&&(this.currentPage--,this.loadStores())}getStars(e){return Array(Math.floor(e)).fill(0)}getEmptyStars(e){return Array(5-Math.floor(e)).fill(0)}static \u0275fac=function(i){return new(i||o)(t.rXU(v.s),t.rXU(F.t))};static \u0275cmp=t.VBU({type:o,selectors:[["app-store-list"]],decls:14,vars:5,consts:[[1,"seller-grid-section"],[1,"container-fluid-lg"],[1,"row","g-4"],["class","col-xxl-4 col-md-6",4,"ngFor","ngForOf"],[1,"custom-pagination"],[1,"pagination","justify-content-center"],[1,"page-item"],[1,"page-link",3,"click"],[1,"fa-solid","fa-angles-left"],[1,"fa-solid","fa-angles-right"],[1,"col-xxl-4","col-md-6"],[1,"seller-grid-box","seller-grid-box-1"],[1,"grid-image"],[1,"image"],[1,"img-fluid",3,"src","alt"],[1,"contain-name"],[1,"since-number"],["src","assets/images/verified.png",1,"verified"],[1,"product-rating"],[1,"rating"],["data-feather","star",1,"fill"],["data-feather","star"],[1,"theme-color","ms-2"],[1,"product-label"],[1,"text-black"],[1,"grid-contain"],[1,"seller-category"],[1,"btn","btn-sm","theme-bg-color","text-white","fw-bold","border-20px",3,"click"],[1,"fa-solid","fa-arrow-right-long","ms-2"],[1,"product-image"],[4,"ngFor","ngForOf"],[4,"ngIf"],[1,"fa-solid","fa-box"]],template:function(i,r){1&i&&(t.j41(0,"section",0)(1,"div",1)(2,"div",2),t.DNE(3,X,40,9,"div",3),t.k0s(),t.j41(4,"nav",4)(5,"ul",5)(6,"li",6)(7,"button",7),t.bIt("click",function(){return r.previousPage()}),t.nrm(8,"i",8),t.EFF(9," Atr\xe1s "),t.k0s()(),t.j41(10,"li",6)(11,"button",7),t.bIt("click",function(){return r.nextPage()}),t.EFF(12," Siguiente "),t.nrm(13,"i",9),t.k0s()()()()()()),2&i&&(t.R7$(3),t.Y8G("ngForOf",r.stores),t.R7$(3),t.AVh("disabled",1===r.currentPage),t.R7$(4),t.AVh("disabled",r.currentPage===r.totalPages))},dependencies:[p.D,p.G,p.I],encapsulation:2})}return o})()},{path:":id",component:L}];let H=(()=>{class o{static \u0275fac=function(i){return new(i||o)};static \u0275mod=t.$C({type:o});static \u0275inj=t.G2t({imports:[u.m.forChild(N),u.m]})}return o})()},3108:($,f,c)=>{c.d(f,{s:()=>_});var u=c(8041),p=c(5312),g=c(8457);let _=(()=>{class m{http;apiUrl=p.c.apiUrl;constructor(n){this.http=n}getAllShops(n=1){return this.http.get(`${this.apiUrl}shops?page=${n}`,{headers:this.getHeaders()})}getShops(n="",a=1){return this.http.get(`${this.apiUrl}shops?page=${a}&name=${n}`,{headers:this.getHeaders()})}getShopInfo(n){return this.http.get(`${this.apiUrl}shops/details/${n}`)}getTopFromThisSellerProducts(n){return this.http.get(`${this.apiUrl}shops/products/top/${n}`,{headers:this.getHeaders()})}getNewFromThisSellerProducts(n){return this.http.get(`${this.apiUrl}shops/products/new/${n}`,{headers:this.getHeaders()})}getFeaturedFromThisSellerProducts(n){return this.http.get(`${this.apiUrl}shops/products/featured/${n}`,{headers:this.getHeaders()})}followedCheck(n){return this.http.get(`${this.apiUrl}followed-seller/check/${n}`,{headers:this.getHeaders(!0)})}followedAdd(n){return this.http.get(`${this.apiUrl}followed-seller/store/${n}`,{headers:this.getHeaders(!0)})}followedRemove(n){return this.http.get(`${this.apiUrl}followed-seller/remove/${n}`,{headers:this.getHeaders(!0)})}followedList(n=1){return this.http.get(`${this.apiUrl}followed-seller?page=${n}`,{headers:this.getHeaders(!0)})}topSellers(){return this.http.get(`${this.apiUrl}seller/top`,{headers:this.getHeaders()})}getHeaders(n=!1){const a=new u.b({});if(n){const d=localStorage.getItem("authToken")||"";return a.set("Authorization",`Bearer ${d}`)}return a}static \u0275fac=function(a){return new(a||m)(g.KVO(u.a))};static \u0275prov=g.jDH({token:m,factory:m.\u0275fac,providedIn:"root"})}return m})()}}]); |