marketplacepos 3.11.7 → 3.11.9
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-NQ3TJQ5O.js → chunk-2ANKQQV3.js} +1 -1
- package/Marketplace/{chunk-ZU7YBWGM.js → chunk-33GGGAPS.js} +1 -1
- package/Marketplace/{chunk-L4Q4FQFW.js → chunk-BP2CJXCZ.js} +1 -1
- package/Marketplace/{chunk-UUPUVGXL.js → chunk-CDTB3FEI.js} +1 -1
- package/Marketplace/{chunk-PTYBFE3S.js → chunk-FNAAZA3R.js} +1 -1
- package/Marketplace/{chunk-LHJXLBHB.js → chunk-G4YKNFZZ.js} +1 -1
- package/Marketplace/{chunk-T4Y427M7.js → chunk-JDGPUKXR.js} +1 -1
- package/Marketplace/{chunk-JJ4ZOCSD.js → chunk-KJJM4QBN.js} +1 -1
- package/Marketplace/{chunk-XJNFT56V.js → chunk-OFMNMKMG.js} +1 -1
- package/Marketplace/{chunk-WVXTWIP3.js → chunk-QKSDQVPL.js} +1 -1
- package/Marketplace/{chunk-QBA3X367.js → chunk-QWNDYA65.js} +1 -1
- package/Marketplace/{chunk-THNYE3KI.js → chunk-RKJINSSM.js} +1 -1
- package/Marketplace/{chunk-7TDQZKQC.js → chunk-RZKKTX4V.js} +1 -1
- package/Marketplace/{chunk-CDAAQO6A.js → chunk-SMRE36YG.js} +1 -1
- package/Marketplace/{chunk-QBVEDLRG.js → chunk-UCO4GNIH.js} +1 -1
- package/Marketplace/{chunk-LHLYIKEW.js → chunk-YHEEVSLX.js} +1 -1
- package/Marketplace/{chunk-5OSUE6B3.js → chunk-YNKSRONN.js} +1 -1
- package/Marketplace/{chunk-H5P5BX43.js → chunk-ZHG47R5T.js} +1 -1
- package/Marketplace/{chunk-7QECCYLR.js → chunk-ZLBTBS3M.js} +1 -1
- package/Marketplace/index.html +2 -2
- package/Marketplace/{main-MFYZJGET.js → main-YOSC4DEC.js} +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as xe,b as Oe}from"./chunk-G5LCLRIW.js";import{a as Ee}from"./chunk-5ZUWMFL5.js";import{g as we}from"./chunk-DT3B54LD.js";import{d as ve,e as Me}from"./chunk-AL67KXJV.js";import{f as Ie}from"./chunk-7QECCYLR.js";import{b as _e,e as ye}from"./chunk-K3G6FMDF.js";import{A as E,q as j,s as x,t as O,z as w}from"./chunk-ZKBLXGXT.js";import{U as De}from"./chunk-6B64VOO7.js";import{b as be,h as B,k as R,u as Te}from"./chunk-SP6QPE3M.js";import{b as p,c as y}from"./chunk-6F6NSBIF.js";import{$ as se,Ab as c,B as oe,Bb as b,Cb as T,Eb as P,Fb as V,Gb as N,H as le,Ha as M,Ia as s,Ja as f,K as re,Kb as me,Rb as $,Sb as Z,T as J,Tb as he,Ub as K,V as H,Wa as u,Xa as X,Xc as Se,Ya as d,Za as pe,aa as de,c as W,ca as q,fb as l,gb as r,ha as S,hb as _,ia as ce,ib as U,ic as fe,jb as F,kc as D,lb as k,lc as A,n as ie,ob as g,pa as I,pc as ge,q as ae,qa as v,qb as h,rc as ue,sc as Ce,za as Q,zb as G}from"./chunk-6DRNAUKE.js";function Le(o,n){if(o&1&&(l(0,"mat-option",9)(1,"div",10),_(2,"img",11),l(3,"span"),c(4),r()()()),o&2){let i=n.$implicit;d("value",i.ID)("disabled",i.disabled),s(),d("matTooltip",i.disabled?"Single Product Scan disabled for this type of Channel":null),s(),d("src",i.Img,M),s(2),b(i.Name)}}function Ue(o,n){if(o&1){let i=k();l(0,"div",12)(1,"label",13),c(2,"Scan Type"),r(),l(3,"mat-radio-group",14),N("ngModelChange",function(e){I(i);let a=h();return V(a.filter.ScanFull,e)||(a.filter.ScanFull=e),v(e)}),l(4,"mat-radio-button",15),c(5," Full (Include Inactive Products) "),r(),l(6,"mat-radio-button",16),c(7," Active "),r()()()}if(o&2){let i=h();s(3),P("ngModel",i.filter.ScanFull),s(),d("value",!0),s(2),d("value",!1)}}function Fe(o,n){if(o&1){let i=k();l(0,"div",17)(1,"label",3),c(2),$(3,"date"),r(),l(4,"mat-radio-group",18),N("ngModelChange",function(e){I(i);let a=h();return V(a.filter.UpdatedProduct,e)||(a.filter.UpdatedProduct=e),v(e)}),l(5,"mat-radio-button",19),c(6," Scan All Products "),r(),l(7,"mat-radio-button",20),c(8),r()()()}if(o&2){let i=h();s(2),T(" Last Scan: ",he(3,6,i.selectedChannel.LastSync,"dd MMMM yyyy HH:mm")," "),s(2),P("ngModel",i.filter.UpdatedProduct),s(),d("value",!1),s(2),d("value",!0)("matTooltip",i.selectedChannel.TypeID==i.channelType.Tokopedia?"Use Tokopedia URL for mapping SKU between POS and Tokopedia":"Scan only products that have been updated since the last channel scan"),s(),T(" ",i.selectedChannel.TypeID==i.channelType.Tokopedia?"Product Download By URL":"Scan Updated Products"," ")}}function Ae(o,n){if(o&1){let i=k();l(0,"div",17)(1,"label",3),c(2," Scan Option "),r(),l(3,"mat-radio-group",21),N("ngModelChange",function(e){I(i);let a=h();return V(a.filter.Async,e)||(a.filter.Async=e),v(e)}),l(4,"mat-radio-button",22),c(5," Asynchronous (Get Notified when Complete) "),r(),l(6,"mat-radio-button",23),c(7," Synchronous (Wait until Complete) "),r()()()}if(o&2){let i=h();s(3),P("ngModel",i.filter.Async),s(),d("value",!0),s(2),d("value",!1)}}var rt=(()=>{let n=class n{constructor(t,e,a){this.dialogRef=t,this.data=e,this.router=a,this.channelType=p,this.disabledChannelOption=!1,this.filter={ChannelID:y.GuidEMpty,ScanFull:!0,UpdatedProduct:!1,Async:!1},this.isSingleChannel=y.IsNotEmpty(e.isSingleChannel)?this.data.isSingleChannel:!1,this.disabledChannelOption=y.IsEmpty(e.disabledChannelOption)?!1:this.data.disabledChannelOption}ngOnInit(){this.initChannelOptions(),this.initFilter(),this.onSelectChannel(this.data?.filter?.ChannelID),this.initModalConfig()}initModalConfig(){this.modalConfig=new w,this.modalConfig.title="Scan Marketplace",this.modalConfig.bodyScrollable=!0}initFilter(){this.filter.ChannelID=this.data?.filter?.ChannelID,this.filter.ScanFull=!1}initChannelOptions(){this.channelOptions=JSON.parse(JSON.stringify(this.data.channelOptions)),this.isSingleChannel&&(this.channelOptions=this.channelOptions.map(t=>(t.disabled=!0,(t.TypeID==p.Tiktok||t.TypeID==p.Tokopedia||t.TypeID==p.Lazada||t.TypeID==p.WooCommerce)&&(t.disabled=!1),t)).sort(t=>t.disabled?1:-1))}onSelectChannel(t){let e=this.filterChannelById(t);this.selectedChannel=e,this.filter.Async=!0,this.iniHasScanUpdate(),this.setDefaultConfigUpdate()}setDefaultConfigUpdate(){this.filter.UpdatedProduct=!1,this.selectedChannel&&y.IsNotEmpty(this.selectedChannel.LastSync)&&(this.selectedChannel.TypeID==p.Shopee||this.selectedChannel.TypeID==p.Tiktok||this.selectedChannel.TypeID==p.Lazada)&&(this.filter.UpdatedProduct=!0)}iniHasScanUpdate(){this.selectedChannel?.TypeID!=p.WooCommerce&&this.selectedChannel?.TypeID!=p.KalCare&&this.selectedChannel?.TypeID!=p.None&&y.IsNotEmpty(this.selectedChannel?.LastSync)&&!this.isSingleChannel?this.hasScanUpdate=!0:this.hasScanUpdate=!1}filterChannelById(t){let e;return this.channelOptions&&(e=this.channelOptions.find(a=>a.ID==t)),e}submit(){this.selectedChannel.TypeID==p.Tokopedia&&this.filter.UpdatedProduct?this.router.navigate(["/menu/products/download/by-url"]).then(()=>{this.dialogRef.close()}):(this.beforeSubmit(),this.dialogRef.close(this.filter))}beforeSubmit(){this.filter.UpdatedProduct&&(this.filter.Async=!1)}isNotEmpty(t){return y.IsNotEmpty(t)}onClose(){this.dialogRef.close()}};n.\u0275fac=function(e){return new(e||n)(f(x),f(O),f(Se))},n.\u0275cmp=S({type:n,selectors:[["app-scan-dialog"]],decls:11,vars:8,consts:[[3,"onOk","onClose","onCancel","dynamicValidated","config"],["content",""],[1,"mx-4"],[1,"mb-2","fw-bold"],["appearance","outline",1,"w-100"],["name","channelid","placeholder","Channel",1,"mat-select-channel",3,"ngModelChange","disabled","ngModel"],["class","channel-option",3,"value","disabled",4,"ngFor","ngForOf"],["class","mt-4",4,"ngIf"],["class","mt-8",4,"ngIf"],[1,"channel-option",3,"value","disabled"],["matTooltipPosition","above","matTooltipClass","custom-width-tooltip",3,"matTooltip"],[2,"width","18px","margin-right","10px",3,"src"],[1,"mt-4"],[1,"mb-2","fw-bold","mt-3"],["name","scanType",1,"form-control","h-100","round",3,"ngModelChange","ngModel"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Full Scan Product",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Only Active Product",1,"me-5",3,"value"],[1,"mt-8"],["name","ScanFull",1,"form-control","h-100","round",2,"line-height","2",3,"ngModelChange","ngModel"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Scan product from beginning ( use this if you haven't scanned at all)",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above",1,"me-5",3,"value","matTooltip"],["name","Async",1,"form-control","h-100","round",2,"line-height","2",3,"ngModelChange","ngModel"],["matTooltipClass","custom-width-tooltip","matTooltip","Scan is running in the background, status will be visible in the notification menu","matTooltipPosition","above",1,"me-5",3,"value"],[1,"me-5",3,"value"]],template:function(e,a){e&1&&(l(0,"modal-material",0),g("onOk",function(){return a.submit()})("onClose",function(){return a.onClose()})("onCancel",function(){return a.onClose()}),l(1,"div",1)(2,"div",2)(3,"label",3),c(4,"Select a Channel"),r(),l(5,"mat-form-field",4)(6,"mat-select",5),N("ngModelChange",function(C){return V(a.filter.ChannelID,C)||(a.filter.ChannelID=C),C}),g("ngModelChange",function(C){return a.onSelectChannel(C)}),u(7,Le,5,5,"mat-option",6),r()(),u(8,Ue,8,3,"div",7)(9,Fe,9,9,"div",8)(10,Ae,8,3,"div",8),r()()()),e&2&&(d("dynamicValidated",a.isNotEmpty(a.filter.ChannelID))("config",a.modalConfig),s(6),d("disabled",a.disabledChannelOption),P("ngModel",a.filter.ChannelID),s(),d("ngForOf",a.channelOptions),s(),d("ngIf",!a.isSingleChannel&&a.isNotEmpty(a.filter.ChannelID)),s(),d("ngIf",a.hasScanUpdate),s(),d("ngIf",!(a.filter!=null&&a.filter.UpdatedProduct)&&!a.isSingleChannel&&a.isNotEmpty(a.filter.ChannelID)))},dependencies:[D,A,B,R,xe,Oe,we,Ee,De,j,E,ge],encapsulation:2});let o=n;return o})();var L=function(o){return o.Tokopedia="https://seller.tokopedia.com",o.Shoope="https://seller.shopee.co.id",o.Tiktok="https://seller-id.tiktok.com",o.WooCommerce="https://woocommerce.dealpos.app",o.Lazada="https://sellercenter.lazada.co.id",o}(L||{});var Be=o=>({"is-disabled":o});function Re(o,n){if(o&1&&(U(0),l(1,"tr")(2,"td",11),c(3),r(),l(4,"td",11),c(5),r(),l(6,"td",12)(7,"p",13),c(8,"Product Not in Channel!"),r()()(),F()),o&2){let i=h().$implicit;s(3),T(" ",i==null?null:i.Model,""),s(2),T(" ",i==null?null:i.Code,"")}}function je(o,n){if(o&1&&(l(0,"td",11),c(1),r()),o&2){let i=h(3).$implicit;X("rowspan",i.Channel.length),s(),T(" ",i==null?null:i.Model,"")}}function We(o,n){if(o&1&&(l(0,"td",11),c(1),r()),o&2){let i=h(3).$implicit;X("rowspan",i.Channel.length),s(),T(" ",i==null?null:i.Code,"")}}function $e(o,n){if(o&1&&(l(0,"tr"),u(1,je,2,2,"td",14)(2,We,2,2,"td",14),l(3,"td",11)(4,"div",15)(5,"a",16),_(6,"img",17),r(),l(7,"div",18),c(8),r()()(),l(9,"td",11),c(10),$(11,"number"),r(),l(12,"td",19),c(13),$(14,"number"),r(),l(15,"td",19)(16,"a",20),_(17,"i",21),l(18,"span",22),c(19,"Edit"),r()()()()),o&2){let i=n.$implicit,t=n.index,e=h(3);s(),d("ngIf",t==0),s(),d("ngIf",t==0),s(3),d("href",i.Url,M)("title",i.Title),s(),d("src",e.getChannelLogo(i.TypeID),M),s(),d("matTooltip",(i==null||i.Name==null?null:i.Name.length)>55?i==null?null:i.Name:""),s(),T(" ",i.Name," "),s(2),b(Z(11,12,i.Price)),s(3),b(Z(14,14,i.Inventory)),s(3),d("href",e.getHyperlinkSellerCenter(i),M)("ngClass",me(16,Be,i.TypeID==e.channelType.KalCare))("matTooltip",i.TypeID!=e.channelType.KalCare?"Edit this product in Seller Center, inventory changes must be done via DEALPOS":"")}}function ze(o,n){if(o&1&&u(0,$e,20,18,"tr",9),o&2){let i=h().$implicit;d("ngForOf",i==null?null:i.Channel)}}function He(o,n){if(o&1&&(U(0),u(1,Re,9,2,"ng-container",10)(2,ze,1,1,"ng-template",null,0,K),F()),o&2){let i=n.$implicit,t=G(3);s(),d("ngIf",!i.Channel||i.Channel.length<1)("ngIfElse",t)}}var gt=(()=>{let n=class n{constructor(t,e){this.data=t,this.dialogRef=e,this.channelType=p,this.variants=t.variants,this.title=t.title}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new w,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}getChannelLogo(t){return y.getChannelLogoByTypeId(t)}getHyperlinkSellerCenter(t){let e="javascript:void(0)";switch(t.TypeID){case p.Shopee:e=`${L.Shoope}/portal/product/${t.ChannelItemID}`;break;case p.Tiktok:e=`${L.Tiktok}/product/edit/${t.ChannelItemID}`;break;case p.Tokopedia:e=`${L.Tokopedia}/edit-product/${t.ChannelItemID}`;break;case p.WooCommerce:e=`${L.WooCommerce}/wp-admin/post.php?post=${t.ChannelItemID}&action=edit`;break;case p.Lazada:e=`${L.Lazada}/apps/product/publish?productId=${t.ChannelItemID}`;break}return e}};n.\u0275fac=function(e){return new(e||n)(f(O),f(x))},n.\u0275cmp=S({type:n,selectors:[["app-modal-variant"]],decls:22,vars:2,consts:[["printChannelModal",""],[3,"onCancel","config"],["content",""],[1,"table"],[1,"sticky-top-thead","variant-modal"],[1,"text-start","sticky-top"],["matTooltip","Variant from POS",1,"fas","fa-info-circle","ms-1"],["matTooltip","Product and Variant from each Channel",1,"fas","fa-info-circle","ms-1"],[1,"text-start","sticky-top",2,"width","0%"],[4,"ngFor","ngForOf"],[4,"ngIf","ngIfElse"],[1,"text-start"],["colspan","3",1,"text-center"],[1,"my-auto"],["class","text-start",4,"ngIf"],[1,"d-flex"],["target","_blank",1,"me-1",3,"href","title"],[2,"width","20px","height","20px",3,"src"],[1,"text-ellipsis","ps-2",2,"max-width","18vw",3,"matTooltip"],[1,"text-center"],["target","_blank",1,"btn","btn-small","btn-light","px-4","py-2",3,"href","ngClass","matTooltip"],[1,"fa-solid","fa-pencil","me-2",2,"font-size","10px"],[1,"fs-6"]],template:function(e,a){e&1&&(l(0,"modal-material",1),g("onCancel",function(){return a.dialogRef.close()}),l(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr")(5,"th",5),c(6," VARIANT "),l(7,"sup"),_(8,"i",6),r()(),l(9,"th",5),c(10,"SKU"),r(),l(11,"th",5),c(12," PRODUCT "),l(13,"sup"),_(14,"i",7),r()(),l(15,"th",5),c(16,"PRICE"),r(),l(17,"th",8),c(18,"INVENTORY"),r(),_(19,"th",5),r()(),l(20,"tbody"),u(21,He,4,2,"ng-container",9),r()()()()),e&2&&(d("config",a.modalConfig),s(21),d("ngForOf",a.variants))},dependencies:[fe,D,A,j,E,ue],styles:[".mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}.sticky-top-thead[_ngcontent-%COMP%] th.sticky-top[_ngcontent-%COMP%]{top:0}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr.sticky-top[_ngcontent-%COMP%]{border:none!important;border-bottom:1px solid!important}table[_ngcontent-%COMP%] > thead[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]{border-top:none!important;border-left:none!important;border-right:none!important}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#fff!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:last-child:after{border-right:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-child:before{border-left:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:before{border-top:0px}a.is-disabled[_ngcontent-%COMP%]{color:gray;cursor:default}a.is-disabled[_ngcontent-%COMP%]:hover{text-decoration:none}"]});let o=n;return o})();var Y=class{constructor(){this._input$=new W,this._destroy$=new W,this._loading=!1,this._bufferSize=50,this.data=[]}onSearch(){this._input$.pipe(le(200),re(),ae(n=>(n&&(n=n.toLowerCase()),this.filterData(n))),oe(n=>n!==void 0),H(this._destroy$)).subscribe(n=>{this._dataBuffer=n.slice(0,this._bufferSize)})}onClear(){this._dataBuffer=this._data.slice(0,this._bufferSize)}filterData(n){let i=-1,t;return this._data.filter(a=>(t=JSON.stringify(a).toLowerCase(),i=t.indexOf(n),i!==-1||n==null))}get input$(){return this._input$}get bufferData(){return this._dataBuffer}get loading(){return this._loading}set data(n){this._data=n||[],this._dataBuffer=this._data.slice(0,this._bufferSize),this.onSearch()}initSelectedValue(n,i){if(y.IsNotEmpty(n)){let t=this._data.filter(e=>e[i].toString().toLowerCase().indexOf(n)!==-1);this._dataBuffer=t.slice(0,this._bufferSize)}}set bufferSize(n){this._bufferSize=n}onScrollToEnd(){this.fetchMore()}fetchMore(){let n=this._dataBuffer.length,i=this._data.slice(n,this._bufferSize+n);this._loading=!0,setTimeout(()=>{this._loading=!1,this._dataBuffer=this._dataBuffer.concat(i)},200)}destroy(){this._destroy$.next(!0),this._destroy$.complete()}};var Ve=(()=>{let n=class n{set items(t){this.ngSelectInfiniteScroll.data=t,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}get selected(){return this._selected}set selected(t){this._selected=t,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}constructor(){this.width="100%",this.clearable=!0,this.disabled=!1,this.ngSelectInfiniteScroll=new Y,this.selectedChange=new Q,this.selectedLabel=new Q}onSelectChange(t){t?(this.selectedChange.emit(t[this.bindValue]),this.selectedLabel.emit(t[this.bindLabel])):(this.selectedChange.emit(null),this.selectedLabel.emit(null))}};n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=S({type:n,selectors:[["ng-select-infinite"]],inputs:{placeholder:"placeholder",bindValue:"bindValue",bindLabel:"bindLabel",width:"width",clearable:"clearable",parent:"parent",disabled:"disabled",items:"items",selected:"selected"},outputs:{selectedChange:"selectedChange",selectedLabel:"selectedLabel"},decls:1,vars:12,consts:[[3,"clear","scrollToEnd","change","disabled","virtualScroll","typeahead","items","bindLabel","bindValue","placeholder","ngModel","clearable","appendTo"]],template:function(e,a){e&1&&(l(0,"ng-select",0),g("clear",function(){return a.ngSelectInfiniteScroll.onClear()})("scrollToEnd",function(){return a.ngSelectInfiniteScroll.onScrollToEnd()})("change",function(C){return a.onSelectChange(C)}),r()),e&2&&(pe("width",a.width),d("disabled",a.disabled)("virtualScroll",!0)("typeahead",a.ngSelectInfiniteScroll.input$)("items",a.ngSelectInfiniteScroll.bufferData)("bindLabel",a.bindLabel)("bindValue",a.bindValue)("placeholder",a.placeholder)("ngModel",a.selected)("clearable",a.clearable)("appendTo",a.parent))},dependencies:[ve,B,R]});let o=n;return o})(),kt=(()=>{let n=class n{};n.\u0275fac=function(e){return new(e||n)},n.\u0275mod=ce({type:n}),n.\u0275inj=de({imports:[Ce,Me,Te]});let o=n;return o})();var Ne=(()=>{let n=class n{constructor(t,e){this.LocalData=t,this.httpService=e}getCategoriesByTypeId(t,e){return this.LocalData.getCategoriesByChannelType(t).pipe(J(a=>a!=null?ie(a):this._getCategoriesByTypeID(t,e)))}_getCategoriesByTypeID(t,e){let a={TypeID:t,ID:e};return this.httpService.post("/api/Channel/getCategoriesByTypeID",a).pipe(J(m=>this.LocalData.saveCategoriesByChannelType(m,t)))}};n.\u0275fac=function(e){return new(e||n)(q(Ie),q(ye))},n.\u0275prov=se({token:n,factory:n.\u0275fac,providedIn:"root"});let o=n;return o})();function Ye(o,n){if(o&1){let i=k();U(0),l(1,"ng-select-infinite",16),g("selectedChange",function(e){I(i);let a=h().index,m=h();return v(m.onSelectCategory(e,a))}),r(),F()}if(o&2){let i=h().$implicit;s(),d("items",i.Categories)("clearable",!1)}}function Je(o,n){if(o&1&&(l(0,"div",17),_(1,"input",18),r()),o&2){let i=h().$implicit,t=h();d("matTooltip",t.channelType.WooCommerce==i.TypeID||t.channelType.Shopify==i.TypeID?"":"Product Category is Harcoded, Please Change Product Category in Seller Center"),s(),d("placeholder",t.getChannelCategory(i.TypeID))}}function qe(o,n){if(o&1){let i=k();U(0),l(1,"tr")(2,"td",10)(3,"input",11),N("ngModelChange",function(e){let a=I(i).$implicit;return V(a.Selected,e)||(a.Selected=e),v(e)}),g("ngModelChange",function(){I(i);let e=h();return v(e.onSelectChannel())}),r()(),l(4,"td")(5,"div",12),_(6,"img",13),l(7,"span",14),c(8),r()()(),l(9,"td"),u(10,Ye,2,2,"ng-container",15)(11,Je,2,2,"ng-template",null,0,K),r()(),F()}if(o&2){let i=n.$implicit,t=G(12);s(3),P("ngModel",i.Selected),s(3),d("src",i==null?null:i.Img,M)("alt",i.Name),s(2),b(i.Name),s(2),d("ngIf",i.Categories.length>0)("ngIfElse",t)}}var Rt=(()=>{let n=class n{constructor(t,e,a,m){this.data=t,this.channelService=e,this.dialogRef=a,this.toastrService=m,this.channelOptions=[],this.uploadResponse=[],this.channelType=p,this.enableBtnOk=!1,this.destroy$=new W,this.uploadResponse=[],this.channels=this.data.channels,this.product=t.product}ngOnInit(){this.initModalConfig(),this.initChannelOptions(),this.initCategories()}initModalConfig(){this.modalConfig=new w,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0}initCategories(){this.filterChannelTypeId().forEach(e=>{this.channelService.getCategoriesByTypeId(e.channelType,e.channelId).pipe(H(this.destroy$)).subscribe(a=>{this.setCategoriesChannelOption(e.channelType,a)})})}setCategoriesChannelOption(t,e){this.channelOptions=this.channelOptions.map(a=>(a.TypeID==t&&(a.Categories=e),a))}initChannelOptions(){this.channelOptions=this.channels.map(t=>({Name:t.Name,Img:t.Img,ID:t.ID,Selected:!1,CategoryID:this.initDefaultChannelCategoryId(t.TypeID),TypeID:t.TypeID,Categories:[]}))}initDefaultChannelCategoryId(t){let e=0;switch(t){case p.Lazada:e=6509;break}return e}filterChannelTypeId(){return this.data.channels.map(e=>({channelType:e.TypeID,channelId:e.ID})).filter((e,a,m)=>m.findIndex(C=>e.channelType==C.channelType)==a).filter(e=>e.channelType==p.Tokopedia)}onSelectCategory(t,e){this.channelOptions[e].CategoryID=t,this.channelOptions[e].Selected=!0,this.onSelectChannel()}onSelectAllChannel(t){this.channelOptions=this.channelOptions.map(e=>(e.Selected=t,e)),this.enableBtnOk=t}onSelectChannel(){this.enableBtnOk=this.hasSelectedChannel()}hasSelectedChannel(){return this.channelOptions.findIndex(t=>t.Selected)!==-1}onClose(){this.dialogRef.close()}onSave(){if(!this.validateSelectedCategory()){this.toastrService.warning("Category is required","Warning!");return}let t=this.channelOptions.filter(e=>e.Selected).map(e=>({CategoryID:e.CategoryID,ChannelID:e.ID}));this.dialogRef.close(t)}validateSelectedCategory(){return this.channelOptions.filter(e=>e.Selected).filter(e=>e.TypeID==p.Tokopedia).findIndex(e=>e.CategoryID==0)==-1}getChannelCategory(t){let e;switch(t){case p.Shopee:e="Aksesoris Fashion";break;case p.Tiktok:e="Aksesoris Fashion - Aksesoris Pakaian";break;case p.WooCommerce:e=this.product?.Category?this.product?.Category:"Following the category in POS";break;case p.Lazada:e="Fashion Accessories / Women Accessories / Others";break;case p.Shopify:e=this.product?.Category?this.product?.Category:"Following the category in POS";break;default:e="Unavailable Category"}return e}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}};n.\u0275fac=function(e){return new(e||n)(f(O),f(Ne),f(x),f(_e))},n.\u0275cmp=S({type:n,selectors:[["app-modal-uploadMultiple-product"]],decls:15,vars:3,consts:[["EMPTY",""],[3,"onOk","onClose","onCancel","dynamicValidated","config"],["content",""],[1,"table"],[1,"text-center",2,"width","6%"],["type","checkbox",3,"change"],[2,"width","30%"],[1,"fs-6"],[2,"width","60%"],[4,"ngFor","ngForOf"],[1,"text-center"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"d-flex","align-items-center"],[1,"channelLogo-md",3,"src","alt"],[1,"ms-3","fs-6"],[4,"ngIf","ngIfElse"],["bindValue","Key","bindLabel","Value","width","100%","parent","body","position","top","placeholder","Select Category",3,"selectedChange","items","clearable"],["matTooltipPosition","above","matTooltipClass","custom-width-tooltip",3,"matTooltip"],["type","text","disabled","",1,"form-control","rounded",2,"height","40px",3,"placeholder"]],template:function(e,a){e&1&&(l(0,"modal-material",1),g("onOk",function(){return a.onSave()})("onClose",function(){return a.onClose()})("onCancel",function(){return a.onClose()}),l(1,"div",2)(2,"table",3)(3,"thead")(4,"tr")(5,"th",4)(6,"input",5),g("change",function(C){return a.onSelectAllChannel(C.target.checked)}),r()(),l(7,"th",6)(8,"span",7),c(9,"CHANNEL"),r()(),l(10,"th",8)(11,"span",7),c(12,"CATEGORY"),r()()()(),l(13,"tbody"),u(14,qe,13,6,"ng-container",9),r()()()()),e&2&&(d("dynamicValidated",a.enableBtnOk)("config",a.modalConfig),s(14),d("ngForOf",a.channelOptions))},dependencies:[D,A,be,B,R,j,E,Ve],styles:[`input[type=checkbox]{width:15px;height:15px}table>thead>tr{border-top:none!important;border-left:none!important;border-right:none!important}
|
|
1
|
+
import{a as xe,b as Oe}from"./chunk-G5LCLRIW.js";import{a as Ee}from"./chunk-5ZUWMFL5.js";import{g as we}from"./chunk-DT3B54LD.js";import{d as ve,e as Me}from"./chunk-AL67KXJV.js";import{f as Ie}from"./chunk-ZLBTBS3M.js";import{b as _e,e as ye}from"./chunk-K3G6FMDF.js";import{A as E,q as j,s as x,t as O,z as w}from"./chunk-ZKBLXGXT.js";import{U as De}from"./chunk-6B64VOO7.js";import{b as be,h as B,k as R,u as Te}from"./chunk-SP6QPE3M.js";import{b as p,c as y}from"./chunk-6F6NSBIF.js";import{$ as se,Ab as c,B as oe,Bb as b,Cb as T,Eb as P,Fb as V,Gb as N,H as le,Ha as M,Ia as s,Ja as f,K as re,Kb as me,Rb as $,Sb as Z,T as J,Tb as he,Ub as K,V as H,Wa as u,Xa as X,Xc as Se,Ya as d,Za as pe,aa as de,c as W,ca as q,fb as l,gb as r,ha as S,hb as _,ia as ce,ib as U,ic as fe,jb as F,kc as D,lb as k,lc as A,n as ie,ob as g,pa as I,pc as ge,q as ae,qa as v,qb as h,rc as ue,sc as Ce,za as Q,zb as G}from"./chunk-6DRNAUKE.js";function Le(o,n){if(o&1&&(l(0,"mat-option",9)(1,"div",10),_(2,"img",11),l(3,"span"),c(4),r()()()),o&2){let i=n.$implicit;d("value",i.ID)("disabled",i.disabled),s(),d("matTooltip",i.disabled?"Single Product Scan disabled for this type of Channel":null),s(),d("src",i.Img,M),s(2),b(i.Name)}}function Ue(o,n){if(o&1){let i=k();l(0,"div",12)(1,"label",13),c(2,"Scan Type"),r(),l(3,"mat-radio-group",14),N("ngModelChange",function(e){I(i);let a=h();return V(a.filter.ScanFull,e)||(a.filter.ScanFull=e),v(e)}),l(4,"mat-radio-button",15),c(5," Full (Include Inactive Products) "),r(),l(6,"mat-radio-button",16),c(7," Active "),r()()()}if(o&2){let i=h();s(3),P("ngModel",i.filter.ScanFull),s(),d("value",!0),s(2),d("value",!1)}}function Fe(o,n){if(o&1){let i=k();l(0,"div",17)(1,"label",3),c(2),$(3,"date"),r(),l(4,"mat-radio-group",18),N("ngModelChange",function(e){I(i);let a=h();return V(a.filter.UpdatedProduct,e)||(a.filter.UpdatedProduct=e),v(e)}),l(5,"mat-radio-button",19),c(6," Scan All Products "),r(),l(7,"mat-radio-button",20),c(8),r()()()}if(o&2){let i=h();s(2),T(" Last Scan: ",he(3,6,i.selectedChannel.LastSync,"dd MMMM yyyy HH:mm")," "),s(2),P("ngModel",i.filter.UpdatedProduct),s(),d("value",!1),s(2),d("value",!0)("matTooltip",i.selectedChannel.TypeID==i.channelType.Tokopedia?"Use Tokopedia URL for mapping SKU between POS and Tokopedia":"Scan only products that have been updated since the last channel scan"),s(),T(" ",i.selectedChannel.TypeID==i.channelType.Tokopedia?"Product Download By URL":"Scan Updated Products"," ")}}function Ae(o,n){if(o&1){let i=k();l(0,"div",17)(1,"label",3),c(2," Scan Option "),r(),l(3,"mat-radio-group",21),N("ngModelChange",function(e){I(i);let a=h();return V(a.filter.Async,e)||(a.filter.Async=e),v(e)}),l(4,"mat-radio-button",22),c(5," Asynchronous (Get Notified when Complete) "),r(),l(6,"mat-radio-button",23),c(7," Synchronous (Wait until Complete) "),r()()()}if(o&2){let i=h();s(3),P("ngModel",i.filter.Async),s(),d("value",!0),s(2),d("value",!1)}}var rt=(()=>{let n=class n{constructor(t,e,a){this.dialogRef=t,this.data=e,this.router=a,this.channelType=p,this.disabledChannelOption=!1,this.filter={ChannelID:y.GuidEMpty,ScanFull:!0,UpdatedProduct:!1,Async:!1},this.isSingleChannel=y.IsNotEmpty(e.isSingleChannel)?this.data.isSingleChannel:!1,this.disabledChannelOption=y.IsEmpty(e.disabledChannelOption)?!1:this.data.disabledChannelOption}ngOnInit(){this.initChannelOptions(),this.initFilter(),this.onSelectChannel(this.data?.filter?.ChannelID),this.initModalConfig()}initModalConfig(){this.modalConfig=new w,this.modalConfig.title="Scan Marketplace",this.modalConfig.bodyScrollable=!0}initFilter(){this.filter.ChannelID=this.data?.filter?.ChannelID,this.filter.ScanFull=!1}initChannelOptions(){this.channelOptions=JSON.parse(JSON.stringify(this.data.channelOptions)),this.isSingleChannel&&(this.channelOptions=this.channelOptions.map(t=>(t.disabled=!0,(t.TypeID==p.Tiktok||t.TypeID==p.Tokopedia||t.TypeID==p.Lazada||t.TypeID==p.WooCommerce)&&(t.disabled=!1),t)).sort(t=>t.disabled?1:-1))}onSelectChannel(t){let e=this.filterChannelById(t);this.selectedChannel=e,this.filter.Async=!0,this.iniHasScanUpdate(),this.setDefaultConfigUpdate()}setDefaultConfigUpdate(){this.filter.UpdatedProduct=!1,this.selectedChannel&&y.IsNotEmpty(this.selectedChannel.LastSync)&&(this.selectedChannel.TypeID==p.Shopee||this.selectedChannel.TypeID==p.Tiktok||this.selectedChannel.TypeID==p.Lazada)&&(this.filter.UpdatedProduct=!0)}iniHasScanUpdate(){this.selectedChannel?.TypeID!=p.WooCommerce&&this.selectedChannel?.TypeID!=p.KalCare&&this.selectedChannel?.TypeID!=p.None&&y.IsNotEmpty(this.selectedChannel?.LastSync)&&!this.isSingleChannel?this.hasScanUpdate=!0:this.hasScanUpdate=!1}filterChannelById(t){let e;return this.channelOptions&&(e=this.channelOptions.find(a=>a.ID==t)),e}submit(){this.selectedChannel.TypeID==p.Tokopedia&&this.filter.UpdatedProduct?this.router.navigate(["/menu/products/download/by-url"]).then(()=>{this.dialogRef.close()}):(this.beforeSubmit(),this.dialogRef.close(this.filter))}beforeSubmit(){this.filter.UpdatedProduct&&(this.filter.Async=!1)}isNotEmpty(t){return y.IsNotEmpty(t)}onClose(){this.dialogRef.close()}};n.\u0275fac=function(e){return new(e||n)(f(x),f(O),f(Se))},n.\u0275cmp=S({type:n,selectors:[["app-scan-dialog"]],decls:11,vars:8,consts:[[3,"onOk","onClose","onCancel","dynamicValidated","config"],["content",""],[1,"mx-4"],[1,"mb-2","fw-bold"],["appearance","outline",1,"w-100"],["name","channelid","placeholder","Channel",1,"mat-select-channel",3,"ngModelChange","disabled","ngModel"],["class","channel-option",3,"value","disabled",4,"ngFor","ngForOf"],["class","mt-4",4,"ngIf"],["class","mt-8",4,"ngIf"],[1,"channel-option",3,"value","disabled"],["matTooltipPosition","above","matTooltipClass","custom-width-tooltip",3,"matTooltip"],[2,"width","18px","margin-right","10px",3,"src"],[1,"mt-4"],[1,"mb-2","fw-bold","mt-3"],["name","scanType",1,"form-control","h-100","round",3,"ngModelChange","ngModel"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Full Scan Product",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Only Active Product",1,"me-5",3,"value"],[1,"mt-8"],["name","ScanFull",1,"form-control","h-100","round",2,"line-height","2",3,"ngModelChange","ngModel"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Scan product from beginning ( use this if you haven't scanned at all)",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above",1,"me-5",3,"value","matTooltip"],["name","Async",1,"form-control","h-100","round",2,"line-height","2",3,"ngModelChange","ngModel"],["matTooltipClass","custom-width-tooltip","matTooltip","Scan is running in the background, status will be visible in the notification menu","matTooltipPosition","above",1,"me-5",3,"value"],[1,"me-5",3,"value"]],template:function(e,a){e&1&&(l(0,"modal-material",0),g("onOk",function(){return a.submit()})("onClose",function(){return a.onClose()})("onCancel",function(){return a.onClose()}),l(1,"div",1)(2,"div",2)(3,"label",3),c(4,"Select a Channel"),r(),l(5,"mat-form-field",4)(6,"mat-select",5),N("ngModelChange",function(C){return V(a.filter.ChannelID,C)||(a.filter.ChannelID=C),C}),g("ngModelChange",function(C){return a.onSelectChannel(C)}),u(7,Le,5,5,"mat-option",6),r()(),u(8,Ue,8,3,"div",7)(9,Fe,9,9,"div",8)(10,Ae,8,3,"div",8),r()()()),e&2&&(d("dynamicValidated",a.isNotEmpty(a.filter.ChannelID))("config",a.modalConfig),s(6),d("disabled",a.disabledChannelOption),P("ngModel",a.filter.ChannelID),s(),d("ngForOf",a.channelOptions),s(),d("ngIf",!a.isSingleChannel&&a.isNotEmpty(a.filter.ChannelID)),s(),d("ngIf",a.hasScanUpdate),s(),d("ngIf",!(a.filter!=null&&a.filter.UpdatedProduct)&&!a.isSingleChannel&&a.isNotEmpty(a.filter.ChannelID)))},dependencies:[D,A,B,R,xe,Oe,we,Ee,De,j,E,ge],encapsulation:2});let o=n;return o})();var L=function(o){return o.Tokopedia="https://seller.tokopedia.com",o.Shoope="https://seller.shopee.co.id",o.Tiktok="https://seller-id.tiktok.com",o.WooCommerce="https://woocommerce.dealpos.app",o.Lazada="https://sellercenter.lazada.co.id",o}(L||{});var Be=o=>({"is-disabled":o});function Re(o,n){if(o&1&&(U(0),l(1,"tr")(2,"td",11),c(3),r(),l(4,"td",11),c(5),r(),l(6,"td",12)(7,"p",13),c(8,"Product Not in Channel!"),r()()(),F()),o&2){let i=h().$implicit;s(3),T(" ",i==null?null:i.Model,""),s(2),T(" ",i==null?null:i.Code,"")}}function je(o,n){if(o&1&&(l(0,"td",11),c(1),r()),o&2){let i=h(3).$implicit;X("rowspan",i.Channel.length),s(),T(" ",i==null?null:i.Model,"")}}function We(o,n){if(o&1&&(l(0,"td",11),c(1),r()),o&2){let i=h(3).$implicit;X("rowspan",i.Channel.length),s(),T(" ",i==null?null:i.Code,"")}}function $e(o,n){if(o&1&&(l(0,"tr"),u(1,je,2,2,"td",14)(2,We,2,2,"td",14),l(3,"td",11)(4,"div",15)(5,"a",16),_(6,"img",17),r(),l(7,"div",18),c(8),r()()(),l(9,"td",11),c(10),$(11,"number"),r(),l(12,"td",19),c(13),$(14,"number"),r(),l(15,"td",19)(16,"a",20),_(17,"i",21),l(18,"span",22),c(19,"Edit"),r()()()()),o&2){let i=n.$implicit,t=n.index,e=h(3);s(),d("ngIf",t==0),s(),d("ngIf",t==0),s(3),d("href",i.Url,M)("title",i.Title),s(),d("src",e.getChannelLogo(i.TypeID),M),s(),d("matTooltip",(i==null||i.Name==null?null:i.Name.length)>55?i==null?null:i.Name:""),s(),T(" ",i.Name," "),s(2),b(Z(11,12,i.Price)),s(3),b(Z(14,14,i.Inventory)),s(3),d("href",e.getHyperlinkSellerCenter(i),M)("ngClass",me(16,Be,i.TypeID==e.channelType.KalCare))("matTooltip",i.TypeID!=e.channelType.KalCare?"Edit this product in Seller Center, inventory changes must be done via DEALPOS":"")}}function ze(o,n){if(o&1&&u(0,$e,20,18,"tr",9),o&2){let i=h().$implicit;d("ngForOf",i==null?null:i.Channel)}}function He(o,n){if(o&1&&(U(0),u(1,Re,9,2,"ng-container",10)(2,ze,1,1,"ng-template",null,0,K),F()),o&2){let i=n.$implicit,t=G(3);s(),d("ngIf",!i.Channel||i.Channel.length<1)("ngIfElse",t)}}var gt=(()=>{let n=class n{constructor(t,e){this.data=t,this.dialogRef=e,this.channelType=p,this.variants=t.variants,this.title=t.title}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new w,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}getChannelLogo(t){return y.getChannelLogoByTypeId(t)}getHyperlinkSellerCenter(t){let e="javascript:void(0)";switch(t.TypeID){case p.Shopee:e=`${L.Shoope}/portal/product/${t.ChannelItemID}`;break;case p.Tiktok:e=`${L.Tiktok}/product/edit/${t.ChannelItemID}`;break;case p.Tokopedia:e=`${L.Tokopedia}/edit-product/${t.ChannelItemID}`;break;case p.WooCommerce:e=`${L.WooCommerce}/wp-admin/post.php?post=${t.ChannelItemID}&action=edit`;break;case p.Lazada:e=`${L.Lazada}/apps/product/publish?productId=${t.ChannelItemID}`;break}return e}};n.\u0275fac=function(e){return new(e||n)(f(O),f(x))},n.\u0275cmp=S({type:n,selectors:[["app-modal-variant"]],decls:22,vars:2,consts:[["printChannelModal",""],[3,"onCancel","config"],["content",""],[1,"table"],[1,"sticky-top-thead","variant-modal"],[1,"text-start","sticky-top"],["matTooltip","Variant from POS",1,"fas","fa-info-circle","ms-1"],["matTooltip","Product and Variant from each Channel",1,"fas","fa-info-circle","ms-1"],[1,"text-start","sticky-top",2,"width","0%"],[4,"ngFor","ngForOf"],[4,"ngIf","ngIfElse"],[1,"text-start"],["colspan","3",1,"text-center"],[1,"my-auto"],["class","text-start",4,"ngIf"],[1,"d-flex"],["target","_blank",1,"me-1",3,"href","title"],[2,"width","20px","height","20px",3,"src"],[1,"text-ellipsis","ps-2",2,"max-width","18vw",3,"matTooltip"],[1,"text-center"],["target","_blank",1,"btn","btn-small","btn-light","px-4","py-2",3,"href","ngClass","matTooltip"],[1,"fa-solid","fa-pencil","me-2",2,"font-size","10px"],[1,"fs-6"]],template:function(e,a){e&1&&(l(0,"modal-material",1),g("onCancel",function(){return a.dialogRef.close()}),l(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr")(5,"th",5),c(6," VARIANT "),l(7,"sup"),_(8,"i",6),r()(),l(9,"th",5),c(10,"SKU"),r(),l(11,"th",5),c(12," PRODUCT "),l(13,"sup"),_(14,"i",7),r()(),l(15,"th",5),c(16,"PRICE"),r(),l(17,"th",8),c(18,"INVENTORY"),r(),_(19,"th",5),r()(),l(20,"tbody"),u(21,He,4,2,"ng-container",9),r()()()()),e&2&&(d("config",a.modalConfig),s(21),d("ngForOf",a.variants))},dependencies:[fe,D,A,j,E,ue],styles:[".mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}.sticky-top-thead[_ngcontent-%COMP%] th.sticky-top[_ngcontent-%COMP%]{top:0}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr.sticky-top[_ngcontent-%COMP%]{border:none!important;border-bottom:1px solid!important}table[_ngcontent-%COMP%] > thead[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]{border-top:none!important;border-left:none!important;border-right:none!important}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#fff!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:last-child:after{border-right:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-child:before{border-left:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:before{border-top:0px}a.is-disabled[_ngcontent-%COMP%]{color:gray;cursor:default}a.is-disabled[_ngcontent-%COMP%]:hover{text-decoration:none}"]});let o=n;return o})();var Y=class{constructor(){this._input$=new W,this._destroy$=new W,this._loading=!1,this._bufferSize=50,this.data=[]}onSearch(){this._input$.pipe(le(200),re(),ae(n=>(n&&(n=n.toLowerCase()),this.filterData(n))),oe(n=>n!==void 0),H(this._destroy$)).subscribe(n=>{this._dataBuffer=n.slice(0,this._bufferSize)})}onClear(){this._dataBuffer=this._data.slice(0,this._bufferSize)}filterData(n){let i=-1,t;return this._data.filter(a=>(t=JSON.stringify(a).toLowerCase(),i=t.indexOf(n),i!==-1||n==null))}get input$(){return this._input$}get bufferData(){return this._dataBuffer}get loading(){return this._loading}set data(n){this._data=n||[],this._dataBuffer=this._data.slice(0,this._bufferSize),this.onSearch()}initSelectedValue(n,i){if(y.IsNotEmpty(n)){let t=this._data.filter(e=>e[i].toString().toLowerCase().indexOf(n)!==-1);this._dataBuffer=t.slice(0,this._bufferSize)}}set bufferSize(n){this._bufferSize=n}onScrollToEnd(){this.fetchMore()}fetchMore(){let n=this._dataBuffer.length,i=this._data.slice(n,this._bufferSize+n);this._loading=!0,setTimeout(()=>{this._loading=!1,this._dataBuffer=this._dataBuffer.concat(i)},200)}destroy(){this._destroy$.next(!0),this._destroy$.complete()}};var Ve=(()=>{let n=class n{set items(t){this.ngSelectInfiniteScroll.data=t,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}get selected(){return this._selected}set selected(t){this._selected=t,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}constructor(){this.width="100%",this.clearable=!0,this.disabled=!1,this.ngSelectInfiniteScroll=new Y,this.selectedChange=new Q,this.selectedLabel=new Q}onSelectChange(t){t?(this.selectedChange.emit(t[this.bindValue]),this.selectedLabel.emit(t[this.bindLabel])):(this.selectedChange.emit(null),this.selectedLabel.emit(null))}};n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=S({type:n,selectors:[["ng-select-infinite"]],inputs:{placeholder:"placeholder",bindValue:"bindValue",bindLabel:"bindLabel",width:"width",clearable:"clearable",parent:"parent",disabled:"disabled",items:"items",selected:"selected"},outputs:{selectedChange:"selectedChange",selectedLabel:"selectedLabel"},decls:1,vars:12,consts:[[3,"clear","scrollToEnd","change","disabled","virtualScroll","typeahead","items","bindLabel","bindValue","placeholder","ngModel","clearable","appendTo"]],template:function(e,a){e&1&&(l(0,"ng-select",0),g("clear",function(){return a.ngSelectInfiniteScroll.onClear()})("scrollToEnd",function(){return a.ngSelectInfiniteScroll.onScrollToEnd()})("change",function(C){return a.onSelectChange(C)}),r()),e&2&&(pe("width",a.width),d("disabled",a.disabled)("virtualScroll",!0)("typeahead",a.ngSelectInfiniteScroll.input$)("items",a.ngSelectInfiniteScroll.bufferData)("bindLabel",a.bindLabel)("bindValue",a.bindValue)("placeholder",a.placeholder)("ngModel",a.selected)("clearable",a.clearable)("appendTo",a.parent))},dependencies:[ve,B,R]});let o=n;return o})(),kt=(()=>{let n=class n{};n.\u0275fac=function(e){return new(e||n)},n.\u0275mod=ce({type:n}),n.\u0275inj=de({imports:[Ce,Me,Te]});let o=n;return o})();var Ne=(()=>{let n=class n{constructor(t,e){this.LocalData=t,this.httpService=e}getCategoriesByTypeId(t,e){return this.LocalData.getCategoriesByChannelType(t).pipe(J(a=>a!=null?ie(a):this._getCategoriesByTypeID(t,e)))}_getCategoriesByTypeID(t,e){let a={TypeID:t,ID:e};return this.httpService.post("/api/Channel/getCategoriesByTypeID",a).pipe(J(m=>this.LocalData.saveCategoriesByChannelType(m,t)))}};n.\u0275fac=function(e){return new(e||n)(q(Ie),q(ye))},n.\u0275prov=se({token:n,factory:n.\u0275fac,providedIn:"root"});let o=n;return o})();function Ye(o,n){if(o&1){let i=k();U(0),l(1,"ng-select-infinite",16),g("selectedChange",function(e){I(i);let a=h().index,m=h();return v(m.onSelectCategory(e,a))}),r(),F()}if(o&2){let i=h().$implicit;s(),d("items",i.Categories)("clearable",!1)}}function Je(o,n){if(o&1&&(l(0,"div",17),_(1,"input",18),r()),o&2){let i=h().$implicit,t=h();d("matTooltip",t.channelType.WooCommerce==i.TypeID||t.channelType.Shopify==i.TypeID?"":"Product Category is Harcoded, Please Change Product Category in Seller Center"),s(),d("placeholder",t.getChannelCategory(i.TypeID))}}function qe(o,n){if(o&1){let i=k();U(0),l(1,"tr")(2,"td",10)(3,"input",11),N("ngModelChange",function(e){let a=I(i).$implicit;return V(a.Selected,e)||(a.Selected=e),v(e)}),g("ngModelChange",function(){I(i);let e=h();return v(e.onSelectChannel())}),r()(),l(4,"td")(5,"div",12),_(6,"img",13),l(7,"span",14),c(8),r()()(),l(9,"td"),u(10,Ye,2,2,"ng-container",15)(11,Je,2,2,"ng-template",null,0,K),r()(),F()}if(o&2){let i=n.$implicit,t=G(12);s(3),P("ngModel",i.Selected),s(3),d("src",i==null?null:i.Img,M)("alt",i.Name),s(2),b(i.Name),s(2),d("ngIf",i.Categories.length>0)("ngIfElse",t)}}var Rt=(()=>{let n=class n{constructor(t,e,a,m){this.data=t,this.channelService=e,this.dialogRef=a,this.toastrService=m,this.channelOptions=[],this.uploadResponse=[],this.channelType=p,this.enableBtnOk=!1,this.destroy$=new W,this.uploadResponse=[],this.channels=this.data.channels,this.product=t.product}ngOnInit(){this.initModalConfig(),this.initChannelOptions(),this.initCategories()}initModalConfig(){this.modalConfig=new w,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0}initCategories(){this.filterChannelTypeId().forEach(e=>{this.channelService.getCategoriesByTypeId(e.channelType,e.channelId).pipe(H(this.destroy$)).subscribe(a=>{this.setCategoriesChannelOption(e.channelType,a)})})}setCategoriesChannelOption(t,e){this.channelOptions=this.channelOptions.map(a=>(a.TypeID==t&&(a.Categories=e),a))}initChannelOptions(){this.channelOptions=this.channels.map(t=>({Name:t.Name,Img:t.Img,ID:t.ID,Selected:!1,CategoryID:this.initDefaultChannelCategoryId(t.TypeID),TypeID:t.TypeID,Categories:[]}))}initDefaultChannelCategoryId(t){let e=0;switch(t){case p.Lazada:e=6509;break}return e}filterChannelTypeId(){return this.data.channels.map(e=>({channelType:e.TypeID,channelId:e.ID})).filter((e,a,m)=>m.findIndex(C=>e.channelType==C.channelType)==a).filter(e=>e.channelType==p.Tokopedia)}onSelectCategory(t,e){this.channelOptions[e].CategoryID=t,this.channelOptions[e].Selected=!0,this.onSelectChannel()}onSelectAllChannel(t){this.channelOptions=this.channelOptions.map(e=>(e.Selected=t,e)),this.enableBtnOk=t}onSelectChannel(){this.enableBtnOk=this.hasSelectedChannel()}hasSelectedChannel(){return this.channelOptions.findIndex(t=>t.Selected)!==-1}onClose(){this.dialogRef.close()}onSave(){if(!this.validateSelectedCategory()){this.toastrService.warning("Category is required","Warning!");return}let t=this.channelOptions.filter(e=>e.Selected).map(e=>({CategoryID:e.CategoryID,ChannelID:e.ID}));this.dialogRef.close(t)}validateSelectedCategory(){return this.channelOptions.filter(e=>e.Selected).filter(e=>e.TypeID==p.Tokopedia).findIndex(e=>e.CategoryID==0)==-1}getChannelCategory(t){let e;switch(t){case p.Shopee:e="Aksesoris Fashion";break;case p.Tiktok:e="Aksesoris Fashion - Aksesoris Pakaian";break;case p.WooCommerce:e=this.product?.Category?this.product?.Category:"Following the category in POS";break;case p.Lazada:e="Fashion Accessories / Women Accessories / Others";break;case p.Shopify:e=this.product?.Category?this.product?.Category:"Following the category in POS";break;default:e="Unavailable Category"}return e}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}};n.\u0275fac=function(e){return new(e||n)(f(O),f(Ne),f(x),f(_e))},n.\u0275cmp=S({type:n,selectors:[["app-modal-uploadMultiple-product"]],decls:15,vars:3,consts:[["EMPTY",""],[3,"onOk","onClose","onCancel","dynamicValidated","config"],["content",""],[1,"table"],[1,"text-center",2,"width","6%"],["type","checkbox",3,"change"],[2,"width","30%"],[1,"fs-6"],[2,"width","60%"],[4,"ngFor","ngForOf"],[1,"text-center"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"d-flex","align-items-center"],[1,"channelLogo-md",3,"src","alt"],[1,"ms-3","fs-6"],[4,"ngIf","ngIfElse"],["bindValue","Key","bindLabel","Value","width","100%","parent","body","position","top","placeholder","Select Category",3,"selectedChange","items","clearable"],["matTooltipPosition","above","matTooltipClass","custom-width-tooltip",3,"matTooltip"],["type","text","disabled","",1,"form-control","rounded",2,"height","40px",3,"placeholder"]],template:function(e,a){e&1&&(l(0,"modal-material",1),g("onOk",function(){return a.onSave()})("onClose",function(){return a.onClose()})("onCancel",function(){return a.onClose()}),l(1,"div",2)(2,"table",3)(3,"thead")(4,"tr")(5,"th",4)(6,"input",5),g("change",function(C){return a.onSelectAllChannel(C.target.checked)}),r()(),l(7,"th",6)(8,"span",7),c(9,"CHANNEL"),r()(),l(10,"th",8)(11,"span",7),c(12,"CATEGORY"),r()()()(),l(13,"tbody"),u(14,qe,13,6,"ng-container",9),r()()()()),e&2&&(d("dynamicValidated",a.enableBtnOk)("config",a.modalConfig),s(14),d("ngForOf",a.channelOptions))},dependencies:[D,A,be,B,R,j,E,Ve],styles:[`input[type=checkbox]{width:15px;height:15px}table>thead>tr{border-top:none!important;border-left:none!important;border-right:none!important}
|
|
2
2
|
`],encapsulation:2});let o=n;return o})();function Qe(o,n){if(o&1&&(l(0,"tr")(1,"td"),c(2),r(),l(3,"td"),c(4),r()()),o&2){let i=n.$implicit;s(2),b(i==null?null:i.Name),s(2),b(i==null?null:i.ChannelVariationSKU)}}var zt=(()=>{let n=class n{constructor(t,e){this.data=t,this.dialogRef=e}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new w,this.modalConfig.title=this.data?.title,this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}};n.\u0275fac=function(e){return new(e||n)(f(O),f(x))},n.\u0275cmp=S({type:n,selectors:[["app-modal-variants"]],decls:11,vars:2,consts:[[3,"onCancel","config"],["content",""],[1,"table"],[1,"thead-light"],[4,"ngFor","ngForOf"]],template:function(e,a){e&1&&(l(0,"modal-material",0),g("onCancel",function(){return a.dialogRef.close()}),l(1,"div",1)(2,"table",2)(3,"thead",3)(4,"tr")(5,"th"),c(6,"Variant"),r(),l(7,"th"),c(8,"SKU"),r()()(),l(9,"tbody"),u(10,Qe,5,2,"tr",4),r()()()()),e&2&&(d("config",a.modalConfig),s(10),d("ngForOf",a.data.variants))},dependencies:[D,E],styles:[".mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}"]});let o=n;return o})();export{rt as a,gt as b,kt as c,Rt as d,zt as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ke}from"./chunk-IWVYX6KY.js";import{a as He,b as Je,c as Ze}from"./chunk-G5LCLRIW.js";import{a as L,b as Pe,c as ve,d as be,e as ye}from"./chunk-WVXTWIP3.js";import{a as Se}from"./chunk-WQ7LUTQ2.js";import{b as qe}from"./chunk-BMZAGAK3.js";import{a as Xe,b as Ye}from"./chunk-N4S3Q3EC.js";import{a as ue}from"./chunk-662E5VTA.js";import{a as Y}from"./chunk-KBYAFLE5.js";import{a as X}from"./chunk-U5YOE633.js";import"./chunk-INNTQ5YN.js";import{a as ze,b as Ge}from"./chunk-SRYGE2HW.js";import{a as xe}from"./chunk-MYMGWQRE.js";import"./chunk-DT3B54LD.js";import{a as Re,b as Be,d as Ue,e as Ae}from"./chunk-AL67KXJV.js";import{a as Ce}from"./chunk-T4Y427M7.js";import{g as J}from"./chunk-7QECCYLR.js";import{b as G,e as K}from"./chunk-K3G6FMDF.js";import"./chunk-JM3LERUP.js";import{B as je,C as q,D as We,q as fe,r as $e,u as Z}from"./chunk-ZKBLXGXT.js";import"./chunk-6B64VOO7.js";import{b as me,c as de,h as k,k as O,m as _e,u as ge,v as Oe}from"./chunk-SP6QPE3M.js";import{c as H,e as he,f as Le}from"./chunk-6F6NSBIF.js";import{Ab as m,B as R,Bb as N,Cb as y,Db as ce,Eb as T,Fb as V,Gb as D,Ha as M,Ia as l,Ib as Ne,Ja as b,Kb as E,Q as ae,Rb as S,Sb as v,Tb as se,Ub as ne,Wa as d,Wc as ke,X as B,Ya as p,_c as pe,aa as oe,fb as r,gb as c,ha as F,hb as P,ia as re,ib as I,ic as U,jb as w,kc as A,lb as f,lc as $,ob as C,oc as j,pa as g,q as ee,qa as u,qb as s,rc as W,sc as z,tb as le,za as Fe,zb as te}from"./chunk-6DRNAUKE.js";import"./chunk-GRMIXZTT.js";function gt(i,o){if(i&1){let n=f();r(0,"button",18),C("click",function(){g(n);let t=s().ngIf,a=s(2);return u(a.onUpdateItems(t))}),P(1,"i",19),m(2," Update "),c()}}function ut(i,o){if(i&1&&(r(0,"div"),d(1,gt,3,0,"button",17),c()),i&2){let n=o.ngIf,e=s(2);l(),p("ngIf",e.productService.hasSelectionVariant(n))}}function ht(i,o){if(i&1){let n=f();r(0,"div",20)(1,"app-table",21),S(2,"async"),C("onToggle",function(t){g(n);let a=s(2);return u(a.onShowDifferencePrice(t))})("onSubmit",function(t){g(n);let a=s(2);return u(a.updatePriceByVariant(t))}),c()()}if(i&2){let n=s().ngIf,e=s();l(),p("showProductToggle",!0)("data",v(2,4,e.paginationService.data$))("channel",e.channelOptions)("filter",n.Filter)}}function Ct(i,o){if(i&1){let n=f();r(0,"span",22),C("click",function(){g(n);let t=s(2);return u(t.getRowCount())}),r(1,"i",23),m(2,"?"),c()()}}function ft(i,o){if(i&1&&(r(0,"span"),m(1),S(2,"number"),c()),i&2){let n=o.ngIf;l(),N(v(2,1,n))}}function xt(i,o){if(i&1){let n=f();r(0,"a",24),C("click",function(){g(n);let t=s(2);return u(t.onNextPage())}),P(1,"i",25),m(2," Next"),c()}}function St(i,o){if(i&1){let n=f();r(0,"a",26),C("click",function(){g(n);let t=s(2);return u(t.onLastPage())}),P(1,"i",27),m(2," Last"),c()}}function Pt(i,o){if(i&1){let n=f();r(0,"mainpanel",1),C("onSubmit",function(t){g(n);let a=s();return u(a.onSearch(t))}),r(1,"actions")(2,"div",2),d(3,ut,2,1,"div",3),S(4,"async"),c()(),r(5,"filters")(6,"div")(7,"label",4),m(8,"Page Number"),c(),r(9,"input",5),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.PageNumber,t)||(a.searchFilter.PageNumber=t),u(t)}),c()(),r(10,"div",6)(11,"label",4),m(12,"Page Size"),c(),r(13,"input",5),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.RowCount,t)||(a.searchFilter.RowCount=t),u(t)}),c()()(),r(14,"content")(15,"div",7)(16,"div",8),d(17,ht,3,6,"div",9),S(18,"async"),c(),r(19,"div",10)(20,"div",11)(21,"div",12),m(22),S(23,"async"),S(24,"number"),d(25,Ct,3,0,"span",13)(26,ft,3,3,"span",3),S(27,"async"),m(28),c()(),r(29,"div",14),d(30,xt,3,0,"a",15)(31,St,3,0,"a",16),c()()()()()}if(i&2){let n,e=s();p("pageData",e.pageData)("textButton","Search"),l(3),p("ngIf",v(4,12,e.paginationService.data$)),l(6),T("ngModel",e.searchFilter.PageNumber),l(4),T("ngModel",e.searchFilter.RowCount),l(4),p("ngIf",v(18,14,e.paginationService.data$)),l(5),y(" Showing 1 - ",v(24,18,(n=v(23,16,e.paginationService.data$))==null?null:n.length)," of "),l(3),p("ngIf",e.paginationService.hideCount),l(),p("ngIf",!e.paginationService.hideCount&&v(27,20,e.allDataCount$)),l(2),y(" records ~ ",e.paginationService.footerPageNumber," Page "),l(2),p("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage),l(),p("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage)}}var rt=(()=>{let o=class o{constructor(e,t,a,_,h,x){this.http=e,this.toastr=t,this.dialog=a,this.paginationService=_,this.productService=h,this.authService=x,this.loaderAPI="PriceLoader/LoadMultiple",this.getDataAPI="Price/GetMultipleChannelComparison",this.rowCountAPI="Inventory/GetMultipleChannelComparisonRowCount",this.filterOptions=[{Key:1,Value:"All"},{Key:3,Value:"Difference"}],this.pageData={Title:"Price",Nav:[{Title:"Price Cache",Url:"/menu/price",Active:!0},{Title:"Price Realtime",Url:"/menu/price/realtime",Active:!1}]},this.channelOptions=this.authService.getChannels()}ngOnInit(){this.initPageLoader()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.getDataAPI,this.loader$=this.http.post(`/api/${this.loaderAPI}`).pipe(B(e=>{e.Filter={PageNumber:e.Filter.PageNumber,RowCount:e.Filter.RowCount,filterModel:1},this.searchFilter=e.Filter,this.paginationService.reloadPagination(this.searchFilter)}))}onShowDifferencePrice(e){this.searchFilter.filterModel=1,e&&(this.searchFilter.filterModel=3),this.paginationService.reloadPagination(this.searchFilter)}onSearch(e){this.searchFilter.text=e,this.paginationService.reloadPagination(this.searchFilter)}updatePrice(e){let t=this.productService.selectedVariantProduct(e);if(t.length>0){let _=t.map(x=>({ID:x.ID,Code:x.Code,Price:x.UnitPrice}));var a=this.channelOptions.filter(x=>x.selected).map(x=>x.ID);let h={ListChannelID:a,ListPrice:_};this.http.post("/api/Price/UpdateChannel",h).subscribe(x=>{this.paginationService.reloadPagination(this.searchFilter),this.toastr.success("Successfully updated "+h.ListPrice.length+" items in "+h.ListChannelID.length+" channels","Success")})}}updatePriceByVariant(e){let t={ID:e.ChannelID,ChannelItemID:e.ChannelItemID,ChannelVariantID:e.ChannelVariationID,Price:e.Price-0,VariantID:e.ID};this.http.post("/api/Price/UpdatePriceByID",t).subscribe(a=>{let _=this.productService.findChannelById(t.ID,this.channelOptions);this.toastr.success("Successfully updated "+e.ItemName+"("+e.VarName+") price in "+_.Name+" to "+t.Price,"Success"),this.paginationService.reloadPagination(this.searchFilter)})}onUpdateItems(e){let t=this.productService.selectedVariantProduct(e);this.dialog.open(Se,{data:{selectedItems:t,channels:this.channelOptions},width:"600px"}).afterClosed().pipe(R(a=>a!==void 0)).subscribe(a=>{this.channelOptions=a,this.updatePrice(e)})}getRowCount(){this.paginationService.hideCount=!1,this.allDataCount$=this.http.post(`/api/${this.rowCountAPI}`,{})}onNextPage(){this.paginationService.onNextPage(this.searchFilter)}onLastPage(){this.http.post(`/api/${this.rowCountAPI}`,{}).subscribe({next:e=>{this.searchFilter.PageNumber=1,this.paginationService.getAllData(this.searchFilter,e)}})}ngOnDestroy(){this.paginationService.destroy()}};o.\u0275fac=function(t){return new(t||o)(b(K),b(G),b(Z),b(Y),b(X),b(J))},o.\u0275cmp=F({type:o,selectors:[["app-price-pos-channel"]],decls:2,vars:3,consts:[["headerTitle","Price Comparison",3,"pageData","textButton","onSubmit",4,"ngIf"],["headerTitle","Price Comparison",3,"onSubmit","pageData","textButton"],[1,"d-flex"],[4,"ngIf"],[1,"fw-bold"],["type","number",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"mt-5"],[1,"container-fluid","mt-3"],[1,"row"],["class","col-md-12",4,"ngIf"],[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 border-start-0","title","Load all products",3,"click",4,"ngIf"],["type","button","class","btn btn-success shadow rounded","data-toggle","modal",3,"click",4,"ngIf"],["type","button","data-toggle","modal",1,"btn","btn-success","shadow","rounded",3,"click"],[1,"fas","fa-chevron-circle-up"],[1,"col-md-12"],["productToggleTitle","FILTER DIFFERENT PRICE","table","price",3,"onToggle","onSubmit","showProductToggle","data","channel","filter"],[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","border-start-0",3,"click"],[1,"fas","fa-share"]],template:function(t,a){t&1&&(d(0,Pt,32,22,"mainpanel",0),S(1,"async")),t&2&&p("ngIf",v(1,1,a.loader$))},dependencies:[$,de,_e,k,O,q,be,j,W],styles:[".no-bullet[_ngcontent-%COMP%]{list-style-type:none}"]});let i=o;return i})();var vt=i=>({"border-0 rounded":i});function bt(i,o){if(i&1&&(r(0,"mat-radio-button",3),m(1),c()),i&2){let n=o.$implicit,e=o.index,t=s();p("value",n.Key)("name",t.name)("title",t.tooltipsText[e]?t.tooltipsText[e]:""),l(),y(" ",n.Value,"")}}var Ie=(()=>{let o=class o{constructor(){this.modelChange=new Fe,this.border=!1,this.tooltipsText=[]}change(e){this.modelChange.emit(e)}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=F({type:o,selectors:[["radio-options"]],inputs:{model:"model",options:"options",border:"border",name:"name",tooltipsText:"tooltipsText"},outputs:{modelChange:"modelChange"},standalone:!0,features:[Ne],decls:3,vars:5,consts:[[1,"form-control","h-100","rounded-1",3,"ngClass"],[3,"ngModelChange","ngModel"],["class","me-5","data-toggle","tooltip","data-placement","right",3,"value","name","title",4,"ngFor","ngForOf"],["data-toggle","tooltip","data-placement","right",1,"me-5",3,"value","name","title"]],template:function(t,a){t&1&&(r(0,"div",0)(1,"mat-radio-group",1),C("ngModelChange",function(h){return a.change(h)}),d(2,bt,2,4,"mat-radio-button",2),c()()),t&2&&(p("ngClass",E(3,vt,a.border==!1)),l(),p("ngModel",a.model),l(),p("ngForOf",a.options))},dependencies:[z,U,A,Ze,He,Je,ge,k,O],styles:[".mat-radio-label{margin-top:auto;margin-bottom:auto}"]});let i=o;return i})();var lt=i=>[i],Dt=i=>({"text-decoration-line-through":i}),Et=i=>({"border-bottom":i}),Mt=i=>({"bg-gradient-warning":i});function Ft(i,o){if(i&1){let n=f();I(0),r(1,"div")(2,"label",25),m(3,"Filter by"),c(),r(4,"radio-options",26),D("modelChange",function(t){g(n);let a=s();return V(a.filterType,t)||(a.filterType=t),u(t)}),c()(),w()}if(i&2){let n=s();l(4),T("model",n.filterType),p("options",n.filterTypeOptions)("border",!0)}}function Nt(i,o){if(i&1){let n=f();r(0,"button",29),C("click",function(){g(n);let t=s().ngIf,a=s();return u(a.onUpdateItems(t))}),P(1,"i",30),m(2," Update "),c()}}function kt(i,o){if(i&1&&(I(0),r(1,"div",27),d(2,Nt,3,0,"button",28),c(),w()),i&2){let n=o.ngIf,e=s();l(2),p("ngIf",e.productService.hasSelectionVariant(n))}}function Ot(i,o){if(i&1&&(r(0,"th",31)(1,"div",32),P(2,"img",33),r(3,"div",34),m(4),S(5,"stringLimit"),c()()()),i&2){let n=o.$implicit;l(),p("matTooltip",(n.Name==null?null:n.Name.length)>20?n.Name:""),l(),p("src",n==null?null:n.Img,M),l(2),ce("",se(5,4,n.Name,20),"",(n.Name==null?null:n.Name.length)>20?"...":"","")}}function Lt(i,o){if(i&1){let n=f();r(0,"th")(1,"input",35),D("ngModelChange",function(t){g(n);let a=s();return V(a.checkboxState,t)||(a.checkboxState=t),u(t)}),C("ngModelChange",function(){g(n);let t=s();return u(t.onSelectAllData())}),c()()}if(i&2){let n=s();l(),T("ngModel",n.checkboxState)}}function Rt(i,o){i&1&&(I(0),r(1,"th",36)(2,"span"),m(3,"Expected"),c(),r(4,"span",37),m(5,"(POS)"),c()(),r(6,"th",36),m(7," Channel "),c(),w())}function Bt(i,o){if(i&1){let n=f();r(0,"img",49),C("click",function(t){g(n);let a=s(3).$implicit,_=s(2);return u(_.onZoomImage(t,a==null?null:a.ImageUrl))}),c()}if(i&2){let n=s(3).$implicit;le("src",n==null?null:n.ImageUrl,M)}}function Ut(i,o){i&1&&P(0,"img",50)}function At(i,o){if(i&1&&(I(0),r(1,"td",44),d(2,Bt,1,1,"img",45)(3,Ut,1,0,"ng-template",null,0,ne),c(),r(5,"td",46)(6,"h5",47),m(7),c(),r(8,"small",48),m(9),c()(),w()),i&2){let n=te(4),e=s().index,t=s().$implicit,a=s().ngIf;l(),p("rowSpan",t==null?null:t.Variants.length)("ngClass",E(7,Et,e+1==a.length)),l(),p("ngIf",t==null?null:t.ImageUrl)("ngIfElse",n),l(3),p("rowSpan",t==null?null:t.Variants.length),l(2),N(t==null?null:t.Name),l(2),y("(",t==null?null:t.Category,")")}}function $t(i,o){if(i&1){let n=f();r(0,"td",51)(1,"input",35),D("ngModelChange",function(t){g(n);let a=s().$implicit;return V(a.selected,t)||(a.selected=t),u(t)}),c()()}if(i&2){let n=s().$implicit;l(),T("ngModel",n.selected)}}function jt(i,o){if(i&1){let n=f();I(0),r(1,"td",53),m(2),S(3,"number"),c(),r(4,"td",54),C("click",function(){let t=g(n).$implicit,a=s(2).$implicit,_=s().$implicit,h=s(2);return u(h.openTableDialog(a,_,t))}),r(5,"div",55)(6,"div",56),m(7),S(8,"number"),c(),r(9,"a",57),C("click",function(t){return g(n),u(t==null?null:t.stopPropagation())}),P(10,"i",43),c()()(),w()}if(i&2){let n=o.$implicit;l(2),y(" ",v(3,4,n.PriceExpected)," "),l(2),p("ngClass",E(8,Mt,n.Price!=n.PriceExpected)),l(3),y(" ",v(8,6,n.Price)," "),l(2),p("href",n.Url,M)}}function Wt(i,o){i&1&&(r(0,"td",58),m(1,"X"),c(),r(2,"td",58),m(3,"X"),c())}function zt(i,o){if(i&1&&(I(0),d(1,jt,11,10,"ng-container",52)(2,Wt,4,0,"ng-template",null,1,ne),w()),i&2){let n=o.$implicit,e=te(3),t=s().$implicit,a=s(3);l(),p("ngIf",a.getItemFromChannel(t,n.ID))("ngIfElse",e)}}function Gt(i,o){if(i&1&&(r(0,"tr"),d(1,At,10,9,"ng-container",3),r(2,"td",38),m(3),c(),r(4,"td",39)(5,"div",40)(6,"div",41),m(7),c(),r(8,"div",34)(9,"a",42),P(10,"i",43),c()()()(),d(11,$t,2,1,"ng-template",16)(12,zt,4,2,"ng-container",17),c()),i&2){let n=o.$implicit,e=o.index,t=s(3);l(),p("ngIf",e==0),l(2),N(n==null?null:n.Model),l(),p("matTooltip",n.isDiscontinued?t.discontinuedVariantMsg:""),l(2),p("ngClass",E(8,Dt,n.isDiscontinued)),l(),y(" ",n==null?null:n.Code,""),l(2),p("href",t.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(n==null?null:n.ID),M),l(2),p("ngxPermissionsOnly",E(10,lt,t.rolePriceEdit)),l(),p("ngForOf",t.channelOptions)}}function Kt(i,o){if(i&1&&(r(0,"tbody"),d(1,Gt,13,12,"tr",17),c()),i&2){let n=o.$implicit;l(),p("ngForOf",n.Variants)}}function Ht(i,o){if(i&1&&(I(0),d(1,Kt,2,1,"tbody",17),w()),i&2){let n=o.ngIf;l(),p("ngForOf",n)}}function Jt(i,o){if(i&1){let n=f();r(0,"span",59),C("click",function(){g(n);let t=s();return u(t.getRowCount())}),r(1,"i",60),m(2,"?"),c()()}}function Zt(i,o){if(i&1&&(r(0,"span"),m(1),S(2,"number"),c()),i&2){let n=o.ngIf;l(),N(v(2,1,n))}}function qt(i,o){if(i&1){let n=f();r(0,"a",61),C("click",function(){g(n);let t=s();return u(t.onNextPage())}),P(1,"i",62),m(2," Next"),c()}}function Xt(i,o){if(i&1){let n=f();r(0,"a",63),C("click",function(){g(n);let t=s();return u(t.onLastPage())}),P(1,"i",64),m(2," Last"),c()}}var ct=(()=>{let o=class o{constructor(e,t,a,_,h,x,we){this.http=e,this.toastr=t,this.dialog=a,this.productService=_,this.authService=h,this.biggerPictureService=x,this.paginationService=we,this.searchFilter=new Ke,this.checkboxState=!1,this.rolePriceEdit=ue.price,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.rowCountAPI="Inventory/GetMultipleChannelComparisonRowCount",this.filterTypeOptions=[{Key:L.ALL,Value:"All"},{Key:L.DIFFERENCE,Value:"Difference"}],this.filterType=L.ALL,this.pageData={Title:"Price Realtime",Nav:[{Title:"Price Cache",Url:"/menu/price",Active:!1}]},this.channelOptions=this.authService.getChannels(),this.hostName=this.authService.getDomain(),this.initPagination()}initPagination(){this.paginationService.fetchDataEndpoint="Price/GetOutletPrice",this.initProduct(),this.initPageLoader()}initProduct(){this.data$=this.paginationService.data$.pipe(ee(e=>(e=e.map(t=>(t.Variants&&(t.Variants=t.Variants.map(a=>(a.isDiscontinued=a.Discontinued=="Yes",a))),t)),e)),ae(1))}initPageLoader(){this.loader$=this.http.post("/api/PriceLoader/LoadMultiple",{}).pipe(B(e=>{this.searchFilter=e.Filter,this.paginationService.reloadPagination(this.searchFilter)}))}onNextPage(){this.paginationService.onNextPage(this.searchFilter)}onLastPage(){this.paginationService.hideCount=!1,this.totalData$=this.http.post(`/api/${this.rowCountAPI}`,{}).pipe(B(e=>{this.searchFilter.PageNumber=1,this.paginationService.getAllData(this.searchFilter,e)}))}getRowCount(){this.paginationService.hideCount=!1,this.totalData$=this.http.post(`/api/${this.rowCountAPI}`,{})}onSelectAllData(){this.data$=this.data$.pipe(ee(e=>(e.map(t=>(t.Variants&&(t.Variants=t.Variants.map(a=>(a.selected=this.checkboxState,a))),t)),e)))}onFilter(e){let t={text:e,filterModel:this.filterType,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount};this.paginationService.reloadPagination(t)}updatePrice(e){let t=this.productService.selectedVariantProduct(e);if(t.length>0){let a=t.map(x=>x.ID),h={ListChannelID:this.channelOptions.filter(x=>x.selected).map(x=>x.ID),ListID:a};this.http.post("/api/Price/UpdateChannelOutletPrice",h).subscribe({next:x=>{this.resetSelectedChannel(),this.onFilter(),this.toastr.success("Successfully updated "+h.ListID.length+" items in "+h.ListChannelID.length+" channels","Success")},error:x=>{this.resetSelectedChannel()}})}}resetSelectedChannel(){this.channelOptions=this.channelOptions.map(e=>(e.selected=!1,e))}getItemFromChannel(e,t){return e.Channel.find(a=>a.ChannelID==t)}onUpdateItems(e){let t=this.productService.selectedVariantProduct(e);this.dialog.open(Se,{data:{selectedItems:t,channels:this.channelOptions},width:"600px"}).afterClosed().pipe(R(a=>H.IsNotEmpty(a))).subscribe(a=>{this.channelOptions=a,this.updatePrice(e)})}openTableDialog(e,t,a){let _=JSON.parse(JSON.stringify(e));this.dialog.open(Pe,{data:{Name:t.Name,Variant:_,ChannelID:a?.ChannelID,Table:"price",ChannelItemID:a?.ChannelItemID}}).afterClosed().pipe(R(x=>H.IsNotEmpty(x))).subscribe(x=>{this.updateProductPrice(x,a)})}updateProductPrice(e,t){let a={ID:e.ChannelID,ChannelItemID:e.ChannelItemID,ChannelVariantID:e.ChannelVariationID,Price:parseFloat(e.Price),VariantID:e.ID,SKU:e.Sku};this.http.post("/api/Price/UpdatePriceByID",a).subscribe(_=>{t.Price=a.Price;let h=this.productService.findChannelById(a.ID,this.channelOptions);this.toastr.success(`Successfully updated ${e.ItemName} (${e.VarName}) inventory in ${h.Name} to ${a.Price}`,"Success")})}onZoomImage(e,t){this.biggerPictureService.openBiggerPicture(e,t)}ngOnDestroy(){this.paginationService.destroy()}};o.\u0275fac=function(t){return new(t||o)(b(K),b(G),b(Z),b(X),b(J),b(xe),b(Y))},o.\u0275cmp=F({type:o,selectors:[["app-custom-channel-price"]],decls:42,vars:30,consts:[["elsePic",""],["elseCol",""],["headerTitle","Price Comparison",3,"onSubmit","pageData","hideSearchBox","hideSearchDropdown","textButton"],[4,"ngIf"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],[1,"channel-column"],["colspan","5"],["scope","col","colspan","2","class","text-center border-bottom-0 border text-uppercase",4,"ngFor","ngForOf"],["scope","col","colspan","2",1,"text-center","w-25"],["scope","col",1,"text-start","w-20"],["scope","col",1,"text-end","w-10"],[3,"ngxPermissionsOnly"],[4,"ngFor","ngForOf"],[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 border-start-0","title","Load all products",3,"click",4,"ngIf"],[1,"fw-bold","mb-2"],["name","filterModel",3,"modelChange","model","options","border"],[1,"d-flex"],["type","button","class","btn btn-success shadow rounded","data-toggle","modal",3,"click",4,"ngIf"],["type","button","data-toggle","modal",1,"btn","btn-success","shadow","rounded",3,"click"],[1,"fas","fa-chevron-circle-up"],["scope","col","colspan","2",1,"text-center","border-bottom-0","border","text-uppercase"],["matTooltipPosition","above",1,"d-flex","align-items-center","justify-content-center",2,"width","180px",3,"matTooltip"],[2,"width","16px","height","16px",3,"src"],[1,"ms-2"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"text-end","border-top-0","border","w-10"],[1,"ms-1"],[1,"text-start","border-bottom"],["matTooltipPosition","above",1,"text-end","border-bottom",3,"matTooltip"],[1,"d-flex","align-items-center","justify-content-end"],[3,"ngClass"],["target","_blank",3,"href"],[1,"fas","fa-lg","fa-external-link-alt","external-link-custom"],[1,"text-center",3,"rowSpan","ngClass"],["class","border rounded w-img cursor-pointer",3,"src","click",4,"ngIf","ngIfElse"],[1,"text-start","border-bottom",2,"padding-left","0px",3,"rowSpan"],[1,"mb-0","item-name"],[1,"mt-1"],[1,"border","rounded","w-img","cursor-pointer",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded","w-img"],[1,"align-middle"],[4,"ngIf","ngIfElse"],[1,"text-end","border"],[1,"text-center","border","pointer","cell-hover",3,"click","ngClass"],[1,"d-flex","align-items-center","justify-content-center"],[1,"me-2"],["target","_blank",3,"click","href"],[1,"table-white","border","text-end",2,"color","red"],[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","border-start-0",3,"click"],[1,"fas","fa-share"]],template:function(t,a){if(t&1&&(r(0,"mainpanel",2),C("onSubmit",function(h){return a.onFilter(h)}),r(1,"filters"),d(2,Ft,5,3,"ng-container",3),S(3,"async"),c(),r(4,"actions"),d(5,kt,3,1,"ng-container",3),S(6,"async"),c(),r(7,"content")(8,"div",4)(9,"div",5)(10,"div",6)(11,"div",7)(12,"table",8)(13,"thead",9)(14,"tr",10),P(15,"th",11),d(16,Ot,6,7,"th",12),c(),r(17,"tr")(18,"th",13)(19,"span"),m(20," Product "),c()(),r(21,"th",14),m(22,"Variant"),c(),r(23,"th",15),m(24,"SKU"),c(),d(25,Lt,2,1,"ng-template",16)(26,Rt,8,0,"ng-container",17),c()(),d(27,Ht,2,1,"ng-container",3),S(28,"async"),c()()()(),r(29,"div",18)(30,"div",19)(31,"div",20),m(32),S(33,"async"),S(34,"number"),d(35,Jt,3,0,"span",21)(36,Zt,3,3,"span",3),S(37,"async"),m(38),c()(),r(39,"div",22),d(40,qt,3,0,"a",23)(41,Xt,3,0,"a",24),c()()()()()),t&2){let _;p("pageData",a.pageData)("hideSearchBox",!1)("hideSearchDropdown",!1)("textButton","Search"),l(2),p("ngIf",v(3,16,a.loader$)),l(3),p("ngIf",v(6,18,a.data$)),l(11),p("ngForOf",a.channelOptions),l(9),p("ngxPermissionsOnly",E(28,lt,a.rolePriceEdit)),l(),p("ngForOf",a.channelOptions),l(),p("ngIf",v(28,20,a.data$)),l(5),y(" Showing 1 - ",v(34,24,(_=v(33,22,a.paginationService.data$))==null?null:_.length)," of "),l(3),p("ngIf",a.paginationService.hideCount),l(),p("ngIf",!a.paginationService.hideCount&&v(37,26,a.totalData$)),l(2),y(" records ~ ",a.paginationService.footerPageNumber," Page "),l(2),p("ngIf",a.paginationService.disableNextButton&&!a.paginationService.goToLastPage),l(),p("ngIf",a.paginationService.disableNextButton&&!a.paginationService.goToLastPage)}},dependencies:[U,A,$,me,k,O,q,fe,Ie,he,j,W,ve],styles:[".w-10[_ngcontent-%COMP%]{width:10%}.w-20[_ngcontent-%COMP%]{width:20%}.w-img[_ngcontent-%COMP%]{width:40px;height:40px}.item-name[_ngcontent-%COMP%]{font-weight:400;font-size:larger}.cell-hover[_ngcontent-%COMP%]:hover{background-color:#c9c9c9!important}"]});let i=o;return i})();var Ee=i=>[i],Yt=i=>({"text-decoration-line-through":i}),Qt=i=>({"bg-gradient-warning":i}),en=i=>({"ms-10":i});function tn(i,o){if(i&1&&(r(0,"span",10),P(1,"img",11),c(),m(2)),i&2){let n=o.item;l(),p("src",n==null?null:n.Img,M),l(),y(" ",n.Name," ")}}function nn(i,o){if(i&1){let n=f();r(0,"button",16),C("click",function(){g(n);let t=s().ngIf,a=s(2);return u(a.updateStock(t))}),P(1,"i",17),m(2," Update "),c()}}function an(i,o){if(i&1){let n=f();r(0,"actions")(1,"div",12),d(2,nn,3,0,"button",13),r(3,"button",14),C("click",function(){g(n);let t=s(2);return u(t.Export())}),P(4,"i",15),r(5,"span"),m(6,"Export"),c()()()()}if(i&2){let n=o.ngIf,e=s(2);l(2),p("ngIf",e.productService.hasSelectionVariant(n))}}function on(i,o){if(i&1){let n=f();r(0,"th")(1,"input",37),C("change",function(t){g(n);let a=s().ngIf,_=s(2);return u(_.onSelectAllSKU(t.target.checked,a))}),c()()}}function rn(i,o){if(i&1){let n=f();r(0,"input",54),D("ngModelChange",function(t){g(n);let a=s(4).$implicit;return V(a.selected,t)||(a.selected=t),u(t)}),C("ngModelChange",function(){g(n);let t=s(4).$implicit,a=s(3);return u(a.onCheckboxStateProduct(t))}),c()}if(i&2){let n=s(4).$implicit;T("ngModel",n.selected)}}function ln(i,o){if(i&1&&(I(0),d(1,rn,1,1,"ng-template",26),w()),i&2){let n=s(6);l(),p("ngxPermissionsOnly",E(1,Ee,n.rolePriceEdit))}}function cn(i,o){if(i&1){let n=f();I(0),r(1,"img",55),C("click",function(t){g(n);let a=s(3).$implicit,_=s(3);return u(_.onZoomImage(t,a==null?null:a.ImageUrl))}),c(),w()}if(i&2){let n=s(3).$implicit;l(),le("src",n.ThumbnailUrl,M)}}function sn(i,o){i&1&&P(0,"img",56)}function pn(i,o){if(i&1&&(I(0),P(1,"br"),r(2,"small"),m(3),c(),w()),i&2){let n=s(3).$implicit;l(3),y("(",n.Category,")")}}function mn(i,o){if(i&1&&(I(0),r(1,"td",49)(2,"div",50),d(3,ln,2,3,"ng-container",9),r(4,"div",39),d(5,cn,2,1,"ng-container",51)(6,sn,1,0,"ng-template",null,0,ne),c()()(),r(8,"td",52)(9,"span",53),m(10),c(),d(11,pn,4,1,"ng-container",9),c(),w()),i&2){let n=te(7),e=s(2).$implicit,t=s(3);l(),p("rowSpan",e.Variants.length),l(2),p("ngIf",(e.Variants==null?null:e.Variants.length)>1),l(),p("ngClass",E(8,en,(e.Variants==null?null:e.Variants.length)<=1)),l(),p("ngIf",e.ThumbnailUrl)("ngIfElse",n),l(3),p("rowSpan",e.Variants.length),l(2),N(e.Name),l(),p("ngIf",(e==null?null:e.CategoryID)!==null&&(e==null?null:e.CategoryID)!=t.guidEmpty)}}function dn(i,o){if(i&1){let n=f();r(0,"input",59),D("ngModelChange",function(t){g(n);let a=s(2).$implicit;return V(a.selected,t)||(a.selected=t),u(t)}),c()}if(i&2){let n=s(2).$implicit;T("ngModel",n.selected)}}function _n(i,o){if(i&1&&(r(0,"td",57),d(1,dn,1,1,"input",58),c()),i&2){let n=s().$implicit;l(),p("ngIf",n.Inventory>=0)}}function gn(i,o){i&1&&(r(0,"div",60),m(1,"Not Found"),c())}function un(i,o){if(i&1&&(r(0,"div"),m(1),S(2,"number"),c()),i&2){let n=s().$implicit;l(),y(" ",v(2,1,n.UnitPrice),"")}}function hn(i,o){if(i&1&&(I(0),r(1,"div",44)(2,"a",45),P(3,"i",61),c()(),w()),i&2){let n=s().$implicit,e=s(4);l(2),p("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(n==null?null:n.ID),M)}}function Cn(i,o){if(i&1){let n=f();r(0,"div",62),C("click",function(){g(n);let t=s().$implicit,a=s().$implicit,_=s(2).ngIf,h=s();return u(h.openTableDialog(t,a,_))}),m(1),S(2,"number"),c()}if(i&2){let n=s().$implicit;l(),y(" ",v(2,1,n.Channel[0]==null?null:n.Channel[0].Price)," ")}}function fn(i,o){if(i&1){let n=f();r(0,"tr"),d(1,mn,12,10,"ng-container",9),r(2,"td",24),m(3),c(),r(4,"td",38)(5,"span",39),m(6),c()(),d(7,_n,2,1,"ng-template",26),r(8,"td",27)(9,"div",40),d(10,gn,2,0,"div",41)(11,un,3,3,"div",9)(12,hn,4,1,"ng-container",9),c()(),r(13,"td",42)(14,"div",40),d(15,Cn,3,3,"div",43),r(16,"div",44)(17,"a",45),P(18,"i",46),c()(),r(19,"div",44)(20,"div",47),C("click",function(){let t=g(n).$implicit,a=s(4);return u(a.refreshPrice(t))}),P(21,"i",48),c()()()()()}if(i&2){let n=o.$implicit,e=o.index,t=s(4);l(),p("ngIf",e==0),l(2),N(n.Model),l(),p("matTooltip",n.isDiscontinued?t.discontinuedVariantMsg:""),l(),p("ngClass",E(12,Yt,n.isDiscontinued)),l(),y(" ",n.Code," "),l(),p("ngxPermissionsOnly",E(14,Ee,t.rolePriceEdit)),l(3),p("ngIf",(n.Channel[0]==null?null:n.Channel[0].Description)!=null),l(),p("ngIf",(n.Channel[0]==null?null:n.Channel[0].Description)==null),l(),p("ngIf",(n.Channel[0]==null?null:n.Channel[0].Description)==null),l(),p("ngClass",E(16,Qt,n.UnitPrice!=(n.Channel[0]==null?null:n.Channel[0].Price))),l(2),p("ngIf",n.Channel.length>0),l(2),p("href",n.Channel[0]==null?null:n.Channel[0].Url,M)}}function xn(i,o){if(i&1&&(I(0),d(1,fn,22,18,"tr",31),w()),i&2){let n=o.$implicit;l(),p("ngForOf",n.Variants)}}function Sn(i,o){if(i&1){let n=f();r(0,"span",62),C("click",function(){g(n);let t=s(3);return u(t.getRowCount())}),r(1,"i",63),m(2,"?"),c()()}}function Pn(i,o){if(i&1&&(r(0,"span"),m(1),S(2,"number"),c()),i&2){let n=o.ngIf;l(),N(v(2,1,n.Total))}}function vn(i,o){if(i&1){let n=f();r(0,"a",67),C("click",function(){g(n);let t=s(4);return u(t.onNextPage())}),P(1,"i",68),m(2," Next"),c()}}function bn(i,o){if(i&1){let n=f();r(0,"a",69),C("click",function(){g(n);let t=s(4);return u(t.onLastPage())}),P(1,"i",70),m(2," Last"),c()}}function yn(i,o){if(i&1&&(r(0,"div",64),d(1,vn,3,0,"a",65)(2,bn,3,0,"a",66),c()),i&2){let n=s(3);l(),p("ngIf",n.paginationService.disableNextButton&&!n.paginationService.goToLastPage),l(),p("ngIf",n.paginationService.disableNextButton&&!n.paginationService.goToLastPage)}}function In(i,o){if(i&1){let n=f();r(0,"content")(1,"div",18)(2,"div",19)(3,"table",20)(4,"thead",21)(5,"tr")(6,"th",22),m(7," Product "),r(8,"div")(9,"mat-slide-toggle",23),D("ngModelChange",function(t){g(n);let a=s(2);return V(a.toggleDifferentInventory,t)||(a.toggleDifferentInventory=t),u(t)}),C("toggleChange",function(){g(n);let t=s(2);return u(t.onToggleDifferentInventory())}),r(10,"small",7),m(11,"FILTER DIFFERENT PRICE"),c()()()(),r(12,"th",24),m(13,"Variant"),c(),r(14,"th",25),m(15,"SKU"),c(),d(16,on,2,0,"ng-template",26),r(17,"th",27),m(18,"POS"),c(),r(19,"th",27)(20,"div",28),C("click",function(){g(n);let t=s(2);return u(t.openModalFilter())}),P(21,"img",29),r(22,"span",30),m(23),S(24,"stringLimit"),c()()()()(),r(25,"tbody"),d(26,xn,2,1,"ng-container",31),c()(),r(27,"div",32)(28,"div",33)(29,"div",34),m(30),S(31,"number"),d(32,Sn,3,0,"span",35)(33,Pn,3,3,"span",9),S(34,"async"),m(35),c()(),d(36,yn,3,2,"div",36),c()()()()}if(i&2){let n=o.ngIf,e=s(2);l(9),T("ngModel",e.toggleDifferentInventory),l(7),p("ngxPermissionsOnly",E(19,Ee,e.rolePriceEdit)),l(4),p("matTooltip",(e.selectedChannel==null||e.selectedChannel.Name==null?null:e.selectedChannel.Name.length)>=20?e.selectedChannel==null?null:e.selectedChannel.Name:""),l(),p("src",e.selectedChannel==null?null:e.selectedChannel.Img,M),l(2),ce(" ",se(24,12,e.selectedChannel==null?null:e.selectedChannel.Name,20),"",(e.selectedChannel==null||e.selectedChannel.Name==null?null:e.selectedChannel.Name.length)>=20?"...":""," "),l(3),p("ngForOf",n),l(4),y(" Showing 1 - ",v(31,15,n==null?null:n.length)," of "),l(2),p("ngIf",e.paginationService.hideCount),l(),p("ngIf",v(34,17,!e.paginationService.hideCount&&e.allDataCount$)),l(2),y(" records ~ ",e.paginationService.footerPageNumber," Page "),l(),p("ngIf",n.length>0)}}function wn(i,o){if(i&1){let n=f();r(0,"mainpanel",2),D("textChange",function(t){g(n);let a=s();return V(a.searchFilter.text,t)||(a.searchFilter.text=t),u(t)}),C("onSubmit",function(){g(n);let t=s();return u(t.onSearch())}),r(1,"filters")(2,"div")(3,"label",3),m(4,"Channel"),c(),r(5,"ng-select",4),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.ChannelID,t)||(a.searchFilter.ChannelID=t),u(t)}),d(6,tn,3,2,"ng-template",5),c()(),r(7,"div",6)(8,"label",7),m(9,"Page Number"),c(),r(10,"input",8),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.PageNumber,t)||(a.searchFilter.PageNumber=t),u(t)}),c()(),r(11,"div",6)(12,"label",7),m(13,"Page Size"),c(),r(14,"input",8),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.RowCount,t)||(a.searchFilter.RowCount=t),u(t)}),c()()(),d(15,an,7,1,"actions",9),S(16,"async"),d(17,In,37,21,"content",9),S(18,"async"),c()}if(i&2){let n=s();p("headerTitle",n.pageTitle),T("text",n.searchFilter.text),l(5),p("clearable",!1)("items",n.channelOptions),T("ngModel",n.searchFilter.ChannelID),l(5),T("ngModel",n.searchFilter.PageNumber),l(4),T("ngModel",n.searchFilter.RowCount),l(),p("ngIf",v(16,9,n.data$)),l(2),p("ngIf",v(18,11,n.data$))}}var st=(()=>{let o=class o{constructor(e,t,a,_,h,x,we,Me,dt){this.http=e,this.paginationService=t,this.toastr=a,this.dialog=_,this.productService=h,this.biggerPictureService=x,this.inventoryService=we,this.authService=Me,this.mainPanelService=dt,this.pageTitle="Price Single Channel Comparison",this.toggleDifferentInventory=!1,this.loaderEndpoint="PriceLoader/Load",this.dataEndpoint="Price/GetSingleChannelComparison",this.allDataCountEndpoint="Inventory/GetInventoryByChannelRowCount",this.rolePriceEdit=ue.price,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.guidEmpty=H.GuidEMpty,this.hostName=this.authService.getDomain(),this.data$=this.paginationService.data$.pipe(ae(1),ee(_t=>_t.map(ie=>(ie.Variants&&(ie.Variants=ie.Variants.map(Te=>(Te.isDiscontinued=Te.Discontinued=="Yes",Te))),ie)))),this.channelOptions=Me.getChannels()}ngOnInit(){this.initPageLoader()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.dataEndpoint,this.loader$=this.http.post(`/API/${this.loaderEndpoint}`).pipe(B(e=>{this.searchFilter=e.Filter,this.searchFilter.filterModel=L.ALL,this.paginationService.reloadPagination(this.searchFilter),this.initSelectedChannel()}))}onToggleDifferentInventory(){this.toggleDifferentInventory?this.searchFilter.filterModel=L.ALL:this.searchFilter.filterModel=L.DIFFERENCE,this.onSearch()}onCheckboxStateProduct(e){e.Variants=e.Variants.map(t=>(t.selected=e.selected,t))}openModalFilter(){this.mainPanelService.openModalFilter()}updateStock(e){let a=this.productService.selectedVariantProduct(e).map(h=>({ID:h.ID,ChannelID:h.Channel[0].ChannelID,Code:h.Code,Price:h.UnitPrice})),_={ListChannelID:[this.searchFilter.ChannelID],ListPrice:a};this.http.post("/api/Price/UpdateChannel",_).subscribe(h=>{this.onSearch(),this.handlingUpdateStock(h.Response)})}handlingUpdateStock(e){if(e.success_list.length>0||e.failure_list.length>0){let t=e.failure_list,a=e.success_list;this.inventoryService.showToastrUpdateInventory("Price",a,t)}else this.toastr.error(e[0]?.Exception,"Error")}refreshPrice(e){let t={ChannelItemID:e?.Channel[0].ChannelItemID,ChannelVariationID:e?.Channel[0]?.ChannelVariationID,ChannelID:e?.Channel[0]?.ChannelID,VariantID:e.ID};this.http.post("/api/Price/RefreshPriceChannel",t).subscribe(a=>{this.toastr.success("Successfully updated","Success"),this.onSearch()})}onSearch(){this.paginationService.reloadPagination(this.searchFilter),this.initSelectedChannel()}getRowCount(){this.paginationService.hideCount=!1,this.allDataCount$=this.http.post(`/API/${this.allDataCountEndpoint}`,this.searchFilter)}onNextPage(){this.paginationService.onNextPage(this.searchFilter)}onLastPage(){this.http.post(`/API/${this.allDataCountEndpoint}`,this.searchFilter).subscribe({next:e=>{this.searchFilter.PageNumber=1,this.paginationService.getAllData(this.searchFilter,e.Total)}})}openTableDialog(e,t,a){let _=JSON.parse(JSON.stringify(e));this.dialog.open(Pe,{data:{Name:t.Name,Variant:_,ChannelID:_?.Channel[0]?.ChannelID,Table:"price",ChannelItemID:_?.Channel[0]?.ChannelItemID}}).afterClosed().pipe(R(x=>H.IsNotEmpty(x))).subscribe(x=>{this.updateItemAfterDialog(x,e)})}updateItemAfterDialog(e,t){let a={ID:e.ChannelID,ChannelItemID:e.ChannelItemID,ChannelVariantID:e.ChannelVariationID,Price:parseFloat(e.Price),VariantID:e.ID,SKU:e.Sku};this.http.post("/api/Price/UpdatePriceByID",a).subscribe(_=>{let h=this.productService.findChannelById(a.ID,this.channelOptions);this.toastr.success(`Successfully updated ${e.ItemName} (${e.VarName}) inventory in ${h.Name} to ${a.Price}`,"Success"),t.Channel[0]&&(t.Channel[0].Price=a.Price)})}initSelectedChannel(){this.selectedChannel=this.channelOptions.find(e=>e.ID==this.searchFilter.ChannelID)}onSelectAllSKU(e,t){t=t.map(a=>(a.Variants=a.Variants.map(_=>(_.selected=e,_)),a))}onZoomImage(e,t){this.biggerPictureService.openBiggerPicture(e,t)}Export(){let e={ChannelID:this.searchFilter.ChannelID,IsMarketplaceAppActive:this.searchFilter.IsMarketplaceAppActive,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount,filterModel:this.searchFilter.filterModel};this.http.postFile("/api/price/GetExportSingleChannelComparison",e).subscribe(t=>{let a=window.URL.createObjectURL(t.file),_=document.createElement("a");_.download=this.getFilenameFromContentDisposition(t.title),_.href=a,_.click(),URL.revokeObjectURL(a),_.remove()})}getFilenameFromContentDisposition(e){let a=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(e);return a!=null&&a[1]?a[1].replace(/['"]/g,""):""}ngOnDestroy(){this.paginationService.destroy()}};o.\u0275fac=function(t){return new(t||o)(b(K),b(Y),b(G),b(Z),b(X),b(xe),b(ye),b(J),b(je))},o.\u0275cmp=F({type:o,selectors:[["app-price-single-channel"]],decls:2,vars:3,consts:[["elsePic",""],[3,"headerTitle","text","textChange","onSubmit",4,"ngIf"],[3,"textChange","onSubmit","headerTitle","text"],[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","","ng-label-tmp",""],[1,"mt-5"],[1,"fw-bold"],["type","number",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[4,"ngIf"],[1,"me-2"],[2,"width","18px",3,"src"],[1,"d-flex"],["class","btn btn-success",3,"click",4,"ngIf"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"btn","btn-success",3,"click"],[1,"fas","fa-chevron-circle-up"],[1,"container-fluid","mt-5"],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],["colspan","2",1,"text-center","ps-12",2,"width","36%"],["name","differentInventory",3,"ngModelChange","toggleChange","ngModel"],[1,"text-start"],[1,"text-end",2,"width","20%"],[3,"ngxPermissionsOnly"],[1,"text-end"],["role","button","matTooltipPosition","above",1,"d-inline-block",3,"click","matTooltip"],[2,"width","16px",3,"src"],[1,"ms-1"],[4,"ngFor","ngForOf"],[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"],["class","btn-group",4,"ngIf"],["type","checkbox",1,"me-3",3,"change"],["matTooltipPosition","above",1,"text-end",3,"matTooltip"],[3,"ngClass"],[1,"d-flex","align-items-center","justify-content-end"],["class","text-danger","matTooltip","This product is no longer available in POS","matTooltipPosition","above",4,"ngIf"],[1,"text-end",3,"ngClass"],["style","cursor: pointer;",3,"click",4,"ngIf"],[1,"ms-3"],["target","_blank",3,"href"],[1,"fas","external-link-custom","fa-lg","fa-external-link-alt"],["matTooltip","Refresh Unit Price according to seller center",1,"pl-5","cursor-pointer",2,"color","var(--bs-link-color)",3,"click"],[1,"fas","external-link-custom","fa-sync","fa-lg"],[1,"text-start",2,"width","0%",3,"rowSpan"],[1,"d-flex","align-items-center","justify-content-start"],[4,"ngIf","ngIfElse"],[1,"text-start",3,"rowSpan"],[1,"item-name","mb-0"],["type","checkbox",1,"me-3",3,"ngModelChange","ngModel"],[1,"border","rounded","w-img","cursor-pointer",2,"margin-left","20px",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded","w-img",2,"margin-left","20px"],[1,"align-middle"],["type","checkbox",3,"ngModel","ngModelChange",4,"ngIf"],["type","checkbox",3,"ngModelChange","ngModel"],["matTooltip","This product is no longer available in POS","matTooltipPosition","above",1,"text-danger"],[1,"fas","external-link-custom","fa-external-link-alt"],[2,"cursor","pointer",3,"click"],["title","Retreive rows count",1,"border","p-3"],[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 border-start-0","title","Load all products",3,"click",4,"ngIf"],["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","border-start-0",3,"click"],[1,"fas","fa-share"]],template:function(t,a){t&1&&(d(0,wn,19,13,"mainpanel",1),S(1,"async")),t&2&&p("ngIf",v(1,1,a.loader$))},dependencies:[U,A,$,de,_e,me,k,O,q,Ue,Re,Be,Xe,fe,he,j,W,ve],styles:[".w-img[_ngcontent-%COMP%]{width:40px;height:40px}input[type=checkbox][_ngcontent-%COMP%]{width:15px;height:15px}i.fas.custom-size[_ngcontent-%COMP%]{font-size:13px}.item-name[_ngcontent-%COMP%]{font-size:larger}"]});let i=o;return i})();var pt=(()=>{let o=class o{constructor(){this.priceTabs=[{Title:"Single Channel Comparison",Url:"/menu/price/SingleChannel"},{Title:"Multi Channel Comparison",Url:"/menu/price/pos"},{Title:"Custom Channel Price",Url:"/menu/price/OutletPrice"}]}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=F({type:o,selectors:[["app-price"]],decls:5,vars:1,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid"],[3,"Tabs"]],template:function(t,a){t&1&&(r(0,"nav",0)(1,"div",1)(2,"div"),P(3,"nav-tab",2),c()()(),P(4,"router-outlet")),t&2&&(l(3),p("Tabs",a.priceTabs))},dependencies:[ze,ke]});let i=o;return i})();var Tn=[{path:"",component:pt,children:[{path:"",redirectTo:"SingleChannel",pathMatch:"full"},{path:"pos",component:rt,canActivate:[Ce],data:{title:"Global Price Comparison"}},{path:"OutletPrice",component:ct,canActivate:[Ce],data:{title:"Outlet Price Comparison"}},{path:"SingleChannel",component:st,canActivate:[Ce],data:{title:"Price Single Channel Comparison"}}]}],mt=(()=>{let o=class o{};o.\u0275fac=function(t){return new(t||o)},o.\u0275mod=re({type:o}),o.\u0275inj=oe({imports:[z,pe.forChild(Tn)]});let i=o;return i})();var Ui=(()=>{let o=class o{};o.\u0275fac=function(t){return new(t||o)},o.\u0275mod=re({type:o}),o.\u0275inj=oe({providers:[ye],imports:[z,ge,Ge,We,pe,Ae,mt,Oe,Ye,qe,$e,Ie,be,Le.forChild()]});let i=o;return i})();export{Ui as PriceModule};
|
|
1
|
+
import{a as Ke}from"./chunk-IWVYX6KY.js";import{a as He,b as Je,c as Ze}from"./chunk-G5LCLRIW.js";import{a as L,b as Pe,c as ve,d as be,e as ye}from"./chunk-QKSDQVPL.js";import{a as Se}from"./chunk-WQ7LUTQ2.js";import{b as qe}from"./chunk-BMZAGAK3.js";import{a as Xe,b as Ye}from"./chunk-N4S3Q3EC.js";import{a as ue}from"./chunk-662E5VTA.js";import{a as Y}from"./chunk-KBYAFLE5.js";import{a as X}from"./chunk-U5YOE633.js";import"./chunk-INNTQ5YN.js";import{a as ze,b as Ge}from"./chunk-SRYGE2HW.js";import{a as xe}from"./chunk-MYMGWQRE.js";import"./chunk-DT3B54LD.js";import{a as Re,b as Be,d as Ue,e as Ae}from"./chunk-AL67KXJV.js";import{a as Ce}from"./chunk-JDGPUKXR.js";import{g as J}from"./chunk-ZLBTBS3M.js";import{b as G,e as K}from"./chunk-K3G6FMDF.js";import"./chunk-JM3LERUP.js";import{B as je,C as q,D as We,q as fe,r as $e,u as Z}from"./chunk-ZKBLXGXT.js";import"./chunk-6B64VOO7.js";import{b as me,c as de,h as k,k as O,m as _e,u as ge,v as Oe}from"./chunk-SP6QPE3M.js";import{c as H,e as he,f as Le}from"./chunk-6F6NSBIF.js";import{Ab as m,B as R,Bb as N,Cb as y,Db as ce,Eb as T,Fb as V,Gb as D,Ha as M,Ia as l,Ib as Ne,Ja as b,Kb as E,Q as ae,Rb as S,Sb as v,Tb as se,Ub as ne,Wa as d,Wc as ke,X as B,Ya as p,_c as pe,aa as oe,fb as r,gb as c,ha as F,hb as P,ia as re,ib as I,ic as U,jb as w,kc as A,lb as f,lc as $,ob as C,oc as j,pa as g,q as ee,qa as u,qb as s,rc as W,sc as z,tb as le,za as Fe,zb as te}from"./chunk-6DRNAUKE.js";import"./chunk-GRMIXZTT.js";function gt(i,o){if(i&1){let n=f();r(0,"button",18),C("click",function(){g(n);let t=s().ngIf,a=s(2);return u(a.onUpdateItems(t))}),P(1,"i",19),m(2," Update "),c()}}function ut(i,o){if(i&1&&(r(0,"div"),d(1,gt,3,0,"button",17),c()),i&2){let n=o.ngIf,e=s(2);l(),p("ngIf",e.productService.hasSelectionVariant(n))}}function ht(i,o){if(i&1){let n=f();r(0,"div",20)(1,"app-table",21),S(2,"async"),C("onToggle",function(t){g(n);let a=s(2);return u(a.onShowDifferencePrice(t))})("onSubmit",function(t){g(n);let a=s(2);return u(a.updatePriceByVariant(t))}),c()()}if(i&2){let n=s().ngIf,e=s();l(),p("showProductToggle",!0)("data",v(2,4,e.paginationService.data$))("channel",e.channelOptions)("filter",n.Filter)}}function Ct(i,o){if(i&1){let n=f();r(0,"span",22),C("click",function(){g(n);let t=s(2);return u(t.getRowCount())}),r(1,"i",23),m(2,"?"),c()()}}function ft(i,o){if(i&1&&(r(0,"span"),m(1),S(2,"number"),c()),i&2){let n=o.ngIf;l(),N(v(2,1,n))}}function xt(i,o){if(i&1){let n=f();r(0,"a",24),C("click",function(){g(n);let t=s(2);return u(t.onNextPage())}),P(1,"i",25),m(2," Next"),c()}}function St(i,o){if(i&1){let n=f();r(0,"a",26),C("click",function(){g(n);let t=s(2);return u(t.onLastPage())}),P(1,"i",27),m(2," Last"),c()}}function Pt(i,o){if(i&1){let n=f();r(0,"mainpanel",1),C("onSubmit",function(t){g(n);let a=s();return u(a.onSearch(t))}),r(1,"actions")(2,"div",2),d(3,ut,2,1,"div",3),S(4,"async"),c()(),r(5,"filters")(6,"div")(7,"label",4),m(8,"Page Number"),c(),r(9,"input",5),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.PageNumber,t)||(a.searchFilter.PageNumber=t),u(t)}),c()(),r(10,"div",6)(11,"label",4),m(12,"Page Size"),c(),r(13,"input",5),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.RowCount,t)||(a.searchFilter.RowCount=t),u(t)}),c()()(),r(14,"content")(15,"div",7)(16,"div",8),d(17,ht,3,6,"div",9),S(18,"async"),c(),r(19,"div",10)(20,"div",11)(21,"div",12),m(22),S(23,"async"),S(24,"number"),d(25,Ct,3,0,"span",13)(26,ft,3,3,"span",3),S(27,"async"),m(28),c()(),r(29,"div",14),d(30,xt,3,0,"a",15)(31,St,3,0,"a",16),c()()()()()}if(i&2){let n,e=s();p("pageData",e.pageData)("textButton","Search"),l(3),p("ngIf",v(4,12,e.paginationService.data$)),l(6),T("ngModel",e.searchFilter.PageNumber),l(4),T("ngModel",e.searchFilter.RowCount),l(4),p("ngIf",v(18,14,e.paginationService.data$)),l(5),y(" Showing 1 - ",v(24,18,(n=v(23,16,e.paginationService.data$))==null?null:n.length)," of "),l(3),p("ngIf",e.paginationService.hideCount),l(),p("ngIf",!e.paginationService.hideCount&&v(27,20,e.allDataCount$)),l(2),y(" records ~ ",e.paginationService.footerPageNumber," Page "),l(2),p("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage),l(),p("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage)}}var rt=(()=>{let o=class o{constructor(e,t,a,_,h,x){this.http=e,this.toastr=t,this.dialog=a,this.paginationService=_,this.productService=h,this.authService=x,this.loaderAPI="PriceLoader/LoadMultiple",this.getDataAPI="Price/GetMultipleChannelComparison",this.rowCountAPI="Inventory/GetMultipleChannelComparisonRowCount",this.filterOptions=[{Key:1,Value:"All"},{Key:3,Value:"Difference"}],this.pageData={Title:"Price",Nav:[{Title:"Price Cache",Url:"/menu/price",Active:!0},{Title:"Price Realtime",Url:"/menu/price/realtime",Active:!1}]},this.channelOptions=this.authService.getChannels()}ngOnInit(){this.initPageLoader()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.getDataAPI,this.loader$=this.http.post(`/api/${this.loaderAPI}`).pipe(B(e=>{e.Filter={PageNumber:e.Filter.PageNumber,RowCount:e.Filter.RowCount,filterModel:1},this.searchFilter=e.Filter,this.paginationService.reloadPagination(this.searchFilter)}))}onShowDifferencePrice(e){this.searchFilter.filterModel=1,e&&(this.searchFilter.filterModel=3),this.paginationService.reloadPagination(this.searchFilter)}onSearch(e){this.searchFilter.text=e,this.paginationService.reloadPagination(this.searchFilter)}updatePrice(e){let t=this.productService.selectedVariantProduct(e);if(t.length>0){let _=t.map(x=>({ID:x.ID,Code:x.Code,Price:x.UnitPrice}));var a=this.channelOptions.filter(x=>x.selected).map(x=>x.ID);let h={ListChannelID:a,ListPrice:_};this.http.post("/api/Price/UpdateChannel",h).subscribe(x=>{this.paginationService.reloadPagination(this.searchFilter),this.toastr.success("Successfully updated "+h.ListPrice.length+" items in "+h.ListChannelID.length+" channels","Success")})}}updatePriceByVariant(e){let t={ID:e.ChannelID,ChannelItemID:e.ChannelItemID,ChannelVariantID:e.ChannelVariationID,Price:e.Price-0,VariantID:e.ID};this.http.post("/api/Price/UpdatePriceByID",t).subscribe(a=>{let _=this.productService.findChannelById(t.ID,this.channelOptions);this.toastr.success("Successfully updated "+e.ItemName+"("+e.VarName+") price in "+_.Name+" to "+t.Price,"Success"),this.paginationService.reloadPagination(this.searchFilter)})}onUpdateItems(e){let t=this.productService.selectedVariantProduct(e);this.dialog.open(Se,{data:{selectedItems:t,channels:this.channelOptions},width:"600px"}).afterClosed().pipe(R(a=>a!==void 0)).subscribe(a=>{this.channelOptions=a,this.updatePrice(e)})}getRowCount(){this.paginationService.hideCount=!1,this.allDataCount$=this.http.post(`/api/${this.rowCountAPI}`,{})}onNextPage(){this.paginationService.onNextPage(this.searchFilter)}onLastPage(){this.http.post(`/api/${this.rowCountAPI}`,{}).subscribe({next:e=>{this.searchFilter.PageNumber=1,this.paginationService.getAllData(this.searchFilter,e)}})}ngOnDestroy(){this.paginationService.destroy()}};o.\u0275fac=function(t){return new(t||o)(b(K),b(G),b(Z),b(Y),b(X),b(J))},o.\u0275cmp=F({type:o,selectors:[["app-price-pos-channel"]],decls:2,vars:3,consts:[["headerTitle","Price Comparison",3,"pageData","textButton","onSubmit",4,"ngIf"],["headerTitle","Price Comparison",3,"onSubmit","pageData","textButton"],[1,"d-flex"],[4,"ngIf"],[1,"fw-bold"],["type","number",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"mt-5"],[1,"container-fluid","mt-3"],[1,"row"],["class","col-md-12",4,"ngIf"],[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 border-start-0","title","Load all products",3,"click",4,"ngIf"],["type","button","class","btn btn-success shadow rounded","data-toggle","modal",3,"click",4,"ngIf"],["type","button","data-toggle","modal",1,"btn","btn-success","shadow","rounded",3,"click"],[1,"fas","fa-chevron-circle-up"],[1,"col-md-12"],["productToggleTitle","FILTER DIFFERENT PRICE","table","price",3,"onToggle","onSubmit","showProductToggle","data","channel","filter"],[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","border-start-0",3,"click"],[1,"fas","fa-share"]],template:function(t,a){t&1&&(d(0,Pt,32,22,"mainpanel",0),S(1,"async")),t&2&&p("ngIf",v(1,1,a.loader$))},dependencies:[$,de,_e,k,O,q,be,j,W],styles:[".no-bullet[_ngcontent-%COMP%]{list-style-type:none}"]});let i=o;return i})();var vt=i=>({"border-0 rounded":i});function bt(i,o){if(i&1&&(r(0,"mat-radio-button",3),m(1),c()),i&2){let n=o.$implicit,e=o.index,t=s();p("value",n.Key)("name",t.name)("title",t.tooltipsText[e]?t.tooltipsText[e]:""),l(),y(" ",n.Value,"")}}var Ie=(()=>{let o=class o{constructor(){this.modelChange=new Fe,this.border=!1,this.tooltipsText=[]}change(e){this.modelChange.emit(e)}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=F({type:o,selectors:[["radio-options"]],inputs:{model:"model",options:"options",border:"border",name:"name",tooltipsText:"tooltipsText"},outputs:{modelChange:"modelChange"},standalone:!0,features:[Ne],decls:3,vars:5,consts:[[1,"form-control","h-100","rounded-1",3,"ngClass"],[3,"ngModelChange","ngModel"],["class","me-5","data-toggle","tooltip","data-placement","right",3,"value","name","title",4,"ngFor","ngForOf"],["data-toggle","tooltip","data-placement","right",1,"me-5",3,"value","name","title"]],template:function(t,a){t&1&&(r(0,"div",0)(1,"mat-radio-group",1),C("ngModelChange",function(h){return a.change(h)}),d(2,bt,2,4,"mat-radio-button",2),c()()),t&2&&(p("ngClass",E(3,vt,a.border==!1)),l(),p("ngModel",a.model),l(),p("ngForOf",a.options))},dependencies:[z,U,A,Ze,He,Je,ge,k,O],styles:[".mat-radio-label{margin-top:auto;margin-bottom:auto}"]});let i=o;return i})();var lt=i=>[i],Dt=i=>({"text-decoration-line-through":i}),Et=i=>({"border-bottom":i}),Mt=i=>({"bg-gradient-warning":i});function Ft(i,o){if(i&1){let n=f();I(0),r(1,"div")(2,"label",25),m(3,"Filter by"),c(),r(4,"radio-options",26),D("modelChange",function(t){g(n);let a=s();return V(a.filterType,t)||(a.filterType=t),u(t)}),c()(),w()}if(i&2){let n=s();l(4),T("model",n.filterType),p("options",n.filterTypeOptions)("border",!0)}}function Nt(i,o){if(i&1){let n=f();r(0,"button",29),C("click",function(){g(n);let t=s().ngIf,a=s();return u(a.onUpdateItems(t))}),P(1,"i",30),m(2," Update "),c()}}function kt(i,o){if(i&1&&(I(0),r(1,"div",27),d(2,Nt,3,0,"button",28),c(),w()),i&2){let n=o.ngIf,e=s();l(2),p("ngIf",e.productService.hasSelectionVariant(n))}}function Ot(i,o){if(i&1&&(r(0,"th",31)(1,"div",32),P(2,"img",33),r(3,"div",34),m(4),S(5,"stringLimit"),c()()()),i&2){let n=o.$implicit;l(),p("matTooltip",(n.Name==null?null:n.Name.length)>20?n.Name:""),l(),p("src",n==null?null:n.Img,M),l(2),ce("",se(5,4,n.Name,20),"",(n.Name==null?null:n.Name.length)>20?"...":"","")}}function Lt(i,o){if(i&1){let n=f();r(0,"th")(1,"input",35),D("ngModelChange",function(t){g(n);let a=s();return V(a.checkboxState,t)||(a.checkboxState=t),u(t)}),C("ngModelChange",function(){g(n);let t=s();return u(t.onSelectAllData())}),c()()}if(i&2){let n=s();l(),T("ngModel",n.checkboxState)}}function Rt(i,o){i&1&&(I(0),r(1,"th",36)(2,"span"),m(3,"Expected"),c(),r(4,"span",37),m(5,"(POS)"),c()(),r(6,"th",36),m(7," Channel "),c(),w())}function Bt(i,o){if(i&1){let n=f();r(0,"img",49),C("click",function(t){g(n);let a=s(3).$implicit,_=s(2);return u(_.onZoomImage(t,a==null?null:a.ImageUrl))}),c()}if(i&2){let n=s(3).$implicit;le("src",n==null?null:n.ImageUrl,M)}}function Ut(i,o){i&1&&P(0,"img",50)}function At(i,o){if(i&1&&(I(0),r(1,"td",44),d(2,Bt,1,1,"img",45)(3,Ut,1,0,"ng-template",null,0,ne),c(),r(5,"td",46)(6,"h5",47),m(7),c(),r(8,"small",48),m(9),c()(),w()),i&2){let n=te(4),e=s().index,t=s().$implicit,a=s().ngIf;l(),p("rowSpan",t==null?null:t.Variants.length)("ngClass",E(7,Et,e+1==a.length)),l(),p("ngIf",t==null?null:t.ImageUrl)("ngIfElse",n),l(3),p("rowSpan",t==null?null:t.Variants.length),l(2),N(t==null?null:t.Name),l(2),y("(",t==null?null:t.Category,")")}}function $t(i,o){if(i&1){let n=f();r(0,"td",51)(1,"input",35),D("ngModelChange",function(t){g(n);let a=s().$implicit;return V(a.selected,t)||(a.selected=t),u(t)}),c()()}if(i&2){let n=s().$implicit;l(),T("ngModel",n.selected)}}function jt(i,o){if(i&1){let n=f();I(0),r(1,"td",53),m(2),S(3,"number"),c(),r(4,"td",54),C("click",function(){let t=g(n).$implicit,a=s(2).$implicit,_=s().$implicit,h=s(2);return u(h.openTableDialog(a,_,t))}),r(5,"div",55)(6,"div",56),m(7),S(8,"number"),c(),r(9,"a",57),C("click",function(t){return g(n),u(t==null?null:t.stopPropagation())}),P(10,"i",43),c()()(),w()}if(i&2){let n=o.$implicit;l(2),y(" ",v(3,4,n.PriceExpected)," "),l(2),p("ngClass",E(8,Mt,n.Price!=n.PriceExpected)),l(3),y(" ",v(8,6,n.Price)," "),l(2),p("href",n.Url,M)}}function Wt(i,o){i&1&&(r(0,"td",58),m(1,"X"),c(),r(2,"td",58),m(3,"X"),c())}function zt(i,o){if(i&1&&(I(0),d(1,jt,11,10,"ng-container",52)(2,Wt,4,0,"ng-template",null,1,ne),w()),i&2){let n=o.$implicit,e=te(3),t=s().$implicit,a=s(3);l(),p("ngIf",a.getItemFromChannel(t,n.ID))("ngIfElse",e)}}function Gt(i,o){if(i&1&&(r(0,"tr"),d(1,At,10,9,"ng-container",3),r(2,"td",38),m(3),c(),r(4,"td",39)(5,"div",40)(6,"div",41),m(7),c(),r(8,"div",34)(9,"a",42),P(10,"i",43),c()()()(),d(11,$t,2,1,"ng-template",16)(12,zt,4,2,"ng-container",17),c()),i&2){let n=o.$implicit,e=o.index,t=s(3);l(),p("ngIf",e==0),l(2),N(n==null?null:n.Model),l(),p("matTooltip",n.isDiscontinued?t.discontinuedVariantMsg:""),l(2),p("ngClass",E(8,Dt,n.isDiscontinued)),l(),y(" ",n==null?null:n.Code,""),l(2),p("href",t.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(n==null?null:n.ID),M),l(2),p("ngxPermissionsOnly",E(10,lt,t.rolePriceEdit)),l(),p("ngForOf",t.channelOptions)}}function Kt(i,o){if(i&1&&(r(0,"tbody"),d(1,Gt,13,12,"tr",17),c()),i&2){let n=o.$implicit;l(),p("ngForOf",n.Variants)}}function Ht(i,o){if(i&1&&(I(0),d(1,Kt,2,1,"tbody",17),w()),i&2){let n=o.ngIf;l(),p("ngForOf",n)}}function Jt(i,o){if(i&1){let n=f();r(0,"span",59),C("click",function(){g(n);let t=s();return u(t.getRowCount())}),r(1,"i",60),m(2,"?"),c()()}}function Zt(i,o){if(i&1&&(r(0,"span"),m(1),S(2,"number"),c()),i&2){let n=o.ngIf;l(),N(v(2,1,n))}}function qt(i,o){if(i&1){let n=f();r(0,"a",61),C("click",function(){g(n);let t=s();return u(t.onNextPage())}),P(1,"i",62),m(2," Next"),c()}}function Xt(i,o){if(i&1){let n=f();r(0,"a",63),C("click",function(){g(n);let t=s();return u(t.onLastPage())}),P(1,"i",64),m(2," Last"),c()}}var ct=(()=>{let o=class o{constructor(e,t,a,_,h,x,we){this.http=e,this.toastr=t,this.dialog=a,this.productService=_,this.authService=h,this.biggerPictureService=x,this.paginationService=we,this.searchFilter=new Ke,this.checkboxState=!1,this.rolePriceEdit=ue.price,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.rowCountAPI="Inventory/GetMultipleChannelComparisonRowCount",this.filterTypeOptions=[{Key:L.ALL,Value:"All"},{Key:L.DIFFERENCE,Value:"Difference"}],this.filterType=L.ALL,this.pageData={Title:"Price Realtime",Nav:[{Title:"Price Cache",Url:"/menu/price",Active:!1}]},this.channelOptions=this.authService.getChannels(),this.hostName=this.authService.getDomain(),this.initPagination()}initPagination(){this.paginationService.fetchDataEndpoint="Price/GetOutletPrice",this.initProduct(),this.initPageLoader()}initProduct(){this.data$=this.paginationService.data$.pipe(ee(e=>(e=e.map(t=>(t.Variants&&(t.Variants=t.Variants.map(a=>(a.isDiscontinued=a.Discontinued=="Yes",a))),t)),e)),ae(1))}initPageLoader(){this.loader$=this.http.post("/api/PriceLoader/LoadMultiple",{}).pipe(B(e=>{this.searchFilter=e.Filter,this.paginationService.reloadPagination(this.searchFilter)}))}onNextPage(){this.paginationService.onNextPage(this.searchFilter)}onLastPage(){this.paginationService.hideCount=!1,this.totalData$=this.http.post(`/api/${this.rowCountAPI}`,{}).pipe(B(e=>{this.searchFilter.PageNumber=1,this.paginationService.getAllData(this.searchFilter,e)}))}getRowCount(){this.paginationService.hideCount=!1,this.totalData$=this.http.post(`/api/${this.rowCountAPI}`,{})}onSelectAllData(){this.data$=this.data$.pipe(ee(e=>(e.map(t=>(t.Variants&&(t.Variants=t.Variants.map(a=>(a.selected=this.checkboxState,a))),t)),e)))}onFilter(e){let t={text:e,filterModel:this.filterType,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount};this.paginationService.reloadPagination(t)}updatePrice(e){let t=this.productService.selectedVariantProduct(e);if(t.length>0){let a=t.map(x=>x.ID),h={ListChannelID:this.channelOptions.filter(x=>x.selected).map(x=>x.ID),ListID:a};this.http.post("/api/Price/UpdateChannelOutletPrice",h).subscribe({next:x=>{this.resetSelectedChannel(),this.onFilter(),this.toastr.success("Successfully updated "+h.ListID.length+" items in "+h.ListChannelID.length+" channels","Success")},error:x=>{this.resetSelectedChannel()}})}}resetSelectedChannel(){this.channelOptions=this.channelOptions.map(e=>(e.selected=!1,e))}getItemFromChannel(e,t){return e.Channel.find(a=>a.ChannelID==t)}onUpdateItems(e){let t=this.productService.selectedVariantProduct(e);this.dialog.open(Se,{data:{selectedItems:t,channels:this.channelOptions},width:"600px"}).afterClosed().pipe(R(a=>H.IsNotEmpty(a))).subscribe(a=>{this.channelOptions=a,this.updatePrice(e)})}openTableDialog(e,t,a){let _=JSON.parse(JSON.stringify(e));this.dialog.open(Pe,{data:{Name:t.Name,Variant:_,ChannelID:a?.ChannelID,Table:"price",ChannelItemID:a?.ChannelItemID}}).afterClosed().pipe(R(x=>H.IsNotEmpty(x))).subscribe(x=>{this.updateProductPrice(x,a)})}updateProductPrice(e,t){let a={ID:e.ChannelID,ChannelItemID:e.ChannelItemID,ChannelVariantID:e.ChannelVariationID,Price:parseFloat(e.Price),VariantID:e.ID,SKU:e.Sku};this.http.post("/api/Price/UpdatePriceByID",a).subscribe(_=>{t.Price=a.Price;let h=this.productService.findChannelById(a.ID,this.channelOptions);this.toastr.success(`Successfully updated ${e.ItemName} (${e.VarName}) inventory in ${h.Name} to ${a.Price}`,"Success")})}onZoomImage(e,t){this.biggerPictureService.openBiggerPicture(e,t)}ngOnDestroy(){this.paginationService.destroy()}};o.\u0275fac=function(t){return new(t||o)(b(K),b(G),b(Z),b(X),b(J),b(xe),b(Y))},o.\u0275cmp=F({type:o,selectors:[["app-custom-channel-price"]],decls:42,vars:30,consts:[["elsePic",""],["elseCol",""],["headerTitle","Price Comparison",3,"onSubmit","pageData","hideSearchBox","hideSearchDropdown","textButton"],[4,"ngIf"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],[1,"channel-column"],["colspan","5"],["scope","col","colspan","2","class","text-center border-bottom-0 border text-uppercase",4,"ngFor","ngForOf"],["scope","col","colspan","2",1,"text-center","w-25"],["scope","col",1,"text-start","w-20"],["scope","col",1,"text-end","w-10"],[3,"ngxPermissionsOnly"],[4,"ngFor","ngForOf"],[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 border-start-0","title","Load all products",3,"click",4,"ngIf"],[1,"fw-bold","mb-2"],["name","filterModel",3,"modelChange","model","options","border"],[1,"d-flex"],["type","button","class","btn btn-success shadow rounded","data-toggle","modal",3,"click",4,"ngIf"],["type","button","data-toggle","modal",1,"btn","btn-success","shadow","rounded",3,"click"],[1,"fas","fa-chevron-circle-up"],["scope","col","colspan","2",1,"text-center","border-bottom-0","border","text-uppercase"],["matTooltipPosition","above",1,"d-flex","align-items-center","justify-content-center",2,"width","180px",3,"matTooltip"],[2,"width","16px","height","16px",3,"src"],[1,"ms-2"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"text-end","border-top-0","border","w-10"],[1,"ms-1"],[1,"text-start","border-bottom"],["matTooltipPosition","above",1,"text-end","border-bottom",3,"matTooltip"],[1,"d-flex","align-items-center","justify-content-end"],[3,"ngClass"],["target","_blank",3,"href"],[1,"fas","fa-lg","fa-external-link-alt","external-link-custom"],[1,"text-center",3,"rowSpan","ngClass"],["class","border rounded w-img cursor-pointer",3,"src","click",4,"ngIf","ngIfElse"],[1,"text-start","border-bottom",2,"padding-left","0px",3,"rowSpan"],[1,"mb-0","item-name"],[1,"mt-1"],[1,"border","rounded","w-img","cursor-pointer",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded","w-img"],[1,"align-middle"],[4,"ngIf","ngIfElse"],[1,"text-end","border"],[1,"text-center","border","pointer","cell-hover",3,"click","ngClass"],[1,"d-flex","align-items-center","justify-content-center"],[1,"me-2"],["target","_blank",3,"click","href"],[1,"table-white","border","text-end",2,"color","red"],[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","border-start-0",3,"click"],[1,"fas","fa-share"]],template:function(t,a){if(t&1&&(r(0,"mainpanel",2),C("onSubmit",function(h){return a.onFilter(h)}),r(1,"filters"),d(2,Ft,5,3,"ng-container",3),S(3,"async"),c(),r(4,"actions"),d(5,kt,3,1,"ng-container",3),S(6,"async"),c(),r(7,"content")(8,"div",4)(9,"div",5)(10,"div",6)(11,"div",7)(12,"table",8)(13,"thead",9)(14,"tr",10),P(15,"th",11),d(16,Ot,6,7,"th",12),c(),r(17,"tr")(18,"th",13)(19,"span"),m(20," Product "),c()(),r(21,"th",14),m(22,"Variant"),c(),r(23,"th",15),m(24,"SKU"),c(),d(25,Lt,2,1,"ng-template",16)(26,Rt,8,0,"ng-container",17),c()(),d(27,Ht,2,1,"ng-container",3),S(28,"async"),c()()()(),r(29,"div",18)(30,"div",19)(31,"div",20),m(32),S(33,"async"),S(34,"number"),d(35,Jt,3,0,"span",21)(36,Zt,3,3,"span",3),S(37,"async"),m(38),c()(),r(39,"div",22),d(40,qt,3,0,"a",23)(41,Xt,3,0,"a",24),c()()()()()),t&2){let _;p("pageData",a.pageData)("hideSearchBox",!1)("hideSearchDropdown",!1)("textButton","Search"),l(2),p("ngIf",v(3,16,a.loader$)),l(3),p("ngIf",v(6,18,a.data$)),l(11),p("ngForOf",a.channelOptions),l(9),p("ngxPermissionsOnly",E(28,lt,a.rolePriceEdit)),l(),p("ngForOf",a.channelOptions),l(),p("ngIf",v(28,20,a.data$)),l(5),y(" Showing 1 - ",v(34,24,(_=v(33,22,a.paginationService.data$))==null?null:_.length)," of "),l(3),p("ngIf",a.paginationService.hideCount),l(),p("ngIf",!a.paginationService.hideCount&&v(37,26,a.totalData$)),l(2),y(" records ~ ",a.paginationService.footerPageNumber," Page "),l(2),p("ngIf",a.paginationService.disableNextButton&&!a.paginationService.goToLastPage),l(),p("ngIf",a.paginationService.disableNextButton&&!a.paginationService.goToLastPage)}},dependencies:[U,A,$,me,k,O,q,fe,Ie,he,j,W,ve],styles:[".w-10[_ngcontent-%COMP%]{width:10%}.w-20[_ngcontent-%COMP%]{width:20%}.w-img[_ngcontent-%COMP%]{width:40px;height:40px}.item-name[_ngcontent-%COMP%]{font-weight:400;font-size:larger}.cell-hover[_ngcontent-%COMP%]:hover{background-color:#c9c9c9!important}"]});let i=o;return i})();var Ee=i=>[i],Yt=i=>({"text-decoration-line-through":i}),Qt=i=>({"bg-gradient-warning":i}),en=i=>({"ms-10":i});function tn(i,o){if(i&1&&(r(0,"span",10),P(1,"img",11),c(),m(2)),i&2){let n=o.item;l(),p("src",n==null?null:n.Img,M),l(),y(" ",n.Name," ")}}function nn(i,o){if(i&1){let n=f();r(0,"button",16),C("click",function(){g(n);let t=s().ngIf,a=s(2);return u(a.updateStock(t))}),P(1,"i",17),m(2," Update "),c()}}function an(i,o){if(i&1){let n=f();r(0,"actions")(1,"div",12),d(2,nn,3,0,"button",13),r(3,"button",14),C("click",function(){g(n);let t=s(2);return u(t.Export())}),P(4,"i",15),r(5,"span"),m(6,"Export"),c()()()()}if(i&2){let n=o.ngIf,e=s(2);l(2),p("ngIf",e.productService.hasSelectionVariant(n))}}function on(i,o){if(i&1){let n=f();r(0,"th")(1,"input",37),C("change",function(t){g(n);let a=s().ngIf,_=s(2);return u(_.onSelectAllSKU(t.target.checked,a))}),c()()}}function rn(i,o){if(i&1){let n=f();r(0,"input",54),D("ngModelChange",function(t){g(n);let a=s(4).$implicit;return V(a.selected,t)||(a.selected=t),u(t)}),C("ngModelChange",function(){g(n);let t=s(4).$implicit,a=s(3);return u(a.onCheckboxStateProduct(t))}),c()}if(i&2){let n=s(4).$implicit;T("ngModel",n.selected)}}function ln(i,o){if(i&1&&(I(0),d(1,rn,1,1,"ng-template",26),w()),i&2){let n=s(6);l(),p("ngxPermissionsOnly",E(1,Ee,n.rolePriceEdit))}}function cn(i,o){if(i&1){let n=f();I(0),r(1,"img",55),C("click",function(t){g(n);let a=s(3).$implicit,_=s(3);return u(_.onZoomImage(t,a==null?null:a.ImageUrl))}),c(),w()}if(i&2){let n=s(3).$implicit;l(),le("src",n.ThumbnailUrl,M)}}function sn(i,o){i&1&&P(0,"img",56)}function pn(i,o){if(i&1&&(I(0),P(1,"br"),r(2,"small"),m(3),c(),w()),i&2){let n=s(3).$implicit;l(3),y("(",n.Category,")")}}function mn(i,o){if(i&1&&(I(0),r(1,"td",49)(2,"div",50),d(3,ln,2,3,"ng-container",9),r(4,"div",39),d(5,cn,2,1,"ng-container",51)(6,sn,1,0,"ng-template",null,0,ne),c()()(),r(8,"td",52)(9,"span",53),m(10),c(),d(11,pn,4,1,"ng-container",9),c(),w()),i&2){let n=te(7),e=s(2).$implicit,t=s(3);l(),p("rowSpan",e.Variants.length),l(2),p("ngIf",(e.Variants==null?null:e.Variants.length)>1),l(),p("ngClass",E(8,en,(e.Variants==null?null:e.Variants.length)<=1)),l(),p("ngIf",e.ThumbnailUrl)("ngIfElse",n),l(3),p("rowSpan",e.Variants.length),l(2),N(e.Name),l(),p("ngIf",(e==null?null:e.CategoryID)!==null&&(e==null?null:e.CategoryID)!=t.guidEmpty)}}function dn(i,o){if(i&1){let n=f();r(0,"input",59),D("ngModelChange",function(t){g(n);let a=s(2).$implicit;return V(a.selected,t)||(a.selected=t),u(t)}),c()}if(i&2){let n=s(2).$implicit;T("ngModel",n.selected)}}function _n(i,o){if(i&1&&(r(0,"td",57),d(1,dn,1,1,"input",58),c()),i&2){let n=s().$implicit;l(),p("ngIf",n.Inventory>=0)}}function gn(i,o){i&1&&(r(0,"div",60),m(1,"Not Found"),c())}function un(i,o){if(i&1&&(r(0,"div"),m(1),S(2,"number"),c()),i&2){let n=s().$implicit;l(),y(" ",v(2,1,n.UnitPrice),"")}}function hn(i,o){if(i&1&&(I(0),r(1,"div",44)(2,"a",45),P(3,"i",61),c()(),w()),i&2){let n=s().$implicit,e=s(4);l(2),p("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(n==null?null:n.ID),M)}}function Cn(i,o){if(i&1){let n=f();r(0,"div",62),C("click",function(){g(n);let t=s().$implicit,a=s().$implicit,_=s(2).ngIf,h=s();return u(h.openTableDialog(t,a,_))}),m(1),S(2,"number"),c()}if(i&2){let n=s().$implicit;l(),y(" ",v(2,1,n.Channel[0]==null?null:n.Channel[0].Price)," ")}}function fn(i,o){if(i&1){let n=f();r(0,"tr"),d(1,mn,12,10,"ng-container",9),r(2,"td",24),m(3),c(),r(4,"td",38)(5,"span",39),m(6),c()(),d(7,_n,2,1,"ng-template",26),r(8,"td",27)(9,"div",40),d(10,gn,2,0,"div",41)(11,un,3,3,"div",9)(12,hn,4,1,"ng-container",9),c()(),r(13,"td",42)(14,"div",40),d(15,Cn,3,3,"div",43),r(16,"div",44)(17,"a",45),P(18,"i",46),c()(),r(19,"div",44)(20,"div",47),C("click",function(){let t=g(n).$implicit,a=s(4);return u(a.refreshPrice(t))}),P(21,"i",48),c()()()()()}if(i&2){let n=o.$implicit,e=o.index,t=s(4);l(),p("ngIf",e==0),l(2),N(n.Model),l(),p("matTooltip",n.isDiscontinued?t.discontinuedVariantMsg:""),l(),p("ngClass",E(12,Yt,n.isDiscontinued)),l(),y(" ",n.Code," "),l(),p("ngxPermissionsOnly",E(14,Ee,t.rolePriceEdit)),l(3),p("ngIf",(n.Channel[0]==null?null:n.Channel[0].Description)!=null),l(),p("ngIf",(n.Channel[0]==null?null:n.Channel[0].Description)==null),l(),p("ngIf",(n.Channel[0]==null?null:n.Channel[0].Description)==null),l(),p("ngClass",E(16,Qt,n.UnitPrice!=(n.Channel[0]==null?null:n.Channel[0].Price))),l(2),p("ngIf",n.Channel.length>0),l(2),p("href",n.Channel[0]==null?null:n.Channel[0].Url,M)}}function xn(i,o){if(i&1&&(I(0),d(1,fn,22,18,"tr",31),w()),i&2){let n=o.$implicit;l(),p("ngForOf",n.Variants)}}function Sn(i,o){if(i&1){let n=f();r(0,"span",62),C("click",function(){g(n);let t=s(3);return u(t.getRowCount())}),r(1,"i",63),m(2,"?"),c()()}}function Pn(i,o){if(i&1&&(r(0,"span"),m(1),S(2,"number"),c()),i&2){let n=o.ngIf;l(),N(v(2,1,n.Total))}}function vn(i,o){if(i&1){let n=f();r(0,"a",67),C("click",function(){g(n);let t=s(4);return u(t.onNextPage())}),P(1,"i",68),m(2," Next"),c()}}function bn(i,o){if(i&1){let n=f();r(0,"a",69),C("click",function(){g(n);let t=s(4);return u(t.onLastPage())}),P(1,"i",70),m(2," Last"),c()}}function yn(i,o){if(i&1&&(r(0,"div",64),d(1,vn,3,0,"a",65)(2,bn,3,0,"a",66),c()),i&2){let n=s(3);l(),p("ngIf",n.paginationService.disableNextButton&&!n.paginationService.goToLastPage),l(),p("ngIf",n.paginationService.disableNextButton&&!n.paginationService.goToLastPage)}}function In(i,o){if(i&1){let n=f();r(0,"content")(1,"div",18)(2,"div",19)(3,"table",20)(4,"thead",21)(5,"tr")(6,"th",22),m(7," Product "),r(8,"div")(9,"mat-slide-toggle",23),D("ngModelChange",function(t){g(n);let a=s(2);return V(a.toggleDifferentInventory,t)||(a.toggleDifferentInventory=t),u(t)}),C("toggleChange",function(){g(n);let t=s(2);return u(t.onToggleDifferentInventory())}),r(10,"small",7),m(11,"FILTER DIFFERENT PRICE"),c()()()(),r(12,"th",24),m(13,"Variant"),c(),r(14,"th",25),m(15,"SKU"),c(),d(16,on,2,0,"ng-template",26),r(17,"th",27),m(18,"POS"),c(),r(19,"th",27)(20,"div",28),C("click",function(){g(n);let t=s(2);return u(t.openModalFilter())}),P(21,"img",29),r(22,"span",30),m(23),S(24,"stringLimit"),c()()()()(),r(25,"tbody"),d(26,xn,2,1,"ng-container",31),c()(),r(27,"div",32)(28,"div",33)(29,"div",34),m(30),S(31,"number"),d(32,Sn,3,0,"span",35)(33,Pn,3,3,"span",9),S(34,"async"),m(35),c()(),d(36,yn,3,2,"div",36),c()()()()}if(i&2){let n=o.ngIf,e=s(2);l(9),T("ngModel",e.toggleDifferentInventory),l(7),p("ngxPermissionsOnly",E(19,Ee,e.rolePriceEdit)),l(4),p("matTooltip",(e.selectedChannel==null||e.selectedChannel.Name==null?null:e.selectedChannel.Name.length)>=20?e.selectedChannel==null?null:e.selectedChannel.Name:""),l(),p("src",e.selectedChannel==null?null:e.selectedChannel.Img,M),l(2),ce(" ",se(24,12,e.selectedChannel==null?null:e.selectedChannel.Name,20),"",(e.selectedChannel==null||e.selectedChannel.Name==null?null:e.selectedChannel.Name.length)>=20?"...":""," "),l(3),p("ngForOf",n),l(4),y(" Showing 1 - ",v(31,15,n==null?null:n.length)," of "),l(2),p("ngIf",e.paginationService.hideCount),l(),p("ngIf",v(34,17,!e.paginationService.hideCount&&e.allDataCount$)),l(2),y(" records ~ ",e.paginationService.footerPageNumber," Page "),l(),p("ngIf",n.length>0)}}function wn(i,o){if(i&1){let n=f();r(0,"mainpanel",2),D("textChange",function(t){g(n);let a=s();return V(a.searchFilter.text,t)||(a.searchFilter.text=t),u(t)}),C("onSubmit",function(){g(n);let t=s();return u(t.onSearch())}),r(1,"filters")(2,"div")(3,"label",3),m(4,"Channel"),c(),r(5,"ng-select",4),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.ChannelID,t)||(a.searchFilter.ChannelID=t),u(t)}),d(6,tn,3,2,"ng-template",5),c()(),r(7,"div",6)(8,"label",7),m(9,"Page Number"),c(),r(10,"input",8),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.PageNumber,t)||(a.searchFilter.PageNumber=t),u(t)}),c()(),r(11,"div",6)(12,"label",7),m(13,"Page Size"),c(),r(14,"input",8),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.RowCount,t)||(a.searchFilter.RowCount=t),u(t)}),c()()(),d(15,an,7,1,"actions",9),S(16,"async"),d(17,In,37,21,"content",9),S(18,"async"),c()}if(i&2){let n=s();p("headerTitle",n.pageTitle),T("text",n.searchFilter.text),l(5),p("clearable",!1)("items",n.channelOptions),T("ngModel",n.searchFilter.ChannelID),l(5),T("ngModel",n.searchFilter.PageNumber),l(4),T("ngModel",n.searchFilter.RowCount),l(),p("ngIf",v(16,9,n.data$)),l(2),p("ngIf",v(18,11,n.data$))}}var st=(()=>{let o=class o{constructor(e,t,a,_,h,x,we,Me,dt){this.http=e,this.paginationService=t,this.toastr=a,this.dialog=_,this.productService=h,this.biggerPictureService=x,this.inventoryService=we,this.authService=Me,this.mainPanelService=dt,this.pageTitle="Price Single Channel Comparison",this.toggleDifferentInventory=!1,this.loaderEndpoint="PriceLoader/Load",this.dataEndpoint="Price/GetSingleChannelComparison",this.allDataCountEndpoint="Inventory/GetInventoryByChannelRowCount",this.rolePriceEdit=ue.price,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.guidEmpty=H.GuidEMpty,this.hostName=this.authService.getDomain(),this.data$=this.paginationService.data$.pipe(ae(1),ee(_t=>_t.map(ie=>(ie.Variants&&(ie.Variants=ie.Variants.map(Te=>(Te.isDiscontinued=Te.Discontinued=="Yes",Te))),ie)))),this.channelOptions=Me.getChannels()}ngOnInit(){this.initPageLoader()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.dataEndpoint,this.loader$=this.http.post(`/API/${this.loaderEndpoint}`).pipe(B(e=>{this.searchFilter=e.Filter,this.searchFilter.filterModel=L.ALL,this.paginationService.reloadPagination(this.searchFilter),this.initSelectedChannel()}))}onToggleDifferentInventory(){this.toggleDifferentInventory?this.searchFilter.filterModel=L.ALL:this.searchFilter.filterModel=L.DIFFERENCE,this.onSearch()}onCheckboxStateProduct(e){e.Variants=e.Variants.map(t=>(t.selected=e.selected,t))}openModalFilter(){this.mainPanelService.openModalFilter()}updateStock(e){let a=this.productService.selectedVariantProduct(e).map(h=>({ID:h.ID,ChannelID:h.Channel[0].ChannelID,Code:h.Code,Price:h.UnitPrice})),_={ListChannelID:[this.searchFilter.ChannelID],ListPrice:a};this.http.post("/api/Price/UpdateChannel",_).subscribe(h=>{this.onSearch(),this.handlingUpdateStock(h.Response)})}handlingUpdateStock(e){if(e.success_list.length>0||e.failure_list.length>0){let t=e.failure_list,a=e.success_list;this.inventoryService.showToastrUpdateInventory("Price",a,t)}else this.toastr.error(e[0]?.Exception,"Error")}refreshPrice(e){let t={ChannelItemID:e?.Channel[0].ChannelItemID,ChannelVariationID:e?.Channel[0]?.ChannelVariationID,ChannelID:e?.Channel[0]?.ChannelID,VariantID:e.ID};this.http.post("/api/Price/RefreshPriceChannel",t).subscribe(a=>{this.toastr.success("Successfully updated","Success"),this.onSearch()})}onSearch(){this.paginationService.reloadPagination(this.searchFilter),this.initSelectedChannel()}getRowCount(){this.paginationService.hideCount=!1,this.allDataCount$=this.http.post(`/API/${this.allDataCountEndpoint}`,this.searchFilter)}onNextPage(){this.paginationService.onNextPage(this.searchFilter)}onLastPage(){this.http.post(`/API/${this.allDataCountEndpoint}`,this.searchFilter).subscribe({next:e=>{this.searchFilter.PageNumber=1,this.paginationService.getAllData(this.searchFilter,e.Total)}})}openTableDialog(e,t,a){let _=JSON.parse(JSON.stringify(e));this.dialog.open(Pe,{data:{Name:t.Name,Variant:_,ChannelID:_?.Channel[0]?.ChannelID,Table:"price",ChannelItemID:_?.Channel[0]?.ChannelItemID}}).afterClosed().pipe(R(x=>H.IsNotEmpty(x))).subscribe(x=>{this.updateItemAfterDialog(x,e)})}updateItemAfterDialog(e,t){let a={ID:e.ChannelID,ChannelItemID:e.ChannelItemID,ChannelVariantID:e.ChannelVariationID,Price:parseFloat(e.Price),VariantID:e.ID,SKU:e.Sku};this.http.post("/api/Price/UpdatePriceByID",a).subscribe(_=>{let h=this.productService.findChannelById(a.ID,this.channelOptions);this.toastr.success(`Successfully updated ${e.ItemName} (${e.VarName}) inventory in ${h.Name} to ${a.Price}`,"Success"),t.Channel[0]&&(t.Channel[0].Price=a.Price)})}initSelectedChannel(){this.selectedChannel=this.channelOptions.find(e=>e.ID==this.searchFilter.ChannelID)}onSelectAllSKU(e,t){t=t.map(a=>(a.Variants=a.Variants.map(_=>(_.selected=e,_)),a))}onZoomImage(e,t){this.biggerPictureService.openBiggerPicture(e,t)}Export(){let e={ChannelID:this.searchFilter.ChannelID,IsMarketplaceAppActive:this.searchFilter.IsMarketplaceAppActive,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount,filterModel:this.searchFilter.filterModel};this.http.postFile("/api/price/GetExportSingleChannelComparison",e).subscribe(t=>{let a=window.URL.createObjectURL(t.file),_=document.createElement("a");_.download=this.getFilenameFromContentDisposition(t.title),_.href=a,_.click(),URL.revokeObjectURL(a),_.remove()})}getFilenameFromContentDisposition(e){let a=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(e);return a!=null&&a[1]?a[1].replace(/['"]/g,""):""}ngOnDestroy(){this.paginationService.destroy()}};o.\u0275fac=function(t){return new(t||o)(b(K),b(Y),b(G),b(Z),b(X),b(xe),b(ye),b(J),b(je))},o.\u0275cmp=F({type:o,selectors:[["app-price-single-channel"]],decls:2,vars:3,consts:[["elsePic",""],[3,"headerTitle","text","textChange","onSubmit",4,"ngIf"],[3,"textChange","onSubmit","headerTitle","text"],[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","","ng-label-tmp",""],[1,"mt-5"],[1,"fw-bold"],["type","number",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[4,"ngIf"],[1,"me-2"],[2,"width","18px",3,"src"],[1,"d-flex"],["class","btn btn-success",3,"click",4,"ngIf"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"btn","btn-success",3,"click"],[1,"fas","fa-chevron-circle-up"],[1,"container-fluid","mt-5"],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],["colspan","2",1,"text-center","ps-12",2,"width","36%"],["name","differentInventory",3,"ngModelChange","toggleChange","ngModel"],[1,"text-start"],[1,"text-end",2,"width","20%"],[3,"ngxPermissionsOnly"],[1,"text-end"],["role","button","matTooltipPosition","above",1,"d-inline-block",3,"click","matTooltip"],[2,"width","16px",3,"src"],[1,"ms-1"],[4,"ngFor","ngForOf"],[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"],["class","btn-group",4,"ngIf"],["type","checkbox",1,"me-3",3,"change"],["matTooltipPosition","above",1,"text-end",3,"matTooltip"],[3,"ngClass"],[1,"d-flex","align-items-center","justify-content-end"],["class","text-danger","matTooltip","This product is no longer available in POS","matTooltipPosition","above",4,"ngIf"],[1,"text-end",3,"ngClass"],["style","cursor: pointer;",3,"click",4,"ngIf"],[1,"ms-3"],["target","_blank",3,"href"],[1,"fas","external-link-custom","fa-lg","fa-external-link-alt"],["matTooltip","Refresh Unit Price according to seller center",1,"pl-5","cursor-pointer",2,"color","var(--bs-link-color)",3,"click"],[1,"fas","external-link-custom","fa-sync","fa-lg"],[1,"text-start",2,"width","0%",3,"rowSpan"],[1,"d-flex","align-items-center","justify-content-start"],[4,"ngIf","ngIfElse"],[1,"text-start",3,"rowSpan"],[1,"item-name","mb-0"],["type","checkbox",1,"me-3",3,"ngModelChange","ngModel"],[1,"border","rounded","w-img","cursor-pointer",2,"margin-left","20px",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded","w-img",2,"margin-left","20px"],[1,"align-middle"],["type","checkbox",3,"ngModel","ngModelChange",4,"ngIf"],["type","checkbox",3,"ngModelChange","ngModel"],["matTooltip","This product is no longer available in POS","matTooltipPosition","above",1,"text-danger"],[1,"fas","external-link-custom","fa-external-link-alt"],[2,"cursor","pointer",3,"click"],["title","Retreive rows count",1,"border","p-3"],[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 border-start-0","title","Load all products",3,"click",4,"ngIf"],["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","border-start-0",3,"click"],[1,"fas","fa-share"]],template:function(t,a){t&1&&(d(0,wn,19,13,"mainpanel",1),S(1,"async")),t&2&&p("ngIf",v(1,1,a.loader$))},dependencies:[U,A,$,de,_e,me,k,O,q,Ue,Re,Be,Xe,fe,he,j,W,ve],styles:[".w-img[_ngcontent-%COMP%]{width:40px;height:40px}input[type=checkbox][_ngcontent-%COMP%]{width:15px;height:15px}i.fas.custom-size[_ngcontent-%COMP%]{font-size:13px}.item-name[_ngcontent-%COMP%]{font-size:larger}"]});let i=o;return i})();var pt=(()=>{let o=class o{constructor(){this.priceTabs=[{Title:"Single Channel Comparison",Url:"/menu/price/SingleChannel"},{Title:"Multi Channel Comparison",Url:"/menu/price/pos"},{Title:"Custom Channel Price",Url:"/menu/price/OutletPrice"}]}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=F({type:o,selectors:[["app-price"]],decls:5,vars:1,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid"],[3,"Tabs"]],template:function(t,a){t&1&&(r(0,"nav",0)(1,"div",1)(2,"div"),P(3,"nav-tab",2),c()()(),P(4,"router-outlet")),t&2&&(l(3),p("Tabs",a.priceTabs))},dependencies:[ze,ke]});let i=o;return i})();var Tn=[{path:"",component:pt,children:[{path:"",redirectTo:"SingleChannel",pathMatch:"full"},{path:"pos",component:rt,canActivate:[Ce],data:{title:"Global Price Comparison"}},{path:"OutletPrice",component:ct,canActivate:[Ce],data:{title:"Outlet Price Comparison"}},{path:"SingleChannel",component:st,canActivate:[Ce],data:{title:"Price Single Channel Comparison"}}]}],mt=(()=>{let o=class o{};o.\u0275fac=function(t){return new(t||o)},o.\u0275mod=re({type:o}),o.\u0275inj=oe({imports:[z,pe.forChild(Tn)]});let i=o;return i})();var Ui=(()=>{let o=class o{};o.\u0275fac=function(t){return new(t||o)},o.\u0275mod=re({type:o}),o.\u0275inj=oe({providers:[ye],imports:[z,ge,Ge,We,pe,Ae,mt,Oe,Ye,qe,$e,Ie,be,Le.forChild()]});let i=o;return i})();export{Ui as PriceModule};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as Ne}from"./chunk-K3G6FMDF.js";import{a as Le,b as ue,c as He,d as $e,e as de,f as We,g as he,h as Ue,i as q,j as pe,k as E}from"./chunk-JM3LERUP.js";import{b as le,c as z,d as Ke}from"./chunk-6F6NSBIF.js";import{$ as b,$b as ce,A as Pe,B as De,Ca as H,I as ie,N as xe,Q as se,Qa as $,T as x,U as ae,Vb as Re,Wb as je,X as K,Xc as Fe,aa as F,b as g,ba as y,c as X,ca as h,ea as _e,g as Ee,h as Te,ia as L,k as M,l as N,m as _,n as U,q as P,r as Ce,sc as Oe,tc as Me,uc as Be}from"./chunk-6DRNAUKE.js";import{a as oe,i as I}from"./chunk-GRMIXZTT.js";var ze={production:!0,version:"3.11.
|
|
1
|
+
import{e as Ne}from"./chunk-K3G6FMDF.js";import{a as Le,b as ue,c as He,d as $e,e as de,f as We,g as he,h as Ue,i as q,j as pe,k as E}from"./chunk-JM3LERUP.js";import{b as le,c as z,d as Ke}from"./chunk-6F6NSBIF.js";import{$ as b,$b as ce,A as Pe,B as De,Ca as H,I as ie,N as xe,Q as se,Qa as $,T as x,U as ae,Vb as Re,Wb as je,X as K,Xc as Fe,aa as F,b as g,ba as y,c as X,ca as h,ea as _e,g as Ee,h as Te,ia as L,k as M,l as N,m as _,n as U,q as P,r as Ce,sc as Oe,tc as Me,uc as Be}from"./chunk-6DRNAUKE.js";import{a as oe,i as I}from"./chunk-GRMIXZTT.js";var ze={production:!0,version:"3.11.9",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/v1/content?fetch=children:omni&sort=sortOrder:asc"};var qe=(()=>{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 ft="firebase",gt="10.12.1";q(ft,gt,"app");var G=new Re("ANGULARFIRE2_VERSION");var mt=(r,i)=>{let t=i?[i]:Ue(),e=[];return t.forEach(n=>{n.container.getProvider(r).instances.forEach(s=>{e.includes(s)||e.push(s)})}),e},V=class{constructor(){return mt(wt)}},wt="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(K({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)}},Ve=(()=>{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 Ge(r){return kt(At())(r)}function kt(r){return function(t){return t=t.lift(new ge(r.ngZone)),t.pipe(N(r.outsideAngular),M(r.insideAngular))}}var bt="firebase",St="10.12.1";E.registerVersion(bt,St,"app-compat");var It=["ngOnDestroy"],Ze=(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(It.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 Q=class{constructor(i){return i}},ee=new y("angularfire2.app.options"),te=new y("angularfire2.app.name");function me(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;yt("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 Q(s)}var yt=(r,...i)=>{ce()&&typeof console<"u"&&console[r](...i)},Et={provide:Q,useFactory:me,deps:[ee,$,[new _e,te]]},Rn=(()=>{class r{static initializeApp(t,e){return{ngModule:r,providers:[{provide:ee,useValue:t},{provide:te,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:[Et]})}return r})();function Xe(r,i,t,e,n){let[,o,s]=globalThis.\u0275AngularfireInstanceCache.find(a=>a[0]===r)||[];if(o)return Tt(n,s)||(Je("error",`${i} was already initialized on the ${t} Firebase App with different settings.${Ct?" You may need to reload as Firebase is not HMR aware.":""}`),Je("warn",{is:n,was:s})),o;{let a=e();return globalThis.\u0275AngularfireInstanceCache.push([r,a,n]),a}}function Tt(r,i){try{return r.toString()===i.toString()}catch{return r===i}}var Ct=typeof module<"u"&&!!module.hot,Je=(r,...i)=>{ce()&&typeof console<"u"&&console[r](...i)};globalThis.\u0275AngularfireInstanceCache||=[];var Pt=new Map,Dt={activated:!1,tokenObservers:[]},xt={initialized:!1,enabled:!1};function T(r){return Pt.get(r)||Object.assign({},Dt)}function nt(){return xt}var _t="https://content-firebaseappcheck.googleapis.com/v1";var Rt="exchangeDebugToken",Ye={OFFSET_DURATION:5*60*1e3,RETRIAL_MIN_WAIT:30*1e3,RETRIAL_MAX_WAIT:16*60*1e3},zn=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 jt(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 jt(r){return new Promise(i=>{setTimeout(i,r)})}var Ot={"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 $e("appCheck","AppCheck",Ot);function rt(r){if(!T(r).activated)throw R.create("use-before-activation",{appName:r.name})}function ot(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 it(r,i){let{projectId:t,appId:e,apiKey:n}=r.options;return{url:`${_t}/projects/${t}/apps/${e}:${Rt}?key=${n}`,body:{debug_token:i}}}var Mt="firebase-app-check-database",Bt=1,ke="firebase-app-check-store";var ne=null;function Nt(){return ne||(ne=new Promise((r,i)=>{try{let t=indexedDB.open(Mt,Bt);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(ke,{keyPath:"compositeKey"})}}}catch(t){i(R.create("storage-open",{originalErrorMessage:t?.message}))}}),ne)}function Ft(r,i){return Lt(Ht(r),i)}function Lt(r,i){return I(this,null,function*(){let e=(yield Nt()).transaction(ke,"readwrite"),o=e.objectStore(ke).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 Ht(r){return`${r.options.appId}-${r.name}`}var ve=new We("@firebase/app-check");function we(r,i){return He()?Ft(r,i).catch(t=>{ve.warn(`Failed to write token to IndexedDB. Error: ${t}`)}):Promise.resolve()}function st(){return nt().enabled}function at(){return I(this,null,function*(){let r=nt();if(r.enabled&&r.token)return r.token.promise;throw Error(`
|
|
3
3
|
Can't get debug token in production mode.
|
|
4
4
|
`)})}var $t={error:"UNKNOWN_ERROR"};function Wt(r){return Le.encodeString(JSON.stringify(r),!1)}function be(r,i=!1){return I(this,null,function*(){let t=r.app;rt(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 we(t,void 0))}if(!i&&n&&J(n))return{token:n.token};let s=!1;if(st()){e.exchangeTokenPromise||(e.exchangeTokenPromise=ot(it(t,yield at()),r.heartbeatServiceProvider).finally(()=>{e.exchangeTokenPromise=void 0}),s=!0);let c=yield e.exchangeTokenPromise;return yield we(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"?ve.warn(c.message):ve.error(c),o=c}let a;return n?o?J(n)?a={token:n.token,internalError:o}:a=et(o):(a={token:n.token},e.token=n,yield we(t,n)):a=et(o),s&&qt(t,a),a})}function Ut(r){return I(this,null,function*(){let i=r.app;rt(i);let{provider:t}=T(i);if(st()){let e=yield at(),{token:n}=yield ot(it(i,e),r.heartbeatServiceProvider);return{token:n}}else{let{token:e}=yield t.getToken();return{token:e}}})}function Kt(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}),Qe(r)}).catch(()=>{})}o.cachedTokenPromise.then(()=>Qe(r))}function ct(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 Qe(r){let{app:i}=r,t=T(i),e=t.tokenRefresher;e||(e=zt(r),t.tokenRefresher=e),!e.isRunning()&&t.isTokenAutoRefreshEnabled&&e.start()}function zt(r){let{app:i}=r;return new Ae(()=>I(this,null,function*(){let t=T(i),e;if(t.token?e=yield be(r,!0):e=yield be(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},Ye.RETRIAL_MIN_WAIT,Ye.RETRIAL_MAX_WAIT)}function qt(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 et(r){return{token:Wt($t),error:r}}var Se=class{constructor(i,t){this.app=i,this.heartbeatServiceProvider=t}_delete(){let{tokenObservers:i}=T(this.app);for(let t of i)ct(this.app,t.next);return Promise.resolve()}};function Vt(r,i){return new Se(r,i)}function Gt(r){return{getToken:i=>be(r,i),getLimitedUseToken:()=>Ut(r),addTokenListener:i=>Kt(r,"INTERNAL",i),removeTokenListener:i=>ct(r.app,i)}}var Jt="@firebase/app-check",Zt="0.8.4";var Xt="app-check",tt="app-check-internal";function Yt(){he(new de(Xt,r=>{let i=r.getProvider("app").getImmediate(),t=r.getProvider("heartbeat");return Vt(i,t)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((r,i,t)=>{r.getProvider(tt).initialize()})),he(new de(tt,r=>{let i=r.getProvider("app-check").getImmediate();return Gt(i)},"PUBLIC").setInstantiationMode("EXPLICIT")),q(Jt,Zt)}Yt();var Qt=["localhost","0.0.0.0","127.0.0.1"],rr=typeof window<"u"&&Qt.includes(window.location.hostname);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)=>Xe(`${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=U(void 0).pipe(M(s.outsideAngular),x(()=>o.runOutsideAngular(()=>import("./chunk-W3EAYQL3.js"))),P(()=>me(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=U(null);else{j.pipe(xe()).subscribe();let C=j.pipe(x(w=>w.getRedirectResult().then(D=>D,()=>null)),Ge,se({bufferSize:1,refCount:!1})),Z=j.pipe(x(w=>new g(D=>({unsubscribe:o.runOutsideAngular(()=>w.onAuthStateChanged(O=>D.next(O),O=>D.error(O),()=>D.complete()))})))),re=j.pipe(x(w=>new g(D=>({unsubscribe:o.runOutsideAngular(()=>w.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(x(w=>w?_(w.getIdToken()):U(null))),this.idTokenResult=this.user.pipe(x(w=>w?_(w.getIdTokenResult()):U(null))),this.credential=Pe(C,W,this.authState.pipe(De(w=>!w))).pipe(P(w=>w?.user?w:null),N(s.outsideAngular),M(s.insideAngular))}return Ze(this,j,o,{spy:{apply:(C,Z,re)=>{(C.startsWith("signIn")||C.startsWith("createUser"))&&re.then(w=>W.next(w))}}})}static \u0275fac=function(e){return new(e||r)(h(ee),h(te,8),h(H),h($),h(Ve),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})(),kr=(()=>{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 A=function(r){return r.readonly="readonly",r.readwrite="readwrite",r}(A||{}),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(A.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(A.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 _(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(A.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 _(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(A.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(A.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(A.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(A.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(A.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(A.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(A.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(A.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(A.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=A.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(A.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(A.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(A.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(A.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})(),Cr=(()=>{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(K(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"}),_(this.afAuth.signInWithPopup(o)).pipe(P(s=>s.credential),P(s=>s.idToken),x(s=>this.httpService.post("/api/token/LoginWithSocialProvider",JSON.stringify({IDToken:s,Host:n}))),K(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(Ne),h(qe),h(Ie),h(Ke),h(dt),h(Fe),h(ht))},i.\u0275prov=b({token:i,factory:i.\u0275fac,providedIn:"root"});let r=i;return r})();export{qe as a,ze as b,Rn as c,kr as d,Cr as e,dt as f,Si as g};
|