marketplacepos 3.20.2 → 3.20.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Marketplace/{chunk-KEXSSIIK.js → chunk-22G3JR6W.js} +1 -1
- package/Marketplace/{chunk-OIA7AZAI.js → chunk-27TUGWVJ.js} +1 -1
- package/Marketplace/{chunk-U5DEYVH7.js → chunk-3MQV6JYA.js} +1 -1
- package/Marketplace/{chunk-FFIAPQXG.js → chunk-5V62VWDN.js} +1 -1
- package/Marketplace/{chunk-B3K6UPYZ.js → chunk-5YIYZ4W4.js} +1 -1
- package/Marketplace/{chunk-Q23T3Z7A.js → chunk-6GQBIOOG.js} +1 -1
- package/Marketplace/{chunk-L4ATAUYG.js → chunk-7JYGGXZV.js} +1 -1
- package/Marketplace/{chunk-6H5OBDRE.js → chunk-AD73Q5SO.js} +1 -1
- package/Marketplace/{chunk-IVZDLO4P.js → chunk-BBOSAJFJ.js} +1 -1
- package/Marketplace/{chunk-7EZF73IF.js → chunk-BM43VVCJ.js} +1 -1
- package/Marketplace/{chunk-VILOHPQ6.js → chunk-CGXLDXLG.js} +1 -1
- package/Marketplace/{chunk-ZAOCXN54.js → chunk-EISQDLOC.js} +1 -1
- package/Marketplace/{chunk-BYRNKZQX.js → chunk-GD4X6JLM.js} +1 -1
- package/Marketplace/{chunk-5XE7MWPC.js → chunk-JGTROTZK.js} +1 -1
- package/Marketplace/{chunk-SF2LKH4I.js → chunk-KZMQ7HFA.js} +1 -1
- package/Marketplace/{chunk-HVK6UHD7.js → chunk-LC5PAP2Y.js} +1 -1
- package/Marketplace/{chunk-V2PRX7LN.js → chunk-NCTBDQQS.js} +1 -1
- package/Marketplace/{chunk-WW4N3RLW.js → chunk-OUXYRPIM.js} +1 -1
- package/Marketplace/{chunk-ZXG5LQIM.js → chunk-RZNPMBKU.js} +1 -1
- package/Marketplace/{chunk-6YZD2TWT.js → chunk-S5BOKQAK.js} +1 -1
- package/Marketplace/{chunk-JTEGS3G3.js → chunk-SAUHZIYY.js} +1 -1
- package/Marketplace/{chunk-4M3J5VEB.js → chunk-UV6746MK.js} +1 -1
- package/Marketplace/{chunk-KR4YVARF.js → chunk-W2JPMZ3K.js} +1 -1
- package/Marketplace/{chunk-INVASEX2.js → chunk-WGQYJ7SC.js} +1 -1
- package/Marketplace/{chunk-RDU7O5EX.js → chunk-XFEGVCTK.js} +1 -1
- package/Marketplace/{chunk-RAHG2R2I.js → chunk-XOLDVKQQ.js} +1 -1
- package/Marketplace/{chunk-HIY4OVL6.js → chunk-XP5UAEOH.js} +1 -1
- package/Marketplace/{chunk-YRVCHKBA.js → chunk-YCBSVDJN.js} +1 -1
- package/Marketplace/index.html +2 -2
- package/Marketplace/{main-FLF2PVF5.js → main-FD6XFGYK.js} +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as N,b as Tt,c as Pe}from"./chunk-EGYILQWG.js";import{a as $}from"./chunk-BGWVHGAY.js";import"./chunk-SQTY2CZY.js";import{a as ve}from"./chunk-JY3L4RUM.js";import{a as Z}from"./chunk-7KG3DC5J.js";import{b as xe}from"./chunk-ULELZXI5.js";import"./chunk-E5BOLHDG.js";import"./chunk-A37OKNC2.js";import{a as re,b as ae}from"./chunk-7YWHTN3X.js";import{e as at}from"./chunk-RAHG2R2I.js";import{f as _e,g as ge,h as Ce,i as fe,j as Se}from"./chunk-KZ6AD6KW.js";import"./chunk-BZPMSXEO.js";import{a as j}from"./chunk-7VKIP3Z6.js";import"./chunk-DYLT6RRK.js";import{a as Ft}from"./chunk-6UDYSYXW.js";import{a as z}from"./chunk-VBCIYCOF.js";import{b as be}from"./chunk-MKJON4UM.js";import{a as me,b as ue}from"./chunk-WKSTGJK5.js";import{a as le,b as ce,c as se}from"./chunk-GQG2K3LS.js";import{a as tt}from"./chunk-7EZF73IF.js";import{a as q}from"./chunk-D6L7HUOY.js";import"./chunk-BTY6PS53.js";import{a as he}from"./chunk-D76K4RZ7.js";import{f as pe,g as de}from"./chunk-EIBGI6U2.js";import{a as rt,b as yt,d as Y,e as qt}from"./chunk-PYD2YWAN.js";import{g as R}from"./chunk-6H5OBDRE.js";import{b as W,e as K}from"./chunk-JHYIHRQH.js";import"./chunk-KCDL7SWP.js";import{b as te,c as ee,d as J,h as Ot,i as ne,j as ie,m as B,n as oe}from"./chunk-4CEFDQPI.js";import{t as Mt,u as Dt}from"./chunk-2SC3HO66.js";import{P as Qt,X as Xt}from"./chunk-DQIP7MCZ.js";import{b as Zt,c as ot,h as U,m as L,y as wt}from"./chunk-2E5AKA74.js";import{b as H,c as f}from"./chunk-FTHTFVHH.js";import{$c as Yt,B as y,Bc as xt,Cc as zt,Ec as vt,Fc as Pt,Ha as D,Ib as G,Ja as c,Jb as d,Ka as S,Kb as et,Lb as I,Nb as O,Ob as T,Pb as F,Rb as Kt,Sb as X,T as ft,Tb as pt,V as Vt,Va as Ut,Wc as bt,X as $t,Xc as Ht,Yc as it,Zc as It,_a as x,aa as Gt,ab as s,ac as E,bc as V,c as Bt,cc as Jt,da as At,dc as nt,ga as M,ha as Wt,hb as St,mb as a,nb as l,oa as m,ob as g,pa as u,pb as P,q as jt,qb as b,sb as v,vb as C,xb as p,xc as k,yc as A}from"./chunk-ZIZWZZ4E.js";import"./chunk-GNOSNGXM.js";var Ve=()=>["/menu/products/download/by-url"],Ie=(()=>{let r=class r{constructor(){this.productTabs=[{Title:"Sold in Channel",Url:"/menu/products/status/sold-in-channel",Description:"SKU has been mapped between dealpos and marketplace"},{Title:"Not in POS",Url:"/menu/products/status/not-in-pos",Description:"SKU sold in Marketplace but not exist in DEALPOS"},{Title:"Not in Channel",Url:"/menu/products/status/not-in-channel",Description:"SKU has not been sold on one of channels"},{Title:"In POS",Url:"/menu/products/status/in-pos",Description:"All products which is already available in POS"},{Title:"Multiple Listing",Url:"/menu/products/status/duplicate-sku",Description:"SKU(s) which is listed more than one time (one to many)"},{Title:"Channel Statistic",Url:"/menu/products/status/channel-statistic",Description:"Product statistic from each channel obtained from the last product scan"}]}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=M({type:r,selectors:[["app-status"]],decls:13,vars:3,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid","d-flex","align-items-center","justify-content-between"],[3,"Tabs"],[1,"dropdown","me-6"],["role","button","data-bs-toggle","dropdown","aria-expanded","false",1,"text-dark"],[1,"fa-solid","fa-bars","fa-lg"],[1,"dropdown-menu","dropdown-menu-end","row"],[1,"d-flex"],[1,"dropdown-item",3,"routerLink"]],template:function(e,i){e&1&&(a(0,"nav",0)(1,"div",1)(2,"div"),g(3,"nav-tab",2),l()(),a(4,"div")(5,"div",3)(6,"a",4),g(7,"i",5),l(),a(8,"div",6)(9,"div",7)(10,"a",8),d(11,"Download Product By Url"),l()()()()()(),g(12,"router-outlet")),e&2&&(c(3),s("Tabs",i.productTabs),c(7),s("routerLink",X(2,Ve)))},dependencies:[re,Ht,It]});let o=r;return o})();function Ae(o,r){if(o&1&&(a(0,"mat-option",6)(1,"div"),g(2,"img",7),a(3,"span"),d(4),l()()()),o&2){let n=r.$implicit;s("value",n.ChannelID),c(2),s("src",n.logo,D),c(2),et(n.Title)}}var ct=(()=>{let r=class r{constructor(){this.dialogRef=At(te),this.channels=At(ee),this.channelIds=Ut([]),this.channelOptions=Ut([])}ngOnInit(){this.initModalConfig();let t=this.channels.filter((e,i,h)=>h.findIndex(_=>_.ChannelID===e.ChannelID)===i);this.channelOptions.set(t)}initModalConfig(){this.modalConfig=new ne,this.modalConfig.title="Detach Product",this.modalConfig.okText="Save"}onClose(){this.dialogRef.close()}onSave(){let t=this.channels.filter(e=>this.channelIds().includes(e.ChannelID)).map(e=>({ChannelID:e.ChannelID,ChannelItemID:e.ChannelItemID}));this.dialogRef.close(t)}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=M({type:r,selectors:[["app-modal-detach-product"]],standalone:!0,features:[Kt],decls:8,vars:5,consts:[[3,"onClose","onCancel","onOk","dynamicValidated","config"],["content",""],[1,"mb-2","fw-bold"],["appearance","outline",1,"w-100"],["name","channelid","placeholder","Channel",1,"mat-select-channel",3,"ngModelChange","ngModel","multiple"],["class","channel-option",3,"value",4,"ngFor","ngForOf"],[1,"channel-option",3,"value"],[2,"width","18px","margin-right","10px",3,"src"]],template:function(e,i){e&1&&(a(0,"modal-material",0),C("onClose",function(){return i.onClose()})("onCancel",function(){return i.onClose()})("onOk",function(){return i.onSave()}),a(1,"div",1)(2,"div")(3,"label",2),d(4,"Select a Channel"),l(),a(5,"mat-form-field",3)(6,"mat-select",4),F("ngModelChange",function(_){return T(i.channelIds,_)||(i.channelIds=_),_}),x(7,Ae,5,3,"mat-option",5),l()()()()()),e&2&&(s("dynamicValidated",i.channelIds().length>0)("config",i.modalConfig),c(6),O("ngModel",i.channelIds),s("multiple",!0),c(),s("ngForOf",i.channelOptions()))},dependencies:[Pt,k,ie,de,pe,ue,me,Xt,wt,U,L,Dt]});let o=r;return o})();function Ue(o,r){if(o&1){let n=v();a(0,"button",13),C("click",function(){m(n);let e=p();return u(e.onDetachMultipleProduct())}),g(1,"i",14),d(2),l()}if(o&2){let n,t=p();c(2),I("Detach (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function Le(o,r){if(o&1){let n=v();a(0,"button",16),C("click",function(){m(n);let e=p(2);return u(e.onOpenScanDialog())}),g(1,"i",17),d(2," Scan Channel "),l()}}function Re(o,r){if(o&1&&(P(0),x(1,Le,3,0,"button",15),b()),o&2){let n=p();c(),s("ngIf",!n.productService.hasSelection(n.products))}}function Be(o,r){if(o&1){let n=v();P(0),a(1,"button",18),C("click",function(){m(n);let e=p();return u(e.onScanMultipleProduct())}),g(2,"i",17),d(3),l(),b()}if(o&2){let n,t=p();c(3),I(" Scan (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function je(o,r){if(o&1){let n=v();P(0),a(1,"button",19),C("click",function(){m(n);let e=p();return u(e.onUploadMultipleProduct())}),g(2,"i",20),d(3),l(),b()}if(o&2){let n,t=p();c(3),I(" Upload (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function $e(o,r){if(o&1){let n=v();a(0,"div",21)(1,"app-product-card",22),C("onUpload",function(){let e=m(n).$implicit,i=p();return u(i.onUploadToMultipleChannel(e))})("onScan",function(){let e=m(n).$implicit,i=p();return u(i.onScanSingleProduct(e))})("onDescEvent",function(){let e=m(n).index,i=p();return u(i.onOpenDialogVariant(e))})("onCheckBoxChange",function(e){let i=m(n).$implicit;return u(i.selected=e)})("onDetach",function(){let e=m(n).$implicit,i=p();return u(i.onDetachProduct([e]))}),l()()}if(o&2){let n=r.$implicit,t=p();c(),s("productId",n.ID)("title",n==null?null:n.Name)("image",n==null?null:n.ThumbnailUrl)("description",(n==null?null:n.Variants.length)>1?(n==null?null:n.Variants.length)+" Variants":null)("channels",t.productService.getChannelProduct(n))("code",t.getVariantCode(n==null?null:n.Variants))("showCheckBox",(n==null?null:n.Channel.length)<t.channelOptions.length)("scanButton",!0)("uploadButton",n==null?null:n.hasUpload)("imageForZoom",n==null?null:n.ImageUrl)("detachButton",(n==null||n.Channel==null?null:n.Channel.length)>0)}}function Ge(o,r){o&1&&(P(0),a(1,"div",23),g(2,"app-empty-state"),l(),b())}function We(o,r){if(o&1){let n=v();P(0),a(1,"div",24)(2,"div",25)(3,"app-custom-paginator",26),C("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())}),l()()(),b()}if(o&2){let n=p();c(3),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",!0)}}var Me=(()=>{let r=class r{constructor(t,e,i,h,_,w,st){this.http=t,this.toastr=e,this.dialog=i,this.productService=h,this.authService=_,this.uploadProductService=w,this.route=st,this.searchFilter=new Z,this.products=[],this.rowCount=0,this.multipeScanChannels=[],this.getLoaderPage(),this.channelOptions=this.authService.getChannels(),this.initMultiScanChannels()}getLoaderPage(){this.productService.LoadInPOS().subscribe(t=>{this.Categories=t.Options.Categories,this.searchFilter.PageNumber=t.Filter.PageNumber,this.searchFilter.RowCount=t.Filter.RowCount,this.searchFilter.ChannelID=null,this.searchFilter.Category=t.Filter.Category,this.searchFilter.PageSize=100,this.getProducts()})}initMultiScanChannels(){this.multipeScanChannels=this.productService.filterChannelByTypeId(this.channelOptions,[H.Tokopedia,H.Tiktok])}getProducts(){let t={PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount,text:this.searchFilter.text,Category:this.searchFilter.Category,From:this.startDate,To:this.endDate};this.http.post("/api/product/GetInPOS",t).subscribe(e=>{this.products=e.Data,this.rowCount=e.Total==null?this.searchFilter.RowCount:e.Total.toString(),this.products=this.productService.checkProductHasUploadBtn(this.products,this.channelOptions)})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open(N,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.UpdatedProduct=i.UpdatedProduct,this.searchFilter.Async=i.Async,this.scanAllProduct()})}scanAllProduct(){if(this.searchFilter.ChannelID==null){this.toastr.error("Please Select Channel","Error");return}this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(t=>{if(this.searchFilter.Async)this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"});else{this.getLoaderPage();let e=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.successToastrScanAllProduct(t,e,!this.searchFilter.UpdatedProduct)}})}onOpenDialogVariant(t){this.dialog.open(Tt,{data:{title:this.products[t].Name,variants:this.products[t].Variants},width:"800px"})}onUploadMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.uploadProductService.setSelectedProduct(t),this.route.navigate(["/menu/products/upload"])}onUploadToMultipleChannel(t){this.uploadProductService.setSelectedProduct([t]),this.route.navigate(["/menu/products/upload"])}searchProduct(t){this.searchFilter.text=t,this.getProducts()}onScanMultipleProduct(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty;let e=this.productService.filterChannelByTypeId(this.channelOptions,[H.Tokopedia,H.Tiktok]);this.dialog.open(N,{data:{filter:t,channelOptions:e,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(h=>f.IsNotEmpty(h))).subscribe(h=>{this.searchFilter.ChannelID=h.ChannelID,this.searchFilter.ScanFull=h.ScanFull,this.searchFilter.UpdatedProduct=h.UpdatedProduct;let _=this.productService.selectedProduct(this.products),w=this.productService.getVariantCodesProducts(_);this.scanSingleProduct(w)})}onScanSingleProduct(t){let e=JSON.parse(JSON.stringify(this.searchFilter));e.ChannelID=f.GuidEMpty,this.dialog.open(N,{data:{filter:e,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID;let h=this.productService.getVariantCodesProduct(t);this.scanSingleProduct(h)})}scanSingleProduct(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:e=>{if(e)this.toastr.success("Successfully Scan ","Success");else{let i=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.toastr.error(`This product is not existed in ${i?.Name} `,"Error")}this.searchFilter.ChannelID=f.GuidEMpty,e&&this.getProducts()},error:e=>{this.searchFilter.ChannelID=f.GuidEMpty}})}getVariantCode(t){let e;return t.length>1&&(e=(t[0].model?t[0].model:"")+t[0].Code),t.length==1&&(e=t[0].Code),e}onDetachProduct(t){let e=[];t.forEach(i=>{i.Channel=f.assignChannelLogo(i.Channel),e.push(...i.Channel)}),this.dialog.open(ct,{width:"600px",data:[...e]}).afterClosed().pipe(y(i=>f.IsNotEmpty(i)),ft(i=>this.productService.detachProduct(i))).subscribe(i=>{this.toastr.success(i.Message,Ot.Success),this.getProducts()})}onDetachMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.onDetachProduct(t)}};r.\u0275fac=function(e){return new(e||r)(S(K),S(W),S(J),S(j),S(R),S(at),S(it))},r.\u0275cmp=M({type:r,selectors:[["app-in-pos"]],decls:23,vars:14,consts:[["picker",""],["description","All products which is already available in POS",3,"onSubmit","headerTitle"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2"],[4,"ngIf"],[1,"fw-bold","mb-2"],["appendTo","body","bindLabel","Name","name","Name","bindValue","Name","placeholder","Select Category",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],[1,"mt-5"],["id","dates",1,"form-control","rounded","dateRange",3,"rangePicker"],["matStartDate","","placeholder","Start date",3,"ngModelChange","click","ngModel"],["matEndDate","","placeholder","End date",3,"ngModelChange","click","ngModel"],[1,"container-fluid"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"fa-sharp","fa-link-slash","me-2"],["type","button","data-cy","scanSoldinChannel","class","btn btn-outline-secondary shadow rounded",3,"click",4,"ngIf"],["type","button","data-cy","scanSoldinChannel",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onUpload","onScan","onDescEvent","onCheckBoxChange","onDetach","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom","detachButton"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row","mt-2","justify-content-end"],[1,"col-md-12"],[3,"next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){if(e&1){let h=v();a(0,"mainpanel",1),C("onSubmit",function(w){return m(h),u(i.searchProduct(w))}),a(1,"actions"),x(2,Ue,3,1,"button",2)(3,Re,2,1,"ng-container",3)(4,Be,4,1,"ng-container",3)(5,je,4,1,"ng-container",3),l(),a(6,"filters")(7,"div")(8,"label",4),d(9,"Category"),l(),a(10,"ng-select",5),C("ngModelChange",function(w){return m(h),u(i.searchFilter.Category=w)}),l()(),a(11,"div",6)(12,"mat-date-range-input",7)(13,"input",8),F("ngModelChange",function(w){return m(h),T(i.startDate,w)||(i.startDate=w),u(w)}),C("click",function(){m(h);let w=G(16);return u(w.open())}),l(),a(14,"input",9),F("ngModelChange",function(w){return m(h),T(i.endDate,w)||(i.endDate=w),u(w)}),C("click",function(){m(h);let w=G(16);return u(w.open())}),l()(),g(15,"mat-date-range-picker",null,0),l()(),a(17,"content")(18,"div",10)(19,"div",11),x(20,$e,2,11,"div",12)(21,Ge,3,0,"ng-container",3),l(),x(22,We,4,4,"ng-container",3),l()()()}if(e&2){let h=G(16);s("headerTitle","In POS ("+i.rowCount+")"),c(2),St(i.productService.hasSelection(i.products)?2:-1),c(),s("ngIf",!i.productService.hasSelection(i.products)),c(),s("ngIf",i.productService.hasSelection(i.products)&&i.multipeScanChannels.length>0),c(),s("ngIf",i.productService.hasSelection(i.products)),c(5),s("clearable",!0)("items",i.Categories)("ngModel",i.searchFilter.Category),c(2),s("rangePicker",h),c(),O("ngModel",i.startDate),c(),O("ngModel",i.endDate),c(6),s("ngForOf",i.products),c(),s("ngIf",i.products.length==0),c(),s("ngIf",i.products.length>0)}},dependencies:[k,A,ot,U,L,B,Y,z,q,$,Ce,_e,ge,fe],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.img-logo[_ngcontent-%COMP%]{height:24px;width:24px}.dateRange[_ngcontent-%COMP%]{padding-top:.8rem;padding-bottom:.8rem}"]});let o=r;return o})();function Ke(o,r){if(o&1){let n=v();a(0,"button",11),C("click",function(){m(n);let e=p();return u(e.onDetachMultipleProduct())}),g(1,"i",12),d(2),l()}if(o&2){let n,t=p();c(2),I("Detach (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function Je(o,r){if(o&1){let n=v();P(0),a(1,"button",13),C("click",function(){m(n);let e=p();return u(e.onOpenScanDialog())}),g(2,"i",14),d(3," Scan Channel "),l(),b()}}function ze(o,r){if(o&1){let n=v();P(0),a(1,"button",15),C("click",function(){m(n);let e=p();return u(e.onScanMultipleProduct())}),g(2,"i",14),d(3),l(),b()}if(o&2){let n=p();c(3),I(" Scan (",n.productService.selectedProduct(n.products).length,") ")}}function He(o,r){if(o&1){let n=v();P(0),a(1,"button",16),C("click",function(){m(n);let e=p();return u(e.onUploadMultipleProduct())}),g(2,"i",17),d(3),l(),b()}if(o&2){let n=p();c(3),I(" Upload (",n.productService.selectedProduct(n.products).length,") ")}}function Ye(o,r){if(o&1&&(a(0,"span",18),g(1,"img",19),l(),d(2)),o&2){let n=r.item;c(),s("src",n.Img,D)("alt",n.Name),c(),I(" ",n.Name," ")}}function Ze(o,r){if(o&1){let n=v();a(0,"div",20)(1,"label",21),d(2,"Item ID"),l(),a(3,"input",22),F("ngModelChange",function(e){m(n);let i=p();return T(i.searchFilter.Item_id,e)||(i.searchFilter.Item_id=e),u(e)}),l()()}if(o&2){let n=p();c(3),O("ngModel",n.searchFilter.Item_id)}}function qe(o,r){if(o&1){let n=v();a(0,"div",23)(1,"app-product-card",24),C("onUpload",function(){let e=m(n).$implicit,i=p();return u(i.onUploadToMultipleChannel(e))})("onDescEvent",function(){let e=m(n).index,i=p();return u(i.onOpenVariantDetail(e))})("onScan",function(){let e=m(n).$implicit,i=p();return u(i.onScanSingleProduct(e))})("onCheckBoxChange",function(e){let i=m(n).$implicit;return u(i.selected=e)})("onDetach",function(){let e=m(n).$implicit,i=p();return u(i.onDetachProduct([e]))}),l()()}if(o&2){let n=r.$implicit,t=p();c(),s("productId",n==null?null:n.ID)("title",n==null?null:n.Name)("image",n==null?null:n.ThumbnailUrl)("description",(n==null||n.Variants==null?null:n.Variants.length)>1?(n==null||n.Variants==null?null:n.Variants.length)+" Variants":null)("channels",t.productService.getChannelProduct(n))("code",t.getVariantCode(n==null?null:n.Variants))("showCheckBox",n==null?null:n.hasScan)("scanButton",!0)("uploadButton",n==null?null:n.hasUpload)("imageForZoom",n==null?null:n.ImageUrl)("detachButton",(n==null||n.Channel==null?null:n.Channel.length)>0)}}function Qe(o,r){o&1&&(P(0),a(1,"div",25),g(2,"app-empty-state"),l(),b())}function Xe(o,r){if(o&1){let n=v();a(0,"div",26)(1,"div",27)(2,"app-custom-paginator",28),C("total",function(){m(n);let e=p();return u(e.getRowCount())})("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())}),l()()()}if(o&2){let n=p();c(2),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",n.hasClickRowCount)}}var De=(()=>{let r=class r{constructor(t,e,i,h,_,w,st,Ct){this.http=t,this.dialog=e,this.toastr=i,this.productService=h,this.activateRouter=_,this.authService=w,this.route=st,this.uploadProductService=Ct,this.searchFilter=new Z,this.products=[],this.rowCount=0,this.hasClickRowCount=!1,this.guidEmpty=f.GuidEMpty,this.multipeScanChannels=[],this.channelOptions=this.authService.getChannels(),this.initMultiScanChannels()}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(f.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(e=>{this.searchFilter=e.Filter,e.Filter.ChannelID!=f.GuidEMpty&&(this.searchFilter.ListChannelID=[],this.searchFilter.ListChannelID.push(e.Filter.ChannelID)),this.searchFilter.PageSize=e.Filter.RowCount,this.searchFilter.Item_id="",this.getProducts()})}initMultiScanChannels(){this.multipeScanChannels=this.productService.filterChannelByTypeId(this.channelOptions,[H.Tokopedia,H.Tiktok])}getProducts(){let t={ListChannelID:this.searchFilter.ListChannelID,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount,text:this.searchFilter.text,Item_id:this.searchFilter.Item_id};this.productService.findAllSoldInChannel(t).subscribe(e=>{this.products=e.Data,this.products=this.productService.checkProductHasUploadBtn(this.products,this.channelOptions),this.products=this.productService.checkProductHasScanButton(this.products,this.channelOptions)})}searchProduct(t){this.searchFilter.text=t,this.hasClickRowCount=!1,this.getProducts()}onOpenVariantDetail(t){let e=this.products[t].Variants;this.dialog.open(Tt,{data:{variants:e,title:this.products[t].Name},width:"800px"})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open(N,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.UpdatedProduct=i.UpdatedProduct,this.searchFilter.Async=i.Async,this.scanAllProduct()})}scanAllProduct(){let t=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).pipe(y(e=>e)).subscribe(e=>{this.searchFilter.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.productService.successToastrScanAllProduct(e,t,!this.searchFilter.UpdatedProduct),this.initPageLoader(f.GuidEMpty))})}onScanSingleProduct(t){t.Channel=this.productService.getChannelProduct(t);let e=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(N,{data:{filter:e,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID;let h=this.productService.getVariantCodesProduct(t);this.scanProducts(h)})}onUploadToMultipleChannel(t){this.uploadProductService.setSelectedProduct([t]),this.route.navigate(["/menu/products/upload"])}onScanMultipleProduct(){this.searchFilter.ChannelID=f.GuidEMpty;let t=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(N,{data:{filter:t,channelOptions:this.multipeScanChannels,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.UpdatedProduct=i.UpdatedProduct;let h=this.productService.selectedProduct(this.products),_=this.productService.getVariantCodesProducts(h);this.scanProducts(_)})}scanProducts(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:e=>{let i=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);e?this.toastr.success(`Product Successfully scan with ${i?.Name}`,"Success"):this.toastr.error(`This product is not existed in ${i?.Name} `,"Error"),this.searchFilter.ChannelID=f.GuidEMpty,e&&this.getProducts()},error:e=>{this.searchFilter.ChannelID=f.GuidEMpty}})}getVariantCode(t){let e;return t.length>1&&(e=(t[0].model?t[0].model:"")+t[0].Code),t.length==1&&(e=t[0].Code),e}onClearFilterChannel(){this.searchFilter.ChannelID=f.GuidEMpty,this.searchFilter.Item_id=""}onUploadMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.uploadProductService.setSelectedProduct(t),this.route.navigate(["/menu/products/upload"])}getRowCount(){let t={ListChannelID:this.searchFilter.ListChannelID,text:this.searchFilter.text};this.http.post("/api/product/GetSoldInChannelRowCount",t).subscribe(e=>{this.hasClickRowCount=!0,this.rowCount=e.Total})}onDetachProduct(t){let e=[];t.forEach(i=>{i.Channel=f.assignChannelLogo(i.Channel),e.push(...i.Channel)}),this.dialog.open(ct,{width:"600px",data:[...e]}).afterClosed().pipe(y(i=>f.IsNotEmpty(i)),ft(i=>this.productService.detachProduct(i))).subscribe(i=>{this.toastr.success(i.Message,Ot.Success),this.getProducts()})}onDetachMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.onDetachProduct(t)}};r.\u0275fac=function(e){return new(e||r)(S(K),S(J),S(W),S(j),S(bt),S(R),S(it),S(at))},r.\u0275cmp=M({type:r,selectors:[["app-sold-in-channel"]],decls:19,vars:13,consts:[["description","SKU has been mapped between dealpos and marketplace",3,"onSubmit","headerTitle"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2"],[4,"ngIf"],[1,"fw-bold","mb-2"],["appendTo","body","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel",1,"center-text",3,"ngModelChange","clear","clearable","multiple","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],["class","mt-5",4,"ngIf"],[1,"container-fluid"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],["class","row",4,"ngIf"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"fa-sharp","fa-link-slash","me-2"],["type","button","data-cy","scanSoldinChannel",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"me-2"],[2,"width","18px",3,"src","alt"],[1,"mt-5"],[1,"fw-bold"],["type","text","name","Item_id","id","Item_id",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onUpload","onDescEvent","onScan","onCheckBoxChange","onDetach","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom","detachButton"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row"],[1,"col-12"],[3,"total","next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){e&1&&(a(0,"mainpanel",0),C("onSubmit",function(_){return i.searchProduct(_)}),a(1,"actions"),x(2,Ke,3,1,"button",1)(3,Je,4,0,"ng-container",2)(4,ze,4,1,"ng-container",2)(5,He,4,1,"ng-container",2),l(),a(6,"filters")(7,"div")(8,"label",3),d(9,"Channel"),l(),a(10,"ng-select",4),C("ngModelChange",function(_){return i.searchFilter.ListChannelID=_})("clear",function(){return i.onClearFilterChannel()}),x(11,Ye,3,3,"ng-template",5),l()(),x(12,Ze,4,1,"div",6),l(),a(13,"content")(14,"div",7)(15,"div",8),x(16,qe,2,11,"div",9)(17,Qe,3,0,"ng-container",2),l(),x(18,Xe,3,4,"div",10),l()()()),e&2&&(s("headerTitle","Sold in Channel"),c(2),St(i.productService.hasSelection(i.products)?2:-1),c(),s("ngIf",!i.productService.hasSelection(i.products)),c(),s("ngIf",i.multipeScanChannels.length>0&&i.productService.hasSelection(i.products)),c(),s("ngIf",i.productService.hasSelection(i.products)),c(5),s("clearable",!0)("multiple",!0)("items",i.channelOptions)("ngModel",i.searchFilter.ListChannelID),c(2),s("ngIf",i.searchFilter.ListChannelID!=null),c(4),s("ngForOf",i.products),c(),s("ngIf",i.products.length==0),c(),s("ngIf",i.products==null?null:i.products.length))},dependencies:[k,A,ot,U,L,B,Y,rt,yt,z,q,$],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}"]});let o=r;return o})();function en(o,r){if(o&1){let n=v();a(0,"button",13),C("click",function(){m(n);let e=p(2);return u(e.uploadMultipleProduct())}),g(1,"i",14),d(2),l()}if(o&2){let n=p(2);c(2),I(" upload (",n.selectedProducts==null?null:n.selectedProducts.length,") ")}}function nn(o,r){if(o&1){let n=v();P(0),a(1,"td",29)(2,"input",30),F("ngModelChange",function(e){m(n);let i=p(2).$implicit;return T(i.selected,e)||(i.selected=e),u(e)}),C("ngModelChange",function(){m(n);let e=p(3).ngIf,i=p(3);return u(i.onSelectProduct(e))}),l()(),b()}if(o&2){let n=p(2).$implicit;c(),s("rowSpan",n==null?null:n.Variants.length),c(),O("ngModel",n.selected)}}function on(o,r){if(o&1){let n=v();P(0),a(1,"img",35),C("click",function(e){m(n);let i=p(3).$implicit,h=p(4);return u(h.onZoomImage(e,i==null?null:i.ImageUrl))}),l(),b()}if(o&2){let n=p(3).$implicit;c(),s("src",n==null?null:n.ImageUrl,D)}}function rn(o,r){o&1&&g(0,"img",36)}function an(o,r){if(o&1&&(P(0),a(1,"td",29)(2,"div",31),x(3,on,2,1,"ng-container",11)(4,rn,1,0,"ng-template",null,1,nt),l()(),a(6,"td",32)(7,"h4",33)(8,"span",34),d(9),l()()(),b()),o&2){let n=G(5),t=p(2).$implicit;c(),s("rowSpan",t==null?null:t.Variants.length),c(2),s("ngIf",t==null?null:t.ImageUrl)("ngIfElse",n),c(3),s("rowSpan",t==null?null:t.Variants.length),c(2),s("matTooltip",(t==null||t.Name==null?null:t.Name.length)>50?t==null?null:t.Name:""),c(),I(" ",t==null?null:t.Name," ")}}function ln(o,r){if(o&1&&(a(0,"div")(1,"a",25),g(2,"img",37),l()()),o&2){let n=r.$implicit;c(),s("href",n.URL,D),c(),s("src",n.Img,D)("matTooltip",n.Name)}}function cn(o,r){if(o&1&&(a(0,"div"),g(1,"img",37),l()),o&2){let n=r.$implicit;c(),s("src",n.Img,D)("matTooltip",n.Name)}}function sn(o,r){if(o&1&&(a(0,"tr"),x(1,nn,3,2,"ng-container",12)(2,an,10,6,"ng-container",12),a(3,"td"),d(4),l(),a(5,"td")(6,"span"),d(7),l(),a(8,"span",24)(9,"a",25),g(10,"i",26),l()()(),a(11,"td",27)(12,"div",28),x(13,ln,3,3,"div",23),l()(),a(14,"td",27)(15,"div",28),x(16,cn,2,2,"div",23),l()()()),o&2){let n=r.$implicit,t=r.index,e=p(5);c(),s("ngIf",t==0),c(),s("ngIf",t==0),c(2),I(" ",n.Name," "),c(3),I(" ",n.Code," "),c(2),s("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(n==null?null:n.ID),D),c(4),s("ngForOf",n==null?null:n.Available),c(3),s("ngForOf",n==null?null:n.NotAvailable)}}function pn(o,r){if(o&1&&(P(0),x(1,sn,17,7,"tr",23),b()),o&2){let n=r.$implicit;c(),s("ngForOf",n.Variants)}}function dn(o,r){if(o&1&&(a(0,"tbody"),x(1,pn,2,1,"ng-container",23),l()),o&2){let n=r.ngIf;c(),s("ngForOf",n)}}function mn(o,r){if(o&1&&(P(0),a(1,"div",15)(2,"table",16)(3,"thead",17)(4,"tr"),g(5,"th",18),a(6,"th",19),d(7,"Product"),l(),a(8,"th",20),d(9,"Variant"),l(),a(10,"th",20),d(11,"SKU"),l(),a(12,"th",21),d(13,"Available In"),l(),a(14,"th",22),d(15,"Not Available In"),l()()(),x(16,dn,2,1,"tbody",12),E(17,"async"),l()(),b()),o&2){let n=p(2);c(16),s("ngIf",V(17,1,n.data$))}}function un(o,r){o&1&&(a(0,"div",38),g(1,"app-empty-state"),l())}function hn(o,r){if(o&1){let n=v();a(0,"span",46),C("click",function(){m(n);let e=p(4);return u(e.getRowCount())}),a(1,"i",47),d(2,"?"),l()()}}function _n(o,r){if(o&1&&(a(0,"span"),d(1),E(2,"number"),l()),o&2){let n=r.ngIf;c(),et(V(2,1,n==null?null:n.Count))}}function gn(o,r){if(o&1){let n=v();a(0,"a",48),C("click",function(){m(n);let e=p(4);return u(e.onNextPage())}),g(1,"i",49),d(2," Next"),l()}}function Cn(o,r){if(o&1){let n=v();a(0,"a",50),C("click",function(){m(n);let e=p(4);return u(e.onLastPage())}),g(1,"i",51),d(2," Last"),l()}}function fn(o,r){if(o&1&&(P(0),a(1,"div",39)(2,"div",40)(3,"div",41),d(4),E(5,"number"),x(6,hn,3,0,"span",42)(7,_n,3,3,"span",12),E(8,"async"),d(9),l()(),a(10,"div",43),x(11,gn,3,0,"a",44)(12,Cn,3,0,"a",45),l()(),b()),o&2){let n=p().ngIf,t=p(2);c(4),I(" Showing 1 - ",V(5,6,n==null?null:n.length)," of "),c(2),s("ngIf",t.paginationService.hideCount),c(),s("ngIf",!t.paginationService.hideCount&&V(8,8,t.rowCount$)),c(2),I(" records ~ ",t.paginationService.footerPageNumber," Page "),c(2),s("ngIf",t.paginationService.disableNextButton&&!t.paginationService.goToLastPage),c(),s("ngIf",t.paginationService.disableNextButton&&!t.paginationService.goToLastPage)}}function Sn(o,r){if(o&1&&(P(0),x(1,fn,13,10,"ng-container",12),b()),o&2){let n=r.ngIf;c(),s("ngIf",(n==null?null:n.length)>0)}}function xn(o,r){if(o&1){let n=v();a(0,"mainpanel",3),C("onSubmit",function(e){m(n);let i=p();return u(i.searchProduct(e))}),a(1,"actions"),x(2,en,3,1,"button",4),a(3,"button",5),C("click",function(){m(n);let e=p();return u(e.openScanDialog())}),g(4,"i",6),d(5," Scan Channel "),l(),a(6,"button",7),C("click",function(){m(n);let e=p();return u(e.openExportDialog())}),g(7,"i",8),a(8,"span"),d(9,"Export"),l()()(),a(10,"content")(11,"div",9)(12,"div",10),x(13,mn,18,3,"ng-container",11),E(14,"async"),x(15,un,2,0,"ng-template",null,0,nt),l(),x(17,Sn,2,1,"ng-container",12),E(18,"async"),l()()()}if(o&2){let n,t=G(16),e=p();s("hideSearchDropdown",!0),c(2),s("ngIf",e.hasSelectionProduct),c(11),s("ngIf",((n=V(14,5,e.data$))==null?null:n.length)>0)("ngIfElse",t),c(4),s("ngIf",V(18,7,e.data$))}}var Oe=(()=>{let r=class r{constructor(t,e,i,h,_,w,st,Ct,Ne){this.http=t,this.dialog=e,this.toastr=i,this.route=h,this.productService=_,this.paginationService=w,this.biggerPictureService=st,this.authService=Ct,this.uploadProductService=Ne,this.loaderAPI="product/Load",this.rowCountAPI="product/GetNotInChannelRowCount",this.notChannelAPI="product/GetNotInChannelV2",this.hasSelectionProduct=!1,this.selectedProducts=[],this.channelOptions=Ct.getChannels(),this.hostName=this.authService.getDomain()}ngOnInit(){this.initPageLoader(),this.iniData()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.notChannelAPI,this.loader$=this.http.post(`api/${this.loaderAPI}`,{}).pipe($t(t=>{this.filterSearch=t.Filter,this.paginationService.reloadPagination(t.Filter)}))}iniData(){this.data$=this.paginationService.data$.pipe(jt(t=>(t=t.map(e=>(e.Variants=e.Variants.map(i=>(i.Available=this.productService.sortChannel(i.Available),i.NotAvailable=this.productService.sortChannel(i.NotAvailable),i.Available=this.assignLogoChannel(i.Available),i.NotAvailable=this.assignLogoChannel(i.NotAvailable),i)),e.Channel=e?.Variants[0]?.Available,e)),t)))}assignLogoChannel(t){return t=t.map(e=>(e.Img=f.getChannelLogoByTypeId(e.TypeID),e)),t}searchProduct(t){this.filterSearch.text=t,this.paginationService.reloadPagination(this.filterSearch)}scanAllProduct(){let t=this.productService.findChannelById(this.filterSearch.ChannelID,this.channelOptions);this.productService.scanAll(this.filterSearch.ChannelID,this.filterSearch.ScanFull,this.filterSearch.UpdatedProduct,this.filterSearch.Async).subscribe(e=>{this.filterSearch.Async?this.toastr.success("You will be notified when the scan is completed.","Scan Asynchronous"):(this.productService.successToastrScanAllProduct(e,t,!this.filterSearch.UpdatedProduct),this.initPageLoader())})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.filterSearch));t.ChannelID=f.GuidEMpty,this.dialog.open(N,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.filterSearch.ChannelID=i.ChannelID,this.filterSearch.ScanFull=i.ScanFull,this.filterSearch.UpdatedProduct=i.UpdatedProduct,this.filterSearch.Async=i.Async,this.scanAllProduct()})}getRowCount(){this.paginationService.hideCount=!1,this.rowCount$=this.http.post(`/api/${this.rowCountAPI}`,this.filterSearch)}onNextPage(){this.paginationService.onNextPage(this.filterSearch)}onLastPage(){this.http.post(`/api/${this.rowCountAPI}`,{}).subscribe({next:t=>{this.filterSearch.PageNumber=1,this.paginationService.getAllData(this.filterSearch,t.Count)}})}onZoomImage(t,e){this.biggerPictureService.openBiggerPicture(t,e)}onSelectProduct(t){this.hasSelectionProduct=this.productService.hasSelection(t),this.selectedProducts=this.productService.selectedProduct(t)}uploadMultipleProduct(){this.uploadProductService.setSelectedProduct(this.selectedProducts),this.route.navigate(["/menu/products/upload"])}ngOnDestroy(){this.paginationService.destroy()}openExportDialog(){this.dialog.open(xe,{data:{title:"Export Not In Channel",pageNumber:this.filterSearch.PageNumber,rowCount:this.filterSearch.RowCount,filterExport:this.filterSearch,getRowCountApi:"product/GetNotInChannelRowCount",exportApi:"product/GetNotInChannelExport"}}).afterClosed().subscribe()}};r.\u0275fac=function(e){return new(e||r)(S(K),S(J),S(W),S(it),S(j),S(ve),S(he),S(R),S(at))},r.\u0275cmp=M({type:r,selectors:[["app-not-in-channel"]],decls:2,vars:3,consts:[["EMPTY",""],["elsePic",""],["headerTitle","Not in Channel","description","SKU has not been sold on one of channels",3,"hideSearchDropdown","onSubmit",4,"ngIf"],["headerTitle","Not in Channel","description","SKU has not been sold on one of channels",3,"onSubmit","hideSearchDropdown"],["class","btn btn-light shadow rounded ms-2",3,"click",4,"ngIf"],["data-cy","scanNotinChannel","type","button",1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"container-fluid","mt-3"],[1,"row"],[4,"ngIf","ngIfElse"],[4,"ngIf"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"col-md-12"],[1,"table","border-bottom"],[1,"thead-light","sticky-top-thead"],[2,"width","10px"],["colspan","2",1,"ms-5","text-center",2,"width","450px"],[2,"width","150px"],[2,"width","20%"],[2,"width","16%"],[4,"ngFor","ngForOf"],[1,"ms-1"],["target","_blank",3,"href"],[1,"fas","fa-solid","fa-arrow-up-right-from-square","external-link-custom"],[2,"padding-left","0px"],[1,"d-flex","flex-wrap","mb-1"],[1,"text-center",3,"rowSpan"],["type","checkbox",3,"ngModelChange","ngModel"],[2,"padding-right","0px"],[1,"text-start",3,"rowSpan"],[1,"ms-5","fw-normal","text-ellipsis",2,"max-width","26vw !important"],[3,"matTooltip"],[1,"border","rounded","cursor-pointer",2,"max-width","40px",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded",2,"max-width","40px"],["alt","",1,"channel-logo","cursor-pointer","ms-4","mt-3",3,"src","matTooltip"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"d-flex","justify-content-between","mt-5"],[1,"me-auto","d-sm-block","collapse","mt-3"],[1,"font-weight-bold","font-italic","hidden-xxs"],["style","cursor: pointer",3,"click",4,"ngIf"],[1,"btn-group"],["role","button","class","btn btn-outline-secondary btn-sm text-primary","title","Load more for 20 products",3,"click",4,"ngIf"],["role","button","class","btn btn-outline-secondary btn-sm text-primary","title","Load all products",3,"click",4,"ngIf"],[2,"cursor","pointer",3,"click"],["title","Retreive rows count",1,"border","p-3"],["role","button","title","Load more for 20 products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fas","fa-arrow-right"],["role","button","title","Load all products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fas","fa-share"]],template:function(e,i){e&1&&(x(0,xn,19,9,"mainpanel",2),E(1,"async")),e&2&&s("ngIf",V(1,1,i.loader$))},dependencies:[k,A,Zt,U,L,B,Mt,$,xt,vt],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}thead[_ngcontent-%COMP%]{position:sticky;top:0}.channel-logo[_ngcontent-%COMP%]{width:20px}.w-img[_ngcontent-%COMP%]{width:100%}"]});let o=r;return o})();var vn=o=>[o],Pn=()=>[];function bn(o,r){if(o&1){let n=v();a(0,"button",15),C("click",function(){m(n);let e=p();return u(e.openScanDialog())}),g(1,"i",16),d(2," Scan Channel "),l()}}function In(o,r){if(o&1){let n=v();P(0),a(1,"button",17),C("click",function(){m(n);let e=p();return u(e.onDownloadAllProduct("SELECTED"))}),g(2,"i",18),d(3),l(),b()}if(o&2){let n,t=p();c(3),I(" Download (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function wn(o,r){if(o&1&&(a(0,"span",19),g(1,"img",20),l(),d(2)),o&2){let n=r.item;c(),s("src",n.Img,D)("alt",n.Name),c(),I(" ",n.Name," ")}}function yn(o,r){if(o&1){let n=v();a(0,"div",21)(1,"app-product-card",22),C("onCheckBoxChange",function(e){let i=m(n).index,h=p();return u(h.onSelectProduct(e,i))})("onDescEvent",function(){let e=m(n).index,i=p();return u(i.onShowVariantDetail(e))})("onDownload",function(){let e=m(n).$implicit,i=p();return u(i.onDownloadProduct(e))})("onScan",function(){let e=m(n).$implicit,i=p();return u(i.onScanChannel(e))}),l()()}if(o&2){let n=r.$implicit;c(),s("showRedirectIcon",!1)("title",n==null?null:n.Name)("image",n==null?null:n.Image)("imageForZoom",n==null?null:n.Image)("code",n==null?null:n.SKU)("description",(n==null||n.Variant==null?null:n.Variant.length)>0?(n==null||n.Variant==null?null:n.Variant.length)+" Variants":null)("downloadButton",!0)("channels",n!=null&&n.Channel?pt(10,vn,n==null?null:n.Channel):X(12,Pn))("showCheckBox",!0)("scanButton",!0)}}function Mn(o,r){o&1&&(P(0),a(1,"div",23),g(2,"app-empty-state"),l(),b())}function Dn(o,r){if(o&1){let n=v();a(0,"div",24)(1,"div",25)(2,"app-custom-paginator",26),C("total",function(){m(n);let e=p();return u(e.getRowCount())})("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())}),l()()()}if(o&2){let n=p();c(2),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",n.hasClickRowCount)}}var Te=(()=>{let r=class r{constructor(t,e,i,h,_,w){this.http=t,this.dialog=e,this.productService=i,this.toastrService=h,this.activateRouter=_,this.authService=w,this.searchFilter=new Z,this.products=[],this.hasClickRowCount=!1,this.channelOptions=this.authService.getChannels()}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(f.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(e=>{this.searchFilter=e.Filter,this.searchFilter.PageSize=e.Filter.RowCount,this.getProducts()})}getProducts(){this.http.post("/api/product/GetProductChannelNotPOS",this.searchFilter).subscribe(t=>{this.products=t.Data,this.mapChannelToProduct(),this.setSkuProduct()})}mapChannelToProduct(){let t;this.products=this.products.map(e=>(t=this.channelOptions.find(i=>i.ID==e.ChannelID),t?e.Channel=JSON.parse(JSON.stringify(t)):e.Channel=null,e)).map(e=>(e.Channel&&(e.Channel.Url=e.Url),e))}setSkuProduct(){this.products=this.products.map(t=>(t?.Variant?.length==0?f.IsNotEmpty(t?.ChannelItemSKU)?t.SKU=t?.ChannelItemSKU:t.SKU="SKU not assigned":t.SKU=t?.Variant[0]?.ChannelVariationSKU?t?.Variant[0]?.ChannelVariationSKU:"SKU not assigned",t))}onSearch(t){this.searchFilter.text=t,this.hasClickRowCount=!1,this.getProducts()}onClearChannelFilter(){this.searchFilter.ChannelID=f.GuidEMpty}onScanAll(){let t=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(e=>{this.searchFilter.Async?this.toastrService.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.initPageLoader(f.GuidEMpty),this.productService.successToastrScanAllProduct(e,t,!this.searchFilter.UpdatedProduct)),this.searchFilter.ChannelID=f.GuidEMpty})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open(N,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.UpdatedProduct=i.UpdatedProduct,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.Async=i.Async,this.onScanAll()})}onDownloadAllProduct(t){let e;t=="ALL"?e=this.products:e=this.productService.selectedProduct(this.products),e.length>0&&this.productService.downloadMultipleProduct(e).subscribe({next:()=>{this.getProducts()}})}onSelectProduct(t,e){this.products[e].selected=t}onDownloadProduct(t){confirm(`Are you sure you want to Retrieve product ${t?.Name} from ${t?.Channel.Name} to POS?`)&&this.productService.downloadProduct(t).subscribe({next:()=>{this.getProducts()}})}onScanChannel(t){let e=JSON.parse(JSON.stringify(t));delete e.Channel,this.productService.scanCompareToPos([e]).subscribe(i=>{i.Status?(this.initPageLoader(f.GuidEMpty),this.toastrService.success(`product ${t.Name} have been successfully scanned and synchronized with POS`,"Success")):this.toastrService.error(`Product ${t.Name} is not existed in POS`,"Error")})}onShowVariantDetail(t){let e=this.products[t].Variant;e.length>0&&this.dialog.open(Pe,{data:{title:this.products[t].Name,variants:e},width:"30%"})}getRowCount(){let t={ChannelID:this.searchFilter.ChannelID,text:this.searchFilter.text,HaveSku:parseInt(this.searchFilter.HaveSku)};this.http.post("/api/product/GetProductChannelNotPOSRowCount",t).subscribe(e=>{this.hasClickRowCount=!0,this.rowCount=e.Count})}};r.\u0275fac=function(e){return new(e||r)(S(K),S(J),S(j),S(W),S(bt),S(R))},r.\u0275cmp=M({type:r,selectors:[["app-not-in-pos"]],decls:30,vars:13,consts:[["headerTitle","Not in POS","textButton","Search","description","SKU sold in Marketplace but not exist in DEALPOS",3,"onSubmit"],["type","button","data-cy","scanNotInPos","class","btn btn-outline-secondary shadow rounded",3,"click",4,"ngIf"],[4,"ngIf"],[1,"fw-bold","mb-2"],["bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel","appendTo","body",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],["ng-option-tmp",""],[1,"mt-5"],[1,"fw-bold"],["name","haveSKU",1,"form-control","h-100","pt-3","rounded","mt-2",3,"ngModelChange","ngModel"],[1,"me-5",3,"value"],["type","text","name","Item_id","id","Item_id","placeholder","item id",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],["class","row",4,"ngIf"],["type","button","data-cy","scanNotInPos",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button",1,"btn","btn-success","shadow-sm","rounded","ms-3",3,"click"],[1,"fa","fa-download"],[1,"me-2"],[2,"width","18px",3,"src","alt"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onCheckBoxChange","onDescEvent","onDownload","onScan","showRedirectIcon","title","image","imageForZoom","code","description","downloadButton","channels","showCheckBox","scanButton"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row"],[1,"col-12"],[3,"total","next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){e&1&&(a(0,"mainpanel",0),C("onSubmit",function(_){return i.onSearch(_)}),a(1,"actions"),x(2,bn,3,0,"button",1)(3,In,4,1,"ng-container",2),l(),a(4,"filters")(5,"div")(6,"label",3),d(7,"Channel"),l(),a(8,"ng-select",4),F("ngModelChange",function(_){return T(i.searchFilter.ChannelID,_)||(i.searchFilter.ChannelID=_),_}),x(9,wn,3,3,"ng-template",5),l()(),a(10,"div",6)(11,"label",7),d(12,"SKU Assigned"),l(),a(13,"mat-radio-group",8),F("ngModelChange",function(_){return T(i.searchFilter.HaveSku,_)||(i.searchFilter.HaveSku=_),_}),a(14,"mat-radio-button",9),d(15," All "),l(),a(16,"mat-radio-button",9),d(17," Yes "),l(),a(18,"mat-radio-button",9),d(19," No "),l()()(),a(20,"div",6)(21,"label",7),d(22,"Item ID"),l(),a(23,"input",10),F("ngModelChange",function(_){return T(i.searchFilter.Item_id,_)||(i.searchFilter.Item_id=_),_}),l()()(),a(24,"content")(25,"div",11)(26,"div",12),x(27,yn,2,13,"div",13)(28,Mn,3,0,"ng-container",2),l(),x(29,Dn,3,4,"div",14),l()()()),e&2&&(c(2),s("ngIf",!i.productService.hasSelection(i.products)),c(),s("ngIf",i.productService.hasSelection(i.products)),c(5),s("clearable",!0)("items",i.channelOptions),O("ngModel",i.searchFilter.ChannelID),c(5),O("ngModel",i.searchFilter.HaveSku),c(),s("value",0),c(2),s("value",1),c(2),s("value",2),c(5),O("ngModel",i.searchFilter.Item_id),c(4),s("ngForOf",i.products),c(),s("ngIf",i.products.length==0),c(),s("ngIf",(i.products==null?null:i.products.length)>0))},dependencies:[k,A,ot,U,L,B,Y,rt,le,ce,z,q,$],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.itemTitle[_ngcontent-%COMP%]{cursor:pointer}"]});let o=r;return o})();function On(o,r){if(o&1&&(a(0,"span",9),g(1,"img",10),l(),d(2)),o&2){let n=r.item,t=p();c(),s("src",t.getChannelLogo(n.TypeID),D),c(),I(" ",n.Name," ")}}function Tn(o,r){if(o&1&&(a(0,"div",11),g(1,"app-duplicate-product-card",12),l()),o&2){let n=r.$implicit,t=r.index;c(),s("imageForZoom",n.ImageUrl)("title",n.Name)("code",n.Code)("id",t)("image",n.ThumbnailURL)("channels",n.Channels)}}function Fn(o,r){o&1&&(P(0),a(1,"div",13),g(2,"app-empty-state"),l(),b())}function En(o,r){if(o&1){let n=v();P(0),a(1,"div",14)(2,"div",15)(3,"app-custom-paginator",16),C("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())})("total",function(){m(n);let e=p();return u(e.getRowCount())}),l()()(),b()}if(o&2){let n=p();c(3),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",n.hasClickedRowCount)}}var Fe=(()=>{let r=class r{constructor(t,e,i){this.httpService=t,this.productService=e,this.authService=i,this.searchFilter=new Z,this.products=[],this.hasClickedRowCount=!1,this.getPageLoader(),this.channelOptions=i.getChannels()}getPageLoader(){this.productService.loader().subscribe(t=>{this.searchFilter=t.Filter,this.searchFilter.PageSize=t.Filter.RowCount,this.getProducts()})}getProducts(){let t={ListChannelID:this.searchFilter.ListChannelID,RowCount:this.searchFilter.RowCount,PageNumber:this.searchFilter.PageNumber,text:this.searchFilter.text};this.httpService.post("/api/product/GetDuplicateInChannel",t).subscribe(e=>{this.products=e.Data})}onSearch(t){this.searchFilter.text=t,this.hasClickedRowCount=!1,this.getProducts()}onClearFilter(){this.searchFilter.ChannelID=f.GuidEMpty}getChannelLogo(t){return f.getChannelLogoByTypeId(t)}getRowCount(){let t={text:this.searchFilter.text,ChannelID:this.searchFilter.ChannelID};this.httpService.post("/api/product/GetDuplicateInChannelRowCount",t).subscribe(e=>{this.hasClickedRowCount=!0,this.rowCount=e.Total})}};r.\u0275fac=function(e){return new(e||r)(S(K),S(j),S(R))},r.\u0275cmp=M({type:r,selectors:[["app-duplicate-sku"]],decls:14,vars:7,consts:[["headerTitle","Multiple Listing","textButton"," Search","description","SKU(s) which is listed more than one time (one to many)",3,"onSubmit"],["container",""],[1,"mb-2"],["appendTo","body","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel",1,"center-text",3,"ngModelChange","clear","multiple","clearable","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],[1,"container-fluid"],[1,"row","mt-8","mx-1"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],[4,"ngIf"],[1,"me-2"],["alt","",2,"width","18px",3,"src"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"imageForZoom","title","code","id","image","channels"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row","mt-2","justify-content-end"],[1,"col-md-12"],[3,"next","previous","total","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){e&1&&(a(0,"mainpanel",0),C("onSubmit",function(_){return i.onSearch(_)}),a(1,"filters")(2,"div",1)(3,"div")(4,"h6",2),d(5,"Channel"),l(),a(6,"ng-select",3),F("ngModelChange",function(_){return T(i.searchFilter.ListChannelID,_)||(i.searchFilter.ListChannelID=_),_}),C("clear",function(){return i.onClearFilter()}),x(7,On,3,2,"ng-template",4),l()()()(),a(8,"content")(9,"div",5)(10,"div",6),x(11,Tn,2,6,"div",7)(12,Fn,3,0,"ng-container",8),l(),x(13,En,4,4,"ng-container",8),l()()()),e&2&&(c(6),s("multiple",!0)("clearable",!0)("items",i.channelOptions),O("ngModel",i.searchFilter.ListChannelID),c(5),s("ngForOf",i.products),c(),s("ngIf",(i.products==null?null:i.products.length)==0),c(),s("ngIf",(i.products==null?null:i.products.length)>0))},dependencies:[k,A,U,L,B,Y,rt,yt,Ft,z,$]});let o=r;return o})();var kn=()=>["/menu/products/status/sold-in-channel"],Ee=o=>({ID:o}),Nn=()=>["/menu/products/status/not-in-pos"];function Vn(o,r){if(o&1&&(P(0),d(1),b()),o&2){let n=p().$implicit;c(),I(" ",n.Count," ")}}function An(o,r){if(o&1){let n=v();a(0,"span",26),C("click",function(){m(n);let e=p().$implicit,i=p(2);return u(i.getLiveProductCount(e.ID,e))}),g(1,"i",27),l()}}function Un(o,r){if(o&1){let n=v();a(0,"tr")(1,"td"),g(2,"img",17),a(3,"span",18),d(4),l()(),a(5,"td",19),x(6,Vn,2,1,"ng-container",6)(7,An,2,0,"ng-template",null,1,nt),l(),a(9,"td",19)(10,"a",20),d(11),E(12,"number"),l()(),a(13,"td",19)(14,"a",20),d(15),E(16,"number"),l()(),a(17,"td"),d(18),E(19,"date"),l(),a(20,"td")(21,"div",21)(22,"button",22),C("click",function(){let e=m(n).$implicit,i=p(2);return u(i.onScanChannel(e))}),g(23,"i",23),d(24," Scan "),l(),a(25,"button",24),C("click",function(){let e=m(n).$implicit,i=p(2);return u(i.onClearCache(e.ID))}),g(26,"i",25),d(27," Clear "),l()()()()}if(o&2){let n=r.$implicit,t=G(8),e=p(2);c(2),s("src",e.getChannelLogo(n.TypeID),D),c(2),et(n.Name),c(2),s("ngIf",n.Count!==void 0)("ngIfElse",t),c(4),s("routerLink",X(18,kn))("queryParams",pt(19,Ee,n.ID)),c(),I(" ",V(12,11,n.SoldInChannel)," "),c(3),s("routerLink",X(21,Nn))("queryParams",pt(22,Ee,n.ID)),c(),I(" ",V(16,13,n.NotInPOS)," "),c(3),I("",n.LastSync?Jt(19,15,n.LastSync,"dd MMM yyyy HH:mm"):"Never"," ")}}function Ln(o,r){if(o&1&&(P(0),a(1,"div",7)(2,"table",8)(3,"thead",9)(4,"tr",10)(5,"th"),d(6,"Channel"),l(),a(7,"th",11),d(8,"Live Product"),l(),a(9,"th",12),d(10,"Sold In Channel"),l(),a(11,"th",13),d(12,"Product Not in POS"),l(),a(13,"th",14),d(14,"Last Sync"),l(),g(15,"th",15),l()(),a(16,"tbody"),x(17,Un,28,24,"tr",16),E(18,"async"),l()()(),b()),o&2){let n,t=p();c(17),s("ngForOf",(n=V(18,1,t.channels$))==null?null:n.Data)}}function Rn(o,r){o&1&&(a(0,"div",28),g(1,"app-empty-state"),l())}var ke=(()=>{let r=class r{constructor(t,e,i,h){this.productService=t,this.toastr=e,this.dialog=i,this.authService=h,this.destroy$=new Bt,this.channelOptions=h.getChannels()}ngOnInit(){this.setObsProductStatistic()}setObsProductStatistic(){this.channels$=this.productService.getProductStatistic()}getLiveProductCount(t,e){this.productService.getTotalProductLive(t).pipe(Vt(this.destroy$)).subscribe(i=>{e.Count=i.Count})}onScanChannel(t){this.dialog.open(N,{width:"700px",data:{channelOptions:this.channelOptions,filter:{ChannelID:t.ID},disabledChannelOption:!0}}).afterClosed().pipe(y(e=>f.IsNotEmpty(e))).subscribe(e=>{this.scanAllProduct(t.ID,e)})}scanAllProduct(t,e){let i=this.productService.findChannelById(t,this.channelOptions);this.productService.scanAll(e.ChannelID,e.ScanFull,e.UpdatedProduct,e.Async).pipe(y(h=>h)).subscribe(h=>{e.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.productService.successToastrScanAllProduct(h,i,!e.UpdatedProduct),this.setObsProductStatistic())})}onClearCache(t){confirm("Are you sure you want to Clear Cache? This Process will remove your product integration to marketplace")&&this.productService.clearCacheChannel(t).pipe(Vt(this.destroy$)).subscribe(i=>{this.toastr.success("Successfully cleared cache","Success"),this.setObsProductStatistic()})}getChannelLogo(t){return f.getChannelLogoByTypeId(t)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}};r.\u0275fac=function(e){return new(e||r)(S(j),S(W),S(J),S(R))},r.\u0275cmp=M({type:r,selectors:[["app-channel-statistic"]],decls:9,vars:6,consts:[["EMPTY",""],["QUESTION",""],["headerTitle","Products Statistic",3,"hideSearchBox","hideSearchDropdown"],[1,"container-fluid"],[1,"row","mt-4"],[1,"col-md-12"],[4,"ngIf","ngIfElse"],[1,"table-responsive"],[1,"table","table-hover"],[1,"sticky-top-thead"],[1,"table-light"],[1,"text-center",2,"width","13rem"],[1,"text-center",2,"width","9rem"],[1,"text-center",2,"width","14rem"],[2,"width","10rem"],[2,"width","12rem"],[4,"ngFor","ngForOf"],[2,"width","24px","height","24px",3,"src"],[1,"ms-3"],[1,"text-center"],[3,"routerLink","queryParams"],[1,"d-flex","align-items-center","justify-content-center"],[1,"btn","btn-sm","btn-secondary","fs-6",3,"click"],[1,"fa","fa-spinner"],[1,"btn","btn-sm","btn-secondary","fs-6","ms-3",3,"click"],[1,"fa","fa-trash"],["matTooltip","Click to see total live product",1,"cursor-pointer","fs-5","text-primary",3,"click"],[1,"fa-solid","fa-circle-question","cursor"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"]],template:function(e,i){if(e&1&&(a(0,"mainpanel",2)(1,"content")(2,"div",3)(3,"div",4)(4,"div",5),x(5,Ln,19,3,"ng-container",6),E(6,"async"),x(7,Rn,2,0,"ng-template",null,0,nt),l()()()()()),e&2){let h,_=G(8);s("hideSearchBox",!0)("hideSearchDropdown",!0),c(5),s("ngIf",((h=V(6,4,i.channels$))==null||h.Data==null?null:h.Data.length)>0)("ngIfElse",_)}},dependencies:[k,A,B,Mt,It,$,xt,vt,zt]});let o=r;return o})();var Bn=[{component:Ie,path:"",children:[{path:"",redirectTo:"sold-in-channel",pathMatch:"full"},{path:"in-pos",component:Me,canActivate:[tt],data:{title:"Products in POS"}},{path:"sold-in-channel",component:De,canActivate:[tt],data:{title:"Products Sold in Channel"}},{path:"not-in-channel",component:Oe,canActivate:[tt],data:{title:"Products not in Channel"}},{path:"not-in-pos",component:Te,canActivate:[tt],data:{title:"Products not in POS"}},{path:"duplicate-sku",component:Fe,canActivate:[tt],data:{title:"Duplicate Sku in Channel"}},{path:"channel-statistic",component:ke,canActivate:[tt],data:{title:"Channel Statistic"}}]}],go=(()=>{let r=class r{};r.\u0275fac=function(e){return new(e||r)},r.\u0275mod=Wt({type:r}),r.\u0275inj=Gt({imports:[Pt,wt,oe,Dt,qt,be,se,ae,Ft,z,q,Yt.forChild(Bn),Se,Qt,ct]});let o=r;return o})();export{go as StatusModule};
|
|
1
|
+
import{a as N,b as Tt,c as Pe}from"./chunk-EGYILQWG.js";import{a as $}from"./chunk-BGWVHGAY.js";import"./chunk-SQTY2CZY.js";import{a as ve}from"./chunk-JY3L4RUM.js";import{a as Z}from"./chunk-7KG3DC5J.js";import{b as xe}from"./chunk-ULELZXI5.js";import"./chunk-E5BOLHDG.js";import"./chunk-A37OKNC2.js";import{a as re,b as ae}from"./chunk-7YWHTN3X.js";import{e as at}from"./chunk-XOLDVKQQ.js";import{f as _e,g as ge,h as Ce,i as fe,j as Se}from"./chunk-KZ6AD6KW.js";import"./chunk-BZPMSXEO.js";import{a as j}from"./chunk-7VKIP3Z6.js";import"./chunk-DYLT6RRK.js";import{a as Ft}from"./chunk-6UDYSYXW.js";import{a as z}from"./chunk-VBCIYCOF.js";import{b as be}from"./chunk-MKJON4UM.js";import{a as me,b as ue}from"./chunk-WKSTGJK5.js";import{a as le,b as ce,c as se}from"./chunk-GQG2K3LS.js";import{a as tt}from"./chunk-BM43VVCJ.js";import{a as q}from"./chunk-D6L7HUOY.js";import"./chunk-BTY6PS53.js";import{a as he}from"./chunk-D76K4RZ7.js";import{f as pe,g as de}from"./chunk-EIBGI6U2.js";import{a as rt,b as yt,d as Y,e as qt}from"./chunk-PYD2YWAN.js";import{g as R}from"./chunk-AD73Q5SO.js";import{b as W,e as K}from"./chunk-JHYIHRQH.js";import"./chunk-KCDL7SWP.js";import{b as te,c as ee,d as J,h as Ot,i as ne,j as ie,m as B,n as oe}from"./chunk-4CEFDQPI.js";import{t as Mt,u as Dt}from"./chunk-2SC3HO66.js";import{P as Qt,X as Xt}from"./chunk-DQIP7MCZ.js";import{b as Zt,c as ot,h as U,m as L,y as wt}from"./chunk-2E5AKA74.js";import{b as H,c as f}from"./chunk-FTHTFVHH.js";import{$c as Yt,B as y,Bc as xt,Cc as zt,Ec as vt,Fc as Pt,Ha as D,Ib as G,Ja as c,Jb as d,Ka as S,Kb as et,Lb as I,Nb as O,Ob as T,Pb as F,Rb as Kt,Sb as X,T as ft,Tb as pt,V as Vt,Va as Ut,Wc as bt,X as $t,Xc as Ht,Yc as it,Zc as It,_a as x,aa as Gt,ab as s,ac as E,bc as V,c as Bt,cc as Jt,da as At,dc as nt,ga as M,ha as Wt,hb as St,mb as a,nb as l,oa as m,ob as g,pa as u,pb as P,q as jt,qb as b,sb as v,vb as C,xb as p,xc as k,yc as A}from"./chunk-ZIZWZZ4E.js";import"./chunk-GNOSNGXM.js";var Ve=()=>["/menu/products/download/by-url"],Ie=(()=>{let r=class r{constructor(){this.productTabs=[{Title:"Sold in Channel",Url:"/menu/products/status/sold-in-channel",Description:"SKU has been mapped between dealpos and marketplace"},{Title:"Not in POS",Url:"/menu/products/status/not-in-pos",Description:"SKU sold in Marketplace but not exist in DEALPOS"},{Title:"Not in Channel",Url:"/menu/products/status/not-in-channel",Description:"SKU has not been sold on one of channels"},{Title:"In POS",Url:"/menu/products/status/in-pos",Description:"All products which is already available in POS"},{Title:"Multiple Listing",Url:"/menu/products/status/duplicate-sku",Description:"SKU(s) which is listed more than one time (one to many)"},{Title:"Channel Statistic",Url:"/menu/products/status/channel-statistic",Description:"Product statistic from each channel obtained from the last product scan"}]}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=M({type:r,selectors:[["app-status"]],decls:13,vars:3,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid","d-flex","align-items-center","justify-content-between"],[3,"Tabs"],[1,"dropdown","me-6"],["role","button","data-bs-toggle","dropdown","aria-expanded","false",1,"text-dark"],[1,"fa-solid","fa-bars","fa-lg"],[1,"dropdown-menu","dropdown-menu-end","row"],[1,"d-flex"],[1,"dropdown-item",3,"routerLink"]],template:function(e,i){e&1&&(a(0,"nav",0)(1,"div",1)(2,"div"),g(3,"nav-tab",2),l()(),a(4,"div")(5,"div",3)(6,"a",4),g(7,"i",5),l(),a(8,"div",6)(9,"div",7)(10,"a",8),d(11,"Download Product By Url"),l()()()()()(),g(12,"router-outlet")),e&2&&(c(3),s("Tabs",i.productTabs),c(7),s("routerLink",X(2,Ve)))},dependencies:[re,Ht,It]});let o=r;return o})();function Ae(o,r){if(o&1&&(a(0,"mat-option",6)(1,"div"),g(2,"img",7),a(3,"span"),d(4),l()()()),o&2){let n=r.$implicit;s("value",n.ChannelID),c(2),s("src",n.logo,D),c(2),et(n.Title)}}var ct=(()=>{let r=class r{constructor(){this.dialogRef=At(te),this.channels=At(ee),this.channelIds=Ut([]),this.channelOptions=Ut([])}ngOnInit(){this.initModalConfig();let t=this.channels.filter((e,i,h)=>h.findIndex(_=>_.ChannelID===e.ChannelID)===i);this.channelOptions.set(t)}initModalConfig(){this.modalConfig=new ne,this.modalConfig.title="Detach Product",this.modalConfig.okText="Save"}onClose(){this.dialogRef.close()}onSave(){let t=this.channels.filter(e=>this.channelIds().includes(e.ChannelID)).map(e=>({ChannelID:e.ChannelID,ChannelItemID:e.ChannelItemID}));this.dialogRef.close(t)}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=M({type:r,selectors:[["app-modal-detach-product"]],standalone:!0,features:[Kt],decls:8,vars:5,consts:[[3,"onClose","onCancel","onOk","dynamicValidated","config"],["content",""],[1,"mb-2","fw-bold"],["appearance","outline",1,"w-100"],["name","channelid","placeholder","Channel",1,"mat-select-channel",3,"ngModelChange","ngModel","multiple"],["class","channel-option",3,"value",4,"ngFor","ngForOf"],[1,"channel-option",3,"value"],[2,"width","18px","margin-right","10px",3,"src"]],template:function(e,i){e&1&&(a(0,"modal-material",0),C("onClose",function(){return i.onClose()})("onCancel",function(){return i.onClose()})("onOk",function(){return i.onSave()}),a(1,"div",1)(2,"div")(3,"label",2),d(4,"Select a Channel"),l(),a(5,"mat-form-field",3)(6,"mat-select",4),F("ngModelChange",function(_){return T(i.channelIds,_)||(i.channelIds=_),_}),x(7,Ae,5,3,"mat-option",5),l()()()()()),e&2&&(s("dynamicValidated",i.channelIds().length>0)("config",i.modalConfig),c(6),O("ngModel",i.channelIds),s("multiple",!0),c(),s("ngForOf",i.channelOptions()))},dependencies:[Pt,k,ie,de,pe,ue,me,Xt,wt,U,L,Dt]});let o=r;return o})();function Ue(o,r){if(o&1){let n=v();a(0,"button",13),C("click",function(){m(n);let e=p();return u(e.onDetachMultipleProduct())}),g(1,"i",14),d(2),l()}if(o&2){let n,t=p();c(2),I("Detach (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function Le(o,r){if(o&1){let n=v();a(0,"button",16),C("click",function(){m(n);let e=p(2);return u(e.onOpenScanDialog())}),g(1,"i",17),d(2," Scan Channel "),l()}}function Re(o,r){if(o&1&&(P(0),x(1,Le,3,0,"button",15),b()),o&2){let n=p();c(),s("ngIf",!n.productService.hasSelection(n.products))}}function Be(o,r){if(o&1){let n=v();P(0),a(1,"button",18),C("click",function(){m(n);let e=p();return u(e.onScanMultipleProduct())}),g(2,"i",17),d(3),l(),b()}if(o&2){let n,t=p();c(3),I(" Scan (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function je(o,r){if(o&1){let n=v();P(0),a(1,"button",19),C("click",function(){m(n);let e=p();return u(e.onUploadMultipleProduct())}),g(2,"i",20),d(3),l(),b()}if(o&2){let n,t=p();c(3),I(" Upload (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function $e(o,r){if(o&1){let n=v();a(0,"div",21)(1,"app-product-card",22),C("onUpload",function(){let e=m(n).$implicit,i=p();return u(i.onUploadToMultipleChannel(e))})("onScan",function(){let e=m(n).$implicit,i=p();return u(i.onScanSingleProduct(e))})("onDescEvent",function(){let e=m(n).index,i=p();return u(i.onOpenDialogVariant(e))})("onCheckBoxChange",function(e){let i=m(n).$implicit;return u(i.selected=e)})("onDetach",function(){let e=m(n).$implicit,i=p();return u(i.onDetachProduct([e]))}),l()()}if(o&2){let n=r.$implicit,t=p();c(),s("productId",n.ID)("title",n==null?null:n.Name)("image",n==null?null:n.ThumbnailUrl)("description",(n==null?null:n.Variants.length)>1?(n==null?null:n.Variants.length)+" Variants":null)("channels",t.productService.getChannelProduct(n))("code",t.getVariantCode(n==null?null:n.Variants))("showCheckBox",(n==null?null:n.Channel.length)<t.channelOptions.length)("scanButton",!0)("uploadButton",n==null?null:n.hasUpload)("imageForZoom",n==null?null:n.ImageUrl)("detachButton",(n==null||n.Channel==null?null:n.Channel.length)>0)}}function Ge(o,r){o&1&&(P(0),a(1,"div",23),g(2,"app-empty-state"),l(),b())}function We(o,r){if(o&1){let n=v();P(0),a(1,"div",24)(2,"div",25)(3,"app-custom-paginator",26),C("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())}),l()()(),b()}if(o&2){let n=p();c(3),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",!0)}}var Me=(()=>{let r=class r{constructor(t,e,i,h,_,w,st){this.http=t,this.toastr=e,this.dialog=i,this.productService=h,this.authService=_,this.uploadProductService=w,this.route=st,this.searchFilter=new Z,this.products=[],this.rowCount=0,this.multipeScanChannels=[],this.getLoaderPage(),this.channelOptions=this.authService.getChannels(),this.initMultiScanChannels()}getLoaderPage(){this.productService.LoadInPOS().subscribe(t=>{this.Categories=t.Options.Categories,this.searchFilter.PageNumber=t.Filter.PageNumber,this.searchFilter.RowCount=t.Filter.RowCount,this.searchFilter.ChannelID=null,this.searchFilter.Category=t.Filter.Category,this.searchFilter.PageSize=100,this.getProducts()})}initMultiScanChannels(){this.multipeScanChannels=this.productService.filterChannelByTypeId(this.channelOptions,[H.Tokopedia,H.Tiktok])}getProducts(){let t={PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount,text:this.searchFilter.text,Category:this.searchFilter.Category,From:this.startDate,To:this.endDate};this.http.post("/api/product/GetInPOS",t).subscribe(e=>{this.products=e.Data,this.rowCount=e.Total==null?this.searchFilter.RowCount:e.Total.toString(),this.products=this.productService.checkProductHasUploadBtn(this.products,this.channelOptions)})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open(N,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.UpdatedProduct=i.UpdatedProduct,this.searchFilter.Async=i.Async,this.scanAllProduct()})}scanAllProduct(){if(this.searchFilter.ChannelID==null){this.toastr.error("Please Select Channel","Error");return}this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(t=>{if(this.searchFilter.Async)this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"});else{this.getLoaderPage();let e=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.successToastrScanAllProduct(t,e,!this.searchFilter.UpdatedProduct)}})}onOpenDialogVariant(t){this.dialog.open(Tt,{data:{title:this.products[t].Name,variants:this.products[t].Variants},width:"800px"})}onUploadMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.uploadProductService.setSelectedProduct(t),this.route.navigate(["/menu/products/upload"])}onUploadToMultipleChannel(t){this.uploadProductService.setSelectedProduct([t]),this.route.navigate(["/menu/products/upload"])}searchProduct(t){this.searchFilter.text=t,this.getProducts()}onScanMultipleProduct(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty;let e=this.productService.filterChannelByTypeId(this.channelOptions,[H.Tokopedia,H.Tiktok]);this.dialog.open(N,{data:{filter:t,channelOptions:e,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(h=>f.IsNotEmpty(h))).subscribe(h=>{this.searchFilter.ChannelID=h.ChannelID,this.searchFilter.ScanFull=h.ScanFull,this.searchFilter.UpdatedProduct=h.UpdatedProduct;let _=this.productService.selectedProduct(this.products),w=this.productService.getVariantCodesProducts(_);this.scanSingleProduct(w)})}onScanSingleProduct(t){let e=JSON.parse(JSON.stringify(this.searchFilter));e.ChannelID=f.GuidEMpty,this.dialog.open(N,{data:{filter:e,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID;let h=this.productService.getVariantCodesProduct(t);this.scanSingleProduct(h)})}scanSingleProduct(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:e=>{if(e)this.toastr.success("Successfully Scan ","Success");else{let i=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.toastr.error(`This product is not existed in ${i?.Name} `,"Error")}this.searchFilter.ChannelID=f.GuidEMpty,e&&this.getProducts()},error:e=>{this.searchFilter.ChannelID=f.GuidEMpty}})}getVariantCode(t){let e;return t.length>1&&(e=(t[0].model?t[0].model:"")+t[0].Code),t.length==1&&(e=t[0].Code),e}onDetachProduct(t){let e=[];t.forEach(i=>{i.Channel=f.assignChannelLogo(i.Channel),e.push(...i.Channel)}),this.dialog.open(ct,{width:"600px",data:[...e]}).afterClosed().pipe(y(i=>f.IsNotEmpty(i)),ft(i=>this.productService.detachProduct(i))).subscribe(i=>{this.toastr.success(i.Message,Ot.Success),this.getProducts()})}onDetachMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.onDetachProduct(t)}};r.\u0275fac=function(e){return new(e||r)(S(K),S(W),S(J),S(j),S(R),S(at),S(it))},r.\u0275cmp=M({type:r,selectors:[["app-in-pos"]],decls:23,vars:14,consts:[["picker",""],["description","All products which is already available in POS",3,"onSubmit","headerTitle"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2"],[4,"ngIf"],[1,"fw-bold","mb-2"],["appendTo","body","bindLabel","Name","name","Name","bindValue","Name","placeholder","Select Category",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],[1,"mt-5"],["id","dates",1,"form-control","rounded","dateRange",3,"rangePicker"],["matStartDate","","placeholder","Start date",3,"ngModelChange","click","ngModel"],["matEndDate","","placeholder","End date",3,"ngModelChange","click","ngModel"],[1,"container-fluid"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"fa-sharp","fa-link-slash","me-2"],["type","button","data-cy","scanSoldinChannel","class","btn btn-outline-secondary shadow rounded",3,"click",4,"ngIf"],["type","button","data-cy","scanSoldinChannel",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onUpload","onScan","onDescEvent","onCheckBoxChange","onDetach","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom","detachButton"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row","mt-2","justify-content-end"],[1,"col-md-12"],[3,"next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){if(e&1){let h=v();a(0,"mainpanel",1),C("onSubmit",function(w){return m(h),u(i.searchProduct(w))}),a(1,"actions"),x(2,Ue,3,1,"button",2)(3,Re,2,1,"ng-container",3)(4,Be,4,1,"ng-container",3)(5,je,4,1,"ng-container",3),l(),a(6,"filters")(7,"div")(8,"label",4),d(9,"Category"),l(),a(10,"ng-select",5),C("ngModelChange",function(w){return m(h),u(i.searchFilter.Category=w)}),l()(),a(11,"div",6)(12,"mat-date-range-input",7)(13,"input",8),F("ngModelChange",function(w){return m(h),T(i.startDate,w)||(i.startDate=w),u(w)}),C("click",function(){m(h);let w=G(16);return u(w.open())}),l(),a(14,"input",9),F("ngModelChange",function(w){return m(h),T(i.endDate,w)||(i.endDate=w),u(w)}),C("click",function(){m(h);let w=G(16);return u(w.open())}),l()(),g(15,"mat-date-range-picker",null,0),l()(),a(17,"content")(18,"div",10)(19,"div",11),x(20,$e,2,11,"div",12)(21,Ge,3,0,"ng-container",3),l(),x(22,We,4,4,"ng-container",3),l()()()}if(e&2){let h=G(16);s("headerTitle","In POS ("+i.rowCount+")"),c(2),St(i.productService.hasSelection(i.products)?2:-1),c(),s("ngIf",!i.productService.hasSelection(i.products)),c(),s("ngIf",i.productService.hasSelection(i.products)&&i.multipeScanChannels.length>0),c(),s("ngIf",i.productService.hasSelection(i.products)),c(5),s("clearable",!0)("items",i.Categories)("ngModel",i.searchFilter.Category),c(2),s("rangePicker",h),c(),O("ngModel",i.startDate),c(),O("ngModel",i.endDate),c(6),s("ngForOf",i.products),c(),s("ngIf",i.products.length==0),c(),s("ngIf",i.products.length>0)}},dependencies:[k,A,ot,U,L,B,Y,z,q,$,Ce,_e,ge,fe],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.img-logo[_ngcontent-%COMP%]{height:24px;width:24px}.dateRange[_ngcontent-%COMP%]{padding-top:.8rem;padding-bottom:.8rem}"]});let o=r;return o})();function Ke(o,r){if(o&1){let n=v();a(0,"button",11),C("click",function(){m(n);let e=p();return u(e.onDetachMultipleProduct())}),g(1,"i",12),d(2),l()}if(o&2){let n,t=p();c(2),I("Detach (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function Je(o,r){if(o&1){let n=v();P(0),a(1,"button",13),C("click",function(){m(n);let e=p();return u(e.onOpenScanDialog())}),g(2,"i",14),d(3," Scan Channel "),l(),b()}}function ze(o,r){if(o&1){let n=v();P(0),a(1,"button",15),C("click",function(){m(n);let e=p();return u(e.onScanMultipleProduct())}),g(2,"i",14),d(3),l(),b()}if(o&2){let n=p();c(3),I(" Scan (",n.productService.selectedProduct(n.products).length,") ")}}function He(o,r){if(o&1){let n=v();P(0),a(1,"button",16),C("click",function(){m(n);let e=p();return u(e.onUploadMultipleProduct())}),g(2,"i",17),d(3),l(),b()}if(o&2){let n=p();c(3),I(" Upload (",n.productService.selectedProduct(n.products).length,") ")}}function Ye(o,r){if(o&1&&(a(0,"span",18),g(1,"img",19),l(),d(2)),o&2){let n=r.item;c(),s("src",n.Img,D)("alt",n.Name),c(),I(" ",n.Name," ")}}function Ze(o,r){if(o&1){let n=v();a(0,"div",20)(1,"label",21),d(2,"Item ID"),l(),a(3,"input",22),F("ngModelChange",function(e){m(n);let i=p();return T(i.searchFilter.Item_id,e)||(i.searchFilter.Item_id=e),u(e)}),l()()}if(o&2){let n=p();c(3),O("ngModel",n.searchFilter.Item_id)}}function qe(o,r){if(o&1){let n=v();a(0,"div",23)(1,"app-product-card",24),C("onUpload",function(){let e=m(n).$implicit,i=p();return u(i.onUploadToMultipleChannel(e))})("onDescEvent",function(){let e=m(n).index,i=p();return u(i.onOpenVariantDetail(e))})("onScan",function(){let e=m(n).$implicit,i=p();return u(i.onScanSingleProduct(e))})("onCheckBoxChange",function(e){let i=m(n).$implicit;return u(i.selected=e)})("onDetach",function(){let e=m(n).$implicit,i=p();return u(i.onDetachProduct([e]))}),l()()}if(o&2){let n=r.$implicit,t=p();c(),s("productId",n==null?null:n.ID)("title",n==null?null:n.Name)("image",n==null?null:n.ThumbnailUrl)("description",(n==null||n.Variants==null?null:n.Variants.length)>1?(n==null||n.Variants==null?null:n.Variants.length)+" Variants":null)("channels",t.productService.getChannelProduct(n))("code",t.getVariantCode(n==null?null:n.Variants))("showCheckBox",n==null?null:n.hasScan)("scanButton",!0)("uploadButton",n==null?null:n.hasUpload)("imageForZoom",n==null?null:n.ImageUrl)("detachButton",(n==null||n.Channel==null?null:n.Channel.length)>0)}}function Qe(o,r){o&1&&(P(0),a(1,"div",25),g(2,"app-empty-state"),l(),b())}function Xe(o,r){if(o&1){let n=v();a(0,"div",26)(1,"div",27)(2,"app-custom-paginator",28),C("total",function(){m(n);let e=p();return u(e.getRowCount())})("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())}),l()()()}if(o&2){let n=p();c(2),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",n.hasClickRowCount)}}var De=(()=>{let r=class r{constructor(t,e,i,h,_,w,st,Ct){this.http=t,this.dialog=e,this.toastr=i,this.productService=h,this.activateRouter=_,this.authService=w,this.route=st,this.uploadProductService=Ct,this.searchFilter=new Z,this.products=[],this.rowCount=0,this.hasClickRowCount=!1,this.guidEmpty=f.GuidEMpty,this.multipeScanChannels=[],this.channelOptions=this.authService.getChannels(),this.initMultiScanChannels()}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(f.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(e=>{this.searchFilter=e.Filter,e.Filter.ChannelID!=f.GuidEMpty&&(this.searchFilter.ListChannelID=[],this.searchFilter.ListChannelID.push(e.Filter.ChannelID)),this.searchFilter.PageSize=e.Filter.RowCount,this.searchFilter.Item_id="",this.getProducts()})}initMultiScanChannels(){this.multipeScanChannels=this.productService.filterChannelByTypeId(this.channelOptions,[H.Tokopedia,H.Tiktok])}getProducts(){let t={ListChannelID:this.searchFilter.ListChannelID,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount,text:this.searchFilter.text,Item_id:this.searchFilter.Item_id};this.productService.findAllSoldInChannel(t).subscribe(e=>{this.products=e.Data,this.products=this.productService.checkProductHasUploadBtn(this.products,this.channelOptions),this.products=this.productService.checkProductHasScanButton(this.products,this.channelOptions)})}searchProduct(t){this.searchFilter.text=t,this.hasClickRowCount=!1,this.getProducts()}onOpenVariantDetail(t){let e=this.products[t].Variants;this.dialog.open(Tt,{data:{variants:e,title:this.products[t].Name},width:"800px"})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open(N,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.UpdatedProduct=i.UpdatedProduct,this.searchFilter.Async=i.Async,this.scanAllProduct()})}scanAllProduct(){let t=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).pipe(y(e=>e)).subscribe(e=>{this.searchFilter.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.productService.successToastrScanAllProduct(e,t,!this.searchFilter.UpdatedProduct),this.initPageLoader(f.GuidEMpty))})}onScanSingleProduct(t){t.Channel=this.productService.getChannelProduct(t);let e=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(N,{data:{filter:e,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID;let h=this.productService.getVariantCodesProduct(t);this.scanProducts(h)})}onUploadToMultipleChannel(t){this.uploadProductService.setSelectedProduct([t]),this.route.navigate(["/menu/products/upload"])}onScanMultipleProduct(){this.searchFilter.ChannelID=f.GuidEMpty;let t=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(N,{data:{filter:t,channelOptions:this.multipeScanChannels,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.UpdatedProduct=i.UpdatedProduct;let h=this.productService.selectedProduct(this.products),_=this.productService.getVariantCodesProducts(h);this.scanProducts(_)})}scanProducts(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:e=>{let i=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);e?this.toastr.success(`Product Successfully scan with ${i?.Name}`,"Success"):this.toastr.error(`This product is not existed in ${i?.Name} `,"Error"),this.searchFilter.ChannelID=f.GuidEMpty,e&&this.getProducts()},error:e=>{this.searchFilter.ChannelID=f.GuidEMpty}})}getVariantCode(t){let e;return t.length>1&&(e=(t[0].model?t[0].model:"")+t[0].Code),t.length==1&&(e=t[0].Code),e}onClearFilterChannel(){this.searchFilter.ChannelID=f.GuidEMpty,this.searchFilter.Item_id=""}onUploadMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.uploadProductService.setSelectedProduct(t),this.route.navigate(["/menu/products/upload"])}getRowCount(){let t={ListChannelID:this.searchFilter.ListChannelID,text:this.searchFilter.text};this.http.post("/api/product/GetSoldInChannelRowCount",t).subscribe(e=>{this.hasClickRowCount=!0,this.rowCount=e.Total})}onDetachProduct(t){let e=[];t.forEach(i=>{i.Channel=f.assignChannelLogo(i.Channel),e.push(...i.Channel)}),this.dialog.open(ct,{width:"600px",data:[...e]}).afterClosed().pipe(y(i=>f.IsNotEmpty(i)),ft(i=>this.productService.detachProduct(i))).subscribe(i=>{this.toastr.success(i.Message,Ot.Success),this.getProducts()})}onDetachMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.onDetachProduct(t)}};r.\u0275fac=function(e){return new(e||r)(S(K),S(J),S(W),S(j),S(bt),S(R),S(it),S(at))},r.\u0275cmp=M({type:r,selectors:[["app-sold-in-channel"]],decls:19,vars:13,consts:[["description","SKU has been mapped between dealpos and marketplace",3,"onSubmit","headerTitle"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2"],[4,"ngIf"],[1,"fw-bold","mb-2"],["appendTo","body","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel",1,"center-text",3,"ngModelChange","clear","clearable","multiple","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],["class","mt-5",4,"ngIf"],[1,"container-fluid"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],["class","row",4,"ngIf"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"fa-sharp","fa-link-slash","me-2"],["type","button","data-cy","scanSoldinChannel",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"me-2"],[2,"width","18px",3,"src","alt"],[1,"mt-5"],[1,"fw-bold"],["type","text","name","Item_id","id","Item_id",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onUpload","onDescEvent","onScan","onCheckBoxChange","onDetach","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom","detachButton"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row"],[1,"col-12"],[3,"total","next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){e&1&&(a(0,"mainpanel",0),C("onSubmit",function(_){return i.searchProduct(_)}),a(1,"actions"),x(2,Ke,3,1,"button",1)(3,Je,4,0,"ng-container",2)(4,ze,4,1,"ng-container",2)(5,He,4,1,"ng-container",2),l(),a(6,"filters")(7,"div")(8,"label",3),d(9,"Channel"),l(),a(10,"ng-select",4),C("ngModelChange",function(_){return i.searchFilter.ListChannelID=_})("clear",function(){return i.onClearFilterChannel()}),x(11,Ye,3,3,"ng-template",5),l()(),x(12,Ze,4,1,"div",6),l(),a(13,"content")(14,"div",7)(15,"div",8),x(16,qe,2,11,"div",9)(17,Qe,3,0,"ng-container",2),l(),x(18,Xe,3,4,"div",10),l()()()),e&2&&(s("headerTitle","Sold in Channel"),c(2),St(i.productService.hasSelection(i.products)?2:-1),c(),s("ngIf",!i.productService.hasSelection(i.products)),c(),s("ngIf",i.multipeScanChannels.length>0&&i.productService.hasSelection(i.products)),c(),s("ngIf",i.productService.hasSelection(i.products)),c(5),s("clearable",!0)("multiple",!0)("items",i.channelOptions)("ngModel",i.searchFilter.ListChannelID),c(2),s("ngIf",i.searchFilter.ListChannelID!=null),c(4),s("ngForOf",i.products),c(),s("ngIf",i.products.length==0),c(),s("ngIf",i.products==null?null:i.products.length))},dependencies:[k,A,ot,U,L,B,Y,rt,yt,z,q,$],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}"]});let o=r;return o})();function en(o,r){if(o&1){let n=v();a(0,"button",13),C("click",function(){m(n);let e=p(2);return u(e.uploadMultipleProduct())}),g(1,"i",14),d(2),l()}if(o&2){let n=p(2);c(2),I(" upload (",n.selectedProducts==null?null:n.selectedProducts.length,") ")}}function nn(o,r){if(o&1){let n=v();P(0),a(1,"td",29)(2,"input",30),F("ngModelChange",function(e){m(n);let i=p(2).$implicit;return T(i.selected,e)||(i.selected=e),u(e)}),C("ngModelChange",function(){m(n);let e=p(3).ngIf,i=p(3);return u(i.onSelectProduct(e))}),l()(),b()}if(o&2){let n=p(2).$implicit;c(),s("rowSpan",n==null?null:n.Variants.length),c(),O("ngModel",n.selected)}}function on(o,r){if(o&1){let n=v();P(0),a(1,"img",35),C("click",function(e){m(n);let i=p(3).$implicit,h=p(4);return u(h.onZoomImage(e,i==null?null:i.ImageUrl))}),l(),b()}if(o&2){let n=p(3).$implicit;c(),s("src",n==null?null:n.ImageUrl,D)}}function rn(o,r){o&1&&g(0,"img",36)}function an(o,r){if(o&1&&(P(0),a(1,"td",29)(2,"div",31),x(3,on,2,1,"ng-container",11)(4,rn,1,0,"ng-template",null,1,nt),l()(),a(6,"td",32)(7,"h4",33)(8,"span",34),d(9),l()()(),b()),o&2){let n=G(5),t=p(2).$implicit;c(),s("rowSpan",t==null?null:t.Variants.length),c(2),s("ngIf",t==null?null:t.ImageUrl)("ngIfElse",n),c(3),s("rowSpan",t==null?null:t.Variants.length),c(2),s("matTooltip",(t==null||t.Name==null?null:t.Name.length)>50?t==null?null:t.Name:""),c(),I(" ",t==null?null:t.Name," ")}}function ln(o,r){if(o&1&&(a(0,"div")(1,"a",25),g(2,"img",37),l()()),o&2){let n=r.$implicit;c(),s("href",n.URL,D),c(),s("src",n.Img,D)("matTooltip",n.Name)}}function cn(o,r){if(o&1&&(a(0,"div"),g(1,"img",37),l()),o&2){let n=r.$implicit;c(),s("src",n.Img,D)("matTooltip",n.Name)}}function sn(o,r){if(o&1&&(a(0,"tr"),x(1,nn,3,2,"ng-container",12)(2,an,10,6,"ng-container",12),a(3,"td"),d(4),l(),a(5,"td")(6,"span"),d(7),l(),a(8,"span",24)(9,"a",25),g(10,"i",26),l()()(),a(11,"td",27)(12,"div",28),x(13,ln,3,3,"div",23),l()(),a(14,"td",27)(15,"div",28),x(16,cn,2,2,"div",23),l()()()),o&2){let n=r.$implicit,t=r.index,e=p(5);c(),s("ngIf",t==0),c(),s("ngIf",t==0),c(2),I(" ",n.Name," "),c(3),I(" ",n.Code," "),c(2),s("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(n==null?null:n.ID),D),c(4),s("ngForOf",n==null?null:n.Available),c(3),s("ngForOf",n==null?null:n.NotAvailable)}}function pn(o,r){if(o&1&&(P(0),x(1,sn,17,7,"tr",23),b()),o&2){let n=r.$implicit;c(),s("ngForOf",n.Variants)}}function dn(o,r){if(o&1&&(a(0,"tbody"),x(1,pn,2,1,"ng-container",23),l()),o&2){let n=r.ngIf;c(),s("ngForOf",n)}}function mn(o,r){if(o&1&&(P(0),a(1,"div",15)(2,"table",16)(3,"thead",17)(4,"tr"),g(5,"th",18),a(6,"th",19),d(7,"Product"),l(),a(8,"th",20),d(9,"Variant"),l(),a(10,"th",20),d(11,"SKU"),l(),a(12,"th",21),d(13,"Available In"),l(),a(14,"th",22),d(15,"Not Available In"),l()()(),x(16,dn,2,1,"tbody",12),E(17,"async"),l()(),b()),o&2){let n=p(2);c(16),s("ngIf",V(17,1,n.data$))}}function un(o,r){o&1&&(a(0,"div",38),g(1,"app-empty-state"),l())}function hn(o,r){if(o&1){let n=v();a(0,"span",46),C("click",function(){m(n);let e=p(4);return u(e.getRowCount())}),a(1,"i",47),d(2,"?"),l()()}}function _n(o,r){if(o&1&&(a(0,"span"),d(1),E(2,"number"),l()),o&2){let n=r.ngIf;c(),et(V(2,1,n==null?null:n.Count))}}function gn(o,r){if(o&1){let n=v();a(0,"a",48),C("click",function(){m(n);let e=p(4);return u(e.onNextPage())}),g(1,"i",49),d(2," Next"),l()}}function Cn(o,r){if(o&1){let n=v();a(0,"a",50),C("click",function(){m(n);let e=p(4);return u(e.onLastPage())}),g(1,"i",51),d(2," Last"),l()}}function fn(o,r){if(o&1&&(P(0),a(1,"div",39)(2,"div",40)(3,"div",41),d(4),E(5,"number"),x(6,hn,3,0,"span",42)(7,_n,3,3,"span",12),E(8,"async"),d(9),l()(),a(10,"div",43),x(11,gn,3,0,"a",44)(12,Cn,3,0,"a",45),l()(),b()),o&2){let n=p().ngIf,t=p(2);c(4),I(" Showing 1 - ",V(5,6,n==null?null:n.length)," of "),c(2),s("ngIf",t.paginationService.hideCount),c(),s("ngIf",!t.paginationService.hideCount&&V(8,8,t.rowCount$)),c(2),I(" records ~ ",t.paginationService.footerPageNumber," Page "),c(2),s("ngIf",t.paginationService.disableNextButton&&!t.paginationService.goToLastPage),c(),s("ngIf",t.paginationService.disableNextButton&&!t.paginationService.goToLastPage)}}function Sn(o,r){if(o&1&&(P(0),x(1,fn,13,10,"ng-container",12),b()),o&2){let n=r.ngIf;c(),s("ngIf",(n==null?null:n.length)>0)}}function xn(o,r){if(o&1){let n=v();a(0,"mainpanel",3),C("onSubmit",function(e){m(n);let i=p();return u(i.searchProduct(e))}),a(1,"actions"),x(2,en,3,1,"button",4),a(3,"button",5),C("click",function(){m(n);let e=p();return u(e.openScanDialog())}),g(4,"i",6),d(5," Scan Channel "),l(),a(6,"button",7),C("click",function(){m(n);let e=p();return u(e.openExportDialog())}),g(7,"i",8),a(8,"span"),d(9,"Export"),l()()(),a(10,"content")(11,"div",9)(12,"div",10),x(13,mn,18,3,"ng-container",11),E(14,"async"),x(15,un,2,0,"ng-template",null,0,nt),l(),x(17,Sn,2,1,"ng-container",12),E(18,"async"),l()()()}if(o&2){let n,t=G(16),e=p();s("hideSearchDropdown",!0),c(2),s("ngIf",e.hasSelectionProduct),c(11),s("ngIf",((n=V(14,5,e.data$))==null?null:n.length)>0)("ngIfElse",t),c(4),s("ngIf",V(18,7,e.data$))}}var Oe=(()=>{let r=class r{constructor(t,e,i,h,_,w,st,Ct,Ne){this.http=t,this.dialog=e,this.toastr=i,this.route=h,this.productService=_,this.paginationService=w,this.biggerPictureService=st,this.authService=Ct,this.uploadProductService=Ne,this.loaderAPI="product/Load",this.rowCountAPI="product/GetNotInChannelRowCount",this.notChannelAPI="product/GetNotInChannelV2",this.hasSelectionProduct=!1,this.selectedProducts=[],this.channelOptions=Ct.getChannels(),this.hostName=this.authService.getDomain()}ngOnInit(){this.initPageLoader(),this.iniData()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.notChannelAPI,this.loader$=this.http.post(`api/${this.loaderAPI}`,{}).pipe($t(t=>{this.filterSearch=t.Filter,this.paginationService.reloadPagination(t.Filter)}))}iniData(){this.data$=this.paginationService.data$.pipe(jt(t=>(t=t.map(e=>(e.Variants=e.Variants.map(i=>(i.Available=this.productService.sortChannel(i.Available),i.NotAvailable=this.productService.sortChannel(i.NotAvailable),i.Available=this.assignLogoChannel(i.Available),i.NotAvailable=this.assignLogoChannel(i.NotAvailable),i)),e.Channel=e?.Variants[0]?.Available,e)),t)))}assignLogoChannel(t){return t=t.map(e=>(e.Img=f.getChannelLogoByTypeId(e.TypeID),e)),t}searchProduct(t){this.filterSearch.text=t,this.paginationService.reloadPagination(this.filterSearch)}scanAllProduct(){let t=this.productService.findChannelById(this.filterSearch.ChannelID,this.channelOptions);this.productService.scanAll(this.filterSearch.ChannelID,this.filterSearch.ScanFull,this.filterSearch.UpdatedProduct,this.filterSearch.Async).subscribe(e=>{this.filterSearch.Async?this.toastr.success("You will be notified when the scan is completed.","Scan Asynchronous"):(this.productService.successToastrScanAllProduct(e,t,!this.filterSearch.UpdatedProduct),this.initPageLoader())})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.filterSearch));t.ChannelID=f.GuidEMpty,this.dialog.open(N,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.filterSearch.ChannelID=i.ChannelID,this.filterSearch.ScanFull=i.ScanFull,this.filterSearch.UpdatedProduct=i.UpdatedProduct,this.filterSearch.Async=i.Async,this.scanAllProduct()})}getRowCount(){this.paginationService.hideCount=!1,this.rowCount$=this.http.post(`/api/${this.rowCountAPI}`,this.filterSearch)}onNextPage(){this.paginationService.onNextPage(this.filterSearch)}onLastPage(){this.http.post(`/api/${this.rowCountAPI}`,{}).subscribe({next:t=>{this.filterSearch.PageNumber=1,this.paginationService.getAllData(this.filterSearch,t.Count)}})}onZoomImage(t,e){this.biggerPictureService.openBiggerPicture(t,e)}onSelectProduct(t){this.hasSelectionProduct=this.productService.hasSelection(t),this.selectedProducts=this.productService.selectedProduct(t)}uploadMultipleProduct(){this.uploadProductService.setSelectedProduct(this.selectedProducts),this.route.navigate(["/menu/products/upload"])}ngOnDestroy(){this.paginationService.destroy()}openExportDialog(){this.dialog.open(xe,{data:{title:"Export Not In Channel",pageNumber:this.filterSearch.PageNumber,rowCount:this.filterSearch.RowCount,filterExport:this.filterSearch,getRowCountApi:"product/GetNotInChannelRowCount",exportApi:"product/GetNotInChannelExport"}}).afterClosed().subscribe()}};r.\u0275fac=function(e){return new(e||r)(S(K),S(J),S(W),S(it),S(j),S(ve),S(he),S(R),S(at))},r.\u0275cmp=M({type:r,selectors:[["app-not-in-channel"]],decls:2,vars:3,consts:[["EMPTY",""],["elsePic",""],["headerTitle","Not in Channel","description","SKU has not been sold on one of channels",3,"hideSearchDropdown","onSubmit",4,"ngIf"],["headerTitle","Not in Channel","description","SKU has not been sold on one of channels",3,"onSubmit","hideSearchDropdown"],["class","btn btn-light shadow rounded ms-2",3,"click",4,"ngIf"],["data-cy","scanNotinChannel","type","button",1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"container-fluid","mt-3"],[1,"row"],[4,"ngIf","ngIfElse"],[4,"ngIf"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"col-md-12"],[1,"table","border-bottom"],[1,"thead-light","sticky-top-thead"],[2,"width","10px"],["colspan","2",1,"ms-5","text-center",2,"width","450px"],[2,"width","150px"],[2,"width","20%"],[2,"width","16%"],[4,"ngFor","ngForOf"],[1,"ms-1"],["target","_blank",3,"href"],[1,"fas","fa-solid","fa-arrow-up-right-from-square","external-link-custom"],[2,"padding-left","0px"],[1,"d-flex","flex-wrap","mb-1"],[1,"text-center",3,"rowSpan"],["type","checkbox",3,"ngModelChange","ngModel"],[2,"padding-right","0px"],[1,"text-start",3,"rowSpan"],[1,"ms-5","fw-normal","text-ellipsis",2,"max-width","26vw !important"],[3,"matTooltip"],[1,"border","rounded","cursor-pointer",2,"max-width","40px",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded",2,"max-width","40px"],["alt","",1,"channel-logo","cursor-pointer","ms-4","mt-3",3,"src","matTooltip"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"d-flex","justify-content-between","mt-5"],[1,"me-auto","d-sm-block","collapse","mt-3"],[1,"font-weight-bold","font-italic","hidden-xxs"],["style","cursor: pointer",3,"click",4,"ngIf"],[1,"btn-group"],["role","button","class","btn btn-outline-secondary btn-sm text-primary","title","Load more for 20 products",3,"click",4,"ngIf"],["role","button","class","btn btn-outline-secondary btn-sm text-primary","title","Load all products",3,"click",4,"ngIf"],[2,"cursor","pointer",3,"click"],["title","Retreive rows count",1,"border","p-3"],["role","button","title","Load more for 20 products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fas","fa-arrow-right"],["role","button","title","Load all products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fas","fa-share"]],template:function(e,i){e&1&&(x(0,xn,19,9,"mainpanel",2),E(1,"async")),e&2&&s("ngIf",V(1,1,i.loader$))},dependencies:[k,A,Zt,U,L,B,Mt,$,xt,vt],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}thead[_ngcontent-%COMP%]{position:sticky;top:0}.channel-logo[_ngcontent-%COMP%]{width:20px}.w-img[_ngcontent-%COMP%]{width:100%}"]});let o=r;return o})();var vn=o=>[o],Pn=()=>[];function bn(o,r){if(o&1){let n=v();a(0,"button",15),C("click",function(){m(n);let e=p();return u(e.openScanDialog())}),g(1,"i",16),d(2," Scan Channel "),l()}}function In(o,r){if(o&1){let n=v();P(0),a(1,"button",17),C("click",function(){m(n);let e=p();return u(e.onDownloadAllProduct("SELECTED"))}),g(2,"i",18),d(3),l(),b()}if(o&2){let n,t=p();c(3),I(" Download (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function wn(o,r){if(o&1&&(a(0,"span",19),g(1,"img",20),l(),d(2)),o&2){let n=r.item;c(),s("src",n.Img,D)("alt",n.Name),c(),I(" ",n.Name," ")}}function yn(o,r){if(o&1){let n=v();a(0,"div",21)(1,"app-product-card",22),C("onCheckBoxChange",function(e){let i=m(n).index,h=p();return u(h.onSelectProduct(e,i))})("onDescEvent",function(){let e=m(n).index,i=p();return u(i.onShowVariantDetail(e))})("onDownload",function(){let e=m(n).$implicit,i=p();return u(i.onDownloadProduct(e))})("onScan",function(){let e=m(n).$implicit,i=p();return u(i.onScanChannel(e))}),l()()}if(o&2){let n=r.$implicit;c(),s("showRedirectIcon",!1)("title",n==null?null:n.Name)("image",n==null?null:n.Image)("imageForZoom",n==null?null:n.Image)("code",n==null?null:n.SKU)("description",(n==null||n.Variant==null?null:n.Variant.length)>0?(n==null||n.Variant==null?null:n.Variant.length)+" Variants":null)("downloadButton",!0)("channels",n!=null&&n.Channel?pt(10,vn,n==null?null:n.Channel):X(12,Pn))("showCheckBox",!0)("scanButton",!0)}}function Mn(o,r){o&1&&(P(0),a(1,"div",23),g(2,"app-empty-state"),l(),b())}function Dn(o,r){if(o&1){let n=v();a(0,"div",24)(1,"div",25)(2,"app-custom-paginator",26),C("total",function(){m(n);let e=p();return u(e.getRowCount())})("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())}),l()()()}if(o&2){let n=p();c(2),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",n.hasClickRowCount)}}var Te=(()=>{let r=class r{constructor(t,e,i,h,_,w){this.http=t,this.dialog=e,this.productService=i,this.toastrService=h,this.activateRouter=_,this.authService=w,this.searchFilter=new Z,this.products=[],this.hasClickRowCount=!1,this.channelOptions=this.authService.getChannels()}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(f.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(e=>{this.searchFilter=e.Filter,this.searchFilter.PageSize=e.Filter.RowCount,this.getProducts()})}getProducts(){this.http.post("/api/product/GetProductChannelNotPOS",this.searchFilter).subscribe(t=>{this.products=t.Data,this.mapChannelToProduct(),this.setSkuProduct()})}mapChannelToProduct(){let t;this.products=this.products.map(e=>(t=this.channelOptions.find(i=>i.ID==e.ChannelID),t?e.Channel=JSON.parse(JSON.stringify(t)):e.Channel=null,e)).map(e=>(e.Channel&&(e.Channel.Url=e.Url),e))}setSkuProduct(){this.products=this.products.map(t=>(t?.Variant?.length==0?f.IsNotEmpty(t?.ChannelItemSKU)?t.SKU=t?.ChannelItemSKU:t.SKU="SKU not assigned":t.SKU=t?.Variant[0]?.ChannelVariationSKU?t?.Variant[0]?.ChannelVariationSKU:"SKU not assigned",t))}onSearch(t){this.searchFilter.text=t,this.hasClickRowCount=!1,this.getProducts()}onClearChannelFilter(){this.searchFilter.ChannelID=f.GuidEMpty}onScanAll(){let t=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(e=>{this.searchFilter.Async?this.toastrService.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.initPageLoader(f.GuidEMpty),this.productService.successToastrScanAllProduct(e,t,!this.searchFilter.UpdatedProduct)),this.searchFilter.ChannelID=f.GuidEMpty})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open(N,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>f.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.UpdatedProduct=i.UpdatedProduct,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.Async=i.Async,this.onScanAll()})}onDownloadAllProduct(t){let e;t=="ALL"?e=this.products:e=this.productService.selectedProduct(this.products),e.length>0&&this.productService.downloadMultipleProduct(e).subscribe({next:()=>{this.getProducts()}})}onSelectProduct(t,e){this.products[e].selected=t}onDownloadProduct(t){confirm(`Are you sure you want to Retrieve product ${t?.Name} from ${t?.Channel.Name} to POS?`)&&this.productService.downloadProduct(t).subscribe({next:()=>{this.getProducts()}})}onScanChannel(t){let e=JSON.parse(JSON.stringify(t));delete e.Channel,this.productService.scanCompareToPos([e]).subscribe(i=>{i.Status?(this.initPageLoader(f.GuidEMpty),this.toastrService.success(`product ${t.Name} have been successfully scanned and synchronized with POS`,"Success")):this.toastrService.error(`Product ${t.Name} is not existed in POS`,"Error")})}onShowVariantDetail(t){let e=this.products[t].Variant;e.length>0&&this.dialog.open(Pe,{data:{title:this.products[t].Name,variants:e},width:"30%"})}getRowCount(){let t={ChannelID:this.searchFilter.ChannelID,text:this.searchFilter.text,HaveSku:parseInt(this.searchFilter.HaveSku)};this.http.post("/api/product/GetProductChannelNotPOSRowCount",t).subscribe(e=>{this.hasClickRowCount=!0,this.rowCount=e.Count})}};r.\u0275fac=function(e){return new(e||r)(S(K),S(J),S(j),S(W),S(bt),S(R))},r.\u0275cmp=M({type:r,selectors:[["app-not-in-pos"]],decls:30,vars:13,consts:[["headerTitle","Not in POS","textButton","Search","description","SKU sold in Marketplace but not exist in DEALPOS",3,"onSubmit"],["type","button","data-cy","scanNotInPos","class","btn btn-outline-secondary shadow rounded",3,"click",4,"ngIf"],[4,"ngIf"],[1,"fw-bold","mb-2"],["bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel","appendTo","body",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],["ng-option-tmp",""],[1,"mt-5"],[1,"fw-bold"],["name","haveSKU",1,"form-control","h-100","pt-3","rounded","mt-2",3,"ngModelChange","ngModel"],[1,"me-5",3,"value"],["type","text","name","Item_id","id","Item_id","placeholder","item id",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],["class","row",4,"ngIf"],["type","button","data-cy","scanNotInPos",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button",1,"btn","btn-success","shadow-sm","rounded","ms-3",3,"click"],[1,"fa","fa-download"],[1,"me-2"],[2,"width","18px",3,"src","alt"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onCheckBoxChange","onDescEvent","onDownload","onScan","showRedirectIcon","title","image","imageForZoom","code","description","downloadButton","channels","showCheckBox","scanButton"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row"],[1,"col-12"],[3,"total","next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){e&1&&(a(0,"mainpanel",0),C("onSubmit",function(_){return i.onSearch(_)}),a(1,"actions"),x(2,bn,3,0,"button",1)(3,In,4,1,"ng-container",2),l(),a(4,"filters")(5,"div")(6,"label",3),d(7,"Channel"),l(),a(8,"ng-select",4),F("ngModelChange",function(_){return T(i.searchFilter.ChannelID,_)||(i.searchFilter.ChannelID=_),_}),x(9,wn,3,3,"ng-template",5),l()(),a(10,"div",6)(11,"label",7),d(12,"SKU Assigned"),l(),a(13,"mat-radio-group",8),F("ngModelChange",function(_){return T(i.searchFilter.HaveSku,_)||(i.searchFilter.HaveSku=_),_}),a(14,"mat-radio-button",9),d(15," All "),l(),a(16,"mat-radio-button",9),d(17," Yes "),l(),a(18,"mat-radio-button",9),d(19," No "),l()()(),a(20,"div",6)(21,"label",7),d(22,"Item ID"),l(),a(23,"input",10),F("ngModelChange",function(_){return T(i.searchFilter.Item_id,_)||(i.searchFilter.Item_id=_),_}),l()()(),a(24,"content")(25,"div",11)(26,"div",12),x(27,yn,2,13,"div",13)(28,Mn,3,0,"ng-container",2),l(),x(29,Dn,3,4,"div",14),l()()()),e&2&&(c(2),s("ngIf",!i.productService.hasSelection(i.products)),c(),s("ngIf",i.productService.hasSelection(i.products)),c(5),s("clearable",!0)("items",i.channelOptions),O("ngModel",i.searchFilter.ChannelID),c(5),O("ngModel",i.searchFilter.HaveSku),c(),s("value",0),c(2),s("value",1),c(2),s("value",2),c(5),O("ngModel",i.searchFilter.Item_id),c(4),s("ngForOf",i.products),c(),s("ngIf",i.products.length==0),c(),s("ngIf",(i.products==null?null:i.products.length)>0))},dependencies:[k,A,ot,U,L,B,Y,rt,le,ce,z,q,$],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.itemTitle[_ngcontent-%COMP%]{cursor:pointer}"]});let o=r;return o})();function On(o,r){if(o&1&&(a(0,"span",9),g(1,"img",10),l(),d(2)),o&2){let n=r.item,t=p();c(),s("src",t.getChannelLogo(n.TypeID),D),c(),I(" ",n.Name," ")}}function Tn(o,r){if(o&1&&(a(0,"div",11),g(1,"app-duplicate-product-card",12),l()),o&2){let n=r.$implicit,t=r.index;c(),s("imageForZoom",n.ImageUrl)("title",n.Name)("code",n.Code)("id",t)("image",n.ThumbnailURL)("channels",n.Channels)}}function Fn(o,r){o&1&&(P(0),a(1,"div",13),g(2,"app-empty-state"),l(),b())}function En(o,r){if(o&1){let n=v();P(0),a(1,"div",14)(2,"div",15)(3,"app-custom-paginator",16),C("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())})("total",function(){m(n);let e=p();return u(e.getRowCount())}),l()()(),b()}if(o&2){let n=p();c(3),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",n.hasClickedRowCount)}}var Fe=(()=>{let r=class r{constructor(t,e,i){this.httpService=t,this.productService=e,this.authService=i,this.searchFilter=new Z,this.products=[],this.hasClickedRowCount=!1,this.getPageLoader(),this.channelOptions=i.getChannels()}getPageLoader(){this.productService.loader().subscribe(t=>{this.searchFilter=t.Filter,this.searchFilter.PageSize=t.Filter.RowCount,this.getProducts()})}getProducts(){let t={ListChannelID:this.searchFilter.ListChannelID,RowCount:this.searchFilter.RowCount,PageNumber:this.searchFilter.PageNumber,text:this.searchFilter.text};this.httpService.post("/api/product/GetDuplicateInChannel",t).subscribe(e=>{this.products=e.Data})}onSearch(t){this.searchFilter.text=t,this.hasClickedRowCount=!1,this.getProducts()}onClearFilter(){this.searchFilter.ChannelID=f.GuidEMpty}getChannelLogo(t){return f.getChannelLogoByTypeId(t)}getRowCount(){let t={text:this.searchFilter.text,ChannelID:this.searchFilter.ChannelID};this.httpService.post("/api/product/GetDuplicateInChannelRowCount",t).subscribe(e=>{this.hasClickedRowCount=!0,this.rowCount=e.Total})}};r.\u0275fac=function(e){return new(e||r)(S(K),S(j),S(R))},r.\u0275cmp=M({type:r,selectors:[["app-duplicate-sku"]],decls:14,vars:7,consts:[["headerTitle","Multiple Listing","textButton"," Search","description","SKU(s) which is listed more than one time (one to many)",3,"onSubmit"],["container",""],[1,"mb-2"],["appendTo","body","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel",1,"center-text",3,"ngModelChange","clear","multiple","clearable","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],[1,"container-fluid"],[1,"row","mt-8","mx-1"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],[4,"ngIf"],[1,"me-2"],["alt","",2,"width","18px",3,"src"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"imageForZoom","title","code","id","image","channels"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row","mt-2","justify-content-end"],[1,"col-md-12"],[3,"next","previous","total","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){e&1&&(a(0,"mainpanel",0),C("onSubmit",function(_){return i.onSearch(_)}),a(1,"filters")(2,"div",1)(3,"div")(4,"h6",2),d(5,"Channel"),l(),a(6,"ng-select",3),F("ngModelChange",function(_){return T(i.searchFilter.ListChannelID,_)||(i.searchFilter.ListChannelID=_),_}),C("clear",function(){return i.onClearFilter()}),x(7,On,3,2,"ng-template",4),l()()()(),a(8,"content")(9,"div",5)(10,"div",6),x(11,Tn,2,6,"div",7)(12,Fn,3,0,"ng-container",8),l(),x(13,En,4,4,"ng-container",8),l()()()),e&2&&(c(6),s("multiple",!0)("clearable",!0)("items",i.channelOptions),O("ngModel",i.searchFilter.ListChannelID),c(5),s("ngForOf",i.products),c(),s("ngIf",(i.products==null?null:i.products.length)==0),c(),s("ngIf",(i.products==null?null:i.products.length)>0))},dependencies:[k,A,U,L,B,Y,rt,yt,Ft,z,$]});let o=r;return o})();var kn=()=>["/menu/products/status/sold-in-channel"],Ee=o=>({ID:o}),Nn=()=>["/menu/products/status/not-in-pos"];function Vn(o,r){if(o&1&&(P(0),d(1),b()),o&2){let n=p().$implicit;c(),I(" ",n.Count," ")}}function An(o,r){if(o&1){let n=v();a(0,"span",26),C("click",function(){m(n);let e=p().$implicit,i=p(2);return u(i.getLiveProductCount(e.ID,e))}),g(1,"i",27),l()}}function Un(o,r){if(o&1){let n=v();a(0,"tr")(1,"td"),g(2,"img",17),a(3,"span",18),d(4),l()(),a(5,"td",19),x(6,Vn,2,1,"ng-container",6)(7,An,2,0,"ng-template",null,1,nt),l(),a(9,"td",19)(10,"a",20),d(11),E(12,"number"),l()(),a(13,"td",19)(14,"a",20),d(15),E(16,"number"),l()(),a(17,"td"),d(18),E(19,"date"),l(),a(20,"td")(21,"div",21)(22,"button",22),C("click",function(){let e=m(n).$implicit,i=p(2);return u(i.onScanChannel(e))}),g(23,"i",23),d(24," Scan "),l(),a(25,"button",24),C("click",function(){let e=m(n).$implicit,i=p(2);return u(i.onClearCache(e.ID))}),g(26,"i",25),d(27," Clear "),l()()()()}if(o&2){let n=r.$implicit,t=G(8),e=p(2);c(2),s("src",e.getChannelLogo(n.TypeID),D),c(2),et(n.Name),c(2),s("ngIf",n.Count!==void 0)("ngIfElse",t),c(4),s("routerLink",X(18,kn))("queryParams",pt(19,Ee,n.ID)),c(),I(" ",V(12,11,n.SoldInChannel)," "),c(3),s("routerLink",X(21,Nn))("queryParams",pt(22,Ee,n.ID)),c(),I(" ",V(16,13,n.NotInPOS)," "),c(3),I("",n.LastSync?Jt(19,15,n.LastSync,"dd MMM yyyy HH:mm"):"Never"," ")}}function Ln(o,r){if(o&1&&(P(0),a(1,"div",7)(2,"table",8)(3,"thead",9)(4,"tr",10)(5,"th"),d(6,"Channel"),l(),a(7,"th",11),d(8,"Live Product"),l(),a(9,"th",12),d(10,"Sold In Channel"),l(),a(11,"th",13),d(12,"Product Not in POS"),l(),a(13,"th",14),d(14,"Last Sync"),l(),g(15,"th",15),l()(),a(16,"tbody"),x(17,Un,28,24,"tr",16),E(18,"async"),l()()(),b()),o&2){let n,t=p();c(17),s("ngForOf",(n=V(18,1,t.channels$))==null?null:n.Data)}}function Rn(o,r){o&1&&(a(0,"div",28),g(1,"app-empty-state"),l())}var ke=(()=>{let r=class r{constructor(t,e,i,h){this.productService=t,this.toastr=e,this.dialog=i,this.authService=h,this.destroy$=new Bt,this.channelOptions=h.getChannels()}ngOnInit(){this.setObsProductStatistic()}setObsProductStatistic(){this.channels$=this.productService.getProductStatistic()}getLiveProductCount(t,e){this.productService.getTotalProductLive(t).pipe(Vt(this.destroy$)).subscribe(i=>{e.Count=i.Count})}onScanChannel(t){this.dialog.open(N,{width:"700px",data:{channelOptions:this.channelOptions,filter:{ChannelID:t.ID},disabledChannelOption:!0}}).afterClosed().pipe(y(e=>f.IsNotEmpty(e))).subscribe(e=>{this.scanAllProduct(t.ID,e)})}scanAllProduct(t,e){let i=this.productService.findChannelById(t,this.channelOptions);this.productService.scanAll(e.ChannelID,e.ScanFull,e.UpdatedProduct,e.Async).pipe(y(h=>h)).subscribe(h=>{e.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.productService.successToastrScanAllProduct(h,i,!e.UpdatedProduct),this.setObsProductStatistic())})}onClearCache(t){confirm("Are you sure you want to Clear Cache? This Process will remove your product integration to marketplace")&&this.productService.clearCacheChannel(t).pipe(Vt(this.destroy$)).subscribe(i=>{this.toastr.success("Successfully cleared cache","Success"),this.setObsProductStatistic()})}getChannelLogo(t){return f.getChannelLogoByTypeId(t)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}};r.\u0275fac=function(e){return new(e||r)(S(j),S(W),S(J),S(R))},r.\u0275cmp=M({type:r,selectors:[["app-channel-statistic"]],decls:9,vars:6,consts:[["EMPTY",""],["QUESTION",""],["headerTitle","Products Statistic",3,"hideSearchBox","hideSearchDropdown"],[1,"container-fluid"],[1,"row","mt-4"],[1,"col-md-12"],[4,"ngIf","ngIfElse"],[1,"table-responsive"],[1,"table","table-hover"],[1,"sticky-top-thead"],[1,"table-light"],[1,"text-center",2,"width","13rem"],[1,"text-center",2,"width","9rem"],[1,"text-center",2,"width","14rem"],[2,"width","10rem"],[2,"width","12rem"],[4,"ngFor","ngForOf"],[2,"width","24px","height","24px",3,"src"],[1,"ms-3"],[1,"text-center"],[3,"routerLink","queryParams"],[1,"d-flex","align-items-center","justify-content-center"],[1,"btn","btn-sm","btn-secondary","fs-6",3,"click"],[1,"fa","fa-spinner"],[1,"btn","btn-sm","btn-secondary","fs-6","ms-3",3,"click"],[1,"fa","fa-trash"],["matTooltip","Click to see total live product",1,"cursor-pointer","fs-5","text-primary",3,"click"],[1,"fa-solid","fa-circle-question","cursor"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"]],template:function(e,i){if(e&1&&(a(0,"mainpanel",2)(1,"content")(2,"div",3)(3,"div",4)(4,"div",5),x(5,Ln,19,3,"ng-container",6),E(6,"async"),x(7,Rn,2,0,"ng-template",null,0,nt),l()()()()()),e&2){let h,_=G(8);s("hideSearchBox",!0)("hideSearchDropdown",!0),c(5),s("ngIf",((h=V(6,4,i.channels$))==null||h.Data==null?null:h.Data.length)>0)("ngIfElse",_)}},dependencies:[k,A,B,Mt,It,$,xt,vt,zt]});let o=r;return o})();var Bn=[{component:Ie,path:"",children:[{path:"",redirectTo:"sold-in-channel",pathMatch:"full"},{path:"in-pos",component:Me,canActivate:[tt],data:{title:"Products in POS"}},{path:"sold-in-channel",component:De,canActivate:[tt],data:{title:"Products Sold in Channel"}},{path:"not-in-channel",component:Oe,canActivate:[tt],data:{title:"Products not in Channel"}},{path:"not-in-pos",component:Te,canActivate:[tt],data:{title:"Products not in POS"}},{path:"duplicate-sku",component:Fe,canActivate:[tt],data:{title:"Duplicate Sku in Channel"}},{path:"channel-statistic",component:ke,canActivate:[tt],data:{title:"Channel Statistic"}}]}],go=(()=>{let r=class r{};r.\u0275fac=function(e){return new(e||r)},r.\u0275mod=Wt({type:r}),r.\u0275inj=Gt({imports:[Pt,wt,oe,Dt,qt,be,se,ae,Ft,z,q,Yt.forChild(Bn),Se,Qt,ct]});let o=r;return o})();export{go as StatusModule};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as Ke}from"./chunk-JHYIHRQH.js";import{a as Fe,b as ue,c as Le,d as He,e as de,f as $e,g as he,h as We,i as q,j as pe,k as E}from"./chunk-KCDL7SWP.js";import{b as le,c as z,d as Ue}from"./chunk-FTHTFVHH.js";import{$ as b,A as Pe,B as De,Ca as H,Fc as Oe,Gc as Me,Hc as Be,I as ie,N as _e,Q as se,Qa as $,T as _,U as ae,X as U,Yc as Ne,aa as F,b as g,ba as y,c as X,ca as h,ea as xe,ec as Re,fc as je,g as Ee,h as Te,ha as L,k as M,kc as ce,l as N,m as x,n as K,q as P,r as Ce}from"./chunk-ZIZWZZ4E.js";import{a as oe,i as I}from"./chunk-GNOSNGXM.js";var ze={production:!0,version:"3.20.
|
|
1
|
+
import{e as Ke}from"./chunk-JHYIHRQH.js";import{a as Fe,b as ue,c as Le,d as He,e as de,f as $e,g as he,h as We,i as q,j as pe,k as E}from"./chunk-KCDL7SWP.js";import{b as le,c as z,d as Ue}from"./chunk-FTHTFVHH.js";import{$ as b,A as Pe,B as De,Ca as H,Fc as Oe,Gc as Me,Hc as Be,I as ie,N as _e,Q as se,Qa as $,T as _,U as ae,X as U,Yc as Ne,aa as F,b as g,ba as y,c as X,ca as h,ea as xe,ec as Re,fc as je,g as Ee,h as Te,ha as L,k as M,kc as ce,l as N,m as x,n as K,q as P,r as Ce}from"./chunk-ZIZWZZ4E.js";import{a as oe,i as I}from"./chunk-GNOSNGXM.js";var ze={production:!0,version:"3.20.3",firebaseConfig:{apiKey:"AIzaSyDnnitFXpM8TglWKNpzu4ChgF98n25Rgvw",authDomain:"auth.dealpos.com",projectId:"devops-signin",storageBucket:"devops-signin.appspot.com",messagingSenderId:"412465165194",appId:"1:412465165194:web:03d806f6b6ab6f8b460e73",measurementId:"G-MNDBRJ5XZD"},news:"https://changelog.dealpos.app/umbraco/delivery/api/v2/content?fetch=children:omni&sort=sortOrder:asc"};var pt="firebase",ft="10.12.1";q(pt,ft,"app");var G=new Re("ANGULARFIRE2_VERSION");var gt=(r,i)=>{let t=i?[i]:We(),e=[];return t.forEach(n=>{n.container.getProvider(r).instances.forEach(s=>{e.includes(s)||e.push(s)})}),e},V=class{constructor(){return gt(mt)}},mt="app-check";function fe(){}var Y=class{zone;delegate;constructor(i,t=Te){this.zone=i,this.delegate=t}now(){return this.delegate.now()}schedule(i,t,e){let n=this.zone,o=function(s){n.runGuarded(()=>{i.apply(this,[s])})};return this.delegate.schedule(o,t,e)}},ge=class{zone;task=null;constructor(i){this.zone=i}call(i,t){let e=this.unscheduleTask.bind(this);return this.task=this.zone.run(()=>Zone.current.scheduleMacroTask("firebaseZoneBlock",fe,{},fe,fe)),t.pipe(U({next:e,complete:e,error:e})).subscribe(i).add(e)}unscheduleTask(){setTimeout(()=>{this.task!=null&&this.task.state==="scheduled"&&(this.task.invoke(),this.task=null)},10)}},qe=(()=>{class r{ngZone;outsideAngular;insideAngular;constructor(t){this.ngZone=t,this.outsideAngular=t.runOutsideAngular(()=>new Y(Zone.current)),this.insideAngular=t.run(()=>new Y(Zone.current,Ee)),globalThis.\u0275AngularFireScheduler||=this}static \u0275fac=function(e){return new(e||r)(h($))};static \u0275prov=b({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function At(){let r=globalThis.\u0275AngularFireScheduler;if(!r)throw new Error(`Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using
|
|
2
2
|
provideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).`);return r}function Ve(r){return wt(At())(r)}function wt(r){return function(t){return t=t.lift(new ge(r.ngZone)),t.pipe(N(r.outsideAngular),M(r.insideAngular))}}var Ge=(()=>{let i=class i{constructor(){}getParseToken(){let e=JSON.parse(window.localStorage.getItem("user"));return this.ParseToken(e.Token.access_token)}GetRoles(){let n=this.getParseToken()["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"];return n||[]}ParseToken(e){try{let o=e.split(".")[0].replace("-","+").replace("_","/"),s=JSON.parse(window.atob(o)),c=e.split(".")[1].replace("-","+").replace("_","/"),l=JSON.parse(window.atob(c));return l.header=s,l}catch{return!1}}};i.\u0275fac=function(n){return new(n||i)},i.\u0275prov=b({token:i,factory:i.\u0275fac,providedIn:"root"});let r=i;return r})();var bt=new Map,St={activated:!1,tokenObservers:[]},It={initialized:!1,enabled:!1};function T(r){return bt.get(r)||Object.assign({},St)}function Qe(){return It}var yt="https://content-firebaseappcheck.googleapis.com/v1";var Et="exchangeDebugToken",Je={OFFSET_DURATION:5*60*1e3,RETRIAL_MIN_WAIT:30*1e3,RETRIAL_MAX_WAIT:16*60*1e3},Ao=24*60*60*1e3;var Ae=class{constructor(i,t,e,n,o){if(this.operation=i,this.retryPolicy=t,this.getWaitDuration=e,this.lowerBound=n,this.upperBound=o,this.pending=null,this.nextErrorWaitInterval=n,n>o)throw new Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}process(i){return I(this,null,function*(){this.stop();try{this.pending=new ue,this.pending.promise.catch(t=>{}),yield Tt(this.getNextRun(i)),this.pending.resolve(),yield this.pending.promise,this.pending=new ue,this.pending.promise.catch(t=>{}),yield this.operation(),this.pending.resolve(),yield this.pending.promise,this.process(!0).catch(()=>{})}catch(t){this.retryPolicy(t)?this.process(!1).catch(()=>{}):this.stop()}})}getNextRun(i){if(i)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{let t=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),t}}};function Tt(r){return new Promise(i=>{setTimeout(i,r)})}var Ct={"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.",throttled:"Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}"},R=new He("appCheck","AppCheck",Ct);function et(r){if(!T(r).activated)throw R.create("use-before-activation",{appName:r.name})}function tt(e,n){return I(this,arguments,function*({url:r,body:i},t){let o={"Content-Type":"application/json"},s=t.getImmediate({optional:!0});if(s){let f=yield s.getHeartbeatsHeader();f&&(o["X-Firebase-Client"]=f)}let a={method:"POST",body:JSON.stringify(i),headers:o},c;try{c=yield fetch(r,a)}catch(f){throw R.create("fetch-network-error",{originalErrorMessage:f?.message})}if(c.status!==200)throw R.create("fetch-status-error",{httpStatus:c.status});let l;try{l=yield c.json()}catch(f){throw R.create("fetch-parse-error",{originalErrorMessage:f?.message})}let d=l.ttl.match(/^([\d.]+)(s)$/);if(!d||!d[2]||isNaN(Number(d[1])))throw R.create("fetch-parse-error",{originalErrorMessage:`ttl field (timeToLive) is not in standard Protobuf Duration format: ${l.ttl}`});let u=Number(d[1])*1e3,p=Date.now();return{token:l.token,expireTimeMillis:p+u,issuedAtTimeMillis:p}})}function nt(r,i){let{projectId:t,appId:e,apiKey:n}=r.options;return{url:`${yt}/projects/${t}/apps/${e}:${Et}?key=${n}`,body:{debug_token:i}}}var Pt="firebase-app-check-database",Dt=1,we="firebase-app-check-store";var Q=null;function _t(){return Q||(Q=new Promise((r,i)=>{try{let t=indexedDB.open(Pt,Dt);t.onsuccess=e=>{r(e.target.result)},t.onerror=e=>{var n;i(R.create("storage-open",{originalErrorMessage:(n=e.target.error)===null||n===void 0?void 0:n.message}))},t.onupgradeneeded=e=>{let n=e.target.result;switch(e.oldVersion){case 0:n.createObjectStore(we,{keyPath:"compositeKey"})}}}catch(t){i(R.create("storage-open",{originalErrorMessage:t?.message}))}}),Q)}function xt(r,i){return Rt(jt(r),i)}function Rt(r,i){return I(this,null,function*(){let e=(yield _t()).transaction(we,"readwrite"),o=e.objectStore(we).put({compositeKey:r,value:i});return new Promise((s,a)=>{o.onsuccess=c=>{s()},e.onerror=c=>{var l;a(R.create("storage-set",{originalErrorMessage:(l=c.target.error)===null||l===void 0?void 0:l.message}))}})})}function jt(r){return`${r.options.appId}-${r.name}`}var ke=new $e("@firebase/app-check");function me(r,i){return Le()?xt(r,i).catch(t=>{ke.warn(`Failed to write token to IndexedDB. Error: ${t}`)}):Promise.resolve()}function rt(){return Qe().enabled}function ot(){return I(this,null,function*(){let r=Qe();if(r.enabled&&r.token)return r.token.promise;throw Error(`
|
|
3
3
|
Can't get debug token in production mode.
|
|
4
4
|
`)})}var Ot={error:"UNKNOWN_ERROR"};function Mt(r){return Fe.encodeString(JSON.stringify(r),!1)}function ve(r,i=!1){return I(this,null,function*(){let t=r.app;et(t);let e=T(t),n=e.token,o;if(n&&!J(n)&&(e.token=void 0,n=void 0),!n){let c=yield e.cachedTokenPromise;c&&(J(c)?n=c:yield me(t,void 0))}if(!i&&n&&J(n))return{token:n.token};let s=!1;if(rt()){e.exchangeTokenPromise||(e.exchangeTokenPromise=tt(nt(t,yield ot()),r.heartbeatServiceProvider).finally(()=>{e.exchangeTokenPromise=void 0}),s=!0);let c=yield e.exchangeTokenPromise;return yield me(t,c),e.token=c,{token:c.token}}try{e.exchangeTokenPromise||(e.exchangeTokenPromise=e.provider.getToken().finally(()=>{e.exchangeTokenPromise=void 0}),s=!0),n=yield T(t).exchangeTokenPromise}catch(c){c.code==="appCheck/throttled"?ke.warn(c.message):ke.error(c),o=c}let a;return n?o?J(n)?a={token:n.token,internalError:o}:a=Xe(o):(a={token:n.token},e.token=n,yield me(t,n)):a=Xe(o),s&&Lt(t,a),a})}function Bt(r){return I(this,null,function*(){let i=r.app;et(i);let{provider:t}=T(i);if(rt()){let e=yield ot(),{token:n}=yield tt(nt(i,e),r.heartbeatServiceProvider);return{token:n}}else{let{token:e}=yield t.getToken();return{token:e}}})}function Nt(r,i,t,e){let{app:n}=r,o=T(n),s={next:t,error:e,type:i};if(o.tokenObservers=[...o.tokenObservers,s],o.token&&J(o.token)){let a=o.token;Promise.resolve().then(()=>{t({token:a.token}),Ze(r)}).catch(()=>{})}o.cachedTokenPromise.then(()=>Ze(r))}function it(r,i){let t=T(r),e=t.tokenObservers.filter(n=>n.next!==i);e.length===0&&t.tokenRefresher&&t.tokenRefresher.isRunning()&&t.tokenRefresher.stop(),t.tokenObservers=e}function Ze(r){let{app:i}=r,t=T(i),e=t.tokenRefresher;e||(e=Ft(r),t.tokenRefresher=e),!e.isRunning()&&t.isTokenAutoRefreshEnabled&&e.start()}function Ft(r){let{app:i}=r;return new Ae(()=>I(this,null,function*(){let t=T(i),e;if(t.token?e=yield ve(r,!0):e=yield ve(r),e.error)throw e.error;if(e.internalError)throw e.internalError}),()=>!0,()=>{let t=T(i);if(t.token){let e=t.token.issuedAtTimeMillis+(t.token.expireTimeMillis-t.token.issuedAtTimeMillis)*.5+3e5,n=t.token.expireTimeMillis-5*60*1e3;return e=Math.min(e,n),Math.max(0,e-Date.now())}else return 0},Je.RETRIAL_MIN_WAIT,Je.RETRIAL_MAX_WAIT)}function Lt(r,i){let t=T(r).tokenObservers;for(let e of t)try{e.type==="EXTERNAL"&&i.error!=null?e.error(i.error):e.next(i)}catch{}}function J(r){return r.expireTimeMillis-Date.now()>0}function Xe(r){return{token:Mt(Ot),error:r}}var be=class{constructor(i,t){this.app=i,this.heartbeatServiceProvider=t}_delete(){let{tokenObservers:i}=T(this.app);for(let t of i)it(this.app,t.next);return Promise.resolve()}};function Ht(r,i){return new be(r,i)}function $t(r){return{getToken:i=>ve(r,i),getLimitedUseToken:()=>Bt(r),addTokenListener:i=>Nt(r,"INTERNAL",i),removeTokenListener:i=>it(r.app,i)}}var Wt="@firebase/app-check",Kt="0.8.4";var Ut="app-check",Ye="app-check-internal";function zt(){he(new de(Ut,r=>{let i=r.getProvider("app").getImmediate(),t=r.getProvider("heartbeat");return Ht(i,t)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((r,i,t)=>{r.getProvider(Ye).initialize()})),he(new de(Ye,r=>{let i=r.getProvider("app-check").getImmediate();return $t(i)},"PUBLIC").setInstantiationMode("EXPLICIT")),q(Wt,Kt)}zt();var qt=["localhost","0.0.0.0","127.0.0.1"],Do=typeof window<"u"&&qt.includes(window.location.hostname);var Gt="firebase",Jt="10.12.1";E.registerVersion(Gt,Jt,"app-compat");var Zt=["ngOnDestroy"],at=(r,i,t,e={})=>new Proxy(r,{get:(n,o)=>t.runOutsideAngular(()=>{if(r[o])return e?.spy?.get&&e.spy.get(o,r[o]),r[o];if(Zt.indexOf(o)>-1)return()=>{};let s=i.toPromise().then(a=>{let c=a?.[o];return typeof c=="function"?c.bind(a):c?.then?c.then(l=>t.run(()=>l)):t.run(()=>c)});return new Proxy(()=>{},{get:(a,c)=>s[c],apply:(a,c,l)=>s.then(d=>{let u=d?.(...l);return e?.spy?.apply&&e.spy.apply(o,l,u),u})})})});var ee=class{constructor(i){return i}},te=new y("angularfire2.app.options"),ne=new y("angularfire2.app.name");function Se(r,i,t){let e=typeof t=="string"&&t||"[DEFAULT]",n=typeof t=="object"&&t||{};n.name=n.name||e;let s=E.apps.filter(a=>a&&a.name===n.name)[0]||i.runOutsideAngular(()=>E.initializeApp(r,n));try{if(JSON.stringify(r)!==JSON.stringify(s.options)){let a=!!module.hot;Xt("error",`${s.name} Firebase App already initialized with different options${a?", you may need to reload as Firebase is not HMR aware.":"."}`)}}catch{}return new ee(s)}var Xt=(r,...i)=>{ce()&&typeof console<"u"&&console[r](...i)},Yt={provide:ee,useFactory:Se,deps:[te,$,[new xe,ne]]},Ho=(()=>{class r{static initializeApp(t,e){return{ngModule:r,providers:[{provide:te,useValue:t},{provide:ne,useValue:e}]}}constructor(t){E.registerVersion("angularfire",G.full,"core"),E.registerVersion("angularfire",G.full,"app-compat"),E.registerVersion("angular",je.full,t.toString())}static \u0275fac=function(e){return new(e||r)(h(H))};static \u0275mod=L({type:r});static \u0275inj=F({providers:[Yt]})}return r})();function ct(r,i,t,e,n){let[,o,s]=globalThis.\u0275AngularfireInstanceCache.find(a=>a[0]===r)||[];if(o)return Qt(n,s)||(st("error",`${i} was already initialized on the ${t} Firebase App with different settings.${en?" You may need to reload as Firebase is not HMR aware.":""}`),st("warn",{is:n,was:s})),o;{let a=e();return globalThis.\u0275AngularfireInstanceCache.push([r,a,n]),a}}function Qt(r,i){try{return r.toString()===i.toString()}catch{return r===i}}var en=typeof module<"u"&&!!module.hot,st=(r,...i)=>{ce()&&typeof console<"u"&&console[r](...i)};globalThis.\u0275AngularfireInstanceCache||=[];var tn=new y("angularfire2.auth.use-emulator"),nn=new y("angularfire2.auth.settings"),rn=new y("angularfire2.auth.tenant-id"),on=new y("angularfire2.auth.langugage-code"),sn=new y("angularfire2.auth.use-device-language"),an=new y("angularfire.auth.persistence"),cn=(r,i,t,e,n,o,s,a)=>ct(`${r.name}.auth`,"AngularFireAuth",r.name,()=>{let c=i.runOutsideAngular(()=>r.auth());if(t&&c.useEmulator(...t),e&&(c.tenantId=e),c.languageCode=n,o&&c.useDeviceLanguage(),s)for(let[l,d]of Object.entries(s))c.settings[l]=d;return a&&c.setPersistence(a),c},[t,e,n,o,s,a]),Ie=(()=>{class r{authState;idToken;user;idTokenResult;credential;constructor(t,e,n,o,s,a,c,l,d,u,p,f){let W=new X,j=K(void 0).pipe(M(s.outsideAngular),_(()=>o.runOutsideAngular(()=>import("./chunk-F4WIW6HA.js"))),P(()=>Se(t,o,e)),P(C=>cn(C,o,a,l,d,u,c,p)),se({bufferSize:1,refCount:!1}));if(Be(n))this.authState=this.user=this.idToken=this.idTokenResult=this.credential=K(null);else{j.pipe(_e()).subscribe();let C=j.pipe(_(A=>A.getRedirectResult().then(D=>D,()=>null)),Ve,se({bufferSize:1,refCount:!1})),Z=j.pipe(_(A=>new g(D=>({unsubscribe:o.runOutsideAngular(()=>A.onAuthStateChanged(O=>D.next(O),O=>D.error(O),()=>D.complete()))})))),re=j.pipe(_(A=>new g(D=>({unsubscribe:o.runOutsideAngular(()=>A.onIdTokenChanged(O=>D.next(O),O=>D.error(O),()=>D.complete()))}))));this.authState=C.pipe(ae(Z),N(s.outsideAngular),M(s.insideAngular)),this.user=C.pipe(ae(re),N(s.outsideAngular),M(s.insideAngular)),this.idToken=this.user.pipe(_(A=>A?x(A.getIdToken()):K(null))),this.idTokenResult=this.user.pipe(_(A=>A?x(A.getIdTokenResult()):K(null))),this.credential=Pe(C,W,this.authState.pipe(De(A=>!A))).pipe(P(A=>A?.user?A:null),N(s.outsideAngular),M(s.insideAngular))}return at(this,j,o,{spy:{apply:(C,Z,re)=>{(C.startsWith("signIn")||C.startsWith("createUser"))&&re.then(A=>W.next(A))}}})}static \u0275fac=function(e){return new(e||r)(h(te),h(ne,8),h(H),h($),h(qe),h(tn,8),h(nn,8),h(rn,8),h(on,8),h(sn,8),h(an,8),h(V,8))};static \u0275prov=b({token:r,factory:r.\u0275fac,providedIn:"any"})}return r})(),ti=(()=>{class r{constructor(){E.registerVersion("angularfire",G.full,"auth-compat")}static \u0275fac=function(e){return new(e||r)};static \u0275mod=L({type:r});static \u0275inj=F({providers:[Ie]})}return r})();function m(r,i,t,e){return new Promise((n,o)=>{r||o("IndexedDB not available");let s=r.open(i,t),a;s.onsuccess=c=>{a=s.result,n(a)},s.onerror=c=>{o(`IndexedDB error: ${s.error}`)},typeof e=="function"&&(s.onupgradeneeded=c=>{e(c,a)})})}function lt(r,i,t,e,n){if(!r)return;let o=r.open(i,t);o.onupgradeneeded=s=>{let a=s.target.result;e.forEach(l=>{if(!a.objectStoreNames.contains(l.store)){let d=a.createObjectStore(l.store,l.storeConfig);l.storeSchema.forEach(u=>{d.createIndex(u.name,u.keypath,u.options)})}});let c=n&&n();c&&Object.keys(c).map(l=>parseInt(l,10)).filter(l=>l>s.oldVersion).sort((l,d)=>l-d).forEach(l=>{c[l](a,o.transaction)}),a.close()},o.onsuccess=s=>{s.target.result.close()}}function un(r,i,t){if(!r||!i||!t)throw Error('Params: "dbName", "version", "storeName" are mandatory.');return new g(e=>{try{let n=i+1,o=indexedDB.open(r,n);o.onupgradeneeded=s=>{let a=s.target.result;a.deleteObjectStore(t),a.close(),console.log("onupgradeneeded"),e.next(!0),e.complete()},o.onerror=s=>e.error(s)}catch(n){e.error(n)}})}function dn(r,i){return r.objectStoreNames.contains(i)}function S(r,i,t){r||t("You need to use the openDatabase function to create a database before you query it!"),dn(r,i)||t(`objectStore does not exists: ${i}`)}function k(r,i){let t=r.transaction(i.storeName,i.dbMode);return t.onerror=i.error,t.onabort=i.abort,t}function v(r,i,t,e){return{storeName:i,dbMode:r,error:n=>{t(n)},abort:n=>{t(n)}}}var w=function(r){return r.readonly="readonly",r.readwrite="readwrite",r}(w||{}),ut=new y(null),ye=(()=>{class r{constructor(t,e){if(this.dbConfig=t,this.platformId=e,!t.name)throw new Error("NgxIndexedDB: Please, provide the dbName in the configuration");if(!t.version)throw new Error("NgxIndexedDB: Please, provide the db version in the configuration");this.isBrowser=Me(this.platformId),this.isBrowser&&(this.indexedDB=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,lt(this.indexedDB,t.name,t.version,t.objectStoresMeta,t.migrationFactory),m(this.indexedDB,t.name).then(n=>{n.version!==t.version&&(this.dbConfig.version=n.version)}))}createObjectStore(t,e){let n=[t];lt(this.indexedDB,this.dbConfig.name,++this.dbConfig.version,n,e)}add(t,e,n){return new g(o=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(s=>{let c=k(s,v(w.readwrite,t,d=>o.error(d))).objectStore(t),l=n?c.add(e,n):c.add(e);l.onsuccess=d=>I(this,null,function*(){let u=d.target.result,p=c.get(u);p.onsuccess=f=>{o.next(f.target.result),o.complete()}})}).catch(s=>o.error(s))})}bulkAdd(t,e){let n=new Promise((o,s)=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(a=>{let l=k(a,v(w.readwrite,t,o,s)).objectStore(t),d=e.map(u=>new Promise((p,f)=>{let W=u.key;delete u.key;let j=W?l.add(u,W):l.add(u);j.onsuccess=C=>{let Z=C.target.result;p(Z)}}));o(Promise.all(d))}).catch(a=>s(a))});return x(n)}bulkDelete(t,e){let n=e.map(o=>new Promise((s,a)=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(c=>{let l=k(c,v(w.readwrite,t,a,s));l.objectStore(t).delete(o),l.oncomplete=()=>{this.getAll(t).pipe(ie(1)).subscribe(u=>{s(u)})}}).catch(c=>a(c))}));return x(Promise.all(n))}getByKey(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(o=>{let c=k(o,v(w.readonly,t,n.error)).objectStore(t).get(e);c.onsuccess=l=>{n.next(l.target.result),n.complete()},c.onerror=l=>{n.error(l)}}).catch(o=>n.error(o))})}bulkGet(t,e){let n=e.map(o=>this.getByKey(t,o));return new g(o=>{Ce(n).subscribe(s=>{o.next(s),o.complete()})})}getByID(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(o=>{S(o,t,l=>n.error(l));let c=k(o,v(w.readonly,t,n.error,n.next)).objectStore(t).get(e);c.onsuccess=l=>{n.next(l.target.result)}}).catch(o=>n.error(o))})}getByIndex(t,e,n){return new g(o=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(s=>{S(s,t,u=>o.error(u));let d=k(s,v(w.readonly,t,o.error)).objectStore(t).index(e).get(n);d.onsuccess=u=>{o.next(u.target.result),o.complete()}}).catch(s=>o.error(s))})}getAll(t){return new g(e=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(n=>{S(n,t,c=>e.error(c));let a=k(n,v(w.readonly,t,e.error,e.next)).objectStore(t).getAll();a.onerror=c=>{e.error(c)},a.onsuccess=({target:{result:c}})=>{e.next(c),e.complete()}}).catch(n=>e.error(n))})}update(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(o=>{S(o,t,l=>n.error(l));let a=k(o,v(w.readwrite,t,l=>n.error(l))).objectStore(t),c=a.put(e);c.onsuccess=l=>I(this,null,function*(){let d=l.target.result,u=a.get(d);u.onsuccess=p=>{n.next(p.target.result),n.complete()}})}).catch(o=>n.error(o))})}delete(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(o=>{S(o,t,c=>n.error(c));let s=k(o,v(w.readwrite,t,c=>n.error(c)));s.objectStore(t).delete(e),s.oncomplete=()=>{this.getAll(t).pipe(ie(1)).subscribe(c=>{n.next(c),n.complete()})}}).catch(o=>n.error(o))})}deleteByKey(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(o=>{S(o,t,c=>n.error(c));let s=k(o,v(w.readwrite,t,c=>n.error(c))),a=s.objectStore(t);s.oncomplete=()=>{n.next(!0),n.complete()},a.delete(e)}).catch(o=>n.error(o))})}clear(t){return new g(e=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(n=>{S(n,t,a=>e.error(a));let o=k(n,v(w.readwrite,t,a=>e.error(a)));o.objectStore(t).clear(),o.oncomplete=()=>{e.next(!0),e.complete()}}).catch(n=>e.error(n))})}deleteDatabase(){return new g(t=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(e=>I(this,null,function*(){yield e.close();let n=this.indexedDB.deleteDatabase(this.dbConfig.name);n.onsuccess=()=>{t.next(!0),t.complete()},n.onerror=o=>t.error(o),n.onblocked=()=>{throw new Error("Unable to delete database because it's blocked")}})).catch(e=>t.error(e))})}openCursor(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(o=>{S(o,t,l=>n.error(l));let a=k(o,v(w.readonly,t,n.error)).objectStore(t),c=e===void 0?a.openCursor():a.openCursor(e);c.onsuccess=l=>{n.next(l),n.complete()}}).catch(o=>n.error(o))})}openCursorByIndex(t,e,n,o=w.readonly){let s=new X;return m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(a=>{S(a,t,p=>{s.error(p)});let u=k(a,v(o,t,p=>{s.error(p)},()=>{s.next()})).objectStore(t).index(e).openCursor(n);u.onsuccess=p=>{s.next(p)}}).catch(a=>s.error(a)),s}getAllByIndex(t,e,n){let o=[];return new g(s=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(a=>{S(a,t,p=>s.error(p));let u=k(a,v(w.readonly,t,s.error)).objectStore(t).index(e).openCursor(n);u.onsuccess=p=>{let f=p.target.result;f?(o.push(f.value),f.continue()):(s.next(o),s.complete())}}).catch(a=>s.error(a))})}getAllKeysByIndex(t,e,n){let o=[];return new g(s=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(a=>{S(a,t,p=>s.error(p));let u=k(a,v(w.readonly,t,s.error)).objectStore(t).index(e).openKeyCursor(n);u.onsuccess=p=>{let f=p.target.result;f?(o.push({primaryKey:f.primaryKey,key:f.key}),f.continue()):(s.next(o),s.complete())}}).catch(a=>s.error(a))})}count(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(o=>{S(o,t,l=>n.error(l));let c=k(o,v(w.readonly,t,n.error)).objectStore(t).count(e);c.onerror=l=>n.error(l),c.onsuccess=l=>{n.next(l.target.result),n.complete()}}).catch(o=>n.error(o))})}countByIndex(t,e,n){return new g(o=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(s=>{S(s,t,u=>o.error(u));let d=k(s,v(w.readonly,t,o.error)).objectStore(t).index(e).count(n);d.onerror=u=>o.error(u),d.onsuccess=u=>{o.next(u.target.result),o.complete()}}).catch(s=>o.error(s))})}deleteObjectStore(t){return un(this.dbConfig.name,++this.dbConfig.version,t)}}return r.\u0275fac=function(t){return new(t||r)(h(ut),h(H))},r.\u0275prov=b({token:r,factory:r.\u0275fac}),r})(),li=(()=>{class r{static forRoot(t){return{ngModule:r,providers:[ye,{provide:ut,useValue:t}]}}}return r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=L({type:r}),r.\u0275inj=F({imports:[[Oe]]}),r})();var dt=(()=>{let i=class i{constructor(e){this.db=e,this.DATABASE="Categories"}saveCategoriesByChannelType(e,n){let o=this.getKey(n);return this.db.add(this.DATABASE,e,o).pipe(P(s=>e))}getCategoriesByChannelType(e){let n=this.getKey(e);return this.db.getByKey(this.DATABASE,n)}getKey(e){let n="";switch(e){case le.Lazada:n="Lazada";break;case le.Tokopedia:n="Tokopedia";break}return n}clearDatabase(){this.db.clear(this.DATABASE)}getHostName(){let e=localStorage.getItem("Authorization");return this.hostName=JSON.parse(e)?.Host,this.hostName}};i.\u0275fac=function(n){return new(n||i)(h(ye))},i.\u0275prov=b({token:i,factory:i.\u0275fac,providedIn:"root"});let r=i;return r})();var ht=(()=>{let i=class i{constructor(){}inititalizeIntercom(){let e=this.getFromLocalStorage();e?.Enabled&&window.Intercom("boot",{app_id:"xv1oomgl",name:e.Name,email:e.Email,created_at:e.Created,user_hash:e.Hash})}shutdown(){this.getFromLocalStorage()?.Enabled&&(window.Intercom("shutdown"),this.clearStorage())}clearStorage(){localStorage.removeItem("Intercom")}updateLocalStorage(e){let n={Enabled:!0};e&&(n=oe(oe({},n),e)),localStorage.setItem("Intercom",JSON.stringify(n))}getFromLocalStorage(){let e=localStorage.getItem("Intercom");return JSON.parse(e)}hideLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(window.Intercom("update",{app_id:"xv1oomgl",hide_default_launcher:!0}),e.hide_default_launcher=!0,this.updateLocalStorage(e))}showLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(window.Intercom("update",{app_id:"xv1oomgl",hide_default_launcher:!1}),e.hide_default_launcher=!1,this.updateLocalStorage(e))}isHideLauncher(){let e=this.getFromLocalStorage();return z.IsEmpty(e?.hide_default_launcher)?!1:e?.hide_default_launcher}};i.\u0275fac=function(n){return new(n||i)},i.\u0275prov=b({token:i,factory:i.\u0275fac,providedIn:"root"});let r=i;return r})();var Si=(()=>{let i=class i{constructor(e,n,o,s,a,c,l){this.httpService=e,this.tokenDecodeService=n,this.afAuth=o,this.ngxPermission=s,this.localDataService=a,this.router=c,this.intercomService=l,this.channels=[]}login(e){return this.httpService.post("/api/token/Login",e).pipe(U(n=>{this.setLocalStorage(n,e.Host,e.Username),this.loadPermissions()}))}getNews(){return this.httpService.get(ze.news).pipe(P(e=>e?.items?.map(n=>n?.properties)))}loginWithGoogle(e,n){e.preventDefault();let o=new pe;return o.setCustomParameters({prompt:"select_account"}),x(this.afAuth.signInWithPopup(o)).pipe(P(s=>s.credential),P(s=>s.idToken),_(s=>this.httpService.post("/api/token/LoginWithSocialProvider",JSON.stringify({IDToken:s,Host:n}))),U(s=>{this.setLocalStorage(s,n,null),this.loadPermissions()}))}setLocalStorage(e,n,o){localStorage.setItem("user",JSON.stringify(e)),localStorage.setItem("Authorization",JSON.stringify({Host:n,username:o})),localStorage.setItem("channels",JSON.stringify(e.Channels)),this.intercomService.updateLocalStorage(e.IntercomWidget),this.intercomService.inititalizeIntercom()}loadPermissions(){this.ngxPermission.loadPermissions([]);let e=localStorage.getItem("user");if(z.IsNotEmpty(e)){let n=this.tokenDecodeService.GetRoles();this.ngxPermission.loadPermissions(n)}}getChannels(){let e=JSON.parse(JSON.stringify(this.channels));if(this.channels.length===0){let n=localStorage.getItem("channels");n?(this.channels=JSON.parse(n),e=JSON.parse(JSON.stringify(this.channels))):(this.channels=[],e=[])}return e=this.setChannelLogo(e),e}setChannelLogo(e){return e=e.map(n=>(n.Img=z.getChannelLogoByTypeId(n.TypeID),n)),e}logout(){this.clearLocalStorage(),this.ngxPermission.flushPermissions()}isActiveToken(){let e=JSON.parse(window.localStorage.getItem("user")),n=new Date;if(e!=null){let o=new Date(e.Token.expiredAt);return n<o?!0:(this.clearLocalStorage(),!1)}else return!1}getDomain(){if(!this.domain){let e=localStorage.getItem("Authorization");this.domain="https://"+JSON.parse(e).Host}return this.domain}clearLocalStorage(){this.domain=null,this.channels=[],localStorage.removeItem("channels"),localStorage.removeItem("user"),this.intercomService.shutdown(),this.localDataService.clearDatabase(),this.router.navigate([""])}};i.\u0275fac=function(n){return new(n||i)(h(Ke),h(Ge),h(Ie),h(Ue),h(dt),h(Ne),h(ht))},i.\u0275prov=b({token:i,factory:i.\u0275fac,providedIn:"root"});let r=i;return r})();export{ze as a,Ge as b,Ho as c,ti as d,li as e,dt as f,Si as g};
|