marketplacepos 3.13.6 → 3.14.0

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.
Files changed (30) hide show
  1. package/Marketplace/{chunk-5JJXE2MC.js → chunk-27KRVOVV.js} +1 -1
  2. package/Marketplace/{chunk-7RG4QMZ5.js → chunk-2U52BOK6.js} +10 -9
  3. package/Marketplace/{chunk-YNZABQBT.js → chunk-5DAS2XHT.js} +1 -1
  4. package/Marketplace/{chunk-HGMVOP4Y.js → chunk-5RBA5Q4C.js} +1 -1
  5. package/Marketplace/{chunk-PDFJK5BS.js → chunk-6PK2RRGP.js} +1 -1
  6. package/Marketplace/{chunk-KTDWCJ72.js → chunk-7SN6N4WR.js} +1 -1
  7. package/Marketplace/{chunk-MPCFCS7E.js → chunk-AQJ4BQQR.js} +1 -1
  8. package/Marketplace/{chunk-WURSRUJ6.js → chunk-ARA5O5PX.js} +1 -1
  9. package/Marketplace/{chunk-PEHOS7ID.js → chunk-D6ANC3SS.js} +1 -1
  10. package/Marketplace/{chunk-NDKET6OE.js → chunk-F6UMOF3O.js} +1 -1
  11. package/Marketplace/{chunk-VLNDI7O4.js → chunk-FTV52HXX.js} +1 -1
  12. package/Marketplace/{chunk-6ISKWNDF.js → chunk-H5G3XI3T.js} +1 -1
  13. package/Marketplace/{chunk-LESDKUCO.js → chunk-HNOVDG7D.js} +1 -1
  14. package/Marketplace/{chunk-RGIOXKO6.js → chunk-HRKBU5UW.js} +1 -1
  15. package/Marketplace/chunk-J47B3BJQ.js +1 -0
  16. package/Marketplace/{chunk-KYWMKLBK.js → chunk-LBHJSQBZ.js} +1 -1
  17. package/Marketplace/{chunk-4P2A3C2Q.js → chunk-MOFF6ASU.js} +1 -1
  18. package/Marketplace/{chunk-CAQJ3BQQ.js → chunk-O2WRF4JL.js} +1 -1
  19. package/Marketplace/{chunk-RIGJVPMV.js → chunk-Q7FQTBT6.js} +1 -1
  20. package/Marketplace/{chunk-HVWWOW4E.js → chunk-SZX66K7N.js} +1 -1
  21. package/Marketplace/chunk-U75FY3SB.js +3 -0
  22. package/Marketplace/{chunk-22XUMF74.js → chunk-U7BIKZZA.js} +1 -1
  23. package/Marketplace/{chunk-RVE2N56F.js → chunk-VQQXE7MA.js} +1 -1
  24. package/Marketplace/{chunk-UGNLUR43.js → chunk-WVF7SHZL.js} +1 -1
  25. package/Marketplace/{chunk-R3Q3NT5H.js → chunk-ZPUPB7UU.js} +1 -1
  26. package/Marketplace/index.html +2 -2
  27. package/Marketplace/{main-V4SWZIDX.js → main-SOGOPFYM.js} +1 -1
  28. package/package.json +1 -1
  29. package/Marketplace/chunk-MLGEX4PW.js +0 -1
  30. package/Marketplace/chunk-QRSYRA7V.js +0 -3
