marketplacepos 5.43.4 → 5.43.5

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 (74) hide show
  1. package/Marketplace/{chunk-YRFZDTXH.js → chunk-2Y2VSIHL.js} +1 -1
  2. package/Marketplace/{chunk-7UWULSSK.js → chunk-3MUVNECT.js} +1 -1
  3. package/Marketplace/{chunk-Q6TBOHRA.js → chunk-3TX6JLFF.js} +1 -1
  4. package/Marketplace/{chunk-CATX24UZ.js → chunk-46CA5SER.js} +1 -1
  5. package/Marketplace/{chunk-G6X5CZ34.js → chunk-4JKDNUTX.js} +1 -1
  6. package/Marketplace/{chunk-BLXMX3JN.js → chunk-4Q35WLYQ.js} +1 -1
  7. package/Marketplace/{chunk-ZHZMT7GZ.js → chunk-5DG3HADY.js} +1 -1
  8. package/Marketplace/{chunk-V3NCYRCF.js → chunk-5HO2IJ47.js} +1 -1
  9. package/Marketplace/{chunk-C4XFI4J7.js → chunk-7AQ244V7.js} +1 -1
  10. package/Marketplace/chunk-AJL3CYNX.js +1 -0
  11. package/Marketplace/{chunk-JHEGROJF.js → chunk-BQVXVM7F.js} +1 -1
  12. package/Marketplace/{chunk-2CBZOVID.js → chunk-BRTYGXCD.js} +1 -1
  13. package/Marketplace/{chunk-74FAXIJ6.js → chunk-BXVG56VT.js} +1 -1
  14. package/Marketplace/{chunk-ISRFFTGW.js → chunk-BZIF3CQ5.js} +1 -1
  15. package/Marketplace/chunk-CROOKZYC.js +1 -0
  16. package/Marketplace/{chunk-FNEDIIIS.js → chunk-CRUPQQ56.js} +1 -1
  17. package/Marketplace/{chunk-2YTIJJIP.js → chunk-DEJVMFIS.js} +1 -1
  18. package/Marketplace/chunk-DFMLZFNU.js +1 -0
  19. package/Marketplace/{chunk-32WYK3BN.js → chunk-DRMAONR7.js} +1 -1
  20. package/Marketplace/{chunk-53FUEOBJ.js → chunk-ELDFGVXL.js} +1 -1
  21. package/Marketplace/{chunk-K2GYNGBL.js → chunk-EZY2ATQQ.js} +1 -1
  22. package/Marketplace/{chunk-5DODHGO5.js → chunk-FVFKSAIS.js} +1 -1
  23. package/Marketplace/{chunk-MQQD4OJO.js → chunk-GQLSQKDI.js} +1 -1
  24. package/Marketplace/{chunk-PP3PVKNQ.js → chunk-HFGJVJO2.js} +1 -1
  25. package/Marketplace/chunk-IONDX3X4.js +2 -0
  26. package/Marketplace/chunk-JMPW6NPQ.js +7 -0
  27. package/Marketplace/{chunk-GS3A2D4O.js → chunk-JSZ2HWK6.js} +1 -1
  28. package/Marketplace/{chunk-YMMOJKVP.js → chunk-KFNKVXCN.js} +1 -1
  29. package/Marketplace/{chunk-P42VFND7.js → chunk-KUW2UF4E.js} +1 -1
  30. package/Marketplace/{chunk-MQD5HJA6.js → chunk-LB7PE76T.js} +1 -1
  31. package/Marketplace/{chunk-T6SBAKYS.js → chunk-LRR6JS6H.js} +1 -1
  32. package/Marketplace/{chunk-64IHCPTX.js → chunk-M3XHIUXS.js} +1 -1
  33. package/Marketplace/{chunk-EK4VKN7N.js → chunk-MCOWAYNM.js} +1 -1
  34. package/Marketplace/{chunk-ONLHWPKX.js → chunk-MOR4ZQ3B.js} +1 -1
  35. package/Marketplace/chunk-NKBQM2CA.js +1 -0
  36. package/Marketplace/chunk-NQ4I4MFR.js +1 -0
  37. package/Marketplace/chunk-OPXWL5G6.js +1 -0
  38. package/Marketplace/{chunk-227LB3XT.js → chunk-PFRHV7VB.js} +1 -1
  39. package/Marketplace/{chunk-YB65PX7S.js → chunk-QINGXOOA.js} +1 -1
  40. package/Marketplace/{chunk-JTIFX4RL.js → chunk-QQ5LLQNX.js} +2 -2
  41. package/Marketplace/{chunk-JFUCAI5X.js → chunk-QZEHOQYW.js} +1 -1
  42. package/Marketplace/{chunk-YT3P3EBI.js → chunk-RIR77G7B.js} +1 -1
  43. package/Marketplace/{chunk-43XFDAKY.js → chunk-RVGDKAUB.js} +1 -1
  44. package/Marketplace/{chunk-FTGUKCA5.js → chunk-RXIOO5CN.js} +1 -1
  45. package/Marketplace/{chunk-UWIHXA2S.js → chunk-TAA75BNT.js} +1 -1
  46. package/Marketplace/chunk-TBG76OM6.js +1 -0
  47. package/Marketplace/{chunk-PVY6MYHG.js → chunk-TDZ7YWEM.js} +1 -1
  48. package/Marketplace/{chunk-S5SDX7ZG.js → chunk-USNELOQD.js} +1 -1
  49. package/Marketplace/{chunk-VYIEJVSJ.js → chunk-V6MTRLRN.js} +1 -1
  50. package/Marketplace/{chunk-S2HNMEC2.js → chunk-WAFTFIDQ.js} +1 -1
  51. package/Marketplace/chunk-WDJS26KO.js +1 -0
  52. package/Marketplace/{chunk-3ASK736S.js → chunk-WYEAWOUO.js} +1 -1
  53. package/Marketplace/{chunk-6LN62T32.js → chunk-WZD7N5DN.js} +1 -1
  54. package/Marketplace/{chunk-KDEVWOVI.js → chunk-Y32UC4LV.js} +1 -1
  55. package/Marketplace/chunk-Y77CFR5W.js +1 -0
  56. package/Marketplace/{chunk-5TIGE5UP.js → chunk-YYA3EM3E.js} +1 -1
  57. package/Marketplace/{chunk-Q2U3MMNW.js → chunk-Z2NHQWEV.js} +1 -1
  58. package/Marketplace/{chunk-H4OBICY5.js → chunk-Z5NWWPJP.js} +1 -1
  59. package/Marketplace/{chunk-ADDTLV5D.js → chunk-ZMBJFK7P.js} +2 -2
  60. package/Marketplace/{chunk-GA7T6FWT.js → chunk-ZTKQ3U35.js} +1 -1
  61. package/Marketplace/index.html +2 -2
  62. package/Marketplace/{main-ZMGZIM3D.js → main-ISCOUMZ4.js} +1 -1
  63. package/package.json +1 -1
  64. package/Marketplace/chunk-BTHDOSGS.js +0 -1
  65. package/Marketplace/chunk-DDV4X5WD.js +0 -7
  66. package/Marketplace/chunk-IGXU4VAO.js +0 -1
  67. package/Marketplace/chunk-IRK2APYZ.js +0 -1
  68. package/Marketplace/chunk-JWARXDWM.js +0 -1
  69. package/Marketplace/chunk-LUVP4A3V.js +0 -1
  70. package/Marketplace/chunk-ORD5Z4XI.js +0 -1
  71. package/Marketplace/chunk-R4GAF5EA.js +0 -1
  72. package/Marketplace/chunk-XUL4LU4R.js +0 -1
  73. package/Marketplace/chunk-Y2QG7YNG.js +0 -2
  74. package/Marketplace/chunk-YUCD4HRB.js +0 -1
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"marketplacepos","version":"5.43.4"}
1
+ {"name":"marketplacepos","version":"5.43.5"}
@@ -1 +0,0 @@
1
- import{a as x}from"./chunk-PE5AFID4.js";import{g as u}from"./chunk-S5SDX7ZG.js";import{b as h,d as C,i as M,j as v,k as S}from"./chunk-CLER2MX6.js";import{G as g,n as p}from"./chunk-M2FCTYGU.js";import{Gb as m,Gc as t,Yb as f,ic as i,ja as s,jc as n,kc as d,pa as o,tc as c}from"./chunk-B7KTCPKC.js";var y=(()=>{class e{constructor(){this.dialogRef=o(h),this.route=o(g),this.modalConfig=new v,this.modalConfig.title="Switch to modern authorization",this.modalConfig.customWidth="450px",this.modalConfig.hideCancel=!0,this.modalConfig.headerType=M.Warning,this.modalConfig.okText="Setup"}onClose(){this.dialogRef.close()}onOk(){this.dialogRef.close(),this.route.navigate(["/menu/users"])}static{this.\u0275fac=function(r){return new(r||e)}}static{this.\u0275cmp=m({type:e,selectors:[["app-modal-user-migration-confirmation"]],decls:19,vars:1,consts:[[3,"onOk","onCancel","config"],["content",""],[1,"d-flex","align-items-center","justify-content-between","gap-6"],[1,"text-center",2,"width","300px"],[1,"fa-solid","fa-users-gear","fa-6x"],[1,"lh-base"],["href","https://support.dealpos.com/en/collections/15916183-omnichannel-user-configuration","target","_blank"]],template:function(r,l){r&1&&(i(0,"modal-material",0),c("onOk",function(){return l.onOk()})("onCancel",function(){return l.onClose()}),i(1,"div",1)(2,"div",2)(3,"div",3),d(4,"i",4),n(),i(5,"div",5)(6,"p"),t(7," We have introduced a new Modern Authorization, Please switch from "),i(8,"b"),t(9,"legacy"),n(),t(10," to "),i(11,"b"),t(12,"modern"),n(),t(13," authorization by inviting your users. "),n(),i(14,"div"),t(15," Please refer to this "),i(16,"a",6),t(17,"article"),n(),t(18," for more information "),n()()()()()),r&2&&f("config",l.modalConfig)},dependencies:[p,S],encapsulation:2})}}return e})();var R=(()=>{class e{constructor(){this.dialog=o(C),this.tokenService=o(u),this.dialogRef=null}openDialogMigrationConfirmation(){this.tokenService.getUser()?.AuthorizationMode===x.Legacy&&!this.dialogRef&&(this.dialogRef=this.dialog.open(y),this.dialogRef.afterClosed().subscribe(()=>{this.dialogRef=null}))}resetDialogState(){this.dialogRef&&(this.dialogRef.close(),this.dialogRef=null)}static{this.\u0275fac=function(r){return new(r||e)}}static{this.\u0275prov=s({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();var B=(e,b)=>(o(R).openDialogMigrationConfirmation(),!0);export{B as a};
@@ -1,7 +0,0 @@
1
- import{c as l}from"./chunk-PW42BQIY.js";import{b as f,e as S}from"./chunk-JXSBFTQM.js";import{J as h,ea as o,ja as d,oa as p,r as c}from"./chunk-B7KTCPKC.js";var E=(()=>{class i{constructor(e,t){this.httpService=e,this.toastrService=t}loader(e=l.GuidEMpty){return this.httpService.post("/api/product/Load",{ID:e})}LoadInPOS(e=l.GuidEMpty){return this.httpService.post("/api/product/LoadInPOS",{ID:e})}filterChannelByTypeId(e,t){return e.filter(a=>t.findIndex(s=>a.TypeID==s)!==-1)}getProductStatistic(){return this.httpService.post("/api/product/ProductStatistic",{})}getTotalProductLive(e){let t={ID:e};return this.httpService.post("/api/product/TotalProductLive",t)}clearCacheChannel(e){let t={ID:e};return this.httpService.post("/api/Channel/ClearCacheChannel",t)}detachProduct(e){return this.httpService.post("/api/product/Detach",e)}uploadSingleProduct(e,t){let a={Channel:t,Products:e};return this.httpService.post("api/product/UploadMultipleChannel",a).pipe(o(s=>{this.showToastrSuccessUploadSingle(s,e[0])}),h(s=>(this.showToastErrorUploadSingle(s,e[0]),c(()=>new Error(s)))))}uploadMultipleProduct(e,t){let a={Channel:t,Products:e};return this.httpService.post("api/product/UploadMultipleProductAndMultipleChannel",a).pipe(o(s=>{this.showToastrUploadMultiple(s.Message)}),h(s=>(this.showToastrUploadMultiple(s.error?.Message),c(()=>new Error(s)))))}uploadNotInChannel(e,t){let a={Products:e,Channel:t};return this.httpService.post("/api/product/UploadProductNotInChannelToChannel",a).pipe(o(s=>{this.showToastrUploadMultiple(s)}),h(s=>(this.showToastrUploadMultiple(s.error?.Message),c(()=>new Error(s)))))}scanSingle(e,t){let a={ID:e,SKU:t};return this.httpService.post("/api/product/ScanSingle",a)}scanNotInChannel(e){let t={ID:e};return this.httpService.post("/api/product/ScanNotinChannel",t)}findAllSoldInChannel(e){return this.httpService.post("/api/product/GetSoldInChannel",e)}scanAll(e,t,a,s=!1){let n={ID:e,ScanFull:t,UpdatedProduct:a,Async:s};return this.httpService.post("/api/product/ScanOptimized",n)}scanCompareToPos(e){return this.httpService.post("/api/product/CompareMarketplaceToPOS",e)}getVariantCodesProduct(e){return(e.Variants||[]).map(s=>s.Code)}downloadMultipleProduct(e){let t=e.map(a=>({ChannelItemID:a.ChannelItemID,ChannelID:a.ChannelID}));return this.httpService.post("/api/product/DownloadMultipleProductFromChannel",t).pipe(o(a=>{this.toastrService.success(`${a.Count} products downloaded to POS`,"Download Complete")}))}downloadProduct(e){let t={ChannelItemID:e.ChannelItemID,ChannelID:e.ChannelID};return this.httpService.post("/api/product/DownloadProductFromChannel",t).pipe(o(()=>{this.toastrService.success("Product successfully downloaded to POS","Download Complete")}))}getVariantCodesProducts(e=[]){let t=[];return e.forEach(a=>{a.Variants.forEach(s=>{t=[...t,s.Code]})}),t}filterUnselectedChannel(e,t){let a=[];e.forEach(n=>{a=[...a,...n.Channel]});let s;if(!a||a.length==0)s=t;else{let n=[];s=t.filter(r=>(n=a.filter(u=>u.ChannelID==r.ID),n.length!==e.length))}return s}findChannelById(e,t){return t.find(a=>a.ID==e)}sortChannel(e=[]){return e.sort((t,a)=>t.TypeID<a.TypeID?1:t.TypeID===a.TypeID?0:-1)}hasSelection(e=[]){return this.selectedProduct(e).length>0}selectedProduct(e=[]){return e.filter(t=>t.selected)}hasSelectionVariant(e){return this.selectedVariantProduct(e).length>0}selectedVariantProduct(e){let t=[];return e.forEach(a=>{t=[...t,...a.Variants!=null?a.Variants.filter(s=>s.selected):""]}),t}getChannelProduct(e){let t=e.Variants||[],a=[];for(let s of t)if(s.Channel!=null)for(let n of s.Channel)a.filter(r=>r.ChannelID==n.ChannelID).length==0&&a.push(n);return this.sortChannel(a)}successToastrScanAllProduct(e,t,a){let s=e.InChannel?e?.InChannel?.Product:0,n=e?.NotInPOS?.Product?e?.NotInPOS?.Product:0,r=l.IsNotEmpty(e.LastUpdate)?l.convertToReadableDate(e.LastUpdate):null;a?this.toastrService.success(`
2
- ${n+s} product updates in ${t.Name} </br>
3
- (${s} In Channel + ${n} Not In Pos)
4
- ${l.IsNotEmpty(r)?"since "+r:""}
5
- `,"Scan Complete!",{enableHtml:!0,timeOut:1e4}):this.toastrService.success(`${s} product updates in ${t.Name} </br>
6
- (${s} In Channel + ${n} Not In Pos)
7
- ${l.IsNotEmpty(r)?"since "+r:""}`,"Scan Complete!",{enableHtml:!0,timeOut:1e4})}checkProductHasScanButton(e,t){let a;return e.map(s=>(s.Channel=this.getChannelProduct(s),a=this.filterUnselectedChannel([s],t),s.hasScan=a.length>0,s))}checkProductHasUploadBtn(e,t){let a;return e.map(s=>(s.Channel=this.getChannelProduct(s),a=this.filterUnselectedChannel([s],t),s.hasUpload=a.length>0,s))}showToastrUploadMultiple(e=[]){let t=[],a=[],s=this.getResponseList(e);if(e.forEach(n=>{typeof n?.Response=="string"?a=[...a,s.length>1?this.setHtmlli(n.Response):this.setHtmlli(n.Response,!1)]:(n?.Response?.Success.forEach(r=>{t=[...t,s.length>1?this.setHtmlli(`Product ${r} was <b>successfully</b> uploaded to ${n.Name}`):this.setHtmlli(`Product ${r} was <b>successfully</b> uploaded to ${n.Name}`,!1)]}),n?.Response.Fail.forEach(r=>{a=[...a,s.length>1?this.setHtmlli(r):this.setHtmlli(r,!1)]}))}),a.length>0&&t.length>0){let n=[...t,...a];this.toastrService.warning(this.concatMessage(n),"Warning!",{enableHtml:!0})}else t.length>0&&a.length==0?this.toastrService.success(this.concatMessage(t),"Success",{enableHtml:!0}):this.toastrService.error(this.concatMessage(a),"Error",{enableHtml:!0})}setHtmlli(e,t=!0){return t?`<li>${e}</li>`:e}getResponseList(e){let t=[];return e.forEach(a=>{typeof a?.Response=="string"?t=[...t,a.Response]:(a?.Response?.Success.forEach(s=>{t=[...t,a.Name]}),a?.Response.Fail.forEach(s=>{t=[...t,s]}))}),t}concatMessage(e=[]){let t="";return e.forEach(a=>{t+=a}),e.length>1?`<ol>${t}</ol>`:t}showToastrSuccessUploadSingle(e,t){let a=e.filter(r=>r.Status==!1),s=e.filter(r=>r.Status==!0),n=this.generateToastrMessage(a,s,t);this.toastrService.success(n.message,"Success",{enableHtml:!0})}showToastErrorUploadSingle(e,t){let a=e?.error?.Message.filter(r=>r.Status==!1),s=e?.error?.Message.filter(r=>r.Status==!0),n=this.generateToastrMessage(a,s,t);n.status=="WARNING"?this.toastrService.warning(n.message,"Warning!",{enableHtml:!0}):this.toastrService.error(n.message,`Error - ${e.status}`,{enableHtml:!0})}generateToastrMessage(e,t,a){let s="",n,r=[...e,...t];if(e.length==0&&t.length>0)n="SUCCESS",s=this.createSuccessResponse(t,a);else if(e.length>0&&t.length==0)n="ERROR",s=this.createErrResponse(e,a);else{n="WARNING";let u=this.createSuccessResponse(t,a),g=this.createErrResponse(e,a);s=`${u} ${g}`}return r.length>1&&(s=`<ol>${s}</ol>`),{status:n,message:s}}createErrResponse(e,t){let a="";return e.length>1?e.forEach((s,n)=>{a+=`<li>${s.Response}</li>`}):e.length==1&&(a+=`${e[0].Response}`),a}createSuccessResponse(e,t){let a="";return e.length>1?e.forEach((s,n)=>{a+=`<li>Product ${t.Name} was <b>successfully</b> uploaded to ${s.Name}</li>`}):e.length==1&&(a+=`Product ${t.Name} was <b>successfully</b> uploaded to ${e[0].Name}`),a}static{this.\u0275fac=function(t){return new(t||i)(p(S),p(f))}}static{this.\u0275prov=d({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();export{E as a};
@@ -1 +0,0 @@
1
- import{a as M}from"./chunk-C4XFI4J7.js";import{a as Ve,b as Te}from"./chunk-RMCAWPWK.js";import"./chunk-3LRWABHB.js";import"./chunk-74IXJYWO.js";import"./chunk-G47XGOST.js";import{a as E}from"./chunk-XHAXYWZ7.js";import{a as De,b as Ee,c as Me,d as U}from"./chunk-UDIDZKN6.js";import"./chunk-M5XGP4SG.js";import{a as be,b as Fe}from"./chunk-CIIO2CJ6.js";import"./chunk-H3J5OAIG.js";import"./chunk-AQTXFEBA.js";import{a as ve}from"./chunk-DDV4X5WD.js";import"./chunk-SDUUFQUI.js";import"./chunk-IL5JIRWJ.js";import{a as ye}from"./chunk-SYUFPF3D.js";import"./chunk-5OHRA4AS.js";import"./chunk-3BT5DR3X.js";import"./chunk-3RK6DDJD.js";import"./chunk-J2KWRDVH.js";import"./chunk-7SVF5UPT.js";import{a as se}from"./chunk-5DIRXS7I.js";import"./chunk-CMTBBXR5.js";import{h as he}from"./chunk-S5SDX7ZG.js";import"./chunk-Z3ITXK3D.js";import"./chunk-ACIMXBIC.js";import"./chunk-TGMCGROM.js";import"./chunk-V3NCYRCF.js";import{a as Ce,b as ue,d as xe,e as fe}from"./chunk-5JVEEL2T.js";import{c as pe}from"./chunk-PW42BQIY.js";import{b as de,c as ge}from"./chunk-SWQXSJ7O.js";import"./chunk-AEOSNAHH.js";import{b as _e,e as me}from"./chunk-JXSBFTQM.js";import"./chunk-K5XRGNWG.js";import{d as Pe,l as Se,m as Ie,n as we}from"./chunk-CLER2MX6.js";import{A as ce,b as ie,c as oe,h as ae,m as re,o as le}from"./chunk-6QYD6NIJ.js";import"./chunk-ATZ475FN.js";import"./chunk-YCH6HHU3.js";import"./chunk-B73M3AMU.js";import{d as X,g as Y,j as ee,m as D,n as te,q as ne}from"./chunk-M2FCTYGU.js";import{$c as y,Fc as H,G as W,Gb as z,Gc as d,Hc as R,Ic as b,Kc as I,Lc as w,Mb as h,Mc as v,Qc as J,Sc as T,Yb as m,Z as A,ad as F,bd as Z,cd as Q,dc as P,ea as $,ec as N,gc as k,hc as L,ic as a,jc as c,kc as S,lc as G,mc as q,oc as x,pa as j,pb as V,rb as l,tc as C,uc as r,xb as u,xc as K,ya as p,za as _}from"./chunk-B7KTCPKC.js";import"./chunk-EU2KAMEK.js";import"./chunk-66YHNWRR.js";var B=i=>[i],Re=i=>({"text-decoration-line-through":i}),Ue=i=>({"bg-gradient-warning":i});function Be(i,s){if(i&1&&(a(0,"span",10),S(1,"img",11),c(),d(2)),i&2){let e=s.item;l(),m("src",e==null?null:e.Img,V),l(),b(" ",e.Name," ")}}function Oe(i,s){if(i&1){let e=x();a(0,"button",16),C("click",function(){p(e);let t=r().ngIf,o=r(2);return _(o.updateStock(t))}),S(1,"i",17),d(2," Update "),c()}}function We(i,s){if(i&1){let e=x();a(0,"actions")(1,"div",12),h(2,Oe,3,0,"button",13),a(3,"button",14),C("click",function(){p(e);let t=r(2);return _(t.openExportDialog())}),S(4,"i",15),a(5,"span"),d(6,"Export"),c()()()()}if(i&2){let e=s.ngIf,n=r(2);l(2),m("ngIf",n.productService.hasSelectionVariant(e))}}function Ae(i,s){if(i&1){let e=x();a(0,"th")(1,"input",32),C("change",function(t){p(e);let o=r().ngIf,g=r(2);return _(g.onSelectAllSKU(t.target.checked,o))}),c()()}}function $e(i,s){if(i&1){let e=x();a(0,"input",49),v("ngModelChange",function(t){p(e);let o=r(4).$implicit;return w(o.selected,t)||(o.selected=t),_(t)}),C("ngModelChange",function(){p(e);let t=r(4).$implicit,o=r(3);return _(o.onCheckboxStateProduct(t))}),c()}if(i&2){let e=r(4).$implicit;I("ngModel",e.selected)}}function je(i,s){if(i&1&&h(0,$e,1,1,"ng-template",26),i&2){let e=r(6);m("ngxPermissionsOnly",T(1,B,e.rolePriceEdit))}}function ze(i,s){if(i&1){let e=x();G(0),a(1,"img",50),C("click",function(t){p(e);let o=r(3).$implicit,g=r(3);return _(g.onZoomImage(t,o==null?null:o.ImageUrl))}),c(),q()}if(i&2){let e=r(3).$implicit;l(),K("src",e.ThumbnailUrl,V)}}function Ge(i,s){i&1&&S(0,"img",51)}function qe(i,s){if(i&1&&(a(0,"small",48),d(1),c()),i&2){let e=r(3).$implicit;l(),b("(",e.Category,")")}}function Ke(i,s){if(i&1&&(a(0,"td",44)(1,"div",35),h(2,je,1,3,null,26),a(3,"div"),h(4,ze,2,1,"ng-container",45)(5,Ge,1,0,"ng-template",null,0,Q),c()()(),a(7,"td",46)(8,"span",47),d(9),c(),h(10,qe,2,1,"small",48),c()),i&2){let e=H(6),n=r(2).$implicit;m("rowSpan",n.Variants.length),l(2),P((n.Variants==null?null:n.Variants.length)>1?2:-1),l(2),m("ngIf",n.ThumbnailUrl)("ngIfElse",e),l(3),m("rowSpan",n.Variants.length),l(2),R(n.Name),l(),P(n.Category?10:-1)}}function He(i,s){if(i&1){let e=x();a(0,"input",54),v("ngModelChange",function(t){p(e);let o=r(2).$implicit;return w(o.selected,t)||(o.selected=t),_(t)}),c()}if(i&2){let e=r(2).$implicit;I("ngModel",e.selected)}}function Je(i,s){if(i&1&&(a(0,"td",52),h(1,He,1,1,"input",53),c()),i&2){let e=r().$implicit;l(),P(e.UnitPrice>=0?1:-1)}}function Ze(i,s){i&1&&(a(0,"div",36),d(1," Not Found "),c())}function Qe(i,s){if(i&1&&(a(0,"div"),d(1),y(2,"number"),c()),i&2){let e=r().$implicit;l(),b(" ",F(2,1,e.UnitPrice)," ")}}function Xe(i,s){if(i&1&&(a(0,"div",37)(1,"a",40),S(2,"i",55),c()()),i&2){let e=r().$implicit,n=r(4);l(),m("href",n.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(e==null?null:e.ID),V)}}function Ye(i,s){if(i&1){let e=x();a(0,"div",56),C("click",function(){p(e);let t=r().$implicit,o=r().$implicit,g=r(2).ngIf,f=r();return _(f.openTableDialog(t,o,g))}),d(1),y(2,"number"),c()}if(i&2){let e=r().$implicit;l(),b(" ",F(2,1,e.Channel[0]==null?null:e.Channel[0].Price)," ")}}function et(i,s){if(i&1){let e=x();a(0,"tr",33),h(1,Ke,11,7),a(2,"td",24),d(3),c(),a(4,"td",27)(5,"span",34),d(6),c()(),h(7,Je,2,1,"ng-template",26),a(8,"td",27)(9,"div",35),h(10,Ze,2,0,"div",36)(11,Qe,3,3,"div")(12,Xe,3,1,"div",37),c()(),a(13,"td",38)(14,"div",35),h(15,Ye,3,3,"div",39),a(16,"div",37)(17,"a",40),S(18,"i",41),c()(),a(19,"div",37)(20,"div",42),C("click",function(){let t=p(e).$implicit,o=r(4);return _(o.refreshPrice(t))}),S(21,"i",43),c()()()()()}if(i&2){let e=s.$implicit,n=s.$index,t=r(4);l(),P(n==0?1:-1),l(2),R(e.Model),l(2),m("matTooltip",e.Discontinued?t.discontinuedVariantMsg:"")("ngClass",T(12,Re,e.Discontinued)),l(),b(" ",e.Code," "),l(),m("ngxPermissionsOnly",T(14,B,t.rolePriceEdit)),l(3),P((e.Channel[0]==null?null:e.Channel[0].Description)!=null?10:-1),l(),P((e.Channel[0]==null?null:e.Channel[0].Description)==null?11:-1),l(),P((e.Channel[0]==null?null:e.Channel[0].Description)==null?12:-1),l(),m("ngClass",T(16,Ue,e.UnitPrice!=(e.Channel[0]==null?null:e.Channel[0].Price))),l(2),P(e.Channel.length>0?15:-1),l(2),m("href",e.Channel[0]==null?null:e.Channel[0].Url,V)}}function tt(i,s){if(i&1&&k(0,et,22,18,"tr",33,N),i&2){let e=s.$implicit;L(e.Variants)}}function nt(i,s){if(i&1){let e=x();a(0,"content")(1,"div",18)(2,"div",19)(3,"table",20)(4,"thead",21)(5,"tr")(6,"th",22),d(7," Product "),a(8,"div")(9,"mat-slide-toggle",23),v("ngModelChange",function(t){p(e);let o=r(2);return w(o.toggleDifferentInventory,t)||(o.toggleDifferentInventory=t),_(t)}),C("toggleChange",function(){p(e);let t=r(2);return _(t.onToggleDifferentInventory())}),a(10,"small",7),d(11,"FILTER DIFFERENT PRICE"),c()()()(),a(12,"th",24),d(13,"Variant"),c(),a(14,"th",25),d(15,"SKU"),c(),h(16,Ae,2,0,"ng-template",26),a(17,"th",27),d(18,"POS"),c(),a(19,"th",27)(20,"div",28),C("click",function(){p(e);let t=r(2);return _(t.openModalFilter())}),S(21,"img",29),a(22,"span",30),d(23),y(24,"stringLimit"),c()()()()(),a(25,"tbody"),k(26,tt,2,0,null,null,N),c()(),a(28,"infinite-paginator",31),y(29,"async"),C("onNextPage",function(){p(e);let t=r(2);return _(t.infinitePagination.onNextPage(t.searchFilter))})("onLastPage",function(){p(e);let t=r(2);return _(t.infinitePagination.onLastPage(t.searchFilter))})("onGetRowCount",function(){p(e);let t=r(2);return _(t.infinitePagination.getRowCount(t.searchFilter))}),c()()()()}if(i&2){let e=s.ngIf,n=r(2);l(9),I("ngModel",n.toggleDifferentInventory),l(7),m("ngxPermissionsOnly",T(16,B,n.rolePriceEdit)),l(4),m("matTooltip",(n.selectedChannel==null||n.selectedChannel.Name==null?null:n.selectedChannel.Name.length)>=20?n.selectedChannel==null?null:n.selectedChannel.Name:""),l(),m("src",n.selectedChannel==null?null:n.selectedChannel.Img,V),l(2),b(" ",Z(24,11,n.selectedChannel==null?null:n.selectedChannel.Name,20)," "),l(3),L(e),l(2),m("totalData",n.infinitePagination.totalData())("hideCount",n.infinitePagination.hideCount())("rowCount",F(29,14,n.infinitePagination.totalRowCount$))("pageNumber",n.infinitePagination.pageNumber())("disableNextButton",n.infinitePagination.disableNextButton())("goToLastPage",n.infinitePagination.isLastPage())}}function it(i,s){if(i&1){let e=x();a(0,"mainpanel",2),v("textChange",function(t){p(e);let o=r();return w(o.searchFilter.text,t)||(o.searchFilter.text=t),_(t)}),C("onSubmit",function(){p(e);let t=r();return _(t.onSearch())}),a(1,"filters")(2,"div")(3,"label",3),d(4,"Channel"),c(),a(5,"ng-select",4),v("ngModelChange",function(t){p(e);let o=r();return w(o.searchFilter.ChannelID,t)||(o.searchFilter.ChannelID=t),_(t)}),h(6,Be,3,2,"ng-template",5),c()(),a(7,"div",6)(8,"label",7),d(9,"Page Number"),c(),a(10,"input",8),v("ngModelChange",function(t){p(e);let o=r();return w(o.searchFilter.PageNumber,t)||(o.searchFilter.PageNumber=t),_(t)}),c()(),a(11,"div",6)(12,"label",7),d(13,"Page Size"),c(),a(14,"input",8),v("ngModelChange",function(t){p(e);let o=r();return w(o.searchFilter.RowCount,t)||(o.searchFilter.RowCount=t),_(t)}),c()()(),h(15,We,7,1,"actions",9),y(16,"async"),h(17,nt,30,18,"content",9),y(18,"async"),c()}if(i&2){let e=r();m("headerTitle",e.pageTitle),I("text",e.searchFilter.text),l(5),m("clearable",!1)("items",e.channelOptions),I("ngModel",e.searchFilter.ChannelID),l(5),I("ngModel",e.searchFilter.PageNumber),l(4),I("ngModel",e.searchFilter.RowCount),l(),m("ngIf",F(16,9,e.data$)),l(2),m("ngIf",F(18,11,e.data$))}}var Wt=(()=>{class i{constructor(e,n,t,o,g,f,O,Ne,ke,Le){this.http=e,this.toastr=n,this.dialog=t,this.productService=o,this.biggerPictureService=g,this.inventoryService=f,this.authService=O,this.mainPanelService=Ne,this.exportService=ke,this.decimalPipe=Le,this.infinitePagination=j(U),this.pageTitle="Price Single Channel Comparison",this.toggleDifferentInventory=!1,this.loaderEndpoint="PriceLoader/Load",this.dataEndpoint="Price/GetSingleChannelComparison",this.rowCountApi="Inventory/GetInventoryByChannelRowCount",this.rolePriceEdit=se.PriceUpdate,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.hostName=this.authService.getDomain(),this.data$=this.infinitePagination.data$.pipe(A(1)),this.channelOptions=O.getChannels()}ngOnInit(){this.initPageLoader()}initPageLoader(){this.infinitePagination.fetchDataEndpoint=this.dataEndpoint,this.infinitePagination.fethRowCountEndpoint=this.rowCountApi,this.loader$=this.http.post(`/API/${this.loaderEndpoint}`).pipe($(e=>{this.searchFilter=e.Filter,this.searchFilter.filterModel=E.ALL,this.infinitePagination.reloadPagination(this.searchFilter),this.initSelectedChannel()}))}onToggleDifferentInventory(){this.toggleDifferentInventory?this.searchFilter.filterModel=E.ALL:this.searchFilter.filterModel=E.DIFFERENCE,this.onSearch()}onCheckboxStateProduct(e){e.Variants=e.Variants.map(n=>(n.selected=e.selected,n))}openModalFilter(){this.mainPanelService.openModalFilter()}updateStock(e){let t=this.productService.selectedVariantProduct(e).map(g=>({ID:g.ID,ChannelID:g.Channel[0].ChannelID,Code:g.Code,Price:g.UnitPrice})),o={ListChannelID:[this.searchFilter.ChannelID],ListPrice:t};this.http.post("/api/Price/UpdateChannel",o).subscribe(g=>{this.onSearch(),this.handlingUpdateStock(g.Response)})}handlingUpdateStock(e){if(e.success_list?.length>0||e.failure_list?.length>0){let n=e.failure_list,t=e.success_list;this.inventoryService.showToastrUpdateInventory("Price",t,n)}else this.toastr.error(e[0]?.Exception,"Error")}refreshPrice(e){let n={ChannelItemID:e?.Channel[0].ChannelItemID,ChannelVariationID:e?.Channel[0]?.ChannelVariationID,ChannelID:e?.Channel[0]?.ChannelID,VariantID:e.ID};this.http.post("/api/Price/RefreshPriceChannel",n).subscribe(t=>{this.toastr.success("Successfully updated","Success"),this.onSearch()})}onSearch(){this.infinitePagination.reloadPagination(this.searchFilter),this.initSelectedChannel()}openTableDialog(e,n,t){let o=JSON.parse(JSON.stringify(e));this.dialog.open(De,{data:{Name:n.Name,Variant:o,ChannelID:o?.Channel[0]?.ChannelID,Table:"price",ChannelItemID:o?.Channel[0]?.ChannelItemID}}).afterClosed().pipe(W(f=>pe.IsNotEmpty(f))).subscribe(f=>{this.updateItemAfterDialog(f,e)})}updateItemAfterDialog(e,n){let t={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",t).subscribe(o=>{let g=this.productService.findChannelById(t.ID,this.channelOptions),f=t.Price?this.decimalPipe.transform(t.Price):t.Price;this.toastr.success(`Successfully updated ${e.ItemName} (${e.VarName}) price in ${g.Name} to ${f}`,"Success"),n.Channel[0]&&(n.Channel[0].Price=t.Price),this.infinitePagination.reloadPagination(this.searchFilter)})}initSelectedChannel(){this.selectedChannel=this.channelOptions.find(e=>e.ID==this.searchFilter.ChannelID)}onSelectAllSKU(e,n){n=n.map(t=>(t.Variants=t.Variants.map(o=>(o.selected=e,o)),t))}onZoomImage(e,n){this.biggerPictureService.openBiggerPicture(e,n)}openExportDialog(){this.dialog.open(Te,{data:{title:"Export Price Single Channel Comparison",pageNumber:this.searchFilter.PageNumber,rowCount:this.searchFilter.RowCount,filterExport:this.searchFilter,getRowCountApi:this.rowCountApi,exportApi:"price/GetExportSingleChannelComparison"}}).afterClosed().subscribe()}static{this.\u0275fac=function(n){return new(n||i)(u(me),u(_e),u(Pe),u(ve),u(ye),u(M),u(he),u(Se),u(Ve),u(D))}}static{this.\u0275cmp=z({type:i,selectors:[["app-price-single-channel"]],features:[J([U,M,ne("https://res.cloudinary.com/"),D])],decls:2,vars:3,consts:[["elsePic",""],["class","single-price",3,"headerTitle","text","textChange","onSubmit",4,"ngIf"],[1,"single-price",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"],[3,"onNextPage","onLastPage","onGetRowCount","totalData","hideCount","rowCount","pageNumber","disableNextButton","goToLastPage"],["type","checkbox",1,"me-3",3,"change"],[1,"w-100"],["matTooltipPosition","above",3,"matTooltip","ngClass"],[1,"d-flex","align-items-center","justify-content-end"],["matTooltip","This product is no longer available in POS","matTooltipPosition","above",1,"text-danger"],[1,"ms-3"],[1,"text-end",3,"ngClass"],[2,"cursor","pointer"],["target","_blank",3,"href"],[1,"fas","external-link-custom","fa-solid","fa-arrow-up-right-from-square"],["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"],[4,"ngIf","ngIfElse"],[1,"text-start",3,"rowSpan"],[1,"item-name","mb-0"],[1,"d-block"],["type","checkbox",1,"me-3",3,"ngModelChange","ngModel"],["loading","lazy",1,"border","rounded","w-img","cursor-pointer",2,"margin-left","8px",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png","loading","lazy",1,"border","rounded","w-img",2,"margin-left","8px"],[1,"align-middle"],["type","checkbox",3,"ngModel"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"fa-solid","fa-arrow-up-right-from-square","external-link-custom"],[2,"cursor","pointer",3,"click"]],template:function(n,t){n&1&&(h(0,it,19,13,"mainpanel",1),y(1,"async")),n&2&&m("ngIf",F(1,1,t.loader$))},dependencies:[te,X,Y,ee,D,we,Ie,fe,xe,Ce,ue,ce,oe,le,ie,ae,re,Ee,Me,ge,de,Fe,be],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}"],changeDetection:0})}}return i})();export{Wt as PriceSingleChannelComponent};
@@ -1 +0,0 @@
1
- import{a as an}from"./chunk-RZU7PSKG.js";import{a as Ke}from"./chunk-H3IVI3LN.js";import{a as Le}from"./chunk-PP3PVKNQ.js";import{a as on}from"./chunk-CROPN4YC.js";import"./chunk-MS4AQ6UA.js";import{d as He,k as qe,l as Qe,m as Xe,n as tn,o as en}from"./chunk-M5JQ7BGW.js";import{a as Z}from"./chunk-EPVCMYCI.js";import{e as Pt}from"./chunk-GS3A2D4O.js";import{a as Ht}from"./chunk-2EOAYJGX.js";import{a as ot}from"./chunk-BTHDOSGS.js";import"./chunk-PE5AFID4.js";import{a as Gt,b as zt,c as We}from"./chunk-MHCAI6KP.js";import{b as rn}from"./chunk-6FY74YFQ.js";import{a as Je,b as Ye}from"./chunk-7ZXNQAAU.js";import{c as Ge,f as ze}from"./chunk-JDIBETL5.js";import"./chunk-L7K5HOBY.js";import{a as pt}from"./chunk-YHKEECJR.js";import{b as nn}from"./chunk-RMCAWPWK.js";import"./chunk-3LRWABHB.js";import"./chunk-74IXJYWO.js";import"./chunk-G47XGOST.js";import"./chunk-M5XGP4SG.js";import"./chunk-CIIO2CJ6.js";import"./chunk-H3J5OAIG.js";import"./chunk-AQTXFEBA.js";import{a as Y}from"./chunk-DDV4X5WD.js";import"./chunk-SDUUFQUI.js";import"./chunk-IL5JIRWJ.js";import{a as Ze}from"./chunk-SYUFPF3D.js";import"./chunk-5OHRA4AS.js";import"./chunk-3BT5DR3X.js";import{a as Be,b as je}from"./chunk-E6XWD6WX.js";import"./chunk-DRHWRRQV.js";import"./chunk-OLOIQI4D.js";import"./chunk-IA6KOBDJ.js";import"./chunk-RECNBAEB.js";import"./chunk-SN4AOGQK.js";import"./chunk-SB7NWPDS.js";import"./chunk-AYPY47VM.js";import"./chunk-SM3P57SO.js";import{a as it}from"./chunk-227LB3XT.js";import"./chunk-3RK6DDJD.js";import{a as Wt}from"./chunk-J2KWRDVH.js";import{f as $e}from"./chunk-7SVF5UPT.js";import{a as U}from"./chunk-5DIRXS7I.js";import"./chunk-PAEIUO2F.js";import"./chunk-OZ7LWNOK.js";import"./chunk-ECRWEMEV.js";import"./chunk-LZCEM2PC.js";import{a as Re,b as Ae}from"./chunk-HYJVHRMN.js";import"./chunk-CMTBBXR5.js";import{a as dt}from"./chunk-7KG3DC5J.js";import{a as nt}from"./chunk-WPW3D4MQ.js";import{h as K}from"./chunk-S5SDX7ZG.js";import"./chunk-Z3ITXK3D.js";import"./chunk-ACIMXBIC.js";import"./chunk-TGMCGROM.js";import{a as Oe}from"./chunk-V3NCYRCF.js";import{a as xt,b as Bt,d as lt,e as ke}from"./chunk-5JVEEL2T.js";import{b as I,c as f}from"./chunk-PW42BQIY.js";import{a as Te,b as tt,c as De}from"./chunk-SWQXSJ7O.js";import"./chunk-AEOSNAHH.js";import{b as z,e as H}from"./chunk-JXSBFTQM.js";import"./chunk-K5XRGNWG.js";import{b as yt,c as vt,d as et,e as Ee,f as Fe,g as Ve,h as Ne,i as jt,j as bt,k as $t,m as J,n as Ue}from"./chunk-CLER2MX6.js";import{A as St,b as Me,c as ft,h as B,m as j}from"./chunk-6QYD6NIJ.js";import"./chunk-ATZ475FN.js";import{r as ct,s as st}from"./chunk-YCH6HHU3.js";import"./chunk-B73M3AMU.js";import{E as Lt,F as Pe,G as rt,H as Ie,J as we,d as Ut,f as L,g as N,j as gt,k as be,m as Ct,n as X}from"./chunk-M2FCTYGU.js";import{$c as E,Fc as W,G as V,Gb as T,Gc as p,Hb as Ce,Hc as A,Ic as b,Ka as Tt,Kb as fe,Kc as D,Lc as O,Mb as h,Mc as k,Ra as ut,Rc as Dt,Sc as w,Tc as ae,Vc as ye,Xb as ee,Yb as l,Z as ue,Zb as Se,aa as Rt,ad as F,bd as ve,ca as te,cd as G,dc as R,ea as he,ec as ne,f as me,gc as ie,hc as oe,ic as o,jc as r,ka as _e,kc as g,lc as y,mc as v,ob as ge,oc as x,pa as Q,pb as M,rb as a,tc as C,uc as s,v as Nt,vc as xe,wc as At,xb as S,ya as m,za as u}from"./chunk-B7KTCPKC.js";import"./chunk-EU2KAMEK.js";import"./chunk-66YHNWRR.js";var ln=(()=>{class i{constructor(){this.productTabs=[{Title:"Sold in Channel",Url:"/menu/products/status/sold-in-channel",Description:"SKU has been mapped between dealpos and marketplace"},{Title:"Not in POS",Url:"/menu/products/status/not-in-pos",Description:"SKU sold in Marketplace but not exist in DEALPOS"},{Title:"Not in Channel",Url:"/menu/products/status/not-in-channel",Description:"SKU has not been sold on one of channels"},{Title:"In POS",Url:"/menu/products/status/in-pos",Description:"All products which is already available in POS"},{Title:"Multiple Listing",Url:"/menu/products/status/duplicate-sku",Description:"SKU(s) which is listed more than one time (one to many)"},{Title:"Channel Statistic",Url:"/menu/products/status/channel-statistic",Description:"Product statistic from each channel obtained from the last product scan"},{Title:"Scan Job",Url:"/menu/products/status/notification",Description:"Product statistic from each channel obtained from the last product scan"}]}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=T({type:i,selectors:[["app-status"]],standalone:!1,decls:5,vars:1,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid","d-flex","align-items-center","justify-content-between"],[3,"Tabs"]],template:function(n,e){n&1&&(o(0,"nav",0)(1,"div",1)(2,"div"),g(3,"nav-tab",2),r()()(),g(4,"router-outlet")),n&2&&(a(3),l("Tabs",e.productTabs))},dependencies:[Re,Pe],encapsulation:2})}}return i})();function Sn(i,d){if(i&1&&(o(0,"div",10),g(1,"img",11),o(2,"span"),p(3),r()()),i&2){let t=d.$implicit;l("matTooltip",t.disabled?"Single Product Scan disabled for this type of Channel":null),a(),l("src",t.Img,M),a(2),A(t.Name)}}function xn(i,d){if(i&1&&(o(0,"div",10),g(1,"img",11),o(2,"span"),p(3),r()()),i&2){let t=d.$implicit;l("matTooltip",t.disabled?"Single Product Scan disabled for this type of Channel":null),a(),l("src",t.Img,M),a(2),A(t.Name)}}function yn(i,d){if(i&1&&(o(0,"div",10),g(1,"img",11),o(2,"span"),p(3),r()()),i&2){let t=d.$implicit;l("matTooltip",t.disabled?"Single Product Scan disabled for this type of Channel":null),a(),l("src",t.Img,M),a(2),A(t.Name)}}function vn(i,d){i&1&&(o(0,"mat-radio-button",16),p(1," All "),r()),i&2&&l("value",2)}function bn(i,d){if(i&1){let t=x();o(0,"div",12)(1,"label",13),p(2,"Scan Type"),r(),o(3,"mat-radio-group",14),k("ngModelChange",function(e){m(t);let c=s();return O(c.filter.ScanFull,e)||(c.filter.ScanFull=e),u(e)}),h(4,vn,2,1,"mat-radio-button",15),o(5,"mat-radio-button",16),p(6," Sellable "),r(),o(7,"mat-radio-button",17),p(8," Active "),r()()()}if(i&2){let t=s();a(3),D("ngModel",t.filter.ScanFull),a(),l("ngIf",t.selectedChannel.TypeID==6),a(),l("value",1),a(2),l("value",0)}}function Pn(i,d){i&1&&(o(0,"span"),p(1,"Never"),r())}function In(i,d){if(i&1&&(o(0,"span"),p(1),E(2,"async"),r()),i&2){let t=s(2);a(),A(F(2,1,t.lastSync$))}}function wn(i,d){if(i&1){let t=x();o(0,"div",8)(1,"label",5)(2,"span",18),p(3,"Last Scan:"),r(),h(4,Pn,2,0,"span"),E(5,"async"),h(6,In,3,3,"span"),r(),o(7,"mat-radio-group",19),k("ngModelChange",function(e){m(t);let c=s();return O(c.filter.UpdatedProduct,e)||(c.filter.UpdatedProduct=e),u(e)}),o(8,"mat-radio-button",20),p(9," Scan All Products "),r(),o(10,"mat-radio-button",21),p(11),r()()()}if(i&2){let t=s();a(4),R(F(5,6,t.lastSync$)==null?4:6),a(3),D("ngModel",t.filter.UpdatedProduct),a(),l("value",!1),a(2),l("value",!0)("matTooltip",t.selectedChannel.TypeID==t.channelType.Tokopedia?"Use Tokopedia URL for mapping SKU between POS and Tokopedia":"Scan only products that have been updated since the last channel scan"),a(),b(" ",t.selectedChannel.TypeID==t.channelType.Tokopedia?"Product Download By URL":"Scan Updated Products"," ")}}function Mn(i,d){if(i&1){let t=x();o(0,"div",8)(1,"label",5),p(2," Scan Option "),r(),o(3,"mat-radio-group",22),k("ngModelChange",function(e){m(t);let c=s();return O(c.filter.Async,e)||(c.filter.Async=e),u(e)}),o(4,"mat-radio-button",23),p(5," Asynchronous (Get Notified when Complete) "),r(),o(6,"mat-radio-button",24),p(7," Synchronous (Wait until Complete) "),r()()()}if(i&2){let t=s();a(3),D("ngModel",t.filter.Async),a(),l("value",!0),a(2),l("value",!1)}}var $=(()=>{class i extends Ke{constructor(t,n,e){super(),this.dialogRef=t,this.data=n,this.router=e,this.channelService=Q(Le),this.channelType=I,this.disabledChannelOption=!1,this.filter={ChannelID:f.GuidEMpty,ScanFull:0,UpdatedProduct:!1,Async:!1},this.isSingleChannel=f.IsNotEmpty(n.isSingleChannel)?this.data.isSingleChannel:!1,this.disabledChannelOption=f.IsEmpty(n.disabledChannelOption)?!1:this.data.disabledChannelOption}ngOnInit(){this.initChannelOptions(),this.initFilter(),this.onSelectChannel(this.data?.filter?.ChannelID),this.initModalConfig()}ngAfterViewInit(){this.initTopPosition()}ngOnDestroy(){this.stopOverlayObserver()}initModalConfig(){this.modalConfig=new bt,this.modalConfig.title=this.isSingleChannel?"Scan Single Product":"Scan Channel Marketplace",this.modalConfig.bodyScrollable=!0}initFilter(){this.filter.ChannelID=this.data?.filter?.ChannelID}initChannelOptions(){this.channelOptions=JSON.parse(JSON.stringify(this.data.channelOptions)),this.isSingleChannel&&(this.channelOptions=this.channelOptions.map(t=>(t.disabled=!0,(t.TypeID==I.Tiktok||t.TypeID==I.Tokopedia||t.TypeID==I.Lazada||t.TypeID==I.WooCommerce)&&(t.disabled=!1),t)).sort(t=>t.disabled?1:-1))}onSelectChannel(t){let n=this.filterChannelById(t);this.selectedChannel=n,this.filter.Async=!0,this.iniHasScanUpdate(),this.getLastSync(t)}onClickSelect(){setTimeout(()=>{this.adjustOverlayPosition()},0)}getLastSync(t){this.lastSync$=this.channelService.getLastSync(t).pipe(Nt(n=>(this.selectedChannel.LastSync=n.LastSync,this.setDefaultConfigUpdate(),f.IsNotEmpty(n.LastSync)?f.convertToReadableDate(n.LastSync):null)),ue(1))}setDefaultConfigUpdate(){this.filter.UpdatedProduct=!1,this.selectedChannel&&f.IsNotEmpty(this.selectedChannel.LastSync)&&(this.selectedChannel.TypeID==I.Shopee||this.selectedChannel.TypeID==I.Tiktok||this.selectedChannel.TypeID==I.Lazada)&&(this.filter.UpdatedProduct=!0)}iniHasScanUpdate(){this.selectedChannel?.TypeID!=I.WooCommerce&&this.selectedChannel?.TypeID!=I.KalCare&&this.selectedChannel?.TypeID!=I.None&&!this.isSingleChannel?this.hasScanUpdate=!0:this.hasScanUpdate=!1}filterChannelById(t){let n;return this.channelOptions&&(n=this.channelOptions.find(e=>e.ID==t)),n}submit(){this.selectedChannel.TypeID==I.Tokopedia&&this.filter.UpdatedProduct?this.router.navigate(["/menu/products/download/by-url"]).then(()=>{this.dialogRef.close()}):this.dialogRef.close(this.filter)}isNotEmpty(t){return f.IsNotEmpty(t)}onClose(){this.dialogRef.close()}static{this.\u0275fac=function(n){return new(n||i)(S(yt),S(vt),S(rt))}}static{this.\u0275cmp=T({type:i,selectors:[["app-scan-dialog"]],features:[fe],decls:15,vars:8,consts:[["selectedItem",""],["item",""],[3,"onOk","onClose","onCancel","dynamicValidated","config"],["content",""],[1,"mx-4"],[1,"mb-2","fw-bold"],["optionLabel","Name","optionValue","ID","placeholder","Select a Channel","appendTo","body","filterBy","Name",1,"w-100",2,"--p-select-padding-y","0.75rem",3,"click","ngModelChange","options","ngModel","filter"],["class","mt-4",4,"ngIf"],[1,"mt-8"],["class","mt-8",4,"ngIf"],["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","rounded-1",3,"ngModelChange","ngModel"],["class","me-5","matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Full Scan Product",3,"value",4,"ngIf"],["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","rounded-1",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","rounded-1",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(n,e){if(n&1){let c=x();o(0,"modal-material",2),C("onOk",function(){return m(c),u(e.submit())})("onClose",function(){return m(c),u(e.onClose())})("onCancel",function(){return m(c),u(e.onClose())}),o(1,"div",3)(2,"div",4)(3,"label",5),p(4,"Select a Channel"),r(),o(5,"p-select",6),C("click",function(){return m(c),u(e.onClickSelect())}),k("ngModelChange",function(P){return m(c),O(e.filter.ChannelID,P)||(e.filter.ChannelID=P),u(P)}),C("ngModelChange",function(P){return m(c),u(e.onSelectChannel(P))}),h(6,Sn,4,3,"ng-template",null,0,G)(8,xn,4,3,"ng-template",null,1,G)(10,yn,4,3,"ng-template",null,1,G),r(),h(12,bn,9,4,"div",7)(13,wn,12,8,"div",8)(14,Mn,8,3,"div",9),r()()()}n&2&&(l("dynamicValidated",e.isNotEmpty(e.filter.ChannelID))("config",e.modalConfig),a(5),l("options",e.channelOptions),D("ngModel",e.filter.ChannelID),l("filter",!0),a(7),l("ngIf",!e.isSingleChannel&&e.isNotEmpty(e.filter.ChannelID)),a(),R(e.hasScanUpdate&&e.selectedChannel?13:-1),a(),l("ngIf",!e.isSingleChannel&&e.isNotEmpty(e.filter.ChannelID)))},dependencies:[X,N,gt,je,Be,St,B,j,$t,Wt,zt,st,ct,ze,Gt],encapsulation:2})}}return i})();var _t=function(i){return i.Tokopedia="https://seller.tokopedia.com",i.Shoope="https://seller.shopee.co.id",i.Tiktok="https://seller-id.tiktok.com",i.WooCommerce="https://woocommerce.dealpos.app",i.Lazada="https://sellercenter.lazada.co.id",i}(_t||{});var le={Success:"Success",Info:"Info",Warning:"Warning",Error:"Error"};var Tn=[[["header"]],[["content"]],[["footer"]]],Dn=["header","content","footer"],On=(i,d)=>({bodyScrollable:i,hideScrollbar:d}),kn=(i,d,t,n)=>({"bg-success":i,"bg-warning":d,"bg-info":t,"bg-danger":n}),En=i=>({"mx-auto":i}),Fn=(i,d)=>({"show-footer":i,"p-0":d});function Vn(i,d){if(i&1){let t=x();o(0,"div",8),C("click",function(){m(t);let e=s();return u(e.onBack.emit())}),o(1,"a",9),g(2,"i",10),r()()}}function Nn(i,d){if(i&1){let t=x();o(0,"div")(1,"a",11),C("click",function(){m(t);let e=s();return u(e.onClose.emit())}),g(2,"i",12),r()()}}function Rn(i,d){if(i&1){let t=x();o(0,"a",16),C("click",function(){m(t);let e=s(2);return u(e.onCancel.emit())}),p(1),r()}if(i&2){let t=s(2);a(),b(" ",t.config!=null&&t.config.cancelText?t.config==null?null:t.config.cancelText:"Cancel","")}}function An(i,d){if(i&1){let t=x();o(0,"button",17),C("click",function(){m(t);let e=s(2);return u(e.onOk.emit())})("keyup.F2",function(){m(t);let e=s(2);return u(e.onOk.emit())}),r()}if(i&2){let t=s(2);l("disabled",!(t.config!=null&&t.config.validated)||!t.dynamicValidated)("innerHTML",t.config!=null&&t.config.okText?t.config==null?null:t.config.okText:"Ok (F2)",ge)}}function Un(i,d){if(i&1&&(o(0,"mat-dialog-actions",13),At(1,2),h(2,Rn,2,1,"a",14)(3,An,1,2,"button",15),r()),i&2){let t=s();a(2),l("ngIf",!(t.config!=null&&t.config.hideCancel)),a(),l("ngIf",!(t.config!=null&&t.config.hideOk))}}var ce=class{constructor(){this.title="New Modal",this.okText="Ok (F2)",this.cancelText="Cancel",this.hideFooter=!1,this.hideCancel=!1,this.hideOk=!1,this.hideClose=!1,this.eMoney=!1,this.headerType=le.Success,this.validated=!0,this.customWidth="initial",this.bodyScrollable=!1,this.hideScrollbar=!1,this.disableKeyup=!1,this.noPadding=!1}},cn=(()=>{class i{constructor(){this.dynamicValidated=!0,this.onOk=new Tt,this.onCancel=new Tt,this.onClose=new Tt,this.onBack=new Tt,this.headerType=le}ngOnInit(){this.config==null&&(this.config=new ce)}onKeyup(t){this.config?.disableKeyup||(t.code=="F2"&&this.onOk.emit("F2"),(t.code=="Enter"||t.code=="NumpadEnter")&&this.onOk.emit("Enter"))}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=T({type:i,selectors:[["modal-material"]],inputs:{config:"config",dynamicValidated:"dynamicValidated"},outputs:{onOk:"onOk",onCancel:"onCancel",onClose:"onClose",onBack:"onBack"},ngContentSelectors:Dn,decls:11,vars:23,consts:[["id","modal_material",1,"modal-material","d-flex","align-items-start","flex-column","position-relative","maxHeight",3,"keyup","ngClass"],["mat-dialog-title","",1,"d-flex","w-100","justify-content-between","modal-header","position-relative",3,"ngClass"],["class","back-button position-absolute pointer d-print-none",3,"click",4,"ngIf"],[1,"d-flex","flex-row","d-print-none","align-items-center",3,"ngClass"],[1,"fw-normal"],[4,"ngIf"],[1,"modal-body","w-100",3,"ngClass"],["class","w-100 py-7 border-top d-flex justify-content-end d-print-none",4,"ngIf"],[1,"back-button","position-absolute","pointer","d-print-none",3,"click"],[1,"btn","back-button"],[1,"fa-solid","fa-arrow-left"],[1,"btn-light-blue","btn-sm","pointer","close",3,"click"],[1,"fa-solid","fa-xmark","fa-lg","text-primary"],[1,"w-100","py-7","border-top","d-flex","justify-content-end","d-print-none"],["class","btn btn-light-blue text-primary btn-lg fw-bold mx-3",3,"click",4,"ngIf"],["class","btn btn-light-blue me-6 text-primary btn-lg fw-bold mx-3","data-cy","btn-ok",3,"disabled","innerHTML","click","keyup.F2",4,"ngIf"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3",3,"click"],["data-cy","btn-ok",1,"btn","btn-light-blue","me-6","text-primary","btn-lg","fw-bold","mx-3",3,"click","keyup.F2","disabled","innerHTML"]],template:function(n,e){n&1&&(xe(Tn),o(0,"div",0),C("keyup",function(_){return e.onKeyup(_)}),o(1,"div",1),h(2,Vn,3,0,"div",2),o(3,"div",3)(4,"h4",4),p(5),r(),At(6),r(),h(7,Nn,3,0,"div",5),r(),o(8,"mat-dialog-content",6),At(9,1),r(),h(10,Un,4,2,"mat-dialog-actions",7),r()),n&2&&(Se("width",e.config==null?null:e.config.customWidth),l("ngClass",ae(10,On,e.config==null?null:e.config.bodyScrollable,e.config==null?null:e.config.hideScrollbar)),a(),l("ngClass",ye(13,kn,e.headerType.Success==(e.config==null?null:e.config.headerType),e.headerType.Warning==(e.config==null?null:e.config.headerType),e.headerType.Info==(e.config==null?null:e.config.headerType),e.headerType.Error==(e.config==null?null:e.config.headerType))),a(),l("ngIf",e.config==null?null:e.config.eMoney),a(),l("ngClass",w(18,En,e.config==null?null:e.config.eMoney)),a(2),A(e.config==null?null:e.config.title),a(2),l("ngIf",!(e.config!=null&&e.config.hideClose)),a(),l("ngClass",ae(20,Fn,!(e.config!=null&&e.config.hideFooter),e.config==null?null:e.config.noPadding)),a(2),l("ngIf",!(e.config!=null&&e.config.hideFooter)))},dependencies:[X,Ut,N,Ne,Ee,Ve,Fe],styles:[".mat-mdc-dialog-container{padding:0!important;border-radius:4px!important;overflow:visible!important} .mat-mdc-dialog-container [mat-dialog-title]{color:#fff;padding:15px;border:none}@media print{ .mat-mdc-dialog-container{box-shadow:unset;width:100vw}}@media print{ .cdk-overlay-pane{position:absolute!important;top:-30px;max-width:100vw!important}.modal-body[_ngcontent-%COMP%]{width:100vw!important}}body.modal-body[_ngcontent-%COMP%]{height:100%;overflow-y:hidden}mat-dialog-actions[_ngcontent-%COMP%]{bottom:15px}mat-dialog-actions[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{padding:15px!important;margin-right:12px}mat-dialog-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:15px!important}mat-dialog-actions[_ngcontent-%COMP%] .more[_ngcontent-%COMP%]{margin-right:auto;margin-top:-1rem;padding-top:.4rem!important;margin-left:1rem}.back-button[_ngcontent-%COMP%]{top:5px;left:0}.close[_ngcontent-%COMP%]{padding:.4rem .5rem}.no-padding[_ngcontent-%COMP%]{padding:0}.modal-material[_ngcontent-%COMP%]{width:40vw}@media (max-width: 992px){.modal-material[_ngcontent-%COMP%]{width:50vw!important}}@media (max-width: 576px){ .dialog-filter .modal-material{width:100%!important} .dialog-filter mat-dialog-actions{position:sticky;bottom:0;background:#fff} .dialog-filter .modal-material.d-flex.align-items-start.flex-column.position-relative.maxHeight.bodyScrollable.maxHeight.bodyScrollable .modal-body{max-height:100%!important;overflow-y:auto}}.maxHeight.bodyScrollable[_ngcontent-%COMP%] .modal-body[_ngcontent-%COMP%]{max-height:450px;overflow-y:auto}.modal-header[_ngcontent-%COMP%], .modal-footer[_ngcontent-%COMP%], .modal-footer[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{padding:15px}.modal-dialog[_ngcontent-%COMP%]{max-width:none}.modal-content[_ngcontent-%COMP%]{width:auto;margin:auto;max-width:850px}.maxHeight[_ngcontent-%COMP%] .modal-body[_ngcontent-%COMP%]{max-height:450px;overflow:auto}.modal-body[_ngcontent-%COMP%]{padding:1rem}.modal-body[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{display:block}.modal-body[_ngcontent-%COMP%] .more[_ngcontent-%COMP%]{margin:0;position:absolute;bottom:-20px}.modal-body[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%], .modal-body[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%], .modal-body[_ngcontent-%COMP%] input[type=password][_ngcontent-%COMP%]{border:1px solid #c8d3df;padding:5px 7px}.modal-body[_ngcontent-%COMP%] table[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{width:330px;height:90px}"]})}}return i})();var Ln=i=>({"is-disabled":i});function Bn(i,d){if(i&1&&(y(0),o(1,"tr")(2,"td",10),p(3),r(),o(4,"td",10),p(5),r(),o(6,"td",11)(7,"p",12),p(8,"Product Not in Channel!"),r()()(),v()),i&2){let t=s().$implicit;a(3),b(" ",t==null?null:t.Model," "),a(2),b(" ",t==null?null:t.Code," ")}}function jn(i,d){if(i&1&&(o(0,"td",10),p(1),r()),i&2){let t=s(3).$implicit;ee("rowspan",t.Channel.length),a(),b(" ",t==null?null:t.Model," ")}}function $n(i,d){if(i&1&&(o(0,"td",10),p(1),r()),i&2){let t=s(3).$implicit;ee("rowspan",t.Channel.length),a(),b(" ",t==null?null:t.Code," ")}}function Wn(i,d){if(i&1){let t=x();o(0,"tr"),h(1,jn,2,2,"td",13)(2,$n,2,2,"td",13),o(3,"td",10)(4,"div",14)(5,"a",15),g(6,"img",16),r(),o(7,"div",17),p(8),r()()(),o(9,"td",10),p(10),E(11,"number"),r(),o(12,"td",18),p(13),E(14,"number"),r(),o(15,"td",19)(16,"div",20)(17,"button",21),C("click",function(){let e=m(t).$implicit,c=s(2).$implicit,_=s();return u(_.onDetach(e,c))}),g(18,"i",22),o(19,"span",23),p(20,"Detach"),r()(),o(21,"a",24),g(22,"i",25),o(23,"span",23),p(24,"Edit"),r()()()()()}if(i&2){let t=d.$implicit,n=d.$index,e=s(3);a(),l("ngIf",n==0),a(),l("ngIf",n==0),a(3),l("href",t.Url,M)("title",t.Title),a(),l("src",e.getChannelLogo(t.TypeID),M),a(),l("matTooltip",(t==null||t.Name==null?null:t.Name.length)>40?t==null?null:t.Name:""),a(),b(" ",t.Name," "),a(2),A(F(11,12,t.Price)),a(3),A(F(14,14,t.Inventory)),a(8),l("href",e.getHyperlinkSellerCenter(t),M)("ngClass",w(16,Ln,t.TypeID==e.channelType.KalCare))("matTooltip",t.TypeID!=e.channelType.KalCare?"Edit this product in Seller Center, inventory changes must be done via DEALPOS":"")}}function Gn(i,d){if(i&1&&ie(0,Wn,25,18,"tr",null,ne),i&2){let t=s().$implicit;oe(t==null?null:t.Channel)}}function zn(i,d){if(i&1&&h(0,Bn,9,2,"ng-container",9)(1,Gn,2,0,"ng-template",null,0,G),i&2){let t=d.$implicit,n=W(2);l("ngIf",!t.Channel||t.Channel.length<1)("ngIfElse",n)}}var Kt=(()=>{class i{constructor(t,n){this.data=t,this.dialogRef=n,this.httpService=Q(H),this.toastr=Q(z),this.variants=ut([]),this.channelType=I,this.variants.set(this.data.variants),this.title=t.title}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new bt,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0,this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="850px"}onDetach(t,n){let e={ChannelID:t.ChannelID,ChannelItemID:t.ChannelItemID,ChannelVariationID:t.ChannelVariationID};this.httpService.post(Oe.DetachVariant,[e]).subscribe(c=>{this.toastr.success(c.Message,"Success"),this.updateVariantAfterDetach(n,t.ChannelVariationID)})}updateVariantAfterDetach(t,n){this.variants.update(e=>{let c=e.findIndex(_=>_.ID===t.ID);return c!==-1&&(e[c].Channel=e[c].Channel.filter(_=>_.ChannelVariationID!==n)),[...e]})}getChannelLogo(t){return f.getChannelLogoByTypeId(t)}getHyperlinkSellerCenter(t){let n="javascript:void(0)";switch(t.TypeID){case I.Shopee:n=`${_t.Shoope}/portal/product/${t.ChannelItemID}`;break;case I.Tiktok:n=`${_t.Tiktok}/product/edit/${t.ChannelItemID}`;break;case I.Tokopedia:n=`${_t.Tokopedia}/edit-product/${t.ChannelItemID}`;break;case I.WooCommerce:n=`${_t.WooCommerce}/wp-admin/post.php?post=${t.ChannelItemID}&action=edit`;break;case I.Lazada:n=`${_t.Lazada}/apps/product/publish?productId=${t.ChannelItemID}`;break}return n}static{this.\u0275fac=function(n){return new(n||i)(S(vt),S(yt))}}static{this.\u0275cmp=T({type:i,selectors:[["app-modal-variant"]],decls:27,vars:1,consts:[["printChannelModal",""],[3,"onClose","onCancel","config"],[1,"table"],[1,"sticky-top-thead","variant-modal"],[1,"text-start","sticky-top"],[1,"d-flex","align-items-center"],["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,"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"],[1,"text-end"],[1,"d-flex","align-items-center","justify-content-end"],[1,"btn","btn-small","btn-light","px-4","py-2","me-3",3,"click"],[1,"fa-sharp","fa-link-slash","me-2",2,"font-size","10px"],[1,"fs-6"],["target","_blank",1,"btn","btn-small","btn-light","px-4","py-2",3,"href","ngClass","matTooltip"],[1,"fa-solid","fa-edit","me-2",2,"font-size","10px"]],template:function(n,e){n&1&&(o(0,"modal-material",1),C("onClose",function(){return e.dialogRef.close()})("onCancel",function(){return e.dialogRef.close()}),o(1,"content")(2,"table",2)(3,"thead",3)(4,"tr")(5,"th",4)(6,"div",5)(7,"span"),p(8,"VARIANT"),r(),o(9,"sup"),g(10,"i",6),r()()(),o(11,"th",4),p(12,"SKU"),r(),o(13,"th",4)(14,"div",5)(15,"span"),p(16,"PRODUCT"),r(),o(17,"sup"),g(18,"i",7),r()()(),o(19,"th",4),p(20,"PRICE"),r(),o(21,"th",8),p(22,"INVENTORY"),r(),g(23,"th",4),r()(),o(24,"tbody"),ie(25,zn,3,2,null,null,ne),r()()()()),n&2&&(l("config",e.modalConfig),a(25),oe(e.variants()))},dependencies:[X,Ut,N,Ct,st,ct,cn],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}"]})}}return i})();function Hn(i,d){if(i&1&&(o(0,"mat-option",6)(1,"div"),g(2,"img",7),o(3,"span"),p(4),r()()()),i&2){let t=d.$implicit;l("value",t.ChannelID),a(2),l("src",t.logo,M),a(2),A(t.Title)}}var Mt=(()=>{class i{constructor(){this.dialogRef=Q(yt),this.channels=Q(vt),this.channelIds=ut([]),this.channelOptions=ut([])}ngOnInit(){this.initModalConfig();let t=this.channels.filter((n,e,c)=>c.findIndex(_=>_.ChannelID===n.ChannelID)===e);this.channelOptions.set(t)}initModalConfig(){this.modalConfig=new bt,this.modalConfig.title="Detach Product",this.modalConfig.okText="Save"}onClose(){this.dialogRef.close()}onSave(){let t=this.channels.filter(n=>this.channelIds().includes(n.ChannelID)).map(n=>({ChannelID:n.ChannelID,ChannelItemID:n.ChannelItemID}));this.dialogRef.close(t)}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=T({type:i,selectors:[["app-modal-detach-product"]],decls:8,vars:5,consts:[[3,"onClose","onCancel","onOk","dynamicValidated","config"],["content",""],[1,"mb-2","fw-bold"],["appearance","outline",1,"w-100"],["name","channelid","placeholder","Channel",1,"mat-select-channel",3,"ngModelChange","ngModel","multiple"],["class","channel-option",3,"value",4,"ngFor","ngForOf"],[1,"channel-option",3,"value"],[2,"width","18px","margin-right","10px",3,"src"]],template:function(n,e){n&1&&(o(0,"modal-material",0),C("onClose",function(){return e.onClose()})("onCancel",function(){return e.onClose()})("onOk",function(){return e.onSave()}),o(1,"div",1)(2,"div")(3,"label",2),p(4,"Select a Channel"),r(),o(5,"mat-form-field",3)(6,"mat-select",4),k("ngModelChange",function(_){return O(e.channelIds,_)||(e.channelIds=_),_}),h(7,Hn,5,3,"mat-option",5),r()()()()()),n&2&&(l("dynamicValidated",e.channelIds().length>0)("config",e.modalConfig),a(6),D("ngModel",e.channelIds),l("multiple",!0),a(),l("ngForOf",e.channelOptions()))},dependencies:[X,L,$t,Wt,$e,Ye,Je,Ge,St,B,j,st],encapsulation:2})}}return i})();var Jt=i=>[i];function Kn(i,d){if(i&1){let t=x();o(0,"button",14),C("click",function(){m(t);let e=s(2);return u(e.onDetachMultipleProduct())}),g(1,"i",15),p(2),r()}if(i&2){let t,n=s(2);a(2),b("Detach (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function Jn(i,d){if(i&1&&(y(0),h(1,Kn,3,1,"button",13),v()),i&2){let t=s();a(),R(t.productService.hasSelection(t.products)?1:-1)}}function Yn(i,d){if(i&1){let t=x();o(0,"button",18),C("click",function(){m(t);let e=s(3);return u(e.onOpenScanDialog())}),g(1,"i",19),p(2," Scan Channel "),r()}}function Zn(i,d){if(i&1&&h(0,Yn,3,0,"button",17),i&2){let t=s(2);l("ngIf",!t.productService.hasSelection(t.products))}}function qn(i,d){if(i&1&&(y(0),h(1,Zn,1,1,"button",16),v()),i&2){let t=s();a(),R(t.productService.hasSelection(t.products)?-1:1)}}function Qn(i,d){if(i&1){let t=x();o(0,"button",21),C("click",function(){m(t);let e=s(2);return u(e.onScanMultipleProduct())}),g(1,"i",19),p(2),r()}if(i&2){let t,n=s(2);a(2),b(" Scan (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function Xn(i,d){if(i&1&&(y(0),h(1,Qn,3,1,"button",20),v()),i&2){let t=s();a(),R(t.productService.hasSelection(t.products)&&t.multipeScanChannels.length>0?1:-1)}}function ti(i,d){if(i&1){let t=x();o(0,"button",23),C("click",function(){m(t);let e=s(2);return u(e.onUploadMultipleProduct())}),g(1,"i",24),p(2),r()}if(i&2){let t,n=s(2);a(2),b(" Upload (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function ei(i,d){if(i&1&&(y(0),h(1,ti,3,1,"button",22),v()),i&2){let t=s();a(),R(t.productService.hasSelection(t.products)?1:-1)}}function ni(i,d){if(i&1){let t=x();o(0,"div",25)(1,"app-product-card",26),C("onUpload",function(){let e=m(t).$implicit,c=s();return u(c.onUploadToMultipleChannel(e))})("onScan",function(){let e=m(t).$implicit,c=s();return u(c.onScanSingleProduct(e))})("onDescEvent",function(){let e=m(t).index,c=s();return u(c.onOpenDialogVariant(e))})("onCheckBoxChange",function(e){let c=m(t).$implicit;return u(c.selected=e)})("onDetach",function(){let e=m(t).$implicit,c=s();return u(c.onDetachProduct([e]))}),r()()}if(i&2){let t=d.$implicit,n=s();a(),l("productId",t.ID)("title",t==null?null:t.Name)("image",t==null?null:t.ThumbnailUrl)("description",(t==null||t.Variants==null?null:t.Variants.length)>1?(t==null||t.Variants==null?null:t.Variants.length)+" Variants":null)("channels",n.productService.getChannelProduct(t))("code",n.getVariantCode(t==null?null:t.Variants))("showCheckBox",(t==null?null:t.Channel.length)<n.channelOptions.length)("scanButton",!0)("uploadButton",t==null?null:t.hasUpload)("imageForZoom",t==null?null:t.ImageUrl)("detachButton",(t==null||t.Channel==null?null:t.Channel.length)>0)}}function ii(i,d){i&1&&(y(0),o(1,"div",27),g(2,"app-empty-state"),r(),v())}function oi(i,d){if(i&1){let t=x();y(0),o(1,"div",28)(2,"div",29)(3,"app-custom-paginator",30),C("next",function(){m(t);let e=s();return u(e.getProducts())})("previous",function(){m(t);let e=s();return u(e.getProducts())}),r()()(),v()}if(i&2){let t=s();a(3),l("filter",t.searchFilter)("totaldata",t.products==null?null:t.products.length)("paginationTotal",t.rowCount)("hasClicked",!0)("nextButtonAlwaysVisible",!0)}}var pn=(()=>{class i{constructor(t,n,e,c,_,P,mt){this.http=t,this.toastr=n,this.dialog=e,this.productService=c,this.authService=_,this.uploadProductService=P,this.route=mt,this.searchFilter=new dt,this.products=[],this.rowCount=0,this.multipeScanChannels=[],this.scanProductRole=U.ProductScan,this.uploadProductRole=U.ProductUpload,this.detachProductRole=U.ProductDetach,this.getLoaderPage(),this.channelOptions=this.authService.getChannels(),this.initMultiScanChannels()}getLoaderPage(){this.productService.LoadInPOS().subscribe(t=>{this.Categories=t.Options.Categories,this.searchFilter.PageNumber=t.Filter.PageNumber,this.searchFilter.RowCount=t.Filter.RowCount,this.searchFilter.ChannelID=null,this.searchFilter.Category=t.Filter.Category,this.searchFilter.PageSize=100,this.getProducts()})}initMultiScanChannels(){this.multipeScanChannels=this.productService.filterChannelByTypeId(this.channelOptions,[I.Tokopedia,I.Tiktok])}getProducts(){let t={PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount,text:this.searchFilter.text,Category:this.searchFilter.Category,From:this.startDate,To:this.endDate};this.http.post("/api/product/GetInPOS",t).subscribe(n=>{this.products=n.Data,this.rowCount=n.Total==null?this.searchFilter.RowCount:n.Total.toString(),this.products=this.productService.checkProductHasUploadBtn(this.products,this.channelOptions)})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open($,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(V(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID,this.searchFilter.ScanFull=e.ScanFull,this.searchFilter.UpdatedProduct=e.UpdatedProduct,this.searchFilter.Async=e.Async,this.scanAllProduct()})}scanAllProduct(){if(this.searchFilter.ChannelID==null){this.toastr.error("Please Select Channel","Error");return}this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(t=>{if(this.searchFilter.Async)this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"});else{this.getLoaderPage();let n=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.successToastrScanAllProduct(t,n,!this.searchFilter.UpdatedProduct)}})}onOpenDialogVariant(t){let n=this.products[t]?.Variants||[];this.dialog.open(Kt,{data:{title:this.products[t].Name,variants:n}})}onUploadMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.uploadProductService.setSelectedProduct(t),this.route.navigate(["/menu/products/upload"])}onUploadToMultipleChannel(t){this.uploadProductService.setSelectedProduct([t]),this.route.navigate(["/menu/products/upload"])}searchProduct(t){this.searchFilter.text=t,this.getProducts()}onScanMultipleProduct(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty;let n=this.productService.filterChannelByTypeId(this.channelOptions,[I.Tokopedia,I.Tiktok]);this.dialog.open($,{data:{filter:t,channelOptions:n,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(V(c=>f.IsNotEmpty(c))).subscribe(c=>{this.searchFilter.ChannelID=c.ChannelID,this.searchFilter.ScanFull=c.ScanFull,this.searchFilter.UpdatedProduct=c.UpdatedProduct;let _=this.productService.selectedProduct(this.products),P=this.productService.getVariantCodesProducts(_);this.scanSingleProduct(P)})}onScanSingleProduct(t){let n=JSON.parse(JSON.stringify(this.searchFilter));n.ChannelID=f.GuidEMpty,this.dialog.open($,{data:{filter:n,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(V(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID;let c=this.productService.getVariantCodesProduct(t);this.scanSingleProduct(c)})}scanSingleProduct(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:n=>{if(n)this.toastr.success("Successfully Scan ","Success");else{let e=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.toastr.error(`This product is not existed in ${e?.Name} `,"Error")}this.searchFilter.ChannelID=f.GuidEMpty,n&&this.getProducts()},error:n=>{this.searchFilter.ChannelID=f.GuidEMpty}})}getVariantCode(t=[]){let n;return t?.length>1&&(n=(t[0].model?t[0].model:"")+t[0].Code),t?.length==1&&(n=t[0].Code),n}onDetachProduct(t){let n=[];t.forEach(e=>{e.Channel=f.assignChannelLogo(e.Channel),n.push(...e.Channel)}),this.dialog.open(Mt,{width:"600px",data:[...n]}).afterClosed().pipe(V(e=>f.IsNotEmpty(e)),Rt(e=>this.productService.detachProduct(e))).subscribe(e=>{this.toastr.success(e.Message,jt.Success),this.getProducts()})}onDetachMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.onDetachProduct(t)}static{this.\u0275fac=function(n){return new(n||i)(S(H),S(z),S(et),S(Y),S(K),S(Pt),S(rt))}}static{this.\u0275cmp=T({type:i,selectors:[["app-in-pos"]],standalone:!1,decls:23,vars:22,consts:[["picker",""],["description","All products which is already available in POS",3,"onSubmit","headerTitle"],[4,"ngxPermissionsOnly"],[1,"fw-bold","mb-2"],["appendTo","body","bindLabel","Name","name","Name","bindValue","Name","placeholder","Select Category",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],[1,"mt-5"],["id","dates",1,"form-control","rounded","dateRange",3,"rangePicker"],["matStartDate","","placeholder","Start date",3,"ngModelChange","click","ngModel"],["matEndDate","","placeholder","End date",3,"ngModelChange","click","ngModel"],[1,"container-fluid"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],[4,"ngIf"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"fa-sharp","fa-link-slash","me-2"],["type","button","data-cy","scanSoldinChannel",1,"btn","btn-outline-secondary","shadow","rounded"],["type","button","data-cy","scanSoldinChannel","class","btn btn-outline-secondary shadow rounded",3,"click",4,"ngIf"],["type","button","data-cy","scanSoldinChannel",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-2"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"btn","btn-light","shadow","rounded","ms-2"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onUpload","onScan","onDescEvent","onCheckBoxChange","onDetach","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom","detachButton"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row","mt-2","justify-content-end"],[1,"col-md-12"],[3,"next","previous","filter","totaldata","paginationTotal","hasClicked","nextButtonAlwaysVisible"]],template:function(n,e){if(n&1){let c=x();o(0,"mainpanel",1),C("onSubmit",function(P){return m(c),u(e.searchProduct(P))}),o(1,"actions"),h(2,Jn,2,1,"ng-container",2)(3,qn,2,1,"ng-container",2)(4,Xn,2,1,"ng-container",2)(5,ei,2,1,"ng-container",2),r(),o(6,"filters")(7,"div")(8,"label",3),p(9,"Category"),r(),o(10,"ng-select",4),C("ngModelChange",function(P){return m(c),u(e.searchFilter.Category=P)}),r()(),o(11,"div",5)(12,"mat-date-range-input",6)(13,"input",7),k("ngModelChange",function(P){return m(c),O(e.startDate,P)||(e.startDate=P),u(P)}),C("click",function(){m(c);let P=W(16);return u(P.open())}),r(),o(14,"input",8),k("ngModelChange",function(P){return m(c),O(e.endDate,P)||(e.endDate=P),u(P)}),C("click",function(){m(c);let P=W(16);return u(P.open())}),r()(),g(15,"mat-date-range-picker",null,0),r()(),o(17,"content")(18,"div",9)(19,"div",10),h(20,ni,2,11,"div",11)(21,ii,3,0,"ng-container",12),r(),h(22,oi,4,5,"ng-container",12),r()()()}if(n&2){let c=W(16);l("headerTitle","In POS ("+e.rowCount+")"),a(2),l("ngxPermissionsOnly",w(14,Jt,e.detachProductRole)),a(),l("ngxPermissionsOnly",w(16,Jt,e.scanProductRole)),a(),l("ngxPermissionsOnly",w(18,Jt,e.scanProductRole)),a(),l("ngxPermissionsOnly",w(20,Jt,e.scanProductRole)),a(5),l("clearable",!0)("items",e.Categories)("ngModel",e.searchFilter.Category),a(2),l("rangePicker",c),a(),D("ngModel",e.startDate),a(),D("ngModel",e.endDate),a(6),l("ngForOf",e.products),a(),l("ngIf",e.products.length==0),a(),l("ngIf",e.products.length>0)}},dependencies:[L,N,ft,B,j,J,lt,nt,pt,Z,qe,Qe,Xe,tn,tt],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.img-logo[_ngcontent-%COMP%]{height:24px;width:24px}.dateRange[_ngcontent-%COMP%]{padding-top:.8rem;padding-bottom:.8rem}"]})}}return i})();var Qt=i=>[i];function ai(i,d){if(i&1){let t=x();o(0,"button",12),C("click",function(){m(t);let e=s(2);return u(e.onDetachMultipleProduct())}),g(1,"i",13),p(2),r()}if(i&2){let t,n=s(2);a(2),b("Detach (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function ri(i,d){if(i&1&&(y(0),h(1,ai,3,1,"button",11),v()),i&2){let t=s();a(),R(t.productService.hasSelection(t.products)?1:-1)}}function li(i,d){if(i&1){let t=x();o(0,"button",15),C("click",function(){m(t);let e=s(2);return u(e.onOpenScanDialog())}),g(1,"i",16),p(2," Scan Channel "),r()}}function ci(i,d){if(i&1&&(y(0),h(1,li,3,0,"button",14),v()),i&2){let t=s();a(),R(t.productService.hasSelection(t.products)?-1:1)}}function si(i,d){if(i&1){let t=x();o(0,"button",18),C("click",function(){m(t);let e=s(2);return u(e.onScanMultipleProduct())}),g(1,"i",16),p(2),r()}if(i&2){let t=s(2);a(2),b(" Scan (",t.productService.selectedProduct(t.products).length,") ")}}function di(i,d){if(i&1&&(y(0),h(1,si,3,1,"button",17),v()),i&2){let t=s();a(),R(t.multipeScanChannels.length>0&&t.productService.hasSelection(t.products)?1:-1)}}function pi(i,d){if(i&1){let t=x();o(0,"button",20),C("click",function(){m(t);let e=s(2);return u(e.onUploadMultipleProduct())}),g(1,"i",21),p(2),r()}if(i&2){let t=s(2);a(2),b(" Upload (",t.productService.selectedProduct(t.products).length,") ")}}function mi(i,d){if(i&1&&(y(0),h(1,pi,3,1,"button",19),v()),i&2){let t=s();a(),R(t.productService.hasSelection(t.products)?1:-1)}}function ui(i,d){if(i&1&&(o(0,"span",22),g(1,"img",23),r(),p(2)),i&2){let t=d.item;a(),l("src",t.Img,M)("alt",t.Name),a(),b(" ",t.Name," ")}}function hi(i,d){if(i&1){let t=x();o(0,"div",24)(1,"label",25),p(2,"Item ID"),r(),o(3,"input",26),k("ngModelChange",function(e){m(t);let c=s();return O(c.searchFilter.Item_id,e)||(c.searchFilter.Item_id=e),u(e)}),r()()}if(i&2){let t=s();a(3),D("ngModel",t.searchFilter.Item_id)}}function _i(i,d){if(i&1){let t=x();o(0,"div",27)(1,"app-product-card",28),C("onUpload",function(){let e=m(t).$implicit,c=s();return u(c.onUploadToMultipleChannel(e))})("onDescEvent",function(){let e=m(t).index,c=s();return u(c.onOpenVariantDetail(e))})("onScan",function(){let e=m(t).$implicit,c=s();return u(c.onScanSingleProduct(e))})("onCheckBoxChange",function(e){let c=m(t).$implicit;return u(c.selected=e)})("onDetach",function(){let e=m(t).$implicit,c=s();return u(c.onDetachProduct([e]))}),r()()}if(i&2){let t=d.$implicit,n=s();a(),l("productId",t==null?null:t.ID)("title",t==null?null:t.Name)("image",t==null?null:t.ThumbnailUrl)("description",(t==null||t.Variants==null?null:t.Variants.length)>1?(t==null||t.Variants==null?null:t.Variants.length)+" Variants":null)("channels",n.productService.getChannelProduct(t))("code",n.getVariantCode(t==null?null:t.Variants))("showCheckBox",t==null?null:t.hasScan)("scanButton",!0)("uploadButton",t==null?null:t.hasUpload)("imageForZoom",t==null?null:t.ImageUrl)("detachButton",(t==null||t.Channel==null?null:t.Channel.length)>0)}}function gi(i,d){i&1&&(y(0),o(1,"div",29),g(2,"app-empty-state"),r(),v())}function Ci(i,d){if(i&1){let t=x();o(0,"div",30)(1,"div",31)(2,"app-custom-paginator",32),C("total",function(){m(t);let e=s();return u(e.getRowCount())})("next",function(){m(t);let e=s();return u(e.getProducts())})("previous",function(){m(t);let e=s();return u(e.getProducts())}),r()()()}if(i&2){let t=s();a(2),l("filter",t.searchFilter)("totaldata",t.products==null?null:t.products.length)("paginationTotal",t.rowCount)("hasClicked",t.hasClickRowCount)}}var mn=(()=>{class i{constructor(t,n,e,c,_,P,mt,Vt){this.http=t,this.dialog=n,this.toastr=e,this.productService=c,this.activateRouter=_,this.authService=P,this.route=mt,this.uploadProductService=Vt,this.searchFilter=new dt,this.products=[],this.rowCount=0,this.hasClickRowCount=!1,this.guidEmpty=f.GuidEMpty,this.multipeScanChannels=[],this.scanProductRole=U.ProductScan,this.uploadProductRole=U.ProductUpload,this.detachProductRole=U.ProductDetach,this.channelOptions=this.authService.getChannels(),this.initMultiScanChannels()}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(f.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(n=>{this.searchFilter=n.Filter,n.Filter.ChannelID!=f.GuidEMpty&&(this.searchFilter.ListChannelID=[],this.searchFilter.ListChannelID.push(n.Filter.ChannelID)),this.searchFilter.PageSize=n.Filter.RowCount,this.searchFilter.Item_id="",this.getProducts()})}initMultiScanChannels(){this.multipeScanChannels=this.productService.filterChannelByTypeId(this.channelOptions,[I.Tokopedia,I.Tiktok])}getProducts(){let t={ListChannelID:this.searchFilter.ListChannelID,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount,text:this.searchFilter.text,Item_id:this.searchFilter.Item_id};this.productService.findAllSoldInChannel(t).subscribe(n=>{this.products=n.Data,this.products=this.productService.checkProductHasUploadBtn(this.products,this.channelOptions),this.products=this.productService.checkProductHasScanButton(this.products,this.channelOptions)})}searchProduct(t){this.searchFilter.text=t,this.hasClickRowCount=!1,this.getProducts()}onOpenVariantDetail(t){let n=this.products[t].Variants;this.dialog.open(Kt,{data:{variants:n,title:this.products[t].Name}})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open($,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(V(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID,this.searchFilter.ScanFull=e.ScanFull,this.searchFilter.UpdatedProduct=e.UpdatedProduct,this.searchFilter.Async=e.Async,this.scanAllProduct()})}scanAllProduct(){let t=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).pipe(V(n=>n)).subscribe(n=>{this.searchFilter.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.productService.successToastrScanAllProduct(n,t,!this.searchFilter.UpdatedProduct),this.initPageLoader(f.GuidEMpty))})}onScanSingleProduct(t){t.Channel=this.productService.getChannelProduct(t);let n=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open($,{data:{filter:n,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(V(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID;let c=this.productService.getVariantCodesProduct(t);this.scanProducts(c)})}onUploadToMultipleChannel(t){this.uploadProductService.setSelectedProduct([t]),this.route.navigate(["/menu/products/upload"])}onScanMultipleProduct(){this.searchFilter.ChannelID=f.GuidEMpty;let t=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open($,{data:{filter:t,channelOptions:this.multipeScanChannels,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(V(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID,this.searchFilter.ScanFull=e.ScanFull,this.searchFilter.UpdatedProduct=e.UpdatedProduct;let c=this.productService.selectedProduct(this.products),_=this.productService.getVariantCodesProducts(c);this.scanProducts(_)})}scanProducts(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:n=>{let e=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);n?this.toastr.success(`Product Successfully scan with ${e?.Name}`,"Success"):this.toastr.error(`This product is not existed in ${e?.Name} `,"Error"),this.searchFilter.ChannelID=f.GuidEMpty,n&&this.getProducts()},error:n=>{this.searchFilter.ChannelID=f.GuidEMpty}})}getVariantCode(t){let n;return t.length>1&&(n=(t[0].model?t[0].model:"")+t[0].Code),t.length==1&&(n=t[0].Code),n}onClearFilterChannel(){this.searchFilter.ChannelID=f.GuidEMpty,this.searchFilter.Item_id=""}onUploadMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.uploadProductService.setSelectedProduct(t),this.route.navigate(["/menu/products/upload"])}getRowCount(){let t={ListChannelID:this.searchFilter.ListChannelID,text:this.searchFilter.text};this.http.post("/api/product/GetSoldInChannelRowCount",t).subscribe(n=>{this.hasClickRowCount=!0,this.rowCount=n.Total})}onDetachProduct(t){let n=[];t.forEach(e=>{e.Channel=f.assignChannelLogo(e.Channel),n.push(...e.Channel)}),this.dialog.open(Mt,{width:"600px",data:[...n]}).afterClosed().pipe(V(e=>f.IsNotEmpty(e)),Rt(e=>this.productService.detachProduct(e))).subscribe(e=>{this.toastr.success(e.Message,jt.Success),this.getProducts()})}onDetachMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.onDetachProduct(t)}static{this.\u0275fac=function(n){return new(n||i)(S(H),S(et),S(z),S(Y),S(Lt),S(K),S(rt),S(Pt))}}static{this.\u0275cmp=T({type:i,selectors:[["app-sold-in-channel"]],standalone:!1,decls:19,vars:21,consts:[["description","SKU has been mapped between dealpos and marketplace",3,"onSubmit","headerTitle"],[4,"ngxPermissionsOnly"],[1,"fw-bold","mb-2"],["appendTo","body","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel",1,"center-text",3,"ngModelChange","clear","clearable","multiple","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],["class","mt-5",4,"ngIf"],[1,"container-fluid"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],[4,"ngIf"],["class","row",4,"ngIf"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"fa-sharp","fa-link-slash","me-2"],["type","button","data-cy","scanSoldinChannel",1,"btn","btn-outline-secondary","shadow","rounded"],["type","button","data-cy","scanSoldinChannel",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-2"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"btn","btn-light","shadow","rounded","ms-2"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"me-2"],[2,"width","18px",3,"src","alt"],[1,"mt-5"],[1,"fw-bold"],["type","text","name","Item_id","id","Item_id",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onUpload","onDescEvent","onScan","onCheckBoxChange","onDetach","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom","detachButton"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row"],[1,"col-12"],[3,"total","next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(n,e){n&1&&(o(0,"mainpanel",0),C("onSubmit",function(_){return e.searchProduct(_)}),o(1,"actions"),h(2,ri,2,1,"ng-container",1)(3,ci,2,1,"ng-container",1)(4,di,2,1,"ng-container",1)(5,mi,2,1,"ng-container",1),r(),o(6,"filters")(7,"div")(8,"label",2),p(9,"Channel"),r(),o(10,"ng-select",3),C("ngModelChange",function(_){return e.searchFilter.ListChannelID=_})("clear",function(){return e.onClearFilterChannel()}),h(11,ui,3,3,"ng-template",4),r()(),h(12,hi,4,1,"div",5),r(),o(13,"content")(14,"div",6)(15,"div",7),h(16,_i,2,11,"div",8)(17,gi,3,0,"ng-container",9),r(),h(18,Ci,3,4,"div",10),r()()()),n&2&&(l("headerTitle","Sold in Channel"),a(2),l("ngxPermissionsOnly",w(13,Qt,e.detachProductRole)),a(),l("ngxPermissionsOnly",w(15,Qt,e.scanProductRole)),a(),l("ngxPermissionsOnly",w(17,Qt,e.scanProductRole)),a(),l("ngxPermissionsOnly",w(19,Qt,e.uploadProductRole)),a(5),l("clearable",!0)("multiple",!0)("items",e.channelOptions)("ngModel",e.searchFilter.ListChannelID),a(2),l("ngIf",e.searchFilter.ListChannelID!=null),a(4),l("ngForOf",e.products),a(),l("ngIf",e.products.length==0),a(),l("ngIf",e.products==null?null:e.products.length))},dependencies:[L,N,ft,B,j,J,lt,xt,Bt,nt,pt,Z,tt],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}"]})}}return i})();var Xt=i=>[i];function fi(i,d){if(i&1){let t=x();o(0,"button",12),C("click",function(){m(t);let e=s(3);return u(e.uploadMultipleProduct())}),g(1,"i",13),p(2),r()}if(i&2){let t=s(3);a(2),b(" upload (",t.selectedProducts==null?null:t.selectedProducts.length,") ")}}function Si(i,d){if(i&1&&(y(0),h(1,fi,3,1,"button",11),v()),i&2){let t=s(2);a(),l("ngIf",t.hasSelectionProduct)}}function xi(i,d){if(i&1){let t=x();y(0),o(1,"button",14),C("click",function(){m(t);let e=s(2);return u(e.openScanDialog())}),g(2,"i",15),p(3," Scan Channel "),r(),v()}}function yi(i,d){i&1&&(y(0),g(1,"th",23),v())}function vi(i,d){if(i&1){let t=x();y(0),o(1,"td",30)(2,"input",31),k("ngModelChange",function(e){m(t);let c=s(3).$implicit;return O(c.selected,e)||(c.selected=e),u(e)}),C("ngModelChange",function(){m(t);let e=s(4).ngIf,c=s(3);return u(c.onSelectProduct(e))}),r()(),v()}if(i&2){let t=s(3).$implicit;a(),l("rowSpan",t==null?null:t.Variants.length),a(),D("ngModel",t.selected)}}function bi(i,d){if(i&1&&(y(0),h(1,vi,3,2,"ng-container",10),v()),i&2){let t=s().index;a(),l("ngIf",t==0)}}function Pi(i,d){if(i&1){let t=x();y(0),o(1,"img",36),C("click",function(e){m(t);let c=s(3).$implicit,_=s(4);return u(_.onZoomImage(e,c==null?null:c.ImageUrl))}),r(),v()}if(i&2){let t=s(3).$implicit;a(),l("src",t==null?null:t.ImageUrl,M)}}function Ii(i,d){i&1&&g(0,"img",37)}function wi(i,d){if(i&1&&(y(0),o(1,"td",30)(2,"div",32),h(3,Pi,2,1,"ng-container",9)(4,Ii,1,0,"ng-template",null,1,G),r()(),o(6,"td",33)(7,"h4",34)(8,"span",35),p(9),r()()(),v()),i&2){let t=W(5),n=s(2).$implicit;a(),l("rowSpan",n==null?null:n.Variants.length),a(2),l("ngIf",n==null?null:n.ImageUrl)("ngIfElse",t),a(3),l("rowSpan",n==null?null:n.Variants.length),a(2),l("matTooltip",(n==null||n.Name==null?null:n.Name.length)>50?n==null?null:n.Name:""),a(),b(" ",n==null?null:n.Name," ")}}function Mi(i,d){if(i&1&&(o(0,"div")(1,"a",26),g(2,"img",38),r()()),i&2){let t=d.$implicit;a(),l("href",t.URL,M),a(),l("src",t.Img,M)("matTooltip",t.Name)}}function Ti(i,d){if(i&1&&(o(0,"div"),g(1,"img",38),r()),i&2){let t=d.$implicit;a(),l("src",t.Img,M)("matTooltip",t.Name)}}function Di(i,d){if(i&1&&(o(0,"tr"),h(1,bi,2,1,"ng-container",4)(2,wi,10,6,"ng-container",10),o(3,"td"),p(4),r(),o(5,"td")(6,"span"),p(7),r(),o(8,"span",25)(9,"a",26),g(10,"i",27),r()()(),o(11,"td",28)(12,"div",29),h(13,Mi,3,3,"div",24),r()(),o(14,"td",28)(15,"div",29),h(16,Ti,2,2,"div",24),r()()()),i&2){let t=d.$implicit,n=d.index,e=s(5);a(),l("ngxPermissionsOnly",w(7,Xt,e.uploadProductRole)),a(),l("ngIf",n==0),a(2),b(" ",t.Name," "),a(3),b(" ",t.Code," "),a(2),l("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(t==null?null:t.ID),M),a(4),l("ngForOf",t==null?null:t.Available),a(3),l("ngForOf",t==null?null:t.NotAvailable)}}function Oi(i,d){if(i&1&&(y(0),h(1,Di,17,9,"tr",24),v()),i&2){let t=d.$implicit;a(),l("ngForOf",t.Variants)}}function ki(i,d){if(i&1&&(o(0,"tbody"),h(1,Oi,2,1,"ng-container",24),r()),i&2){let t=d.ngIf;a(),l("ngForOf",t)}}function Ei(i,d){if(i&1&&(y(0),o(1,"div",16)(2,"table",17)(3,"thead",18)(4,"tr"),h(5,yi,2,0,"ng-container",4),o(6,"th",19),p(7," Product "),r(),o(8,"th",20),p(9,"Variant"),r(),o(10,"th",20),p(11,"SKU"),r(),o(12,"th",21),p(13,"Available In"),r(),o(14,"th",22),p(15,"Not Available In"),r()()(),h(16,ki,2,1,"tbody",10),E(17,"async"),r()(),v()),i&2){let t=s(2);a(5),l("ngxPermissionsOnly",w(4,Xt,t.uploadProductRole)),a(11),l("ngIf",F(17,2,t.data$))}}function Fi(i,d){i&1&&(o(0,"div",39),g(1,"app-empty-state"),r())}function Vi(i,d){if(i&1){let t=x();o(0,"span",47),C("click",function(){m(t);let e=s(4);return u(e.getRowCount())}),o(1,"i",48),p(2,"?"),r()()}}function Ni(i,d){if(i&1&&(o(0,"span"),p(1),E(2,"number"),r()),i&2){let t=d.ngIf;a(),A(F(2,1,t==null?null:t.Count))}}function Ri(i,d){if(i&1){let t=x();o(0,"a",49),C("click",function(){m(t);let e=s(4);return u(e.onNextPage())}),g(1,"i",50),p(2," Next"),r()}}function Ai(i,d){if(i&1){let t=x();o(0,"a",51),C("click",function(){m(t);let e=s(4);return u(e.onLastPage())}),g(1,"i",52),p(2," Last"),r()}}function Ui(i,d){if(i&1&&(y(0),o(1,"div",40)(2,"div",41)(3,"div",42),p(4),E(5,"number"),h(6,Vi,3,0,"span",43)(7,Ni,3,3,"span",10),E(8,"async"),p(9),r()(),o(10,"div",44),h(11,Ri,3,0,"a",45)(12,Ai,3,0,"a",46),r()(),v()),i&2){let t=s().ngIf,n=s(2);a(4),b(" Showing 1 - ",F(5,6,t==null?null:t.length)," of "),a(2),l("ngIf",n.paginationService.hideCount),a(),l("ngIf",!n.paginationService.hideCount&&F(8,8,n.rowCount$)),a(2),b(" records ~ ",n.paginationService.footerPageNumber," Page "),a(2),l("ngIf",n.paginationService.disableNextButton&&!n.paginationService.goToLastPage),a(),l("ngIf",n.paginationService.disableNextButton&&!n.paginationService.goToLastPage)}}function Li(i,d){if(i&1&&(y(0),h(1,Ui,13,10,"ng-container",10),v()),i&2){let t=d.ngIf;a(),l("ngIf",(t==null?null:t.length)>0)}}function Bi(i,d){if(i&1){let t=x();o(0,"mainpanel",3),C("onSubmit",function(e){m(t);let c=s();return u(c.searchProduct(e))}),o(1,"actions"),h(2,Si,2,1,"ng-container",4)(3,xi,4,0,"ng-container",4),o(4,"button",5),C("click",function(){m(t);let e=s();return u(e.openExportDialog())}),g(5,"i",6),o(6,"span"),p(7,"Export"),r()()(),o(8,"content")(9,"div",7)(10,"div",8),h(11,Ei,18,6,"ng-container",9),E(12,"async"),h(13,Fi,2,0,"ng-template",null,0,G),r(),h(15,Li,2,1,"ng-container",10),E(16,"async"),r()()()}if(i&2){let t,n=W(14),e=s();l("hideSearchDropdown",!0),a(2),l("ngxPermissionsOnly",w(10,Xt,e.uploadProductRole)),a(),l("ngxPermissionsOnly",w(12,Xt,e.scanProductRole)),a(8),l("ngIf",((t=F(12,6,e.data$))==null?null:t.length)>0)("ngIfElse",n),a(4),l("ngIf",F(16,8,e.data$))}}var un=(()=>{class i{constructor(t,n,e,c,_,P,mt,Vt,fn){this.http=t,this.dialog=n,this.toastr=e,this.route=c,this.productService=_,this.paginationService=P,this.biggerPictureService=mt,this.authService=Vt,this.uploadProductService=fn,this.loaderAPI="product/Load",this.rowCountAPI="product/GetNotInChannelRowCount",this.notChannelAPI="product/GetNotInChannelV2",this.hasSelectionProduct=!1,this.selectedProducts=[],this.scanProductRole=U.ProductScan,this.uploadProductRole=U.ProductUpload,this.channelOptions=Vt.getChannels(),this.hostName=this.authService.getDomain()}ngOnInit(){this.initPageLoader(),this.iniData()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.notChannelAPI,this.loader$=this.http.post(`api/${this.loaderAPI}`,{}).pipe(he(t=>{this.filterSearch=t.Filter,this.paginationService.reloadPagination(t.Filter)}))}iniData(){this.data$=this.paginationService.data$.pipe(Nt(t=>(t=t.map(n=>(n.Variants=n.Variants.map(e=>(e.Available=this.productService.sortChannel(e.Available),e.NotAvailable=this.productService.sortChannel(e.NotAvailable),e.Available=this.assignLogoChannel(e.Available),e.NotAvailable=this.assignLogoChannel(e.NotAvailable),e)),n.Channel=n?.Variants[0]?.Available,n)),t)))}assignLogoChannel(t){return t=t.map(n=>(n.Img=f.getChannelLogoByTypeId(n.TypeID),n)),t}searchProduct(t){this.filterSearch.text=t,this.paginationService.reloadPagination(this.filterSearch)}scanAllProduct(){let t=this.productService.findChannelById(this.filterSearch.ChannelID,this.channelOptions);this.productService.scanAll(this.filterSearch.ChannelID,this.filterSearch.ScanFull,this.filterSearch.UpdatedProduct,this.filterSearch.Async).subscribe(n=>{this.filterSearch.Async?this.toastr.success("You will be notified when the scan is completed.","Scan Asynchronous"):(this.productService.successToastrScanAllProduct(n,t,!this.filterSearch.UpdatedProduct),this.initPageLoader())})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.filterSearch));t.ChannelID=f.GuidEMpty,this.dialog.open($,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(V(e=>f.IsNotEmpty(e))).subscribe(e=>{this.filterSearch.ChannelID=e.ChannelID,this.filterSearch.ScanFull=e.ScanFull,this.filterSearch.UpdatedProduct=e.UpdatedProduct,this.filterSearch.Async=e.Async,this.scanAllProduct()})}getRowCount(){this.paginationService.hideCount=!1,this.rowCount$=this.http.post(`/api/${this.rowCountAPI}`,this.filterSearch)}onNextPage(){this.paginationService.onNextPage(this.filterSearch)}onLastPage(){this.http.post(`/api/${this.rowCountAPI}`,{}).subscribe({next:t=>{this.filterSearch.PageNumber=1,this.paginationService.getAllData(this.filterSearch,t.Count)}})}onZoomImage(t,n){this.biggerPictureService.openBiggerPicture(t,n)}onSelectProduct(t){this.hasSelectionProduct=this.productService.hasSelection(t),this.selectedProducts=this.productService.selectedProduct(t)}uploadMultipleProduct(){this.uploadProductService.setSelectedProduct(this.selectedProducts),this.route.navigate(["/menu/products/upload"])}ngOnDestroy(){this.paginationService.destroy()}openExportDialog(){this.dialog.open(nn,{data:{title:"Export Not In Channel",pageNumber:this.filterSearch.PageNumber,rowCount:this.filterSearch.RowCount,filterExport:this.filterSearch,getRowCountApi:"product/GetNotInChannelRowCount",exportApi:"product/GetNotInChannelExport"}}).afterClosed().subscribe()}static{this.\u0275fac=function(n){return new(n||i)(S(H),S(et),S(z),S(rt),S(Y),S(on),S(Ze),S(K),S(Pt))}}static{this.\u0275cmp=T({type:i,selectors:[["app-not-in-channel"]],standalone:!1,decls:2,vars:3,consts:[["EMPTY",""],["elsePic",""],["headerTitle","Not in Channel","description","SKU has not been sold on one of channels",3,"hideSearchDropdown","onSubmit",4,"ngIf"],["headerTitle","Not in Channel","description","SKU has not been sold on one of channels",3,"onSubmit","hideSearchDropdown"],[4,"ngxPermissionsOnly"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"container-fluid","mt-3"],[1,"row"],[4,"ngIf","ngIfElse"],[4,"ngIf"],["class","btn btn-light shadow rounded ms-2",3,"click",4,"ngIf"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],["data-cy","scanNotinChannel","type","button",1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],[1,"col-md-12"],[1,"table","border-bottom"],[1,"thead-light","sticky-top-thead"],["colspan","2",1,"ms-5","text-center",2,"width","450px"],[2,"width","150px"],[2,"width","20%"],[2,"width","16%"],[2,"width","10px"],[4,"ngFor","ngForOf"],[1,"ms-1"],["target","_blank",3,"href"],[1,"fas","fa-solid","fa-arrow-up-right-from-square","external-link-custom"],[2,"padding-left","0px"],[1,"d-flex","flex-wrap","mb-1"],[1,"text-center",3,"rowSpan"],["type","checkbox",3,"ngModelChange","ngModel"],[2,"padding-right","0px"],[1,"text-start",3,"rowSpan"],[1,"ms-5","fw-normal","text-ellipsis",2,"max-width","26vw !important"],[3,"matTooltip"],[1,"border","rounded","cursor-pointer",2,"max-width","40px",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded",2,"max-width","40px"],["alt","",1,"channel-logo","cursor-pointer","ms-4","mt-3",3,"src","matTooltip"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"d-flex","justify-content-between","mt-5"],[1,"me-auto","d-sm-block","collapse","mt-3"],[1,"font-weight-bold","font-italic","hidden-xxs"],["style","cursor: pointer",3,"click",4,"ngIf"],[1,"btn-group"],["role","button","class","btn btn-outline-secondary btn-sm text-primary","title","Load more for 20 products",3,"click",4,"ngIf"],["role","button","class","btn btn-outline-secondary btn-sm text-primary","title","Load all products",3,"click",4,"ngIf"],[2,"cursor","pointer",3,"click"],["title","Retreive rows count",1,"border","p-3"],["role","button","title","Load more for 20 products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fas","fa-arrow-right"],["role","button","title","Load all products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fas","fa-share"]],template:function(n,e){n&1&&(h(0,Bi,17,14,"mainpanel",2),E(1,"async")),n&2&&l("ngIf",F(1,1,e.loader$))},dependencies:[L,N,Me,B,j,J,ct,Z,tt,gt,Ct],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}thead[_ngcontent-%COMP%]{position:sticky;top:0}.channel-logo[_ngcontent-%COMP%]{width:20px}.w-img[_ngcontent-%COMP%]{width:100%}"]})}}return i})();var pe=i=>[i],ji=()=>[];function $i(i,d){if(i&1){let t=x();o(0,"button",16),C("click",function(){m(t);let e=s(2);return u(e.openScanDialog())}),g(1,"i",17),p(2," Scan Channel "),r()}}function Wi(i,d){if(i&1&&(y(0),h(1,$i,3,0,"button",15),v()),i&2){let t=s();a(),R(t.productService.hasSelection(t.products)?-1:1)}}function Gi(i,d){if(i&1){let t=x();o(0,"button",19),C("click",function(){m(t);let e=s(2);return u(e.onDownloadAllProduct("SELECTED"))}),g(1,"i",20),p(2),r()}if(i&2){let t,n=s(2);a(2),b(" Download (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function zi(i,d){if(i&1&&(y(0),h(1,Gi,3,1,"button",18),v()),i&2){let t=s();a(),R(t.productService.hasSelection(t.products)?1:-1)}}function Hi(i,d){if(i&1&&(o(0,"span",21),g(1,"img",22),r(),p(2)),i&2){let t=d.item;a(),l("src",t.Img,M)("alt",t.Name),a(),b(" ",t.Name," ")}}function Ki(i,d){if(i&1){let t=x();o(0,"div",23)(1,"app-product-card",24),C("onCheckBoxChange",function(e){let c=m(t).index,_=s();return u(_.onSelectProduct(e,c))})("onDescEvent",function(){let e=m(t).index,c=s();return u(c.onShowVariantDetail(e))})("onDownload",function(){let e=m(t).$implicit,c=s();return u(c.onDownloadProduct(e))})("onScan",function(){let e=m(t).$implicit,c=s();return u(c.onScanChannel(e))}),r()()}if(i&2){let t=d.$implicit,n=s();a(),l("showRedirectIcon",!1)("title",t==null?null:t.Name)("image",t==null?null:t.Image)("imageForZoom",t==null?null:t.Image)("code",t==null?null:t.SKU)("description",(t==null||t.Variant==null?null:t.Variant.length)>0?(t==null||t.Variant==null?null:t.Variant.length)+" Variants":null)("downloadButton",!0)("channels",t!=null&&t.Channel?w(10,pe,t==null?null:t.Channel):Dt(12,ji))("showCheckBox",n.hasDownloadRole())("scanButton",!0)}}function Ji(i,d){i&1&&(y(0),o(1,"div",25),g(2,"app-empty-state"),r(),v())}function Yi(i,d){if(i&1){let t=x();o(0,"div",26)(1,"div",27)(2,"app-custom-paginator",28),C("total",function(){m(t);let e=s();return u(e.getRowCount())})("next",function(){m(t);let e=s();return u(e.getProducts())})("previous",function(){m(t);let e=s();return u(e.getProducts())}),r()()()}if(i&2){let t=s();a(2),l("filter",t.searchFilter)("totaldata",t.products==null?null:t.products.length)("paginationTotal",t.rowCount)("hasClicked",t.hasClickRowCount)}}var hn=(()=>{class i{constructor(t,n,e,c,_,P){this.http=t,this.dialog=n,this.productService=e,this.toastrService=c,this.activateRouter=_,this.authService=P,this.permissionService=Q(Te),this.searchFilter=new dt,this.products=[],this.hasClickRowCount=!1,this.scanProductRole=U.ProductScan,this.downloadProductRole=U.ProductDownload,this.hasDownloadRole=ut(!0),this.channelOptions=this.authService.getChannels(),this.permissionService.hasPermission(this.downloadProductRole).then(mt=>{this.hasDownloadRole.set(mt)})}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(f.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(n=>{this.searchFilter=n.Filter,this.searchFilter.PageSize=n.Filter.RowCount,this.getProducts()})}getProducts(){this.http.post("/api/product/GetProductChannelNotPOS",this.searchFilter).subscribe(t=>{this.products=t.Data,this.mapChannelToProduct(),this.setSkuProduct()})}mapChannelToProduct(){let t;this.products=this.products.map(n=>(t=this.channelOptions.find(e=>e.ID==n.ChannelID),t?n.Channel=JSON.parse(JSON.stringify(t)):n.Channel=null,n)).map(n=>(n.Channel&&(n.Channel.Url=n.Url),n))}setSkuProduct(){this.products=this.products.map(t=>(t?.Variant?.length==0?f.IsNotEmpty(t?.ChannelItemSKU)?t.SKU=t?.ChannelItemSKU:t.SKU="SKU not assigned":t.SKU=t?.Variant[0]?.ChannelVariationSKU?t?.Variant[0]?.ChannelVariationSKU:"SKU not assigned",t))}onSearch(t){this.searchFilter.text=t,this.hasClickRowCount=!1,this.getProducts()}onClearChannelFilter(){this.searchFilter.ChannelID=f.GuidEMpty}onScanAll(){let t=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(n=>{this.searchFilter.Async?this.toastrService.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.initPageLoader(f.GuidEMpty),this.productService.successToastrScanAllProduct(n,t,!this.searchFilter.UpdatedProduct)),this.searchFilter.ChannelID=f.GuidEMpty})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open($,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(V(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID,this.searchFilter.UpdatedProduct=e.UpdatedProduct,this.searchFilter.ScanFull=e.ScanFull,this.searchFilter.Async=e.Async,this.onScanAll()})}onDownloadAllProduct(t){let n;t=="ALL"?n=this.products:n=this.productService.selectedProduct(this.products),n.length>0&&this.productService.downloadMultipleProduct(n).subscribe({next:()=>{this.getProducts()}})}onSelectProduct(t,n){this.products[n].selected=t}onDownloadProduct(t){confirm(`Are you sure you want to Retrieve product ${t?.Name} from ${t?.Channel.Name} to POS?`)&&this.productService.downloadProduct(t).subscribe({next:()=>{this.getProducts()}})}onScanChannel(t){let n=JSON.parse(JSON.stringify(t));delete n.Channel,this.productService.scanCompareToPos([n]).subscribe(e=>{e.Status?(this.initPageLoader(f.GuidEMpty),this.toastrService.success(`product ${t.Name} have been successfully scanned and synchronized with POS`,"Success")):this.toastrService.error(`Product ${t.Name} is not existed in POS`,"Error")})}onShowVariantDetail(t){let n=this.products[t].Variant;n.length>0&&this.dialog.open(an,{data:{title:this.products[t].Name,variants:n},width:"30%"})}getRowCount(){let t={ChannelID:this.searchFilter.ChannelID,text:this.searchFilter.text,HaveSku:parseInt(this.searchFilter.HaveSku)};this.http.post("/api/product/GetProductChannelNotPOSRowCount",t).subscribe(n=>{this.hasClickRowCount=!0,this.rowCount=n.Count})}static{this.\u0275fac=function(n){return new(n||i)(S(H),S(et),S(Y),S(z),S(Lt),S(K))}}static{this.\u0275cmp=T({type:i,selectors:[["app-not-in-pos"]],standalone:!1,decls:30,vars:17,consts:[["headerTitle","Not in POS","textButton","Search","description","SKU sold in Marketplace but not exist in DEALPOS",3,"onSubmit"],[4,"ngxPermissionsOnly"],[1,"fw-bold","mb-2"],["bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel","appendTo","body",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],["ng-option-tmp",""],[1,"mt-5"],[1,"fw-bold"],["name","haveSKU",1,"form-control","h-100","pt-3","rounded","mt-2",3,"ngModelChange","ngModel"],[1,"me-5",3,"value"],["type","text","name","Item_id","id","Item_id","placeholder","item id",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],[4,"ngIf"],["class","row",4,"ngIf"],["type","button","data-cy","scanNotInPos",1,"btn","btn-outline-secondary","shadow","rounded"],["type","button","data-cy","scanNotInPos",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button",1,"btn","btn-success","shadow-sm","rounded","ms-3"],["type","button",1,"btn","btn-success","shadow-sm","rounded","ms-3",3,"click"],[1,"fa","fa-download"],[1,"me-2"],[2,"width","18px",3,"src","alt"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onCheckBoxChange","onDescEvent","onDownload","onScan","showRedirectIcon","title","image","imageForZoom","code","description","downloadButton","channels","showCheckBox","scanButton"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row"],[1,"col-12"],[3,"total","next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(n,e){n&1&&(o(0,"mainpanel",0),C("onSubmit",function(_){return e.onSearch(_)}),o(1,"actions"),h(2,Wi,2,1,"ng-container",1)(3,zi,2,1,"ng-container",1),r(),o(4,"filters")(5,"div")(6,"label",2),p(7,"Channel"),r(),o(8,"ng-select",3),k("ngModelChange",function(_){return O(e.searchFilter.ChannelID,_)||(e.searchFilter.ChannelID=_),_}),h(9,Hi,3,3,"ng-template",4),r()(),o(10,"div",5)(11,"label",6),p(12,"SKU Assigned"),r(),o(13,"mat-radio-group",7),k("ngModelChange",function(_){return O(e.searchFilter.HaveSku,_)||(e.searchFilter.HaveSku=_),_}),o(14,"mat-radio-button",8),p(15," All "),r(),o(16,"mat-radio-button",8),p(17," Yes "),r(),o(18,"mat-radio-button",8),p(19," No "),r()()(),o(20,"div",5)(21,"label",6),p(22,"Item ID"),r(),o(23,"input",9),k("ngModelChange",function(_){return O(e.searchFilter.Item_id,_)||(e.searchFilter.Item_id=_),_}),r()()(),o(24,"content")(25,"div",10)(26,"div",11),h(27,Ki,2,13,"div",12)(28,Ji,3,0,"ng-container",13),r(),h(29,Yi,3,4,"div",14),r()()()),n&2&&(a(2),l("ngxPermissionsOnly",w(13,pe,e.scanProductRole)),a(),l("ngxPermissionsOnly",w(15,pe,e.downloadProductRole)),a(5),l("clearable",!0)("items",e.channelOptions),D("ngModel",e.searchFilter.ChannelID),a(5),D("ngModel",e.searchFilter.HaveSku),a(),l("value",0),a(2),l("value",1),a(2),l("value",2),a(5),D("ngModel",e.searchFilter.Item_id),a(4),l("ngForOf",e.products),a(),l("ngIf",e.products.length==0),a(),l("ngIf",(e.products==null?null:e.products.length)>0))},dependencies:[L,N,ft,B,j,J,lt,xt,Gt,zt,nt,pt,Z,tt],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.itemTitle[_ngcontent-%COMP%]{cursor:pointer}"]})}}return i})();function Zi(i,d){if(i&1&&(o(0,"span",9),g(1,"img",10),r(),p(2)),i&2){let t=d.item,n=s();a(),l("src",n.getChannelLogo(t.TypeID),M),a(),b(" ",t.Name," ")}}function qi(i,d){if(i&1&&(o(0,"div",11),g(1,"app-duplicate-product-card",12),r()),i&2){let t=d.$implicit,n=d.index;a(),l("imageForZoom",t.ImageUrl)("title",t.Name)("code",t.Code)("id",n)("image",t.ThumbnailURL)("channels",t.Channels)}}function Qi(i,d){i&1&&(y(0),o(1,"div",13),g(2,"app-empty-state"),r(),v())}function Xi(i,d){if(i&1){let t=x();y(0),o(1,"div",14)(2,"div",15)(3,"app-custom-paginator",16),C("next",function(){m(t);let e=s();return u(e.getProducts())})("previous",function(){m(t);let e=s();return u(e.getProducts())})("total",function(){m(t);let e=s();return u(e.getRowCount())}),r()()(),v()}if(i&2){let t=s();a(3),l("filter",t.searchFilter)("totaldata",t.products==null?null:t.products.length)("paginationTotal",t.rowCount)("hasClicked",t.hasClickedRowCount)}}var _n=(()=>{class i{constructor(t,n,e){this.httpService=t,this.productService=n,this.authService=e,this.searchFilter=new dt,this.products=[],this.hasClickedRowCount=!1,this.getPageLoader(),this.channelOptions=e.getChannels()}getPageLoader(){this.productService.loader().subscribe(t=>{this.searchFilter=t.Filter,this.searchFilter.PageSize=t.Filter.RowCount,this.getProducts()})}getProducts(){let t={ListChannelID:this.searchFilter.ListChannelID,RowCount:this.searchFilter.RowCount,PageNumber:this.searchFilter.PageNumber,text:this.searchFilter.text};this.httpService.post("/api/product/GetDuplicateInChannel",t).subscribe(n=>{this.products=n.Data})}onSearch(t){this.searchFilter.text=t,this.hasClickedRowCount=!1,this.getProducts()}onClearFilter(){this.searchFilter.ChannelID=f.GuidEMpty}getChannelLogo(t){return f.getChannelLogoByTypeId(t)}getRowCount(){let t={text:this.searchFilter.text,ChannelID:this.searchFilter.ChannelID};this.httpService.post("/api/product/GetDuplicateInChannelRowCount",t).subscribe(n=>{this.hasClickedRowCount=!0,this.rowCount=n.Total})}static{this.\u0275fac=function(n){return new(n||i)(S(H),S(Y),S(K))}}static{this.\u0275cmp=T({type:i,selectors:[["app-duplicate-sku"]],standalone:!1,decls:14,vars:7,consts:[["headerTitle","Multiple Listing","textButton"," Search","description","SKU(s) which is listed more than one time (one to many)",3,"onSubmit"],["container",""],[1,"mb-2"],["appendTo","body","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel",1,"center-text",3,"ngModelChange","clear","multiple","clearable","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],[1,"container-fluid"],[1,"row","mt-8","mx-1"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],[4,"ngIf"],[1,"me-2"],["alt","",2,"width","18px",3,"src"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"imageForZoom","title","code","id","image","channels"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row","mt-2","justify-content-end"],[1,"col-md-12"],[3,"next","previous","total","filter","totaldata","paginationTotal","hasClicked"]],template:function(n,e){n&1&&(o(0,"mainpanel",0),C("onSubmit",function(_){return e.onSearch(_)}),o(1,"filters")(2,"div",1)(3,"div")(4,"h6",2),p(5,"Channel"),r(),o(6,"ng-select",3),k("ngModelChange",function(_){return O(e.searchFilter.ListChannelID,_)||(e.searchFilter.ListChannelID=_),_}),C("clear",function(){return e.onClearFilter()}),h(7,Zi,3,2,"ng-template",4),r()()()(),o(8,"content")(9,"div",5)(10,"div",6),h(11,qi,2,6,"div",7)(12,Qi,3,0,"ng-container",8),r(),h(13,Xi,4,4,"ng-container",8),r()()()),n&2&&(a(6),l("multiple",!0)("clearable",!0)("items",e.channelOptions),D("ngModel",e.searchFilter.ListChannelID),a(5),l("ngForOf",e.products),a(),l("ngIf",(e.products==null?null:e.products.length)==0),a(),l("ngIf",(e.products==null?null:e.products.length)>0))},dependencies:[L,N,B,j,J,lt,xt,Bt,Ht,nt,Z],encapsulation:2})}}return i})();var to=()=>["/menu/products/status/sold-in-channel"],gn=i=>({ID:i}),eo=()=>["/menu/products/status/not-in-pos"],no=i=>[i];function io(i,d){if(i&1&&(y(0),p(1),v()),i&2){let t=s().$implicit;a(),b(" ",t.Count," ")}}function oo(i,d){if(i&1){let t=x();o(0,"span",25),C("click",function(){m(t);let e=s().$implicit,c=s(2);return u(c.getLiveProductCount(e.ID,e))}),g(1,"i",26),r()}}function ao(i,d){if(i&1){let t=x();y(0),o(1,"button",27),C("click",function(){m(t);let e=s().$implicit,c=s(2);return u(c.onScanChannel(e))}),g(2,"i",28),p(3," Scan "),r(),v()}}function ro(i,d){if(i&1){let t=x();o(0,"tr")(1,"td"),g(2,"img",17),o(3,"span",18),p(4),r()(),o(5,"td",19),h(6,io,2,1,"ng-container",6)(7,oo,2,0,"ng-template",null,1,G),r(),o(9,"td",19)(10,"a",20),p(11),E(12,"number"),r()(),o(13,"td",19)(14,"a",20),p(15),E(16,"number"),r()(),o(17,"td"),p(18),E(19,"date"),r(),o(20,"td")(21,"div",21),h(22,ao,4,0,"ng-container",22),o(23,"button",23),C("click",function(){let e=m(t).$implicit,c=s(2);return u(c.onClearCache(e.ID))}),g(24,"i",24),p(25," Clear "),r()()()()}if(i&2){let t=d.$implicit,n=W(8),e=s(2);a(2),l("src",e.getChannelLogo(t.TypeID),M),a(2),A(t.Name),a(2),l("ngIf",t.Count!==void 0)("ngIfElse",n),a(4),l("routerLink",Dt(19,to))("queryParams",w(20,gn,t.ID)),a(),b(" ",F(12,12,t.SoldInChannel)," "),a(3),l("routerLink",Dt(22,eo))("queryParams",w(23,gn,t.ID)),a(),b(" ",F(16,14,t.NotInPOS)," "),a(3),b(" ",t.LastSync?ve(19,16,t.LastSync,"dd MMM yyyy HH:mm"):"Never"," "),a(4),l("ngxPermissionsOnly",w(25,no,e.scanProductRole))}}function lo(i,d){if(i&1&&(y(0),o(1,"div",7)(2,"table",8)(3,"thead",9)(4,"tr",10)(5,"th"),p(6,"Channel"),r(),o(7,"th",11),p(8," Live Product "),r(),o(9,"th",12),p(10," Sold In Channel "),r(),o(11,"th",13),p(12," Product Not in POS "),r(),o(13,"th",14),p(14,"Last Sync"),r(),g(15,"th",15),r()(),o(16,"tbody"),h(17,ro,26,27,"tr",16),E(18,"async"),r()()(),v()),i&2){let t,n=s();a(17),l("ngForOf",(t=F(18,1,n.channels$))==null?null:t.Data)}}function co(i,d){i&1&&(o(0,"div",29),g(1,"app-empty-state"),r())}var Cn=(()=>{class i{constructor(t,n,e,c){this.productService=t,this.toastr=n,this.dialog=e,this.authService=c,this.scanProductRole=U.ProductScan,this.destroy$=new me,this.channelOptions=c.getChannels()}ngOnInit(){this.setObsProductStatistic()}setObsProductStatistic(){this.channels$=this.productService.getProductStatistic()}getLiveProductCount(t,n){this.productService.getTotalProductLive(t).pipe(te(this.destroy$)).subscribe(e=>{n.Count=e.Count})}onScanChannel(t){this.dialog.open($,{width:"700px",data:{channelOptions:this.channelOptions,filter:{ChannelID:t.ID},disabledChannelOption:!0}}).afterClosed().pipe(V(n=>f.IsNotEmpty(n))).subscribe(n=>{this.scanAllProduct(t.ID,n)})}scanAllProduct(t,n){let e=this.productService.findChannelById(t,this.channelOptions);this.productService.scanAll(n.ChannelID,n.ScanFull,n.UpdatedProduct,n.Async).pipe(V(c=>c)).subscribe(c=>{n.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.productService.successToastrScanAllProduct(c,e,!n.UpdatedProduct),this.setObsProductStatistic())})}onClearCache(t){confirm("Are you sure you want to Clear Cache? This Process will remove your product integration to marketplace")&&this.productService.clearCacheChannel(t).pipe(te(this.destroy$)).subscribe(e=>{this.toastr.success("Successfully cleared cache","Success"),this.setObsProductStatistic()})}getChannelLogo(t){return f.getChannelLogoByTypeId(t)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static{this.\u0275fac=function(n){return new(n||i)(S(Y),S(z),S(et),S(K))}}static{this.\u0275cmp=T({type:i,selectors:[["app-channel-statistic"]],standalone:!1,decls:9,vars:6,consts:[["EMPTY",""],["QUESTION",""],["headerTitle","Products Statistic",3,"hideSearchBox","hideSearchDropdown"],[1,"container-fluid"],[1,"row","mt-4"],[1,"col-md-12"],[4,"ngIf","ngIfElse"],[1,"table-responsive"],[1,"table","table-hover"],[1,"sticky-top-thead"],[1,"table-light"],[1,"text-center",2,"width","13rem"],[1,"text-center",2,"width","9rem"],[1,"text-center",2,"width","14rem"],[2,"width","10rem"],[2,"width","12rem"],[4,"ngFor","ngForOf"],[2,"width","24px","height","24px",3,"src"],[1,"ms-3"],[1,"text-center"],[3,"routerLink","queryParams"],[1,"d-flex","align-items-center","justify-content-center"],[4,"ngxPermissionsOnly"],[1,"btn","btn-sm","btn-secondary","fs-6","ms-3",3,"click"],[1,"fa","fa-trash"],["matTooltip","Click to see total live product",1,"cursor-pointer","fs-5","text-primary",3,"click"],[1,"fa-solid","fa-circle-question","cursor"],[1,"btn","btn-sm","btn-secondary","fs-6",3,"click"],[1,"fa","fa-spinner"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"]],template:function(n,e){if(n&1&&(o(0,"mainpanel",2)(1,"content")(2,"div",3)(3,"div",4)(4,"div",5),h(5,lo,19,3,"ng-container",6),E(6,"async"),h(7,co,2,0,"ng-template",null,0,G),r()()()()()),n&2){let c,_=W(8);l("hideSearchBox",!0)("hideSearchDropdown",!0),a(5),l("ngIf",((c=F(6,4,e.channels$))==null||c.Data==null?null:c.Data.length)>0)("ngIfElse",_)}},dependencies:[L,N,J,ct,Ie,Z,tt,gt,Ct,be],encapsulation:2})}}return i})();var so=[{component:ln,path:"",children:[{path:"",redirectTo:"sold-in-channel",pathMatch:"full"},{path:"in-pos",component:pn,canActivate:[it,ot],data:{title:"Products in POS"}},{path:"sold-in-channel",component:mn,canActivate:[it,ot],data:{title:"Products Sold in Channel"}},{path:"not-in-channel",component:un,canActivate:[it,ot],data:{title:"Products not in Channel"}},{path:"not-in-pos",component:hn,canActivate:[it,ot],data:{title:"Products not in POS"}},{path:"duplicate-sku",component:_n,canActivate:[it,ot],data:{title:"Duplicate Sku in Channel"}},{path:"channel-statistic",component:Cn,canActivate:[it,ot],data:{title:"Channel Statistic"}},{path:"notification",loadComponent(){return import("./chunk-FTGUKCA5.js").then(i=>i.NotificationComponent)},canActivate:[it,ot],data:{title:"Notification"}},{path:"notification/detail",loadComponent(){return import("./chunk-YB65PX7S.js").then(i=>i.DetailComponent)},canActivate:[it,ot],data:{title:"Notification Detail"}}]}],Br=(()=>{class i{static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275mod=Ce({type:i})}static{this.\u0275inj=_e({imports:[X,St,Ue,st,ke,rn,We,Ae,Ht,nt,pt,we.forChild(so),en,He,Mt,De]})}}return i})();export{Br as StatusModule};
@@ -1 +0,0 @@
1
- import{b as Me}from"./chunk-PFB7XEYZ.js";import"./chunk-UEPQYAWE.js";import{a as Ae,b as Pe,c as ke,d as ie,e as oe}from"./chunk-GS3A2D4O.js";import{a as we}from"./chunk-YHKEECJR.js";import{a as Ne,b as Ue}from"./chunk-BFU7VKO3.js";import{b as Ee}from"./chunk-OC2FBL33.js";import"./chunk-NS46QSCM.js";import"./chunk-DDV4X5WD.js";import"./chunk-SYUFPF3D.js";import"./chunk-5OHRA4AS.js";import"./chunk-3BT5DR3X.js";import"./chunk-DRHWRRQV.js";import"./chunk-EH6HWI3G.js";import"./chunk-E3ROEHBW.js";import"./chunk-OLOIQI4D.js";import"./chunk-IA6KOBDJ.js";import"./chunk-RECNBAEB.js";import"./chunk-SN4AOGQK.js";import"./chunk-SB7NWPDS.js";import"./chunk-AYPY47VM.js";import"./chunk-SM3P57SO.js";import"./chunk-5DIRXS7I.js";import"./chunk-OZ7LWNOK.js";import"./chunk-ECRWEMEV.js";import"./chunk-LZCEM2PC.js";import{a as Fe,b as Te}from"./chunk-M7NQID2Z.js";import"./chunk-CMTBBXR5.js";import"./chunk-S5SDX7ZG.js";import"./chunk-Z3ITXK3D.js";import"./chunk-ACIMXBIC.js";import"./chunk-TGMCGROM.js";import"./chunk-V3NCYRCF.js";import{d as O,e as B}from"./chunk-5JVEEL2T.js";import{b as be,c as _}from"./chunk-PW42BQIY.js";import"./chunk-SWQXSJ7O.js";import"./chunk-AEOSNAHH.js";import{e as K}from"./chunk-JXSBFTQM.js";import"./chunk-K5XRGNWG.js";import{m as Se,n as Ie}from"./chunk-CLER2MX6.js";import{A as Z,B as D,c as te,e as ge,h as $,i as H,m as ye,n as q,q as z,s as J,z as Y}from"./chunk-6QYD6NIJ.js";import"./chunk-ATZ475FN.js";import{r as ve,s as xe}from"./chunk-YCH6HHU3.js";import"./chunk-B73M3AMU.js";import{g as V,j as x,n as S}from"./chunk-M2FCTYGU.js";import{$c as g,Gb as b,Gc as u,Hc as fe,Ic as Q,K as de,Ka as w,Kc as he,Lc as _e,M as ue,Mb as h,Mc as Ce,Oa as re,Qc as v,Yb as m,Z as ee,ad as y,dc as E,ea as A,ec as j,gc as R,hc as L,ic as l,ja as P,jc as r,kc as f,lc as N,mc as U,oc as M,pa as d,rb as s,tc as C,uc as a,v as T,xa as k,ya as I,za as F}from"./chunk-B7KTCPKC.js";import"./chunk-EU2KAMEK.js";import"./chunk-66YHNWRR.js";var ae=(()=>{class i{constructor(){this.httpService=d(K),this.formBuilder=d(Y),this.uploadProductService=d(oe)}getAttributes(e,t){return this.httpService.get("api/product/tiktok/GetAttributes",[{key:"ID",value:e},{key:"CategoryID",value:t}]).pipe(de(o=>this.uploadProductService.selectedProduct$.pipe(T(c=>(o=this.mappingAttributeSalesProperty(o,c),o)))))}mappingAttributeSalesProperty(e,t){let n=0;return e.filter(o=>(o.type=="SALES_PROPERTY"&&(n+=1),n>1?(n=0,!1):!0)).map(o=>(o.type=="SALES_PROPERTY"&&(o.name="Jenis Variant",o.is_multiple_selection=!1,o.is_required=this.isProductHasMoreVariant(t),o.values=[{id:"Warna",name:"Warna"},{id:"Ukuran",name:"Ukuran"}]),o))}isProductHasMoreVariant(e){let t=!1,n=[];return e.forEach(o=>{o.Variants&&n.push(o.Variants.length)}),t=n.some(o=>o>1),t}createFormGroup(e){let t=this.formBuilder.group({}),n=[];return e.forEach(o=>{n=[],o.is_required&&n.push(ge.required),t.addControl(o.id,this.formBuilder.control(null,n))}),t}getFilteredAttributes(e,t){let n=JSON.parse(JSON.stringify(e)),o=Object.keys(t),c=n.filter(W=>o.findIndex(Be=>parseInt(Be)==W.id)!=-1);return c=this.filterSelectedAttributes(c,t),c}filterSelectedAttributes(e,t){return e.map(o=>(_.IsNotEmpty(o.values)?o.is_multiple_selection?o.values=o.values.filter(c=>t[o.id]?.includes(c.id)):o.values=o.values.filter(c=>c.id==t[o.id]):t[o.id]&&(o.values=[{id:null,name:t[o.id]}]),o)).filter(o=>o?.values?.length>0)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=P({token:i,factory:i.\u0275fac})}}return i})();function Ge(i,p){i&1&&(l(0,"span",5),u(1,"*"),r())}function je(i,p){if(i&1&&f(0,"ng-select",6),i&2){let e=a().$implicit;m("multiple",!0)("formControlName",e.id)("items",e.values)("placeholder","Pilih "+(e==null?null:e.name))}}function Re(i,p){if(i&1&&f(0,"ng-select",7),i&2){let e=a().$implicit;m("formControlName",e.id)("items",e.values)("placeholder","Pilih "+(e==null?null:e.name))}}function Le(i,p){if(i&1&&f(0,"input",8),i&2){let e=a().$implicit;m("formControlName",e.id)("placeholder",e==null?null:e.name)}}function We(i,p){if(i&1&&(l(0,"small",5),u(1),r()),i&2){let e=a().$implicit;s(),Q(" ",e==null?null:e.name," is mandatory ")}}function He(i,p){if(i&1&&(l(0,"div",3)(1,"div",4),h(2,Ge,2,0,"span",5),l(3,"span"),u(4),r()(),h(5,je,1,4,"ng-select",6)(6,Re,1,3,"ng-select",7)(7,Le,1,2,"input",8)(8,We,2,1,"small",5),r()),i&2){let e=p.$implicit;s(2),E(e.is_required?2:-1),s(2),Q(" ",e==null?null:e.name," "),s(),E(e.is_multiple_selection?5:e.values!==null&&e.values.length>0?6:7),s(3),E(e.is_required?8:-1)}}function qe(i,p){if(i&1&&(N(0),l(1,"form",1)(2,"div",2),R(3,He,9,4,"div",3,j),r()(),U()),i&2){let e=p.ngIf,t=a();s(),m("formGroup",t.form),s(2),L(e)}}var Ve=(()=>{class i{constructor(){this.tiktokAttributeFormService=d(ae),this.attributesChanges=new w}ngOnChanges(){_.IsNotEmpty(this.categoryId)&&_.IsNotEmpty(this.channelId)&&(this.attributes$=this.tiktokAttributeFormService.getAttributes(this.channelId,this.categoryId).pipe(T(e=>e.filter(t=>!(t.type=="PRODUCT_PROPERTY"&&(_.IsEmpty(t.values)||t.values?.length==0)&&t.is_customizable==!1))),A(e=>{this.form=this.tiktokAttributeFormService.createFormGroup(e),this.listenToFormChange(e)}),ee(1)))}listenToFormChange(e){let t=[];this.formSubscription=this.form.valueChanges.subscribe(n=>{t=this.tiktokAttributeFormService.getFilteredAttributes(e,n),this.attributesChanges.emit(t)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=b({type:i,selectors:[["tiktok-attribute-form"]],inputs:{channelId:"channelId",categoryId:"categoryId"},outputs:{attributesChanges:"attributesChanges"},features:[v([ae]),k],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],[1,"text-danger"],["bindLabel","name","bindValue","id",3,"multiple","formControlName","items","placeholder"],["bindLabel","name","bindValue","id",3,"formControlName","items","placeholder"],["type","text",1,"form-control",3,"formControlName","placeholder"]],template:function(t,n){t&1&&(h(0,qe,5,1,"ng-container",0),g(1,"async")),t&2&&m("ngIf",y(1,1,n.attributes$))},dependencies:[S,V,x,B,O,D,q,te,$,H,z,J,Z],encapsulation:2})}}return i})();var se=(()=>{class i{constructor(){this.woocommerceUploadService=d(ie)}getAttributes(e,t){return this.woocommerceUploadService.getAttributes(e,t).pipe(T(n=>n.map(o=>({key:o.name,label:o.name}))))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=P({token:i,factory:i.\u0275fac})}}return i})();var $e=(()=>{class i{constructor(){this.wooAttributeFormService=d(se),this.channelId=re(),this.categoryId=re(),this.attributesChanges=new w}ngOnChanges(){_.IsNotEmpty(this.categoryId())&&_.IsNotEmpty(this.channelId())&&(this.attributes$=this.wooAttributeFormService.getAttributes(this.channelId(),this.categoryId()))}onSelectAttribute(e){this.attributesChanges.emit([e.key])}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=b({type:i,selectors:[["wooocommerce-attribute-form"]],inputs:{channelId:[1,"channelId"],categoryId:[1,"categoryId"]},outputs:{attributesChanges:"attributesChanges"},features:[v([se]),k],decls:6,vars:3,consts:[[1,"row"],[1,"col-6"],[1,"mb-1"],["bindLabel","label","bindValue","id","placeholder","Pilih Atribut",3,"change","items"]],template:function(t,n){t&1&&(l(0,"div",0)(1,"div",1)(2,"div",2),u(3,"Atribut"),r(),l(4,"ng-select",3),g(5,"async"),C("change",function(c){return n.onSelectAttribute(c)}),r()()()),t&2&&(s(4),m("items",y(5,1,n.attributes$)))},dependencies:[S,x,Z,B,O,D],encapsulation:2})}}return i})();var me=(()=>{class i{constructor(){this.httpService=d(K),this.formBuilder=d(Y)}getAttributes(e,t){return this.httpService.get("api/product/tokopedia/GetAttributes",[{key:"ID",value:e},{key:"CategoryID",value:t}]).pipe(T(o=>o))}createFormGroup(e){let t=this.formBuilder.group({});return e.forEach(n=>{t.addControl(n.variant,this.formBuilder.control(null))}),t}convertAttributes(e={}){return Object.values(e).filter(n=>n!==null).map(n=>JSON.stringify(n))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=P({token:i,factory:i.\u0275fac})}}return i})();function ze(i,p){if(i&1&&(l(0,"div",3)(1,"div",4),u(2),r(),f(3,"ng-select",5),r()),i&2){let e=p.$implicit;s(2),Q(" ",e==null?null:e.variant," "),s(),m("formControlName",e.variant)("items",e.values)("placeholder","Pilih "+(e==null?null:e.variant))}}function Je(i,p){if(i&1&&(N(0),l(1,"form",1)(2,"div",2),R(3,ze,4,4,"div",3,j),r()(),U()),i&2){let e=p.ngIf,t=a();s(),m("formGroup",t.form),s(2),L(e)}}var De=(()=>{class i{constructor(){this.tokpedAttrFormService=d(me),this.attributesChanges=new w}ngOnInit(){}ngOnChanges(e){_.IsNotEmpty(this.categoryId)&&_.IsNotEmpty(this.channelId)&&(this.attributes$=this.tokpedAttrFormService.getAttributes(this.channelId,this.categoryId).pipe(A(t=>{this.form=this.tokpedAttrFormService.createFormGroup(t),this.listenToFormChange()})))}listenToFormChange(){let e=[];this.formSubscription=this.form.valueChanges.subscribe(t=>{e=this.tokpedAttrFormService.convertAttributes(t),this.attributesChanges.emit(e)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=b({type:i,selectors:[["tokopedia-attribute-form"]],inputs:{channelId:"channelId",categoryId:"categoryId"},outputs:{attributesChanges:"attributesChanges"},features:[v([me]),k],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["bindLabel","name","bindValue","id",3,"formControlName","items","placeholder"]],template:function(t,n){t&1&&(h(0,Je,5,1,"ng-container",0),g(1,"async")),t&2&&m("ngIf",y(1,1,n.attributes$))},dependencies:[S,V,x,B,O,D,q,$,H,z,J],encapsulation:2})}}return i})();var pe=(()=>{class i{constructor(){this.httpService=d(K),this.formBuilder=d(Y)}getAttributes(e){return this.httpService.get("api/product/shopify/GetAttributes",[{key:"ID",value:e}]).pipe(A(n=>(n.Options.StatusOptions=n.Options.Status.map(o=>({id:o,name:o})),n)))}createFormGroup(e){let t=this.formBuilder.group({});return Object.keys(e.Attribute).forEach(o=>{t.addControl(o,this.formBuilder.control(null))}),t}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=P({token:i,factory:i.\u0275fac})}}return i})();function Ye(i,p){if(i&1&&(N(0),l(1,"form",1)(2,"div",2)(3,"div",3)(4,"div",4),u(5," Brand "),r(),f(6,"input",5),r(),l(7,"div",6)(8,"div",4),u(9," Product Type "),r(),f(10,"input",7),r(),l(11,"div",6)(12,"div",4),u(13," Status "),r(),f(14,"ng-select",8),r()()(),U()),i&2){let e=p.ngIf,t=a();s(),m("formGroup",t.form),s(13),m("items",e.Options.StatusOptions)}}var Oe=(()=>{class i{constructor(){this.attributesChanges=new w,this.shopifyFormService=d(pe)}ngOnChanges(e){e.channelId&&(this.attributes$=this.shopifyFormService.getAttributes(this.channelId).pipe(A(t=>{this.form=this.shopifyFormService.createFormGroup(t),this.listenToFormChange()})))}listenToFormChange(){this.formSubscription=this.form.valueChanges.pipe(ue(500)).subscribe(e=>{this.attributesChanges.emit([e])})}ngOnDestroy(){this.formSubscription.unsubscribe()}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=b({type:i,selectors:[["shopify-attribute-form"]],inputs:{channelId:"channelId"},outputs:{attributesChanges:"attributesChanges"},features:[v([pe]),k],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["formControlName","Brand","type","text","placeholder","brand",1,"form-control"],[1,"col-6"],["formControlName","ProductType","type","text","placeholder","Product Type",1,"form-control"],["formControlName","Status","bindLabel","name","bindValue","id","placeholder","Status",3,"items"]],template:function(t,n){t&1&&(h(0,Ye,15,2,"ng-container",0),g(1,"async")),t&2&&m("ngIf",y(1,1,n.attributes$))},dependencies:[S,V,x,D,q,te,$,H,z,J,B,O],encapsulation:2})}}return i})();function Ze(i,p){if(i&1&&(l(0,"div",6),f(1,"app-product-card",9),r()),i&2){let e=p.$implicit;s(),m("productId",e==null?null:e.ID)("title",e==null?null:e.Name)("image",e==null?null:e.ThumbnailUrl)("description",(e==null||e.Variants==null?null:e.Variants.length)>1?(e==null||e.Variants==null?null:e.Variants.length)+" Variants":null)("imageForZoom",e==null?null:e.ImageUrl)("code",e==null||e.Variants[0]==null?null:e.Variants[0].Code)("showFooter",!1)}}function Ke(i,p){if(i&1){let e=M();N(0),l(1,"mat-checkbox",21),Ce("ngModelChange",function(n){I(e);let o=a().$implicit;return _e(o.selected,n)||(o.selected=n),F(n)}),C("ngModelChange",function(){let n=I(e).ngIf,o=a(),c=o.$implicit,W=o.$index,X=a();return F(X.onSelectChannel(c,W,n))}),r(),U()}if(i&2){let e=a().$implicit;s(),he("ngModel",e.selected)}}function Qe(i,p){if(i&1&&(l(0,"div",18),f(1,"input",22),r()),i&2){let e=a().$implicit,t=a();m("matTooltip",e.type==t.channelType.Shopify?"Cannot change category, please change category in admin.shopify.com":e.type==t.channelType.Plugo?"You can change the category after the product has been uploaded to the Plugo Dashboard.":"")}}function Xe(i,p){if(i&1){let e=M();l(0,"app-channel-category-select",23),C("selectedCategory",function(n){I(e);let o=a().$index,c=a();return F(c.onCategoryChange(o,n))}),r()}if(i&2){let e=a().$implicit,t=a();m("disabled",!e.selected||e.selected&&e.type==t.channelType.Lazada)("channelId",e.id)("channelType",e.type)("categoryId",e.categoryId)}}function et(i,p){if(i&1){let e=M();l(0,"shopee-attribute-form",27),C("attributesChanges",function(n){I(e);let o=a(2).$index,c=a();return F(c.onAttributesChange(o,n))}),r()}if(i&2){let e=a(2).$implicit;m("categoryId",e.categoryId)("channelId",e.id)("channelType",e.type)}}function tt(i,p){if(i&1){let e=M();l(0,"tiktok-attribute-form",28),C("attributesChanges",function(n){I(e);let o=a(2).$index,c=a();return F(c.onAttributesChange(o,n))}),r()}if(i&2){let e=a(2).$implicit;m("categoryId",e.categoryId)("channelId",e.id)}}function it(i,p){if(i&1){let e=M();l(0,"wooocommerce-attribute-form",28),C("attributesChanges",function(n){I(e);let o=a(2).$index,c=a();return F(c.onAttributesChange(o,n))}),r()}if(i&2){let e=a(2).$implicit;m("categoryId",e.categoryId)("channelId",e.id)}}function ot(i,p){if(i&1){let e=M();l(0,"tokopedia-attribute-form",28),C("attributesChanges",function(n){I(e);let o=a(2).$index,c=a();return F(c.onAttributesChange(o,n))}),r()}if(i&2){let e=a(2).$implicit;m("categoryId",e.categoryId)("channelId",e.id)}}function nt(i,p){if(i&1&&(l(0,"div",20)(1,"div",24),h(2,et,1,3,"shopee-attribute-form",25)(3,tt,1,2,"tiktok-attribute-form",26)(4,it,1,2,"wooocommerce-attribute-form",26)(5,ot,1,2,"tokopedia-attribute-form",26),r()()),i&2){let e,t=a().$implicit,n=a();s(2),E((e=t.type)===n.channelType.Shopee?2:e===n.channelType.Tiktok?3:e===n.channelType.WooCommerce?4:e===n.channelType.Tokopedia?5:-1)}}function rt(i,p){if(i&1){let e=M();l(0,"div",20)(1,"div",24)(2,"shopify-attribute-form",29),C("attributesChanges",function(n){I(e);let o=a().$index,c=a();return F(c.onAttributesChange(o,n))}),r()()()}if(i&2){let e=a().$implicit;s(2),m("channelId",e.id)}}function at(i,p){if(i&1&&(l(0,"div",8)(1,"div",10)(2,"div",11)(3,"div",12)(4,"div",13)(5,"div"),h(6,Ke,2,1,"ng-container",14),g(7,"async"),r(),l(8,"div"),f(9,"app-channel-logo",15),r(),l(10,"div",16)(11,"span"),u(12),r()()()(),l(13,"div",12)(14,"div",17),h(15,Qe,2,1,"div",18)(16,Xe,1,4,"app-channel-category-select",19),r()()(),h(17,nt,6,1,"div",20)(18,rt,3,1,"div",20),r()()),i&2){let e=p.$implicit,t=a();s(6),m("ngIf",y(7,8,t.defaultCategories$)),s(3),m("typeId",e.type)("showChannelName",!1),s(),m("matTooltip",e.name)("matTooltipShowDelay",2500),s(2),fe(e.name),s(3),E(e.type==t.channelType.Shopify||e.type==t.channelType.Plugo?15:16),s(2),E(e.categoryId&&t.channelType.Lazada!=e.type&&e.selected?17:t.channelType.Shopify==e.type&&e.selected?18:-1)}}var qi=(()=>{class i{constructor(){this.uploadProductService=d(oe),this.selectedProducts$=this.uploadProductService.selectedProduct$,this.channelProductUploads=this.uploadProductService.channelProductUpload,this.channelType=be,this.defaultCategories$=this.uploadProductService.getDefaultCategory().pipe(ee(1))}onCategoryChange(e,t){this.channelProductUploads.update(n=>n.map((o,c)=>(c==e&&(o.categoryId=t,o.attributes=[]),o)))}onAttributesChange(e,t){this.channelProductUploads.update(n=>n.map((o,c)=>(c==e&&(o.attributes=t),o)))}onSelectChannel(e,t,n){this.channelProductUploads.update(o=>o.map((c,W)=>{if(W==t&&e.selected){let X=this.findCategoryByChannelId(e.id,n);c.categoryId=X?.DefaultCategoryID}return W==t&&!e.selected&&(c.categoryId=null),c}))}findCategoryByChannelId(e,t){return t.find(n=>n.ID===e)}onUploadProduct(){this.uploadProductService.onUploadProduct(this.channelProductUploads())}ngOnDestroy(){this.uploadProductService.clearSelectedProduct()}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=b({type:i,selectors:[["app-product-upload"]],features:[v([Ae,Pe,ke,ie])],decls:17,vars:5,consts:[["headerTitle","Upload Product To Channel",3,"hideSearchBox","hideSearchDropdown"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click","disabled"],["aria-hidden","true",1,"fa","fa-upload"],[1,"container-fluid","mt-6"],[1,"ps-3","mt-8","pb-5","fw-medium"],[1,"row","mb-10","ps-3"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[1,"ps-3","mb-8","border-bottom","pb-5","fw-medium"],[1,"row","mb-6"],[3,"productId","title","image","description","imageForZoom","code","showFooter"],[1,"col-12"],[1,"row"],[1,"col-3"],[1,"d-flex","align-items-center"],[4,"ngIf"],[3,"typeId","showChannelName"],[2,"overflow","hidden","text-overflow","ellipsis","white-space","nowrap",3,"matTooltip","matTooltipShowDelay"],[1,"w-100"],["matTooltipPosition","above",3,"matTooltip"],[3,"disabled","channelId","channelType","categoryId"],[1,"row","my-3"],["color","primary",1,"example-margin",3,"ngModelChange","ngModel"],["disabled","","type","text","placeholder","Category Unavailable",1,"form-control","rounded-1",2,"height","35px"],[3,"selectedCategory","disabled","channelId","channelType","categoryId"],[1,"col-12","ps-11"],[3,"categoryId","channelId","channelType"],[3,"categoryId","channelId"],[3,"attributesChanges","categoryId","channelId","channelType"],[3,"attributesChanges","categoryId","channelId"],[3,"attributesChanges","channelId"]],template:function(t,n){if(t&1&&(l(0,"mainpanel",0)(1,"actions")(2,"button",1),C("click",function(){return n.onUploadProduct()}),f(3,"i",2),u(4," Upload "),r()(),l(5,"content")(6,"div",3)(7,"h3",4),u(8,"Product To Upload"),r(),l(9,"div",5),R(10,Ze,2,7,"div",6,j),g(12,"async"),r(),l(13,"h3",7),u(14,"Channel To Upload"),r(),R(15,at,19,10,"div",8,j),r()()()),t&2){let o;m("hideSearchBox",!0)("hideSearchDropdown",!0),s(2),m("disabled",((o=n.channelProductUploads())==null?null:o.length)==0),s(8),L(y(12,3,n.selectedProducts$)),s(5),L(n.channelProductUploads())}},dependencies:[S,V,x,Ee,Ie,Se,Ue,Ne,Te,Fe,Z,$,ye,xe,ve,Ve,$e,De,Oe,we,Me],encapsulation:2})}}return i})();export{qi as ProductUploadComponent};
@@ -1 +0,0 @@
1
- import{a as Le}from"./chunk-VKMFDXJJ.js";import{a as Be}from"./chunk-CATX24UZ.js";import{a as De}from"./chunk-CROPN4YC.js";import"./chunk-MHCAI6KP.js";import{a as Me}from"./chunk-3NMM37H7.js";import"./chunk-BFU7VKO3.js";import{b as Ve}from"./chunk-RMCAWPWK.js";import"./chunk-3LRWABHB.js";import"./chunk-74IXJYWO.js";import"./chunk-G47XGOST.js";import{a as L}from"./chunk-XHAXYWZ7.js";import{a as Ne,b as ke,c as Oe,d as W}from"./chunk-UDIDZKN6.js";import"./chunk-M5XGP4SG.js";import"./chunk-CIIO2CJ6.js";import"./chunk-H3J5OAIG.js";import"./chunk-AQTXFEBA.js";import{a as Fe}from"./chunk-DDV4X5WD.js";import"./chunk-SDUUFQUI.js";import"./chunk-IL5JIRWJ.js";import{a as Te}from"./chunk-SYUFPF3D.js";import"./chunk-5OHRA4AS.js";import"./chunk-3BT5DR3X.js";import"./chunk-3RK6DDJD.js";import"./chunk-J2KWRDVH.js";import"./chunk-7SVF5UPT.js";import{a as he}from"./chunk-5DIRXS7I.js";import"./chunk-CMTBBXR5.js";import{a as Ee}from"./chunk-7KG3DC5J.js";import{h as Se}from"./chunk-S5SDX7ZG.js";import"./chunk-Z3ITXK3D.js";import"./chunk-ACIMXBIC.js";import"./chunk-TGMCGROM.js";import"./chunk-V3NCYRCF.js";import"./chunk-5JVEEL2T.js";import{c as O}from"./chunk-PW42BQIY.js";import{a as fe,b as xe,c as Pe}from"./chunk-SWQXSJ7O.js";import"./chunk-AEOSNAHH.js";import{b as ge,e as Ce}from"./chunk-JXSBFTQM.js";import"./chunk-K5XRGNWG.js";import{d as we,m as ve,n as ye}from"./chunk-CLER2MX6.js";import{A as ue,b as me,h as de,m as _e}from"./chunk-6QYD6NIJ.js";import"./chunk-ATZ475FN.js";import{r as Ie,s as be}from"./chunk-YCH6HHU3.js";import"./chunk-B73M3AMU.js";import{d as re,f as ae,g as le,j as ce,m as se,n as pe}from"./chunk-M2FCTYGU.js";import{$c as f,Fc as U,G as B,Gb as Z,Gc as m,Hc as Y,Ic as y,Kc as D,Lc as M,Mb as g,Mc as N,Nc as ee,Oc as te,Pc as A,Qc as ne,Ra as X,Sc as k,Tc as ie,Yb as p,Z as R,ad as I,bd as oe,cd as j,dc as q,ea as J,ec as F,gc as T,hc as V,ic as o,jc as a,kc as P,lc as w,mc as v,oc as S,p as K,pa as $,pb as E,rb as r,tc as C,uc as s,v as H,xb as x,xc as Q,ya as _,za as u}from"./chunk-B7KTCPKC.js";import"./chunk-EU2KAMEK.js";import{a as G,b as z}from"./chunk-66YHNWRR.js";var Re=n=>[n],$e=n=>({"text-decoration-line-through":n}),Ue=n=>({"border-bottom":n}),Ae=(n,c)=>({"bg-gradient-warning":n,"border pointer cell-hover":c});function je(n,c){if(n&1){let e=S();w(0),o(1,"div")(2,"label",21),m(3,"Channel"),a(),o(4,"channel-select-options",22),N("ngModelChange",function(t){_(e);let l=s();return M(l.searchFilter.ListChannelID,t)||(l.searchFilter.ListChannelID=t),u(t)}),a()(),o(5,"div",23)(6,"label",24),m(7,"Filter by"),a(),o(8,"lib-radio-options",25),N("modelChange",function(t){_(e);let l=s();return M(l.searchFilter.filterModel,t)||(l.searchFilter.filterModel=t),u(t)}),a()(),v()}if(n&2){let e=s();r(4),p("multiple",!0),D("ngModel",e.searchFilter.ListChannelID),r(4),D("model",e.searchFilter.filterModel),p("options",e.filterTypeOptions)}}function We(n,c){if(n&1){let e=S();o(0,"button",27),C("click",function(){_(e);let t=s().ngIf,l=s();return u(l.onUpdateItems(t))}),P(1,"i",28),m(2," Update "),a()}}function Ge(n,c){if(n&1&&(w(0),o(1,"div",4),g(2,We,3,0,"button",26),a(),v()),n&2){let e=c.ngIf,i=s();r(2),p("ngIf",i.productService.hasSelectionVariant(e))}}function ze(n,c){if(n&1&&(o(0,"th",15)(1,"div",29),P(2,"img",30),o(3,"div",31),m(4),f(5,"stringLimit"),a()()()),n&2){let e=c.$implicit;r(),p("matTooltip",(e.Name==null?null:e.Name.length)>20?e.Name:""),r(),p("src",e==null?null:e.Img,E),r(2),y(" ",oe(5,3,e.Name,20)," ")}}function Ke(n,c){if(n&1){let e=S();o(0,"th")(1,"input",32),N("ngModelChange",function(t){_(e);let l=s();return M(l.checkboxState,t)||(l.checkboxState=t),u(t)}),C("ngModelChange",function(){_(e);let t=s();return u(t.onSelectAllData())}),a()()}if(n&2){let e=s();r(),D("ngModel",e.checkboxState)}}function He(n,c){n&1&&(o(0,"th",33)(1,"span"),m(2,"Expected"),a(),o(3,"span",34),m(4,"(POS)"),a()(),o(5,"th",33),m(6,"Channel"),a())}function Je(n,c){if(n&1){let e=S();o(0,"img",47),C("click",function(t){_(e);let l=s(3).$implicit,d=s(2);return u(d.onZoomImage(t,l==null?null:l.ImageUrl))}),a()}if(n&2){let e=s(3).$implicit;Q("src",e==null?null:e.ImageUrl,E)}}function Xe(n,c){n&1&&P(0,"img",48)}function Ze(n,c){if(n&1&&(o(0,"small",46),m(1),a()),n&2){let e=s(3).$implicit;r(),y("(",e==null?null:e.Category,")")}}function qe(n,c){if(n&1&&(w(0),o(1,"td",42),g(2,Je,1,1,"img",43)(3,Xe,1,0,"ng-template",null,0,j),a(),o(5,"td",44)(6,"h5",45),m(7),a(),g(8,Ze,2,1,"small",46),a(),v()),n&2){let e=U(4),i=s().$index,t=s().$implicit,l=s().ngIf;r(),p("rowSpan",t==null?null:t.Variants.length)("ngClass",k(7,Ue,i+1==l.length)),r(),p("ngIf",t==null?null:t.ImageUrl)("ngIfElse",e),r(3),p("rowSpan",t==null?null:t.Variants.length),r(2),Y(t==null?null:t.Name),r(),q(t!=null&&t.Category?8:-1)}}function Qe(n,c){if(n&1){let e=S();o(0,"td",49)(1,"input",32),N("ngModelChange",function(t){_(e);let l=s().$implicit;return M(l.selected,t)||(l.selected=t),u(t)}),a()()}if(n&2){let e=s().$implicit;r(),D("ngModel",e.selected)}}function Ye(n,c){if(n&1){let e=S();w(0),o(1,"td",51),m(2),f(3,"number"),a(),o(4,"td",52),C("click",function(){let t=_(e).$implicit,l=s(2).$implicit,d=s().$implicit,h=s(2),b=A(0);return u(h.openTableDialog(l,d,t,b))}),o(5,"div",53)(6,"div",54),m(7),f(8,"number"),a(),o(9,"a",55),C("click",function(t){return _(e),u(t==null?null:t.stopPropagation())}),P(10,"i",40),a()()(),v()}if(n&2){let e=c.$implicit;s(5);let i=A(0);r(2),y(" ",I(3,4,e.PriceExpected)," "),r(2),p("ngClass",ie(8,Ae,e.Price!=e.PriceExpected,i)),r(3),y(" ",I(8,6,e.Price)," "),r(2),p("href",e.Url,E)}}function et(n,c){n&1&&(o(0,"td",56),m(1," X "),a(),o(2,"td",56),m(3," X "),a())}function tt(n,c){if(n&1&&(w(0),g(1,Ye,11,11,"ng-container",50)(2,et,4,0,"ng-template",null,1,j),v()),n&2){let e=c.$implicit,i=U(3),t=s().$implicit,l=s(3);r(),p("ngIf",l.getItemFromChannel(t,e.ID))("ngIfElse",i)}}function nt(n,c){if(n&1&&(o(0,"tr"),g(1,qe,9,9,"ng-container",3),o(2,"td",35),m(3),a(),o(4,"td",36)(5,"div",37)(6,"div",38),m(7),a(),o(8,"div",31)(9,"a",39),P(10,"i",40),a()()()(),g(11,Qe,2,1,"ng-template",19)(12,tt,4,2,"ng-container",41),a()),n&2){let e=c.$implicit,i=c.$index,t=s(3);r(),p("ngIf",i==0),r(2),y(" ",e==null?null:e.Model," "),r(),p("matTooltip",e.Discontinued?t.discontinuedVariantMsg:""),r(2),p("ngClass",k(8,$e,e.Discontinued)),r(),y(" ",e==null?null:e.Code," "),r(2),p("href",t.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(e==null?null:e.ID),E),r(2),p("ngxPermissionsOnly",k(10,Re,t.rolePriceEdit)),r(),p("ngForOf",t.channels())}}function it(n,c){if(n&1&&(o(0,"tbody"),T(1,nt,13,12,"tr",null,F),a()),n&2){let e=c.$implicit;r(),V(e.Variants)}}function ot(n,c){if(n&1&&(w(0),T(1,it,3,0,"tbody",null,F),v()),n&2){let e=c.ngIf;r(),V(e)}}var Ut=(()=>{class n{constructor(e,i,t,l,d,h,b){this.http=e,this.toastr=i,this.dialog=t,this.productService=l,this.authService=d,this.biggerPictureService=h,this.paginationService=b,this.infinitePagination=$(W),this.permissionService=$(fe),this.searchFilter=new Ee,this.checkboxState=!1,this.rolePriceEdit=he.PriceUpdate,this.hasRolePriceEdit=K(this.permissionService.hasPermission(this.rolePriceEdit)),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.channels=X([]),this.filterTypeOptions=[{Key:L.ALL,Value:"All"},{Key:L.DIFFERENCE,Value:"Difference"}],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(),this.initChannelTable()}initChannelTable(){let e=this.searchFilter.ListChannelID,i=[];O.IsEmpty(e)||e?.length==0?i=this.channelOptions:i=this.channelOptions.filter(t=>e.findIndex(l=>l==t.ID)>-1),this.channels.update(()=>i)}initPagination(){this.infinitePagination.fetchDataEndpoint="Price/GetOutletPrice",this.infinitePagination.fethRowCountEndpoint=this.rowCountAPI,this.initProduct(),this.initPageLoader()}initProduct(){this.data$=this.infinitePagination.data$.pipe(R(1))}initPageLoader(){this.loader$=this.http.post("/api/PriceLoader/LoadMultiple",{}).pipe(J(e=>{this.searchFilter=e.Filter,this.searchFilter.filterModel=L.ALL,this.infinitePagination.reloadPagination(this.searchFilter)}),R(1))}onSelectAllData(){this.data$=this.data$.pipe(H(e=>(e.map(i=>(i.Variants&&(i.Variants=i.Variants.map(t=>(t.selected=this.checkboxState,t))),i)),e)))}onFilter(e){this.searchFilter.text=e;let i=z(G({},this.searchFilter),{text:e,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount});this.initChannelTable(),this.infinitePagination.reloadPagination(i)}updatePrice(e){let i=this.productService.selectedVariantProduct(e);if(i.length>0){let t=i.map(h=>h.ID),d={ListChannelID:this.channelOptions.filter(h=>h.selected).map(h=>h.ID),ListID:t};this.http.post("/api/Price/UpdateChannelOutletPrice",d).subscribe({next:h=>{this.resetSelectedChannel(),this.onFilter(),this.toastr.success("Successfully updated "+d.ListID.length+" items in "+d.ListChannelID.length+" channels","Success")},error:h=>{this.resetSelectedChannel()}})}}resetSelectedChannel(){this.channelOptions=this.channelOptions.map(e=>(e.selected=!1,e))}getItemFromChannel(e,i){return e.Channel.find(t=>t.ChannelID==i)}onUpdateItems(e){let i=this.productService.selectedVariantProduct(e);this.dialog.open(Me,{data:{title:"Updating Price",selectedItems:i,channels:this.channelOptions},width:"400px"}).afterClosed().pipe(B(t=>O.IsNotEmpty(t))).subscribe(t=>{this.channelOptions=t,this.updatePrice(e)})}openTableDialog(e,i,t,l){if(l){let d=JSON.parse(JSON.stringify(e));this.dialog.open(Ne,{data:{Name:i.Name,Variant:d,ChannelID:t?.ChannelID,Table:"price",ChannelItemID:t?.ChannelItemID}}).afterClosed().pipe(B(b=>O.IsNotEmpty(b))).subscribe(b=>{this.updateProductPrice(b,t)})}}updateProductPrice(e,i){let t={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",t).subscribe(l=>{i.Price=t.Price;let d=this.productService.findChannelById(t.ID,this.channelOptions);this.toastr.success(`Successfully updated ${e.ItemName} (${e.VarName}) inventory in ${d.Name} to ${t.Price}`,"Success")})}openExportDialog(){this.dialog.open(Ve,{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(e,i){this.biggerPictureService.openBiggerPicture(e,i)}static{this.\u0275fac=function(i){return new(i||n)(x(Ce),x(ge),x(we),x(Fe),x(Se),x(Te),x(De))}}static{this.\u0275cmp=Z({type:n,selectors:[["app-custom-channel-price"]],features:[ne([W])],decls:40,vars:26,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"],[1,"fw-bold","mb-2"],[3,"ngModelChange","multiple","ngModel"],[1,"mt-5",2,"height","46px"],[1,"fw-bold","mb-2","d-block"],["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-solid","fa-arrow-up-right-from-square","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",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(i,t){if(i&1){let l=S();ee(0),f(1,"async"),o(2,"mainpanel",2),C("onSubmit",function(h){return _(l),u(t.onFilter(h))}),o(3,"filters"),g(4,je,9,4,"ng-container",3),f(5,"async"),a(),o(6,"actions")(7,"div",4),g(8,Ge,3,1,"ng-container",3),f(9,"async"),o(10,"button",5),C("click",function(){return _(l),u(t.openExportDialog())}),P(11,"i",6),o(12,"span"),m(13,"Export"),a()()()(),o(14,"content")(15,"div",7)(16,"div",8)(17,"div",9)(18,"div",10)(19,"table",11)(20,"thead",12)(21,"tr",13),P(22,"th",14),T(23,ze,6,6,"th",15,F),a(),o(25,"tr")(26,"th",16)(27,"span"),m(28," Product "),a()(),o(29,"th",17),m(30,"Variant"),a(),o(31,"th",18),m(32,"SKU"),a(),g(33,Ke,2,1,"ng-template",19),T(34,He,7,0,null,null,F),a()(),g(36,ot,3,0,"ng-container",3),f(37,"async"),a(),o(38,"infinite-paginator",20),f(39,"async"),C("onNextPage",function(){return _(l),u(t.infinitePagination.onNextPage(t.searchFilter))})("onLastPage",function(){return _(l),u(t.infinitePagination.onLastPage(t.searchFilter))})("onGetRowCount",function(){return _(l),u(t.infinitePagination.getRowCount(t.searchFilter))}),a()()()()()()()}i&2&&(te(I(1,13,t.hasRolePriceEdit)),r(2),p("hideSearchBox",!1)("hideSearchDropdown",!1)("textButton","Search"),r(2),p("ngIf",I(5,16,t.loader$)),r(4),p("ngIf",I(9,18,t.data$)),r(15),V(t.channels()),r(10),p("ngxPermissionsOnly",k(24,Re,t.rolePriceEdit)),r(),V(t.channels()),r(2),p("ngIf",I(37,20,t.data$)),r(2),p("totalData",t.infinitePagination.totalData())("hideCount",t.infinitePagination.hideCount())("rowCount",I(39,22,t.infinitePagination.totalRowCount$))("pageNumber",t.infinitePagination.pageNumber())("disableNextButton",t.infinitePagination.disableNextButton())("goToLastPage",t.infinitePagination.isLastPage()))},dependencies:[pe,re,ae,le,ce,se,ye,ve,ue,me,de,_e,Oe,Le,be,Ie,ke,Pe,xe,Be],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}"]})}}return n})();export{Ut as CustomChannelPriceComponent};
@@ -1 +0,0 @@
1
- import{a as X}from"./chunk-6LN62T32.js";import{a as Q}from"./chunk-3NMM37H7.js";import"./chunk-BFU7VKO3.js";import{b as K}from"./chunk-RMCAWPWK.js";import"./chunk-3LRWABHB.js";import"./chunk-74IXJYWO.js";import"./chunk-G47XGOST.js";import{c as Y,d as D}from"./chunk-UDIDZKN6.js";import"./chunk-M5XGP4SG.js";import"./chunk-CIIO2CJ6.js";import"./chunk-H3J5OAIG.js";import"./chunk-AQTXFEBA.js";import{a as J}from"./chunk-DDV4X5WD.js";import"./chunk-SDUUFQUI.js";import"./chunk-IL5JIRWJ.js";import"./chunk-SYUFPF3D.js";import"./chunk-5OHRA4AS.js";import"./chunk-3BT5DR3X.js";import"./chunk-3RK6DDJD.js";import"./chunk-J2KWRDVH.js";import"./chunk-7SVF5UPT.js";import"./chunk-5DIRXS7I.js";import"./chunk-CMTBBXR5.js";import{h as $}from"./chunk-S5SDX7ZG.js";import"./chunk-Z3ITXK3D.js";import"./chunk-ACIMXBIC.js";import"./chunk-TGMCGROM.js";import"./chunk-V3NCYRCF.js";import"./chunk-PW42BQIY.js";import"./chunk-SWQXSJ7O.js";import"./chunk-AEOSNAHH.js";import{b as G,e as W}from"./chunk-JXSBFTQM.js";import"./chunk-K5XRGNWG.js";import{d as H,m as q,n as z}from"./chunk-CLER2MX6.js";import{A as k,c as B,h as O,m as U,o as j}from"./chunk-6QYD6NIJ.js";import"./chunk-ATZ475FN.js";import"./chunk-YCH6HHU3.js";import"./chunk-B73M3AMU.js";import{g as R,j as L,m as x,n as A}from"./chunk-M2FCTYGU.js";import{$c as _,G as V,Gb as N,Gc as g,Kc as S,Lc as v,Mb as f,Mc as y,Qc as E,Yb as u,Z as T,ad as C,ea as F,ic as a,jc as p,kc as I,oc as b,pa as M,rb as d,tc as P,uc as o,xb as h,ya as s,za as l}from"./chunk-B7KTCPKC.js";import"./chunk-EU2KAMEK.js";import"./chunk-66YHNWRR.js";function Z(r,w){if(r&1){let e=b();a(0,"button",15),P("click",function(){s(e);let t=o().ngIf,n=o(2);return l(n.onUpdateItems(t))}),I(1,"i",16),g(2," Update "),p()}}function ee(r,w){if(r&1&&(a(0,"div"),f(1,Z,3,0,"button",14),p()),r&2){let e=w.ngIf,i=o(2);d(),u("ngIf",i.productService.hasSelectionVariant(e))}}function te(r,w){if(r&1){let e=b();a(0,"mainpanel",1),P("onSubmit",function(t){s(e);let n=o();return l(n.onSearch(t))}),a(1,"actions")(2,"div",2),f(3,ee,2,1,"div",3),_(4,"async"),a(5,"button",4),P("click",function(){s(e);let t=o();return l(t.openExportDialog())}),I(6,"i",5),a(7,"span"),g(8,"Export"),p()()()(),a(9,"filters")(10,"div")(11,"label",6),g(12,"Page Number"),p(),a(13,"input",7),y("ngModelChange",function(t){s(e);let n=o();return v(n.searchFilter.PageNumber,t)||(n.searchFilter.PageNumber=t),l(t)}),p()(),a(14,"div",8)(15,"label",6),g(16,"Page Size"),p(),a(17,"input",7),y("ngModelChange",function(t){s(e);let n=o();return v(n.searchFilter.RowCount,t)||(n.searchFilter.RowCount=t),l(t)}),p()()(),a(18,"content")(19,"div",9)(20,"div",10)(21,"div",11)(22,"app-table",12),_(23,"async"),P("onToggle",function(t){s(e);let n=o();return l(n.onShowDifferencePrice(t))})("onSubmit",function(t){s(e);let n=o();return l(n.updatePriceByVariant(t))}),p(),a(24,"infinite-paginator",13),_(25,"async"),P("onNextPage",function(){s(e);let t=o();return l(t.infinitePagination.onNextPage(t.searchFilter))})("onLastPage",function(){s(e);let t=o();return l(t.infinitePagination.onLastPage(t.searchFilter))})("onGetRowCount",function(){s(e);let t=o();return l(t.infinitePagination.getRowCount(t.searchFilter))}),p()()()()()()}if(r&2){let e=o();u("textButton","Search"),d(3),u("ngIf",C(4,14,e.data$)),d(10),S("ngModel",e.searchFilter.PageNumber),d(4),S("ngModel",e.searchFilter.RowCount),d(5),u("showProductToggle",!0)("data",C(23,16,e.data$))("channel",e.channelOptions)("hiddenIPOSInventory",!1),d(2),u("totalData",e.infinitePagination.totalData())("hideCount",e.infinitePagination.hideCount())("rowCount",C(25,18,e.infinitePagination.totalRowCount$))("pageNumber",e.infinitePagination.pageNumber())("disableNextButton",e.infinitePagination.disableNextButton())("goToLastPage",e.infinitePagination.isLastPage())}}var be=(()=>{class r{constructor(e,i,t,n,m,c){this.http=e,this.toastr=i,this.dialog=t,this.productService=n,this.authService=m,this.decimalPipe=c,this.infinitePagination=M(D),this.loaderAPI="PriceLoader/LoadMultiple",this.getDataAPI="Price/GetMultipleChannelComparison",this.rowCountAPI="Inventory/GetMultipleChannelComparisonRowCount",this.data$=this.infinitePagination.data$.pipe(T()),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.infinitePagination.fetchDataEndpoint=this.getDataAPI,this.infinitePagination.fethRowCountEndpoint=this.rowCountAPI,this.loader$=this.http.post(`/api/${this.loaderAPI}`).pipe(F(e=>{e.Filter={PageNumber:e.Filter.PageNumber,RowCount:e.Filter.RowCount,filterModel:1},this.searchFilter=e.Filter,this.infinitePagination.reloadPagination(this.searchFilter)}))}onShowDifferencePrice(e){this.searchFilter.filterModel=1,e&&(this.searchFilter.filterModel=3),this.infinitePagination.reloadPagination(this.searchFilter)}onSearch(e){this.searchFilter.text=e,this.infinitePagination.reloadPagination(this.searchFilter)}updatePrice(e){let i=this.productService.selectedVariantProduct(e);if(i.length>0){let n=i.map(c=>({ID:c.ID,Code:c.Code,Price:c.UnitPrice}));var t=this.channelOptions.filter(c=>c.selected).map(c=>c.ID);let m={ListChannelID:t,ListPrice:n};this.http.post("/api/Price/UpdateChannel",m).subscribe(c=>{this.infinitePagination.reloadPagination(this.searchFilter),this.toastr.success("Successfully updated "+m.ListPrice.length+" items in "+m.ListChannelID.length+" channels","Success")})}}updatePriceByVariant(e){let i={ID:e.ChannelID,ChannelItemID:e.ChannelItemID,ChannelVariantID:e.ChannelVariationID,Price:e.Price-0,VariantID:e.ID};this.http.post("/api/Price/UpdatePriceByID",i).subscribe(t=>{let n=this.productService.findChannelById(i.ID,this.channelOptions),m=i.Price?this.decimalPipe.transform(i.Price):i.Price;this.toastr.success("Successfully updated "+e.ItemName+"("+e.VarName+") price in "+n.Name+" to "+m,"Success"),this.infinitePagination.reloadPagination(this.searchFilter)})}onUpdateItems(e){let i=this.productService.selectedVariantProduct(e);this.dialog.open(Q,{data:{title:"Updating Price",selectedItems:i,channels:this.channelOptions},width:"400px"}).afterClosed().pipe(V(t=>t!==void 0)).subscribe(t=>{this.channelOptions=t,this.updatePrice(e)})}openExportDialog(){this.dialog.open(K,{data:{title:"Export Multi Channel Comparison",pageNumber:this.searchFilter.PageNumber,rowCount:this.searchFilter.RowCount,filterExport:this.searchFilter,getRowCountApi:this.rowCountAPI,exportApi:"price/GetExportMultipleChannelComparison"}}).afterClosed().subscribe()}static{this.\u0275fac=function(i){return new(i||r)(h(W),h(G),h(H),h(J),h($),h(x))}}static{this.\u0275cmp=N({type:r,selectors:[["app-price-pos-channel"]],features:[E([D,x])],decls:2,vars:3,consts:[["headerTitle","Price Comparison",3,"textButton","onSubmit",4,"ngIf"],["headerTitle","Price Comparison",3,"onSubmit","textButton"],[1,"d-flex"],[4,"ngIf"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"fw-bold"],["type","number",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"mt-5"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],["productToggleTitle","FILTER DIFFERENT PRICE","table","price",3,"onToggle","onSubmit","showProductToggle","data","channel","hiddenIPOSInventory"],[3,"onNextPage","onLastPage","onGetRowCount","totalData","hideCount","rowCount","pageNumber","disableNextButton","goToLastPage"],["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"]],template:function(i,t){i&1&&(f(0,te,26,20,"mainpanel",0),_(1,"async")),i&2&&u("ngIf",C(1,1,t.loader$))},dependencies:[A,R,L,k,B,j,O,U,Y,z,q,X],styles:[".no-bullet[_ngcontent-%COMP%]{list-style-type:none}"]})}}return r})();export{be as PricePosChannelComponent};
@@ -1 +0,0 @@
1
- import{a as he}from"./chunk-6LN62T32.js";import{a as pe}from"./chunk-3NMM37H7.js";import"./chunk-BFU7VKO3.js";import{a as de}from"./chunk-SRVGUGY2.js";import{a as D}from"./chunk-XHAXYWZ7.js";import{c as me,d as R}from"./chunk-UDIDZKN6.js";import"./chunk-M5XGP4SG.js";import"./chunk-CIIO2CJ6.js";import"./chunk-H3J5OAIG.js";import"./chunk-AQTXFEBA.js";import"./chunk-OC2FBL33.js";import"./chunk-NS46QSCM.js";import{a as ce}from"./chunk-DDV4X5WD.js";import"./chunk-SDUUFQUI.js";import"./chunk-IL5JIRWJ.js";import"./chunk-SYUFPF3D.js";import"./chunk-5OHRA4AS.js";import"./chunk-3BT5DR3X.js";import"./chunk-EH6HWI3G.js";import"./chunk-E3ROEHBW.js";import"./chunk-OLOIQI4D.js";import"./chunk-IA6KOBDJ.js";import"./chunk-RECNBAEB.js";import"./chunk-SN4AOGQK.js";import"./chunk-SB7NWPDS.js";import"./chunk-AYPY47VM.js";import"./chunk-SM3P57SO.js";import"./chunk-5KS4WK6H.js";import"./chunk-3RK6DDJD.js";import"./chunk-J2KWRDVH.js";import"./chunk-7SVF5UPT.js";import{a as ee}from"./chunk-5DIRXS7I.js";import"./chunk-OZ7LWNOK.js";import"./chunk-ECRWEMEV.js";import"./chunk-LZCEM2PC.js";import"./chunk-CMTBBXR5.js";import{h as w}from"./chunk-S5SDX7ZG.js";import"./chunk-Z3ITXK3D.js";import"./chunk-ACIMXBIC.js";import"./chunk-TGMCGROM.js";import"./chunk-V3NCYRCF.js";import{c as C}from"./chunk-PW42BQIY.js";import{b as ie,c as ae}from"./chunk-SWQXSJ7O.js";import"./chunk-AEOSNAHH.js";import{b as te,e as ne}from"./chunk-JXSBFTQM.js";import"./chunk-K5XRGNWG.js";import{d as oe,l as re,m as le,n as se}from"./chunk-CLER2MX6.js";import{A as Z,c as K,h as q,m as X,o as Y}from"./chunk-6QYD6NIJ.js";import"./chunk-ATZ475FN.js";import"./chunk-YCH6HHU3.js";import"./chunk-B73M3AMU.js";import{g as $,j as Q,n as J}from"./chunk-M2FCTYGU.js";import{$c as I,G as U,Gb as A,Gc as v,Kc as T,Lc as E,Mb as u,Mc as x,Qc as H,Ra as M,Sc as z,Yb as h,ad as y,ea as k,ic as s,ja as j,jc as p,kc as G,lc as N,mc as F,nc as W,oc as L,pa as S,rb as c,tc as g,uc as m,xb as d,ya as b,za as P}from"./chunk-B7KTCPKC.js";import"./chunk-EU2KAMEK.js";import{a as V,b as B}from"./chunk-66YHNWRR.js";var O=(()=>{class o{constructor(){this.authService=S(w),this.channelOptions=this.authService.getChannels()}filterSelectedChannels(t,i){let e=Object.assign([],this.channelOptions),n=[],a;return t.forEach(r=>{a=e.find(l=>l.ID==r?.parent?.id),a&&(a=B(V({},a),{Name:`${r?.parent?.label} - ${r?.label}`,LocationID:r?.id}),n.push(a))}),i.forEach(r=>{a=e.find(l=>l.ID==r.id),a&&n.push(a)}),n}generateFilterLocation(t,i){let e=[],n=[],a=[];return t.length>0?(e=t.map(r=>r.id),n=t.filter(r=>C.IsNotEmpty(r?.parent?.id)).map(r=>r?.parent?.id).filter((r,l,_)=>_.indexOf(r)===l)):(e=[],n=[]),a=i.map(r=>r.id),a=a.concat(n).filter((r,l,_)=>_.indexOf(r)===l),{locationIds:e,channelIds:a}}static{this.\u0275fac=function(i){return new(i||o)}}static{this.\u0275prov=j({token:o,factory:o.\u0275fac})}}return o})();var ge=o=>[o];function Ce(o,f){if(o&1){let t=L();s(0,"button",16),g("click",function(){b(t);let e=m(2).ngIf,n=m();return P(n.onUpdateItems(e))}),G(1,"i",17),v(2," Update "),p()}}function fe(o,f){if(o&1&&(N(0),u(1,Ce,3,0,"button",15),F()),o&2){let t=m().ngIf,i=m();c(),h("ngIf",i.productService.hasSelectionVariant(t))}}function _e(o,f){if(o&1&&(s(0,"actions")(1,"div",13),u(2,fe,2,1,"ng-container",14),p()()),o&2){let t=m();c(2),h("ngxPermissionsOnly",z(1,ge,t.inventoryUpdateRole))}}function Se(o,f){o&1&&W(0)}function ve(o,f){if(o&1){let t=L();N(0),s(1,"app-table",18),g("onToggle",function(e){b(t);let n=m();return P(n.onShowDifferenceStock(e))})("onSubmit",function(e){b(t);let n=m();return P(n.updateStockByVariant(e))}),p(),F()}if(o&2){let t=f.ngIf,i=m();c(),h("data",t)("channel",i.channels())("showProductToggle",!0)("hiddenIPOSInventory",i.searchFilter.HiddenIPOSInventory)}}var et=(()=>{class o{constructor(t,i,e,n,a,r){this.http=t,this.toastr=i,this.dialog=e,this.productService=n,this.authService=a,this.mainPanelService=r,this.paginationService=S(R),this.multiChannelService=S(O),this.searchFilter={PageNumber:1,RowCount:100},this.loaderEndpoint="InventoryLoader/GetMultipleInventoryComparison",this.dataEndpoint="Inventory/GetMultipleChannelComparison",this.allDataCountEndpoint="Inventory/GetMultipleChannelComparisonRowCount",this.selectedLocations=M([]),this.selectedChannels=M([]),this.channels=M([]),this.inventoryUpdateRole=ee.InventoryUpdate,this.pageData={Title:"Inventory",Nav:[{Title:"Inventory Cache",Url:"/menu/inventory/pos",Active:!0},{Title:"Inventory Realtime",Url:"/menu/inventory/realtime",Active:!1}]},this.channelOptions=this.authService.getChannels()}ngOnInit(){this.initPageLoader()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.dataEndpoint,this.paginationService.fethRowCountEndpoint=this.allDataCountEndpoint,this.loader$=this.http.post(`/API/${this.loaderEndpoint}`,{}).pipe(k(t=>{t.Filter={PageNumber:t.Filter.PageNumber,filterModel:D.ALL,RowCount:t.Filter.PageSize,HiddenIPOSInventory:t.Filter.HiddenIPOSInventory},this.searchFilter=t.Filter,this.mainPanelService.openModalFilter()}))}onChannelChange(t=[]){let i=t.filter(n=>C.isValidGUID(n.id)==!1),e=t.filter(n=>C.isValidGUID(n.id));this.selectedLocations.set(i),this.selectedChannels.set(e)}onSearch(t){let i=this.multiChannelService.filterSelectedChannels(this.selectedLocations(),this.selectedChannels());this.channels.set(i);let e=this.multiChannelService.generateFilterLocation(this.selectedLocations(),this.selectedChannels());this.searchFilter.ListChannelID=e.channelIds,this.searchFilter.ListLocationID=e.locationIds,this.searchFilter.text=t,this.paginationService.reloadPagination(this.searchFilter)}updateStock(t,i){let e=this.productService.selectedVariantProduct(t);if(e.length>0){let n=[];e.forEach(l=>{l.Channel?.forEach(_=>{n.push({ID:l.ID,Code:l.Code,Inventory:l.Inventory,LocationID:_.LocationID})})});let r={ListChannelID:i.filter(l=>l.selected).map(l=>l.ID),List:n};this.http.post("/api/Inventory/UpdateChannel",r).subscribe(l=>{this.paginationService.reloadPagination(this.searchFilter),this.toastr.success("Successfully updated "+r.List.length+" variants in "+r.ListChannelID.length+" channels","Success")})}}updateStockByVariant(t){let i={ID:t.ChannelID,ChannelItemID:t.ChannelItemID,ChannelVariantID:t.ChannelVariationID,NewQuantity:parseFloat(t.Inventory),VariantID:t.ID,SKU:t.Sku,LocationID:t.LocationID};this.http.post("/api/Inventory/UpdateQuantityByItem",i).subscribe(e=>{this.paginationService.reloadPagination(this.searchFilter);let n=this.productService.findChannelById(i.ID,this.channelOptions);this.toastr.success("Successfully updated "+t.ItemName+"("+t.VarName+") inventory in "+n.Name+" to "+i.NewQuantity,"Success")})}onShowDifferenceStock(t){t?this.searchFilter.filterModel=D.DIFFERENCE:this.searchFilter.filterModel=D.ALL,this.paginationService.reloadPagination(this.searchFilter)}onUpdateItems(t){let i=this.productService.selectedVariantProduct(t),e=this.channelOptions.filter(n=>this.channels()?.find(a=>a.ID===n.ID));this.dialog.open(pe,{data:{selectedItems:i,channels:JSON.parse(JSON.stringify(e))},width:"400px"}).afterClosed().pipe(U(n=>C.IsNotEmpty(n))).subscribe(n=>{this.updateStock(t,n)})}static{this.\u0275fac=function(i){return new(i||o)(d(ne),d(te),d(oe),d(ce),d(w),d(re))}}static{this.\u0275cmp=A({type:o,selectors:[["app-multi-channel-comparison"]],features:[H([R,O])],decls:26,vars:22,consts:[["headerTitle","Inventory Comparison","textButton","Search",3,"onSubmit","pageData","hideSearchBox"],[4,"ngIf"],["for","selectChannel",1,"fw-bold","mb-3"],["id","selectChannel",3,"onChannelChange","multiple"],[1,"mt-5"],["for","PageNumber",1,"fw-bold"],["type","number","id","PageNumber","placeholder","PageNumber","name","PageNumber","data-toggle","tooltip","matTooltip","Page Number",1,"form-control","mt-2",3,"ngModelChange","ngModel"],["for","RowCount",1,"fw-bold"],["type","number","id","RowCount","placeholder","Page Size","name","RowCount","data-toggle","tooltip","matTooltip","Page Size",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[3,"onNextPage","onLastPage","onGetRowCount","totalData","hideCount","rowCount","pageNumber","disableNextButton","goToLastPage"],[1,"d-flex"],[4,"ngxPermissionsOnly"],["type","button","class","btn btn-success shadow-sm rounded me-3",3,"click",4,"ngIf"],["type","button",1,"btn","btn-success","shadow-sm","rounded","me-3",3,"click"],[1,"fas","fa-chevron-circle-up"],["table","inventory",3,"onToggle","onSubmit","data","channel","showProductToggle","hiddenIPOSInventory"]],template:function(i,e){i&1&&(s(0,"mainpanel",0),g("onSubmit",function(a){return e.onSearch(a)}),u(1,_e,3,3,"actions",1),I(2,"async"),s(3,"filters"),u(4,Se,1,0,"ng-container",1),I(5,"async"),s(6,"div")(7,"label",2),v(8,"Channel"),p(),s(9,"multiwarehouse-tree-select",3),g("onChannelChange",function(a){return e.onChannelChange(a)}),p()(),s(10,"div",4)(11,"label",5),v(12,"PageNumber"),p(),s(13,"input",6),x("ngModelChange",function(a){return E(e.searchFilter.PageNumber,a)||(e.searchFilter.PageNumber=a),a}),p()(),s(14,"div",4)(15,"label",7),v(16,"Page Size"),p(),s(17,"input",8),x("ngModelChange",function(a){return E(e.searchFilter.RowCount,a)||(e.searchFilter.RowCount=a),a}),p()()(),s(18,"content")(19,"div",9)(20,"div",10)(21,"div",11),u(22,ve,2,4,"ng-container",1),I(23,"async"),s(24,"infinite-paginator",12),I(25,"async"),g("onNextPage",function(){return e.paginationService.onNextPage(e.searchFilter)})("onLastPage",function(){return e.paginationService.onLastPage(e.searchFilter)})("onGetRowCount",function(){return e.paginationService.getRowCount(e.searchFilter)}),p()()()()()()),i&2&&(h("pageData",e.pageData)("hideSearchBox",!1),c(),h("ngIf",y(2,14,e.paginationService.data$)),c(3),h("ngIf",y(5,16,e.loader$)),c(5),h("multiple",!0),c(4),T("ngModel",e.searchFilter.PageNumber),c(4),T("ngModel",e.searchFilter.RowCount),c(5),h("ngIf",y(23,18,e.paginationService.data$)),c(2),h("totalData",e.paginationService.totalData())("hideCount",e.paginationService.hideCount())("rowCount",y(25,20,e.paginationService.totalRowCount$))("pageNumber",e.paginationService.pageNumber())("disableNextButton",e.paginationService.disableNextButton())("goToLastPage",e.paginationService.isLastPage()))},dependencies:[J,$,Q,se,le,he,Z,K,Y,q,X,me,de,ae,ie],styles:[".no-bullet[_ngcontent-%COMP%]{list-style-type:none}"]})}}return o})();export{et as MultiChannelComparison};
@@ -1 +0,0 @@
1
- import{g as k,m as N,n as T}from"./chunk-M2FCTYGU.js";import{$c as c,Gb as b,Gc as m,Hc as v,Jc as P,Ka as o,Mb as C,Yb as s,ad as d,ic as a,jc as r,kc as u,oc as _,rb as n,tc as p,uc as g,ya as f,za as h}from"./chunk-B7KTCPKC.js";function S(t,w){if(t&1){let i=_();a(0,"span",10),p("click",function(){f(i);let e=g();return e.getTotal(),h(e.hasClicked=!0)}),a(1,"i",11),m(2,"?"),r()()}}function x(t,w){if(t&1&&(a(0,"span"),m(1),c(2,"number"),r()),t&2){let i=g();n(),v(d(2,1,i.paginationTotal))}}var j=(()=>{class t{constructor(){this.get=new o,this.change=new o,this.next=new o,this.previous=new o,this.total=new o,this.hasClicked=!1}changePage(i){this.filter.PageNumber=i.pageIndex+1,this.change.emit(this.filter)}getTotal(){this.total.emit()}PreviousPage(){this.previous.emit()}NextPage(){this.next.emit()}static{this.\u0275fac=function(l){return new(l||t)}}static{this.\u0275cmp=b({type:t,selectors:[["app-mat-paginator-no-count"]],inputs:{filter:"filter",paginationTotal:"paginationTotal",totaldata:"totaldata",hasClicked:"hasClicked"},outputs:{get:"get",change:"change",next:"next",previous:"previous",total:"total"},decls:13,vars:10,consts:[[1,"d-flex","justify-content-end","mt-5"],[1,"d-sm-block","collapse","mt-3","me-5"],[1,"text-dark","hidden-xxs"],["style","cursor:pointer",3,"click",4,"ngIf"],[4,"ngIf"],[1,"btn-group"],["role","button",1,"btn","btn-outline-secondary","btn-sm","me-3","border-0",3,"click","disabled"],[1,"fa-solid","fa-chevron-left"],["role","button",1,"btn","btn-outline-secondary","btn-sm","border-0",3,"click","disabled"],[1,"fa-solid","fa-chevron-right"],[2,"cursor","pointer",3,"click"],["title","Retreive rows count",1,"border","p-3"]],template:function(l,e){l&1&&(a(0,"div",0)(1,"div",1)(2,"div",2),m(3),c(4,"number"),c(5,"number"),C(6,S,3,0,"span",3)(7,x,3,3,"span",4),r()(),a(8,"div",5)(9,"button",6),p("click",function(){return e.PreviousPage()}),u(10,"i",7),r(),a(11,"button",8),p("click",function(){return e.NextPage()}),u(12,"i",9),r()()()),l&2&&(n(3),P(" Showing ",d(4,6,e.filter.PageSize*(e.filter.PageNumber-1)+1)," - ",d(5,8,e.filter.PageSize*(e.filter.PageNumber-1)+e.totaldata)," of "),n(3),s("ngIf",!e.hasClicked),n(),s("ngIf",e.hasClicked),n(2),s("disabled",e.filter.PageNumber==1),n(2),s("disabled",e.filter.PageSize*(e.filter.PageNumber-1)+e.totaldata==e.paginationTotal||e.totaldata<e.filter.PageSize))},dependencies:[T,k,N],encapsulation:2})}}return t})();export{j as a};