File: /var/www/vhost/disk-apps/pwa.sports-crowd.com/www/5408.6310a5e84e4d0a89.js
"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[5408,1337],{81337:(Q,j,c)=>{c.d(j,{O:()=>i});var t=c(2978),m=c(56610),U=c(77897);function x(D,k){if(1&D&&t.nrm(0,"img",5),2&D){const R=t.XpG();t.FS9("src",R.emptySettingsSlide.urlImage,t.B4B)}}function M(D,k){if(1&D&&(t.j41(0,"p"),t.EFF(1),t.k0s()),2&D){const R=t.XpG();t.R7$(1),t.SpI(" ",R.emptySettingsSlide.text," ")}}let i=(()=>{class D{constructor(){this.emptySettingsSlide=[],this.slideOpts={allowSlidePrev:!1,allowSlideNext:!1,initialSlide:1,speed:400}}ngOnInit(){}static#t=this.\u0275fac=function(O){return new(O||D)};static#e=this.\u0275cmp=t.VBU({type:D,selectors:[["app-empty-component"]],inputs:{emptySettingsSlide:"emptySettingsSlide"},decls:6,vars:3,consts:[["pager","false",3,"options"],[1,"slide_center"],[1,"slide"],["alt","image_camponent",3,"src",4,"ngIf"],[4,"ngIf"],["alt","image_camponent",3,"src"]],template:function(O,F){1&O&&(t.j41(0,"ion-slides",0)(1,"ion-slide",1)(2,"div",2),t.DNE(3,x,1,1,"img",3),t.j41(4,"ion-label"),t.DNE(5,M,2,1,"p",4),t.k0s()()()()),2&O&&(t.Y8G("options",F.slideOpts),t.R7$(3),t.Y8G("ngIf",F.emptySettingsSlide.showImage),t.R7$(2),t.Y8G("ngIf",F.emptySettingsSlide.showText))},dependencies:[m.bT,U.he,U.q3,U.tR],styles:["ion-slides[_ngcontent-%COMP%]{height:100%}.swiper-slide[_ngcontent-%COMP%]{display:block}.swiper-slide[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin-top:2.8rem}.swiper-slide[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{max-height:50%;max-width:40%;margin:60px 0 40px;pointer-events:none}b[_ngcontent-%COMP%]{font-weight:500}p[_ngcontent-%COMP%]{padding:0 40px;font-size:14px;line-height:1.5;color:var(--ion-color-step-600, #60646b)}p[_ngcontent-%COMP%] b[_ngcontent-%COMP%]{color:var(--ion-text-color, #000000)}.slide_center[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}"]})}return D})()},23793:(Q,j,c)=>{c.d(j,{M:()=>Y});var t=c(2978),m=c(69942),U=c(56610),x=c(77897),M=c(60822),i=c(22882);function D(o,y){if(1&o&&(t.j41(0,"ion-item-divider")(1,"ion-label"),t.EFF(2),t.k0s()()),2&o){const r=t.XpG();t.R7$(2),t.SpI(" ",r.title," ")}}function k(o,y){if(1&o&&(t.j41(0,"ion-note",6),t.EFF(1),t.nI1(2,"formatCurrency"),t.k0s()),2&o){const r=t.XpG();t.R7$(1),t.SpI("",t.i5U(2,1,r.subtotal,r.currency)," ")}}function R(o,y){if(1&o&&(t.j41(0,"ion-note",6),t.EFF(1),t.nI1(2,"formatCurrency"),t.k0s()),2&o){const r=t.XpG();t.R7$(1),t.SpI("",t.i5U(2,1,r.pco_price,r.currency)," ")}}function O(o,y){if(1&o&&(t.j41(0,"ion-item",2)(1,"ion-label"),t.EFF(2),t.nI1(3,"translate"),t.k0s(),t.j41(4,"ion-note",6),t.EFF(5),t.nI1(6,"formatCurrency"),t.k0s()()),2&o){const r=t.XpG();t.R7$(2),t.SpI("",t.bMT(3,2,"service_label"),":"),t.R7$(3),t.SpI("",t.i5U(6,4,r.serviceCharge,r.currency)," ")}}function F(o,y){if(1&o&&(t.j41(0,"ion-item",2)(1,"ion-label"),t.EFF(2),t.nI1(3,"translate"),t.k0s(),t.j41(4,"ion-note",6),t.EFF(5),t.nI1(6,"formatCurrency"),t.k0s()()),2&o){const r=t.XpG();t.R7$(2),t.JRh(t.bMT(3,2,"DOMICILE_CART")),t.R7$(3),t.JRh(t.i5U(6,4,r.priceDomicile,r.currency))}}function N(o,y){if(1&o){const r=t.RV6();t.j41(0,"ion-icon",9),t.bIt("click",function(){t.eBV(r);const h=t.XpG(2);return t.Njj(h.emitterEvent("discountDelivery"))}),t.k0s()}}function W(o,y){if(1&o&&(t.j41(0,"ion-item",2)(1,"ion-label"),t.EFF(2),t.nI1(3,"translate"),t.DNE(4,N,1,0,"ion-icon",7),t.k0s(),t.j41(5,"ion-label",8),t.EFF(6),t.nI1(7,"formatCurrency"),t.k0s(),t.j41(8,"ion-note",6)(9,"ion-label"),t.EFF(10),t.nI1(11,"formatCurrency"),t.k0s()()()),2&o){const r=t.XpG();t.R7$(2),t.SpI("",t.bMT(3,4,"DOMICILE_CART")," "),t.R7$(2),t.Y8G("ngIf",r.discountDelivery&&"orderDetail"==r.origin),t.R7$(2),t.JRh(t.i5U(7,6,r.priceDomicile+r.discountDelivery,r.currency)),t.R7$(4),t.JRh(t.i5U(11,9,r.priceDomicile,r.currency))}}function w(o,y){if(1&o&&(t.j41(0,"ion-note",13),t.EFF(1),t.nI1(2,"formatCurrency"),t.k0s()),2&o){const r=t.XpG(2);t.R7$(1),t.JRh(t.i5U(2,1,r.total,r.currency))}}function J(o,y){if(1&o&&(t.j41(0,"ion-note",13),t.EFF(1),t.nI1(2,"formatCurrency"),t.k0s()),2&o){const r=t.XpG(2);t.R7$(1),t.JRh(t.i5U(2,1,r.pco_price+r.priceDomicile,r.currency))}}function z(o,y){if(1&o&&(t.j41(0,"ion-item",10)(1,"ion-label",11),t.EFF(2),t.nI1(3,"translate"),t.k0s(),t.DNE(4,w,3,4,"ion-note",12),t.DNE(5,J,3,4,"ion-note",12),t.k0s()),2&o){const r=t.XpG();t.R7$(2),t.JRh(t.bMT(3,3,"TOTAL_CART")),t.R7$(2),t.Y8G("ngIf",6!=r.pco_option),t.R7$(1),t.Y8G("ngIf",6==r.pco_option)}}function K(o,y){if(1&o){const r=t.RV6();t.j41(0,"ion-icon",9),t.bIt("click",function(){t.eBV(r);const h=t.XpG(2);return t.Njj(h.emitterEvent("discountOrder"))}),t.k0s()}}function Z(o,y){if(1&o&&(t.j41(0,"ion-item",10)(1,"ion-label",11),t.EFF(2),t.nI1(3,"translate"),t.DNE(4,K,1,0,"ion-icon",7),t.k0s(),t.j41(5,"ion-label",8),t.EFF(6),t.nI1(7,"formatCurrency"),t.k0s(),t.j41(8,"ion-note",6)(9,"ion-label",11),t.EFF(10),t.nI1(11,"formatCurrency"),t.k0s()()()),2&o){const r=t.XpG();t.R7$(2),t.SpI("",t.bMT(3,4,"TOTAL_CART")," "),t.R7$(2),t.Y8G("ngIf",r.discount&&"orderDetail"==r.origin),t.R7$(2),t.SpI("",t.i5U(7,6,r.total+r.discount,r.currency)," "),t.R7$(4),t.JRh(t.i5U(11,9,r.total,r.currency))}}let Y=(()=>{class o{constructor(r){this.corporateIdentityService=r,this.title="",this.pco_price=0,this.pco_option=0,this.subtotal=0,this.priceDomicile=0,this.discountDelivery=0,this.discount=0,this.serviceCharge=0,this.serviceChargeEnabled=!1,this.total=0,this.origin="others",this.infoDiscount=new t.bkB,this.currency=this.corporateIdentityService.getCurrency()}ngOnInit(){}emitterEvent(r){("discountDelivery"==r||"discountOrder"==r)&&this.infoDiscount.emit(r)}static#t=this.\u0275fac=function(G){return new(G||o)(t.rXU(m.r))};static#e=this.\u0275cmp=t.VBU({type:o,selectors:[["app-total-summary"]],inputs:{title:"title",pco_price:"pco_price",pco_option:"pco_option",subtotal:"subtotal",priceDomicile:"priceDomicile",discountDelivery:"discountDelivery",discount:"discount",serviceCharge:"serviceCharge",serviceChargeEnabled:"serviceChargeEnabled",total:"total",origin:"origin"},outputs:{infoDiscount:"infoDiscount"},decls:13,vars:11,consts:[["lines","inset"],[4,"ngIf"],["lines","none",1,"ion-no-padding","f-s-14"],["slot","end","color","dark",4,"ngIf"],["lines","none","class","ion-no-padding f-s-14",4,"ngIf"],["lines","none","class","ion-no-padding f-s-14 total",4,"ngIf"],["slot","end","color","dark"],["name","alert-circle-outline","size","small",3,"click",4,"ngIf"],[1,"priceDecorationThrough","ion-text-end"],["name","alert-circle-outline","size","small",3,"click"],["lines","none",1,"ion-no-padding","f-s-14","total"],[1,"fontWeightBold"],["slot","end","color","dark","class","fontWeightBold",4,"ngIf"],["slot","end","color","dark",1,"fontWeightBold"]],template:function(G,h){1&G&&(t.j41(0,"ion-list",0),t.DNE(1,D,3,1,"ion-item-divider",1),t.j41(2,"ion-item",2)(3,"ion-label"),t.EFF(4),t.nI1(5,"translate"),t.k0s(),t.DNE(6,k,3,4,"ion-note",3),t.DNE(7,R,3,4,"ion-note",3),t.k0s(),t.DNE(8,O,7,7,"ion-item",4),t.DNE(9,F,7,7,"ion-item",4),t.DNE(10,W,12,12,"ion-item",4),t.DNE(11,z,6,5,"ion-item",5),t.DNE(12,Z,12,12,"ion-item",5),t.k0s()),2&G&&(t.R7$(1),t.Y8G("ngIf",""!=h.title),t.R7$(3),t.JRh(t.bMT(5,9,"SUBTOTAL_CART")),t.R7$(2),t.Y8G("ngIf",6!=h.pco_option),t.R7$(1),t.Y8G("ngIf",6==h.pco_option),t.R7$(1),t.Y8G("ngIf",h.serviceChargeEnabled&&h.serviceCharge),t.R7$(1),t.Y8G("ngIf",!h.discountDelivery),t.R7$(1),t.Y8G("ngIf",h.discountDelivery),t.R7$(1),t.Y8G("ngIf",!h.discount),t.R7$(1),t.Y8G("ngIf",h.discount))},dependencies:[U.bT,x.iq,x.uz,x.Dg,x.he,x.nf,x.JI,M.P,i.D9],styles:["ion-item-divider[_ngcontent-%COMP%]{--padding-start: 8px}ion-item[_ngcontent-%COMP%]{--inner-padding-end: 0px;--inner-padding-start: 8px;height:22px;display:flex}.priceDecorationThrough[_ngcontent-%COMP%]{text-decoration:line-through!important}.total[_ngcontent-%COMP%]{height:26px;font-size:min(5vw,16px)!important}"]})}return o})()},15408:(Q,j,c)=>{c.r(j),c.d(j,{CartPageModule:()=>it});var t=c(56610),m=c(77897),U=c(37222),x=c(22882),M=c(73308),i=c(2978),D=c(46868),k=c(7125),R=c(29885),O=c(54171),F=c(57291),N=c(36075),W=c(69942);function w(u,V){if(1&u){const e=i.RV6();i.j41(0,"ion-buttons",9),i.bIt("click",function(){i.eBV(e);const n=i.XpG();return i.Njj(n.showConfirmDeleteCart())}),i.nrm(1,"ion-icon",10),i.k0s()}}function J(u,V){if(1&u&&(i.j41(0,"ion-chip",11),i.nrm(1,"ion-icon",12),i.j41(2,"ion-label",13),i.EFF(3),i.nI1(4,"translate"),i.nI1(5,"translate"),i.nI1(6,"formatCurrency"),i.k0s()()),2&u){const e=i.XpG();i.R7$(3),i.E5c("",i.bMT(4,3,"MINIMUM1_ORDER_PRICE")," ",i.bMT(5,5,"MINIMUM2_ORDER_PRICE")," ",i.i5U(6,7,e.cartProvider._minimumOrderPrice-e.cartProvider._subtotal,e.currency),"")}}function z(u,V){if(1&u&&i.nrm(0,"app-product-list",14),2&u){const e=i.XpG();i.Y8G("listProducts",e.cartProvider.productsCart)("disabled_sliding",!1)("origin","cart")("parent",e)}}function K(u,V){if(1&u&&i.nrm(0,"app-empty-component",15),2&u){const e=i.XpG();i.Y8G("emptySettingsSlide",e.emptySettingsSlide)}}function Z(u,V){if(1&u){const e=i.RV6();i.j41(0,"ion-grid"),i.nrm(1,"app-total-summary",16),i.nI1(2,"translate"),i.j41(3,"ion-row")(4,"ion-col",17)(5,"ion-button",18),i.bIt("click",function(){i.eBV(e);const n=i.XpG();return i.Njj(n.goToConfirmOrder())}),i.EFF(6),i.nI1(7,"translate"),i.k0s()()()()}if(2&u){const e=i.XpG();i.R7$(1),i.Y8G("title",i.bMT(2,9,"TEXT_SUMMARY_CONFIRM_ORDER"))("subtotal",e.cartProvider._subtotal)("priceDomicile",e.cartProvider._priceDomicile)("discount",e.cartProvider._discount)("total",e.cartProvider._total)("serviceChargeEnabled",e.cartProvider._serviceChargeEnabled)("serviceCharge",e.cartProvider._serviceCharge),i.R7$(4),i.Y8G("disabled",!e.cartProvider._total||e.cartProvider._statusMinimumOrderPrice||!e.validConfirmPurchase),i.R7$(1),i.JRh(i.bMT(7,11,"BUTTON_NEXT_CART"))}}let Y=(()=>{class u{constructor(e,l,n,b,$,X,g,_,p,a,B,A){this.navCtrl=e,this.modalCtrl=l,this.alertCtrl=n,this.translateService=b,this.cartProvider=$,this.cityProvider=X,this.userProvider=g,this.utilsService=_,this.storage=p,this.routerOutlet=a,this.router=B,this.corporateIdentityService=A,this.discountList=[],this.discountDelivery=[],this.couponList=[],this.campaignList=[],this.categoryList=[],this.productGift=[],this.productosDescuentoGift=[],this.validConfirmPurchase=!1,this.translateService.get(["TITLE_DELETE_CART","TEXT_DELETE_CART","TITLE_VALIDATE_INVITED","TEXT_VALIDATE_INVITED"]).subscribe(S=>{this.messageText={titleDeleteCart:S.TITLE_DELETE_CART,textDeleteCart:S.TEXT_DELETE_CART,titleValidateInvited:S.TITLE_VALIDATE_INVITED,textValidateInvited:S.TEXT_VALIDATE_INVITED}}),this.currency=this.corporateIdentityService.getCurrency()}ngOnInit(){this.emptySettingsSlide={showImage:!0,urlImage:"../../assets/img/shopping_cart_sad.png",showText:!0,text:this.translateService.instant("EMPTY_CART")},this.userProvider._infoUser&&(this.userProvider._infoUser.user_info&&this.userProvider._infoUser.user_info.is_initial||!this.userProvider._infoUser.addresses.length)&&this.router.navigate(["/address/confirmOrder/true"])}ionViewDidLeave(){if(this.cartProvider.productsCart&&this.cartProvider.productsCart.length){for(let e=0;e<this.cartProvider.productsCart.length;e++)this.cartProvider.productsCart[e].priceToDiscount=0,typeof this.cartProvider.productsCart[e].discountpercentageCombo<"u"&&(this.cartProvider.productsCart[e].discountpercentageCombo=0,this.cartProvider.productsCart[e].priceTotal=this.cartProvider.productsCart[e].price,this.cartProvider.productsCart[e].priceWithDiscount=this.cartProvider.productsCart[e].price);this.cartProvider.calculatePrice()}}ionViewWillEnter(){this.cartProvider._paymentTypes||this.cartProvider.getPaymentTypesDomicile(),(!this.cartProvider._priceDomicile||this.cartProvider._discountDelivery)&&(this.cartProvider._discountDelivery=0,this.cartProvider.getPriceDomicile()),this.cartProvider.domicile_by_coverage?this.cartProvider.priceDomicileByCoverage().then(()=>{this.getDiscounts(),this.validateShoppingCartProducts(),this.cartProvider.calculatePrice()}).catch(e=>{console.log("error")}):(this.getDiscounts(),this.validateShoppingCartProducts(),this.cartProvider.calculatePrice())}showConfirmDeleteCart(){var e=this;return(0,M.A)(function*(){yield(yield e.alertCtrl.create({header:e.messageText.titleDeleteCart,message:e.messageText.textDeleteCart,buttons:[{text:"Cancelar",handler:()=>{}},{text:"Vaciar",handler:()=>{e.cartProvider.deleteAllProductsCart()}}]})).present()})()}goToConfirmOrder(){this.validateShoppingCartProducts(!0)}confirm(){var e=this;return(0,M.A)(function*(){2==e.userProvider._infoUser.id?yield(yield e.alertCtrl.create({header:e.messageText.titleValidateInvited,message:e.messageText.textValidateInvited,buttons:[{text:"Cancelar",handler:()=>{console.log("Disagree clicked")}},{text:"Registrarme",handler:()=>{e.storage.remove("token"),e.storage.remove("infoUser"),e.navCtrl.navigateRoot("/welcome")}}]})).present():e.router.navigate(e.userProvider._infoUser&&(e.userProvider._infoUser.user_info&&e.userProvider._infoUser.user_info.is_initial||!e.userProvider._infoUser.addresses.length)?["/address/confirmOrder/true"]:"main"==e.cartProvider.storeType?["/app/tabs/shop/confirm-order"]:["/shop/"+e.cartProvider.storeType+"/confirm-order"])})()}getDiscounts(){var e=this;this.storage.get("token").then(function(){var l=(0,M.A)(function*(n){n&&(yield e.cartProvider.getDiscounts(n.access_token)).subscribe(b=>{if("success"==b.status){if(e.discountList=b.discountList,e.cartProvider._serviceChargeEnabled=b.serviceChargeEnabled,e.cartProvider._serviceCharge=b.serviceCharge,e.cartProvider.productsCart.length<=0)return;let g,_,p,a,B,A,S;for(let P=0;P<e.discountList.length;P++)if(e.productGift=b.productGift,6==e.discountList[P].discount_type_id){if(e.cartProvider.validateDateDiscount(e.discountList[P])){e.cartProvider.applyDiscount(e.discountList[P]);let E=e.productGift.filter(f=>f.discount_id==e.discountList[P].id);for(let f=0;f<E.length;f++)if(!E[f].is_gift&&(g=e.cartProvider.productsCart.filter(v=>v.product_id==E[f].product_id),g&&(_=E.filter(v=>v.discount_id==E[f].discount_id&&1==v.is_gift),g.filter(v=>v.product_id==e.cartProvider.productsCart[f].product_id)&&_.filter(v=>v.product_id==e.cartProvider.productsCart[f].product_id)))){for(let s=0;s<g.length;s++)B=e.cartProvider.productsCart.findIndex(T=>T.product_id==g[s].product_id),e.productosDescuentoGift.push(e.cartProvider.productsCart[B]);for(let s=0;s<_.length;s++)a=e.cartProvider.productsCart.findIndex(T=>T.product_id==_[s].product_id),e.productosDescuentoGift.push(e.cartProvider.productsCart[a]);for(let s=e.productosDescuentoGift.length-1;s>=0;s--)e.productosDescuentoGift.indexOf(e.productosDescuentoGift[s])!==s&&e.productosDescuentoGift.splice(s,1);e.productosDescuentoGift.forEach(function(s,T,I){void 0===s&&I.splice(T,1)}),e.productosDescuentoGift.sort(function(s,T){return s.price-T.price});let d,v=0;if(0!=e.productosDescuentoGift.filter(s=>null!=s).length)if(d=e.productosDescuentoGift.every(s=>s.price==e.productosDescuentoGift[v].price),1==d){let T,s=e.cartProvider.productsCart.map((I,C)=>I.priceToDiscount&&0!=I.priceToDiscount);for(let I=0;I<e.productosDescuentoGift.length;I++)T=e.cartProvider.productsCart.filter(C=>C.id==e.productosDescuentoGift[I].id);if(1==e.productosDescuentoGift[f].quantity&&e.productosDescuentoGift.length>0){if(T.length==E.length&&-1==s.indexOf(!0)){p=Math.floor(Math.random()*e.productosDescuentoGift.length);let C=e.cartProvider.productsCart.find(H=>H.id==e.productosDescuentoGift[p].id);S=e.cartProvider.productsCart.findIndex(H=>H.product_id==C.product_id),e.utilsService.presentAlertInfo(e.cartProvider.productsCart[S].name,"",e.discountList[P].message_to_user),e.cartProvider.productsCart[S].priceToDiscount=C.price,e.storage.set("priceToDiscount",e.cartProvider.productsCart[S].priceToDiscount),e.cartProvider.calculatePrice()}}else if(2==e.productosDescuentoGift[f].quantity||1==e.productosDescuentoGift.length)if(0==e.cartProvider.productsCart.every(C=>C.product_id==e.productosDescuentoGift[f].product_id)){let C=e.productosDescuentoGift.every(L=>L.product_id==_[f].product_id);(C=!0)&&(a=e.productosDescuentoGift.findIndex(L=>L.product_id==_[f].product_id),e.cartProvider.productsCart[a].priceToDiscount=e.cartProvider.productsCart[a].price,e.storage.set("priceToDiscount",e.cartProvider.productsCart[a].priceToDiscount),e.cartProvider.calculatePrice())}else e.cartProvider.calculatePrice();else e.cartProvider.calculatePrice()}else{let s=e.cartProvider.productsCart.find(C=>C.price===Math.min(...e.productosDescuentoGift.map(L=>L.price))),T=e.cartProvider.productsCart.findIndex(C=>C.id==s.id),I=e.cartProvider.productsCart.findIndex(C=>C.price==e.cartProvider.productsCart[T].price);e.cartProvider.productsCart[I].priceToDiscount=e.cartProvider.productsCart[I].price,e.storage.set("priceToDiscount",e.cartProvider.productsCart[I].priceToDiscount),e.cartProvider.calculatePrice()}}}}else if(5==e.discountList[P].discount_type_id&&e.cartProvider.validateDateDiscount(e.discountList[P])){e.cartProvider.applyDiscount(e.discountList[P]);let E=e.productGift.filter(f=>f.discount_id==e.discountList[P].id);for(let f=0;f<E.length;f++)if(!E[f].is_gift)if(g=e.cartProvider.productsCart.find(v=>v.product_id==E[f].product_id),g){if(_=E.filter(v=>v.discount_id==E[f].discount_id&&1==v.is_gift),_)if(0==E.filter(d=>!e.cartProvider.productsCart.some(s=>d.product_id==s.product_id)).length)if(setTimeout(()=>{""!=e.discountList[P].message_to_user&&(e.toastMessageText=e.discountList[P].message_to_user,e.utilsService.presentToast(2500,"success","top",e.toastMessageText))},4500),e.cartProvider.productsCart.find(d=>d.product_id==g.product_id)&&-1!=e.cartProvider.productsCart.findIndex(d=>d.product_id==_[f].product_id)){e.productosDescuentoGift.push(g);for(let d=0;d<_.length;d++)A=e.cartProvider.productsCart.findIndex(s=>s.product_id==_[d].product_id),e.productosDescuentoGift.push(e.cartProvider.productsCart[A]),e.cartProvider.productsCart[A].discountpercentageCombo=e.discountList[P].percentage_discount;if(e.cartProvider.productsCart.find(d=>0!==d.priceToDiscount)){let d=e.cartProvider.productsCart.findIndex(s=>0!==s.priceToDiscount);e.cartProvider.productsCart[d].priceToDiscount=0,e.storage.set("priceToDiscount2",e.cartProvider.productsCart[d].priceToDiscount)}e.productosDescuentoGift.forEach(function(d,s,T){void 0===d&&T.splice(s,1)});for(let d=e.productosDescuentoGift.length-1;d>=0;d--)e.productosDescuentoGift.indexOf(e.productosDescuentoGift[d])!==d&&e.productosDescuentoGift.splice(d,1);e.storage.set("productsCartCombo",e.productosDescuentoGift),-1!=e.productosDescuentoGift.findIndex(d=>d.product_id==g.product_id)&&(p=e.cartProvider.productsCart.findIndex(d=>d.product_id==g.product_id),e.cartProvider.productsCart[p].pivotProduct=1,e.cartProvider.productsCart[p].discountpercentageCombo=e.discountList[P].percentage_discount,e.storage.set("discountTypes",{pivotProduct:e.cartProvider.productsCart[p].pivotProduct,discountpercentageCombo:e.cartProvider.productsCart[p].discountpercentageCombo}),e.cartProvider.calculatePrice())}else e.cartProvider.calculatePrice();else A=e.cartProvider.productsCart.findIndex(d=>d.product_id!=_[f].product_id),-1!=A&&(e.cartProvider.productsCart[A].discountpercentageCombo=0),e.cartProvider.calculatePrice()}else e.cartProvider.calculatePrice()}e.cartProvider.calculatePrice()}else e.cartProvider.calculatePrice()},b=>{console.log("error getDiscounts",b),e.discountList=[]})});return function(n){return l.apply(this,arguments)}}())}validateShoppingCartProducts(e=!1){var l=this,n=this;this.utilsService.presentLoading(this.translateService.instant("all.validating")).then((0,M.A)(function*(){let b=[],$=[];for(let g=0;g<l.cartProvider.productsCart.length;g++){let _={},p=l.cartProvider.productsCart[g];p.product_attributes_selected&&p.product_attributes_selected[0]?(_={product_id:p.product_attributes_selected[0].product_id,attribute_id:p.product_attributes_selected[0].attribute_id,value:p.product_attributes_selected[0].value,quantity:p.quantity,item:g,oldPrice:p.priceTotal+p.product_attributes_selected[0].price_additional},$.push(_)):(_={id:p.id,quantity:p.quantity,item:g,oldPrice:p.priceTotal},b.push(_))}let X={productsAttributesCart:$,productsCart:b};n.validConfirmPurchase=!0,l.storage.get("token").then(function(){var g=(0,M.A)(function*(_){_&&(yield l.cartProvider.productValidationCart(X,_.access_token)).subscribe(p=>{p.forEach(function(a){n.cartProvider.productsCart[a.item].availableStock=a.availableStock,n.cartProvider.productsCart[a.item].availablePrice=a.availablePrice,n.cartProvider.productsCart[a.item].validationMessage=a.validationMessage,n.cartProvider.productsCart[a.item].newPriceAfterSpecialPriceTag=0,n.cartProvider.productsCart[a.item].newPriceAfterFlash=0,n.cartProvider.productsCart[a.item].newPriceAfterDiscount=0,n.cartProvider.productsCart[a.item].newPrice=0,a.priceAfterSpecialPriceTag?n.cartProvider.productsCart[a.item].newPriceAfterSpecialPriceTag=a.priceAfterSpecialPriceTag:a.priceAfterFlash?n.cartProvider.productsCart[a.item].newPriceAfterFlash=a.priceAfterFlash:a.priceAfterDiscount?n.cartProvider.productsCart[a.item].newPriceAfterDiscount=a.priceAfterDiscount:n.cartProvider.productsCart[a.item].newPrice=a.newPrice,(0==a.availableStock||0==a.availablePrice)&&(n.validConfirmPurchase=!1)}),l.utilsService.dismissLoading(),n.validConfirmPurchase?e&&l.confirm():l.utilsService.presentAlertInfo(l.translateService.instant("TITLE_NOVELTY_BUY"),"",l.translateService.instant("MESSAGE_NOVELTY_BUY"))},p=>{console.log("error productValidationCart",p),n.validConfirmPurchase=!1,l.utilsService.dismissLoading(),l.utilsService.presentAlertInfo(l.translateService.instant("TITLE_NOVELTY_BUY"),"",l.translateService.instant("MESSAGE_NOVELTY_BUY"))})});return function(_){return g.apply(this,arguments)}}())}))}static#t=this.\u0275fac=function(l){return new(l||u)(i.rXU(m.q9),i.rXU(m.W3),i.rXU(m.hG),i.rXU(x.c$),i.rXU(D.m),i.rXU(k.h),i.rXU(R.D),i.rXU(O.T),i.rXU(F.n),i.rXU(m.Rg),i.rXU(N.Ix),i.rXU(W.r))};static#e=this.\u0275cmp=i.VBU({type:u,selectors:[["page-cart"]],decls:14,vars:8,consts:[[1,"ion-no-border"],["slot","start"],["defaultHref","/app/tabs/shop"],[1,"ion-text-center"],["slot","end",3,"click",4,"ngIf"],["color","danger","class","w-98",4,"ngIf"],[3,"listProducts","disabled_sliding","origin","parent",4,"ngIf"],[3,"emptySettingsSlide",4,"ngIf"],[4,"ngIf"],["slot","end",3,"click"],["slot","icon-only","name","trash-outline"],["color","danger",1,"w-98"],["name","alert-outline"],["color","danger"],[3,"listProducts","disabled_sliding","origin","parent"],[3,"emptySettingsSlide"],[3,"title","subtotal","priceDomicile","discount","total","serviceChargeEnabled","serviceCharge"],["size","12",1,"ion-no-padding","ion-no-margin"],["expand","block","fill","solid","shape","round",3,"disabled","click"]],template:function(l,n){1&l&&(i.j41(0,"ion-header",0)(1,"ion-toolbar")(2,"ion-buttons",1),i.nrm(3,"ion-back-button",2),i.k0s(),i.j41(4,"ion-title",3),i.EFF(5),i.nI1(6,"translate"),i.k0s(),i.DNE(7,w,2,0,"ion-buttons",4),i.k0s()(),i.j41(8,"ion-content"),i.DNE(9,J,7,10,"ion-chip",5),i.DNE(10,z,1,4,"app-product-list",6),i.DNE(11,K,1,1,"app-empty-component",7),i.k0s(),i.j41(12,"ion-footer"),i.DNE(13,Z,8,13,"ion-grid",8),i.k0s()),2&l&&(i.R7$(5),i.JRh(i.bMT(6,6,"CART_TITLE")),i.R7$(2),i.Y8G("ngIf",n.cartProvider.productsCart.length),i.R7$(2),i.Y8G("ngIf",n.cartProvider._statusMinimumOrderPrice&&n.cartProvider._minimumOrderPrice>0&&n.cartProvider.productsCart.length),i.R7$(1),i.Y8G("ngIf",n.cartProvider.productsCart.length),i.R7$(1),i.Y8G("ngIf",0==n.cartProvider._subtotal&&!n.cartProvider.productsCart.length),i.R7$(2),i.Y8G("ngIf",n.cartProvider.productsCart&&n.cartProvider.productsCart.length))},styles:[".buttonNav[_ngcontent-%COMP%]{font-size:2.2em;color:var(--color-icon-black)}.item-md.item-block[_ngcontent-%COMP%] .item-inner[_ngcontent-%COMP%]{padding-right:0!important}.imageShoppingCartSad[_ngcontent-%COMP%]{border-radius:0!important;width:40%!important;height:auto!important;margin:auto!important}.imageProductDiscount[_ngcontent-%COMP%]{position:absolute!important;width:30px!important;height:auto!important;top:20px!important;left:6px!important}.priceDecorationThrough[_ngcontent-%COMP%]{text-decoration:line-through!important}.priceDiscount[_ngcontent-%COMP%]{font-weight:600;font-size:1.6rem;color:var(--ion-color-secondary)}.spanPriceDiscount[_ngcontent-%COMP%]{display:-webkit-box!important}.marginRight7[_ngcontent-%COMP%]{margin-right:7px!important}.buttonContainer[_ngcontent-%COMP%]{padding-left:0!important;padding-right:0!important}.buttonRemove[_ngcontent-%COMP%]{border:none!important;padding-left:10px!important;padding-right:10px!important}.fontSize12[_ngcontent-%COMP%]{font-size:12px!important}.chip-md-danger[_ngcontent-%COMP%], .chip-md[_ngcontent-%COMP%] .icon-md-danger[_ngcontent-%COMP%], .chip-ios-danger[_ngcontent-%COMP%], .chip-ios[_ngcontent-%COMP%] .icon-ios-danger[_ngcontent-%COMP%]{border-radius:0!important;color:#cb3030!important;background-color:#f3afaf!important;width:100%!important;border-bottom:.1px solid!important;height:20px!important;font-size:11px!important}.chip-md[_ngcontent-%COMP%] > ion-label[_ngcontent-%COMP%]{margin:-5px 10px!important}.chip-ios[_ngcontent-%COMP%] > ion-label[_ngcontent-%COMP%]{margin:-5px 10px!important}"]})}return u})();const o=[{path:"",component:Y}];let y=(()=>{class u{static#t=this.\u0275fac=function(l){return new(l||u)};static#e=this.\u0275mod=i.$C({type:u});static#i=this.\u0275inj=i.G2t({imports:[N.iI.forChild(o),N.iI]})}return u})();var r=c(55553),G=c(41683),h=c(70047),q=c(81337),tt=c(23793),et=c(60822);let it=(()=>{class u{static#t=this.\u0275fac=function(l){return new(l||u)};static#e=this.\u0275mod=i.$C({type:u});static#i=this.\u0275inj=i.G2t({imports:[t.MD,m.bv,x.h.forChild(),r.h,y,U.YN,G.Y]})}return u})();i.wjB(Y,function(){return[t.bT,m.el,m.Jm,m.QW,m.ZB,m.hU,m.W9,m.M0,m.lO,m.eU,m.iq,m.he,m.ln,m.BC,m.ai,m.tY,h.t,q.O,tt.M]},function(){return[x.D9,et.P]})}}]);