marketplacepos 3.22.1 → 3.22.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/Marketplace/{chunk-OOK5GT4H.js → chunk-2EQSQQSG.js} +1 -1
  2. package/Marketplace/{chunk-O7DZGYE7.js → chunk-37V5CJJ5.js} +1 -1
  3. package/Marketplace/{chunk-Z7GKHFMV.js → chunk-52SSIH5R.js} +1 -1
  4. package/Marketplace/{chunk-HHK72C4S.js → chunk-57D743TM.js} +1 -1
  5. package/Marketplace/{chunk-SE55BPZD.js → chunk-7244E2TD.js} +1 -1
  6. package/Marketplace/{chunk-4H2AACHZ.js → chunk-CM7FKNYB.js} +1 -1
  7. package/Marketplace/{chunk-5BHAOLXD.js → chunk-CYIQCMZY.js} +1 -1
  8. package/Marketplace/{chunk-NONK6EKG.js → chunk-DWXQR4WL.js} +1 -1
  9. package/Marketplace/{chunk-HK66WK22.js → chunk-EMO3QL6Q.js} +1 -1
  10. package/Marketplace/{chunk-YOCYRT76.js → chunk-F2YSYX6S.js} +1 -1
  11. package/Marketplace/{chunk-SDII7XXL.js → chunk-F5WRNHLB.js} +1 -1
  12. package/Marketplace/{chunk-EBYNFVMV.js → chunk-FMK7E67O.js} +1 -1
  13. package/Marketplace/{chunk-5EC2PEVE.js → chunk-GCMMLBGS.js} +1 -1
  14. package/Marketplace/{chunk-IH22G3XP.js → chunk-KOPHQT52.js} +1 -1
  15. package/Marketplace/{chunk-TKQTS6W7.js → chunk-LERYKH6W.js} +1 -1
  16. package/Marketplace/{chunk-4W3VEO3E.js → chunk-LSXEWTLP.js} +1 -1
  17. package/Marketplace/{chunk-YGCOL7HH.js → chunk-LZSQNKJV.js} +1 -1
  18. package/Marketplace/{chunk-JQ2K6T44.js → chunk-MGJYDGNK.js} +1 -1
  19. package/Marketplace/{chunk-A35Y7HOJ.js → chunk-N42YDQZA.js} +1 -1
  20. package/Marketplace/{chunk-QRYPBXV2.js → chunk-NPDBUADH.js} +1 -1
  21. package/Marketplace/{chunk-SQDFIZMW.js → chunk-O53NO6NZ.js} +1 -1
  22. package/Marketplace/{chunk-33CGFKGR.js → chunk-OOUAVE3Y.js} +1 -1
  23. package/Marketplace/{chunk-FYZFHN47.js → chunk-Q7IOXBZX.js} +1 -1
  24. package/Marketplace/{chunk-MXMA4SED.js → chunk-RZB553M3.js} +1 -1
  25. package/Marketplace/{chunk-RVV4RI3V.js → chunk-S2I5R6LZ.js} +1 -1
  26. package/Marketplace/{chunk-5W6WPVQG.js → chunk-SFD25F67.js} +1 -1
  27. package/Marketplace/{chunk-5TYZYJGF.js → chunk-TU5BCTYG.js} +2 -2
  28. package/Marketplace/{chunk-RO4DEKKD.js → chunk-U7ZZQR5Y.js} +1 -1
  29. package/Marketplace/{chunk-HX2SDZHX.js → chunk-WGPP5ACW.js} +1 -1
  30. package/Marketplace/{chunk-6MEL53S4.js → chunk-XL7EOUKR.js} +1 -1
  31. package/Marketplace/{chunk-YTF4RN6U.js → chunk-XZT3BIW4.js} +1 -1
  32. package/Marketplace/{chunk-OHADF44Q.js → chunk-YFL4FUJ5.js} +1 -1
  33. package/Marketplace/index.html +2 -2
  34. package/Marketplace/{main-VBS2IBYS.js → main-5MXBT3XM.js} +1 -1
  35. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import{a as Qe,b as j,c as Je}from"./chunk-YC44HHHF.js";import"./chunk-B2TH5YJH.js";import{a as Ye,b as Ge,c as Ue,e as je,f as Ke,g as He}from"./chunk-TPGBOTD4.js";import"./chunk-4LFFAE2I.js";import"./chunk-46AOM3SM.js";import"./chunk-OULUJ2IO.js";import{f as Le,g as Be,h as Ae,i as $e,j as ze}from"./chunk-FGPSBTFS.js";import{a as Re}from"./chunk-YIB7FZAQ.js";import"./chunk-ADRVUMMW.js";import{a as ke,b as Ne,c as We}from"./chunk-UMNGKENU.js";import"./chunk-FMV4LYKN.js";import"./chunk-HCDKYABV.js";import{c as Ee,d as Pe,e as Ie}from"./chunk-CCXKODFV.js";import{g as te,i as ie}from"./chunk-HK66WK22.js";import{b as Te,e as be}from"./chunk-4SAJUEHO.js";import"./chunk-KCDL7SWP.js";import{m as Fe,n as Oe}from"./chunk-BO4PPSB5.js";import{t as Me,u as Ve}from"./chunk-HUUFOAKH.js";import"./chunk-E5GGIVK7.js";import{c as ve,h as ye,m as xe,y as De}from"./chunk-BSN7ZAXG.js";import{b as ee,c as D}from"./chunk-6SF7AUOH.js";import{p as Se,r as Ce}from"./chunk-OVEJFFL6.js";import{$b as S,Cd as k,Da as c,Ea as u,Eb as w,Gb as m,Gc as L,Hc as U,Ic as we,Jc as J,Ma as N,Nb as E,Pa as H,Sb as r,Tb as a,Ub as C,Vb as W,Wb as R,Yb as x,Z as Y,aa as se,bc as h,ea as G,ec as me,fc as ce,fd as q,gb as de,hc as ue,ic as he,ja as pe,jb as l,jc as fe,m as le,mc as b,nc as p,oc as F,pa as y,pc as v,rc as P,sc as I,sd as B,ta as V,tc as M,uc as Q,ud as A,v as K,vc as O,vd as $,xb as g,xc as _e,yc as ge,yd as X,zd as Z}from"./chunk-PQDPS2ID.js";import{a as re,b as oe}from"./chunk-GNOSNGXM.js";var et=e=>({"over-due":e});function tt(e,o){if(e&1&&(r(0,"tr",8)(1,"td"),p(2),a(),r(3,"td"),p(4),a(),r(5,"td"),p(6),a(),r(7,"td"),p(8),a()()),e&2){let s=o.$implicit,t=o.index;m("ngClass",_e(5,et,s.Exception)),l(2),F(t+1),l(2),F(s.Number),l(2),F(s.Status),l(2),F(s.Exception)}}function it(e,o){if(e&1&&(W(0),w(1,tt,9,7,"tr",7),R()),e&2){let s,t=h();l(),m("ngForOf",(s=t.downloadResult())==null?null:s.Body)}}function nt(e,o){e&1&&(r(0,"tr",9)(1,"td",10)(2,"div",11),C(3,"i",12),a(),r(4,"h4",13),p(5," There is no order to processed "),a()()())}var qe=(()=>{let o=class o{constructor(){this.downloadResult=N()}ngOnInit(){}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=V({type:o,selectors:[["complete-step"]],inputs:{downloadResult:[1,"downloadResult"]},standalone:!0,features:[O],decls:16,vars:2,consts:[["EMPTY_DOWNLOAD",""],[1,"row","pt-2"],[1,"col-md-12"],[1,"table"],[1,"thead-light"],["width","1%"],[4,"ngIf","ngIfElse"],[3,"ngClass",4,"ngFor","ngForOf"],[3,"ngClass"],[1,"text-center"],["colspan","10",1,"border-0"],[2,"margin-top","16vh"],[1,"far","fa-file","text-secondary",2,"font-size","95px"],[1,"text-secondary","mt-6"]],template:function(n,i){if(n&1&&(r(0,"div",1)(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr"),C(5,"th",5),r(6,"th"),p(7,"Order Number"),a(),r(8,"th"),p(9,"Status"),a(),r(10,"th"),p(11,"Exception"),a()()(),r(12,"tbody"),w(13,it,2,1,"ng-container",6)(14,nt,6,0,"ng-template",null,0,J),a()()()()),n&2){let d,f=b(15);l(13),m("ngIf",((d=i.downloadResult())==null||d.Body==null?null:d.Body.length)>0)("ngIfElse",f)}},dependencies:[k,B,A,$]});let e=o;return e})();var z=(()=>{let o=class o{constructor(){this.httpService=y(be),this.toastr=y(Te),this.datePipe=y(Z)}gerChannelDetailById(t){return this.httpService.post(te.GetChannelDetail,{ID:t})}getOrderPreview(t){return this.httpService.post(te.GetOrderPreviewV2,t)}getDownloadOrder(t){return this.httpService.post(te.GetDownloadOrderV2,t)}onPreviewOrder(t){return this.validateDatePreview(t)?this.getOrderPreview(t).pipe(G(n=>{n.Data?.length===0&&this.toastrEmptyPreview(t)})):le}toastrEmptyPreview(t){let n=this.datePipe.transform(t.From,"dd MMM yyyy"),i=this.datePipe.transform(t.To,"dd MMM yyyy"),d=t.TimeFrom?t.TimeFrom:"",f=t.TimeTo?t.TimeTo:"";this.toastr.info(`There is no orders from ${n} ${d} to ${i} ${f}!`,"No Orders!")}validateDatePreview(t){let n=!0;return t.downloadType==!0?D.getDaysDiff(t?.From,t?.To)+1>7&&(this.toastr.warning("Dates cannot be more than 7 days apart!","Warning"),n=!1):D.getDaysDiff(t?.From,t?.To)+1>14&&(this.toastr.warning("Dates cannot be more than 14 days apart!","Warning"),n=!1),n}getDateTitle(t,n){let i=D.formatTitleFromDate(new Date(t),new Date(n)),d=this.datePipe.transform(t,i),f=this.datePipe.transform(n,"dd MMM yyyy");return`${i==null?"":d+"-"} ${f}`}};o.\u0275fac=function(n){return new(n||o)},o.\u0275prov=pe({token:o,factory:o.\u0275fac});let e=o;return e})();function at(e,o){if(e&1&&(r(0,"ng-option",13),C(1,"img",14),p(2),a()),e&2){let s=o.$implicit;m("value",s.ID),l(),m("src",s==null?null:s.Img,de),l(),v("",s.Name," ")}}function rt(e,o){if(e&1){let s=x();r(0,"div",8)(1,"div",4)(2,"h5"),p(3,"Type"),a(),r(4,"p",5),p(5,"Select Type want to download"),a()(),r(6,"div",4)(7,"div",15)(8,"div")(9,"mat-radio-group",16),M("ngModelChange",function(n){c(s);let i=h();return I(i.downloadType,n)||(i.downloadType=n),u(n)}),S("ngModelChange",function(){c(s);let n=h();return u(n.onDownloadTypeChange())}),r(10,"mat-radio-button",17),p(11," Orders "),a(),r(12,"mat-radio-button",18),p(13," Disbursement "),a()()()(),r(14,"div",19)(15,"div",20),C(16,"i",21),a(),r(17,"p",22),p(18," If there are completed transactions, to obtain payment and service fee, you need to download disbursement. "),a()()()()}if(e&2){let s=h();l(9),P("ngModel",s.downloadType),l(),m("value",!1),l(2),m("value",!0)}}function ot(e,o){e&1&&(r(0,"p",5),p(1," Select Disbursement date "),r(2,"span",23),p(3,"(payment date / order complete date)"),a(),p(4," of the channel you want to download (Max 1 Week). "),a())}function lt(e,o){e&1&&(r(0,"p",5),p(1," Select transaction date of the channel you want to download (Max 2 Weeks) "),a())}function st(e,o){if(e&1){let s=x();r(0,"div",12)(1,"app-timepicker",24),M("timeChange",function(n){c(s);let i=h();return I(i.startTime,n)||(i.startTime=n),u(n)}),S("timeChange",function(){c(s);let n=h();return u(n.onStartTimeChange())}),a(),r(2,"span",25),p(3,"-"),a(),r(4,"app-timepicker",24),M("timeChange",function(n){c(s);let i=h();return I(i.endTime,n)||(i.endTime=n),u(n)}),S("timeChange",function(){c(s);let n=h();return u(n.onEndTimeChange())}),a()()}if(e&2){let s=h();l(),P("time",s.startTime),l(3),P("time",s.endTime)}}var Xe=(()=>{let o=class o{constructor(){this.reset=N(!1),this.authService=y(ie),this.downloadService=y(z),this.downloadType=g(!1),this.selectedChannelId=g(null),this.channelOptions=g(this.authService.getChannels()),this.channelType=ee,this.selectedChannel=g(null),this.showTimePicker=g(!1),this.startDate=g(null),this.endDate=g(null),this.startTime=g("00:00"),this.endTime=g("23:59"),this.filterData=new H,q(()=>{this.reset()&&this.resetFilter()},{allowSignalWrites:!0})}resetFilter(){this.selectedChannelId.update(()=>null),this.startDate.update(()=>null),this.endDate.update(()=>null),this.startTime.update(()=>null),this.endTime.update(()=>null),this.downloadType.update(()=>!1),this.selectedChannel.update(()=>null),this.showTimePicker.update(()=>!1),this.channelDetail$=null}onSelectChannel(){this.selectedChannel.update(()=>this.channelOptions().find(t=>t.ID===this.selectedChannelId())),this.selectedChannel()?this.channelDetail$=this.downloadService.gerChannelDetailById(this.selectedChannelId()).pipe(K(t=>t?.Model),Y(1)):this.channelDetail$=null,this.emitFilterData()}onFilterDateChange(){let t=1;this.startDate()&&this.endDate()&&(t=D.getDaysDiff(this.startDate(),this.endDate())),this.showTimePicker.update(()=>t==0),this.emitFilterData()}onDownloadTypeChange(){this.emitFilterData()}onStartTimeChange(){this.emitFilterData()}onEndTimeChange(){this.emitFilterData()}emitFilterData(){this.filterData.emit({channelId:this.selectedChannelId(),startDate:this.startDate(),endDate:this.endDate(),downloadType:this.downloadType(),startTime:this.startTime(),endTime:this.endTime()})}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=V({type:o,selectors:[["filter-step"]],inputs:{reset:[1,"reset"]},outputs:{filterData:"onFilterChange"},standalone:!0,features:[Q([z]),O],decls:27,vars:11,consts:[["picker",""],[1,"row","pt-2",2,"width","63%","margin-right","40px"],[1,"col-12"],[1,"row"],[1,"col-6"],[1,"text-muted"],["appendTo","body","placeholder","Select Channel",3,"ngModelChange","clearable","ngModel"],[3,"value",4,"ngFor","ngForOf"],[1,"row","mt-6"],["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,"mt-8"],[3,"value"],[2,"width","18px","margin-right","10px",3,"src"],[1,"form-label-group","radio","download-type",2,"margin-bottom","0px"],["name","dowloadType",3,"ngModelChange","ngModel"],["matTooltip","Download from Create sales order until create logistics status",1,"me-5",3,"value"],["matTooltip","Download only Payment and write off",1,"me-5",3,"value"],[1,"d-flex","border","mb-4","pt-6","px-6","mt-3",2,"background","#1f87ac0a","border-radius","5px"],[1,"me-3","pt-1"],[1,"fa","fa-lightbulb","fs-5"],[1,"mb-6"],[1,"fw-bold"],[3,"timeChange","time"],[1,"mx-4"]],template:function(n,i){if(n&1){let d=x();r(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4)(4,"h5"),p(5,"Select a Channel"),a(),r(6,"p",5),p(7,"Select Channel want to download order"),a()(),r(8,"div",4)(9,"ng-select",6),M("ngModelChange",function(_){return c(d),I(i.selectedChannelId,_)||(i.selectedChannelId=_),u(_)}),S("ngModelChange",function(){return c(d),u(i.onSelectChannel())}),w(10,at,3,3,"ng-option",7),a()()(),w(11,rt,19,3,"div",8),L(12,"async"),r(13,"div",8)(14,"div",4)(15,"h5"),p(16,"Date Range"),a(),w(17,ot,5,0,"p",5)(18,lt,2,0,"p",5),a(),r(19,"div",4)(20,"div",2)(21,"mat-date-range-input",9)(22,"input",10),M("ngModelChange",function(_){return c(d),I(i.startDate,_)||(i.startDate=_),u(_)}),S("click",function(){c(d);let _=b(25);return u(_.open())}),a(),r(23,"input",11),M("ngModelChange",function(_){return c(d),I(i.endDate,_)||(i.endDate=_),u(_)}),S("click",function(){c(d);let _=b(25);return u(_.open())})("ngModelChange",function(){return c(d),u(i.onFilterDateChange())}),a()(),C(24,"mat-date-range-picker",null,0),a(),w(26,st,5,2,"div",12),a()()()()}if(n&2){let d,f,_=b(25);l(9),m("clearable",!1),P("ngModel",i.selectedChannelId),l(),m("ngForOf",i.channelOptions()),l(),E((d=U(12,9,i.channelDetail$))!=null&&d.ServiceFeeWriteOff&&((d=i.selectedChannel())==null?null:d.TypeID)==i.channelType.Tokopedia?11:-1),l(6),E(i.downloadType()&&((f=i.selectedChannel())==null?null:f.TypeID)==i.channelType.Tokopedia?17:18),l(4),m("rangePicker",_),l(),P("ngModel",i.startDate),l(),P("ngModel",i.endDate),l(3),E(i.showTimePicker()?26:-1)}},dependencies:[k,A,X,Ie,Pe,Ee,We,ke,Ne,De,ve,ye,xe,Je,$e,Ae,ze,Le,Be],styles:[".vertical-radio[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:15px 0}.mt-1rem[_ngcontent-%COMP%]{margin-top:1rem}.dateRange[_ngcontent-%COMP%]{padding-top:.8rem;padding-bottom:.8rem}.form-label-group.radio.download-type[_ngcontent-%COMP%]{height:45.5938px!important;border-radius:.375rem!important}"]});let e=o;return e})();var T=function(e){return e.ALL="all",e.SYNC="sync",e.WRONG="wrong",e.UNSYNC="unsync",e}(T||{});var pt=(e,o)=>({"over-due-today":e,"over-due":o});function dt(e,o){if(e&1&&(r(0,"th",21),p(1),a()),e&2){let s=h();l(),v(" ",s.selectedChannel()?"Created Date":"Last Status Update"," ")}}function mt(e,o){if(e&1&&(r(0,"td"),p(1),L(2,"date"),a()),e&2){let s=h().$implicit;l(),v(" ",we(2,1,s.Date,"dd MMM yyyy HH:mm:ss")," ")}}function ct(e,o){if(e&1&&(r(0,"span"),p(1),a()),e&2){let s=h().$implicit;l(),v(" ",s.ActionString," ")}}function ut(e,o){if(e&1&&(r(0,"li"),p(1),a()),e&2){let s=o.$implicit;l(),v(" ",s," ")}}function ht(e,o){if(e&1&&(r(0,"ul",27),w(1,ut,2,1,"li",22),a()),e&2){let s=h().$implicit;l(),m("ngForOf",s.ActionString)}}function ft(e,o){if(e&1&&(r(0,"span",28),C(1,"i",29),a()),e&2){let s=h().$implicit;ce("title","Delivery : ",s.DeliveryState,`
1
+ import{a as Qe,b as j,c as Je}from"./chunk-YC44HHHF.js";import"./chunk-B2TH5YJH.js";import{a as Ye,b as Ge,c as Ue,e as je,f as Ke,g as He}from"./chunk-TPGBOTD4.js";import"./chunk-4LFFAE2I.js";import"./chunk-46AOM3SM.js";import"./chunk-OULUJ2IO.js";import{f as Le,g as Be,h as Ae,i as $e,j as ze}from"./chunk-FGPSBTFS.js";import{a as Re}from"./chunk-YIB7FZAQ.js";import"./chunk-ADRVUMMW.js";import{a as ke,b as Ne,c as We}from"./chunk-UMNGKENU.js";import"./chunk-FMV4LYKN.js";import"./chunk-HCDKYABV.js";import{c as Ee,d as Pe,e as Ie}from"./chunk-CCXKODFV.js";import{g as te,i as ie}from"./chunk-EMO3QL6Q.js";import{b as Te,e as be}from"./chunk-4SAJUEHO.js";import"./chunk-KCDL7SWP.js";import{m as Fe,n as Oe}from"./chunk-BO4PPSB5.js";import{t as Me,u as Ve}from"./chunk-HUUFOAKH.js";import"./chunk-E5GGIVK7.js";import{c as ve,h as ye,m as xe,y as De}from"./chunk-BSN7ZAXG.js";import{b as ee,c as D}from"./chunk-6SF7AUOH.js";import{p as Se,r as Ce}from"./chunk-OVEJFFL6.js";import{$b as S,Cd as k,Da as c,Ea as u,Eb as w,Gb as m,Gc as L,Hc as U,Ic as we,Jc as J,Ma as N,Nb as E,Pa as H,Sb as r,Tb as a,Ub as C,Vb as W,Wb as R,Yb as x,Z as Y,aa as se,bc as h,ea as G,ec as me,fc as ce,fd as q,gb as de,hc as ue,ic as he,ja as pe,jb as l,jc as fe,m as le,mc as b,nc as p,oc as F,pa as y,pc as v,rc as P,sc as I,sd as B,ta as V,tc as M,uc as Q,ud as A,v as K,vc as O,vd as $,xb as g,xc as _e,yc as ge,yd as X,zd as Z}from"./chunk-PQDPS2ID.js";import{a as re,b as oe}from"./chunk-GNOSNGXM.js";var et=e=>({"over-due":e});function tt(e,o){if(e&1&&(r(0,"tr",8)(1,"td"),p(2),a(),r(3,"td"),p(4),a(),r(5,"td"),p(6),a(),r(7,"td"),p(8),a()()),e&2){let s=o.$implicit,t=o.index;m("ngClass",_e(5,et,s.Exception)),l(2),F(t+1),l(2),F(s.Number),l(2),F(s.Status),l(2),F(s.Exception)}}function it(e,o){if(e&1&&(W(0),w(1,tt,9,7,"tr",7),R()),e&2){let s,t=h();l(),m("ngForOf",(s=t.downloadResult())==null?null:s.Body)}}function nt(e,o){e&1&&(r(0,"tr",9)(1,"td",10)(2,"div",11),C(3,"i",12),a(),r(4,"h4",13),p(5," There is no order to processed "),a()()())}var qe=(()=>{let o=class o{constructor(){this.downloadResult=N()}ngOnInit(){}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=V({type:o,selectors:[["complete-step"]],inputs:{downloadResult:[1,"downloadResult"]},standalone:!0,features:[O],decls:16,vars:2,consts:[["EMPTY_DOWNLOAD",""],[1,"row","pt-2"],[1,"col-md-12"],[1,"table"],[1,"thead-light"],["width","1%"],[4,"ngIf","ngIfElse"],[3,"ngClass",4,"ngFor","ngForOf"],[3,"ngClass"],[1,"text-center"],["colspan","10",1,"border-0"],[2,"margin-top","16vh"],[1,"far","fa-file","text-secondary",2,"font-size","95px"],[1,"text-secondary","mt-6"]],template:function(n,i){if(n&1&&(r(0,"div",1)(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr"),C(5,"th",5),r(6,"th"),p(7,"Order Number"),a(),r(8,"th"),p(9,"Status"),a(),r(10,"th"),p(11,"Exception"),a()()(),r(12,"tbody"),w(13,it,2,1,"ng-container",6)(14,nt,6,0,"ng-template",null,0,J),a()()()()),n&2){let d,f=b(15);l(13),m("ngIf",((d=i.downloadResult())==null||d.Body==null?null:d.Body.length)>0)("ngIfElse",f)}},dependencies:[k,B,A,$]});let e=o;return e})();var z=(()=>{let o=class o{constructor(){this.httpService=y(be),this.toastr=y(Te),this.datePipe=y(Z)}gerChannelDetailById(t){return this.httpService.post(te.GetChannelDetail,{ID:t})}getOrderPreview(t){return this.httpService.post(te.GetOrderPreviewV2,t)}getDownloadOrder(t){return this.httpService.post(te.GetDownloadOrderV2,t)}onPreviewOrder(t){return this.validateDatePreview(t)?this.getOrderPreview(t).pipe(G(n=>{n.Data?.length===0&&this.toastrEmptyPreview(t)})):le}toastrEmptyPreview(t){let n=this.datePipe.transform(t.From,"dd MMM yyyy"),i=this.datePipe.transform(t.To,"dd MMM yyyy"),d=t.TimeFrom?t.TimeFrom:"",f=t.TimeTo?t.TimeTo:"";this.toastr.info(`There is no orders from ${n} ${d} to ${i} ${f}!`,"No Orders!")}validateDatePreview(t){let n=!0;return t.downloadType==!0?D.getDaysDiff(t?.From,t?.To)+1>7&&(this.toastr.warning("Dates cannot be more than 7 days apart!","Warning"),n=!1):D.getDaysDiff(t?.From,t?.To)+1>14&&(this.toastr.warning("Dates cannot be more than 14 days apart!","Warning"),n=!1),n}getDateTitle(t,n){let i=D.formatTitleFromDate(new Date(t),new Date(n)),d=this.datePipe.transform(t,i),f=this.datePipe.transform(n,"dd MMM yyyy");return`${i==null?"":d+"-"} ${f}`}};o.\u0275fac=function(n){return new(n||o)},o.\u0275prov=pe({token:o,factory:o.\u0275fac});let e=o;return e})();function at(e,o){if(e&1&&(r(0,"ng-option",13),C(1,"img",14),p(2),a()),e&2){let s=o.$implicit;m("value",s.ID),l(),m("src",s==null?null:s.Img,de),l(),v("",s.Name," ")}}function rt(e,o){if(e&1){let s=x();r(0,"div",8)(1,"div",4)(2,"h5"),p(3,"Type"),a(),r(4,"p",5),p(5,"Select Type want to download"),a()(),r(6,"div",4)(7,"div",15)(8,"div")(9,"mat-radio-group",16),M("ngModelChange",function(n){c(s);let i=h();return I(i.downloadType,n)||(i.downloadType=n),u(n)}),S("ngModelChange",function(){c(s);let n=h();return u(n.onDownloadTypeChange())}),r(10,"mat-radio-button",17),p(11," Orders "),a(),r(12,"mat-radio-button",18),p(13," Disbursement "),a()()()(),r(14,"div",19)(15,"div",20),C(16,"i",21),a(),r(17,"p",22),p(18," If there are completed transactions, to obtain payment and service fee, you need to download disbursement. "),a()()()()}if(e&2){let s=h();l(9),P("ngModel",s.downloadType),l(),m("value",!1),l(2),m("value",!0)}}function ot(e,o){e&1&&(r(0,"p",5),p(1," Select Disbursement date "),r(2,"span",23),p(3,"(payment date / order complete date)"),a(),p(4," of the channel you want to download (Max 1 Week). "),a())}function lt(e,o){e&1&&(r(0,"p",5),p(1," Select transaction date of the channel you want to download (Max 2 Weeks) "),a())}function st(e,o){if(e&1){let s=x();r(0,"div",12)(1,"app-timepicker",24),M("timeChange",function(n){c(s);let i=h();return I(i.startTime,n)||(i.startTime=n),u(n)}),S("timeChange",function(){c(s);let n=h();return u(n.onStartTimeChange())}),a(),r(2,"span",25),p(3,"-"),a(),r(4,"app-timepicker",24),M("timeChange",function(n){c(s);let i=h();return I(i.endTime,n)||(i.endTime=n),u(n)}),S("timeChange",function(){c(s);let n=h();return u(n.onEndTimeChange())}),a()()}if(e&2){let s=h();l(),P("time",s.startTime),l(3),P("time",s.endTime)}}var Xe=(()=>{let o=class o{constructor(){this.reset=N(!1),this.authService=y(ie),this.downloadService=y(z),this.downloadType=g(!1),this.selectedChannelId=g(null),this.channelOptions=g(this.authService.getChannels()),this.channelType=ee,this.selectedChannel=g(null),this.showTimePicker=g(!1),this.startDate=g(null),this.endDate=g(null),this.startTime=g("00:00"),this.endTime=g("23:59"),this.filterData=new H,q(()=>{this.reset()&&this.resetFilter()},{allowSignalWrites:!0})}resetFilter(){this.selectedChannelId.update(()=>null),this.startDate.update(()=>null),this.endDate.update(()=>null),this.startTime.update(()=>null),this.endTime.update(()=>null),this.downloadType.update(()=>!1),this.selectedChannel.update(()=>null),this.showTimePicker.update(()=>!1),this.channelDetail$=null}onSelectChannel(){this.selectedChannel.update(()=>this.channelOptions().find(t=>t.ID===this.selectedChannelId())),this.selectedChannel()?this.channelDetail$=this.downloadService.gerChannelDetailById(this.selectedChannelId()).pipe(K(t=>t?.Model),Y(1)):this.channelDetail$=null,this.emitFilterData()}onFilterDateChange(){let t=1;this.startDate()&&this.endDate()&&(t=D.getDaysDiff(this.startDate(),this.endDate())),this.showTimePicker.update(()=>t==0),this.emitFilterData()}onDownloadTypeChange(){this.emitFilterData()}onStartTimeChange(){this.emitFilterData()}onEndTimeChange(){this.emitFilterData()}emitFilterData(){this.filterData.emit({channelId:this.selectedChannelId(),startDate:this.startDate(),endDate:this.endDate(),downloadType:this.downloadType(),startTime:this.startTime(),endTime:this.endTime()})}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=V({type:o,selectors:[["filter-step"]],inputs:{reset:[1,"reset"]},outputs:{filterData:"onFilterChange"},standalone:!0,features:[Q([z]),O],decls:27,vars:11,consts:[["picker",""],[1,"row","pt-2",2,"width","63%","margin-right","40px"],[1,"col-12"],[1,"row"],[1,"col-6"],[1,"text-muted"],["appendTo","body","placeholder","Select Channel",3,"ngModelChange","clearable","ngModel"],[3,"value",4,"ngFor","ngForOf"],[1,"row","mt-6"],["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,"mt-8"],[3,"value"],[2,"width","18px","margin-right","10px",3,"src"],[1,"form-label-group","radio","download-type",2,"margin-bottom","0px"],["name","dowloadType",3,"ngModelChange","ngModel"],["matTooltip","Download from Create sales order until create logistics status",1,"me-5",3,"value"],["matTooltip","Download only Payment and write off",1,"me-5",3,"value"],[1,"d-flex","border","mb-4","pt-6","px-6","mt-3",2,"background","#1f87ac0a","border-radius","5px"],[1,"me-3","pt-1"],[1,"fa","fa-lightbulb","fs-5"],[1,"mb-6"],[1,"fw-bold"],[3,"timeChange","time"],[1,"mx-4"]],template:function(n,i){if(n&1){let d=x();r(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4)(4,"h5"),p(5,"Select a Channel"),a(),r(6,"p",5),p(7,"Select Channel want to download order"),a()(),r(8,"div",4)(9,"ng-select",6),M("ngModelChange",function(_){return c(d),I(i.selectedChannelId,_)||(i.selectedChannelId=_),u(_)}),S("ngModelChange",function(){return c(d),u(i.onSelectChannel())}),w(10,at,3,3,"ng-option",7),a()()(),w(11,rt,19,3,"div",8),L(12,"async"),r(13,"div",8)(14,"div",4)(15,"h5"),p(16,"Date Range"),a(),w(17,ot,5,0,"p",5)(18,lt,2,0,"p",5),a(),r(19,"div",4)(20,"div",2)(21,"mat-date-range-input",9)(22,"input",10),M("ngModelChange",function(_){return c(d),I(i.startDate,_)||(i.startDate=_),u(_)}),S("click",function(){c(d);let _=b(25);return u(_.open())}),a(),r(23,"input",11),M("ngModelChange",function(_){return c(d),I(i.endDate,_)||(i.endDate=_),u(_)}),S("click",function(){c(d);let _=b(25);return u(_.open())})("ngModelChange",function(){return c(d),u(i.onFilterDateChange())}),a()(),C(24,"mat-date-range-picker",null,0),a(),w(26,st,5,2,"div",12),a()()()()}if(n&2){let d,f,_=b(25);l(9),m("clearable",!1),P("ngModel",i.selectedChannelId),l(),m("ngForOf",i.channelOptions()),l(),E((d=U(12,9,i.channelDetail$))!=null&&d.ServiceFeeWriteOff&&((d=i.selectedChannel())==null?null:d.TypeID)==i.channelType.Tokopedia?11:-1),l(6),E(i.downloadType()&&((f=i.selectedChannel())==null?null:f.TypeID)==i.channelType.Tokopedia?17:18),l(4),m("rangePicker",_),l(),P("ngModel",i.startDate),l(),P("ngModel",i.endDate),l(3),E(i.showTimePicker()?26:-1)}},dependencies:[k,A,X,Ie,Pe,Ee,We,ke,Ne,De,ve,ye,xe,Je,$e,Ae,ze,Le,Be],styles:[".vertical-radio[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:15px 0}.mt-1rem[_ngcontent-%COMP%]{margin-top:1rem}.dateRange[_ngcontent-%COMP%]{padding-top:.8rem;padding-bottom:.8rem}.form-label-group.radio.download-type[_ngcontent-%COMP%]{height:45.5938px!important;border-radius:.375rem!important}"]});let e=o;return e})();var T=function(e){return e.ALL="all",e.SYNC="sync",e.WRONG="wrong",e.UNSYNC="unsync",e}(T||{});var pt=(e,o)=>({"over-due-today":e,"over-due":o});function dt(e,o){if(e&1&&(r(0,"th",21),p(1),a()),e&2){let s=h();l(),v(" ",s.selectedChannel()?"Created Date":"Last Status Update"," ")}}function mt(e,o){if(e&1&&(r(0,"td"),p(1),L(2,"date"),a()),e&2){let s=h().$implicit;l(),v(" ",we(2,1,s.Date,"dd MMM yyyy HH:mm:ss")," ")}}function ct(e,o){if(e&1&&(r(0,"span"),p(1),a()),e&2){let s=h().$implicit;l(),v(" ",s.ActionString," ")}}function ut(e,o){if(e&1&&(r(0,"li"),p(1),a()),e&2){let s=o.$implicit;l(),v(" ",s," ")}}function ht(e,o){if(e&1&&(r(0,"ul",27),w(1,ut,2,1,"li",22),a()),e&2){let s=h().$implicit;l(),m("ngForOf",s.ActionString)}}function ft(e,o){if(e&1&&(r(0,"span",28),C(1,"i",29),a()),e&2){let s=h().$implicit;ce("title","Delivery : ",s.DeliveryState,`
2
2
  Payment : `,s.PaymentState,"")}}function _t(e,o){if(e&1&&(r(0,"tr")(1,"td"),p(2),a(),r(3,"td"),p(4),a(),w(5,mt,3,4,"td",23),r(6,"td")(7,"span"),p(8),a(),p(9),a(),r(10,"td",24)(11,"span"),p(12),a(),p(13),a(),r(14,"td"),w(15,ct,2,1,"span",23)(16,ht,2,1,"ul",25),a(),r(17,"td"),w(18,ft,2,3,"span",26),a()()),e&2){let s,t=o.$implicit,n=o.index,i=h(2);l(2),F(n+1),l(2),F(t.Number),l(),m("ngIf",((s=i.selectedChannel())==null?null:s.TypeID)!=i.channelType.Shopee&&((s=i.selectedChannel())==null?null:s.TypeID)!==i.channelType.Tiktok),l(3),v("",t.ChannelStatus," - "),l(),v("",t.ChannelStatusDescription," "),l(),m("ngClass",ge(12,pt,(t==null?null:t.Action)==i.actionPreviewOrder.Update,(t==null?null:t.Action)==i.actionPreviewOrder.New))("matTooltip",t.POSStatus==91||t.POSStatusDescription=="Conflict"?"There is a missed status at POS, usually fulfillment has not been recorded but the payment has been recorded":""),l(2),v("",t.POSStatus," - "),l(),v("",t.POSStatusDescription," "),l(2),m("ngIf",t.ActionString.length==1),l(),m("ngIf",t.ActionString.length>1),l(2),m("ngIf",t.ChannelStatus!=99&&t.POSStatus!=99)}}function gt(e,o){if(e&1&&(W(0),w(1,_t,19,15,"tr",22),R()),e&2){let s=h();l(),m("ngForOf",s.displayPreviewData())}}function wt(e,o){e&1&&(r(0,"tr",30)(1,"td",31)(2,"div",32),C(3,"i",33),a(),r(4,"h4",34),p(5," There is no order to processed "),a()()())}var Ze=(()=>{let o=class o{constructor(){this.orderPreview=N(),this.selectedChannel=N(),this.channelType=ee,this.allData=g(0),this.syncData=g(0),this.wrongData=g(0),this.unsyncData=g(0),this.pillStatus=g(T.ALL),this.actionPreviewOrder=j,this.previewStatus=T,this.displayPreviewData=g([]),this.exportOrders=new H,q(()=>{this.orderPreview()&&(this.filterPreviewData(T.ALL),this.initLengthStatusData())},{allowSignalWrites:!0})}filterPreviewData(t){this.pillStatus.update(()=>t),this.displayPreviewData.update(()=>this.filterDataByStatus(t))}initLengthStatusData(){this.wrongData.update(()=>this.filterDataByStatus(T.WRONG).length),this.syncData.update(()=>this.filterDataByStatus(T.SYNC).length),this.allData.update(()=>this.orderPreview().length),this.unsyncData.update(()=>this.filterDataByStatus(T.UNSYNC).length)}filterDataByStatus(t){let n=[];switch(t){case T.ALL:n=this.orderPreview();break;case T.SYNC:n=this.orderPreview().filter(i=>i.Action==j.DoNothing);break;case T.WRONG:n=this.orderPreview().filter(i=>i.Action==j.Update);break;case T.UNSYNC:n=this.orderPreview().filter(i=>i.Action==j.New);break}return n}onExportOrders(){this.exportOrders.emit()}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=V({type:o,selectors:[["preview-step"]],inputs:{orderPreview:[1,"orderPreview"],selectedChannel:[1,"selectedChannel"]},outputs:{exportOrders:"onExportOrders"},standalone:!0,features:[O],decls:41,vars:11,consts:[["EMPTY",""],[1,"row","pt-2"],[1,"col-md-12"],[1,"row","mx-1","mb-5"],[1,"col-12","d-flex","justify-content-between","align-items-end",2,"padding-left","0px","padding-right","0px"],[1,"nav","nav-pills"],[1,"nav-item","me-3"],[1,"btn","btn-sm","rounded-pill",3,"click","ngClass"],[1,"nav-item","mx-3"],["matTooltip","All Invoice which is already available in POS",1,"btn","btn-sm","rounded-pill",3,"click","ngClass"],["matTooltip","Invoices that have different status between marketplace and POS",1,"btn","btn-sm","rounded-pill",3,"click","ngClass"],["matTooltip","Invoices which is not exist in POS",1,"btn","btn-sm","rounded-pill",3,"click","ngClass"],["type","button",1,"btn","btn-outline-secondary",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"table"],[1,"thead-light"],["width","1%"],["width","25%"],["width","15%",4,"ngIf"],["width","10%"],[4,"ngIf","ngIfElse"],["width","15%"],[4,"ngFor","ngForOf"],[4,"ngIf"],["matTooltipClass","custom-width-tooltip",3,"ngClass","matTooltip"],["class","ps-5",4,"ngIf"],[3,"title",4,"ngIf"],[1,"ps-5"],[3,"title"],[1,"fas","fa-info-circle","ms-2"],[1,"text-center"],["colspan","10",1,"border-0"],[2,"margin-top","16vh"],[1,"far","fa-file","text-secondary",2,"font-size","95px"],[1,"text-secondary","mt-6"]],template:function(n,i){if(n&1){let d=x();r(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4)(4,"div")(5,"ul",5)(6,"li",6)(7,"button",7),S("click",function(){return c(d),u(i.filterPreviewData(i.previewStatus.ALL))}),p(8),a()(),r(9,"li",8)(10,"button",9),S("click",function(){return c(d),u(i.filterPreviewData(i.previewStatus.SYNC))}),p(11),a()(),r(12,"li",8)(13,"button",10),S("click",function(){return c(d),u(i.filterPreviewData(i.previewStatus.WRONG))}),p(14),a()(),r(15,"li",8)(16,"button",11),S("click",function(){return c(d),u(i.filterPreviewData(i.previewStatus.UNSYNC))}),p(17),a()()()(),r(18,"div")(19,"button",12),S("click",function(){return c(d),u(i.onExportOrders())}),C(20,"i",13),r(21,"span"),p(22,"Export"),a()()()()(),r(23,"table",14)(24,"thead",15)(25,"tr"),C(26,"th",16),r(27,"th",17),p(28,"Number"),a(),w(29,dt,2,1,"th",18),r(30,"th",19),p(31,"Channel Status"),a(),r(32,"th",19),p(33,"POS Status"),a(),r(34,"th"),p(35,"Action"),a(),C(36,"th",16),a()(),r(37,"tbody"),w(38,gt,2,1,"ng-container",20)(39,wt,6,0,"ng-template",null,0,J),a()()()()}if(n&2){let d,f,_=b(40);l(7),m("ngClass",i.pillStatus()=="all"?"btn-secondary text-white":"btn-outline-dark"),l(),v(" All (",i.allData(),") "),l(2),m("ngClass",i.pillStatus()=="sync"?"btn-success":"btn-outline-success"),l(),v(" Existing (",i.syncData(),") "),l(2),m("ngClass",i.pillStatus()=="wrong"?"btn-warning text-white":"btn-outline-warning"),l(),v(" Wrong Status (",i.wrongData(),") "),l(2),m("ngClass",i.pillStatus()=="unsync"?"btn-danger":"btn-outline-danger"),l(),v(" Missing (",i.unsyncData(),") "),l(12),m("ngIf",((d=i.selectedChannel())==null?null:d.TypeID)!=i.channelType.Shopee&&((d=i.selectedChannel())==null?null:d.TypeID)!==i.channelType.Tiktok),l(9),m("ngIf",((f=i.displayPreviewData())==null?null:f.length)>0)("ngIfElse",_)}},dependencies:[k,B,A,$,Z,Ve,Me]});let e=o;return e})();var St=["stepper"];function Ct(e,o){e&1&&(r(0,"a",2),p(1," Download V1 "),a())}function vt(e,o){if(e&1){let s=x();r(0,"div",3)(1,"button",20),S("click",function(){c(s);let n=h();return u(n.onStepperBack())}),p(2," Back "),a(),r(3,"button",21),S("click",function(){c(s);let n=h();return u(n.onNextStep())}),p(4," Next "),a()()}if(e&2){let s=h();l(3),m("disabled",s.disabledNextFilter())}}function yt(e,o){if(e&1){let s=x();r(0,"button",22),S("click",function(){c(s);let n=h();return u(n.onNextStep())}),p(1," Next "),a()}if(e&2){let s=h();m("disabled",s.disabledNextFilter())}}function xt(e,o){if(e&1){let s=x();r(0,"button",23),S("click",function(){c(s);let n=h();return u(n.onNewDownload())}),C(1,"i",24),p(2," New "),a()}}function Dt(e,o){e&1&&(C(0,"i",25),r(1,"span"),p(2,"Filter"),a())}function Tt(e,o){e&1&&(C(0,"i",26),r(1,"span"),p(2,"Preview"),a())}function bt(e,o){if(e&1){let s=x();W(0),r(1,"preview-step",27),S("onExportOrders",function(){c(s);let n=h();return u(n.onExportOrders())}),a(),R()}if(e&2){let s=o.ngIf;l(),m("orderPreview",s)}}function Et(e,o){e&1&&(C(0,"i",28),r(1,"span"),p(2,"Finish"),a())}function Pt(e,o){if(e&1&&(W(0),C(1,"complete-step",29),R()),e&2){let s=o.ngIf;l(),m("downloadResult",s)}}function It(e,o){e&1&&(r(0,"h6"),p(1,"1"),a())}function Mt(e,o){e&1&&(r(0,"h6"),p(1,"2"),a())}function Vt(e,o){e&1&&(r(0,"h6"),p(1,"3"),a())}var Yi=(()=>{let o=class o{constructor(){this.downloadService=y(z),this.orderService=y(Qe),this.productService=y(Re),this.authService=y(ie),this.stepperSelectedIndex=g(0),this.disabledNextFilter=g(!0),this.isResetFilter=g(!1),this.pageTitle=g("Download to POS"),this.cacheKey=g(D.GuidEMpty)}onFilterChange(t){this.filter=t,this.validateDisabledNext()}validateDisabledNext(){this.disabledNextFilter.update(()=>D.IsEmpty(this.filter?.channelId)||!D.isValidDate(this.filter.startDate)||!D.isValidDate(this.filter.endDate))}onNextStep(){switch(this.stepper.selectedIndex){case 0:this.onPreview();let t=this.productService.findChannelById(this.filter.channelId,this.authService.getChannels());this.setPageTitle(`Preview ${t?.Name}`);break;case 1:this.onDownload(),this.setPageTitle("Download");break}}onStepperNext(){this.stepper.selected.completed=!0,this.stepper.next()}onPreview(){let t={ID:this.filter.channelId,From:this.filter.startDate,To:this.filter.endDate,IsDisbursement:this.filter.downloadType};D.IsNotEmpty(this.filter.startTime)&&(t=oe(re({},t),{TimeFrom:this.filter.startTime+":00",TimeTo:this.filter.endTime+":00"})),this.orderPreview$=this.downloadService.onPreviewOrder(t).pipe(G(n=>{n.Data?.length>0&&(this.cacheKey.update(()=>n.CacheKey),this.onStepperNext())}),K(n=>n.Data),Y(1))}onExportOrders(){let t={ID:this.filter.channelId,From:this.filter.startDate?JSON.stringify(this.filter.startDate):null,To:this.filter.endDate?JSON.stringify(this.filter.endDate):null},n=`Orders ${this.downloadService.getDateTitle(this.filter.startDate,this.filter.endDate)}`;this.orderService.exportOrders(t,n).subscribe()}onDownload(){let t={ID:this.filter.channelId,From:this.filter.startDate,To:this.filter.endDate,ListPreview:[],IsDisbursement:this.filter.downloadType,CacheKey:this.cacheKey()};this.downloadPreview$=this.orderPreview$.pipe(se(n=>(t.ListPreview=n,this.downloadService.getDownloadOrder(t))),G(()=>{this.onStepperNext()}),Y(1))}setPageTitle(t){this.pageTitle.update(()=>`
3
3
  ${t} (${this.downloadService.getDateTitle(this.filter.startDate,this.filter.endDate)})
4
4
  `)}onStepperBack(){this.stepper.previous(),this.pageTitle.update(()=>"Download to POS")}onNewDownload(){this.isResetFilter.update(()=>!0),this.stepper.reset(),this.stepperSelectedIndex.update(()=>0),this.orderPreview$=null,this.downloadPreview$=null,this.pageTitle.update(()=>"Download to POS")}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=V({type:o,selectors:[["app-download-v2"]],viewQuery:function(n,i){if(n&1&&ue(St,5),n&2){let d;he(d=fe())&&(i.stepper=d.first)}},standalone:!0,features:[Q([z,{provide:Ye,useValue:{displayDefaultIndicatorType:!1}}]),O],decls:27,vars:21,consts:[["stepper",""],[3,"hideSearchBox","hideSearchDropdown","headerTitle","description"],["routerLink","/menu/Order/Download/V1",1,"btn","btn-outline-secondary","btn-fill","me-3"],[1,"btn-group","me-3"],["type","button",1,"btn","btn-outline-secondary","btn-fill","me-3","bg-success","text-white",3,"disabled"],[1,"btn","btn-outline-secondary","btn-fill"],[1,"container-fluid","pt-5","mt-5"],[1,"row"],[1,"col-12"],[1,"d-flex","justify-content-center"],["linear","",1,"w-100","stepper-download",3,"selectedIndexChange","ngClass","selectedIndex"],["state","filter",3,"completed","editable"],["matStepLabel",""],[1,"w-100",3,"onFilterChange","reset"],["state","preview",3,"editable","completed"],[4,"ngIf"],["state","finish"],["matStepperIcon","filter"],["matStepperIcon","preview"],["matStepperIcon","finish"],[1,"btn","btn-outline-secondary",3,"click"],["type","button",1,"btn","btn-outline-secondary","bg-success","text-white",3,"click","disabled"],["type","button",1,"btn","btn-outline-secondary","btn-fill","me-3","bg-success","text-white",3,"click","disabled"],[1,"btn","btn-outline-secondary","btn-fill",3,"click"],["aria-hidden","true",1,"fa","fa-file-alt","me-2"],[1,"fa-solid","fa-filter","me-3"],[1,"fa-solid","fa-file","me-3"],[3,"onExportOrders","orderPreview"],[1,"fa-solid","fa-flag","me-3"],[3,"downloadResult"]],template:function(n,i){if(n&1){let d=x();r(0,"mainpanel",1)(1,"actions"),w(2,Ct,2,0,"a",2)(3,vt,5,1,"div",3)(4,yt,2,1,"button",4)(5,xt,3,0,"button",5),a(),r(6,"content")(7,"div",6)(8,"div",7)(9,"div",8)(10,"div",9)(11,"mat-stepper",10,0),M("selectedIndexChange",function(_){return c(d),I(i.stepperSelectedIndex,_)||(i.stepperSelectedIndex=_),u(_)}),r(13,"mat-step",11),w(14,Dt,3,0,"ng-template",12),r(15,"filter-step",13),S("onFilterChange",function(_){return c(d),u(i.onFilterChange(_))}),a()(),r(16,"mat-step",14),w(17,Tt,3,0,"ng-template",12)(18,bt,2,1,"ng-container",15),L(19,"async"),a(),r(20,"mat-step",16),w(21,Et,3,0,"ng-template",12)(22,Pt,2,1,"ng-container",15),L(23,"async"),a(),w(24,It,2,0,"ng-template",17)(25,Mt,2,0,"ng-template",18)(26,Vt,2,0,"ng-template",19),a()()()()()()()}if(n&2){let d=b(12);m("hideSearchBox",!0)("hideSearchDropdown",!0)("headerTitle",i.pageTitle())("description",i.pageTitle()),l(2),E(i.stepperSelectedIndex()==0?2:-1),l(),E(i.stepperSelectedIndex()==1?3:-1),l(),E(i.stepperSelectedIndex()==0?4:-1),l(),E(i.stepperSelectedIndex()==2?5:-1),l(6),me("ngClass","last-edited-step-"+d.selectedIndex),P("selectedIndex",i.stepperSelectedIndex),l(2),m("completed",!1)("editable",i.stepperSelectedIndex()!=2),l(2),m("reset",i.isResetFilter()),l(),m("editable",i.stepperSelectedIndex()!=2)("completed",!1),l(2),m("ngIf",U(19,17,i.orderPreview$)),l(4),m("ngIf",U(23,19,i.downloadPreview$))}},dependencies:[k,B,$,X,qe,Xe,Ze,He,je,Ge,Ke,Ue,Oe,Fe,Ce,Se],styles:[`@import"https://fonts.googleapis.com/icon?family=Material+Icons";.vertical-radio{display:flex;flex-direction:column;margin:15px 0}.mt-1rem{margin-top:1rem}.dateRange{padding-top:.8rem;padding-bottom:.8rem}mat-stepper.stepper-download>div.mat-horizontal-stepper-wrapper>div.mat-horizontal-stepper-header-container{position:relative;width:60%;left:18%}mat-stepper.stepper-download>div.mat-horizontal-stepper-wrapper>div.mat-horizontal-content-container>div.mat-horizontal-stepper-content:nth-child(1){display:flex;justify-content:left}mat-stepper.stepper-download>div.mat-horizontal-stepper-wrapper>div.mat-horizontal-content-container{margin-top:30px}mat-stepper.stepper-download>div.mat-horizontal-stepper-wrapper>div.mat-horizontal-stepper-header-container>mat-step-header.mat-horizontal-stepper-header{pointer-events:none!important}.form-label-group.radio.download-type{height:45.5938px!important;border-radius:.375rem!important}
@@ -1,2 +1,2 @@
1
- import{a as Ve}from"./chunk-OSSJKXND.js";import"./chunk-LRU7GIXZ.js";import{a as L}from"./chunk-WTR5UFZI.js";import{a as H}from"./chunk-XHAXYWZ7.js";import{a as Pe,b as De,c as G}from"./chunk-RDHVV7FZ.js";import"./chunk-BVIRHZTZ.js";import{b as Me}from"./chunk-DR4IU4JY.js";import{a as Ee}from"./chunk-N6IHFFFZ.js";import{a as Te,b as Fe}from"./chunk-PD4CUVAW.js";import"./chunk-IJYSJN63.js";import"./chunk-X5Q6FPWS.js";import"./chunk-46AOM3SM.js";import"./chunk-OULUJ2IO.js";import"./chunk-GCKSYCMI.js";import{a as we}from"./chunk-YIB7FZAQ.js";import"./chunk-ADRVUMMW.js";import{a as be}from"./chunk-3QG5QJ5P.js";import"./chunk-HCDKYABV.js";import{e as ge}from"./chunk-CCXKODFV.js";import{i as Ce}from"./chunk-HK66WK22.js";import{b as de,e as ue}from"./chunk-4SAJUEHO.js";import"./chunk-KCDL7SWP.js";import{d as Se,l as ye,m as ve,n as Ie}from"./chunk-BO4PPSB5.js";import{t as fe,u as xe}from"./chunk-HUUFOAKH.js";import"./chunk-E5GGIVK7.js";import{b as re,c as se,h as pe,m as ce,o as me,y as _e}from"./chunk-BSN7ZAXG.js";import{c as v,f as he}from"./chunk-6SF7AUOH.js";import"./chunk-OVEJFFL6.js";import{$b as f,Bd as ae,Cd as le,Da as _,Ea as d,Eb as u,G as Y,Gb as m,Gc as h,Hc as x,Ic as N,Jc as z,Nb as I,Ob as U,Qb as $,Rb as j,Sb as a,Tb as r,Ub as S,Vb as D,Wb as V,Yb as y,Z as A,bc as l,ea as W,ec as q,gb as P,jb as s,kb as w,mc as Q,nc as c,oc as k,pa as K,pc as M,rc as b,sc as T,sd as ee,ta as Z,tc as F,uc as X,ud as te,vc as J,vd as ne,xb as O,xc as R,yd as ie,zd as oe}from"./chunk-PQDPS2ID.js";import{a as B}from"./chunk-GNOSNGXM.js";var Ne=o=>({"text-decoration-line-through":o}),Le=o=>({"ms-10":o}),Be=o=>({"bg-gradient-warning":o});function Ae(o,p){if(o&1){let e=y();a(0,"button",38),f("click",function(){_(e);let t=l().ngIf,i=l(2);return d(i.updateStock(t))}),S(1,"i",39),c(2," Update "),r()}}function We(o,p){if(o&1){let e=y();a(0,"div"),u(1,Ae,3,0,"button",35),a(2,"button",36),f("click",function(){_(e);let t=l(2);return d(t.openExportDialog())}),S(3,"i",37),a(4,"span"),c(5,"Export"),r()()()}if(o&2){let e=p.ngIf,n=l(2);s(),m("ngIf",n.productService.hasSelectionVariant(e))}}function Oe(o,p){o&1&&(a(0,"div",40)(1,"span"),c(2," showing only different stock, please press next to populate more data "),r()())}function Ue(o,p){if(o&1){let e=y();a(0,"th")(1,"input",41),F("ngModelChange",function(t){_(e);let i=l(2);return T(i.checkboxState,t)||(i.checkboxState=t),d(t)}),f("ngModelChange",function(){let t=_(e).ngIf,i=l(2);return d(i.onCheckboxStateChange(t))}),r()()}if(o&2){let e=l(2);s(),b("ngModel",e.checkboxState)}}function $e(o,p){o&1&&(a(0,"th",32),c(1," Reserved "),r())}function je(o,p){}function Qe(o,p){if(o&1){let e=y();a(0,"input",60),F("ngModelChange",function(t){_(e);let i=l(3).$implicit;return T(i.selected,t)||(i.selected=t),d(t)}),f("ngModelChange",function(){_(e);let t=l(3).$implicit,i=l(2);return d(i.onCheckboxStateProduct(t))}),r()}if(o&2){let e=l(3).$implicit;b("ngModel",e.selected)}}function ze(o,p){if(o&1){let e=y();a(0,"img",61),f("click",function(t){_(e);let i=l(3).$implicit,C=l(2);return d(C.onZoomImage(t,i==null?null:i.ImageUrl))}),r()}if(o&2){let e=l(3).$implicit;q("src",e==null?null:e.ThumbnailUrl,P)}}function Ge(o,p){o&1&&S(0,"img",57)}function He(o,p){if(o&1&&(S(0,"br"),a(1,"div",62),S(2,"i",63),a(3,"small"),c(4),r()()),o&2){let e=l(3).$implicit;s(4),M("(",e==null?null:e.Category,")")}}function Ye(o,p){if(o&1&&(a(0,"td",53)(1,"div",14),u(2,Qe,1,1,"input",54),a(3,"div",55),u(4,ze,1,1,"img",56)(5,Ge,1,0,"img",57),r()()(),a(6,"td",58)(7,"span",59),c(8),r(),u(9,He,5,1),r()),o&2){let e=l(2).$implicit,n=l(2);m("rowSpan",e==null?null:e.Variants.length),s(2),I(e.Variants.length>1?2:-1),s(),m("ngClass",R(7,Le,e.Variants.length<=1)),s(),I(e!=null&&e.ThumbnailUrl?4:5),s(2),m("rowSpan",e==null?null:e.Variants.length),s(2),k(e==null?null:e.Name),s(),I(e.CategoryID!==null&&e.CategoryID!=n.guidEmpty?9:-1)}}function Ke(o,p){if(o&1){let e=y();a(0,"input",41),F("ngModelChange",function(t){_(e);let i=l(2).$implicit;return T(i.selected,t)||(i.selected=t),d(t)}),r()}if(o&2){let e=l(2).$implicit;b("ngModel",e.selected)}}function Ze(o,p){if(o&1&&u(0,Ke,1,1,"input",47),o&2){let e=l().$implicit;I((e==null?null:e.Inventory)<=1e5?0:-1)}}function qe(o,p){if(o&1){let e=y();a(0,"input",41),F("ngModelChange",function(t){_(e);let i=l().$implicit;return T(i.selected,t)||(i.selected=t),d(t)}),r()}if(o&2){let e=l().$implicit;b("ngModel",e.selected)}}function Xe(o,p){o&1&&(a(0,"div",64),c(1," Not Found "),r())}function Je(o,p){if(o&1&&(a(0,"div")(1,"span",65),c(2),h(3,"number"),r(),c(4," => "),a(5,"span",66),c(6),h(7,"number"),r()()),o&2){let e=l().$implicit;s(2),M(" ",x(3,2,e==null||e.I==null?null:e.I.Available),""),s(4),k(x(7,4,e==null?null:e.Inventory))}}function et(o,p){if(o&1&&(c(0),h(1,"number")),o&2){let e=l().$implicit;M(" ",x(1,1,e==null?null:e.Inventory)," ")}}function tt(o,p){if(o&1&&(D(0),a(1,"div",67)(2,"a",68),S(3,"i",69),r()(),V()),o&2){let e=l().$implicit,n=l(3);s(2),m("href",n.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(e==null?null:e.ID),P)}}function nt(o,p){if(o&1){let e=y();a(0,"span",74),f("click",function(){let t=_(e).ngIf,i=l(2).$implicit,C=l().$implicit,g=l(2);return d(g.openTableDialog(C,i,t))}),c(1),h(2,"number"),r()}if(o&2){let e=l(2).$implicit;s(),M(" ",x(2,1,e==null||e.Channel[0]==null?null:e.Channel[0].Inventory)," ")}}function it(o,p){if(o&1){let e=y();a(0,"td",70)(1,"div",48)(2,"div"),u(3,nt,3,3,"span",71),h(4,"async"),r(),a(5,"div",67)(6,"a",68),S(7,"i",69),r()(),a(8,"div",67)(9,"span",72),f("click",function(){_(e);let t=l().$implicit,i=l(3);return d(i.refreshInventory(t==null||t.Channel[0]==null?null:t.Channel[0].ChannelItemID,t==null||t.Channel[0]==null?null:t.Channel[0].ChannelVariationID,t==null||t.Channel[0]==null?null:t.Channel[0].ChannelID,t==null?null:t.ID))}),S(10,"i",73),r()()()()}if(o&2){let e=l().$implicit,n=l(3);m("ngClass",R(5,Be,(e==null?null:e.Inventory)!=(e==null||e.Channel[0]==null?null:e.Channel[0].Inventory))),s(3),m("ngIf",x(4,3,n.products$)),s(3),m("href",e==null||e.Channel[0]==null?null:e.Channel[0].Url,P)}}function ot(o,p){if(o&1&&(D(0),a(1,"span",75),c(2),h(3,"number"),r(),V()),o&2){let e=l(2).$implicit;s(2),M(" (",x(3,1,e==null||e.Channel[0]==null?null:e.Channel[0].InventoryReserved),") ")}}function at(o,p){o&1&&c(0," - ")}function lt(o,p){if(o&1&&(D(0),a(1,"td",44),u(2,ot,4,3,"ng-container",52)(3,at,1,0,"ng-template",null,1,z),r(),V()),o&2){let e=Q(4),n=l().$implicit;s(2),m("ngIf",n==null||n.Channel[0]==null?null:n.Channel[0].InventoryReserved)("ngIfElse",e)}}function rt(o,p){o&1&&(D(0),c(1," - "),V())}function st(o,p){if(o&1&&(a(0,"span",76),h(1,"date"),c(2),h(3,"date"),r()),o&2){let e=l().$implicit;m("matTooltip",N(1,2,e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync,"dd MMMM yyyy HH:mm:ss")),s(2),M(" ",N(3,5,e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync,"dd MMM yy HH:mm")," ")}}function pt(o,p){if(o&1&&(a(0,"tr"),u(1,Ye,10,9),a(2,"td",43),c(3),r(),a(4,"td",44)(5,"span",45),c(6),r()(),a(7,"td",46),u(8,Ze,1,1)(9,qe,1,1,"input",47),r(),a(10,"td")(11,"div",48),u(12,Xe,2,0,"div",49)(13,Je,8,6,"div")(14,et,2,3)(15,tt,4,1,"ng-container",5),r()(),u(16,it,11,7,"td",50)(17,lt,5,2,"ng-container",5),a(18,"td",51),u(19,rt,2,0,"ng-container",52)(20,st,4,8,"ng-template",null,0,z),r()()),o&2){let e=p.$implicit,n=p.index,t=Q(21),i=l(3);s(),I(n==0?1:-1),s(2),k(e==null?null:e.Model),s(2),m("matTooltip",e.Discontinued?i.discontinuedVariantMsg:"")("ngClass",R(14,Ne,e.Discontinued)),s(),k(e==null?null:e.Code),s(2),I((e==null?null:e.Channel[0].TypeID)==1?8:(e==null?null:e.Inventory)>=0?9:-1),s(4),m("ngIf",(e==null?null:e.I)==null),s(),I((e==null?null:e.I)!=null&&(e==null?null:e.Inventory)!=(e==null||e.I==null?null:e.I.Available)?13:-1),s(),I((e==null?null:e.Inventory)==(e==null||e.I==null?null:e.I.Available)?14:-1),s(),m("ngIf",(e==null?null:e.I)!=null),s(),m("ngIf",e==null?null:e.Channel),s(),m("ngIf",i.isShowReservedColumn),s(2),m("ngIf",(e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync)==i.minDate)("ngIfElse",t)}}function ct(o,p){if(o&1&&(a(0,"tbody"),$(1,je,0,0,null,null,U),u(3,pt,22,16,"tr",42),r()),o&2){let e=p.$implicit;s(),j(e.Variants),s(2),m("ngForOf",e.Variants)}}function mt(o,p){if(o&1){let e=y();a(0,"mainpanel",3),f("onSubmit",function(t){_(e);let i=l();return d(i.onSearch(t))}),a(1,"actions")(2,"div",4),u(3,We,6,1,"div",5),h(4,"async"),r()(),a(5,"filters")(6,"div")(7,"label",6),c(8,"Channel"),r(),a(9,"multiwarehouse-tree-select",7),f("onChannelChange",function(t){_(e);let i=l();return d(i.onChannelChange(t))}),r()(),a(10,"div",8)(11,"label",9),c(12,"PageNumber"),r(),a(13,"input",10),F("ngModelChange",function(t){_(e);let i=l();return T(i.searchFilter.PageNumber,t)||(i.searchFilter.PageNumber=t),d(t)}),r()(),a(14,"div",8)(15,"label",11),c(16,"Page Size"),r(),a(17,"input",12),F("ngModelChange",function(t){_(e);let i=l();return T(i.searchFilter.RowCount,t)||(i.searchFilter.RowCount=t),d(t)}),r()(),a(18,"div",8)(19,"label",13),c(20,"Quantity From - To"),r(),a(21,"div",14)(22,"input",15),F("ngModelChange",function(t){_(e);let i=l();return T(i.searchFilter.QuantityFrom,t)||(i.searchFilter.QuantityFrom=t),d(t)}),r(),c(23," - "),a(24,"input",16),F("ngModelChange",function(t){_(e);let i=l();return T(i.searchFilter.QuantityTo,t)||(i.searchFilter.QuantityTo=t),d(t)}),r()()()(),a(25,"content")(26,"div",17)(27,"div",18)(28,"div",19),u(29,Oe,3,0,"div",20),a(30,"table",21)(31,"thead",22)(32,"tr")(33,"th",23),c(34," Product "),S(35,"br"),a(36,"mat-slide-toggle",24),f("toggleChange",function(){_(e);let t=l();return t.showDifferenceStock=!t.showDifferenceStock,d(t.onShowDifferenceStock())}),a(37,"small",13),c(38,"FILTER DIFFERENT INVENTORY"),r()()(),a(39,"th",25),c(40,"Variant"),r(),a(41,"th",26),c(42,"SKU"),r(),u(43,Ue,2,1,"th",5),h(44,"async"),a(45,"th",27),c(46,"POS"),r(),a(47,"th",28)(48,"div",29),f("click",function(){_(e);let t=l();return d(t.openModalFilter())}),S(49,"img",30),a(50,"span",31),c(51),h(52,"stringLimit"),r()()(),u(53,$e,2,0,"th",32),a(54,"th",33),c(55,"Last Sync"),r()()(),$(56,ct,4,1,"tbody",null,U),h(58,"async"),r(),a(59,"infinite-paginator",34),h(60,"async"),f("onNextPage",function(){_(e);let t=l();return d(t.infinitePagination.onNextPage(t.searchFilter))})("onLastPage",function(){_(e);let t=l();return d(t.infinitePagination.onLastPage(t.searchFilter))})("onGetRowCount",function(){_(e);let t=l();return d(t.infinitePagination.getRowCount(t.searchFilter))}),r()()()()()()}if(o&2){let e,n,t,i=l();m("headerTitle","Inventory Comparison")("pageData",i.pageData)("hideSearchBox",!1),s(3),m("ngIf",x(4,21,i.products$)),s(6),m("ngModel",(i.searchFilter==null?null:i.searchFilter.LocationID)||(i.searchFilter==null?null:i.searchFilter.ChannelID)),s(4),b("ngModel",i.searchFilter.PageNumber),s(4),b("ngModel",i.searchFilter.RowCount),s(5),b("ngModel",i.searchFilter.QuantityFrom),s(2),b("ngModel",i.searchFilter.QuantityTo),s(5),m("ngIf",(i.searchFilter==null?null:i.searchFilter.filterModel)==3),s(14),m("ngIf",x(44,23,i.products$)),s(5),m("matTooltip",((e=i.channelIdentity())==null||e.label==null?null:e.label.length)>13?(e=i.channelIdentity())==null?null:e.label:""),s(),m("src",(n=i.channelIdentity())==null?null:n.img,P),s(2),M(" ",N(52,25,(t=i.channelIdentity())==null?null:t.label,13)," "),s(2),I(i.isShowReservedColumn?53:-1),s(3),j(x(58,28,i.products$)),s(3),m("totalData",i.infinitePagination.totalData())("hideCount",i.infinitePagination.hideCount())("rowCount",x(60,30,i.infinitePagination.totalRowCount$))("pageNumber",i.infinitePagination.pageNumber())("disableNextButton",i.infinitePagination.disableNextButton())("goToLastPage",i.infinitePagination.isLastPage())}}var Kt=(()=>{let p=class p{constructor(n,t,i,C,g,E,ke,Re){this.http=n,this.toastr=t,this.dialog=i,this.productService=C,this.authService=g,this.biggerPictureService=E,this.inventoryService=ke,this.mainPanelService=Re,this.infinitePagination=K(G),this.checkboxState=!1,this.showDifferenceStock=!1,this.loaderApi="InventoryLoader/Load",this.fetchApi="Inventory/GetSingleChannelComparison",this.rowCountApi="Inventory/GetInventoryByChannelRowCount",this.minDate=v.MinDate,this.isShowReservedColumn=!0,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.guidEmpty=v.GuidEMpty,this.selectedChannel=O(null),this.channelIdentity=O({img:null,label:null}),this.pageData={Title:"Inventory Realtime",Nav:[{Title:"Inventory Cache",Url:"/menu/inventory",Active:!1},{Title:"Inventory Realtime",Url:"/menu/inventory/realtime",Active:!0}]}}ngOnInit(){this.hostName=this.authService.getDomain(),this.initPageLoader(),this.products$=this.infinitePagination.data$.pipe(W(n=>{this.checkShowReservedColumn(n)}),A())}checkShowReservedColumn(n){let t=0,i;n.forEach(C=>{i=C.Variants.find(g=>v.IsNotEmpty(g?.Channel[0]?.InventoryReserved)),i&&(t+=1)}),this.isShowReservedColumn=t>0}initPageLoader(){this.infinitePagination.fetchDataEndpoint=this.fetchApi,this.infinitePagination.fethRowCountEndpoint=this.rowCountApi,this.loader$=this.http.post(`/api/${this.loaderApi}`,{}).pipe(A(1),W(n=>{this.searchFilter={RowCount:n.Filter.PageSize,filterModel:1,PageNumber:1,ChannelID:n.Filter.ChannelID,LocationID:n.Filter.LocationID},this.initReloadData(),this.showToastrMarketplaceInactive(!n.Filter.IsMarketplaceAppActive)}))}onChannelChange(n){let t=Object.assign({},n);this.selectedChannel.set(t),v.IsEmpty(this.channelIdentity()?.label)&&this.setChannelFilter()}setChannelFilter(){if(this.selectedChannel()){let n=Object.assign({},this.selectedChannel());v.IsNotEmpty(n.parent)?(this.searchFilter.LocationID=n.id,this.searchFilter.ChannelID=n?.parent?.id,n.label=n?.parent?.label+" - "+n?.label,n.img=v.getChannelLogoByTypeId(n?.parent?.typeid)):(this.searchFilter.LocationID=null,n.img=v.getChannelLogoByTypeId(n?.typeid),this.searchFilter.ChannelID=n?.id,this.selectedChannel.set(n)),this.channelIdentity.update(()=>({img:n.img,label:n.label}))}}initReloadData(){this.infinitePagination.reloadPagination(this.searchFilter)}showToastrMarketplaceInactive(n){n&&this.toastr.warning(`Automatic inventory sync disabled.
1
+ import{a as Ve}from"./chunk-OSSJKXND.js";import"./chunk-LRU7GIXZ.js";import{a as L}from"./chunk-WTR5UFZI.js";import{a as H}from"./chunk-XHAXYWZ7.js";import{a as Pe,b as De,c as G}from"./chunk-RDHVV7FZ.js";import"./chunk-BVIRHZTZ.js";import{b as Me}from"./chunk-DR4IU4JY.js";import{a as Ee}from"./chunk-N6IHFFFZ.js";import{a as Te,b as Fe}from"./chunk-PD4CUVAW.js";import"./chunk-IJYSJN63.js";import"./chunk-X5Q6FPWS.js";import"./chunk-46AOM3SM.js";import"./chunk-OULUJ2IO.js";import"./chunk-GCKSYCMI.js";import{a as we}from"./chunk-YIB7FZAQ.js";import"./chunk-ADRVUMMW.js";import{a as be}from"./chunk-3QG5QJ5P.js";import"./chunk-HCDKYABV.js";import{e as ge}from"./chunk-CCXKODFV.js";import{i as Ce}from"./chunk-EMO3QL6Q.js";import{b as de,e as ue}from"./chunk-4SAJUEHO.js";import"./chunk-KCDL7SWP.js";import{d as Se,l as ye,m as ve,n as Ie}from"./chunk-BO4PPSB5.js";import{t as fe,u as xe}from"./chunk-HUUFOAKH.js";import"./chunk-E5GGIVK7.js";import{b as re,c as se,h as pe,m as ce,o as me,y as _e}from"./chunk-BSN7ZAXG.js";import{c as v,f as he}from"./chunk-6SF7AUOH.js";import"./chunk-OVEJFFL6.js";import{$b as f,Bd as ae,Cd as le,Da as _,Ea as d,Eb as u,G as Y,Gb as m,Gc as h,Hc as x,Ic as N,Jc as z,Nb as I,Ob as U,Qb as $,Rb as j,Sb as a,Tb as r,Ub as S,Vb as D,Wb as V,Yb as y,Z as A,bc as l,ea as W,ec as q,gb as P,jb as s,kb as w,mc as Q,nc as c,oc as k,pa as K,pc as M,rc as b,sc as T,sd as ee,ta as Z,tc as F,uc as X,ud as te,vc as J,vd as ne,xb as O,xc as R,yd as ie,zd as oe}from"./chunk-PQDPS2ID.js";import{a as B}from"./chunk-GNOSNGXM.js";var Ne=o=>({"text-decoration-line-through":o}),Le=o=>({"ms-10":o}),Be=o=>({"bg-gradient-warning":o});function Ae(o,p){if(o&1){let e=y();a(0,"button",38),f("click",function(){_(e);let t=l().ngIf,i=l(2);return d(i.updateStock(t))}),S(1,"i",39),c(2," Update "),r()}}function We(o,p){if(o&1){let e=y();a(0,"div"),u(1,Ae,3,0,"button",35),a(2,"button",36),f("click",function(){_(e);let t=l(2);return d(t.openExportDialog())}),S(3,"i",37),a(4,"span"),c(5,"Export"),r()()()}if(o&2){let e=p.ngIf,n=l(2);s(),m("ngIf",n.productService.hasSelectionVariant(e))}}function Oe(o,p){o&1&&(a(0,"div",40)(1,"span"),c(2," showing only different stock, please press next to populate more data "),r()())}function Ue(o,p){if(o&1){let e=y();a(0,"th")(1,"input",41),F("ngModelChange",function(t){_(e);let i=l(2);return T(i.checkboxState,t)||(i.checkboxState=t),d(t)}),f("ngModelChange",function(){let t=_(e).ngIf,i=l(2);return d(i.onCheckboxStateChange(t))}),r()()}if(o&2){let e=l(2);s(),b("ngModel",e.checkboxState)}}function $e(o,p){o&1&&(a(0,"th",32),c(1," Reserved "),r())}function je(o,p){}function Qe(o,p){if(o&1){let e=y();a(0,"input",60),F("ngModelChange",function(t){_(e);let i=l(3).$implicit;return T(i.selected,t)||(i.selected=t),d(t)}),f("ngModelChange",function(){_(e);let t=l(3).$implicit,i=l(2);return d(i.onCheckboxStateProduct(t))}),r()}if(o&2){let e=l(3).$implicit;b("ngModel",e.selected)}}function ze(o,p){if(o&1){let e=y();a(0,"img",61),f("click",function(t){_(e);let i=l(3).$implicit,C=l(2);return d(C.onZoomImage(t,i==null?null:i.ImageUrl))}),r()}if(o&2){let e=l(3).$implicit;q("src",e==null?null:e.ThumbnailUrl,P)}}function Ge(o,p){o&1&&S(0,"img",57)}function He(o,p){if(o&1&&(S(0,"br"),a(1,"div",62),S(2,"i",63),a(3,"small"),c(4),r()()),o&2){let e=l(3).$implicit;s(4),M("(",e==null?null:e.Category,")")}}function Ye(o,p){if(o&1&&(a(0,"td",53)(1,"div",14),u(2,Qe,1,1,"input",54),a(3,"div",55),u(4,ze,1,1,"img",56)(5,Ge,1,0,"img",57),r()()(),a(6,"td",58)(7,"span",59),c(8),r(),u(9,He,5,1),r()),o&2){let e=l(2).$implicit,n=l(2);m("rowSpan",e==null?null:e.Variants.length),s(2),I(e.Variants.length>1?2:-1),s(),m("ngClass",R(7,Le,e.Variants.length<=1)),s(),I(e!=null&&e.ThumbnailUrl?4:5),s(2),m("rowSpan",e==null?null:e.Variants.length),s(2),k(e==null?null:e.Name),s(),I(e.CategoryID!==null&&e.CategoryID!=n.guidEmpty?9:-1)}}function Ke(o,p){if(o&1){let e=y();a(0,"input",41),F("ngModelChange",function(t){_(e);let i=l(2).$implicit;return T(i.selected,t)||(i.selected=t),d(t)}),r()}if(o&2){let e=l(2).$implicit;b("ngModel",e.selected)}}function Ze(o,p){if(o&1&&u(0,Ke,1,1,"input",47),o&2){let e=l().$implicit;I((e==null?null:e.Inventory)<=1e5?0:-1)}}function qe(o,p){if(o&1){let e=y();a(0,"input",41),F("ngModelChange",function(t){_(e);let i=l().$implicit;return T(i.selected,t)||(i.selected=t),d(t)}),r()}if(o&2){let e=l().$implicit;b("ngModel",e.selected)}}function Xe(o,p){o&1&&(a(0,"div",64),c(1," Not Found "),r())}function Je(o,p){if(o&1&&(a(0,"div")(1,"span",65),c(2),h(3,"number"),r(),c(4," => "),a(5,"span",66),c(6),h(7,"number"),r()()),o&2){let e=l().$implicit;s(2),M(" ",x(3,2,e==null||e.I==null?null:e.I.Available),""),s(4),k(x(7,4,e==null?null:e.Inventory))}}function et(o,p){if(o&1&&(c(0),h(1,"number")),o&2){let e=l().$implicit;M(" ",x(1,1,e==null?null:e.Inventory)," ")}}function tt(o,p){if(o&1&&(D(0),a(1,"div",67)(2,"a",68),S(3,"i",69),r()(),V()),o&2){let e=l().$implicit,n=l(3);s(2),m("href",n.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(e==null?null:e.ID),P)}}function nt(o,p){if(o&1){let e=y();a(0,"span",74),f("click",function(){let t=_(e).ngIf,i=l(2).$implicit,C=l().$implicit,g=l(2);return d(g.openTableDialog(C,i,t))}),c(1),h(2,"number"),r()}if(o&2){let e=l(2).$implicit;s(),M(" ",x(2,1,e==null||e.Channel[0]==null?null:e.Channel[0].Inventory)," ")}}function it(o,p){if(o&1){let e=y();a(0,"td",70)(1,"div",48)(2,"div"),u(3,nt,3,3,"span",71),h(4,"async"),r(),a(5,"div",67)(6,"a",68),S(7,"i",69),r()(),a(8,"div",67)(9,"span",72),f("click",function(){_(e);let t=l().$implicit,i=l(3);return d(i.refreshInventory(t==null||t.Channel[0]==null?null:t.Channel[0].ChannelItemID,t==null||t.Channel[0]==null?null:t.Channel[0].ChannelVariationID,t==null||t.Channel[0]==null?null:t.Channel[0].ChannelID,t==null?null:t.ID))}),S(10,"i",73),r()()()()}if(o&2){let e=l().$implicit,n=l(3);m("ngClass",R(5,Be,(e==null?null:e.Inventory)!=(e==null||e.Channel[0]==null?null:e.Channel[0].Inventory))),s(3),m("ngIf",x(4,3,n.products$)),s(3),m("href",e==null||e.Channel[0]==null?null:e.Channel[0].Url,P)}}function ot(o,p){if(o&1&&(D(0),a(1,"span",75),c(2),h(3,"number"),r(),V()),o&2){let e=l(2).$implicit;s(2),M(" (",x(3,1,e==null||e.Channel[0]==null?null:e.Channel[0].InventoryReserved),") ")}}function at(o,p){o&1&&c(0," - ")}function lt(o,p){if(o&1&&(D(0),a(1,"td",44),u(2,ot,4,3,"ng-container",52)(3,at,1,0,"ng-template",null,1,z),r(),V()),o&2){let e=Q(4),n=l().$implicit;s(2),m("ngIf",n==null||n.Channel[0]==null?null:n.Channel[0].InventoryReserved)("ngIfElse",e)}}function rt(o,p){o&1&&(D(0),c(1," - "),V())}function st(o,p){if(o&1&&(a(0,"span",76),h(1,"date"),c(2),h(3,"date"),r()),o&2){let e=l().$implicit;m("matTooltip",N(1,2,e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync,"dd MMMM yyyy HH:mm:ss")),s(2),M(" ",N(3,5,e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync,"dd MMM yy HH:mm")," ")}}function pt(o,p){if(o&1&&(a(0,"tr"),u(1,Ye,10,9),a(2,"td",43),c(3),r(),a(4,"td",44)(5,"span",45),c(6),r()(),a(7,"td",46),u(8,Ze,1,1)(9,qe,1,1,"input",47),r(),a(10,"td")(11,"div",48),u(12,Xe,2,0,"div",49)(13,Je,8,6,"div")(14,et,2,3)(15,tt,4,1,"ng-container",5),r()(),u(16,it,11,7,"td",50)(17,lt,5,2,"ng-container",5),a(18,"td",51),u(19,rt,2,0,"ng-container",52)(20,st,4,8,"ng-template",null,0,z),r()()),o&2){let e=p.$implicit,n=p.index,t=Q(21),i=l(3);s(),I(n==0?1:-1),s(2),k(e==null?null:e.Model),s(2),m("matTooltip",e.Discontinued?i.discontinuedVariantMsg:"")("ngClass",R(14,Ne,e.Discontinued)),s(),k(e==null?null:e.Code),s(2),I((e==null?null:e.Channel[0].TypeID)==1?8:(e==null?null:e.Inventory)>=0?9:-1),s(4),m("ngIf",(e==null?null:e.I)==null),s(),I((e==null?null:e.I)!=null&&(e==null?null:e.Inventory)!=(e==null||e.I==null?null:e.I.Available)?13:-1),s(),I((e==null?null:e.Inventory)==(e==null||e.I==null?null:e.I.Available)?14:-1),s(),m("ngIf",(e==null?null:e.I)!=null),s(),m("ngIf",e==null?null:e.Channel),s(),m("ngIf",i.isShowReservedColumn),s(2),m("ngIf",(e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync)==i.minDate)("ngIfElse",t)}}function ct(o,p){if(o&1&&(a(0,"tbody"),$(1,je,0,0,null,null,U),u(3,pt,22,16,"tr",42),r()),o&2){let e=p.$implicit;s(),j(e.Variants),s(2),m("ngForOf",e.Variants)}}function mt(o,p){if(o&1){let e=y();a(0,"mainpanel",3),f("onSubmit",function(t){_(e);let i=l();return d(i.onSearch(t))}),a(1,"actions")(2,"div",4),u(3,We,6,1,"div",5),h(4,"async"),r()(),a(5,"filters")(6,"div")(7,"label",6),c(8,"Channel"),r(),a(9,"multiwarehouse-tree-select",7),f("onChannelChange",function(t){_(e);let i=l();return d(i.onChannelChange(t))}),r()(),a(10,"div",8)(11,"label",9),c(12,"PageNumber"),r(),a(13,"input",10),F("ngModelChange",function(t){_(e);let i=l();return T(i.searchFilter.PageNumber,t)||(i.searchFilter.PageNumber=t),d(t)}),r()(),a(14,"div",8)(15,"label",11),c(16,"Page Size"),r(),a(17,"input",12),F("ngModelChange",function(t){_(e);let i=l();return T(i.searchFilter.RowCount,t)||(i.searchFilter.RowCount=t),d(t)}),r()(),a(18,"div",8)(19,"label",13),c(20,"Quantity From - To"),r(),a(21,"div",14)(22,"input",15),F("ngModelChange",function(t){_(e);let i=l();return T(i.searchFilter.QuantityFrom,t)||(i.searchFilter.QuantityFrom=t),d(t)}),r(),c(23," - "),a(24,"input",16),F("ngModelChange",function(t){_(e);let i=l();return T(i.searchFilter.QuantityTo,t)||(i.searchFilter.QuantityTo=t),d(t)}),r()()()(),a(25,"content")(26,"div",17)(27,"div",18)(28,"div",19),u(29,Oe,3,0,"div",20),a(30,"table",21)(31,"thead",22)(32,"tr")(33,"th",23),c(34," Product "),S(35,"br"),a(36,"mat-slide-toggle",24),f("toggleChange",function(){_(e);let t=l();return t.showDifferenceStock=!t.showDifferenceStock,d(t.onShowDifferenceStock())}),a(37,"small",13),c(38,"FILTER DIFFERENT INVENTORY"),r()()(),a(39,"th",25),c(40,"Variant"),r(),a(41,"th",26),c(42,"SKU"),r(),u(43,Ue,2,1,"th",5),h(44,"async"),a(45,"th",27),c(46,"POS"),r(),a(47,"th",28)(48,"div",29),f("click",function(){_(e);let t=l();return d(t.openModalFilter())}),S(49,"img",30),a(50,"span",31),c(51),h(52,"stringLimit"),r()()(),u(53,$e,2,0,"th",32),a(54,"th",33),c(55,"Last Sync"),r()()(),$(56,ct,4,1,"tbody",null,U),h(58,"async"),r(),a(59,"infinite-paginator",34),h(60,"async"),f("onNextPage",function(){_(e);let t=l();return d(t.infinitePagination.onNextPage(t.searchFilter))})("onLastPage",function(){_(e);let t=l();return d(t.infinitePagination.onLastPage(t.searchFilter))})("onGetRowCount",function(){_(e);let t=l();return d(t.infinitePagination.getRowCount(t.searchFilter))}),r()()()()()()}if(o&2){let e,n,t,i=l();m("headerTitle","Inventory Comparison")("pageData",i.pageData)("hideSearchBox",!1),s(3),m("ngIf",x(4,21,i.products$)),s(6),m("ngModel",(i.searchFilter==null?null:i.searchFilter.LocationID)||(i.searchFilter==null?null:i.searchFilter.ChannelID)),s(4),b("ngModel",i.searchFilter.PageNumber),s(4),b("ngModel",i.searchFilter.RowCount),s(5),b("ngModel",i.searchFilter.QuantityFrom),s(2),b("ngModel",i.searchFilter.QuantityTo),s(5),m("ngIf",(i.searchFilter==null?null:i.searchFilter.filterModel)==3),s(14),m("ngIf",x(44,23,i.products$)),s(5),m("matTooltip",((e=i.channelIdentity())==null||e.label==null?null:e.label.length)>13?(e=i.channelIdentity())==null?null:e.label:""),s(),m("src",(n=i.channelIdentity())==null?null:n.img,P),s(2),M(" ",N(52,25,(t=i.channelIdentity())==null?null:t.label,13)," "),s(2),I(i.isShowReservedColumn?53:-1),s(3),j(x(58,28,i.products$)),s(3),m("totalData",i.infinitePagination.totalData())("hideCount",i.infinitePagination.hideCount())("rowCount",x(60,30,i.infinitePagination.totalRowCount$))("pageNumber",i.infinitePagination.pageNumber())("disableNextButton",i.infinitePagination.disableNextButton())("goToLastPage",i.infinitePagination.isLastPage())}}var Kt=(()=>{let p=class p{constructor(n,t,i,C,g,E,ke,Re){this.http=n,this.toastr=t,this.dialog=i,this.productService=C,this.authService=g,this.biggerPictureService=E,this.inventoryService=ke,this.mainPanelService=Re,this.infinitePagination=K(G),this.checkboxState=!1,this.showDifferenceStock=!1,this.loaderApi="InventoryLoader/Load",this.fetchApi="Inventory/GetSingleChannelComparison",this.rowCountApi="Inventory/GetInventoryByChannelRowCount",this.minDate=v.MinDate,this.isShowReservedColumn=!0,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.guidEmpty=v.GuidEMpty,this.selectedChannel=O(null),this.channelIdentity=O({img:null,label:null}),this.pageData={Title:"Inventory Realtime",Nav:[{Title:"Inventory Cache",Url:"/menu/inventory",Active:!1},{Title:"Inventory Realtime",Url:"/menu/inventory/realtime",Active:!0}]}}ngOnInit(){this.hostName=this.authService.getDomain(),this.initPageLoader(),this.products$=this.infinitePagination.data$.pipe(W(n=>{this.checkShowReservedColumn(n)}),A())}checkShowReservedColumn(n){let t=0,i;n.forEach(C=>{i=C.Variants.find(g=>v.IsNotEmpty(g?.Channel[0]?.InventoryReserved)),i&&(t+=1)}),this.isShowReservedColumn=t>0}initPageLoader(){this.infinitePagination.fetchDataEndpoint=this.fetchApi,this.infinitePagination.fethRowCountEndpoint=this.rowCountApi,this.loader$=this.http.post(`/api/${this.loaderApi}`,{}).pipe(A(1),W(n=>{this.searchFilter={RowCount:n.Filter.PageSize,filterModel:1,PageNumber:1,ChannelID:n.Filter.ChannelID,LocationID:n.Filter.LocationID},this.initReloadData(),this.showToastrMarketplaceInactive(!n.Filter.IsMarketplaceAppActive)}))}onChannelChange(n){let t=Object.assign({},n);this.selectedChannel.set(t),v.IsEmpty(this.channelIdentity()?.label)&&this.setChannelFilter()}setChannelFilter(){if(this.selectedChannel()){let n=Object.assign({},this.selectedChannel());v.IsNotEmpty(n.parent)?(this.searchFilter.LocationID=n.id,this.searchFilter.ChannelID=n?.parent?.id,n.label=n?.parent?.label+" - "+n?.label,n.img=v.getChannelLogoByTypeId(n?.parent?.typeid)):(this.searchFilter.LocationID=null,n.img=v.getChannelLogoByTypeId(n?.typeid),this.searchFilter.ChannelID=n?.id,this.selectedChannel.set(n)),this.channelIdentity.update(()=>({img:n.img,label:n.label}))}}initReloadData(){this.infinitePagination.reloadPagination(this.searchFilter)}showToastrMarketplaceInactive(n){n&&this.toastr.warning(`Automatic inventory sync disabled.
2
2
  Please enable Dealpos X Marketplace Apps integration in POS Configuration`,"Warning")}onSearch(n){this.searchFilter.text=n,this.setChannelFilter(),this.initReloadData()}openModalFilter(){this.mainPanelService.openModalFilter()}updateStock(n){let t=this.productService.selectedVariantProduct(n);if(t.length>0){let i=this.searchFilter.LocationID,C=t.map(E=>B({ID:E.ID,Code:E.Code,Inventory:E.Inventory},v.IsNotEmpty(i)&&{LocationID:i})),g={ListChannelID:[this.searchFilter.ChannelID],List:C};this.http.post("/api/Inventory/UpdateChannel",g).subscribe(E=>{this.initReloadData(),this.checkboxState=!1,this.handlingUpdateStock(E)})}}handlingUpdateStock(n){if(n[0]?.Response){let t=n[0]?.Response?.Fail_list,i=n[0]?.Response?.Success_list;this.inventoryService.showToastrUpdateInventory("Stock",i,t)}else this.toastr.error(n[0]?.Exception,"Error")}refreshInventory(n,t,i,C){let g={ChannelItemID:n,ChannelVariationID:t,ChannelID:i,VariantID:C};this.http.post("/api/Inventory/RefreshInventoryChannel",g).subscribe(E=>{this.toastr.success("Successfully updated","Success"),this.initReloadData()})}onCheckboxStateProduct(n){n.Variants=n.Variants.map(t=>(t.Inventory>=0&&(t.selected=n.selected),t))}onCheckboxStateChange(n){n=n.map(t=>(t.Variants=t.Variants.map(i=>(i.selected=this.checkboxState,i)),t))}openTableDialog(n,t,i){this.dialog.open(Pe,{data:{Name:n.Name,Variant:t,ChannelID:t?.Channel[0].ChannelID,Table:"inventory",ChannelItemID:n.ChannelItemID}}).afterClosed().pipe(Y(g=>v.IsNotEmpty(g))).subscribe(g=>{this.updateItemAfterDialog(g)})}updateItemAfterDialog(n){let t=this.searchFilter.LocationID,i=B({ID:n.ChannelID,ChannelItemID:n.ChannelItemID,ChannelVariantID:n.ChannelVariationID,NewQuantity:parseFloat(n.Inventory),VariantID:n.ID,SKU:n.Sku},v.IsNotEmpty(t)&&{LocationID:t});this.http.post("/api/Inventory/UpdateQuantityByItem",i).subscribe(C=>{this.searchFilter.PageNumber=1,this.initReloadData(),this.handlingUpdateStock([C])})}openExportDialog(){this.dialog.open(Me,{data:{title:"Export Inventory Single Channel Comparison",pageNumber:this.searchFilter.PageNumber,rowCount:this.searchFilter.RowCount,filterExport:this.searchFilter,getRowCountApi:this.rowCountApi,QuantityFrom:this.searchFilter.QuantityFrom,QuantityTo:this.searchFilter.QuantityTo,exportApi:"Inventory/GetExportSingleChannelComparison"}}).afterClosed().subscribe()}onShowDifferenceStock(){this.showDifferenceStock?this.searchFilter.filterModel=H.DIFFERENCE:this.searchFilter.filterModel=H.ALL,this.initReloadData()}onZoomImage(n,t){this.biggerPictureService.openBiggerPicture(n,t)}};p.\u0275fac=function(t){return new(t||p)(w(ue),w(de),w(Se),w(we),w(Ce),w(be),w(L),w(ye))},p.\u0275cmp=Z({type:p,selectors:[["app-single-channel-comparison"]],standalone:!0,features:[X([G,L]),J],decls:2,vars:3,consts:[["SYNCDATE",""],["EMPTY_RESERVED",""],["textButton","Search",3,"headerTitle","pageData","hideSearchBox","onSubmit",4,"ngIf"],["textButton","Search",3,"onSubmit","headerTitle","pageData","hideSearchBox"],[1,"d-flex"],[4,"ngIf"],["for","channelOptions",1,"fw-bold","mb-2"],["id","channelOptions",3,"onChannelChange","ngModel"],[1,"mt-5"],["for","PageNumber",1,"fw-bold"],["type","number","id","PageNumber","placeholder","PageNumber","name","PageNumber","data-toggle","tooltip","matTooltip","Page Number",1,"mat-mdc-tooltip-trigger","form-control","ng-pristine","ng-valid","ng-touched","mt-3",3,"ngModelChange","ngModel"],["for","RowCount",1,"fw-bold"],["type","number","id","RowCount","placeholder","Page Size","name","RowCount","data-toggle","tooltip","matTooltip","Page Size",1,"mat-mdc-tooltip-trigger","form-control","ng-pristine","ng-valid","ng-touched","mt-3",3,"ngModelChange","ngModel"],[1,"fw-bold"],[1,"d-flex","align-items-center","justify-content-start"],["type","number","name","QuantityFrom",1,"w-25","me-2","mt-3","form-control",3,"ngModelChange","ngModel"],["type","number","name","QuantityTo",1,"w-25","ms-2","form-control","mt-2",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],["class","alert alert-warning d-flex justify-content-between text-dark","role","alert",4,"ngIf"],[1,"table","border-bottom"],[1,"thead-light","sticky-top-thead"],["scope","col","colspan","2",1,"text-center","ps-12",2,"width","25%"],[3,"toggleChange"],["scope","col",1,"text-start"],["scope","col",1,"text-end",2,"width","10%"],["scope","col",1,"text-end","w-10",2,"width","8%"],[1,"text-end",2,"width","150px"],["role","button","matTooltipPosition","above",1,"d-inline-block",3,"click","matTooltip"],[2,"width","16px",3,"src"],[1,"ms-1"],["matTooltip","Reserved Stock","matTooltipPosition","above",1,"text-end",2,"width","80px"],[1,"text-center",2,"width","145px"],[3,"onNextPage","onLastPage","onGetRowCount","totalData","hideCount","rowCount","pageNumber","disableNextButton","goToLastPage"],["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"],["role","alert",1,"alert","alert-warning","d-flex","justify-content-between","text-dark"],["type","checkbox",3,"ngModelChange","ngModel"],[4,"ngFor","ngForOf"],[1,"text-start"],[1,"text-end"],["matTooltipPosition","above",3,"matTooltip","ngClass"],[1,"align-middle"],["type","checkbox",3,"ngModel"],[1,"d-flex","align-items-center","justify-content-end"],["class","text-danger","matTooltip","This product is no longer available in POS","matTooltipPosition","above",4,"ngIf"],["class","text-end",3,"ngClass",4,"ngIf"],[1,"text-center"],[4,"ngIf","ngIfElse"],[1,"text-start",2,"width","0%",3,"rowSpan"],["type","checkbox",1,"me-3",3,"ngModel"],[3,"ngClass"],[1,"border","rounded","w-img","cursor-pointer",2,"margin-left","20px",3,"src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded","w-img",2,"margin-left","20px"],[1,"text-start",3,"rowSpan"],[1,"item-name","mb-0"],["type","checkbox",1,"me-3",3,"ngModelChange","ngModel"],[1,"border","rounded","w-img","cursor-pointer",2,"margin-left","20px",3,"click","src"],[1,"d-flex","align-items-center"],["title","Category",1,"fa-solid","fa-tags","me-2",2,"opacity","60%"],["matTooltip","This product is no longer available in POS","matTooltipPosition","above",1,"text-danger"],["title","Stock Available"],["title","Inventory below minimum inventory"],[1,"ms-3"],["target","_blank",3,"href"],[1,"fa-solid","fa-arrow-up-right-from-square","external-link-custom"],[1,"text-end",3,"ngClass"],["class","cursor",3,"click",4,"ngIf"],["matTooltip","Refresh stock according to seller center",1,"pl-5","cursor-pointer",2,"color","var(--bs-link-color)",3,"click"],[1,"fas","fa-sync","fa-lg","external-link-custom","pt-1"],[1,"cursor",3,"click"],[1,"text-danger"],["matTooltipShowDelay","500",3,"matTooltip"]],template:function(t,i){t&1&&(u(0,mt,61,32,"mainpanel",2),h(1,"async")),t&2&&m("ngIf",x(1,1,i.loader$))},dependencies:[le,ee,te,ne,ie,ae,oe,Ie,ve,ge,_e,se,me,re,pe,ce,Ee,De,he,Fe,Te,xe,fe,Ve],styles:[".w-10[_ngcontent-%COMP%]{width:10%}.w-img[_ngcontent-%COMP%]{width:40px;height:40px}.item-name[_ngcontent-%COMP%]{margin-bottom:-14px!important;font-size:larger}input[type=checkbox][_ngcontent-%COMP%]{width:15px;height:15px}"]});let o=p;return o})();export{Kt as SingleChannelComparisonComponent};
@@ -1 +1 @@
1
- import{a as T}from"./chunk-JP44SOP7.js";import{a as w}from"./chunk-YIB7FZAQ.js";import{i as j}from"./chunk-HK66WK22.js";import{b as D,e as d}from"./chunk-4SAJUEHO.js";import{b as a,c as g}from"./chunk-6SF7AUOH.js";import{o as U}from"./chunk-OVEJFFL6.js";import{B as A,G as C,J as l,g as P,ja as s,pa as c,q as u,v as b,xb as I}from"./chunk-PQDPS2ID.js";var E=(()=>{let o=class o{constructor(){this.httpService=c(d)}getAttributes(t,e){return this.httpService.get("api/product/shopee/GetAttributesTree",[{key:"ID",value:t},{key:"CategoryID",value:e}])}getCategories(t){return this.httpService.get("api/product/shopee/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/shopee/AddProduct",t).pipe(l(r=>u(null)))}generateAttribute(t){return t.map(e=>({attribute_id:e.attribute_id,attribute_value_list:e.attribute_value_list.map(r=>({value_id:r.value_id,name:r.name}))})),t}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var F=(()=>{let o=class o{constructor(){this.httpService=c(d)}getCategories(t){return this.httpService.get("api/product/tiktok/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/tiktok/AddProduct",t).pipe(l(r=>u(null)))}generateAttribute(t){let e;return t.map(r=>(r.type=="PRODUCT_PROPERTY"?e={id:r.id,name:r.name,type:r.type,values:r.values}:e={id:r.id,name:r.values[0].id,type:r.type},e))}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var x=(()=>{let o=class o{constructor(){this.httpService=c(d)}getAttributes(t,e){return this.httpService.get("api/product/lazada/GetAttributes",[{key:"ID",value:t},{key:"CategoryID",value:e}])}getCategories(t){return this.httpService.get("api/product/lazada/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/lazada/AddProduct",t).pipe(l(r=>u(null)))}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var H=(()=>{let o=class o{constructor(){this.httpService=c(d)}getAttributes(t,e){return this.httpService.get("api/product/woo/GetAttributes",[{key:"ID",value:t},{key:"CategoryID",value:e}])}getCategories(t){return this.httpService.get("api/product/woo/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/woo/AddProduct",t).pipe(l(r=>u(null)))}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var v=class{};var S=class{};var z=(()=>{let o=class o{constructor(){this.httpService=c(d)}getCategories(t){return this.httpService.get("api/product/tokopedia/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/tokopedia/AddProduct",t).pipe(l(r=>u(null)))}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var R=(()=>{let o=class o{constructor(){this.httpService=c(d)}uploadProduct(t){return this.httpService.post("api/product/shopify/AddProduct",t).pipe(l(r=>u(null)))}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ht=(()=>{let o=class o{constructor(){this.authService=c(j),this.productService=c(w),this.shoppeUploadService=c(E),this.tiktokUploadService=c(F),this.lazadaUploadService=c(x),this.tokopediaUploadService=c(z),this.wooUploadService=c(H),this.shopifyUploadService=c(R),this.toastrHandlingService=c(T),this.toastr=c(D),this.router=c(U),this.httpService=c(d),this._selectedProduct=new P(this.getStoredProducts()),this.selectedProduct$=this._selectedProduct.asObservable().pipe(C(t=>t&&t.length>0))}getStoredProducts(){let t=localStorage.getItem("productsUpload");if(t){let e=JSON.parse(t);return e&&e.length>0?e:[]}else return[]}setSelectedProduct(t){localStorage.setItem("productsUpload",JSON.stringify(t)),this._selectedProduct.next(t)}clearSelectedProduct(){localStorage.removeItem("productsUpload"),this._selectedProduct.next([])}getUnselectedChannels(){let t=this.authService.getChannels(),e=this._selectedProduct.getValue();return this.productService.filterUnselectedChannel(e,t)}getDefaultCategory(){return this.httpService.get("api/v1/Channel/ProductCategory/Default")}get channelProductUpload(){let t=this.getUnselectedChannels();return I(t.map(r=>{let p=new v;return p.id=r.ID,p.name=r.Name,p.type=r.TypeID,p.categoryId=null,p.attributes=[],p.selected=!1,p}))}onUploadProduct(t){let e=t.filter(r=>r.selected&&g.IsNotEmpty(r.categoryId)||r.selected&&r.type==a.Shopify);if(e.length>0){let r=this.generateDataForUpload(e);this.uploadProduct(r)}else this.toastr.warning("Please select a channel and category to upload the product.","Warning!")}uploadProduct(t){let e=this.generateObservableForUpload(t);A(e).pipe(b(r=>{let p=[];return r.forEach(m=>{p=[...p,...m]}),p})).subscribe({next:(r=[])=>{g.IsNotEmpty(r)&&this.toastrHandlingService.showToastrUploadMultiple(r),this.hasSuccessRes(r)&&this.onSuccessUpload()}})}hasSuccessRes(t){let e=!1;return t.forEach(r=>{r?.Response.Success_list?.length>0&&g.IsNotEmpty(r)&&(e=!0)}),e}onSuccessUpload(){this.router.navigate(["/menu/products/status/sold-in-channel"]),this.clearSelectedProduct()}generateObservableForUpload(t){let e=[],r=[],p=[],m=[],y=[],k=[];t.forEach(n=>{switch(n.ChannelType){case a.Shopee:r.push(n);break;case a.Tiktok:e.push(n);break;case a.Lazada:p.push(n);break;case a.Tokopedia:m.push(n);break;case a.WooCommerce:y.push(n);break;case a.Shopify:k.push(n);break}});let h=[];return[{type:a.Shopee,data:r},{type:a.Tiktok,data:e},{type:a.Lazada,data:p},{type:a.Tokopedia,data:m},{type:a.WooCommerce,data:y},{type:a.Shopify,data:k}].filter(n=>n.data.length>0).forEach(n=>{switch(n.type){case a.Shopee:h.push(this.shoppeUploadService.uploadProduct(r));break;case a.Tiktok:h.push(this.tiktokUploadService.uploadProduct(e));break;case a.Lazada:h.push(this.lazadaUploadService.uploadProduct(p));break;case a.Tokopedia:h.push(this.tokopediaUploadService.uploadProduct(m));break;case a.WooCommerce:h.push(this.wooUploadService.uploadProduct(y));break;case a.Shopify:h.push(this.shopifyUploadService.uploadProduct(k));break}}),h}generateDataForUpload(t){let e=[];return t.forEach(r=>{let p=new S;p.ChannelID=r.id,p.ChannelType=r.type,p.Products=this._selectedProduct.getValue(),r.type==a.Shopify?delete p.CategoryID:p.CategoryID=r.categoryId,r.type==a.WooCommerce||r.type==a.Shopify?p.Attribute=r.attributes[0]:p.Attributes=this.formatAttributes(r.type,r.attributes),e.push(p)}),e}formatAttributes(t,e){let r;switch(t){case a.Shopee:r=this.shoppeUploadService.generateAttribute(e);break;case a.Tiktok:r=this.tiktokUploadService.generateAttribute(e);break;case a.WooCommerce:r=this.tiktokUploadService.generateAttribute(e);break;case a.Tokopedia:r=e;break;case a.Shopify:r=e;break;default:r=[];break}return r}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();export{E as a,F as b,x as c,H as d,Ht as e};
1
+ import{a as T}from"./chunk-JP44SOP7.js";import{a as w}from"./chunk-YIB7FZAQ.js";import{i as j}from"./chunk-EMO3QL6Q.js";import{b as D,e as d}from"./chunk-4SAJUEHO.js";import{b as a,c as g}from"./chunk-6SF7AUOH.js";import{o as U}from"./chunk-OVEJFFL6.js";import{B as A,G as C,J as l,g as P,ja as s,pa as c,q as u,v as b,xb as I}from"./chunk-PQDPS2ID.js";var E=(()=>{let o=class o{constructor(){this.httpService=c(d)}getAttributes(t,e){return this.httpService.get("api/product/shopee/GetAttributesTree",[{key:"ID",value:t},{key:"CategoryID",value:e}])}getCategories(t){return this.httpService.get("api/product/shopee/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/shopee/AddProduct",t).pipe(l(r=>u(null)))}generateAttribute(t){return t.map(e=>({attribute_id:e.attribute_id,attribute_value_list:e.attribute_value_list.map(r=>({value_id:r.value_id,name:r.name}))})),t}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var F=(()=>{let o=class o{constructor(){this.httpService=c(d)}getCategories(t){return this.httpService.get("api/product/tiktok/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/tiktok/AddProduct",t).pipe(l(r=>u(null)))}generateAttribute(t){let e;return t.map(r=>(r.type=="PRODUCT_PROPERTY"?e={id:r.id,name:r.name,type:r.type,values:r.values}:e={id:r.id,name:r.values[0].id,type:r.type},e))}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var x=(()=>{let o=class o{constructor(){this.httpService=c(d)}getAttributes(t,e){return this.httpService.get("api/product/lazada/GetAttributes",[{key:"ID",value:t},{key:"CategoryID",value:e}])}getCategories(t){return this.httpService.get("api/product/lazada/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/lazada/AddProduct",t).pipe(l(r=>u(null)))}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var H=(()=>{let o=class o{constructor(){this.httpService=c(d)}getAttributes(t,e){return this.httpService.get("api/product/woo/GetAttributes",[{key:"ID",value:t},{key:"CategoryID",value:e}])}getCategories(t){return this.httpService.get("api/product/woo/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/woo/AddProduct",t).pipe(l(r=>u(null)))}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var v=class{};var S=class{};var z=(()=>{let o=class o{constructor(){this.httpService=c(d)}getCategories(t){return this.httpService.get("api/product/tokopedia/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/tokopedia/AddProduct",t).pipe(l(r=>u(null)))}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var R=(()=>{let o=class o{constructor(){this.httpService=c(d)}uploadProduct(t){return this.httpService.post("api/product/shopify/AddProduct",t).pipe(l(r=>u(null)))}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ht=(()=>{let o=class o{constructor(){this.authService=c(j),this.productService=c(w),this.shoppeUploadService=c(E),this.tiktokUploadService=c(F),this.lazadaUploadService=c(x),this.tokopediaUploadService=c(z),this.wooUploadService=c(H),this.shopifyUploadService=c(R),this.toastrHandlingService=c(T),this.toastr=c(D),this.router=c(U),this.httpService=c(d),this._selectedProduct=new P(this.getStoredProducts()),this.selectedProduct$=this._selectedProduct.asObservable().pipe(C(t=>t&&t.length>0))}getStoredProducts(){let t=localStorage.getItem("productsUpload");if(t){let e=JSON.parse(t);return e&&e.length>0?e:[]}else return[]}setSelectedProduct(t){localStorage.setItem("productsUpload",JSON.stringify(t)),this._selectedProduct.next(t)}clearSelectedProduct(){localStorage.removeItem("productsUpload"),this._selectedProduct.next([])}getUnselectedChannels(){let t=this.authService.getChannels(),e=this._selectedProduct.getValue();return this.productService.filterUnselectedChannel(e,t)}getDefaultCategory(){return this.httpService.get("api/v1/Channel/ProductCategory/Default")}get channelProductUpload(){let t=this.getUnselectedChannels();return I(t.map(r=>{let p=new v;return p.id=r.ID,p.name=r.Name,p.type=r.TypeID,p.categoryId=null,p.attributes=[],p.selected=!1,p}))}onUploadProduct(t){let e=t.filter(r=>r.selected&&g.IsNotEmpty(r.categoryId)||r.selected&&r.type==a.Shopify);if(e.length>0){let r=this.generateDataForUpload(e);this.uploadProduct(r)}else this.toastr.warning("Please select a channel and category to upload the product.","Warning!")}uploadProduct(t){let e=this.generateObservableForUpload(t);A(e).pipe(b(r=>{let p=[];return r.forEach(m=>{p=[...p,...m]}),p})).subscribe({next:(r=[])=>{g.IsNotEmpty(r)&&this.toastrHandlingService.showToastrUploadMultiple(r),this.hasSuccessRes(r)&&this.onSuccessUpload()}})}hasSuccessRes(t){let e=!1;return t.forEach(r=>{r?.Response.Success_list?.length>0&&g.IsNotEmpty(r)&&(e=!0)}),e}onSuccessUpload(){this.router.navigate(["/menu/products/status/sold-in-channel"]),this.clearSelectedProduct()}generateObservableForUpload(t){let e=[],r=[],p=[],m=[],y=[],k=[];t.forEach(n=>{switch(n.ChannelType){case a.Shopee:r.push(n);break;case a.Tiktok:e.push(n);break;case a.Lazada:p.push(n);break;case a.Tokopedia:m.push(n);break;case a.WooCommerce:y.push(n);break;case a.Shopify:k.push(n);break}});let h=[];return[{type:a.Shopee,data:r},{type:a.Tiktok,data:e},{type:a.Lazada,data:p},{type:a.Tokopedia,data:m},{type:a.WooCommerce,data:y},{type:a.Shopify,data:k}].filter(n=>n.data.length>0).forEach(n=>{switch(n.type){case a.Shopee:h.push(this.shoppeUploadService.uploadProduct(r));break;case a.Tiktok:h.push(this.tiktokUploadService.uploadProduct(e));break;case a.Lazada:h.push(this.lazadaUploadService.uploadProduct(p));break;case a.Tokopedia:h.push(this.tokopediaUploadService.uploadProduct(m));break;case a.WooCommerce:h.push(this.wooUploadService.uploadProduct(y));break;case a.Shopify:h.push(this.shopifyUploadService.uploadProduct(k));break}}),h}generateDataForUpload(t){let e=[];return t.forEach(r=>{let p=new S;p.ChannelID=r.id,p.ChannelType=r.type,p.Products=this._selectedProduct.getValue(),r.type==a.Shopify?delete p.CategoryID:p.CategoryID=r.categoryId,r.type==a.WooCommerce||r.type==a.Shopify?p.Attribute=r.attributes[0]:p.Attributes=this.formatAttributes(r.type,r.attributes),e.push(p)}),e}formatAttributes(t,e){let r;switch(t){case a.Shopee:r=this.shoppeUploadService.generateAttribute(e);break;case a.Tiktok:r=this.tiktokUploadService.generateAttribute(e);break;case a.WooCommerce:r=this.tiktokUploadService.generateAttribute(e);break;case a.Tokopedia:r=e;break;case a.Shopify:r=e;break;default:r=[];break}return r}};o.\u0275fac=function(e){return new(e||o)},o.\u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();export{E as a,F as b,x as c,H as d,Ht as e};
@@ -1,4 +1,4 @@
1
- import{e as Y}from"./chunk-4SAJUEHO.js";import{a as He,b as de,c as We,d as $e,e as he,f as ze,g as pe,h as Ke,i as V,j as fe,k as T}from"./chunk-KCDL7SWP.js";import{b as ue,c as $,d as Ge}from"./chunk-6SF7AUOH.js";import{o as Le}from"./chunk-OVEJFFL6.js";import{Cd as Be,Ed as Ne,F as De,Fd as Fe,G as xe,Kc as Oe,Lc as Me,O as se,U as Re,Ua as H,Yc as le,Z as ae,aa as x,ba as ce,c as g,ea as G,f as X,j as Te,ja as A,k as Ee,ka as F,ma as C,n as B,o as N,oa as h,p as R,pa as _e,q as K,qa as je,sb as W,ua as L,v as y,w as Pe}from"./chunk-PQDPS2ID.js";import{a as ie,i as I}from"./chunk-GNOSNGXM.js";var Ve={production:!0,version:"3.22.1",firebaseConfig:{apiKey:"AIzaSyDnnitFXpM8TglWKNpzu4ChgF98n25Rgvw",authDomain:"auth.dealpos.com",projectId:"devops-signin",storageBucket:"devops-signin.appspot.com",messagingSenderId:"412465165194",appId:"1:412465165194:web:03d806f6b6ab6f8b460e73",measurementId:"G-MNDBRJ5XZD"},news:"https://changelog.dealpos.app/umbraco/delivery/api/v2/content?fetch=children:omni&sort=sortOrder:asc"};var mt="firebase",wt="10.12.1";V(mt,wt,"app");var U=new Oe("ANGULARFIRE2_VERSION");var vt=(r,o)=>{let t=o?[o]:Ke(),e=[];return t.forEach(n=>{n.container.getProvider(r).instances.forEach(s=>{e.includes(s)||e.push(s)})}),e},q=class{constructor(){return vt(St)}},St="app-check";function ge(){}var Q=class{zone;delegate;constructor(o,t=Ee){this.zone=o,this.delegate=t}now(){return this.delegate.now()}schedule(o,t,e){let n=this.zone,i=function(s){n.runGuarded(()=>{o.apply(this,[s])})};return this.delegate.schedule(i,t,e)}},me=class{zone;task=null;constructor(o){this.zone=o}call(o,t){let e=this.unscheduleTask.bind(this);return this.task=this.zone.run(()=>Zone.current.scheduleMacroTask("firebaseZoneBlock",ge,{},ge,ge)),t.pipe(G({next:e,complete:e,error:e})).subscribe(o).add(e)}unscheduleTask(){setTimeout(()=>{this.task!=null&&this.task.state==="scheduled"&&(this.task.invoke(),this.task=null)},10)}},qe=(()=>{class r{ngZone;outsideAngular;insideAngular;constructor(t){this.ngZone=t,this.outsideAngular=t.runOutsideAngular(()=>new Q(Zone.current)),this.insideAngular=t.run(()=>new Q(Zone.current,Te)),globalThis.\u0275AngularFireScheduler||=this}static \u0275fac=function(e){return new(e||r)(h(W))};static \u0275prov=A({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function kt(){let r=globalThis.\u0275AngularFireScheduler;if(!r)throw new Error(`Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using
1
+ import{e as Y}from"./chunk-4SAJUEHO.js";import{a as He,b as de,c as We,d as $e,e as he,f as ze,g as pe,h as Ke,i as V,j as fe,k as T}from"./chunk-KCDL7SWP.js";import{b as ue,c as $,d as Ge}from"./chunk-6SF7AUOH.js";import{o as Le}from"./chunk-OVEJFFL6.js";import{Cd as Be,Ed as Ne,F as De,Fd as Fe,G as xe,Kc as Oe,Lc as Me,O as se,U as Re,Ua as H,Yc as le,Z as ae,aa as x,ba as ce,c as g,ea as G,f as X,j as Te,ja as A,k as Ee,ka as F,ma as C,n as B,o as N,oa as h,p as R,pa as _e,q as K,qa as je,sb as W,ua as L,v as y,w as Pe}from"./chunk-PQDPS2ID.js";import{a as ie,i as I}from"./chunk-GNOSNGXM.js";var Ve={production:!0,version:"3.22.3",firebaseConfig:{apiKey:"AIzaSyDnnitFXpM8TglWKNpzu4ChgF98n25Rgvw",authDomain:"auth.dealpos.com",projectId:"devops-signin",storageBucket:"devops-signin.appspot.com",messagingSenderId:"412465165194",appId:"1:412465165194:web:03d806f6b6ab6f8b460e73",measurementId:"G-MNDBRJ5XZD"},news:"https://changelog.dealpos.app/umbraco/delivery/api/v2/content?fetch=children:omni&sort=sortOrder:asc"};var mt="firebase",wt="10.12.1";V(mt,wt,"app");var U=new Oe("ANGULARFIRE2_VERSION");var vt=(r,o)=>{let t=o?[o]:Ke(),e=[];return t.forEach(n=>{n.container.getProvider(r).instances.forEach(s=>{e.includes(s)||e.push(s)})}),e},q=class{constructor(){return vt(St)}},St="app-check";function ge(){}var Q=class{zone;delegate;constructor(o,t=Ee){this.zone=o,this.delegate=t}now(){return this.delegate.now()}schedule(o,t,e){let n=this.zone,i=function(s){n.runGuarded(()=>{o.apply(this,[s])})};return this.delegate.schedule(i,t,e)}},me=class{zone;task=null;constructor(o){this.zone=o}call(o,t){let e=this.unscheduleTask.bind(this);return this.task=this.zone.run(()=>Zone.current.scheduleMacroTask("firebaseZoneBlock",ge,{},ge,ge)),t.pipe(G({next:e,complete:e,error:e})).subscribe(o).add(e)}unscheduleTask(){setTimeout(()=>{this.task!=null&&this.task.state==="scheduled"&&(this.task.invoke(),this.task=null)},10)}},qe=(()=>{class r{ngZone;outsideAngular;insideAngular;constructor(t){this.ngZone=t,this.outsideAngular=t.runOutsideAngular(()=>new Q(Zone.current)),this.insideAngular=t.run(()=>new Q(Zone.current,Te)),globalThis.\u0275AngularFireScheduler||=this}static \u0275fac=function(e){return new(e||r)(h(W))};static \u0275prov=A({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function kt(){let r=globalThis.\u0275AngularFireScheduler;if(!r)throw new Error(`Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using
2
2
  provideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).`);return r}function Ue(r){return At(kt())(r)}function At(r){return function(t){return t=t.lift(new me(r.ngZone)),t.pipe(N(r.outsideAngular),B(r.insideAngular))}}var Je=(()=>{let o=class o{constructor(){}getParseToken(){let e=JSON.parse(window.localStorage.getItem("user"));return this.ParseToken(e.Token.access_token)}GetRoles(){let n=this.getParseToken()["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"];return n||[]}ParseToken(e){try{let i=e.split(".")[0].replace("-","+").replace("_","/"),s=JSON.parse(window.atob(i)),c=e.split(".")[1].replace("-","+").replace("_","/"),l=JSON.parse(window.atob(c));return l.header=s,l}catch{return!1}}};o.\u0275fac=function(n){return new(n||o)},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();var yt=new Map,Ct={activated:!1,tokenObservers:[]},Tt={initialized:!1,enabled:!1};function E(r){return yt.get(r)||Object.assign({},Ct)}function et(){return Tt}var Et="https://content-firebaseappcheck.googleapis.com/v1";var Pt="exchangeDebugToken",Ze={OFFSET_DURATION:5*60*1e3,RETRIAL_MIN_WAIT:30*1e3,RETRIAL_MAX_WAIT:16*60*1e3},Ao=24*60*60*1e3;var ve=class{constructor(o,t,e,n,i){if(this.operation=o,this.retryPolicy=t,this.getWaitDuration=e,this.lowerBound=n,this.upperBound=i,this.pending=null,this.nextErrorWaitInterval=n,n>i)throw new Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}process(o){return I(this,null,function*(){this.stop();try{this.pending=new de,this.pending.promise.catch(t=>{}),yield Dt(this.getNextRun(o)),this.pending.resolve(),yield this.pending.promise,this.pending=new de,this.pending.promise.catch(t=>{}),yield this.operation(),this.pending.resolve(),yield this.pending.promise,this.process(!0).catch(()=>{})}catch(t){this.retryPolicy(t)?this.process(!1).catch(()=>{}):this.stop()}})}getNextRun(o){if(o)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{let t=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),t}}};function Dt(r){return new Promise(o=>{setTimeout(o,r)})}var xt={"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.",throttled:"Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}"},j=new $e("appCheck","AppCheck",xt);function tt(r){if(!E(r).activated)throw j.create("use-before-activation",{appName:r.name})}function nt(e,n){return I(this,arguments,function*({url:r,body:o},t){let i={"Content-Type":"application/json"},s=t.getImmediate({optional:!0});if(s){let f=yield s.getHeartbeatsHeader();f&&(i["X-Firebase-Client"]=f)}let a={method:"POST",body:JSON.stringify(o),headers:i},c;try{c=yield fetch(r,a)}catch(f){throw j.create("fetch-network-error",{originalErrorMessage:f?.message})}if(c.status!==200)throw j.create("fetch-status-error",{httpStatus:c.status});let l;try{l=yield c.json()}catch(f){throw j.create("fetch-parse-error",{originalErrorMessage:f?.message})}let d=l.ttl.match(/^([\d.]+)(s)$/);if(!d||!d[2]||isNaN(Number(d[1])))throw j.create("fetch-parse-error",{originalErrorMessage:`ttl field (timeToLive) is not in standard Protobuf Duration format: ${l.ttl}`});let u=Number(d[1])*1e3,p=Date.now();return{token:l.token,expireTimeMillis:p+u,issuedAtTimeMillis:p}})}function rt(r,o){let{projectId:t,appId:e,apiKey:n}=r.options;return{url:`${Et}/projects/${t}/apps/${e}:${Pt}?key=${n}`,body:{debug_token:o}}}var Rt="firebase-app-check-database",_t=1,Se="firebase-app-check-store";var ee=null;function jt(){return ee||(ee=new Promise((r,o)=>{try{let t=indexedDB.open(Rt,_t);t.onsuccess=e=>{r(e.target.result)},t.onerror=e=>{var n;o(j.create("storage-open",{originalErrorMessage:(n=e.target.error)===null||n===void 0?void 0:n.message}))},t.onupgradeneeded=e=>{let n=e.target.result;switch(e.oldVersion){case 0:n.createObjectStore(Se,{keyPath:"compositeKey"})}}}catch(t){o(j.create("storage-open",{originalErrorMessage:t?.message}))}}),ee)}function Ot(r,o){return Mt(Bt(r),o)}function Mt(r,o){return I(this,null,function*(){let e=(yield jt()).transaction(Se,"readwrite"),i=e.objectStore(Se).put({compositeKey:r,value:o});return new Promise((s,a)=>{i.onsuccess=c=>{s()},e.onerror=c=>{var l;a(j.create("storage-set",{originalErrorMessage:(l=c.target.error)===null||l===void 0?void 0:l.message}))}})})}function Bt(r){return`${r.options.appId}-${r.name}`}var ke=new ze("@firebase/app-check");function we(r,o){return We()?Ot(r,o).catch(t=>{ke.warn(`Failed to write token to IndexedDB. Error: ${t}`)}):Promise.resolve()}function ot(){return et().enabled}function it(){return I(this,null,function*(){let r=et();if(r.enabled&&r.token)return r.token.promise;throw Error(`
3
3
  Can't get debug token in production mode.
4
4
  `)})}var Nt={error:"UNKNOWN_ERROR"};function Ft(r){return He.encodeString(JSON.stringify(r),!1)}function Ae(r,o=!1){return I(this,null,function*(){let t=r.app;tt(t);let e=E(t),n=e.token,i;if(n&&!J(n)&&(e.token=void 0,n=void 0),!n){let c=yield e.cachedTokenPromise;c&&(J(c)?n=c:yield we(t,void 0))}if(!o&&n&&J(n))return{token:n.token};let s=!1;if(ot()){e.exchangeTokenPromise||(e.exchangeTokenPromise=nt(rt(t,yield it()),r.heartbeatServiceProvider).finally(()=>{e.exchangeTokenPromise=void 0}),s=!0);let c=yield e.exchangeTokenPromise;return yield we(t,c),e.token=c,{token:c.token}}try{e.exchangeTokenPromise||(e.exchangeTokenPromise=e.provider.getToken().finally(()=>{e.exchangeTokenPromise=void 0}),s=!0),n=yield E(t).exchangeTokenPromise}catch(c){c.code==="appCheck/throttled"?ke.warn(c.message):ke.error(c),i=c}let a;return n?i?J(n)?a={token:n.token,internalError:i}:a=Ye(i):(a={token:n.token},e.token=n,yield we(t,n)):a=Ye(i),s&&$t(t,a),a})}function Lt(r){return I(this,null,function*(){let o=r.app;tt(o);let{provider:t}=E(o);if(ot()){let e=yield it(),{token:n}=yield nt(rt(o,e),r.heartbeatServiceProvider);return{token:n}}else{let{token:e}=yield t.getToken();return{token:e}}})}function Ht(r,o,t,e){let{app:n}=r,i=E(n),s={next:t,error:e,type:o};if(i.tokenObservers=[...i.tokenObservers,s],i.token&&J(i.token)){let a=i.token;Promise.resolve().then(()=>{t({token:a.token}),Xe(r)}).catch(()=>{})}i.cachedTokenPromise.then(()=>Xe(r))}function st(r,o){let t=E(r),e=t.tokenObservers.filter(n=>n.next!==o);e.length===0&&t.tokenRefresher&&t.tokenRefresher.isRunning()&&t.tokenRefresher.stop(),t.tokenObservers=e}function Xe(r){let{app:o}=r,t=E(o),e=t.tokenRefresher;e||(e=Wt(r),t.tokenRefresher=e),!e.isRunning()&&t.isTokenAutoRefreshEnabled&&e.start()}function Wt(r){let{app:o}=r;return new ve(()=>I(this,null,function*(){let t=E(o),e;if(t.token?e=yield Ae(r,!0):e=yield Ae(r),e.error)throw e.error;if(e.internalError)throw e.internalError}),()=>!0,()=>{let t=E(o);if(t.token){let e=t.token.issuedAtTimeMillis+(t.token.expireTimeMillis-t.token.issuedAtTimeMillis)*.5+3e5,n=t.token.expireTimeMillis-5*60*1e3;return e=Math.min(e,n),Math.max(0,e-Date.now())}else return 0},Ze.RETRIAL_MIN_WAIT,Ze.RETRIAL_MAX_WAIT)}function $t(r,o){let t=E(r).tokenObservers;for(let e of t)try{e.type==="EXTERNAL"&&o.error!=null?e.error(o.error):e.next(o)}catch{}}function J(r){return r.expireTimeMillis-Date.now()>0}function Ye(r){return{token:Ft(Nt),error:r}}var be=class{constructor(o,t){this.app=o,this.heartbeatServiceProvider=t}_delete(){let{tokenObservers:o}=E(this.app);for(let t of o)st(this.app,t.next);return Promise.resolve()}};function zt(r,o){return new be(r,o)}function Kt(r){return{getToken:o=>Ae(r,o),getLimitedUseToken:()=>Lt(r),addTokenListener:o=>Ht(r,"INTERNAL",o),removeTokenListener:o=>st(r.app,o)}}var Gt="@firebase/app-check",Vt="0.8.4";var qt="app-check",Qe="app-check-internal";function Ut(){pe(new he(qt,r=>{let o=r.getProvider("app").getImmediate(),t=r.getProvider("heartbeat");return zt(o,t)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((r,o,t)=>{r.getProvider(Qe).initialize()})),pe(new he(Qe,r=>{let o=r.getProvider("app-check").getImmediate();return Kt(o)},"PUBLIC").setInstantiationMode("EXPLICIT")),V(Gt,Vt)}Ut();var Jt=["localhost","0.0.0.0","127.0.0.1"],jo=typeof window<"u"&&Jt.includes(window.location.hostname);var Xt="firebase",Yt="10.12.1";T.registerVersion(Xt,Yt,"app-compat");var Qt=["ngOnDestroy"],ct=(r,o,t,e={})=>new Proxy(r,{get:(n,i)=>t.runOutsideAngular(()=>{if(r[i])return e?.spy?.get&&e.spy.get(i,r[i]),r[i];if(Qt.indexOf(i)>-1)return()=>{};let s=o.toPromise().then(a=>{let c=a?.[i];return typeof c=="function"?c.bind(a):c?.then?c.then(l=>t.run(()=>l)):t.run(()=>c)});return new Proxy(()=>{},{get:(a,c)=>s[c],apply:(a,c,l)=>s.then(d=>{let u=d?.(...l);return e?.spy?.apply&&e.spy.apply(i,l,u),u})})})});var te=class{constructor(o){return o}},ne=new C("angularfire2.app.options"),re=new C("angularfire2.app.name");function Ie(r,o,t){let e=typeof t=="string"&&t||"[DEFAULT]",n=typeof t=="object"&&t||{};n.name=n.name||e;let s=T.apps.filter(a=>a&&a.name===n.name)[0]||o.runOutsideAngular(()=>T.initializeApp(r,n));try{if(JSON.stringify(r)!==JSON.stringify(s.options)){let a=!!module.hot;en("error",`${s.name} Firebase App already initialized with different options${a?", you may need to reload as Firebase is not HMR aware.":"."}`)}}catch{}return new te(s)}var en=(r,...o)=>{le()&&typeof console<"u"&&console[r](...o)},tn={provide:te,useFactory:Ie,deps:[ne,W,[new je,re]]},Ko=(()=>{class r{static initializeApp(t,e){return{ngModule:r,providers:[{provide:ne,useValue:t},{provide:re,useValue:e}]}}constructor(t){T.registerVersion("angularfire",U.full,"core"),T.registerVersion("angularfire",U.full,"app-compat"),T.registerVersion("angular",Me.full,t.toString())}static \u0275fac=function(e){return new(e||r)(h(H))};static \u0275mod=L({type:r});static \u0275inj=F({providers:[tn]})}return r})();function lt(r,o,t,e,n){let[,i,s]=globalThis.\u0275AngularfireInstanceCache.find(a=>a[0]===r)||[];if(i)return nn(n,s)||(at("error",`${o} was already initialized on the ${t} Firebase App with different settings.${rn?" You may need to reload as Firebase is not HMR aware.":""}`),at("warn",{is:n,was:s})),i;{let a=e();return globalThis.\u0275AngularfireInstanceCache.push([r,a,n]),a}}function nn(r,o){try{return r.toString()===o.toString()}catch{return r===o}}var rn=typeof module<"u"&&!!module.hot,at=(r,...o)=>{le()&&typeof console<"u"&&console[r](...o)};globalThis.\u0275AngularfireInstanceCache||=[];var on=new C("angularfire2.auth.use-emulator"),sn=new C("angularfire2.auth.settings"),an=new C("angularfire2.auth.tenant-id"),cn=new C("angularfire2.auth.langugage-code"),ln=new C("angularfire2.auth.use-device-language"),un=new C("angularfire.auth.persistence"),dn=(r,o,t,e,n,i,s,a)=>lt(`${r.name}.auth`,"AngularFireAuth",r.name,()=>{let c=o.runOutsideAngular(()=>r.auth());if(t&&c.useEmulator(...t),e&&(c.tenantId=e),c.languageCode=n,i&&c.useDeviceLanguage(),s)for(let[l,d]of Object.entries(s))c.settings[l]=d;return a&&c.setPersistence(a),c},[t,e,n,i,s,a]),ye=(()=>{class r{authState;idToken;user;idTokenResult;credential;constructor(t,e,n,i,s,a,c,l,d,u,p,f){let z=new X,O=K(void 0).pipe(B(s.outsideAngular),x(()=>i.runOutsideAngular(()=>import("./chunk-F4WIW6HA.js"))),y(()=>Ie(t,i,e)),y(P=>dn(P,i,a,l,d,u,c,p)),ae({bufferSize:1,refCount:!1}));if(Fe(n))this.authState=this.user=this.idToken=this.idTokenResult=this.credential=K(null);else{O.pipe(Re()).subscribe();let P=O.pipe(x(w=>w.getRedirectResult().then(D=>D,()=>null)),Ue,ae({bufferSize:1,refCount:!1})),Z=O.pipe(x(w=>new g(D=>({unsubscribe:i.runOutsideAngular(()=>w.onAuthStateChanged(M=>D.next(M),M=>D.error(M),()=>D.complete()))})))),oe=O.pipe(x(w=>new g(D=>({unsubscribe:i.runOutsideAngular(()=>w.onIdTokenChanged(M=>D.next(M),M=>D.error(M),()=>D.complete()))}))));this.authState=P.pipe(ce(Z),N(s.outsideAngular),B(s.insideAngular)),this.user=P.pipe(ce(oe),N(s.outsideAngular),B(s.insideAngular)),this.idToken=this.user.pipe(x(w=>w?R(w.getIdToken()):K(null))),this.idTokenResult=this.user.pipe(x(w=>w?R(w.getIdTokenResult()):K(null))),this.credential=De(P,z,this.authState.pipe(xe(w=>!w))).pipe(y(w=>w?.user?w:null),N(s.outsideAngular),B(s.insideAngular))}return ct(this,O,i,{spy:{apply:(P,Z,oe)=>{(P.startsWith("signIn")||P.startsWith("createUser"))&&oe.then(w=>z.next(w))}}})}static \u0275fac=function(e){return new(e||r)(h(ne),h(re,8),h(H),h(W),h(qe),h(on,8),h(sn,8),h(an,8),h(cn,8),h(ln,8),h(un,8),h(q,8))};static \u0275prov=A({token:r,factory:r.\u0275fac,providedIn:"any"})}return r})(),ii=(()=>{class r{constructor(){T.registerVersion("angularfire",U.full,"auth-compat")}static \u0275fac=function(e){return new(e||r)};static \u0275mod=L({type:r});static \u0275inj=F({providers:[ye]})}return r})();function m(r,o,t,e){return new Promise((n,i)=>{r||i("IndexedDB not available");let s=r.open(o,t),a;s.onsuccess=c=>{a=s.result,n(a)},s.onerror=c=>{i(`IndexedDB error: ${s.error}`)},typeof e=="function"&&(s.onupgradeneeded=c=>{e(c,a)})})}function ut(r,o,t,e,n){if(!r)return;let i=r.open(o,t);i.onupgradeneeded=s=>{let a=s.target.result;e.forEach(l=>{if(!a.objectStoreNames.contains(l.store)){let d=a.createObjectStore(l.store,l.storeConfig);l.storeSchema.forEach(u=>{d.createIndex(u.name,u.keypath,u.options)})}});let c=n&&n();c&&Object.keys(c).map(l=>parseInt(l,10)).filter(l=>l>s.oldVersion).sort((l,d)=>l-d).forEach(l=>{c[l](a,i.transaction)}),a.close()},i.onsuccess=s=>{s.target.result.close()}}function pn(r,o,t){if(!r||!o||!t)throw Error('Params: "dbName", "version", "storeName" are mandatory.');return new g(e=>{try{let n=o+1,i=indexedDB.open(r,n);i.onupgradeneeded=s=>{let a=s.target.result;a.deleteObjectStore(t),a.close(),console.log("onupgradeneeded"),e.next(!0),e.complete()},i.onerror=s=>e.error(s)}catch(n){e.error(n)}})}function fn(r,o){return r.objectStoreNames.contains(o)}function b(r,o,t){r||t("You need to use the openDatabase function to create a database before you query it!"),fn(r,o)||t(`objectStore does not exists: ${o}`)}function S(r,o){let t=r.transaction(o.storeName,o.dbMode);return t.onerror=o.error,t.onabort=o.abort,t}function k(r,o,t,e){return{storeName:o,dbMode:r,error:n=>{t(n)},abort:n=>{t(n)}}}var v=function(r){return r.readonly="readonly",r.readwrite="readwrite",r}(v||{}),dt=new C(null),Ce=(()=>{class r{constructor(t,e){if(this.dbConfig=t,this.platformId=e,!t.name)throw new Error("NgxIndexedDB: Please, provide the dbName in the configuration");if(!t.version)throw new Error("NgxIndexedDB: Please, provide the db version in the configuration");this.isBrowser=Ne(this.platformId),this.isBrowser&&(this.indexedDB=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,ut(this.indexedDB,t.name,t.version,t.objectStoresMeta,t.migrationFactory),m(this.indexedDB,t.name).then(n=>{n.version!==t.version&&(this.dbConfig.version=n.version)}))}createObjectStore(t,e){let n=[t];ut(this.indexedDB,this.dbConfig.name,++this.dbConfig.version,n,e)}add(t,e,n){return new g(i=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(s=>{let c=S(s,k(v.readwrite,t,d=>i.error(d))).objectStore(t),l=n?c.add(e,n):c.add(e);l.onsuccess=d=>I(this,null,function*(){let u=d.target.result,p=c.get(u);p.onsuccess=f=>{i.next(f.target.result),i.complete()}})}).catch(s=>i.error(s))})}bulkAdd(t,e){let n=new Promise((i,s)=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(a=>{let l=S(a,k(v.readwrite,t,i,s)).objectStore(t),d=e.map(u=>new Promise((p,f)=>{let z=u.key;delete u.key;let O=z?l.add(u,z):l.add(u);O.onsuccess=P=>{let Z=P.target.result;p(Z)}}));i(Promise.all(d))}).catch(a=>s(a))});return R(n)}bulkDelete(t,e){let n=e.map(i=>new Promise((s,a)=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(c=>{let l=S(c,k(v.readwrite,t,a,s));l.objectStore(t).delete(i),l.oncomplete=()=>{this.getAll(t).pipe(se(1)).subscribe(u=>{s(u)})}}).catch(c=>a(c))}));return R(Promise.all(n))}getByKey(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{let c=S(i,k(v.readonly,t,n.error)).objectStore(t).get(e);c.onsuccess=l=>{n.next(l.target.result),n.complete()},c.onerror=l=>{n.error(l)}}).catch(i=>n.error(i))})}bulkGet(t,e){let n=e.map(i=>this.getByKey(t,i));return new g(i=>{Pe(n).subscribe(s=>{i.next(s),i.complete()})})}getByID(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{b(i,t,l=>n.error(l));let c=S(i,k(v.readonly,t,n.error,n.next)).objectStore(t).get(e);c.onsuccess=l=>{n.next(l.target.result)}}).catch(i=>n.error(i))})}getByIndex(t,e,n){return new g(i=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(s=>{b(s,t,u=>i.error(u));let d=S(s,k(v.readonly,t,i.error)).objectStore(t).index(e).get(n);d.onsuccess=u=>{i.next(u.target.result),i.complete()}}).catch(s=>i.error(s))})}getAll(t){return new g(e=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(n=>{b(n,t,c=>e.error(c));let a=S(n,k(v.readonly,t,e.error,e.next)).objectStore(t).getAll();a.onerror=c=>{e.error(c)},a.onsuccess=({target:{result:c}})=>{e.next(c),e.complete()}}).catch(n=>e.error(n))})}update(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{b(i,t,l=>n.error(l));let a=S(i,k(v.readwrite,t,l=>n.error(l))).objectStore(t),c=a.put(e);c.onsuccess=l=>I(this,null,function*(){let d=l.target.result,u=a.get(d);u.onsuccess=p=>{n.next(p.target.result),n.complete()}})}).catch(i=>n.error(i))})}delete(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{b(i,t,c=>n.error(c));let s=S(i,k(v.readwrite,t,c=>n.error(c)));s.objectStore(t).delete(e),s.oncomplete=()=>{this.getAll(t).pipe(se(1)).subscribe(c=>{n.next(c),n.complete()})}}).catch(i=>n.error(i))})}deleteByKey(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{b(i,t,c=>n.error(c));let s=S(i,k(v.readwrite,t,c=>n.error(c))),a=s.objectStore(t);s.oncomplete=()=>{n.next(!0),n.complete()},a.delete(e)}).catch(i=>n.error(i))})}clear(t){return new g(e=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(n=>{b(n,t,a=>e.error(a));let i=S(n,k(v.readwrite,t,a=>e.error(a)));i.objectStore(t).clear(),i.oncomplete=()=>{e.next(!0),e.complete()}}).catch(n=>e.error(n))})}deleteDatabase(){return new g(t=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(e=>I(this,null,function*(){yield e.close();let n=this.indexedDB.deleteDatabase(this.dbConfig.name);n.onsuccess=()=>{t.next(!0),t.complete()},n.onerror=i=>t.error(i),n.onblocked=()=>{throw new Error("Unable to delete database because it's blocked")}})).catch(e=>t.error(e))})}openCursor(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{b(i,t,l=>n.error(l));let a=S(i,k(v.readonly,t,n.error)).objectStore(t),c=e===void 0?a.openCursor():a.openCursor(e);c.onsuccess=l=>{n.next(l),n.complete()}}).catch(i=>n.error(i))})}openCursorByIndex(t,e,n,i=v.readonly){let s=new X;return m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(a=>{b(a,t,p=>{s.error(p)});let u=S(a,k(i,t,p=>{s.error(p)},()=>{s.next()})).objectStore(t).index(e).openCursor(n);u.onsuccess=p=>{s.next(p)}}).catch(a=>s.error(a)),s}getAllByIndex(t,e,n){let i=[];return new g(s=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(a=>{b(a,t,p=>s.error(p));let u=S(a,k(v.readonly,t,s.error)).objectStore(t).index(e).openCursor(n);u.onsuccess=p=>{let f=p.target.result;f?(i.push(f.value),f.continue()):(s.next(i),s.complete())}}).catch(a=>s.error(a))})}getAllKeysByIndex(t,e,n){let i=[];return new g(s=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(a=>{b(a,t,p=>s.error(p));let u=S(a,k(v.readonly,t,s.error)).objectStore(t).index(e).openKeyCursor(n);u.onsuccess=p=>{let f=p.target.result;f?(i.push({primaryKey:f.primaryKey,key:f.key}),f.continue()):(s.next(i),s.complete())}}).catch(a=>s.error(a))})}count(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{b(i,t,l=>n.error(l));let c=S(i,k(v.readonly,t,n.error)).objectStore(t).count(e);c.onerror=l=>n.error(l),c.onsuccess=l=>{n.next(l.target.result),n.complete()}}).catch(i=>n.error(i))})}countByIndex(t,e,n){return new g(i=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(s=>{b(s,t,u=>i.error(u));let d=S(s,k(v.readonly,t,i.error)).objectStore(t).index(e).count(n);d.onerror=u=>i.error(u),d.onsuccess=u=>{i.next(u.target.result),i.complete()}}).catch(s=>i.error(s))})}deleteObjectStore(t){return pn(this.dbConfig.name,++this.dbConfig.version,t)}}return r.\u0275fac=function(t){return new(t||r)(h(dt),h(H))},r.\u0275prov=A({token:r,factory:r.\u0275fac}),r})(),pi=(()=>{class r{static forRoot(t){return{ngModule:r,providers:[Ce,{provide:dt,useValue:t}]}}}return r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=L({type:r}),r.\u0275inj=F({imports:[[Be]]}),r})();var ht=(()=>{let o=class o{constructor(e){this.db=e,this.DATABASE="Categories"}saveCategoriesByChannelType(e,n){let i=this.getKey(n);return this.db.add(this.DATABASE,e,i).pipe(y(s=>e))}getCategoriesByChannelType(e){let n=this.getKey(e);return this.db.getByKey(this.DATABASE,n)}getKey(e){let n="";switch(e){case ue.Lazada:n="Lazada";break;case ue.Tokopedia:n="Tokopedia";break}return n}clearDatabase(){this.db.clear(this.DATABASE)}getHostName(){let e=localStorage.getItem("Authorization");return this.hostName=JSON.parse(e)?.Host,this.hostName}};o.\u0275fac=function(n){return new(n||o)(h(Ce))},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();var pt=(()=>{let o=class o{constructor(){}inititalizeIntercom(){let e=this.getFromLocalStorage();e?.Enabled&&window.Intercom("boot",{app_id:"xv1oomgl",name:e.Name,email:e.Email,created_at:e.Created,user_hash:e.Hash})}shutdown(){this.getFromLocalStorage()?.Enabled&&(window.Intercom("shutdown"),this.clearStorage())}clearStorage(){localStorage.removeItem("Intercom")}updateLocalStorage(e){let n={Enabled:!0};e&&(n=ie(ie({},n),e)),localStorage.setItem("Intercom",JSON.stringify(n))}getFromLocalStorage(){let e=localStorage.getItem("Intercom");return JSON.parse(e)}hideLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(window.Intercom("update",{app_id:"xv1oomgl",hide_default_launcher:!0}),e.hide_default_launcher=!0,this.updateLocalStorage(e))}showLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(window.Intercom("update",{app_id:"xv1oomgl",hide_default_launcher:!1}),e.hide_default_launcher=!1,this.updateLocalStorage(e))}isHideLauncher(){let e=this.getFromLocalStorage();return $.IsEmpty(e?.hide_default_launcher)?!1:e?.hide_default_launcher}};o.\u0275fac=function(n){return new(n||o)},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();var ft=(()=>{let o=class o{};o.SubmitConfig="/api/Channel/SubmitConfig",o.PosAccountTest="/api/POSAccount/Test",o.PosAccountRemove="/api/POSAccount/Remove",o.PosAccountGetConfig="/api/ChannelLoader/GetConfig",o.ChannelGetLastSyncByID="/api/Channel/GetLastSyncByID",o.GetChannel="/api/Channel/GetChannel",o.GetChannelLoader="/api/ChannelLoader/GetChannelLoader",o.TestShopID="/api/Channel/TestShopID",o.UpdateChannelIndex="/api/Channel/UpdateChannelIndex",o.DeleteChannel="/api/Channel/DeleteChannel",o.GetRegisterByOutletName="/api/Channel/GetRegistersByOutletOrder",o.GetChannelRowCount="/api/Channel/GetCountChannel",o.GetChannelWarehouse="/api/Channel/GetChannelWarehouseLocation",o.UnSynchronizedWarehouse="/api/Channel/UnSynchronizedWarehouse",o.GetChannelDetail="/api/ChannelLoader/GetChannelView",o.GetOrderPreview="/api/Orders/Preview",o.GetOrderPreviewV2="/api/Orders/PreviewV2",o.GetDownloadOrder="/api/Orders/Download",o.GetDownloadOrderV2="/api/Orders/DownloadV2";let r=o;return r})();var gt=(()=>{let o=class o{constructor(){this.httpService=_e(Y)}update(e){if(e)this.updateLocalStorage(e);else{let n={RowCount:500,PageNumber:1};this.httpService.post(ft.GetChannel,n).pipe(y(i=>i?.Data)).subscribe(i=>{this.updateLocalStorage(i)})}}getChannels(){let e=localStorage.getItem("channels");return e?JSON.parse(e):[]}updateLocalStorage(e){let n=this.mappingChannelLocalStorage(e);localStorage.setItem("channels",JSON.stringify(n))}mappingChannelLocalStorage(e){return e.map(i=>({ID:i.ID,Name:i.Name,TypeID:i.TypeID,Img:$.getChannelLogoByTypeId(i.TypeID)}))}clearLocalStorage(){localStorage.removeItem("channels")}};o.\u0275fac=function(n){return new(n||o)},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();var ji=(()=>{let o=class o{constructor(e,n,i,s,a,c,l,d){this.httpService=e,this.tokenDecodeService=n,this.afAuth=i,this.ngxPermission=s,this.localDataService=a,this.router=c,this.intercomService=l,this.updateChannelStorageService=d}login(e){return this.httpService.post("/api/token/Login",e).pipe(G(n=>{this.setLocalStorage(n,e.Host,e.Username),this.loadPermissions()}))}getNews(){return this.httpService.get(Ve.news).pipe(y(e=>e?.items?.map(n=>n?.properties)))}loginWithGoogle(e,n){e.preventDefault();let i=new fe;return i.setCustomParameters({prompt:"select_account"}),R(this.afAuth.signInWithPopup(i)).pipe(y(s=>s.credential),y(s=>s.idToken),x(s=>this.httpService.post("/api/token/LoginWithSocialProvider",JSON.stringify({IDToken:s,Host:n}))),G(s=>{this.setLocalStorage(s,n,null),this.loadPermissions()}))}setLocalStorage(e,n,i){localStorage.setItem("user",JSON.stringify(e)),localStorage.setItem("Authorization",JSON.stringify({Host:n,username:i})),this.updateChannelStorageService.update(e.Channels),this.intercomService.updateLocalStorage(e.IntercomWidget),this.intercomService.inititalizeIntercom()}loadPermissions(){this.ngxPermission.loadPermissions([]);let e=localStorage.getItem("user");if($.IsNotEmpty(e)){let n=this.tokenDecodeService.GetRoles();this.ngxPermission.loadPermissions(n)}}getChannels(){return this.updateChannelStorageService.getChannels()}logout(){this.clearLocalStorage(),this.ngxPermission.flushPermissions()}isActiveToken(){let e=JSON.parse(window.localStorage.getItem("user")),n=new Date;if(e!=null){let i=new Date(e.Token.expiredAt);return n<i?!0:(this.clearLocalStorage(),!1)}else return!1}getDomain(){if(!this.domain){let e=localStorage.getItem("Authorization");this.domain="https://"+JSON.parse(e).Host}return this.domain}clearLocalStorage(){this.domain=null,localStorage.removeItem("user"),this.updateChannelStorageService.clearLocalStorage(),this.intercomService.shutdown(),this.localDataService.clearDatabase(),this.router.navigate([""])}};o.\u0275fac=function(n){return new(n||o)(h(Y),h(Je),h(ye),h(Ge),h(ht),h(Le),h(pt),h(gt))},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();export{Ve as a,Je as b,Ko as c,ii as d,pi as e,ht as f,ft as g,gt as h,ji as i};