@@ -1 +1 @@
1
- import{g as c}from"./chunk-KYWMKLBK.js";import{b as a}from"./chunk-DSF55IXM.js";import{$ as s,ca as o}from"./chunk-C3YE27TZ.js";var d=(()=>{let e=class e{constructor(i,t){this.toastr=i,this.authService=t}canActivate(i,t){let n=JSON.parse(window.localStorage.getItem("user")),l=new Date;if(n!=null){let p=new Date(n.Token.expiredAt);return l<p?!0:(this.onTokenExpired(),!1)}else return this.onTokenExpired(),!1}onTokenExpired(){this.toastr.error("Your session has expired. Please login again.","Session Expired").onShown.subscribe(()=>this.authService.logout())}};e.\u0275fac=function(t){return new(t||e)(o(a),o(c))},e.\u0275prov=s({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();export{d as a};
1
+ import{g as c}from"./chunk-LBHJSQBZ.js";import{b as a}from"./chunk-DSF55IXM.js";import{$ as s,ca as o}from"./chunk-C3YE27TZ.js";var d=(()=>{let e=class e{constructor(i,t){this.toastr=i,this.authService=t}canActivate(i,t){let n=JSON.parse(window.localStorage.getItem("user")),l=new Date;if(n!=null){let p=new Date(n.Token.expiredAt);return l<p?!0:(this.onTokenExpired(),!1)}else return this.onTokenExpired(),!1}onTokenExpired(){this.toastr.error("Your session has expired. Please login again.","Session Expired").onShown.subscribe(()=>this.authService.logout())}};e.\u0275fac=function(t){return new(t||e)(o(a),o(c))},e.\u0275prov=s({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();export{d as a};
@@ -1,2 +1,2 @@
1
- import{a as ke}from"./chunk-MLGEX4PW.js";import{a as Ue}from"./chunk-6U6JR5K6.js";import{a as Ve,b as Ne}from"./chunk-2LGY3VGP.js";import{a as Fe}from"./chunk-MSVZKMTY.js";import{a as De,d as we,e as Pe}from"./chunk-S5GA4AVB.js";import{f as Le}from"./chunk-KWFES5F7.js";import{f as xe}from"./chunk-KYWMKLBK.js";import{b as Te,e as ve}from"./chunk-DSF55IXM.js";import{b as D,c as w,i as P,j as E}from"./chunk-4R22UO7N.js";import{t as j}from"./chunk-MVPTQRFO.js";import{X as Ee}from"./chunk-EKCNJX26.js";import{b as Me,h as $,k as W,u as Oe}from"./chunk-B3LBEB32.js";import{b as p,c as v}from"./chunk-QPRFFPO5.js";import{$ as ce,$a as d,B as le,Bc as Se,Cb as he,Cc as be,Db as fe,Eb as ge,H as re,Ha as M,Hb as Y,Ia as s,Ib as c,Ja as g,Jb as S,K as se,Kb as O,Mb as k,Nb as V,Ob as N,Q as de,Qb as ue,Sb as Ce,T as q,V as H,Za as f,Zb as A,_a as Z,_b as B,ab as me,ac as J,c as z,ca as X,da as pe,ga as T,gb as ee,gd as Ie,lb as l,mb as r,n as ae,nb as b,oa as _,ob as F,pa as y,pb as U,q as K,rb as I,sc as _e,ub as u,uc as x,vc as R,wb as h,yc as ye,za as Q}from"./chunk-C3YE27TZ.js";function je(a,i){if(a&1&&(l(0,"mat-option",10)(1,"div",11),b(2,"img",12),l(3,"span"),c(4),r()()()),a&2){let n=i.$implicit;d("value",n.ID)("disabled",n.disabled),s(),d("matTooltip",n.disabled?"Single Product Scan disabled for this type of Channel":null),s(),d("src",n.Img,M),s(2),S(n.Name)}}function ze(a,i){if(a&1){let n=I();l(0,"div",13)(1,"label",14),c(2,"Scan Type"),r(),l(3,"mat-radio-group",15),N("ngModelChange",function(e){_(n);let o=h();return V(o.filter.ScanFull,e)||(o.filter.ScanFull=e),y(e)}),l(4,"mat-radio-button",16),c(5," Full (Include Inactive Products) "),r(),l(6,"mat-radio-button",17),c(7," Active "),r()()()}if(a&2){let n=h();s(3),k("ngModel",n.filter.ScanFull),s(),d("value",!0),s(2),d("value",!1)}}function Ge(a,i){a&1&&(l(0,"span"),c(1,"Never"),r())}function Ke(a,i){if(a&1&&(l(0,"span"),c(1),A(2,"async"),r()),a&2){let n=h(2);s(),S(B(2,1,n.lastSync$))}}function He(a,i){if(a&1){let n=I();l(0,"div",8)(1,"label",3)(2,"span",18),c(3,"Last Scan:"),r(),f(4,Ge,2,0,"span"),A(5,"async"),f(6,Ke,3,3,"span"),r(),l(7,"mat-radio-group",19),N("ngModelChange",function(e){_(n);let o=h();return V(o.filter.UpdatedProduct,e)||(o.filter.UpdatedProduct=e),y(e)}),l(8,"mat-radio-button",20),c(9," Scan All Products "),r(),l(10,"mat-radio-button",21),c(11),r()()()}if(a&2){let n=h();s(4),ee(B(5,6,n.lastSync$)==null?4:6),s(3),k("ngModel",n.filter.UpdatedProduct),s(),d("value",!1),s(2),d("value",!0)("matTooltip",n.selectedChannel.TypeID==n.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(),O(" ",n.selectedChannel.TypeID==n.channelType.Tokopedia?"Product Download By URL":"Scan Updated Products"," ")}}function Qe(a,i){if(a&1){let n=I();l(0,"div",8)(1,"label",3),c(2," Scan Option "),r(),l(3,"mat-radio-group",22),N("ngModelChange",function(e){_(n);let o=h();return V(o.filter.Async,e)||(o.filter.Async=e),y(e)}),l(4,"mat-radio-button",23),c(5," Asynchronous (Get Notified when Complete) "),r(),l(6,"mat-radio-button",24),c(7," Synchronous (Wait until Complete) "),r()()()}if(a&2){let n=h();s(3),k("ngModel",n.filter.Async),s(),d("value",!0),s(2),d("value",!1)}}var Mt=(()=>{let i=class i{constructor(t,e,o){this.dialogRef=t,this.data=e,this.router=o,this.channelService=pe(ke),this.channelType=p,this.disabledChannelOption=!1,this.filter={ChannelID:v.GuidEMpty,ScanFull:!0,UpdatedProduct:!1,Async:!1},this.isSingleChannel=v.IsNotEmpty(e.isSingleChannel)?this.data.isSingleChannel:!1,this.disabledChannelOption=v.IsEmpty(e.disabledChannelOption)?!1:this.data.disabledChannelOption}ngOnInit(){this.initChannelOptions(),this.initFilter(),this.onSelectChannel(this.data?.filter?.ChannelID),this.initModalConfig()}initModalConfig(){this.modalConfig=new P,this.modalConfig.title=this.isSingleChannel?"Scan Single Product":"Scan Channel 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(),this.getLastSync(t)}getLastSync(t){this.lastSync$=this.channelService.getLastSync(t).pipe(K(e=>v.IsNotEmpty(e.LastSync)?v.convertToReadableDate(e.LastSync):null),de(1))}setDefaultConfigUpdate(){this.filter.UpdatedProduct=!1,this.selectedChannel&&v.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&&!this.isSingleChannel?this.hasScanUpdate=!0:this.hasScanUpdate=!1}filterChannelById(t){let e;return this.channelOptions&&(e=this.channelOptions.find(o=>o.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.dialogRef.close(this.filter)}isNotEmpty(t){return v.IsNotEmpty(t)}onClose(){this.dialogRef.close()}};i.\u0275fac=function(e){return new(e||i)(g(D),g(w),g(Ie))},i.\u0275cmp=T({type:i,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"],[1,"mt-8"],["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,"me-2"],["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,o){e&1&&(l(0,"modal-material",0),u("onOk",function(){return o.submit()})("onClose",function(){return o.onClose()})("onCancel",function(){return o.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(o.filter.ChannelID,C)||(o.filter.ChannelID=C),C}),u("ngModelChange",function(C){return o.onSelectChannel(C)}),f(7,je,5,5,"mat-option",6),r()(),f(8,ze,8,3,"div",7)(9,He,12,8,"div",8)(10,Qe,8,3,"div",9),r()()()),e&2&&(d("dynamicValidated",o.isNotEmpty(o.filter.ChannelID))("config",o.modalConfig),s(6),d("disabled",o.disabledChannelOption),k("ngModel",o.filter.ChannelID),s(),d("ngForOf",o.channelOptions),s(),d("ngIf",!o.isSingleChannel&&o.isNotEmpty(o.filter.ChannelID)),s(),ee(o.hasScanUpdate&&o.selectedChannel?9:-1),s(),d("ngIf",!o.isSingleChannel&&o.isNotEmpty(o.filter.ChannelID)))},dependencies:[x,R,$,W,Ve,Ne,Le,Fe,Ee,j,E,ye],encapsulation:2});let a=i;return a})();var L=function(a){return a.Tokopedia="https://seller.tokopedia.com",a.Shoope="https://seller.shopee.co.id",a.Tiktok="https://seller-id.tiktok.com",a.WooCommerce="https://woocommerce.dealpos.app",a.Lazada="https://sellercenter.lazada.co.id",a}(L||{});var Ye=a=>({"is-disabled":a});function Je(a,i){if(a&1&&(F(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()()(),U()),a&2){let n=h().$implicit;s(3),O(" ",n==null?null:n.Model,""),s(2),O(" ",n==null?null:n.Code,"")}}function qe(a,i){if(a&1&&(l(0,"td",11),c(1),r()),a&2){let n=h(3).$implicit;Z("rowspan",n.Channel.length),s(),O(" ",n==null?null:n.Model,"")}}function Xe(a,i){if(a&1&&(l(0,"td",11),c(1),r()),a&2){let n=h(3).$implicit;Z("rowspan",n.Channel.length),s(),O(" ",n==null?null:n.Code,"")}}function Ze(a,i){if(a&1&&(l(0,"tr"),f(1,qe,2,2,"td",14)(2,Xe,2,2,"td",14),l(3,"td",11)(4,"div",15)(5,"a",16),b(6,"img",17),r(),l(7,"div",18),c(8),r()()(),l(9,"td",11),c(10),A(11,"number"),r(),l(12,"td",19),c(13),A(14,"number"),r(),l(15,"td",19)(16,"a",20),b(17,"i",21),l(18,"span",22),c(19,"Edit"),r()()()()),a&2){let n=i.$implicit,t=i.index,e=h(3);s(),d("ngIf",t==0),s(),d("ngIf",t==0),s(3),d("href",n.Url,M)("title",n.Title),s(),d("src",e.getChannelLogo(n.TypeID),M),s(),d("matTooltip",(n==null||n.Name==null?null:n.Name.length)>55?n==null?null:n.Name:""),s(),O(" ",n.Name," "),s(2),S(B(11,12,n.Price)),s(3),S(B(14,14,n.Inventory)),s(3),d("href",e.getHyperlinkSellerCenter(n),M)("ngClass",Ce(16,Ye,n.TypeID==e.channelType.KalCare))("matTooltip",n.TypeID!=e.channelType.KalCare?"Edit this product in Seller Center, inventory changes must be done via DEALPOS":"")}}function et(a,i){if(a&1&&f(0,Ze,20,18,"tr",9),a&2){let n=h().$implicit;d("ngForOf",n==null?null:n.Channel)}}function tt(a,i){if(a&1&&(F(0),f(1,Je,9,2,"ng-container",10)(2,et,1,1,"ng-template",null,0,J),U()),a&2){let n=i.$implicit,t=Y(3);s(),d("ngIf",!n.Channel||n.Channel.length<1)("ngIfElse",t)}}var Vt=(()=>{let i=class i{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 P,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}getChannelLogo(t){return v.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}};i.\u0275fac=function(e){return new(e||i)(g(w),g(D))},i.\u0275cmp=T({type:i,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,o){e&1&&(l(0,"modal-material",1),u("onCancel",function(){return o.dialogRef.close()}),l(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr")(5,"th",5),c(6," VARIANT "),l(7,"sup"),b(8,"i",6),r()(),l(9,"th",5),c(10,"SKU"),r(),l(11,"th",5),c(12," PRODUCT "),l(13,"sup"),b(14,"i",7),r()(),l(15,"th",5),c(16,"PRICE"),r(),l(17,"th",8),c(18,"INVENTORY"),r(),b(19,"th",5),r()(),l(20,"tbody"),f(21,tt,4,2,"ng-container",9),r()()()()),e&2&&(d("config",o.modalConfig),s(21),d("ngForOf",o.variants))},dependencies:[_e,x,R,j,E,Se],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 a=i;return a})();var nt=["selectId"];function it(a,i){if(a&1&&(l(0,"span",3),c(1),r()),a&2){let n=i.item,t=h();d("title",n[t.bindLabel]),s(),S(n[t.bindLabel])}}var Re=(()=>{let i=class i{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.placeholder="",this.bindValue="",this.bindLabel="",this.width="100%",this.clearable=!0,this.parent="body",this.disabled=!1,this.optionTitle=!1,this._selected="",this.ngSelectInfiniteScroll=new oe,this.selectedChange=new Q,this.selectedLabel=new Q,this.onOpen=new Q}onOpenSelect(){this.onOpen.emit()}onSelectChange(t){t?(this.selectedChange.emit(t[this.bindValue]),this.selectedLabel.emit(t[this.bindLabel])):(this.selectedChange.emit(null),this.selectedLabel.emit(null))}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=T({type:i,selectors:[["ng-select-infinite"]],viewQuery:function(e,o){if(e&1&&he(nt,7),e&2){let m;fe(m=ge())&&(o.ngSelectElement=m.first)}},inputs:{placeholder:"placeholder",bindValue:"bindValue",bindLabel:"bindLabel",width:"width",clearable:"clearable",parent:"parent",disabled:"disabled",optionTitle:"optionTitle",items:"items",selected:"selected"},outputs:{selectedChange:"selectedChange",selectedLabel:"selectedLabel",onOpen:"onOpen"},standalone:!0,features:[ue],decls:3,vars:12,consts:[["selectId",""],[3,"clear","scrollToEnd","open","change","appendTo","disabled","virtualScroll","typeahead","items","bindLabel","bindValue","placeholder","ngModel","clearable"],["ng-option-tmp",""],[3,"title"]],template:function(e,o){if(e&1){let m=I();l(0,"ng-select",1,0),u("clear",function(){return _(m),y(o.ngSelectInfiniteScroll.onClear())})("scrollToEnd",function(){return _(m),y(o.ngSelectInfiniteScroll.onScrollToEnd())})("open",function(){return _(m),y(o.onOpenSelect())})("change",function(We){return _(m),y(o.onSelectChange(We))}),f(2,it,2,2,"ng-template",2),r()}e&2&&(me("width",o.width),d("appendTo",o.parent)("disabled",o.disabled)("virtualScroll",!0)("typeahead",o.ngSelectInfiniteScroll.input$)("items",o.ngSelectInfiniteScroll.bufferData)("bindLabel",o.bindLabel)("bindValue",o.bindValue)("placeholder",o.placeholder)("ngModel",o.selected)("clearable",o.clearable))},dependencies:[be,Pe,we,De,Oe,$,W]});let a=i;return a})(),oe=class{constructor(){this._dataBuffer=[],this._data=[],this._input$=new z,this._destroy$=new z,this._loading=!1,this._bufferSize=50,this.data=[]}onSearch(){this._input$.pipe(re(200),se(),K(i=>(i&&(i=i.toLowerCase()),this.filterData(i))),le(i=>i!==void 0),H(this._destroy$)).subscribe(i=>{this._dataBuffer=i.slice(0,this._bufferSize)})}onClear(){this._dataBuffer=this._data.slice(0,this._bufferSize)}filterData(i){let n=-1,t;return this._data.filter(o=>(t=JSON.stringify(o).toLowerCase(),n=t.indexOf(i),n!==-1||i==null))}get input$(){return this._input$}get bufferData(){return this._dataBuffer}get loading(){return this._loading}set data(i){this._data=i||[],this._dataBuffer=this._data.slice(0,this._bufferSize),this.onSearch()}initSelectedValue(i,n){if(Ue.IsNotEmpty(i)){let t=this._data.filter(e=>e[n].toString().toLowerCase().indexOf(i)!==-1);this._dataBuffer=t.slice(0,this._bufferSize)}}set bufferSize(i){this._bufferSize=i}onScrollToEnd(){this.fetchMore()}fetchMore(){let i=this._dataBuffer.length,n=this._data.slice(i,this._bufferSize+i);this._loading=!0,setTimeout(()=>{this._loading=!1,this._dataBuffer=this._dataBuffer.concat(n)},200)}destroy(){this._destroy$.next(!0),this._destroy$.complete()}};var $e=(()=>{let i=class i{constructor(t,e){this.LocalData=t,this.httpService=e}getCategoriesByTypeId(t,e){return this.LocalData.getCategoriesByChannelType(t).pipe(q(o=>o!=null?ae(o):this._getCategoriesByTypeID(t,e)))}_getCategoriesByTypeID(t,e){let o={TypeID:t,ID:e};return this.httpService.post("/api/Channel/getCategoriesByTypeID",o).pipe(q(m=>this.LocalData.saveCategoriesByChannelType(m,t)))}};i.\u0275fac=function(e){return new(e||i)(X(xe),X(ve))},i.\u0275prov=ce({token:i,factory:i.\u0275fac,providedIn:"root"});let a=i;return a})();function lt(a,i){if(a&1){let n=I();F(0),l(1,"ng-select-infinite",16),u("selectedChange",function(e){_(n);let o=h().index,m=h();return y(m.onSelectCategory(e,o))}),r(),U()}if(a&2){let n=h().$implicit;s(),d("items",n.Categories)("clearable",!1)}}function rt(a,i){if(a&1&&(l(0,"div",17),b(1,"input",18),r()),a&2){let n=h().$implicit,t=h();d("matTooltip",t.channelType.WooCommerce==n.TypeID||t.channelType.Shopify==n.TypeID?"":"Product Category is Harcoded, Please Change Product Category in Seller Center"),s(),d("placeholder",t.getChannelCategory(n.TypeID))}}function st(a,i){if(a&1){let n=I();F(0),l(1,"tr")(2,"td",10)(3,"input",11),N("ngModelChange",function(e){let o=_(n).$implicit;return V(o.Selected,e)||(o.Selected=e),y(e)}),u("ngModelChange",function(){_(n);let e=h();return y(e.onSelectChannel())}),r()(),l(4,"td")(5,"div",12),b(6,"img",13),l(7,"span",14),c(8),r()()(),l(9,"td"),f(10,lt,2,2,"ng-container",15)(11,rt,2,2,"ng-template",null,0,J),r()(),U()}if(a&2){let n=i.$implicit,t=Y(12);s(3),k("ngModel",n.Selected),s(3),d("src",n==null?null:n.Img,M)("alt",n.Name),s(2),S(n.Name),s(2),d("ngIf",n.Categories.length>0)("ngIfElse",t)}}var tn=(()=>{let i=class i{constructor(t,e,o,m){this.data=t,this.channelService=e,this.dialogRef=o,this.toastrService=m,this.channelOptions=[],this.uploadResponse=[],this.channelType=p,this.enableBtnOk=!1,this.destroy$=new z,this.uploadResponse=[],this.channels=this.data.channels,this.product=t.product}ngOnInit(){this.initModalConfig(),this.initChannelOptions(),this.initCategories()}initModalConfig(){this.modalConfig=new P,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(o=>{this.setCategoriesChannelOption(e.channelType,o)})})}setCategoriesChannelOption(t,e){this.channelOptions=this.channelOptions.map(o=>(o.TypeID==t&&(o.Categories=e),o))}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,o,m)=>m.findIndex(C=>e.channelType==C.channelType)==o).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()}};i.\u0275fac=function(e){return new(e||i)(g(w),g($e),g(D),g(Te))},i.\u0275cmp=T({type:i,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,o){e&1&&(l(0,"modal-material",1),u("onOk",function(){return o.onSave()})("onClose",function(){return o.onClose()})("onCancel",function(){return o.onClose()}),l(1,"div",2)(2,"table",3)(3,"thead")(4,"tr")(5,"th",4)(6,"input",5),u("change",function(C){return o.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"),f(14,st,13,6,"ng-container",9),r()()()()),e&2&&(d("dynamicValidated",o.enableBtnOk)("config",o.modalConfig),s(14),d("ngForOf",o.channelOptions))},dependencies:[x,R,Me,$,W,j,E,Re],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 ke}from"./chunk-J47B3BJQ.js";import{a as Ue}from"./chunk-6U6JR5K6.js";import{a as Fe}from"./chunk-MSVZKMTY.js";import{a as Ve,b as Ne}from"./chunk-2LGY3VGP.js";import{a as De,d as we,e as Pe}from"./chunk-S5GA4AVB.js";import{f as Le}from"./chunk-KWFES5F7.js";import{f as xe}from"./chunk-LBHJSQBZ.js";import{b as Te,e as ve}from"./chunk-DSF55IXM.js";import{b as D,c as w,i as P,j as E}from"./chunk-4R22UO7N.js";import{t as j}from"./chunk-MVPTQRFO.js";import{X as Ee}from"./chunk-EKCNJX26.js";import{b as Me,h as $,k as W,u as Oe}from"./chunk-B3LBEB32.js";import{b as p,c as v}from"./chunk-QPRFFPO5.js";import{$ as ce,$a as d,B as le,Bc as Se,Cb as he,Cc as be,Db as fe,Eb as ge,H as re,Ha as M,Hb as Y,Ia as s,Ib as c,Ja as g,Jb as S,K as se,Kb as O,Mb as k,Nb as V,Ob as N,Q as de,Qb as ue,Sb as Ce,T as q,V as H,Za as f,Zb as A,_a as Z,_b as B,ab as me,ac as J,c as z,ca as X,da as pe,ga as T,gb as ee,gd as Ie,lb as l,mb as r,n as ae,nb as b,oa as _,ob as F,pa as y,pb as U,q as K,rb as I,sc as _e,ub as u,uc as x,vc as R,wb as h,yc as ye,za as Q}from"./chunk-C3YE27TZ.js";function je(a,i){if(a&1&&(l(0,"mat-option",10)(1,"div",11),b(2,"img",12),l(3,"span"),c(4),r()()()),a&2){let n=i.$implicit;d("value",n.ID)("disabled",n.disabled),s(),d("matTooltip",n.disabled?"Single Product Scan disabled for this type of Channel":null),s(),d("src",n.Img,M),s(2),S(n.Name)}}function ze(a,i){if(a&1){let n=I();l(0,"div",13)(1,"label",14),c(2,"Scan Type"),r(),l(3,"mat-radio-group",15),N("ngModelChange",function(e){_(n);let o=h();return V(o.filter.ScanFull,e)||(o.filter.ScanFull=e),y(e)}),l(4,"mat-radio-button",16),c(5," Full (Include Inactive Products) "),r(),l(6,"mat-radio-button",17),c(7," Active "),r()()()}if(a&2){let n=h();s(3),k("ngModel",n.filter.ScanFull),s(),d("value",!0),s(2),d("value",!1)}}function Ge(a,i){a&1&&(l(0,"span"),c(1,"Never"),r())}function Ke(a,i){if(a&1&&(l(0,"span"),c(1),A(2,"async"),r()),a&2){let n=h(2);s(),S(B(2,1,n.lastSync$))}}function He(a,i){if(a&1){let n=I();l(0,"div",8)(1,"label",3)(2,"span",18),c(3,"Last Scan:"),r(),f(4,Ge,2,0,"span"),A(5,"async"),f(6,Ke,3,3,"span"),r(),l(7,"mat-radio-group",19),N("ngModelChange",function(e){_(n);let o=h();return V(o.filter.UpdatedProduct,e)||(o.filter.UpdatedProduct=e),y(e)}),l(8,"mat-radio-button",20),c(9," Scan All Products "),r(),l(10,"mat-radio-button",21),c(11),r()()()}if(a&2){let n=h();s(4),ee(B(5,6,n.lastSync$)==null?4:6),s(3),k("ngModel",n.filter.UpdatedProduct),s(),d("value",!1),s(2),d("value",!0)("matTooltip",n.selectedChannel.TypeID==n.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(),O(" ",n.selectedChannel.TypeID==n.channelType.Tokopedia?"Product Download By URL":"Scan Updated Products"," ")}}function Qe(a,i){if(a&1){let n=I();l(0,"div",8)(1,"label",3),c(2," Scan Option "),r(),l(3,"mat-radio-group",22),N("ngModelChange",function(e){_(n);let o=h();return V(o.filter.Async,e)||(o.filter.Async=e),y(e)}),l(4,"mat-radio-button",23),c(5," Asynchronous (Get Notified when Complete) "),r(),l(6,"mat-radio-button",24),c(7," Synchronous (Wait until Complete) "),r()()()}if(a&2){let n=h();s(3),k("ngModel",n.filter.Async),s(),d("value",!0),s(2),d("value",!1)}}var Mt=(()=>{let i=class i{constructor(t,e,o){this.dialogRef=t,this.data=e,this.router=o,this.channelService=pe(ke),this.channelType=p,this.disabledChannelOption=!1,this.filter={ChannelID:v.GuidEMpty,ScanFull:!0,UpdatedProduct:!1,Async:!1},this.isSingleChannel=v.IsNotEmpty(e.isSingleChannel)?this.data.isSingleChannel:!1,this.disabledChannelOption=v.IsEmpty(e.disabledChannelOption)?!1:this.data.disabledChannelOption}ngOnInit(){this.initChannelOptions(),this.initFilter(),this.onSelectChannel(this.data?.filter?.ChannelID),this.initModalConfig()}initModalConfig(){this.modalConfig=new P,this.modalConfig.title=this.isSingleChannel?"Scan Single Product":"Scan Channel 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(),this.getLastSync(t)}getLastSync(t){this.lastSync$=this.channelService.getLastSync(t).pipe(K(e=>v.IsNotEmpty(e.LastSync)?v.convertToReadableDate(e.LastSync):null),de(1))}setDefaultConfigUpdate(){this.filter.UpdatedProduct=!1,this.selectedChannel&&v.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&&!this.isSingleChannel?this.hasScanUpdate=!0:this.hasScanUpdate=!1}filterChannelById(t){let e;return this.channelOptions&&(e=this.channelOptions.find(o=>o.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.dialogRef.close(this.filter)}isNotEmpty(t){return v.IsNotEmpty(t)}onClose(){this.dialogRef.close()}};i.\u0275fac=function(e){return new(e||i)(g(D),g(w),g(Ie))},i.\u0275cmp=T({type:i,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"],[1,"mt-8"],["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,"me-2"],["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,o){e&1&&(l(0,"modal-material",0),u("onOk",function(){return o.submit()})("onClose",function(){return o.onClose()})("onCancel",function(){return o.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(o.filter.ChannelID,C)||(o.filter.ChannelID=C),C}),u("ngModelChange",function(C){return o.onSelectChannel(C)}),f(7,je,5,5,"mat-option",6),r()(),f(8,ze,8,3,"div",7)(9,He,12,8,"div",8)(10,Qe,8,3,"div",9),r()()()),e&2&&(d("dynamicValidated",o.isNotEmpty(o.filter.ChannelID))("config",o.modalConfig),s(6),d("disabled",o.disabledChannelOption),k("ngModel",o.filter.ChannelID),s(),d("ngForOf",o.channelOptions),s(),d("ngIf",!o.isSingleChannel&&o.isNotEmpty(o.filter.ChannelID)),s(),ee(o.hasScanUpdate&&o.selectedChannel?9:-1),s(),d("ngIf",!o.isSingleChannel&&o.isNotEmpty(o.filter.ChannelID)))},dependencies:[x,R,$,W,Ve,Ne,Le,Fe,Ee,j,E,ye],encapsulation:2});let a=i;return a})();var L=function(a){return a.Tokopedia="https://seller.tokopedia.com",a.Shoope="https://seller.shopee.co.id",a.Tiktok="https://seller-id.tiktok.com",a.WooCommerce="https://woocommerce.dealpos.app",a.Lazada="https://sellercenter.lazada.co.id",a}(L||{});var Ye=a=>({"is-disabled":a});function Je(a,i){if(a&1&&(F(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()()(),U()),a&2){let n=h().$implicit;s(3),O(" ",n==null?null:n.Model,""),s(2),O(" ",n==null?null:n.Code,"")}}function qe(a,i){if(a&1&&(l(0,"td",11),c(1),r()),a&2){let n=h(3).$implicit;Z("rowspan",n.Channel.length),s(),O(" ",n==null?null:n.Model,"")}}function Xe(a,i){if(a&1&&(l(0,"td",11),c(1),r()),a&2){let n=h(3).$implicit;Z("rowspan",n.Channel.length),s(),O(" ",n==null?null:n.Code,"")}}function Ze(a,i){if(a&1&&(l(0,"tr"),f(1,qe,2,2,"td",14)(2,Xe,2,2,"td",14),l(3,"td",11)(4,"div",15)(5,"a",16),b(6,"img",17),r(),l(7,"div",18),c(8),r()()(),l(9,"td",11),c(10),A(11,"number"),r(),l(12,"td",19),c(13),A(14,"number"),r(),l(15,"td",19)(16,"a",20),b(17,"i",21),l(18,"span",22),c(19,"Edit"),r()()()()),a&2){let n=i.$implicit,t=i.index,e=h(3);s(),d("ngIf",t==0),s(),d("ngIf",t==0),s(3),d("href",n.Url,M)("title",n.Title),s(),d("src",e.getChannelLogo(n.TypeID),M),s(),d("matTooltip",(n==null||n.Name==null?null:n.Name.length)>55?n==null?null:n.Name:""),s(),O(" ",n.Name," "),s(2),S(B(11,12,n.Price)),s(3),S(B(14,14,n.Inventory)),s(3),d("href",e.getHyperlinkSellerCenter(n),M)("ngClass",Ce(16,Ye,n.TypeID==e.channelType.KalCare))("matTooltip",n.TypeID!=e.channelType.KalCare?"Edit this product in Seller Center, inventory changes must be done via DEALPOS":"")}}function et(a,i){if(a&1&&f(0,Ze,20,18,"tr",9),a&2){let n=h().$implicit;d("ngForOf",n==null?null:n.Channel)}}function tt(a,i){if(a&1&&(F(0),f(1,Je,9,2,"ng-container",10)(2,et,1,1,"ng-template",null,0,J),U()),a&2){let n=i.$implicit,t=Y(3);s(),d("ngIf",!n.Channel||n.Channel.length<1)("ngIfElse",t)}}var Vt=(()=>{let i=class i{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 P,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}getChannelLogo(t){return v.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}};i.\u0275fac=function(e){return new(e||i)(g(w),g(D))},i.\u0275cmp=T({type:i,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,o){e&1&&(l(0,"modal-material",1),u("onCancel",function(){return o.dialogRef.close()}),l(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr")(5,"th",5),c(6," VARIANT "),l(7,"sup"),b(8,"i",6),r()(),l(9,"th",5),c(10,"SKU"),r(),l(11,"th",5),c(12," PRODUCT "),l(13,"sup"),b(14,"i",7),r()(),l(15,"th",5),c(16,"PRICE"),r(),l(17,"th",8),c(18,"INVENTORY"),r(),b(19,"th",5),r()(),l(20,"tbody"),f(21,tt,4,2,"ng-container",9),r()()()()),e&2&&(d("config",o.modalConfig),s(21),d("ngForOf",o.variants))},dependencies:[_e,x,R,j,E,Se],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 a=i;return a})();var nt=["selectId"];function it(a,i){if(a&1&&(l(0,"span",3),c(1),r()),a&2){let n=i.item,t=h();d("title",n[t.bindLabel]),s(),S(n[t.bindLabel])}}var Re=(()=>{let i=class i{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.placeholder="",this.bindValue="",this.bindLabel="",this.width="100%",this.clearable=!0,this.parent="body",this.disabled=!1,this.optionTitle=!1,this._selected="",this.ngSelectInfiniteScroll=new oe,this.selectedChange=new Q,this.selectedLabel=new Q,this.onOpen=new Q}onOpenSelect(){this.onOpen.emit()}onSelectChange(t){t?(this.selectedChange.emit(t[this.bindValue]),this.selectedLabel.emit(t[this.bindLabel])):(this.selectedChange.emit(null),this.selectedLabel.emit(null))}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=T({type:i,selectors:[["ng-select-infinite"]],viewQuery:function(e,o){if(e&1&&he(nt,7),e&2){let m;fe(m=ge())&&(o.ngSelectElement=m.first)}},inputs:{placeholder:"placeholder",bindValue:"bindValue",bindLabel:"bindLabel",width:"width",clearable:"clearable",parent:"parent",disabled:"disabled",optionTitle:"optionTitle",items:"items",selected:"selected"},outputs:{selectedChange:"selectedChange",selectedLabel:"selectedLabel",onOpen:"onOpen"},standalone:!0,features:[ue],decls:3,vars:12,consts:[["selectId",""],[3,"clear","scrollToEnd","open","change","appendTo","disabled","virtualScroll","typeahead","items","bindLabel","bindValue","placeholder","ngModel","clearable"],["ng-option-tmp",""],[3,"title"]],template:function(e,o){if(e&1){let m=I();l(0,"ng-select",1,0),u("clear",function(){return _(m),y(o.ngSelectInfiniteScroll.onClear())})("scrollToEnd",function(){return _(m),y(o.ngSelectInfiniteScroll.onScrollToEnd())})("open",function(){return _(m),y(o.onOpenSelect())})("change",function(We){return _(m),y(o.onSelectChange(We))}),f(2,it,2,2,"ng-template",2),r()}e&2&&(me("width",o.width),d("appendTo",o.parent)("disabled",o.disabled)("virtualScroll",!0)("typeahead",o.ngSelectInfiniteScroll.input$)("items",o.ngSelectInfiniteScroll.bufferData)("bindLabel",o.bindLabel)("bindValue",o.bindValue)("placeholder",o.placeholder)("ngModel",o.selected)("clearable",o.clearable))},dependencies:[be,Pe,we,De,Oe,$,W]});let a=i;return a})(),oe=class{constructor(){this._dataBuffer=[],this._data=[],this._input$=new z,this._destroy$=new z,this._loading=!1,this._bufferSize=50,this.data=[]}onSearch(){this._input$.pipe(re(200),se(),K(i=>(i&&(i=i.toLowerCase()),this.filterData(i))),le(i=>i!==void 0),H(this._destroy$)).subscribe(i=>{this._dataBuffer=i.slice(0,this._bufferSize)})}onClear(){this._dataBuffer=this._data.slice(0,this._bufferSize)}filterData(i){let n=-1,t;return this._data.filter(o=>(t=JSON.stringify(o).toLowerCase(),n=t.indexOf(i),n!==-1||i==null))}get input$(){return this._input$}get bufferData(){return this._dataBuffer}get loading(){return this._loading}set data(i){this._data=i||[],this._dataBuffer=this._data.slice(0,this._bufferSize),this.onSearch()}initSelectedValue(i,n){if(Ue.IsNotEmpty(i)){let t=this._data.filter(e=>e[n].toString().toLowerCase().indexOf(i)!==-1);this._dataBuffer=t.slice(0,this._bufferSize)}}set bufferSize(i){this._bufferSize=i}onScrollToEnd(){this.fetchMore()}fetchMore(){let i=this._dataBuffer.length,n=this._data.slice(i,this._bufferSize+i);this._loading=!0,setTimeout(()=>{this._loading=!1,this._dataBuffer=this._dataBuffer.concat(n)},200)}destroy(){this._destroy$.next(!0),this._destroy$.complete()}};var $e=(()=>{let i=class i{constructor(t,e){this.LocalData=t,this.httpService=e}getCategoriesByTypeId(t,e){return this.LocalData.getCategoriesByChannelType(t).pipe(q(o=>o!=null?ae(o):this._getCategoriesByTypeID(t,e)))}_getCategoriesByTypeID(t,e){let o={TypeID:t,ID:e};return this.httpService.post("/api/Channel/getCategoriesByTypeID",o).pipe(q(m=>this.LocalData.saveCategoriesByChannelType(m,t)))}};i.\u0275fac=function(e){return new(e||i)(X(xe),X(ve))},i.\u0275prov=ce({token:i,factory:i.\u0275fac,providedIn:"root"});let a=i;return a})();function lt(a,i){if(a&1){let n=I();F(0),l(1,"ng-select-infinite",16),u("selectedChange",function(e){_(n);let o=h().index,m=h();return y(m.onSelectCategory(e,o))}),r(),U()}if(a&2){let n=h().$implicit;s(),d("items",n.Categories)("clearable",!1)}}function rt(a,i){if(a&1&&(l(0,"div",17),b(1,"input",18),r()),a&2){let n=h().$implicit,t=h();d("matTooltip",t.channelType.WooCommerce==n.TypeID||t.channelType.Shopify==n.TypeID?"":"Product Category is Harcoded, Please Change Product Category in Seller Center"),s(),d("placeholder",t.getChannelCategory(n.TypeID))}}function st(a,i){if(a&1){let n=I();F(0),l(1,"tr")(2,"td",10)(3,"input",11),N("ngModelChange",function(e){let o=_(n).$implicit;return V(o.Selected,e)||(o.Selected=e),y(e)}),u("ngModelChange",function(){_(n);let e=h();return y(e.onSelectChannel())}),r()(),l(4,"td")(5,"div",12),b(6,"img",13),l(7,"span",14),c(8),r()()(),l(9,"td"),f(10,lt,2,2,"ng-container",15)(11,rt,2,2,"ng-template",null,0,J),r()(),U()}if(a&2){let n=i.$implicit,t=Y(12);s(3),k("ngModel",n.Selected),s(3),d("src",n==null?null:n.Img,M)("alt",n.Name),s(2),S(n.Name),s(2),d("ngIf",n.Categories.length>0)("ngIfElse",t)}}var tn=(()=>{let i=class i{constructor(t,e,o,m){this.data=t,this.channelService=e,this.dialogRef=o,this.toastrService=m,this.channelOptions=[],this.uploadResponse=[],this.channelType=p,this.enableBtnOk=!1,this.destroy$=new z,this.uploadResponse=[],this.channels=this.data.channels,this.product=t.product}ngOnInit(){this.initModalConfig(),this.initChannelOptions(),this.initCategories()}initModalConfig(){this.modalConfig=new P,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(o=>{this.setCategoriesChannelOption(e.channelType,o)})})}setCategoriesChannelOption(t,e){this.channelOptions=this.channelOptions.map(o=>(o.TypeID==t&&(o.Categories=e),o))}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,o,m)=>m.findIndex(C=>e.channelType==C.channelType)==o).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()}};i.\u0275fac=function(e){return new(e||i)(g(w),g($e),g(D),g(Te))},i.\u0275cmp=T({type:i,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,o){e&1&&(l(0,"modal-material",1),u("onOk",function(){return o.onSave()})("onClose",function(){return o.onClose()})("onCancel",function(){return o.onClose()}),l(1,"div",2)(2,"table",3)(3,"thead")(4,"tr")(5,"th",4)(6,"input",5),u("change",function(C){return o.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"),f(14,st,13,6,"ng-container",9),r()()()()),e&2&&(d("dynamicValidated",o.enableBtnOk)("config",o.modalConfig),s(14),d("ngForOf",o.channelOptions))},dependencies:[x,R,Me,$,W,j,E,Re],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 a=i;return a})();function dt(a,i){if(a&1&&(l(0,"tr")(1,"td"),c(2),r(),l(3,"td"),c(4),r()()),a&2){let n=i.$implicit;s(2),S(n==null?null:n.Name),s(2),S(n==null?null:n.ChannelVariationSKU)}}var ln=(()=>{let i=class i{constructor(t,e){this.data=t,this.dialogRef=e}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new P,this.modalConfig.title=this.data?.title,this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0,this.modalConfig.bodyScrollable=!0}};i.\u0275fac=function(e){return new(e||i)(g(w),g(D))},i.\u0275cmp=T({type:i,selectors:[["app-modal-variants"]],decls:11,vars:2,consts:[[3,"onCancel","config"],["content",""],[1,"table"],[1,"sticky-top-thead","variant-modal"],[1,"sticky-top"],[4,"ngFor","ngForOf"]],template:function(e,o){e&1&&(l(0,"modal-material",0),u("onCancel",function(){return o.dialogRef.close()}),l(1,"div",1)(2,"table",2)(3,"thead",3)(4,"tr")(5,"th",4),c(6,"Variant"),r(),l(7,"th",4),c(8,"SKU"),r()()(),l(9,"tbody"),f(10,dt,5,2,"tr",5),r()()()()),e&2&&(d("config",o.modalConfig),s(10),d("ngForOf",o.data.variants))},dependencies:[x,E],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:#f6f6f6!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}"]});let a=i;return a})();export{Mt as a,Vt as b,Re as c,tn as d,ln as e};
@@ -1 +1 @@
1
- import{a as b}from"./chunk-V4UFHWKE.js";import{a as h,b as P}from"./chunk-HXDXTE2F.js";import{a as C}from"./chunk-YZ42FKNJ.js";import{c as M}from"./chunk-2LGY3VGP.js";import{b as O}from"./chunk-QZKWUCMY.js";import"./chunk-MSVZKMTY.js";import"./chunk-RZ7FKABW.js";import{e as s}from"./chunk-S5GA4AVB.js";import{a as p}from"./chunk-22XUMF74.js";import"./chunk-RMD2ZXUN.js";import"./chunk-KWFES5F7.js";import"./chunk-KYWMKLBK.js";import"./chunk-DSF55IXM.js";import"./chunk-KCDL7SWP.js";import{m as u}from"./chunk-4R22UO7N.js";import{u as f}from"./chunk-MVPTQRFO.js";import"./chunk-EKCNJX26.js";import{u as g}from"./chunk-B3LBEB32.js";import"./chunk-QPRFFPO5.js";import{Cc as i,aa as e,fd as l,ga as d,ha as r,jd as m,nb as c}from"./chunk-C3YE27TZ.js";import"./chunk-GNOSNGXM.js";var _=(()=>{let t=class t{};t.\u0275fac=function(n){return new(n||t)},t.\u0275cmp=d({type:t,selectors:[["app-products"]],decls:1,vars:0,template:function(n,v){n&1&&c(0,"router-outlet")},dependencies:[l],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}"]});let o=t;return o})();var y=[{path:"",component:_,children:[{path:"",redirectTo:"status",pathMatch:"full"},{path:"status",loadChildren:()=>import("./chunk-PDFJK5BS.js").then(o=>o.StatusModule),canActivate:[p]},{path:"download",loadChildren:()=>import("./chunk-MPCFCS7E.js").then(o=>o.DownloadModule),canActivate:[p]}]}],w=(()=>{let t=class t{};t.\u0275fac=function(n){return new(n||t)},t.\u0275mod=r({type:t}),t.\u0275inj=e({imports:[i,m.forChild(y)]});let o=t;return o})();var W=(()=>{let t=class t{};t.\u0275fac=function(n){return new(n||t)},t.\u0275mod=r({type:t}),t.\u0275inj=e({imports:[i,g,m,w,f,u,s,O,C,M,h,P,b]});let o=t;return o})();export{W as ProductModule};
1
+ import{a as b}from"./chunk-V4UFHWKE.js";import{a as h,b as P}from"./chunk-HXDXTE2F.js";import{a as C}from"./chunk-YZ42FKNJ.js";import{b as O}from"./chunk-QZKWUCMY.js";import"./chunk-MSVZKMTY.js";import{c as M}from"./chunk-2LGY3VGP.js";import"./chunk-RZ7FKABW.js";import{e as s}from"./chunk-S5GA4AVB.js";import{a as p}from"./chunk-U7BIKZZA.js";import"./chunk-RMD2ZXUN.js";import"./chunk-KWFES5F7.js";import"./chunk-LBHJSQBZ.js";import"./chunk-DSF55IXM.js";import"./chunk-KCDL7SWP.js";import{m as u}from"./chunk-4R22UO7N.js";import{u as f}from"./chunk-MVPTQRFO.js";import"./chunk-EKCNJX26.js";import{u as g}from"./chunk-B3LBEB32.js";import"./chunk-QPRFFPO5.js";import{Cc as i,aa as e,fd as l,ga as d,ha as r,jd as m,nb as c}from"./chunk-C3YE27TZ.js";import"./chunk-GNOSNGXM.js";var _=(()=>{let t=class t{};t.\u0275fac=function(n){return new(n||t)},t.\u0275cmp=d({type:t,selectors:[["app-products"]],decls:1,vars:0,template:function(n,v){n&1&&c(0,"router-outlet")},dependencies:[l],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}"]});let o=t;return o})();var y=[{path:"",component:_,children:[{path:"",redirectTo:"status",pathMatch:"full"},{path:"status",loadChildren:()=>import("./chunk-6PK2RRGP.js").then(o=>o.StatusModule),canActivate:[p]},{path:"download",loadChildren:()=>import("./chunk-AQJ4BQQR.js").then(o=>o.DownloadModule),canActivate:[p]}]}],w=(()=>{let t=class t{};t.\u0275fac=function(n){return new(n||t)},t.\u0275mod=r({type:t}),t.\u0275inj=e({imports:[i,m.forChild(y)]});let o=t;return o})();var W=(()=>{let t=class t{};t.\u0275fac=function(n){return new(n||t)},t.\u0275mod=r({type:t}),t.\u0275inj=e({imports:[i,g,m,w,f,u,s,O,C,M,h,P,b]});let o=t;return o})();export{W as ProductModule};
@@ -1 +1 @@
1
- import{a as ve}from"./chunk-IWVYX6KY.js";import{a as Me}from"./chunk-V6L3NRY3.js";import{a as ye,b as Ie,c as we}from"./chunk-2LGY3VGP.js";import"./chunk-4P2A3C2Q.js";import{a as Oe}from"./chunk-VOWLO2M7.js";import{a as K}from"./chunk-BSBYMQ7J.js";import{a as De,b as X,c as Ve}from"./chunk-L34D7YAZ.js";import"./chunk-YG3KQ63T.js";import{a as he}from"./chunk-662E5VTA.js";import{a as Fe,c as Ee}from"./chunk-5WXM6HSA.js";import"./chunk-JTJLVSTV.js";import"./chunk-IPYNDMGQ.js";import{a as Te}from"./chunk-RMD2ZXUN.js";import"./chunk-KWFES5F7.js";import{g as xe}from"./chunk-KYWMKLBK.js";import{b as _e,e as ue}from"./chunk-DSF55IXM.js";import"./chunk-KCDL7SWP.js";import{d as Pe,l as be,m as Se}from"./chunk-4R22UO7N.js";import{t as j,u as W}from"./chunk-MVPTQRFO.js";import"./chunk-EKCNJX26.js";import{b as ge,h as L,k as U,u as A}from"./chunk-B3LBEB32.js";import{c as J,e as Ce,f as fe}from"./chunk-QPRFFPO5.js";import{$a as s,$b as ce,B as G,Bc as de,Cc as $,Ha as T,Hb as z,Ia as l,Ib as p,Ja as S,Jb as oe,Kb as P,Lb as re,Mb as V,Nb as N,Ob as k,Pb as ae,Q as Y,Qb as B,Sb as F,Tb as le,X as q,Za as g,Zb as b,_b as w,ac as H,cb as te,da as Q,ga as D,gb as ne,hb as E,jb as M,kb as O,lb as a,mb as c,nb as x,oa as C,ob as v,pa as f,pb as y,q as Z,rb as I,sc as se,ub as h,uc as R,vc as me,wb as m,yc as pe,za as ee,zb as ie}from"./chunk-C3YE27TZ.js";import"./chunk-GNOSNGXM.js";var Ue=(t,r)=>({color:t,"font-weight":r});function Ae(t,r){if(t&1&&(a(0,"mat-radio-button",2),p(1),c()),t&2){let i=r.$implicit,o=r.index,e=m();te(le(7,Ue,e.model==i.Key&&e.activeBold?"#0976b4":"",e.model==i.Key&&e.activeBold?"700":"")),s("disabled",e.exception==i.Value)("matTooltip",e.title.length>0?e.title[o]:"")("value",i.Key)("name",e.name),l(),P("",i.Value," ")}}var Ne=(()=>{let r=class r{constructor(){this.disabled=!1,this.modelChange=new ee,this.options=[{Key:!1,Value:"No"},{Key:!0,Value:"Yes"}],this.border=!1,this.name="",this.title=[],this.exception="",this.activeBold=""}change(o){this.modelChange.emit(o)}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=D({type:r,selectors:[["lib-radio-options"]],inputs:{model:"model",disabled:"disabled",options:"options",border:"border",name:"name",title:"title",exception:"exception",activeBold:"activeBold"},outputs:{modelChange:"modelChange"},standalone:!0,features:[B],decls:2,vars:3,consts:[["color","primary",3,"ngModelChange","disabled","ngModel"],["matTooltipPosition","above","class","me-4 mt-1",3,"style","disabled","matTooltip","value","name",4,"ngFor","ngForOf"],["matTooltipPosition","above",1,"me-4","mt-1",3,"disabled","matTooltip","value","name"]],template:function(e,n){e&1&&(a(0,"mat-radio-group",0),h("ngModelChange",function(_){return n.change(_)}),g(1,Ae,2,10,"mat-radio-button",1),c()),e&2&&(s("disabled",n.disabled)("ngModel",n.model),l(),s("ngForOf",n.options))},dependencies:[$,R,we,ye,Ie,A,L,U,W,j],styles:["html[_ngcontent-%COMP%]{--mdc-radio-state-layer-size: 36px;--mat-radio-touch-target-display: block}.mat-mdc-radio-button[_ngcontent-%COMP%] .mdc-radio[_ngcontent-%COMP%] .mdc-radio__native-control[_ngcontent-%COMP%]:enabled:checked + .mdc-radio__background[_ngcontent-%COMP%] .mdc-radio__outer-circle[_ngcontent-%COMP%]{border-color:#0976b4!important}.mat-mdc-radio-button[_ngcontent-%COMP%] .mdc-radio[_ngcontent-%COMP%] .mdc-radio__native-control[_ngcontent-%COMP%]:enabled + .mdc-radio__background[_ngcontent-%COMP%] .mdc-radio__inner-circle[_ngcontent-%COMP%]{background-color:#0976b4!important;border-color:#0976b4!important}"]});let t=r;return t})();var ke=t=>[t],je=t=>({"text-decoration-line-through":t}),We=t=>({"border-bottom":t}),Ke=t=>({"bg-gradient-warning":t});function Ge(t,r){if(t&1){let i=I();v(0),a(1,"div",21)(2,"h6",22),p(3,"Filter by"),c(),a(4,"lib-radio-options",23),k("modelChange",function(e){C(i);let n=m();return N(n.filterType,e)||(n.filterType=e),f(e)}),c()(),y()}if(t&2){let i=m();l(4),V("model",i.filterType),s("options",i.filterTypeOptions)}}function ze(t,r){if(t&1){let i=I();a(0,"button",25),h("click",function(){C(i);let e=m().ngIf,n=m();return f(n.onUpdateItems(e))}),x(1,"i",26),p(2," Update "),c()}}function He(t,r){if(t&1&&(v(0),a(1,"div",4),g(2,ze,3,0,"button",24),c(),y()),t&2){let i=r.ngIf,o=m();l(2),s("ngIf",o.productService.hasSelectionVariant(i))}}function Je(t,r){if(t&1&&(a(0,"th",15)(1,"div",27),x(2,"img",28),a(3,"div",29),p(4),b(5,"stringLimit"),c()()()),t&2){let i=r.$implicit;l(),s("matTooltip",(i.Name==null?null:i.Name.length)>20?i.Name:""),l(),s("src",i==null?null:i.Img,T),l(2),re(" ",ce(5,4,i.Name,20),"",(i.Name==null?null:i.Name.length)>20?"...":""," ")}}function Xe(t,r){if(t&1){let i=I();a(0,"th")(1,"input",30),k("ngModelChange",function(e){C(i);let n=m();return N(n.checkboxState,e)||(n.checkboxState=e),f(e)}),h("ngModelChange",function(){C(i);let e=m();return f(e.onSelectAllData())}),c()()}if(t&2){let i=m();l(),V("ngModel",i.checkboxState)}}function Ze(t,r){t&1&&(a(0,"th",31)(1,"span"),p(2,"Expected"),c(),a(3,"span",32),p(4,"(POS)"),c()(),a(5,"th",31),p(6,"Channel"),c())}function Ye(t,r){if(t&1){let i=I();a(0,"img",45),h("click",function(e){C(i);let n=m(3).$implicit,d=m(2);return f(d.onZoomImage(e,n==null?null:n.ImageUrl))}),c()}if(t&2){let i=m(3).$implicit;ie("src",i==null?null:i.ImageUrl,T)}}function qe(t,r){t&1&&x(0,"img",46)}function Qe(t,r){if(t&1&&(a(0,"small",44),p(1),c()),t&2){let i=m(3).$implicit;l(),P("(",i==null?null:i.Category,")")}}function et(t,r){if(t&1&&(v(0),a(1,"td",40),g(2,Ye,1,1,"img",41)(3,qe,1,0,"ng-template",null,0,H),c(),a(5,"td",42)(6,"h5",43),p(7),c(),g(8,Qe,2,1,"small",44),c(),y()),t&2){let i=z(4),o=m().$index,e=m().$implicit,n=m().ngIf;l(),s("rowSpan",e==null?null:e.Variants.length)("ngClass",F(7,We,o+1==n.length)),l(),s("ngIf",e==null?null:e.ImageUrl)("ngIfElse",i),l(3),s("rowSpan",e==null?null:e.Variants.length),l(2),oe(e==null?null:e.Name),l(),ne(e!=null&&e.Category?8:-1)}}function tt(t,r){if(t&1){let i=I();a(0,"td",47)(1,"input",30),k("ngModelChange",function(e){C(i);let n=m().$implicit;return N(n.selected,e)||(n.selected=e),f(e)}),c()()}if(t&2){let i=m().$implicit;l(),V("ngModel",i.selected)}}function nt(t,r){if(t&1){let i=I();v(0),a(1,"td",49),p(2),b(3,"number"),c(),a(4,"td",50),h("click",function(){let e=C(i).$implicit,n=m(2).$implicit,d=m().$implicit,_=m(2);return f(_.openTableDialog(n,d,e))}),a(5,"div",51)(6,"div",52),p(7),b(8,"number"),c(),a(9,"a",53),h("click",function(e){return C(i),f(e==null?null:e.stopPropagation())}),x(10,"i",38),c()()(),y()}if(t&2){let i=r.$implicit;l(2),P(" ",w(3,4,i.PriceExpected)," "),l(2),s("ngClass",F(8,Ke,i.Price!=i.PriceExpected)),l(3),P(" ",w(8,6,i.Price)," "),l(2),s("href",i.Url,T)}}function it(t,r){t&1&&(a(0,"td",54),p(1," X "),c(),a(2,"td",54),p(3," X "),c())}function ot(t,r){if(t&1&&(v(0),g(1,nt,11,10,"ng-container",48)(2,it,4,0,"ng-template",null,1,H),y()),t&2){let i=r.$implicit,o=z(3),e=m().$implicit,n=m(3);l(),s("ngIf",n.getItemFromChannel(e,i.ID))("ngIfElse",o)}}function rt(t,r){if(t&1&&(a(0,"tr"),g(1,et,9,9,"ng-container",3),a(2,"td",33),p(3),c(),a(4,"td",34)(5,"div",35)(6,"div",36),p(7),c(),a(8,"div",29)(9,"a",37),x(10,"i",38),c()()()(),g(11,tt,2,1,"ng-template",19)(12,ot,4,2,"ng-container",39),c()),t&2){let i=r.$implicit,o=r.$index,e=m(3);l(),s("ngIf",o==0),l(2),P(" ",i==null?null:i.Model," "),l(),s("matTooltip",i.Discontinued?e.discontinuedVariantMsg:""),l(2),s("ngClass",F(8,je,i.Discontinued)),l(),P(" ",i==null?null:i.Code," "),l(2),s("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(i==null?null:i.ID),T),l(2),s("ngxPermissionsOnly",F(10,ke,e.rolePriceEdit)),l(),s("ngForOf",e.channelOptions)}}function at(t,r){if(t&1&&(a(0,"tbody"),M(1,rt,13,12,"tr",null,E),c()),t&2){let i=r.$implicit;l(),O(i.Variants)}}function lt(t,r){if(t&1&&(v(0),M(1,at,3,0,"tbody",null,E),y()),t&2){let i=r.ngIf;l(),O(i)}}var Jt=(()=>{let r=class r{constructor(o,e,n,d,_,u){this.http=o,this.toastr=e,this.dialog=n,this.productService=d,this.authService=_,this.biggerPictureService=u,this.infinitePagination=Q(X),this.searchFilter=new ve,this.checkboxState=!1,this.rolePriceEdit=he.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:K.ALL,Value:"All"},{Key:K.DIFFERENCE,Value:"Difference"}],this.filterType=K.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.infinitePagination.fetchDataEndpoint="Price/GetOutletPrice",this.infinitePagination.fethRowCountEndpoint=this.rowCountAPI,this.initProduct(),this.initPageLoader()}initProduct(){this.data$=this.infinitePagination.data$.pipe(Y(1))}initPageLoader(){this.loader$=this.http.post("/api/PriceLoader/LoadMultiple",{}).pipe(q(o=>{this.searchFilter=o.Filter,this.infinitePagination.reloadPagination(this.searchFilter)}))}onSelectAllData(){this.data$=this.data$.pipe(Z(o=>(o.map(e=>(e.Variants&&(e.Variants=e.Variants.map(n=>(n.selected=this.checkboxState,n))),e)),o)))}onFilter(o){this.searchFilter.text=o;let e={text:o,filterModel:this.filterType,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount};this.infinitePagination.reloadPagination(e)}updatePrice(o){let e=this.productService.selectedVariantProduct(o);if(e.length>0){let n=e.map(u=>u.ID),_={ListChannelID:this.channelOptions.filter(u=>u.selected).map(u=>u.ID),ListID:n};this.http.post("/api/Price/UpdateChannelOutletPrice",_).subscribe({next:u=>{this.resetSelectedChannel(),this.onFilter(),this.toastr.success("Successfully updated "+_.ListID.length+" items in "+_.ListChannelID.length+" channels","Success")},error:u=>{this.resetSelectedChannel()}})}}resetSelectedChannel(){this.channelOptions=this.channelOptions.map(o=>(o.selected=!1,o))}getItemFromChannel(o,e){return o.Channel.find(n=>n.ChannelID==e)}onUpdateItems(o){let e=this.productService.selectedVariantProduct(o);this.dialog.open(Oe,{data:{selectedItems:e,channels:this.channelOptions},width:"600px"}).afterClosed().pipe(G(n=>J.IsNotEmpty(n))).subscribe(n=>{this.channelOptions=n,this.updatePrice(o)})}openTableDialog(o,e,n){let d=JSON.parse(JSON.stringify(o));this.dialog.open(De,{data:{Name:e.Name,Variant:d,ChannelID:n?.ChannelID,Table:"price",ChannelItemID:n?.ChannelItemID}}).afterClosed().pipe(G(u=>J.IsNotEmpty(u))).subscribe(u=>{this.updateProductPrice(u,n)})}updateProductPrice(o,e){let n={ID:o.ChannelID,ChannelItemID:o.ChannelItemID,ChannelVariantID:o.ChannelVariationID,Price:parseFloat(o.Price),VariantID:o.ID,SKU:o.Sku};this.http.post("/api/Price/UpdatePriceByID",n).subscribe(d=>{e.Price=n.Price;let _=this.productService.findChannelById(n.ID,this.channelOptions);this.toastr.success(`Successfully updated ${o.ItemName} (${o.VarName}) inventory in ${_.Name} to ${n.Price}`,"Success")})}openExportDialog(){this.dialog.open(Me,{data:{title:"Export Custom Channel Price",pageNumber:this.searchFilter.PageNumber,rowCount:this.searchFilter.RowCount,filterExport:this.searchFilter,getRowCountApi:this.rowCountAPI,exportApi:"price/GetExportOutletPrice"}}).afterClosed().subscribe()}onZoomImage(o,e){this.biggerPictureService.openBiggerPicture(o,e)}};r.\u0275fac=function(e){return new(e||r)(S(ue),S(_e),S(Pe),S(Fe),S(xe),S(Te))},r.\u0275cmp=D({type:r,selectors:[["app-custom-channel-price"]],standalone:!0,features:[ae([X]),B],decls:38,vars:23,consts:[["elsePic",""],["elseCol",""],["headerTitle","Price Comparison",3,"onSubmit","hideSearchBox","hideSearchDropdown","textButton"],[4,"ngIf"],[1,"d-flex"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],[1,"channel-column"],["colspan","5"],["scope","col","colspan","2",1,"text-center","border-bottom-0","border","text-uppercase"],["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"],[3,"onNextPage","onLastPage","onGetRowCount","totalData","hideCount","rowCount","pageNumber","disableNextButton","goToLastPage"],[2,"height","46px"],[1,"mb-3"],["name","filterModel",3,"modelChange","model","options"],["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"],["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"],[4,"ngFor","ngForOf"],[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"]],template:function(e,n){e&1&&(a(0,"mainpanel",2),h("onSubmit",function(_){return n.onFilter(_)}),a(1,"filters"),g(2,Ge,5,2,"ng-container",3),b(3,"async"),c(),a(4,"actions")(5,"div",4),g(6,He,3,1,"ng-container",3),b(7,"async"),a(8,"button",5),h("click",function(){return n.openExportDialog()}),x(9,"i",6),a(10,"span"),p(11,"Export"),c()()()(),a(12,"content")(13,"div",7)(14,"div",8)(15,"div",9)(16,"div",10)(17,"table",11)(18,"thead",12)(19,"tr",13),x(20,"th",14),M(21,Je,6,7,"th",15,E),c(),a(23,"tr")(24,"th",16)(25,"span"),p(26," Product "),c()(),a(27,"th",17),p(28,"Variant"),c(),a(29,"th",18),p(30,"SKU"),c(),g(31,Xe,2,1,"ng-template",19),M(32,Ze,7,0,null,null,E),c()(),g(34,lt,3,0,"ng-container",3),b(35,"async"),c(),a(36,"infinite-paginator",20),b(37,"async"),h("onNextPage",function(){return n.infinitePagination.onNextPage(n.searchFilter)})("onLastPage",function(){return n.infinitePagination.onLastPage(n.searchFilter)})("onGetRowCount",function(){return n.infinitePagination.getRowCount(n.searchFilter)}),c()()()()()()()),e&2&&(s("hideSearchBox",!1)("hideSearchDropdown",!1)("textButton","Search"),l(2),s("ngIf",w(3,13,n.loader$)),l(4),s("ngIf",w(7,15,n.data$)),l(15),O(n.channelOptions),l(10),s("ngxPermissionsOnly",F(21,ke,n.rolePriceEdit)),l(),O(n.channelOptions),l(2),s("ngIf",w(35,17,n.data$)),l(2),s("totalData",n.infinitePagination.totalData())("hideCount",n.infinitePagination.hideCount())("rowCount",w(37,19,n.infinitePagination.totalRowCount$))("pageNumber",n.infinitePagination.pageNumber())("disableNextButton",n.infinitePagination.disableNextButton())("goToLastPage",n.infinitePagination.isLastPage()))},dependencies:[$,se,R,me,pe,de,Se,be,A,ge,L,U,Ve,Ne,W,j,Ee,fe,Ce],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 t=r;return t})();export{Jt as CustomChannelPriceComponent};
1
+ import{a as ve}from"./chunk-IWVYX6KY.js";import{a as Me}from"./chunk-V6L3NRY3.js";import{a as ye,b as Ie,c as we}from"./chunk-2LGY3VGP.js";import"./chunk-MOFF6ASU.js";import{a as Oe}from"./chunk-VOWLO2M7.js";import{a as K}from"./chunk-BSBYMQ7J.js";import{a as De,b as X,c as Ve}from"./chunk-L34D7YAZ.js";import"./chunk-YG3KQ63T.js";import{a as he}from"./chunk-662E5VTA.js";import{a as Fe,c as Ee}from"./chunk-5WXM6HSA.js";import"./chunk-JTJLVSTV.js";import"./chunk-IPYNDMGQ.js";import{a as Te}from"./chunk-RMD2ZXUN.js";import"./chunk-KWFES5F7.js";import{g as xe}from"./chunk-LBHJSQBZ.js";import{b as _e,e as ue}from"./chunk-DSF55IXM.js";import"./chunk-KCDL7SWP.js";import{d as Pe,l as be,m as Se}from"./chunk-4R22UO7N.js";import{t as j,u as W}from"./chunk-MVPTQRFO.js";import"./chunk-EKCNJX26.js";import{b as ge,h as L,k as U,u as A}from"./chunk-B3LBEB32.js";import{c as J,e as Ce,f as fe}from"./chunk-QPRFFPO5.js";import{$a as s,$b as ce,B as G,Bc as de,Cc as $,Ha as T,Hb as z,Ia as l,Ib as p,Ja as S,Jb as oe,Kb as P,Lb as re,Mb as V,Nb as N,Ob as k,Pb as ae,Q as Y,Qb as B,Sb as F,Tb as le,X as q,Za as g,Zb as b,_b as w,ac as H,cb as te,da as Q,ga as D,gb as ne,hb as E,jb as M,kb as O,lb as a,mb as c,nb as x,oa as C,ob as v,pa as f,pb as y,q as Z,rb as I,sc as se,ub as h,uc as R,vc as me,wb as m,yc as pe,za as ee,zb as ie}from"./chunk-C3YE27TZ.js";import"./chunk-GNOSNGXM.js";var Ue=(t,r)=>({color:t,"font-weight":r});function Ae(t,r){if(t&1&&(a(0,"mat-radio-button",2),p(1),c()),t&2){let i=r.$implicit,o=r.index,e=m();te(le(7,Ue,e.model==i.Key&&e.activeBold?"#0976b4":"",e.model==i.Key&&e.activeBold?"700":"")),s("disabled",e.exception==i.Value)("matTooltip",e.title.length>0?e.title[o]:"")("value",i.Key)("name",e.name),l(),P("",i.Value," ")}}var Ne=(()=>{let r=class r{constructor(){this.disabled=!1,this.modelChange=new ee,this.options=[{Key:!1,Value:"No"},{Key:!0,Value:"Yes"}],this.border=!1,this.name="",this.title=[],this.exception="",this.activeBold=""}change(o){this.modelChange.emit(o)}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=D({type:r,selectors:[["lib-radio-options"]],inputs:{model:"model",disabled:"disabled",options:"options",border:"border",name:"name",title:"title",exception:"exception",activeBold:"activeBold"},outputs:{modelChange:"modelChange"},standalone:!0,features:[B],decls:2,vars:3,consts:[["color","primary",3,"ngModelChange","disabled","ngModel"],["matTooltipPosition","above","class","me-4 mt-1",3,"style","disabled","matTooltip","value","name",4,"ngFor","ngForOf"],["matTooltipPosition","above",1,"me-4","mt-1",3,"disabled","matTooltip","value","name"]],template:function(e,n){e&1&&(a(0,"mat-radio-group",0),h("ngModelChange",function(_){return n.change(_)}),g(1,Ae,2,10,"mat-radio-button",1),c()),e&2&&(s("disabled",n.disabled)("ngModel",n.model),l(),s("ngForOf",n.options))},dependencies:[$,R,we,ye,Ie,A,L,U,W,j],styles:["html[_ngcontent-%COMP%]{--mdc-radio-state-layer-size: 36px;--mat-radio-touch-target-display: block}.mat-mdc-radio-button[_ngcontent-%COMP%] .mdc-radio[_ngcontent-%COMP%] .mdc-radio__native-control[_ngcontent-%COMP%]:enabled:checked + .mdc-radio__background[_ngcontent-%COMP%] .mdc-radio__outer-circle[_ngcontent-%COMP%]{border-color:#0976b4!important}.mat-mdc-radio-button[_ngcontent-%COMP%] .mdc-radio[_ngcontent-%COMP%] .mdc-radio__native-control[_ngcontent-%COMP%]:enabled + .mdc-radio__background[_ngcontent-%COMP%] .mdc-radio__inner-circle[_ngcontent-%COMP%]{background-color:#0976b4!important;border-color:#0976b4!important}"]});let t=r;return t})();var ke=t=>[t],je=t=>({"text-decoration-line-through":t}),We=t=>({"border-bottom":t}),Ke=t=>({"bg-gradient-warning":t});function Ge(t,r){if(t&1){let i=I();v(0),a(1,"div",21)(2,"h6",22),p(3,"Filter by"),c(),a(4,"lib-radio-options",23),k("modelChange",function(e){C(i);let n=m();return N(n.filterType,e)||(n.filterType=e),f(e)}),c()(),y()}if(t&2){let i=m();l(4),V("model",i.filterType),s("options",i.filterTypeOptions)}}function ze(t,r){if(t&1){let i=I();a(0,"button",25),h("click",function(){C(i);let e=m().ngIf,n=m();return f(n.onUpdateItems(e))}),x(1,"i",26),p(2," Update "),c()}}function He(t,r){if(t&1&&(v(0),a(1,"div",4),g(2,ze,3,0,"button",24),c(),y()),t&2){let i=r.ngIf,o=m();l(2),s("ngIf",o.productService.hasSelectionVariant(i))}}function Je(t,r){if(t&1&&(a(0,"th",15)(1,"div",27),x(2,"img",28),a(3,"div",29),p(4),b(5,"stringLimit"),c()()()),t&2){let i=r.$implicit;l(),s("matTooltip",(i.Name==null?null:i.Name.length)>20?i.Name:""),l(),s("src",i==null?null:i.Img,T),l(2),re(" ",ce(5,4,i.Name,20),"",(i.Name==null?null:i.Name.length)>20?"...":""," ")}}function Xe(t,r){if(t&1){let i=I();a(0,"th")(1,"input",30),k("ngModelChange",function(e){C(i);let n=m();return N(n.checkboxState,e)||(n.checkboxState=e),f(e)}),h("ngModelChange",function(){C(i);let e=m();return f(e.onSelectAllData())}),c()()}if(t&2){let i=m();l(),V("ngModel",i.checkboxState)}}function Ze(t,r){t&1&&(a(0,"th",31)(1,"span"),p(2,"Expected"),c(),a(3,"span",32),p(4,"(POS)"),c()(),a(5,"th",31),p(6,"Channel"),c())}function Ye(t,r){if(t&1){let i=I();a(0,"img",45),h("click",function(e){C(i);let n=m(3).$implicit,d=m(2);return f(d.onZoomImage(e,n==null?null:n.ImageUrl))}),c()}if(t&2){let i=m(3).$implicit;ie("src",i==null?null:i.ImageUrl,T)}}function qe(t,r){t&1&&x(0,"img",46)}function Qe(t,r){if(t&1&&(a(0,"small",44),p(1),c()),t&2){let i=m(3).$implicit;l(),P("(",i==null?null:i.Category,")")}}function et(t,r){if(t&1&&(v(0),a(1,"td",40),g(2,Ye,1,1,"img",41)(3,qe,1,0,"ng-template",null,0,H),c(),a(5,"td",42)(6,"h5",43),p(7),c(),g(8,Qe,2,1,"small",44),c(),y()),t&2){let i=z(4),o=m().$index,e=m().$implicit,n=m().ngIf;l(),s("rowSpan",e==null?null:e.Variants.length)("ngClass",F(7,We,o+1==n.length)),l(),s("ngIf",e==null?null:e.ImageUrl)("ngIfElse",i),l(3),s("rowSpan",e==null?null:e.Variants.length),l(2),oe(e==null?null:e.Name),l(),ne(e!=null&&e.Category?8:-1)}}function tt(t,r){if(t&1){let i=I();a(0,"td",47)(1,"input",30),k("ngModelChange",function(e){C(i);let n=m().$implicit;return N(n.selected,e)||(n.selected=e),f(e)}),c()()}if(t&2){let i=m().$implicit;l(),V("ngModel",i.selected)}}function nt(t,r){if(t&1){let i=I();v(0),a(1,"td",49),p(2),b(3,"number"),c(),a(4,"td",50),h("click",function(){let e=C(i).$implicit,n=m(2).$implicit,d=m().$implicit,_=m(2);return f(_.openTableDialog(n,d,e))}),a(5,"div",51)(6,"div",52),p(7),b(8,"number"),c(),a(9,"a",53),h("click",function(e){return C(i),f(e==null?null:e.stopPropagation())}),x(10,"i",38),c()()(),y()}if(t&2){let i=r.$implicit;l(2),P(" ",w(3,4,i.PriceExpected)," "),l(2),s("ngClass",F(8,Ke,i.Price!=i.PriceExpected)),l(3),P(" ",w(8,6,i.Price)," "),l(2),s("href",i.Url,T)}}function it(t,r){t&1&&(a(0,"td",54),p(1," X "),c(),a(2,"td",54),p(3," X "),c())}function ot(t,r){if(t&1&&(v(0),g(1,nt,11,10,"ng-container",48)(2,it,4,0,"ng-template",null,1,H),y()),t&2){let i=r.$implicit,o=z(3),e=m().$implicit,n=m(3);l(),s("ngIf",n.getItemFromChannel(e,i.ID))("ngIfElse",o)}}function rt(t,r){if(t&1&&(a(0,"tr"),g(1,et,9,9,"ng-container",3),a(2,"td",33),p(3),c(),a(4,"td",34)(5,"div",35)(6,"div",36),p(7),c(),a(8,"div",29)(9,"a",37),x(10,"i",38),c()()()(),g(11,tt,2,1,"ng-template",19)(12,ot,4,2,"ng-container",39),c()),t&2){let i=r.$implicit,o=r.$index,e=m(3);l(),s("ngIf",o==0),l(2),P(" ",i==null?null:i.Model," "),l(),s("matTooltip",i.Discontinued?e.discontinuedVariantMsg:""),l(2),s("ngClass",F(8,je,i.Discontinued)),l(),P(" ",i==null?null:i.Code," "),l(2),s("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(i==null?null:i.ID),T),l(2),s("ngxPermissionsOnly",F(10,ke,e.rolePriceEdit)),l(),s("ngForOf",e.channelOptions)}}function at(t,r){if(t&1&&(a(0,"tbody"),M(1,rt,13,12,"tr",null,E),c()),t&2){let i=r.$implicit;l(),O(i.Variants)}}function lt(t,r){if(t&1&&(v(0),M(1,at,3,0,"tbody",null,E),y()),t&2){let i=r.ngIf;l(),O(i)}}var Jt=(()=>{let r=class r{constructor(o,e,n,d,_,u){this.http=o,this.toastr=e,this.dialog=n,this.productService=d,this.authService=_,this.biggerPictureService=u,this.infinitePagination=Q(X),this.searchFilter=new ve,this.checkboxState=!1,this.rolePriceEdit=he.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:K.ALL,Value:"All"},{Key:K.DIFFERENCE,Value:"Difference"}],this.filterType=K.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.infinitePagination.fetchDataEndpoint="Price/GetOutletPrice",this.infinitePagination.fethRowCountEndpoint=this.rowCountAPI,this.initProduct(),this.initPageLoader()}initProduct(){this.data$=this.infinitePagination.data$.pipe(Y(1))}initPageLoader(){this.loader$=this.http.post("/api/PriceLoader/LoadMultiple",{}).pipe(q(o=>{this.searchFilter=o.Filter,this.infinitePagination.reloadPagination(this.searchFilter)}))}onSelectAllData(){this.data$=this.data$.pipe(Z(o=>(o.map(e=>(e.Variants&&(e.Variants=e.Variants.map(n=>(n.selected=this.checkboxState,n))),e)),o)))}onFilter(o){this.searchFilter.text=o;let e={text:o,filterModel:this.filterType,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount};this.infinitePagination.reloadPagination(e)}updatePrice(o){let e=this.productService.selectedVariantProduct(o);if(e.length>0){let n=e.map(u=>u.ID),_={ListChannelID:this.channelOptions.filter(u=>u.selected).map(u=>u.ID),ListID:n};this.http.post("/api/Price/UpdateChannelOutletPrice",_).subscribe({next:u=>{this.resetSelectedChannel(),this.onFilter(),this.toastr.success("Successfully updated "+_.ListID.length+" items in "+_.ListChannelID.length+" channels","Success")},error:u=>{this.resetSelectedChannel()}})}}resetSelectedChannel(){this.channelOptions=this.channelOptions.map(o=>(o.selected=!1,o))}getItemFromChannel(o,e){return o.Channel.find(n=>n.ChannelID==e)}onUpdateItems(o){let e=this.productService.selectedVariantProduct(o);this.dialog.open(Oe,{data:{selectedItems:e,channels:this.channelOptions},width:"600px"}).afterClosed().pipe(G(n=>J.IsNotEmpty(n))).subscribe(n=>{this.channelOptions=n,this.updatePrice(o)})}openTableDialog(o,e,n){let d=JSON.parse(JSON.stringify(o));this.dialog.open(De,{data:{Name:e.Name,Variant:d,ChannelID:n?.ChannelID,Table:"price",ChannelItemID:n?.ChannelItemID}}).afterClosed().pipe(G(u=>J.IsNotEmpty(u))).subscribe(u=>{this.updateProductPrice(u,n)})}updateProductPrice(o,e){let n={ID:o.ChannelID,ChannelItemID:o.ChannelItemID,ChannelVariantID:o.ChannelVariationID,Price:parseFloat(o.Price),VariantID:o.ID,SKU:o.Sku};this.http.post("/api/Price/UpdatePriceByID",n).subscribe(d=>{e.Price=n.Price;let _=this.productService.findChannelById(n.ID,this.channelOptions);this.toastr.success(`Successfully updated ${o.ItemName} (${o.VarName}) inventory in ${_.Name} to ${n.Price}`,"Success")})}openExportDialog(){this.dialog.open(Me,{data:{title:"Export Custom Channel Price",pageNumber:this.searchFilter.PageNumber,rowCount:this.searchFilter.RowCount,filterExport:this.searchFilter,getRowCountApi:this.rowCountAPI,exportApi:"price/GetExportOutletPrice"}}).afterClosed().subscribe()}onZoomImage(o,e){this.biggerPictureService.openBiggerPicture(o,e)}};r.\u0275fac=function(e){return new(e||r)(S(ue),S(_e),S(Pe),S(Fe),S(xe),S(Te))},r.\u0275cmp=D({type:r,selectors:[["app-custom-channel-price"]],standalone:!0,features:[ae([X]),B],decls:38,vars:23,consts:[["elsePic",""],["elseCol",""],["headerTitle","Price Comparison",3,"onSubmit","hideSearchBox","hideSearchDropdown","textButton"],[4,"ngIf"],[1,"d-flex"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],[1,"channel-column"],["colspan","5"],["scope","col","colspan","2",1,"text-center","border-bottom-0","border","text-uppercase"],["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"],[3,"onNextPage","onLastPage","onGetRowCount","totalData","hideCount","rowCount","pageNumber","disableNextButton","goToLastPage"],[2,"height","46px"],[1,"mb-3"],["name","filterModel",3,"modelChange","model","options"],["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"],["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"],[4,"ngFor","ngForOf"],[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"]],template:function(e,n){e&1&&(a(0,"mainpanel",2),h("onSubmit",function(_){return n.onFilter(_)}),a(1,"filters"),g(2,Ge,5,2,"ng-container",3),b(3,"async"),c(),a(4,"actions")(5,"div",4),g(6,He,3,1,"ng-container",3),b(7,"async"),a(8,"button",5),h("click",function(){return n.openExportDialog()}),x(9,"i",6),a(10,"span"),p(11,"Export"),c()()()(),a(12,"content")(13,"div",7)(14,"div",8)(15,"div",9)(16,"div",10)(17,"table",11)(18,"thead",12)(19,"tr",13),x(20,"th",14),M(21,Je,6,7,"th",15,E),c(),a(23,"tr")(24,"th",16)(25,"span"),p(26," Product "),c()(),a(27,"th",17),p(28,"Variant"),c(),a(29,"th",18),p(30,"SKU"),c(),g(31,Xe,2,1,"ng-template",19),M(32,Ze,7,0,null,null,E),c()(),g(34,lt,3,0,"ng-container",3),b(35,"async"),c(),a(36,"infinite-paginator",20),b(37,"async"),h("onNextPage",function(){return n.infinitePagination.onNextPage(n.searchFilter)})("onLastPage",function(){return n.infinitePagination.onLastPage(n.searchFilter)})("onGetRowCount",function(){return n.infinitePagination.getRowCount(n.searchFilter)}),c()()()()()()()),e&2&&(s("hideSearchBox",!1)("hideSearchDropdown",!1)("textButton","Search"),l(2),s("ngIf",w(3,13,n.loader$)),l(4),s("ngIf",w(7,15,n.data$)),l(15),O(n.channelOptions),l(10),s("ngxPermissionsOnly",F(21,ke,n.rolePriceEdit)),l(),O(n.channelOptions),l(2),s("ngIf",w(35,17,n.data$)),l(2),s("totalData",n.infinitePagination.totalData())("hideCount",n.infinitePagination.hideCount())("rowCount",w(37,19,n.infinitePagination.totalRowCount$))("pageNumber",n.infinitePagination.pageNumber())("disableNextButton",n.infinitePagination.disableNextButton())("goToLastPage",n.infinitePagination.isLastPage()))},dependencies:[$,se,R,me,pe,de,Se,be,A,ge,L,U,Ve,Ne,W,j,Ee,fe,Ce],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 t=r;return t})();export{Jt as CustomChannelPriceComponent};