marketplacepos 3.20.5 → 3.20.7

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 (32) hide show
  1. package/Marketplace/{chunk-3VGAURY3.js → chunk-2D6GZYV6.js} +1 -1
  2. package/Marketplace/{chunk-62AUVNTW.js → chunk-3RHUIDAQ.js} +1 -1
  3. package/Marketplace/{chunk-5CRDOJPK.js → chunk-6IFUYLZO.js} +1 -1
  4. package/Marketplace/{chunk-6LC5LHS7.js → chunk-7J6VWSOY.js} +1 -1
  5. package/Marketplace/{chunk-COAD3DY5.js → chunk-7ZGA73PD.js} +1 -1
  6. package/Marketplace/{chunk-LWMWPW7O.js → chunk-D77F5RO6.js} +1 -1
  7. package/Marketplace/{chunk-OMR5REL2.js → chunk-EJX6CAIL.js} +1 -1
  8. package/Marketplace/{chunk-UTP5O3JL.js → chunk-G6KIXTPI.js} +1 -1
  9. package/Marketplace/{chunk-HTFZRZEI.js → chunk-HJXQWVTQ.js} +1 -1
  10. package/Marketplace/{chunk-GOV3GQ7Y.js → chunk-I6W5QIOM.js} +1 -1
  11. package/Marketplace/{chunk-ELNSUKXK.js → chunk-JOC6XFFU.js} +1 -1
  12. package/Marketplace/{chunk-HMRV5GCL.js → chunk-NZPUMERQ.js} +1 -1
  13. package/Marketplace/{chunk-JAASJQ7I.js → chunk-OEP5AAFY.js} +1 -1
  14. package/Marketplace/{chunk-ZPUEDBNZ.js → chunk-OFZ5NJV6.js} +1 -1
  15. package/Marketplace/{chunk-HNI6GED7.js → chunk-OKOVDVO7.js} +1 -1
  16. package/Marketplace/{chunk-REVVSWD3.js → chunk-RF6ORGG3.js} +1 -1
  17. package/Marketplace/{chunk-3HIQR6S5.js → chunk-RRVHCECC.js} +1 -1
  18. package/Marketplace/{chunk-5GZGQTZO.js → chunk-TEQJOK4U.js} +1 -1
  19. package/Marketplace/{chunk-AGTLQ7PH.js → chunk-UFXTALJV.js} +1 -1
  20. package/Marketplace/{chunk-HQ2NK4T7.js → chunk-V3E6EYCE.js} +1 -1
  21. package/Marketplace/{chunk-2LWHDKOC.js → chunk-VYJYR4KR.js} +1 -1
  22. package/Marketplace/chunk-W24G4ZA4.js +3 -0
  23. package/Marketplace/{chunk-SAGRGMBL.js → chunk-WM3MIKKJ.js} +1 -1
  24. package/Marketplace/{chunk-G5TWCIEM.js → chunk-WR2VVFHM.js} +1 -1
  25. package/Marketplace/{chunk-BARICLUB.js → chunk-XMH33RT7.js} +1 -1
  26. package/Marketplace/{chunk-2ORRMEZR.js → chunk-YE2ZQWOE.js} +1 -1
  27. package/Marketplace/{chunk-EKFFWAOD.js → chunk-YOU4YFV2.js} +1 -1
  28. package/Marketplace/{chunk-BAP3IJF6.js → chunk-ZN3HSNZC.js} +1 -1
  29. package/Marketplace/index.html +2 -2
  30. package/Marketplace/{main-CMQW2MZJ.js → main-SKG4AXDA.js} +1 -1
  31. package/package.json +1 -1
  32. package/Marketplace/chunk-LF7UA3W4.js +0 -3
@@ -1 +1 @@
1
- import{a as he}from"./chunk-MZNSPLFO.js";import{a as oe}from"./chunk-BVIRHZTZ.js";import{a as fe}from"./chunk-E5BOLHDG.js";import{a as xe,b as Ce}from"./chunk-A37OKNC2.js";import{c as ue}from"./chunk-DYLT6RRK.js";import{a as ge}from"./chunk-D76K4RZ7.js";import{g as de}from"./chunk-EIBGI6U2.js";import{g as ce}from"./chunk-5GZGQTZO.js";import{d as pe,g as se}from"./chunk-4CEFDQPI.js";import{t as _e,u as me}from"./chunk-2SC3HO66.js";import{b as ee,h as te,m as ne,y as ie}from"./chunk-2E5AKA74.js";import{c as re,e as le,f as ae}from"./chunk-FTHTFVHH.js";import{Ab as H,Ac as G,Ec as J,Fc as Q,Ha as v,Ib as b,Ja as a,Jb as s,Ka as F,Kb as k,Lb as S,Nb as O,Ob as D,Pb as N,Rb as Z,Tb as T,V as z,_a as p,ab as m,ac as $,bc as j,c as W,cc as q,dc as y,ga as A,hb as P,ib as E,kb as M,lb as V,mb as c,nb as _,oa as g,ob as I,pa as u,pb as x,qb as C,rb as R,sb as f,vb as h,vc as K,xa as B,xb as r,xc as X,yc as Y,za as U}from"./chunk-ZIZWZZ4E.js";var L=t=>[t],Te=t=>({"text-decoration-line-through":t}),be=t=>({"ms-10":t}),Se=t=>({"bg-gradient-warning":t});function ve(t,l){if(t&1){let n=f();c(0,"mat-slide-toggle",13),h("toggleChange",function(){g(n);let e=r();return e.toggleStatus=!e.toggleStatus,u(e.onToggle())}),c(1,"small",14),s(2),_()()}if(t&2){let n=r();a(2),S(" ",n.productToggleTitle?n.productToggleTitle:"FILTER DIFFERENT INVENTORY"," ")}}function Ie(t,l){if(t&1){let n=f();c(0,"th")(1,"input",16),N("ngModelChange",function(e){g(n);let o=r(2);return D(o.checkboxState,e)||(o.checkboxState=e),u(e)}),h("ngModelChange",function(){g(n);let e=r(2);return u(e.onCheckboxStateChange())}),_()()}if(t&2){let n=r(2);a(),O("ngModel",n.checkboxState)}}function ye(t,l){if(t&1&&(p(0,Ie,2,1,"ng-template",15),c(1,"th",11),s(2,"POS"),_()),t&2){let n=r();m("ngxPermissionsOnly",T(1,L,n.rolePriceEdit))}}function we(t,l){if(t&1&&(x(0),c(1,"th",17)(2,"div",18)(3,"div",19),I(4,"img",20),c(5,"div",21),s(6),$(7,"stringLimit"),_()()()(),C()),t&2){let n=l.$implicit;a(3),m("matTooltip",(n.Name==null?null:n.Name.length)>20?n.Name:""),a(),m("src",n==null?null:n.Img,v),a(2),S(" ",q(7,3,n.Name,20)," ")}}function Fe(t,l){t&1&&R(0)}function Pe(t,l){if(t&1&&(x(0),p(1,Fe,1,0,"ng-container",34),C()),t&2){r();let n=b(7);a(),m("ngTemplateOutlet",n)}}function Ee(t,l){t&1&&R(0)}function Me(t,l){if(t&1&&p(0,Ee,1,0,"ng-container",34),t&2){r(2);let n=b(7);m("ngTemplateOutlet",n)}}function Ve(t,l){if(t&1&&p(0,Me,1,1,"ng-template",15),t&2){let n=r(4);m("ngxPermissionsOnly",T(1,L,n.rolePriceEdit))}}function ke(t,l){if(t&1){let n=f();x(0),c(1,"input",35),N("ngModelChange",function(e){g(n);let o=r(4).$implicit;return D(o.selected,e)||(o.selected=e),u(e)}),h("ngModelChange",function(){g(n);let e=r(4).$implicit,o=r();return u(o.onCheckboxStateProduct(e.ID))}),_(),C()}if(t&2){let n=r(4).$implicit;a(),O("ngModel",n.selected)}}function Oe(t,l){if(t&1&&p(0,ke,2,1,"ng-container",22),t&2){let n=r(3).$implicit;m("ngIf",(n==null||n.Variants==null?null:n.Variants.length)>1)}}function De(t,l){if(t&1){let n=f();x(0),c(1,"img",36),h("click",function(e){g(n);let o=r(3).$implicit,d=r();return u(d.onZoomImage(e,o==null?null:o.ImageUrl))}),_(),C()}if(t&2){let n=r(3).$implicit;a(),H("src",n==null?null:n.ThumbnailUrl,v)}}function Ne(t,l){t&1&&I(0,"img",37)}function $e(t,l){if(t&1&&(x(0),c(1,"td",29)(2,"div",30),p(3,Pe,2,1,"ng-container",31)(4,Ve,1,3,"ng-template",null,0,y)(6,Oe,1,1,"ng-template",null,1,y),c(8,"div",26),p(9,De,2,1,"ng-container",31)(10,Ne,1,0,"ng-template",null,2,y),_()()(),c(12,"td",32)(13,"div"),s(14),_(),c(15,"small",33),s(16),_()(),C()),t&2){let n=b(5),i=b(11),e=r(2).$implicit,o=r();a(),m("rowSpan",e==null?null:e.Variants.length),a(2),m("ngIf",o.table=="inventory")("ngIfElse",n),a(5),m("ngClass",T(9,be,(e==null||e.Variants==null?null:e.Variants.length)<=1)),a(),m("ngIf",e==null?null:e.ThumbnailUrl)("ngIfElse",i),a(3),m("rowSpan",e==null?null:e.Variants.length),a(2),k(e==null?null:e.Name),a(2),S("(",e==null?null:e.Category,")")}}function Be(t,l){if(t&1){let n=f();c(0,"input",16),N("ngModelChange",function(e){g(n);let o=r(3).$implicit;return D(o.selected,e)||(o.selected=e),u(e)}),_()}if(t&2){let n=r(3).$implicit;O("ngModel",n.selected)}}function Ue(t,l){if(t&1&&(c(0,"td",38),p(1,Be,1,1,"input",39),_()),t&2){let n=r(2).$implicit,i=r(2);a(),m("ngIf",i.printPOS(n)>=0||i.table=="price")}}function Re(t,l){if(t&1&&(p(0,Ue,2,1,"ng-template",15),c(1,"td",24),s(2),$(3,"number"),_()),t&2){let n=r().$implicit,i=r(2);m("ngxPermissionsOnly",T(4,L,i.rolePriceEdit)),a(2),k(j(3,2,i.printPOS(n)))}}function je(t,l){if(t&1){let n=f();x(0),c(1,"td",40),h("click",function(){g(n);let e=r().$implicit,o=r().$implicit,d=r().$implicit,w=r();return u(w.openTableDialog(d.Name,o,e.ID,d.ChannelItemID))}),c(2,"div",30)(3,"div",41),s(4),$(5,"number"),_(),c(6,"a",42),h("click",function(e){return g(n),u(e==null?null:e.stopPropagation())}),I(7,"i",28),_()()(),C()}if(t&2){let n=l.$implicit,i=r(2).$implicit,e=r(2);a(),m("ngClass",T(5,Se,e.printPOS(i)!=e.printItem(n)&&e.hiddenIPOSInventory()==!1)),a(3),S(" ",j(5,3,e.printItem(n))," "),a(2),m("href",n.Url,v)}}function Le(t,l){t&1&&(c(0,"td",43)(1,"div",30)(2,"span"),s(3,"X"),_()()())}function We(t,l){if(t&1&&p(0,je,8,7,"ng-container",31)(1,Le,4,0,"ng-template",null,3,y),t&2){let n=l.$implicit,i=b(2),e=r().$implicit,o=r(2);m("ngIf",o.getItemFromChannel(e,n))("ngIfElse",i)}}function ze(t,l){if(t&1&&(c(0,"tr"),p(1,$e,17,11,"ng-container",22),c(2,"td",23),s(3),_(),c(4,"td",24)(5,"div",25)(6,"div",26),s(7),_(),c(8,"div",21)(9,"a",27),I(10,"i",28),_()()()(),p(11,Re,4,6),M(12,We,3,2,null,null,E),_()),t&2){let n=l.$implicit,i=l.$index,e=r(2);a(),m("ngIf",i==0),a(2),k(n==null?null:n.Model),a(2),m("matTooltip",n.Discontinued?e.discontinuedVariantMsg:""),a(),m("ngClass",T(7,Te,n.Discontinued)),a(),S(" ",n.Code," "),a(2),m("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(n==null?null:n.ID),v),a(2),P(e.hiddenIPOSInventory()==!1?11:-1),a(),V(e.channel)}}function Ae(t,l){if(t&1&&(c(0,"tbody"),M(1,ze,14,9,"tr",null,E),_()),t&2){let n=l.$implicit;a(),V(n.Variants)}}var ht=(()=>{let l=class l{constructor(i,e,o){this.dialog=i,this.biggerPictureService=e,this.authService=o,this.showProductToggle=!1,this.multiwarehouse=B(!1),this.hiddenIPOSInventory=B(!1),this.toggleStatus=!1,this.checkboxState=!1,this.rolePriceEdit=oe.price,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.onSubmit=new U,this.destroy$=new W,this.toggle=new U,this.hostName=this.authService.getDomain()}ngOnInit(){this.table=="inventory"?this.stockHeader="Stock":this.table=="price"&&(this.stockHeader="Price")}onCheckboxStateProduct(i){let e=this.data.filter(o=>o.ID==i);e.length>0&&(e=e.map(o=>(o.Variants=o.Variants.map(d=>(d.selected=o.selected,d)),o)))}onCheckboxStateChange(){this.data=this.data.map(i=>(i.Variants=i.Variants.map(e=>(e.selected=this.checkboxState,e)),i))}getItemFromChannel(i,e){return i.Channel.find(d=>re.IsNotEmpty(e.LocationID)?d.LocationID==e.LocationID:d.ChannelID==e.ID)}printItem(i){if(this.table=="inventory")return i.Inventory;if(this.table=="price")return i.Price}openTableDialog(i,e,o,d){this.dialog.open(he,{data:{Name:i,Variant:e,ChannelID:o,Table:this.table,ChannelItemID:d}}).afterClosed().pipe(z(this.destroy$)).subscribe(w=>{w!=null&&this.onSubmit.emit(w)})}printPOS(i){return this.table=="inventory"?i.Inventory?i.Inventory:0:this.table=="price"?i.UnitPrice:null}onToggle(){this.toggle.emit(this.toggleStatus)}onZoomImage(i,e){this.biggerPictureService.openBiggerPicture(i,e)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}};l.\u0275fac=function(e){return new(e||l)(F(pe),F(ge),F(ce))},l.\u0275cmp=A({type:l,selectors:[["app-table"]],inputs:{data:"data",table:"table",channel:"channel",showProductToggle:"showProductToggle",productToggleTitle:"productToggleTitle",multiwarehouse:[1,"multiwarehouse"],hiddenIPOSInventory:[1,"hiddenIPOSInventory"]},outputs:{onSubmit:"onSubmit",toggle:"onToggle"},standalone:!0,features:[Z],decls:17,vars:3,consts:[["PRICE",""],["checkbox_update",""],["elsePic",""],["elseCol",""],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],["scope","col","colspan","2",1,"text-center","w-25"],[1,"w-100"],[2,"width","200px"],["scope","col",1,"text-start","w-20"],["scope","col",1,"text-end","w-10"],[4,"ngFor","ngForOf"],[2,"width","200px",3,"toggleChange"],[1,"fw-bold"],[3,"ngxPermissionsOnly"],["type","checkbox",3,"ngModelChange","ngModel"],["scope","col"],[1,"w-100","d-flex","align-items-center","justify-content-center"],["matTooltipPosition","above",1,"d-flex","align-items-center","justify-content-center",2,"width","180px",3,"matTooltip"],[2,"width","16px","height","16px",3,"src"],[1,"ms-2"],[4,"ngIf"],[1,"text-start"],[1,"text-end"],["matTooltipPosition","above",1,"d-flex","align-items-center","justify-content-end",3,"matTooltip"],[3,"ngClass"],["target","_blank",3,"href"],[1,"fas","fa-solid","fa-arrow-up-right-from-square","external-link-custom"],[1,"text-center",3,"rowSpan"],[1,"d-flex","align-items-center","justify-content-center"],[4,"ngIf","ngIfElse"],[1,"text-start",2,"padding-left","0px",3,"rowSpan"],[1,"mt-1"],[4,"ngTemplateOutlet"],["type","checkbox",1,"me-3",3,"ngModelChange","ngModel"],[1,"border","rounded","w-img","cursor-pointer",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded","w-img"],[1,"align-middle"],["type","checkbox",3,"ngModel","ngModelChange",4,"ngIf"],[1,"p-0","pointer","cell-hover",3,"click","ngClass"],[1,"me-2","mt-1"],["target","_blank",3,"click","href"],[1,"table-white","text-center",2,"color","red"]],template:function(e,o){e&1&&(c(0,"div",4)(1,"table",5)(2,"thead",6)(3,"tr")(4,"th",7)(5,"div",8)(6,"div"),s(7,"Product"),_(),p(8,ve,3,1,"mat-slide-toggle",9),_()(),c(9,"th",10),s(10,"Variant"),_(),c(11,"th",11),s(12,"SKU"),_(),p(13,ye,3,3)(14,we,8,6,"ng-container",12),_()(),M(15,Ae,3,0,"tbody",null,E),_()()),e&2&&(a(8),P(o.showProductToggle?8:-1),a(5),P(o.hiddenIPOSInventory()==!1?13:-1),a(),m("ngForOf",o.channel),a(),V(o.data))},dependencies:[Q,K,X,Y,G,J,ie,ee,te,ne,Ce,xe,se,de,ue,ae,le,me,_e,fe],styles:[".w-10[_ngcontent-%COMP%]{width:10%}.w-20[_ngcontent-%COMP%]{width:20%}.w-img[_ngcontent-%COMP%]{width:40px;height:40px}.item-name[_ngcontent-%COMP%]{margin-bottom:-14px!important;font-size:larger}.cell-hover[_ngcontent-%COMP%]:hover{background-color:#c9c9c9!important}.text-wrapping[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;width:88px}.cell-hover[_ngcontent-%COMP%]{width:400px!important}"]});let t=l;return t})();export{ht as a};
1
+ import{a as he}from"./chunk-MZNSPLFO.js";import{a as oe}from"./chunk-BVIRHZTZ.js";import{a as fe}from"./chunk-E5BOLHDG.js";import{a as xe,b as Ce}from"./chunk-A37OKNC2.js";import{c as ue}from"./chunk-DYLT6RRK.js";import{a as ge}from"./chunk-D76K4RZ7.js";import{g as de}from"./chunk-EIBGI6U2.js";import{g as ce}from"./chunk-TEQJOK4U.js";import{d as pe,g as se}from"./chunk-4CEFDQPI.js";import{t as _e,u as me}from"./chunk-2SC3HO66.js";import{b as ee,h as te,m as ne,y as ie}from"./chunk-2E5AKA74.js";import{c as re,e as le,f as ae}from"./chunk-FTHTFVHH.js";import{Ab as H,Ac as G,Ec as J,Fc as Q,Ha as v,Ib as b,Ja as a,Jb as s,Ka as F,Kb as k,Lb as S,Nb as O,Ob as D,Pb as N,Rb as Z,Tb as T,V as z,_a as p,ab as m,ac as $,bc as j,c as W,cc as q,dc as y,ga as A,hb as P,ib as E,kb as M,lb as V,mb as c,nb as _,oa as g,ob as I,pa as u,pb as x,qb as C,rb as R,sb as f,vb as h,vc as K,xa as B,xb as r,xc as X,yc as Y,za as U}from"./chunk-ZIZWZZ4E.js";var L=t=>[t],Te=t=>({"text-decoration-line-through":t}),be=t=>({"ms-10":t}),Se=t=>({"bg-gradient-warning":t});function ve(t,l){if(t&1){let n=f();c(0,"mat-slide-toggle",13),h("toggleChange",function(){g(n);let e=r();return e.toggleStatus=!e.toggleStatus,u(e.onToggle())}),c(1,"small",14),s(2),_()()}if(t&2){let n=r();a(2),S(" ",n.productToggleTitle?n.productToggleTitle:"FILTER DIFFERENT INVENTORY"," ")}}function Ie(t,l){if(t&1){let n=f();c(0,"th")(1,"input",16),N("ngModelChange",function(e){g(n);let o=r(2);return D(o.checkboxState,e)||(o.checkboxState=e),u(e)}),h("ngModelChange",function(){g(n);let e=r(2);return u(e.onCheckboxStateChange())}),_()()}if(t&2){let n=r(2);a(),O("ngModel",n.checkboxState)}}function ye(t,l){if(t&1&&(p(0,Ie,2,1,"ng-template",15),c(1,"th",11),s(2,"POS"),_()),t&2){let n=r();m("ngxPermissionsOnly",T(1,L,n.rolePriceEdit))}}function we(t,l){if(t&1&&(x(0),c(1,"th",17)(2,"div",18)(3,"div",19),I(4,"img",20),c(5,"div",21),s(6),$(7,"stringLimit"),_()()()(),C()),t&2){let n=l.$implicit;a(3),m("matTooltip",(n.Name==null?null:n.Name.length)>20?n.Name:""),a(),m("src",n==null?null:n.Img,v),a(2),S(" ",q(7,3,n.Name,20)," ")}}function Fe(t,l){t&1&&R(0)}function Pe(t,l){if(t&1&&(x(0),p(1,Fe,1,0,"ng-container",34),C()),t&2){r();let n=b(7);a(),m("ngTemplateOutlet",n)}}function Ee(t,l){t&1&&R(0)}function Me(t,l){if(t&1&&p(0,Ee,1,0,"ng-container",34),t&2){r(2);let n=b(7);m("ngTemplateOutlet",n)}}function Ve(t,l){if(t&1&&p(0,Me,1,1,"ng-template",15),t&2){let n=r(4);m("ngxPermissionsOnly",T(1,L,n.rolePriceEdit))}}function ke(t,l){if(t&1){let n=f();x(0),c(1,"input",35),N("ngModelChange",function(e){g(n);let o=r(4).$implicit;return D(o.selected,e)||(o.selected=e),u(e)}),h("ngModelChange",function(){g(n);let e=r(4).$implicit,o=r();return u(o.onCheckboxStateProduct(e.ID))}),_(),C()}if(t&2){let n=r(4).$implicit;a(),O("ngModel",n.selected)}}function Oe(t,l){if(t&1&&p(0,ke,2,1,"ng-container",22),t&2){let n=r(3).$implicit;m("ngIf",(n==null||n.Variants==null?null:n.Variants.length)>1)}}function De(t,l){if(t&1){let n=f();x(0),c(1,"img",36),h("click",function(e){g(n);let o=r(3).$implicit,d=r();return u(d.onZoomImage(e,o==null?null:o.ImageUrl))}),_(),C()}if(t&2){let n=r(3).$implicit;a(),H("src",n==null?null:n.ThumbnailUrl,v)}}function Ne(t,l){t&1&&I(0,"img",37)}function $e(t,l){if(t&1&&(x(0),c(1,"td",29)(2,"div",30),p(3,Pe,2,1,"ng-container",31)(4,Ve,1,3,"ng-template",null,0,y)(6,Oe,1,1,"ng-template",null,1,y),c(8,"div",26),p(9,De,2,1,"ng-container",31)(10,Ne,1,0,"ng-template",null,2,y),_()()(),c(12,"td",32)(13,"div"),s(14),_(),c(15,"small",33),s(16),_()(),C()),t&2){let n=b(5),i=b(11),e=r(2).$implicit,o=r();a(),m("rowSpan",e==null?null:e.Variants.length),a(2),m("ngIf",o.table=="inventory")("ngIfElse",n),a(5),m("ngClass",T(9,be,(e==null||e.Variants==null?null:e.Variants.length)<=1)),a(),m("ngIf",e==null?null:e.ThumbnailUrl)("ngIfElse",i),a(3),m("rowSpan",e==null?null:e.Variants.length),a(2),k(e==null?null:e.Name),a(2),S("(",e==null?null:e.Category,")")}}function Be(t,l){if(t&1){let n=f();c(0,"input",16),N("ngModelChange",function(e){g(n);let o=r(3).$implicit;return D(o.selected,e)||(o.selected=e),u(e)}),_()}if(t&2){let n=r(3).$implicit;O("ngModel",n.selected)}}function Ue(t,l){if(t&1&&(c(0,"td",38),p(1,Be,1,1,"input",39),_()),t&2){let n=r(2).$implicit,i=r(2);a(),m("ngIf",i.printPOS(n)>=0||i.table=="price")}}function Re(t,l){if(t&1&&(p(0,Ue,2,1,"ng-template",15),c(1,"td",24),s(2),$(3,"number"),_()),t&2){let n=r().$implicit,i=r(2);m("ngxPermissionsOnly",T(4,L,i.rolePriceEdit)),a(2),k(j(3,2,i.printPOS(n)))}}function je(t,l){if(t&1){let n=f();x(0),c(1,"td",40),h("click",function(){g(n);let e=r().$implicit,o=r().$implicit,d=r().$implicit,w=r();return u(w.openTableDialog(d.Name,o,e.ID,d.ChannelItemID))}),c(2,"div",30)(3,"div",41),s(4),$(5,"number"),_(),c(6,"a",42),h("click",function(e){return g(n),u(e==null?null:e.stopPropagation())}),I(7,"i",28),_()()(),C()}if(t&2){let n=l.$implicit,i=r(2).$implicit,e=r(2);a(),m("ngClass",T(5,Se,e.printPOS(i)!=e.printItem(n)&&e.hiddenIPOSInventory()==!1)),a(3),S(" ",j(5,3,e.printItem(n))," "),a(2),m("href",n.Url,v)}}function Le(t,l){t&1&&(c(0,"td",43)(1,"div",30)(2,"span"),s(3,"X"),_()()())}function We(t,l){if(t&1&&p(0,je,8,7,"ng-container",31)(1,Le,4,0,"ng-template",null,3,y),t&2){let n=l.$implicit,i=b(2),e=r().$implicit,o=r(2);m("ngIf",o.getItemFromChannel(e,n))("ngIfElse",i)}}function ze(t,l){if(t&1&&(c(0,"tr"),p(1,$e,17,11,"ng-container",22),c(2,"td",23),s(3),_(),c(4,"td",24)(5,"div",25)(6,"div",26),s(7),_(),c(8,"div",21)(9,"a",27),I(10,"i",28),_()()()(),p(11,Re,4,6),M(12,We,3,2,null,null,E),_()),t&2){let n=l.$implicit,i=l.$index,e=r(2);a(),m("ngIf",i==0),a(2),k(n==null?null:n.Model),a(2),m("matTooltip",n.Discontinued?e.discontinuedVariantMsg:""),a(),m("ngClass",T(7,Te,n.Discontinued)),a(),S(" ",n.Code," "),a(2),m("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(n==null?null:n.ID),v),a(2),P(e.hiddenIPOSInventory()==!1?11:-1),a(),V(e.channel)}}function Ae(t,l){if(t&1&&(c(0,"tbody"),M(1,ze,14,9,"tr",null,E),_()),t&2){let n=l.$implicit;a(),V(n.Variants)}}var ht=(()=>{let l=class l{constructor(i,e,o){this.dialog=i,this.biggerPictureService=e,this.authService=o,this.showProductToggle=!1,this.multiwarehouse=B(!1),this.hiddenIPOSInventory=B(!1),this.toggleStatus=!1,this.checkboxState=!1,this.rolePriceEdit=oe.price,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.onSubmit=new U,this.destroy$=new W,this.toggle=new U,this.hostName=this.authService.getDomain()}ngOnInit(){this.table=="inventory"?this.stockHeader="Stock":this.table=="price"&&(this.stockHeader="Price")}onCheckboxStateProduct(i){let e=this.data.filter(o=>o.ID==i);e.length>0&&(e=e.map(o=>(o.Variants=o.Variants.map(d=>(d.selected=o.selected,d)),o)))}onCheckboxStateChange(){this.data=this.data.map(i=>(i.Variants=i.Variants.map(e=>(e.selected=this.checkboxState,e)),i))}getItemFromChannel(i,e){return i.Channel.find(d=>re.IsNotEmpty(e.LocationID)?d.LocationID==e.LocationID:d.ChannelID==e.ID)}printItem(i){if(this.table=="inventory")return i.Inventory;if(this.table=="price")return i.Price}openTableDialog(i,e,o,d){this.dialog.open(he,{data:{Name:i,Variant:e,ChannelID:o,Table:this.table,ChannelItemID:d}}).afterClosed().pipe(z(this.destroy$)).subscribe(w=>{w!=null&&this.onSubmit.emit(w)})}printPOS(i){return this.table=="inventory"?i.Inventory?i.Inventory:0:this.table=="price"?i.UnitPrice:null}onToggle(){this.toggle.emit(this.toggleStatus)}onZoomImage(i,e){this.biggerPictureService.openBiggerPicture(i,e)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}};l.\u0275fac=function(e){return new(e||l)(F(pe),F(ge),F(ce))},l.\u0275cmp=A({type:l,selectors:[["app-table"]],inputs:{data:"data",table:"table",channel:"channel",showProductToggle:"showProductToggle",productToggleTitle:"productToggleTitle",multiwarehouse:[1,"multiwarehouse"],hiddenIPOSInventory:[1,"hiddenIPOSInventory"]},outputs:{onSubmit:"onSubmit",toggle:"onToggle"},standalone:!0,features:[Z],decls:17,vars:3,consts:[["PRICE",""],["checkbox_update",""],["elsePic",""],["elseCol",""],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],["scope","col","colspan","2",1,"text-center","w-25"],[1,"w-100"],[2,"width","200px"],["scope","col",1,"text-start","w-20"],["scope","col",1,"text-end","w-10"],[4,"ngFor","ngForOf"],[2,"width","200px",3,"toggleChange"],[1,"fw-bold"],[3,"ngxPermissionsOnly"],["type","checkbox",3,"ngModelChange","ngModel"],["scope","col"],[1,"w-100","d-flex","align-items-center","justify-content-center"],["matTooltipPosition","above",1,"d-flex","align-items-center","justify-content-center",2,"width","180px",3,"matTooltip"],[2,"width","16px","height","16px",3,"src"],[1,"ms-2"],[4,"ngIf"],[1,"text-start"],[1,"text-end"],["matTooltipPosition","above",1,"d-flex","align-items-center","justify-content-end",3,"matTooltip"],[3,"ngClass"],["target","_blank",3,"href"],[1,"fas","fa-solid","fa-arrow-up-right-from-square","external-link-custom"],[1,"text-center",3,"rowSpan"],[1,"d-flex","align-items-center","justify-content-center"],[4,"ngIf","ngIfElse"],[1,"text-start",2,"padding-left","0px",3,"rowSpan"],[1,"mt-1"],[4,"ngTemplateOutlet"],["type","checkbox",1,"me-3",3,"ngModelChange","ngModel"],[1,"border","rounded","w-img","cursor-pointer",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded","w-img"],[1,"align-middle"],["type","checkbox",3,"ngModel","ngModelChange",4,"ngIf"],[1,"p-0","pointer","cell-hover",3,"click","ngClass"],[1,"me-2","mt-1"],["target","_blank",3,"click","href"],[1,"table-white","text-center",2,"color","red"]],template:function(e,o){e&1&&(c(0,"div",4)(1,"table",5)(2,"thead",6)(3,"tr")(4,"th",7)(5,"div",8)(6,"div"),s(7,"Product"),_(),p(8,ve,3,1,"mat-slide-toggle",9),_()(),c(9,"th",10),s(10,"Variant"),_(),c(11,"th",11),s(12,"SKU"),_(),p(13,ye,3,3)(14,we,8,6,"ng-container",12),_()(),M(15,Ae,3,0,"tbody",null,E),_()()),e&2&&(a(8),P(o.showProductToggle?8:-1),a(5),P(o.hiddenIPOSInventory()==!1?13:-1),a(),m("ngForOf",o.channel),a(),V(o.data))},dependencies:[Q,K,X,Y,G,J,ie,ee,te,ne,Ce,xe,se,de,ue,ae,le,me,_e,fe],styles:[".w-10[_ngcontent-%COMP%]{width:10%}.w-20[_ngcontent-%COMP%]{width:20%}.w-img[_ngcontent-%COMP%]{width:40px;height:40px}.item-name[_ngcontent-%COMP%]{margin-bottom:-14px!important;font-size:larger}.cell-hover[_ngcontent-%COMP%]:hover{background-color:#c9c9c9!important}.text-wrapping[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;width:88px}.cell-hover[_ngcontent-%COMP%]{width:400px!important}"]});let t=l;return t})();export{ht as a};
@@ -1,4 +1,4 @@
1
- import{a as ee}from"./chunk-HHIG3XFB.js";import"./chunk-6U6JR5K6.js";import{a as $t,d as Zt,e as Xt}from"./chunk-YVTEU2IF.js";import{a as ht}from"./chunk-BVIRHZTZ.js";import{a as le,b as pe,c as vt}from"./chunk-33L2SBIN.js";import{a as se}from"./chunk-BGWVHGAY.js";import{b as Rt}from"./chunk-ULELZXI5.js";import"./chunk-E5BOLHDG.js";import"./chunk-A37OKNC2.js";import{a as Bt,b as zt,c as Gt,d as jt,e as Ht,f as Ut,g as Yt}from"./chunk-L4BFVIW5.js";import"./chunk-GNY5TY3R.js";import{a as Dt,b as Et}from"./chunk-7YWHTN3X.js";import"./chunk-CJILX5R7.js";import{i as qt}from"./chunk-2FRMUOJY.js";import{a as Jt,b as Kt}from"./chunk-C6QIBOCB.js";import{a as me,b as Tt}from"./chunk-47PEHCOU.js";import{f as kt,g as Lt,h as Vt,i as Ft,j as At}from"./chunk-KZ6AD6KW.js";import{a as Ot}from"./chunk-7VKIP3Z6.js";import"./chunk-DYLT6RRK.js";import{a as Q}from"./chunk-WTMUHE4V.js";import{b as Wt}from"./chunk-MKJON4UM.js";import{b as Mt}from"./chunk-WKSTGJK5.js";import{a as Pt,b as It,c as Nt}from"./chunk-GQG2K3LS.js";import{a as ge}from"./chunk-LWMWPW7O.js";import"./chunk-BTY6PS53.js";import"./chunk-EIBGI6U2.js";import{a as re,b as oe,c as gt,d as X,e as _t}from"./chunk-PYD2YWAN.js";import{f as ce,g as Z}from"./chunk-5GZGQTZO.js";import{b as Te,e as A}from"./chunk-JHYIHRQH.js";import"./chunk-KCDL7SWP.js";import{b as Ct,d as De,e as yt,f as wt,g as xt,m as Y,n as bt}from"./chunk-4CEFDQPI.js";import{t as ft,u as St}from"./chunk-2SC3HO66.js";import{P as ut}from"./chunk-DQIP7MCZ.js";import{b as He,c as $,h as z,m as G,o as ae,y as Ue}from"./chunk-2E5AKA74.js";import{b as N,c as M}from"./chunk-FTHTFVHH.js";import{$ as fe,$c as je,Ab as mt,B as at,Bb as st,Bc as ve,Cc as F,Ec as K,Fc as Se,Ha as V,Ib as O,Ja as p,Jb as m,Ka as v,Kb as S,Lb as T,Nb as w,Ob as x,Pb as b,Q as ye,Qb as dt,Rb as We,Sb as J,T as rt,Tb as Be,Ub as ie,Va as pt,Wc as Ge,X as be,Xc as ct,Zc as ne,_a as u,aa as Ae,ab as d,ac as P,bc as k,ca as de,cc as R,dc as U,ga as L,ha as Re,hb as Qe,mb as n,na as ot,nb as r,oa as g,ob as C,pa as _,pb as D,q as j,qa as Ze,qb as E,ra as Xe,sb as I,vb as y,vc as ze,w as nt,xb as c,xc as W,yc as B,za as lt}from"./chunk-ZIZWZZ4E.js";import{a as tt,b as it}from"./chunk-GNOSNGXM.js";var Qt=(()=>{let l=class l{constructor(){this.ObjectOrderTabs=[{Title:"1 - New Order",Url:"/menu/Order/new",Permissions:[]},{Title:"2 - Ready to Ship",Url:"/menu/Order/ready_to_ship",Permissions:[]},{Title:"3 - Shipped",Url:"/menu/Order/Shipped",Permissions:[]},{Title:"4 - Completed",Url:"/menu/Order/Delivered",Permissions:[]},{Title:"All",Url:"/menu/Order/All",Permissions:[]},{Title:"99 - Cancelled",Url:"/menu/Order/Cancelled",Permissions:[]},{Title:"Download",Url:"/menu/Order/Download",Permissions:[ht.downloadOrder]}]}ngOnInit(){}};l.\u0275fac=function(t){return new(t||l)},l.\u0275cmp=L({type:l,selectors:[["app-orders"]],decls:5,vars:2,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid"],[3,"Tabs","usePermissions"]],template:function(t,i){t&1&&(n(0,"nav",0)(1,"div",1)(2,"div"),C(3,"nav-tab",2),r()()(),C(4,"router-outlet")),t&2&&(p(3),d("Tabs",i.ObjectOrderTabs)("usePermissions",!0))},dependencies:[Dt,ct]});let a=l;return a})();var ei=(()=>{let l=class l{constructor(){}convertToCSV(e,t){let i;if(typeof e=="string")i=e;else{var h=typeof e=="object"?e:JSON.parse(e);i=this.transformToCSVStringFormat(h)}this.downloadCSV(i,t)}transformToCSVStringFormat(e){if(!e||!e.length)return;let t=",",i=Object.keys(e[0]);return e.map(f=>i.map(s=>{let q=f[s]===null||f[s]===void 0?"":f[s];return q=q instanceof Date?q.toLocaleString():q.toString().replace(/"/g,'""'),q.search(/("|,|\n)/g)>=0&&(q=`"${q}"`),q}).join(t)).join(`
1
+ import{a as ee}from"./chunk-HHIG3XFB.js";import"./chunk-6U6JR5K6.js";import{a as $t,d as Zt,e as Xt}from"./chunk-YVTEU2IF.js";import{a as ht}from"./chunk-BVIRHZTZ.js";import{a as le,b as pe,c as vt}from"./chunk-33L2SBIN.js";import{a as se}from"./chunk-BGWVHGAY.js";import{b as Rt}from"./chunk-ULELZXI5.js";import"./chunk-E5BOLHDG.js";import"./chunk-A37OKNC2.js";import{a as Bt,b as zt,c as Gt,d as jt,e as Ht,f as Ut,g as Yt}from"./chunk-L4BFVIW5.js";import"./chunk-GNY5TY3R.js";import{a as Dt,b as Et}from"./chunk-7YWHTN3X.js";import"./chunk-CJILX5R7.js";import{i as qt}from"./chunk-2FRMUOJY.js";import{a as Jt,b as Kt}from"./chunk-C6QIBOCB.js";import{a as me,b as Tt}from"./chunk-47PEHCOU.js";import{f as kt,g as Lt,h as Vt,i as Ft,j as At}from"./chunk-KZ6AD6KW.js";import{a as Ot}from"./chunk-7VKIP3Z6.js";import"./chunk-DYLT6RRK.js";import{a as Q}from"./chunk-WTMUHE4V.js";import{b as Wt}from"./chunk-MKJON4UM.js";import{b as Mt}from"./chunk-WKSTGJK5.js";import{a as Pt,b as It,c as Nt}from"./chunk-GQG2K3LS.js";import{a as ge}from"./chunk-D77F5RO6.js";import"./chunk-BTY6PS53.js";import"./chunk-EIBGI6U2.js";import{a as re,b as oe,c as gt,d as X,e as _t}from"./chunk-PYD2YWAN.js";import{f as ce,g as Z}from"./chunk-TEQJOK4U.js";import{b as Te,e as A}from"./chunk-JHYIHRQH.js";import"./chunk-KCDL7SWP.js";import{b as Ct,d as De,e as yt,f as wt,g as xt,m as Y,n as bt}from"./chunk-4CEFDQPI.js";import{t as ft,u as St}from"./chunk-2SC3HO66.js";import{P as ut}from"./chunk-DQIP7MCZ.js";import{b as He,c as $,h as z,m as G,o as ae,y as Ue}from"./chunk-2E5AKA74.js";import{b as N,c as M}from"./chunk-FTHTFVHH.js";import{$ as fe,$c as je,Ab as mt,B as at,Bb as st,Bc as ve,Cc as F,Ec as K,Fc as Se,Ha as V,Ib as O,Ja as p,Jb as m,Ka as v,Kb as S,Lb as T,Nb as w,Ob as x,Pb as b,Q as ye,Qb as dt,Rb as We,Sb as J,T as rt,Tb as Be,Ub as ie,Va as pt,Wc as Ge,X as be,Xc as ct,Zc as ne,_a as u,aa as Ae,ab as d,ac as P,bc as k,ca as de,cc as R,dc as U,ga as L,ha as Re,hb as Qe,mb as n,na as ot,nb as r,oa as g,ob as C,pa as _,pb as D,q as j,qa as Ze,qb as E,ra as Xe,sb as I,vb as y,vc as ze,w as nt,xb as c,xc as W,yc as B,za as lt}from"./chunk-ZIZWZZ4E.js";import{a as tt,b as it}from"./chunk-GNOSNGXM.js";var Qt=(()=>{let l=class l{constructor(){this.ObjectOrderTabs=[{Title:"1 - New Order",Url:"/menu/Order/new",Permissions:[]},{Title:"2 - Ready to Ship",Url:"/menu/Order/ready_to_ship",Permissions:[]},{Title:"3 - Shipped",Url:"/menu/Order/Shipped",Permissions:[]},{Title:"4 - Completed",Url:"/menu/Order/Delivered",Permissions:[]},{Title:"All",Url:"/menu/Order/All",Permissions:[]},{Title:"99 - Cancelled",Url:"/menu/Order/Cancelled",Permissions:[]},{Title:"Download",Url:"/menu/Order/Download",Permissions:[ht.downloadOrder]}]}ngOnInit(){}};l.\u0275fac=function(t){return new(t||l)},l.\u0275cmp=L({type:l,selectors:[["app-orders"]],decls:5,vars:2,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid"],[3,"Tabs","usePermissions"]],template:function(t,i){t&1&&(n(0,"nav",0)(1,"div",1)(2,"div"),C(3,"nav-tab",2),r()()(),C(4,"router-outlet")),t&2&&(p(3),d("Tabs",i.ObjectOrderTabs)("usePermissions",!0))},dependencies:[Dt,ct]});let a=l;return a})();var ei=(()=>{let l=class l{constructor(){}convertToCSV(e,t){let i;if(typeof e=="string")i=e;else{var h=typeof e=="object"?e:JSON.parse(e);i=this.transformToCSVStringFormat(h)}this.downloadCSV(i,t)}transformToCSVStringFormat(e){if(!e||!e.length)return;let t=",",i=Object.keys(e[0]);return e.map(f=>i.map(s=>{let q=f[s]===null||f[s]===void 0?"":f[s];return q=q instanceof Date?q.toLocaleString():q.toString().replace(/"/g,'""'),q.search(/("|,|\n)/g)>=0&&(q=`"${q}"`),q}).join(t)).join(`
2
2
  `)}downloadCSV(e,t){var i=new Blob([e],{type:"text/csv;charset=utf8;"}),h=document.createElement("a");h.setAttribute("href",window.URL.createObjectURL(i)),h.setAttribute("download",t),document.body.appendChild(h),h.click(),document.body.removeChild(h)}};l.\u0275fac=function(t){return new(t||l)},l.\u0275prov=fe({token:l,factory:l.\u0275fac,providedIn:"root"});let a=l;return a})();var Ee=(()=>{let l=class l{constructor(e,t){this.http=e,this.exportService=t}loadInitialPage(){return this.http.post("/api/ordersLoader/GetOrder",{})}getNewOrders(e){return this.http.post("/api/orders/GetNewOrder",e).pipe(j(t=>t.Data))}getTotalNewOrders(e,t,i){let h={ListChannelID:e,From:t,To:i};return this.http.post("/api/orders/GetCountNewOrder",h).pipe(j(f=>f.Count))}exportOrders(e,t){return this.http.post("api/Orders/ExportOrder",e).pipe(be(i=>{this.exportService.convertToCSV(i,t)}))}};l.\u0275fac=function(t){return new(t||l)(de(A),de(ei))},l.\u0275prov=fe({token:l,factory:l.\u0275fac});let a=l;return a})();var Ye=(()=>{let l=class l{constructor(e,t){this.http=e,this.toastr=t}acceptTokopediaOrders(e){return this.http.post("/api/Orders/AcceptOrderTokopedia",e).pipe(be(t=>{this.tokopediaAcceptOrderHandler(t)}))}tokopediaAcceptOrderHandler(e){let t=e.filter(h=>h.Status==!1),i=e.filter(h=>h.Status==!0);if(t.length==0&&i.length>0){let h=`<ol>${this.generateSuccessMessage(i)}</ol>`;this.toastr.success(h,"Success",{enableHtml:!0})}else if(t.length>0&&i.length>0){let h=`<ol>
3
3
  ${this.generateSuccessMessage(i)}
4
4
  ${this.generateErrorMessage(t)}
@@ -1 +1 @@
1
- import"./chunk-3VGAURY3.js";import{a as Oe}from"./chunk-65RMQ5Q5.js";import{a as K}from"./chunk-XHAXYWZ7.js";import{a as De,b as Ve,c as X}from"./chunk-MZNSPLFO.js";import{a as _e}from"./chunk-BVIRHZTZ.js";import{a as Me}from"./chunk-JY3L4RUM.js";import{a as Ie}from"./chunk-7KG3DC5J.js";import{b as Ee}from"./chunk-ULELZXI5.js";import{a as Te}from"./chunk-E5BOLHDG.js";import"./chunk-A37OKNC2.js";import"./chunk-C6QIBOCB.js";import{a as we}from"./chunk-7VKIP3Z6.js";import"./chunk-DYLT6RRK.js";import{a as Se,b as ve,c as ye}from"./chunk-GQG2K3LS.js";import{a as Fe}from"./chunk-D76K4RZ7.js";import"./chunk-EIBGI6U2.js";import{g as fe}from"./chunk-5GZGQTZO.js";import{b as ue,e as ge}from"./chunk-JHYIHRQH.js";import"./chunk-KCDL7SWP.js";import{d as xe,m as Pe,n as be}from"./chunk-4CEFDQPI.js";import{t as j,u as W}from"./chunk-2SC3HO66.js";import"./chunk-DQIP7MCZ.js";import{b as de,h as L,m as U,y as A}from"./chunk-2E5AKA74.js";import{c as J,e as he,f as Ce}from"./chunk-FTHTFVHH.js";import{Ab as ie,B as G,Bc as me,Ec as pe,Fc as $,Ha as T,Ib as z,Ja as l,Jb as p,Ka as P,Kb as oe,Lb as x,Nb as V,Ob as N,Pb as k,Q as q,Qb as re,Rb as B,Tb as F,Ub as ae,X as Y,_a as g,ab as s,ac as S,bc as w,cc as le,da as Q,db as te,dc as H,ga as D,hb as ne,ib as E,kb as M,lb as O,mb as a,nb as c,oa as C,ob as b,pa as f,pb as v,q as Z,qb as y,sb as I,vb as h,vc as ce,xb as m,xc as R,yc as se,za as ee}from"./chunk-ZIZWZZ4E.js";import"./chunk-GNOSNGXM.js";var Ae=(t,r)=>({color:t,"font-weight":r});function je(t,r){if(t&1&&(a(0,"mat-radio-button",2),p(1),c()),t&2){let i=r.$implicit,o=r.index,e=m();te(ae(7,Ae,e.model==i.Key&&e.activeBold?"#0976b4":"",e.model==i.Key&&e.activeBold?"700":"")),s("disabled",e.exception==i.Value)("matTooltip",e.title.length>0?e.title[o]:"")("value",i.Key)("name",e.name),l(),x("",i.Value," ")}}var Ne=(()=>{let r=class r{constructor(){this.disabled=!1,this.modelChange=new ee,this.options=[{Key:!1,Value:"No"},{Key:!0,Value:"Yes"}],this.border=!1,this.name="",this.title=[],this.exception="",this.activeBold=""}change(o){this.modelChange.emit(o)}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=D({type:r,selectors:[["lib-radio-options"]],inputs:{model:"model",disabled:"disabled",options:"options",border:"border",name:"name",title:"title",exception:"exception",activeBold:"activeBold"},outputs:{modelChange:"modelChange"},standalone:!0,features:[B],decls:2,vars:3,consts:[["color","primary",3,"ngModelChange","disabled","ngModel"],["matTooltipPosition","above","class","me-4 mt-1",3,"style","disabled","matTooltip","value","name",4,"ngFor","ngForOf"],["matTooltipPosition","above",1,"me-4","mt-1",3,"disabled","matTooltip","value","name"]],template:function(e,n){e&1&&(a(0,"mat-radio-group",0),h("ngModelChange",function(_){return n.change(_)}),g(1,je,2,10,"mat-radio-button",1),c()),e&2&&(s("disabled",n.disabled)("ngModel",n.model),l(),s("ngForOf",n.options))},dependencies:[$,R,ye,Se,ve,A,L,U,W,j],styles:["html[_ngcontent-%COMP%]{--mdc-radio-state-layer-size: 36px;--mat-radio-touch-target-display: block}.mat-mdc-radio-button[_ngcontent-%COMP%] .mdc-radio[_ngcontent-%COMP%] .mdc-radio__native-control[_ngcontent-%COMP%]:enabled:checked + .mdc-radio__background[_ngcontent-%COMP%] .mdc-radio__outer-circle[_ngcontent-%COMP%]{border-color:#0976b4!important}.mat-mdc-radio-button[_ngcontent-%COMP%] .mdc-radio[_ngcontent-%COMP%] .mdc-radio__native-control[_ngcontent-%COMP%]:enabled + .mdc-radio__background[_ngcontent-%COMP%] .mdc-radio__inner-circle[_ngcontent-%COMP%]{background-color:#0976b4!important;border-color:#0976b4!important}"]});let t=r;return t})();var ke=t=>[t],We=t=>({"text-decoration-line-through":t}),Ke=t=>({"border-bottom":t}),Ge=t=>({"bg-gradient-warning":t});function ze(t,r){if(t&1){let i=I();v(0),a(1,"div",21)(2,"h6",22),p(3,"Filter by"),c(),a(4,"lib-radio-options",23),k("modelChange",function(e){C(i);let n=m();return N(n.filterType,e)||(n.filterType=e),f(e)}),c()(),y()}if(t&2){let i=m();l(4),V("model",i.filterType),s("options",i.filterTypeOptions)}}function He(t,r){if(t&1){let i=I();a(0,"button",25),h("click",function(){C(i);let e=m().ngIf,n=m();return f(n.onUpdateItems(e))}),b(1,"i",26),p(2," Update "),c()}}function Je(t,r){if(t&1&&(v(0),a(1,"div",4),g(2,He,3,0,"button",24),c(),y()),t&2){let i=r.ngIf,o=m();l(2),s("ngIf",o.productService.hasSelectionVariant(i))}}function Xe(t,r){if(t&1&&(a(0,"th",15)(1,"div",27),b(2,"img",28),a(3,"div",29),p(4),S(5,"stringLimit"),c()()()),t&2){let i=r.$implicit;l(),s("matTooltip",(i.Name==null?null:i.Name.length)>20?i.Name:""),l(),s("src",i==null?null:i.Img,T),l(2),x(" ",le(5,3,i.Name,20)," ")}}function Ze(t,r){if(t&1){let i=I();a(0,"th")(1,"input",30),k("ngModelChange",function(e){C(i);let n=m();return N(n.checkboxState,e)||(n.checkboxState=e),f(e)}),h("ngModelChange",function(){C(i);let e=m();return f(e.onSelectAllData())}),c()()}if(t&2){let i=m();l(),V("ngModel",i.checkboxState)}}function qe(t,r){t&1&&(a(0,"th",31)(1,"span"),p(2,"Expected"),c(),a(3,"span",32),p(4,"(POS)"),c()(),a(5,"th",31),p(6,"Channel"),c())}function Ye(t,r){if(t&1){let i=I();a(0,"img",45),h("click",function(e){C(i);let n=m(3).$implicit,d=m(2);return f(d.onZoomImage(e,n==null?null:n.ImageUrl))}),c()}if(t&2){let i=m(3).$implicit;ie("src",i==null?null:i.ImageUrl,T)}}function Qe(t,r){t&1&&b(0,"img",46)}function et(t,r){if(t&1&&(a(0,"small",44),p(1),c()),t&2){let i=m(3).$implicit;l(),x("(",i==null?null:i.Category,")")}}function tt(t,r){if(t&1&&(v(0),a(1,"td",40),g(2,Ye,1,1,"img",41)(3,Qe,1,0,"ng-template",null,0,H),c(),a(5,"td",42)(6,"h5",43),p(7),c(),g(8,et,2,1,"small",44),c(),y()),t&2){let i=z(4),o=m().$index,e=m().$implicit,n=m().ngIf;l(),s("rowSpan",e==null?null:e.Variants.length)("ngClass",F(7,Ke,o+1==n.length)),l(),s("ngIf",e==null?null:e.ImageUrl)("ngIfElse",i),l(3),s("rowSpan",e==null?null:e.Variants.length),l(2),oe(e==null?null:e.Name),l(),ne(e!=null&&e.Category?8:-1)}}function nt(t,r){if(t&1){let i=I();a(0,"td",47)(1,"input",30),k("ngModelChange",function(e){C(i);let n=m().$implicit;return N(n.selected,e)||(n.selected=e),f(e)}),c()()}if(t&2){let i=m().$implicit;l(),V("ngModel",i.selected)}}function it(t,r){if(t&1){let i=I();v(0),a(1,"td",49),p(2),S(3,"number"),c(),a(4,"td",50),h("click",function(){let e=C(i).$implicit,n=m(2).$implicit,d=m().$implicit,_=m(2);return f(_.openTableDialog(n,d,e))}),a(5,"div",51)(6,"div",52),p(7),S(8,"number"),c(),a(9,"a",53),h("click",function(e){return C(i),f(e==null?null:e.stopPropagation())}),b(10,"i",38),c()()(),y()}if(t&2){let i=r.$implicit;l(2),x(" ",w(3,4,i.PriceExpected)," "),l(2),s("ngClass",F(8,Ge,i.Price!=i.PriceExpected)),l(3),x(" ",w(8,6,i.Price)," "),l(2),s("href",i.Url,T)}}function ot(t,r){t&1&&(a(0,"td",54),p(1," X "),c(),a(2,"td",54),p(3," X "),c())}function rt(t,r){if(t&1&&(v(0),g(1,it,11,10,"ng-container",48)(2,ot,4,0,"ng-template",null,1,H),y()),t&2){let i=r.$implicit,o=z(3),e=m().$implicit,n=m(3);l(),s("ngIf",n.getItemFromChannel(e,i.ID))("ngIfElse",o)}}function at(t,r){if(t&1&&(a(0,"tr"),g(1,tt,9,9,"ng-container",3),a(2,"td",33),p(3),c(),a(4,"td",34)(5,"div",35)(6,"div",36),p(7),c(),a(8,"div",29)(9,"a",37),b(10,"i",38),c()()()(),g(11,nt,2,1,"ng-template",19)(12,rt,4,2,"ng-container",39),c()),t&2){let i=r.$implicit,o=r.$index,e=m(3);l(),s("ngIf",o==0),l(2),x(" ",i==null?null:i.Model," "),l(),s("matTooltip",i.Discontinued?e.discontinuedVariantMsg:""),l(2),s("ngClass",F(8,We,i.Discontinued)),l(),x(" ",i==null?null:i.Code," "),l(2),s("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(i==null?null:i.ID),T),l(2),s("ngxPermissionsOnly",F(10,ke,e.rolePriceEdit)),l(),s("ngForOf",e.channelOptions)}}function lt(t,r){if(t&1&&(a(0,"tbody"),M(1,at,13,12,"tr",null,E),c()),t&2){let i=r.$implicit;l(),O(i.Variants)}}function ct(t,r){if(t&1&&(v(0),M(1,lt,3,0,"tbody",null,E),y()),t&2){let i=r.ngIf;l(),O(i)}}var Zt=(()=>{let r=class r{constructor(o,e,n,d,_,u,Be){this.http=o,this.toastr=e,this.dialog=n,this.productService=d,this.authService=_,this.biggerPictureService=u,this.paginationService=Be,this.infinitePagination=Q(X),this.searchFilter=new Ie,this.checkboxState=!1,this.rolePriceEdit=_e.price,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.rowCountAPI="Inventory/GetMultipleChannelComparisonRowCount",this.filterTypeOptions=[{Key:K.ALL,Value:"All"},{Key:K.DIFFERENCE,Value:"Difference"}],this.filterType=K.ALL,this.pageData={Title:"Price Realtime",Nav:[{Title:"Price Cache",Url:"/menu/price",Active:!1}]},this.channelOptions=this.authService.getChannels(),this.hostName=this.authService.getDomain(),this.initPagination()}initPagination(){this.infinitePagination.fetchDataEndpoint="Price/GetOutletPrice",this.infinitePagination.fethRowCountEndpoint=this.rowCountAPI,this.initProduct(),this.initPageLoader()}initProduct(){this.data$=this.infinitePagination.data$.pipe(q(1))}initPageLoader(){this.loader$=this.http.post("/api/PriceLoader/LoadMultiple",{}).pipe(Y(o=>{this.searchFilter=o.Filter,this.infinitePagination.reloadPagination(this.searchFilter)}))}onSelectAllData(){this.data$=this.data$.pipe(Z(o=>(o.map(e=>(e.Variants&&(e.Variants=e.Variants.map(n=>(n.selected=this.checkboxState,n))),e)),o)))}onFilter(o){this.searchFilter.text=o;let e={text:o,filterModel:this.filterType,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount};this.infinitePagination.reloadPagination(e)}updatePrice(o){let e=this.productService.selectedVariantProduct(o);if(e.length>0){let n=e.map(u=>u.ID),_={ListChannelID:this.channelOptions.filter(u=>u.selected).map(u=>u.ID),ListID:n};this.http.post("/api/Price/UpdateChannelOutletPrice",_).subscribe({next:u=>{this.resetSelectedChannel(),this.onFilter(),this.toastr.success("Successfully updated "+_.ListID.length+" items in "+_.ListChannelID.length+" channels","Success")},error:u=>{this.resetSelectedChannel()}})}}resetSelectedChannel(){this.channelOptions=this.channelOptions.map(o=>(o.selected=!1,o))}getItemFromChannel(o,e){return o.Channel.find(n=>n.ChannelID==e)}onUpdateItems(o){let e=this.productService.selectedVariantProduct(o);this.dialog.open(Oe,{data:{selectedItems:e,channels:this.channelOptions},width:"600px"}).afterClosed().pipe(G(n=>J.IsNotEmpty(n))).subscribe(n=>{this.channelOptions=n,this.updatePrice(o)})}openTableDialog(o,e,n){let d=JSON.parse(JSON.stringify(o));this.dialog.open(De,{data:{Name:e.Name,Variant:d,ChannelID:n?.ChannelID,Table:"price",ChannelItemID:n?.ChannelItemID}}).afterClosed().pipe(G(u=>J.IsNotEmpty(u))).subscribe(u=>{this.updateProductPrice(u,n)})}updateProductPrice(o,e){let n={ID:o.ChannelID,ChannelItemID:o.ChannelItemID,ChannelVariantID:o.ChannelVariationID,Price:parseFloat(o.Price),VariantID:o.ID,SKU:o.Sku};this.http.post("/api/Price/UpdatePriceByID",n).subscribe(d=>{e.Price=n.Price;let _=this.productService.findChannelById(n.ID,this.channelOptions);this.toastr.success(`Successfully updated ${o.ItemName} (${o.VarName}) inventory in ${_.Name} to ${n.Price}`,"Success")})}openExportDialog(){this.dialog.open(Ee,{data:{title:"Export Custom Channel Price",pageNumber:this.searchFilter.PageNumber,rowCount:this.searchFilter.RowCount,filterExport:this.searchFilter,getRowCountApi:this.rowCountAPI,exportApi:"price/GetExportOutletPrice"}}).afterClosed().subscribe()}onZoomImage(o,e){this.biggerPictureService.openBiggerPicture(o,e)}};r.\u0275fac=function(e){return new(e||r)(P(ge),P(ue),P(xe),P(we),P(fe),P(Fe),P(Me))},r.\u0275cmp=D({type:r,selectors:[["app-custom-channel-price"]],standalone:!0,features:[re([X]),B],decls:38,vars:23,consts:[["elsePic",""],["elseCol",""],["headerTitle","Price Comparison",3,"onSubmit","hideSearchBox","hideSearchDropdown","textButton"],[4,"ngIf"],[1,"d-flex"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],[1,"channel-column"],["colspan","5"],["scope","col","colspan","2",1,"text-center","border-bottom-0","border","text-uppercase"],["scope","col","colspan","2",1,"text-center","w-25"],["scope","col",1,"text-start","w-20"],["scope","col",1,"text-end","w-10"],[3,"ngxPermissionsOnly"],[3,"onNextPage","onLastPage","onGetRowCount","totalData","hideCount","rowCount","pageNumber","disableNextButton","goToLastPage"],[2,"height","46px"],[1,"mb-3"],["name","filterModel",3,"modelChange","model","options"],["type","button","class","btn btn-success shadow rounded","data-toggle","modal",3,"click",4,"ngIf"],["type","button","data-toggle","modal",1,"btn","btn-success","shadow","rounded",3,"click"],[1,"fas","fa-chevron-circle-up"],["matTooltipPosition","above",1,"d-flex","align-items-center","justify-content-center",2,"width","180px",3,"matTooltip"],[2,"width","16px","height","16px",3,"src"],[1,"ms-2"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"text-end","border-top-0","border","w-10"],[1,"ms-1"],[1,"text-start","border-bottom"],["matTooltipPosition","above",1,"text-end","border-bottom",3,"matTooltip"],[1,"d-flex","align-items-center","justify-content-end"],[3,"ngClass"],["target","_blank",3,"href"],[1,"fas","fa-solid","fa-arrow-up-right-from-square","external-link-custom"],[4,"ngFor","ngForOf"],[1,"text-center",3,"rowSpan","ngClass"],["class","border rounded w-img cursor-pointer",3,"src","click",4,"ngIf","ngIfElse"],[1,"text-start","border-bottom",2,"padding-left","0px",3,"rowSpan"],[1,"mb-0","item-name"],[1,"mt-1"],[1,"border","rounded","w-img","cursor-pointer",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded","w-img"],[1,"align-middle"],[4,"ngIf","ngIfElse"],[1,"text-end","border"],[1,"text-center","border","pointer","cell-hover",3,"click","ngClass"],[1,"d-flex","align-items-center","justify-content-center"],[1,"me-2"],["target","_blank",3,"click","href"],[1,"table-white","border","text-end",2,"color","red"]],template:function(e,n){e&1&&(a(0,"mainpanel",2),h("onSubmit",function(_){return n.onFilter(_)}),a(1,"filters"),g(2,ze,5,2,"ng-container",3),S(3,"async"),c(),a(4,"actions")(5,"div",4),g(6,Je,3,1,"ng-container",3),S(7,"async"),a(8,"button",5),h("click",function(){return n.openExportDialog()}),b(9,"i",6),a(10,"span"),p(11,"Export"),c()()()(),a(12,"content")(13,"div",7)(14,"div",8)(15,"div",9)(16,"div",10)(17,"table",11)(18,"thead",12)(19,"tr",13),b(20,"th",14),M(21,Xe,6,6,"th",15,E),c(),a(23,"tr")(24,"th",16)(25,"span"),p(26," Product "),c()(),a(27,"th",17),p(28,"Variant"),c(),a(29,"th",18),p(30,"SKU"),c(),g(31,Ze,2,1,"ng-template",19),M(32,qe,7,0,null,null,E),c()(),g(34,ct,3,0,"ng-container",3),S(35,"async"),c(),a(36,"infinite-paginator",20),S(37,"async"),h("onNextPage",function(){return n.infinitePagination.onNextPage(n.searchFilter)})("onLastPage",function(){return n.infinitePagination.onLastPage(n.searchFilter)})("onGetRowCount",function(){return n.infinitePagination.getRowCount(n.searchFilter)}),c()()()()()()()),e&2&&(s("hideSearchBox",!1)("hideSearchDropdown",!1)("textButton","Search"),l(2),s("ngIf",w(3,13,n.loader$)),l(4),s("ngIf",w(7,15,n.data$)),l(15),O(n.channelOptions),l(10),s("ngxPermissionsOnly",F(21,ke,n.rolePriceEdit)),l(),O(n.channelOptions),l(2),s("ngIf",w(35,17,n.data$)),l(2),s("totalData",n.infinitePagination.totalData())("hideCount",n.infinitePagination.hideCount())("rowCount",w(37,19,n.infinitePagination.totalRowCount$))("pageNumber",n.infinitePagination.pageNumber())("disableNextButton",n.infinitePagination.disableNextButton())("goToLastPage",n.infinitePagination.isLastPage()))},dependencies:[$,ce,R,se,me,pe,be,Pe,A,de,L,U,Ve,Ne,W,j,Te,Ce,he],styles:[".w-10[_ngcontent-%COMP%]{width:10%}.w-20[_ngcontent-%COMP%]{width:20%}.w-img[_ngcontent-%COMP%]{width:40px;height:40px}.item-name[_ngcontent-%COMP%]{font-weight:400;font-size:larger}.cell-hover[_ngcontent-%COMP%]:hover{background-color:#c9c9c9!important}"]});let t=r;return t})();export{Zt as CustomChannelPriceComponent};
1
+ import"./chunk-2D6GZYV6.js";import{a as Oe}from"./chunk-65RMQ5Q5.js";import{a as K}from"./chunk-XHAXYWZ7.js";import{a as De,b as Ve,c as X}from"./chunk-MZNSPLFO.js";import{a as _e}from"./chunk-BVIRHZTZ.js";import{a as Me}from"./chunk-JY3L4RUM.js";import{a as Ie}from"./chunk-7KG3DC5J.js";import{b as Ee}from"./chunk-ULELZXI5.js";import{a as Te}from"./chunk-E5BOLHDG.js";import"./chunk-A37OKNC2.js";import"./chunk-C6QIBOCB.js";import{a as we}from"./chunk-7VKIP3Z6.js";import"./chunk-DYLT6RRK.js";import{a as Se,b as ve,c as ye}from"./chunk-GQG2K3LS.js";import{a as Fe}from"./chunk-D76K4RZ7.js";import"./chunk-EIBGI6U2.js";import{g as fe}from"./chunk-TEQJOK4U.js";import{b as ue,e as ge}from"./chunk-JHYIHRQH.js";import"./chunk-KCDL7SWP.js";import{d as xe,m as Pe,n as be}from"./chunk-4CEFDQPI.js";import{t as j,u as W}from"./chunk-2SC3HO66.js";import"./chunk-DQIP7MCZ.js";import{b as de,h as L,m as U,y as A}from"./chunk-2E5AKA74.js";import{c as J,e as he,f as Ce}from"./chunk-FTHTFVHH.js";import{Ab as ie,B as G,Bc as me,Ec as pe,Fc as $,Ha as T,Ib as z,Ja as l,Jb as p,Ka as P,Kb as oe,Lb as x,Nb as V,Ob as N,Pb as k,Q as q,Qb as re,Rb as B,Tb as F,Ub as ae,X as Y,_a as g,ab as s,ac as S,bc as w,cc as le,da as Q,db as te,dc as H,ga as D,hb as ne,ib as E,kb as M,lb as O,mb as a,nb as c,oa as C,ob as b,pa as f,pb as v,q as Z,qb as y,sb as I,vb as h,vc as ce,xb as m,xc as R,yc as se,za as ee}from"./chunk-ZIZWZZ4E.js";import"./chunk-GNOSNGXM.js";var Ae=(t,r)=>({color:t,"font-weight":r});function je(t,r){if(t&1&&(a(0,"mat-radio-button",2),p(1),c()),t&2){let i=r.$implicit,o=r.index,e=m();te(ae(7,Ae,e.model==i.Key&&e.activeBold?"#0976b4":"",e.model==i.Key&&e.activeBold?"700":"")),s("disabled",e.exception==i.Value)("matTooltip",e.title.length>0?e.title[o]:"")("value",i.Key)("name",e.name),l(),x("",i.Value," ")}}var Ne=(()=>{let r=class r{constructor(){this.disabled=!1,this.modelChange=new ee,this.options=[{Key:!1,Value:"No"},{Key:!0,Value:"Yes"}],this.border=!1,this.name="",this.title=[],this.exception="",this.activeBold=""}change(o){this.modelChange.emit(o)}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=D({type:r,selectors:[["lib-radio-options"]],inputs:{model:"model",disabled:"disabled",options:"options",border:"border",name:"name",title:"title",exception:"exception",activeBold:"activeBold"},outputs:{modelChange:"modelChange"},standalone:!0,features:[B],decls:2,vars:3,consts:[["color","primary",3,"ngModelChange","disabled","ngModel"],["matTooltipPosition","above","class","me-4 mt-1",3,"style","disabled","matTooltip","value","name",4,"ngFor","ngForOf"],["matTooltipPosition","above",1,"me-4","mt-1",3,"disabled","matTooltip","value","name"]],template:function(e,n){e&1&&(a(0,"mat-radio-group",0),h("ngModelChange",function(_){return n.change(_)}),g(1,je,2,10,"mat-radio-button",1),c()),e&2&&(s("disabled",n.disabled)("ngModel",n.model),l(),s("ngForOf",n.options))},dependencies:[$,R,ye,Se,ve,A,L,U,W,j],styles:["html[_ngcontent-%COMP%]{--mdc-radio-state-layer-size: 36px;--mat-radio-touch-target-display: block}.mat-mdc-radio-button[_ngcontent-%COMP%] .mdc-radio[_ngcontent-%COMP%] .mdc-radio__native-control[_ngcontent-%COMP%]:enabled:checked + .mdc-radio__background[_ngcontent-%COMP%] .mdc-radio__outer-circle[_ngcontent-%COMP%]{border-color:#0976b4!important}.mat-mdc-radio-button[_ngcontent-%COMP%] .mdc-radio[_ngcontent-%COMP%] .mdc-radio__native-control[_ngcontent-%COMP%]:enabled + .mdc-radio__background[_ngcontent-%COMP%] .mdc-radio__inner-circle[_ngcontent-%COMP%]{background-color:#0976b4!important;border-color:#0976b4!important}"]});let t=r;return t})();var ke=t=>[t],We=t=>({"text-decoration-line-through":t}),Ke=t=>({"border-bottom":t}),Ge=t=>({"bg-gradient-warning":t});function ze(t,r){if(t&1){let i=I();v(0),a(1,"div",21)(2,"h6",22),p(3,"Filter by"),c(),a(4,"lib-radio-options",23),k("modelChange",function(e){C(i);let n=m();return N(n.filterType,e)||(n.filterType=e),f(e)}),c()(),y()}if(t&2){let i=m();l(4),V("model",i.filterType),s("options",i.filterTypeOptions)}}function He(t,r){if(t&1){let i=I();a(0,"button",25),h("click",function(){C(i);let e=m().ngIf,n=m();return f(n.onUpdateItems(e))}),b(1,"i",26),p(2," Update "),c()}}function Je(t,r){if(t&1&&(v(0),a(1,"div",4),g(2,He,3,0,"button",24),c(),y()),t&2){let i=r.ngIf,o=m();l(2),s("ngIf",o.productService.hasSelectionVariant(i))}}function Xe(t,r){if(t&1&&(a(0,"th",15)(1,"div",27),b(2,"img",28),a(3,"div",29),p(4),S(5,"stringLimit"),c()()()),t&2){let i=r.$implicit;l(),s("matTooltip",(i.Name==null?null:i.Name.length)>20?i.Name:""),l(),s("src",i==null?null:i.Img,T),l(2),x(" ",le(5,3,i.Name,20)," ")}}function Ze(t,r){if(t&1){let i=I();a(0,"th")(1,"input",30),k("ngModelChange",function(e){C(i);let n=m();return N(n.checkboxState,e)||(n.checkboxState=e),f(e)}),h("ngModelChange",function(){C(i);let e=m();return f(e.onSelectAllData())}),c()()}if(t&2){let i=m();l(),V("ngModel",i.checkboxState)}}function qe(t,r){t&1&&(a(0,"th",31)(1,"span"),p(2,"Expected"),c(),a(3,"span",32),p(4,"(POS)"),c()(),a(5,"th",31),p(6,"Channel"),c())}function Ye(t,r){if(t&1){let i=I();a(0,"img",45),h("click",function(e){C(i);let n=m(3).$implicit,d=m(2);return f(d.onZoomImage(e,n==null?null:n.ImageUrl))}),c()}if(t&2){let i=m(3).$implicit;ie("src",i==null?null:i.ImageUrl,T)}}function Qe(t,r){t&1&&b(0,"img",46)}function et(t,r){if(t&1&&(a(0,"small",44),p(1),c()),t&2){let i=m(3).$implicit;l(),x("(",i==null?null:i.Category,")")}}function tt(t,r){if(t&1&&(v(0),a(1,"td",40),g(2,Ye,1,1,"img",41)(3,Qe,1,0,"ng-template",null,0,H),c(),a(5,"td",42)(6,"h5",43),p(7),c(),g(8,et,2,1,"small",44),c(),y()),t&2){let i=z(4),o=m().$index,e=m().$implicit,n=m().ngIf;l(),s("rowSpan",e==null?null:e.Variants.length)("ngClass",F(7,Ke,o+1==n.length)),l(),s("ngIf",e==null?null:e.ImageUrl)("ngIfElse",i),l(3),s("rowSpan",e==null?null:e.Variants.length),l(2),oe(e==null?null:e.Name),l(),ne(e!=null&&e.Category?8:-1)}}function nt(t,r){if(t&1){let i=I();a(0,"td",47)(1,"input",30),k("ngModelChange",function(e){C(i);let n=m().$implicit;return N(n.selected,e)||(n.selected=e),f(e)}),c()()}if(t&2){let i=m().$implicit;l(),V("ngModel",i.selected)}}function it(t,r){if(t&1){let i=I();v(0),a(1,"td",49),p(2),S(3,"number"),c(),a(4,"td",50),h("click",function(){let e=C(i).$implicit,n=m(2).$implicit,d=m().$implicit,_=m(2);return f(_.openTableDialog(n,d,e))}),a(5,"div",51)(6,"div",52),p(7),S(8,"number"),c(),a(9,"a",53),h("click",function(e){return C(i),f(e==null?null:e.stopPropagation())}),b(10,"i",38),c()()(),y()}if(t&2){let i=r.$implicit;l(2),x(" ",w(3,4,i.PriceExpected)," "),l(2),s("ngClass",F(8,Ge,i.Price!=i.PriceExpected)),l(3),x(" ",w(8,6,i.Price)," "),l(2),s("href",i.Url,T)}}function ot(t,r){t&1&&(a(0,"td",54),p(1," X "),c(),a(2,"td",54),p(3," X "),c())}function rt(t,r){if(t&1&&(v(0),g(1,it,11,10,"ng-container",48)(2,ot,4,0,"ng-template",null,1,H),y()),t&2){let i=r.$implicit,o=z(3),e=m().$implicit,n=m(3);l(),s("ngIf",n.getItemFromChannel(e,i.ID))("ngIfElse",o)}}function at(t,r){if(t&1&&(a(0,"tr"),g(1,tt,9,9,"ng-container",3),a(2,"td",33),p(3),c(),a(4,"td",34)(5,"div",35)(6,"div",36),p(7),c(),a(8,"div",29)(9,"a",37),b(10,"i",38),c()()()(),g(11,nt,2,1,"ng-template",19)(12,rt,4,2,"ng-container",39),c()),t&2){let i=r.$implicit,o=r.$index,e=m(3);l(),s("ngIf",o==0),l(2),x(" ",i==null?null:i.Model," "),l(),s("matTooltip",i.Discontinued?e.discontinuedVariantMsg:""),l(2),s("ngClass",F(8,We,i.Discontinued)),l(),x(" ",i==null?null:i.Code," "),l(2),s("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(i==null?null:i.ID),T),l(2),s("ngxPermissionsOnly",F(10,ke,e.rolePriceEdit)),l(),s("ngForOf",e.channelOptions)}}function lt(t,r){if(t&1&&(a(0,"tbody"),M(1,at,13,12,"tr",null,E),c()),t&2){let i=r.$implicit;l(),O(i.Variants)}}function ct(t,r){if(t&1&&(v(0),M(1,lt,3,0,"tbody",null,E),y()),t&2){let i=r.ngIf;l(),O(i)}}var Zt=(()=>{let r=class r{constructor(o,e,n,d,_,u,Be){this.http=o,this.toastr=e,this.dialog=n,this.productService=d,this.authService=_,this.biggerPictureService=u,this.paginationService=Be,this.infinitePagination=Q(X),this.searchFilter=new Ie,this.checkboxState=!1,this.rolePriceEdit=_e.price,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.rowCountAPI="Inventory/GetMultipleChannelComparisonRowCount",this.filterTypeOptions=[{Key:K.ALL,Value:"All"},{Key:K.DIFFERENCE,Value:"Difference"}],this.filterType=K.ALL,this.pageData={Title:"Price Realtime",Nav:[{Title:"Price Cache",Url:"/menu/price",Active:!1}]},this.channelOptions=this.authService.getChannels(),this.hostName=this.authService.getDomain(),this.initPagination()}initPagination(){this.infinitePagination.fetchDataEndpoint="Price/GetOutletPrice",this.infinitePagination.fethRowCountEndpoint=this.rowCountAPI,this.initProduct(),this.initPageLoader()}initProduct(){this.data$=this.infinitePagination.data$.pipe(q(1))}initPageLoader(){this.loader$=this.http.post("/api/PriceLoader/LoadMultiple",{}).pipe(Y(o=>{this.searchFilter=o.Filter,this.infinitePagination.reloadPagination(this.searchFilter)}))}onSelectAllData(){this.data$=this.data$.pipe(Z(o=>(o.map(e=>(e.Variants&&(e.Variants=e.Variants.map(n=>(n.selected=this.checkboxState,n))),e)),o)))}onFilter(o){this.searchFilter.text=o;let e={text:o,filterModel:this.filterType,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount};this.infinitePagination.reloadPagination(e)}updatePrice(o){let e=this.productService.selectedVariantProduct(o);if(e.length>0){let n=e.map(u=>u.ID),_={ListChannelID:this.channelOptions.filter(u=>u.selected).map(u=>u.ID),ListID:n};this.http.post("/api/Price/UpdateChannelOutletPrice",_).subscribe({next:u=>{this.resetSelectedChannel(),this.onFilter(),this.toastr.success("Successfully updated "+_.ListID.length+" items in "+_.ListChannelID.length+" channels","Success")},error:u=>{this.resetSelectedChannel()}})}}resetSelectedChannel(){this.channelOptions=this.channelOptions.map(o=>(o.selected=!1,o))}getItemFromChannel(o,e){return o.Channel.find(n=>n.ChannelID==e)}onUpdateItems(o){let e=this.productService.selectedVariantProduct(o);this.dialog.open(Oe,{data:{selectedItems:e,channels:this.channelOptions},width:"600px"}).afterClosed().pipe(G(n=>J.IsNotEmpty(n))).subscribe(n=>{this.channelOptions=n,this.updatePrice(o)})}openTableDialog(o,e,n){let d=JSON.parse(JSON.stringify(o));this.dialog.open(De,{data:{Name:e.Name,Variant:d,ChannelID:n?.ChannelID,Table:"price",ChannelItemID:n?.ChannelItemID}}).afterClosed().pipe(G(u=>J.IsNotEmpty(u))).subscribe(u=>{this.updateProductPrice(u,n)})}updateProductPrice(o,e){let n={ID:o.ChannelID,ChannelItemID:o.ChannelItemID,ChannelVariantID:o.ChannelVariationID,Price:parseFloat(o.Price),VariantID:o.ID,SKU:o.Sku};this.http.post("/api/Price/UpdatePriceByID",n).subscribe(d=>{e.Price=n.Price;let _=this.productService.findChannelById(n.ID,this.channelOptions);this.toastr.success(`Successfully updated ${o.ItemName} (${o.VarName}) inventory in ${_.Name} to ${n.Price}`,"Success")})}openExportDialog(){this.dialog.open(Ee,{data:{title:"Export Custom Channel Price",pageNumber:this.searchFilter.PageNumber,rowCount:this.searchFilter.RowCount,filterExport:this.searchFilter,getRowCountApi:this.rowCountAPI,exportApi:"price/GetExportOutletPrice"}}).afterClosed().subscribe()}onZoomImage(o,e){this.biggerPictureService.openBiggerPicture(o,e)}};r.\u0275fac=function(e){return new(e||r)(P(ge),P(ue),P(xe),P(we),P(fe),P(Fe),P(Me))},r.\u0275cmp=D({type:r,selectors:[["app-custom-channel-price"]],standalone:!0,features:[re([X]),B],decls:38,vars:23,consts:[["elsePic",""],["elseCol",""],["headerTitle","Price Comparison",3,"onSubmit","hideSearchBox","hideSearchDropdown","textButton"],[4,"ngIf"],[1,"d-flex"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],[1,"channel-column"],["colspan","5"],["scope","col","colspan","2",1,"text-center","border-bottom-0","border","text-uppercase"],["scope","col","colspan","2",1,"text-center","w-25"],["scope","col",1,"text-start","w-20"],["scope","col",1,"text-end","w-10"],[3,"ngxPermissionsOnly"],[3,"onNextPage","onLastPage","onGetRowCount","totalData","hideCount","rowCount","pageNumber","disableNextButton","goToLastPage"],[2,"height","46px"],[1,"mb-3"],["name","filterModel",3,"modelChange","model","options"],["type","button","class","btn btn-success shadow rounded","data-toggle","modal",3,"click",4,"ngIf"],["type","button","data-toggle","modal",1,"btn","btn-success","shadow","rounded",3,"click"],[1,"fas","fa-chevron-circle-up"],["matTooltipPosition","above",1,"d-flex","align-items-center","justify-content-center",2,"width","180px",3,"matTooltip"],[2,"width","16px","height","16px",3,"src"],[1,"ms-2"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"text-end","border-top-0","border","w-10"],[1,"ms-1"],[1,"text-start","border-bottom"],["matTooltipPosition","above",1,"text-end","border-bottom",3,"matTooltip"],[1,"d-flex","align-items-center","justify-content-end"],[3,"ngClass"],["target","_blank",3,"href"],[1,"fas","fa-solid","fa-arrow-up-right-from-square","external-link-custom"],[4,"ngFor","ngForOf"],[1,"text-center",3,"rowSpan","ngClass"],["class","border rounded w-img cursor-pointer",3,"src","click",4,"ngIf","ngIfElse"],[1,"text-start","border-bottom",2,"padding-left","0px",3,"rowSpan"],[1,"mb-0","item-name"],[1,"mt-1"],[1,"border","rounded","w-img","cursor-pointer",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded","w-img"],[1,"align-middle"],[4,"ngIf","ngIfElse"],[1,"text-end","border"],[1,"text-center","border","pointer","cell-hover",3,"click","ngClass"],[1,"d-flex","align-items-center","justify-content-center"],[1,"me-2"],["target","_blank",3,"click","href"],[1,"table-white","border","text-end",2,"color","red"]],template:function(e,n){e&1&&(a(0,"mainpanel",2),h("onSubmit",function(_){return n.onFilter(_)}),a(1,"filters"),g(2,ze,5,2,"ng-container",3),S(3,"async"),c(),a(4,"actions")(5,"div",4),g(6,Je,3,1,"ng-container",3),S(7,"async"),a(8,"button",5),h("click",function(){return n.openExportDialog()}),b(9,"i",6),a(10,"span"),p(11,"Export"),c()()()(),a(12,"content")(13,"div",7)(14,"div",8)(15,"div",9)(16,"div",10)(17,"table",11)(18,"thead",12)(19,"tr",13),b(20,"th",14),M(21,Xe,6,6,"th",15,E),c(),a(23,"tr")(24,"th",16)(25,"span"),p(26," Product "),c()(),a(27,"th",17),p(28,"Variant"),c(),a(29,"th",18),p(30,"SKU"),c(),g(31,Ze,2,1,"ng-template",19),M(32,qe,7,0,null,null,E),c()(),g(34,ct,3,0,"ng-container",3),S(35,"async"),c(),a(36,"infinite-paginator",20),S(37,"async"),h("onNextPage",function(){return n.infinitePagination.onNextPage(n.searchFilter)})("onLastPage",function(){return n.infinitePagination.onLastPage(n.searchFilter)})("onGetRowCount",function(){return n.infinitePagination.getRowCount(n.searchFilter)}),c()()()()()()()),e&2&&(s("hideSearchBox",!1)("hideSearchDropdown",!1)("textButton","Search"),l(2),s("ngIf",w(3,13,n.loader$)),l(4),s("ngIf",w(7,15,n.data$)),l(15),O(n.channelOptions),l(10),s("ngxPermissionsOnly",F(21,ke,n.rolePriceEdit)),l(),O(n.channelOptions),l(2),s("ngIf",w(35,17,n.data$)),l(2),s("totalData",n.infinitePagination.totalData())("hideCount",n.infinitePagination.hideCount())("rowCount",w(37,19,n.infinitePagination.totalRowCount$))("pageNumber",n.infinitePagination.pageNumber())("disableNextButton",n.infinitePagination.disableNextButton())("goToLastPage",n.infinitePagination.isLastPage()))},dependencies:[$,ce,R,se,me,pe,be,Pe,A,de,L,U,Ve,Ne,W,j,Te,Ce,he],styles:[".w-10[_ngcontent-%COMP%]{width:10%}.w-20[_ngcontent-%COMP%]{width:20%}.w-img[_ngcontent-%COMP%]{width:40px;height:40px}.item-name[_ngcontent-%COMP%]{font-weight:400;font-size:larger}.cell-hover[_ngcontent-%COMP%]:hover{background-color:#c9c9c9!important}"]});let t=r;return t})();export{Zt as CustomChannelPriceComponent};
@@ -1 +1 @@
1
- import{a as re}from"./chunk-BGWVHGAY.js";import{b as le}from"./chunk-47PEHCOU.js";import{a as pe,b as me}from"./chunk-MKJON4UM.js";import{a as ee,b as te,d as ne,e as ie}from"./chunk-PYD2YWAN.js";import{g as Z}from"./chunk-5GZGQTZO.js";import{e as Y}from"./chunk-JHYIHRQH.js";import{m as ae,n as oe}from"./chunk-4CEFDQPI.js";import{h as G,m as K,y as Q}from"./chunk-2E5AKA74.js";import{c as X}from"./chunk-FTHTFVHH.js";import{$ as E,Bc as W,Cc as k,Dc as H,Fc as U,Ha as v,Ja as p,Jb as s,Kb as C,Lb as b,Nb as O,Ob as q,Pb as z,Q as D,Qb as A,Rb as V,T as w,_a as u,ab as h,ac as c,bc as d,cc as J,d as I,da as g,ga as N,hb as B,ib as T,kb as $,lb as F,mb as a,nb as o,oa as P,ob as f,pa as R,q as M,sb as j,vb as x,xb as y}from"./chunk-ZIZWZZ4E.js";import{a as S}from"./chunk-GNOSNGXM.js";var L=(()=>{let t=class t{constructor(){this.httpService=g(Y),this._pageination=new I({PageNumber:1,RowCount:100,ChannelID:null}),this.filter$=this._pageination.asObservable(),this.log$=this.filter$.pipe(w(n=>this.getLogs$(n).pipe()))}getLogs$(n){return this.httpService.post("/api/Channel/GetChannelLogPaged",n)}onPaginationChange(n){let e=this._pageination.value;e.PageNumber=n.pageIndex+1,this._pageination.next(e)}onFilter(n){let e=this._pageination.value;e.PageNumber=1,e=S(S({},e),n),this._pageination.next(e)}};t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=E({token:t,factory:t.\u0275fac});let i=t;return i})();function ce(i,t){if(i&1&&(a(0,"span",10),f(1,"img",11),o(),s(2)),i&2){let l=t.item;p(),h("src",l.Img,v)("alt",l.Name),p(),b(" ",l.Name," ")}}function de(i,t){if(i&1&&(a(0,"tr")(1,"td"),f(2,"img",17),a(3,"span"),s(4),o()(),a(5,"td"),s(6),c(7,"json"),o(),a(8,"td"),s(9),c(10,"json"),o(),a(11,"td"),s(12),c(13,"date"),o()()),i&2){let l=t.$implicit;p(2),h("src",l.Img,v),p(2),b(" ",l.ChannelName," "),p(2),C(d(7,5,l.Request)),p(3),C(d(10,7,l.Response)),p(3),C(J(13,9,l.Created,"dd-MM-yyyy hh:mm:ss"))}}function he(i,t){if(i&1){let l=j();a(0,"div",8)(1,"table",12)(2,"thead")(3,"tr",13)(4,"th",14),s(5,"Channel"),o(),a(6,"th"),s(7,"Request"),o(),a(8,"th"),s(9,"Response"),o(),a(10,"th",15),s(11,"Created"),o()()(),a(12,"tbody"),$(13,de,14,12,"tr",null,T),c(15,"async"),o()(),a(16,"mat-paginator",16),c(17,"async"),c(18,"async"),c(19,"async"),c(20,"async"),x("page",function(e){P(l);let r=y();return R(r.channelLogService.onPaginationChange(e))}),o()()}if(i&2){let l,n,e,r,m=y();p(13),F((l=d(15,3,m.channelLogs$))==null?null:l.Data),p(3),h("length",(n=d(17,5,m.channelLogs$))==null?null:n.Count)("pageSize",(e=d(18,7,m.filter$))==null?null:e.RowCount)("pageIndex",(r=d(19,9,m.filter$))!=null&&r.PageNumber?0:((r=d(20,11,m.filter$))==null?null:r.PageNumber)-1)}}function ge(i,t){i&1&&(a(0,"div",9),f(1,"app-empty-state"),o())}var ze=(()=>{let t=class t{constructor(){this.channelLogService=g(L),this.authService=g(Z),this.channelOptions=this.authService.getChannels(),this.channelLogs$=this.channelLogService.log$.pipe(M(n=>(n.Data?n.Data=n.Data.map(e=>(e.Response=e.Response?JSON.parse(e.Response):"",e.Request=e.Request?JSON.parse(e.Request):"",e.Img=X.getChannelLogoByTypeId(e.TypeID),e)):n.Data=[],n)),D(1)),this.filter$=this.channelLogService.filter$}onSubmitFilter(){this.channelLogService.onFilter({ChannelID:this.channelID})}};t.\u0275fac=function(e){return new(e||t)},t.\u0275cmp=N({type:t,selectors:[["app-channel-log"]],standalone:!0,features:[A([L]),V],decls:15,vars:7,consts:[["headerTitle","Authorization Log",3,"onSubmit","hideSearchBox"],["container",""],[1,"fw-bold","mb-2"],["appendTo","body","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"me-2"],[2,"width","18px",3,"src","alt"],[1,"table","table-hover"],[1,"table-light"],[2,"width","250px"],[2,"width","150px"],[3,"page","length","pageSize","pageIndex"],[1,"me-2",2,"width","25px",3,"src"]],template:function(e,r){if(e&1&&(a(0,"mainpanel",0),x("onSubmit",function(){return r.onSubmitFilter()}),a(1,"filters")(2,"div",1)(3,"div")(4,"label",2),s(5,"Channel"),o(),a(6,"ng-select",3),z("ngModelChange",function(_){return q(r.channelID,_)||(r.channelID=_),_}),u(7,ce,3,3,"ng-template",4),o()()()(),a(8,"content")(9,"div",5)(10,"div",6)(11,"div",7),u(12,he,21,13,"div",8),c(13,"async"),u(14,ge,2,0,"div",9),o()()()()()),e&2){let m;h("hideSearchBox",!0),p(6),h("clearable",!0)("items",r.channelOptions),O("ngModel",r.channelID),p(6),B(((m=d(13,5,r.channelLogs$))==null||m.Data==null?null:m.Data.length)>0?12:14)}},dependencies:[U,W,H,k,oe,ae,re,me,pe,le,ie,ne,ee,te,Q,G,K]});let i=t;return i})();export{ze as a};
1
+ import{a as re}from"./chunk-BGWVHGAY.js";import{b as le}from"./chunk-47PEHCOU.js";import{a as pe,b as me}from"./chunk-MKJON4UM.js";import{a as ee,b as te,d as ne,e as ie}from"./chunk-PYD2YWAN.js";import{g as Z}from"./chunk-TEQJOK4U.js";import{e as Y}from"./chunk-JHYIHRQH.js";import{m as ae,n as oe}from"./chunk-4CEFDQPI.js";import{h as G,m as K,y as Q}from"./chunk-2E5AKA74.js";import{c as X}from"./chunk-FTHTFVHH.js";import{$ as E,Bc as W,Cc as k,Dc as H,Fc as U,Ha as v,Ja as p,Jb as s,Kb as C,Lb as b,Nb as O,Ob as q,Pb as z,Q as D,Qb as A,Rb as V,T as w,_a as u,ab as h,ac as c,bc as d,cc as J,d as I,da as g,ga as N,hb as B,ib as T,kb as $,lb as F,mb as a,nb as o,oa as P,ob as f,pa as R,q as M,sb as j,vb as x,xb as y}from"./chunk-ZIZWZZ4E.js";import{a as S}from"./chunk-GNOSNGXM.js";var L=(()=>{let t=class t{constructor(){this.httpService=g(Y),this._pageination=new I({PageNumber:1,RowCount:100,ChannelID:null}),this.filter$=this._pageination.asObservable(),this.log$=this.filter$.pipe(w(n=>this.getLogs$(n).pipe()))}getLogs$(n){return this.httpService.post("/api/Channel/GetChannelLogPaged",n)}onPaginationChange(n){let e=this._pageination.value;e.PageNumber=n.pageIndex+1,this._pageination.next(e)}onFilter(n){let e=this._pageination.value;e.PageNumber=1,e=S(S({},e),n),this._pageination.next(e)}};t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=E({token:t,factory:t.\u0275fac});let i=t;return i})();function ce(i,t){if(i&1&&(a(0,"span",10),f(1,"img",11),o(),s(2)),i&2){let l=t.item;p(),h("src",l.Img,v)("alt",l.Name),p(),b(" ",l.Name," ")}}function de(i,t){if(i&1&&(a(0,"tr")(1,"td"),f(2,"img",17),a(3,"span"),s(4),o()(),a(5,"td"),s(6),c(7,"json"),o(),a(8,"td"),s(9),c(10,"json"),o(),a(11,"td"),s(12),c(13,"date"),o()()),i&2){let l=t.$implicit;p(2),h("src",l.Img,v),p(2),b(" ",l.ChannelName," "),p(2),C(d(7,5,l.Request)),p(3),C(d(10,7,l.Response)),p(3),C(J(13,9,l.Created,"dd-MM-yyyy hh:mm:ss"))}}function he(i,t){if(i&1){let l=j();a(0,"div",8)(1,"table",12)(2,"thead")(3,"tr",13)(4,"th",14),s(5,"Channel"),o(),a(6,"th"),s(7,"Request"),o(),a(8,"th"),s(9,"Response"),o(),a(10,"th",15),s(11,"Created"),o()()(),a(12,"tbody"),$(13,de,14,12,"tr",null,T),c(15,"async"),o()(),a(16,"mat-paginator",16),c(17,"async"),c(18,"async"),c(19,"async"),c(20,"async"),x("page",function(e){P(l);let r=y();return R(r.channelLogService.onPaginationChange(e))}),o()()}if(i&2){let l,n,e,r,m=y();p(13),F((l=d(15,3,m.channelLogs$))==null?null:l.Data),p(3),h("length",(n=d(17,5,m.channelLogs$))==null?null:n.Count)("pageSize",(e=d(18,7,m.filter$))==null?null:e.RowCount)("pageIndex",(r=d(19,9,m.filter$))!=null&&r.PageNumber?0:((r=d(20,11,m.filter$))==null?null:r.PageNumber)-1)}}function ge(i,t){i&1&&(a(0,"div",9),f(1,"app-empty-state"),o())}var ze=(()=>{let t=class t{constructor(){this.channelLogService=g(L),this.authService=g(Z),this.channelOptions=this.authService.getChannels(),this.channelLogs$=this.channelLogService.log$.pipe(M(n=>(n.Data?n.Data=n.Data.map(e=>(e.Response=e.Response?JSON.parse(e.Response):"",e.Request=e.Request?JSON.parse(e.Request):"",e.Img=X.getChannelLogoByTypeId(e.TypeID),e)):n.Data=[],n)),D(1)),this.filter$=this.channelLogService.filter$}onSubmitFilter(){this.channelLogService.onFilter({ChannelID:this.channelID})}};t.\u0275fac=function(e){return new(e||t)},t.\u0275cmp=N({type:t,selectors:[["app-channel-log"]],standalone:!0,features:[A([L]),V],decls:15,vars:7,consts:[["headerTitle","Authorization Log",3,"onSubmit","hideSearchBox"],["container",""],[1,"fw-bold","mb-2"],["appendTo","body","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"me-2"],[2,"width","18px",3,"src","alt"],[1,"table","table-hover"],[1,"table-light"],[2,"width","250px"],[2,"width","150px"],[3,"page","length","pageSize","pageIndex"],[1,"me-2",2,"width","25px",3,"src"]],template:function(e,r){if(e&1&&(a(0,"mainpanel",0),x("onSubmit",function(){return r.onSubmitFilter()}),a(1,"filters")(2,"div",1)(3,"div")(4,"label",2),s(5,"Channel"),o(),a(6,"ng-select",3),z("ngModelChange",function(_){return q(r.channelID,_)||(r.channelID=_),_}),u(7,ce,3,3,"ng-template",4),o()()()(),a(8,"content")(9,"div",5)(10,"div",6)(11,"div",7),u(12,he,21,13,"div",8),c(13,"async"),u(14,ge,2,0,"div",9),o()()()()()),e&2){let m;h("hideSearchBox",!0),p(6),h("clearable",!0)("items",r.channelOptions),O("ngModel",r.channelID),p(6),B(((m=d(13,5,r.channelLogs$))==null||m.Data==null?null:m.Data.length)>0?12:14)}},dependencies:[U,W,H,k,oe,ae,re,me,pe,le,ie,ne,ee,te,Q,G,K]});let i=t;return i})();export{ze as a};
@@ -1 +1 @@
1
- import{a as T}from"./chunk-XUSY2QT2.js";import{a as y,b}from"./chunk-7YWHTN3X.js";import{a}from"./chunk-LWMWPW7O.js";import"./chunk-5GZGQTZO.js";import"./chunk-JHYIHRQH.js";import"./chunk-KCDL7SWP.js";import"./chunk-2SC3HO66.js";import"./chunk-DQIP7MCZ.js";import"./chunk-FTHTFVHH.js";import{$c as r,Fc as o,Ja as c,Qb as h,Rb as v,Xc as C,aa as p,ab as u,ga as l,ha as s,mb as d,nb as f,ob as i}from"./chunk-ZIZWZZ4E.js";import"./chunk-GNOSNGXM.js";var M=(()=>{let e=class e{constructor(){this.inventoryTabs=[{Title:"Single Channel Comparison",Url:"/menu/inventory/bychannel"},{Title:"Multi Channel Comparison",Url:"/menu/inventory/pos"},{Title:"Different Inventory",Url:"/menu/inventory/channel_summary"}]}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=l({type:e,selectors:[["app-inventory"]],standalone:!0,features:[h([T]),v],decls:5,vars:1,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid"],[3,"Tabs"]],template:function(n,S){n&1&&(d(0,"nav",0)(1,"div",1)(2,"div"),i(3,"nav-tab",2),f()()(),i(4,"router-outlet")),n&2&&(c(3),u("Tabs",S.inventoryTabs))},dependencies:[o,b,y,r,C],encapsulation:2});let t=e;return t})();var A=[{path:"",component:M,children:[{path:"",redirectTo:"bychannel",pathMatch:"full"},{path:"pos",loadComponent(){return import("./chunk-OMR5REL2.js").then(t=>t.MultiChannelComparison)},canActivate:[a],data:{title:"Inventory Comparison"}},{path:"bychannel",loadComponent(){return import("./chunk-SAGRGMBL.js").then(t=>t.SingleChannelComparisonComponent)},canActivate:[a],data:{title:"Inventory Comparison"}},{path:"channel_summary",loadComponent(){return import("./chunk-GOV3GQ7Y.js").then(t=>t.ChannelSummaryComponent)},canActivate:[a],data:{title:"Different Inventory"}}]}],P=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=s({type:e}),e.\u0275inj=p({imports:[o,r.forChild(A)]});let t=e;return t})();export{P as InventoryRoutingModule};
1
+ import{a as T}from"./chunk-XUSY2QT2.js";import{a as y,b}from"./chunk-7YWHTN3X.js";import{a}from"./chunk-D77F5RO6.js";import"./chunk-TEQJOK4U.js";import"./chunk-JHYIHRQH.js";import"./chunk-KCDL7SWP.js";import"./chunk-2SC3HO66.js";import"./chunk-DQIP7MCZ.js";import"./chunk-FTHTFVHH.js";import{$c as r,Fc as o,Ja as c,Qb as h,Rb as v,Xc as C,aa as p,ab as u,ga as l,ha as s,mb as d,nb as f,ob as i}from"./chunk-ZIZWZZ4E.js";import"./chunk-GNOSNGXM.js";var M=(()=>{let e=class e{constructor(){this.inventoryTabs=[{Title:"Single Channel Comparison",Url:"/menu/inventory/bychannel"},{Title:"Multi Channel Comparison",Url:"/menu/inventory/pos"},{Title:"Different Inventory",Url:"/menu/inventory/channel_summary"}]}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=l({type:e,selectors:[["app-inventory"]],standalone:!0,features:[h([T]),v],decls:5,vars:1,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid"],[3,"Tabs"]],template:function(n,S){n&1&&(d(0,"nav",0)(1,"div",1)(2,"div"),i(3,"nav-tab",2),f()()(),i(4,"router-outlet")),n&2&&(c(3),u("Tabs",S.inventoryTabs))},dependencies:[o,b,y,r,C],encapsulation:2});let t=e;return t})();var A=[{path:"",component:M,children:[{path:"",redirectTo:"bychannel",pathMatch:"full"},{path:"pos",loadComponent(){return import("./chunk-EJX6CAIL.js").then(t=>t.MultiChannelComparison)},canActivate:[a],data:{title:"Inventory Comparison"}},{path:"bychannel",loadComponent(){return import("./chunk-WM3MIKKJ.js").then(t=>t.SingleChannelComparisonComponent)},canActivate:[a],data:{title:"Inventory Comparison"}},{path:"channel_summary",loadComponent(){return import("./chunk-I6W5QIOM.js").then(t=>t.ChannelSummaryComponent)},canActivate:[a],data:{title:"Different Inventory"}}]}],P=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=s({type:e}),e.\u0275inj=p({imports:[o,r.forChild(A)]});let t=e;return t})();export{P as InventoryRoutingModule};
@@ -1 +1 @@
1
- import{g as c}from"./chunk-5GZGQTZO.js";import{b as a}from"./chunk-JHYIHRQH.js";import{$ as s,ca as o}from"./chunk-ZIZWZZ4E.js";var d=(()=>{let e=class e{constructor(i,t){this.toastr=i,this.authService=t}canActivate(i,t){let n=JSON.parse(window.localStorage.getItem("user")),l=new Date;if(n!=null){let p=new Date(n.Token.expiredAt);return l<p?!0:(this.onTokenExpired(),!1)}else return this.onTokenExpired(),!1}onTokenExpired(){this.toastr.error("Your session has expired. Please login again.","Session Expired").onShown.subscribe(()=>this.authService.logout())}};e.\u0275fac=function(t){return new(t||e)(o(a),o(c))},e.\u0275prov=s({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();export{d as a};
1
+ import{g as c}from"./chunk-TEQJOK4U.js";import{b as a}from"./chunk-JHYIHRQH.js";import{$ as s,ca as o}from"./chunk-ZIZWZZ4E.js";var d=(()=>{let e=class e{constructor(i,t){this.toastr=i,this.authService=t}canActivate(i,t){let n=JSON.parse(window.localStorage.getItem("user")),l=new Date;if(n!=null){let p=new Date(n.Token.expiredAt);return l<p?!0:(this.onTokenExpired(),!1)}else return this.onTokenExpired(),!1}onTokenExpired(){this.toastr.error("Your session has expired. Please login again.","Session Expired").onShown.subscribe(()=>this.authService.logout())}};e.\u0275fac=function(t){return new(t||e)(o(a),o(c))},e.\u0275prov=s({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();export{d as a};
@@ -1 +1 @@
1
- import{a as he}from"./chunk-HCJ6C5OR.js";import"./chunk-XUSY2QT2.js";import{a as ce}from"./chunk-3VGAURY3.js";import{a as se}from"./chunk-65RMQ5Q5.js";import{a as F}from"./chunk-XHAXYWZ7.js";import{b as pe,c as V}from"./chunk-MZNSPLFO.js";import"./chunk-BVIRHZTZ.js";import"./chunk-E5BOLHDG.js";import"./chunk-A37OKNC2.js";import"./chunk-ZA7FXMFZ.js";import"./chunk-ZX3SBNZT.js";import"./chunk-2FRMUOJY.js";import"./chunk-C6QIBOCB.js";import{a as le}from"./chunk-7VKIP3Z6.js";import"./chunk-DYLT6RRK.js";import"./chunk-D76K4RZ7.js";import"./chunk-EIBGI6U2.js";import{g as M}from"./chunk-5GZGQTZO.js";import{b as te,e as ne}from"./chunk-JHYIHRQH.js";import"./chunk-KCDL7SWP.js";import{d as ie,l as ae,m as oe,n as re}from"./chunk-4CEFDQPI.js";import"./chunk-2SC3HO66.js";import"./chunk-DQIP7MCZ.js";import{c as q,h as X,m as Y,o as Z,y as ee}from"./chunk-2E5AKA74.js";import{c as D}from"./chunk-FTHTFVHH.js";import{$ as j,B,Bc as J,Fc as K,Ja as h,Jb as _,Ka as m,Nb as L,Ob as T,Pb as E,Qb as z,Rb as $,Va as w,X as k,_a as I,ab as d,ac as v,bc as y,da as S,ga as A,mb as c,nb as p,oa as b,ob as U,pa as P,pb as G,qb as W,rb as H,sb as N,vb as C,xb as g,yc as Q}from"./chunk-ZIZWZZ4E.js";import{a as R,b as x}from"./chunk-GNOSNGXM.js";var O=(()=>{let r=class r{constructor(){this.authService=S(M),this.channelOptions=this.authService.getChannels()}filterSelectedChannels(t,i){let e=Object.assign([],this.channelOptions),n=[],a;return t.forEach(o=>{a=e.find(s=>s.ID==o?.parent?.id),a&&(a=x(R({},a),{Name:`${o?.parent?.label} - ${o?.label}`,LocationID:o?.id}),n.push(a))}),i.forEach(o=>{a=e.find(s=>s.ID==o.id),a&&n.push(a)}),n}generateFilterLocation(t,i){let e=[],n=[],a=[];return t.length>0?(e=t.map(o=>o.id),n=t.map(o=>o.parent.id).filter((o,s,f)=>f.indexOf(o)===s)):(e=[],n=[]),a=i.map(o=>o.id),a=a.concat(n).filter((o,s,f)=>f.indexOf(o)===s),{locationIds:e,channelIds:a}}};r.\u0275fac=function(i){return new(i||r)},r.\u0275prov=j({token:r,factory:r.\u0275fac});let l=r;return l})();function ue(l,r){if(l&1){let u=N();c(0,"button",15),C("click",function(){b(u);let i=g().ngIf,e=g();return P(e.onUpdateItems(i))}),U(1,"i",16),_(2," Update "),p()}}function me(l,r){if(l&1&&(c(0,"actions")(1,"div",13),I(2,ue,3,0,"button",14),p()()),l&2){let u=r.ngIf,t=g();h(2),d("ngIf",t.productService.hasSelectionVariant(u))}}function ge(l,r){l&1&&H(0)}function Ce(l,r){if(l&1){let u=N();G(0),c(1,"app-table",17),C("onToggle",function(i){b(u);let e=g();return P(e.onShowDifferenceStock(i))})("onSubmit",function(i){b(u);let e=g();return P(e.updateStockByVariant(i))}),p(),W()}if(l&2){let u=r.ngIf,t=g();h(),d("data",u)("channel",t.channels())("showProductToggle",!0)("hiddenIPOSInventory",t.searchFilter.HiddenIPOSInventory)}}var $e=(()=>{let r=class r{constructor(t,i,e,n,a,o){this.http=t,this.toastr=i,this.dialog=e,this.productService=n,this.authService=a,this.mainPanelService=o,this.paginationService=S(V),this.multiChannelService=S(O),this.searchFilter={PageNumber:1,RowCount:100},this.loaderEndpoint="InventoryLoader/GetMultipleInventoryComparison",this.dataEndpoint="Inventory/GetMultipleChannelComparison",this.allDataCountEndpoint="Inventory/GetMultipleChannelComparisonRowCount",this.selectedLocations=w([]),this.selectedChannels=w([]),this.channels=w([]),this.pageData={Title:"Inventory",Nav:[{Title:"Inventory Cache",Url:"/menu/inventory/pos",Active:!0},{Title:"Inventory Realtime",Url:"/menu/inventory/realtime",Active:!1}]},this.channelOptions=this.authService.getChannels()}ngOnInit(){this.initPageLoader()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.dataEndpoint,this.paginationService.fethRowCountEndpoint=this.allDataCountEndpoint,this.loader$=this.http.post(`/API/${this.loaderEndpoint}`,{}).pipe(k(t=>{t.Filter={PageNumber:t.Filter.PageNumber,filterModel:F.ALL,RowCount:t.Filter.PageSize,HiddenIPOSInventory:t.Filter.HiddenIPOSInventory},this.searchFilter=t.Filter,this.mainPanelService.openModalFilter()}))}onChannelChange(t=[]){let i=t.filter(n=>D.isValidGUID(n.id)==!1),e=t.filter(n=>D.isValidGUID(n.id));this.selectedLocations.set(i),this.selectedChannels.set(e)}onSearch(t){let i=this.multiChannelService.filterSelectedChannels(this.selectedLocations(),this.selectedChannels());this.channels.set(i);let e=this.multiChannelService.generateFilterLocation(this.selectedLocations(),this.selectedChannels());this.searchFilter.ListChannelID=e.channelIds,this.searchFilter.ListLocationID=e.locationIds,this.searchFilter.text=t,this.paginationService.reloadPagination(this.searchFilter)}updateStock(t,i){let e=this.productService.selectedVariantProduct(t);if(e.length>0){let n=[];e.forEach(s=>{s.Channel?.forEach(f=>{n.push({ID:s.ID,Code:s.Code,Inventory:s.Inventory,LocationID:f.LocationID})})});let o={ListChannelID:i.filter(s=>s.selected).map(s=>s.ID),List:n};this.http.post("/api/Inventory/UpdateChannel",o).subscribe(s=>{this.paginationService.reloadPagination(this.searchFilter),this.toastr.success("Successfully updated "+o.List.length+" variants in "+o.ListChannelID.length+" channels","Success")})}}updateStockByVariant(t){let i={ID:t.ChannelID,ChannelItemID:t.ChannelItemID,ChannelVariantID:t.ChannelVariationID,NewQuantity:parseFloat(t.Inventory),VariantID:t.ID,SKU:t.Sku,LocationID:t.LocationID};this.http.post("/api/Inventory/UpdateQuantityByItem",i).subscribe(e=>{this.paginationService.reloadPagination(this.searchFilter);let n=this.productService.findChannelById(i.ID,this.channelOptions);this.toastr.success("Successfully updated "+t.ItemName+"("+t.VarName+") inventory in "+n.Name+" to "+i.NewQuantity,"Success")})}onShowDifferenceStock(t){t?this.searchFilter.filterModel=F.DIFFERENCE:this.searchFilter.filterModel=F.ALL,this.paginationService.reloadPagination(this.searchFilter)}onUpdateItems(t){let i=this.productService.selectedVariantProduct(t),e=this.channelOptions.filter(n=>this.channels()?.find(a=>a.ID===n.ID));this.dialog.open(se,{data:{selectedItems:i,channels:JSON.parse(JSON.stringify(e))},width:"600px"}).afterClosed().pipe(B(n=>D.IsNotEmpty(n))).subscribe(n=>{this.updateStock(t,n)})}};r.\u0275fac=function(i){return new(i||r)(m(ne),m(te),m(ie),m(le),m(M),m(ae))},r.\u0275cmp=A({type:r,selectors:[["app-multi-channel-comparison"]],standalone:!0,features:[z([V,O]),$],decls:26,vars:22,consts:[["headerTitle","Inventory Comparison","textButton","Search",3,"onSubmit","pageData","hideSearchBox"],[4,"ngIf"],["for","selectChannel",1,"fw-bold","mb-3"],["id","selectChannel",3,"onChannelChange","multiple"],[1,"mt-5"],["for","PageNumber",1,"fw-bold"],["type","number","id","PageNumber","placeholder","PageNumber","name","PageNumber","data-toggle","tooltip","matTooltip","Page Number",1,"form-control","mt-2",3,"ngModelChange","ngModel"],["for","RowCount",1,"fw-bold"],["type","number","id","RowCount","placeholder","Page Size","name","RowCount","data-toggle","tooltip","matTooltip","Page Size",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[3,"onNextPage","onLastPage","onGetRowCount","totalData","hideCount","rowCount","pageNumber","disableNextButton","goToLastPage"],[1,"d-flex"],["type","button","class","btn btn-success shadow-sm rounded me-3",3,"click",4,"ngIf"],["type","button",1,"btn","btn-success","shadow-sm","rounded","me-3",3,"click"],[1,"fas","fa-chevron-circle-up"],["table","inventory",3,"onToggle","onSubmit","data","channel","showProductToggle","hiddenIPOSInventory"]],template:function(i,e){i&1&&(c(0,"mainpanel",0),C("onSubmit",function(a){return e.onSearch(a)}),I(1,me,3,1,"actions",1),v(2,"async"),c(3,"filters"),I(4,ge,1,0,"ng-container",1),v(5,"async"),c(6,"div")(7,"label",2),_(8,"Channel"),p(),c(9,"multiwarehouse-tree-select",3),C("onChannelChange",function(a){return e.onChannelChange(a)}),p()(),c(10,"div",4)(11,"label",5),_(12,"PageNumber"),p(),c(13,"input",6),E("ngModelChange",function(a){return T(e.searchFilter.PageNumber,a)||(e.searchFilter.PageNumber=a),a}),p()(),c(14,"div",4)(15,"label",7),_(16,"Page Size"),p(),c(17,"input",8),E("ngModelChange",function(a){return T(e.searchFilter.RowCount,a)||(e.searchFilter.RowCount=a),a}),p()()(),c(18,"content")(19,"div",9)(20,"div",10)(21,"div",11),I(22,Ce,2,4,"ng-container",1),v(23,"async"),c(24,"infinite-paginator",12),v(25,"async"),C("onNextPage",function(){return e.paginationService.onNextPage(e.searchFilter)})("onLastPage",function(){return e.paginationService.onLastPage(e.searchFilter)})("onGetRowCount",function(){return e.paginationService.getRowCount(e.searchFilter)}),p()()()()()()),i&2&&(d("pageData",e.pageData)("hideSearchBox",!1),h(),d("ngIf",y(2,14,e.paginationService.data$)),h(3),d("ngIf",y(5,16,e.loader$)),h(5),d("multiple",!0),h(4),L("ngModel",e.searchFilter.PageNumber),h(4),L("ngModel",e.searchFilter.RowCount),h(5),d("ngIf",y(23,18,e.paginationService.data$)),h(2),d("totalData",e.paginationService.totalData())("hideCount",e.paginationService.hideCount())("rowCount",y(25,20,e.paginationService.totalRowCount$))("pageNumber",e.paginationService.pageNumber())("disableNextButton",e.paginationService.disableNextButton())("goToLastPage",e.paginationService.isLastPage()))},dependencies:[K,Q,J,re,oe,ce,ee,q,Z,X,Y,pe,he],styles:[".no-bullet[_ngcontent-%COMP%]{list-style-type:none}"]});let l=r;return l})();export{$e as MultiChannelComparison};
1
+ import{a as he}from"./chunk-HCJ6C5OR.js";import"./chunk-XUSY2QT2.js";import{a as ce}from"./chunk-2D6GZYV6.js";import{a as se}from"./chunk-65RMQ5Q5.js";import{a as F}from"./chunk-XHAXYWZ7.js";import{b as pe,c as V}from"./chunk-MZNSPLFO.js";import"./chunk-BVIRHZTZ.js";import"./chunk-E5BOLHDG.js";import"./chunk-A37OKNC2.js";import"./chunk-ZA7FXMFZ.js";import"./chunk-ZX3SBNZT.js";import"./chunk-2FRMUOJY.js";import"./chunk-C6QIBOCB.js";import{a as le}from"./chunk-7VKIP3Z6.js";import"./chunk-DYLT6RRK.js";import"./chunk-D76K4RZ7.js";import"./chunk-EIBGI6U2.js";import{g as M}from"./chunk-TEQJOK4U.js";import{b as te,e as ne}from"./chunk-JHYIHRQH.js";import"./chunk-KCDL7SWP.js";import{d as ie,l as ae,m as oe,n as re}from"./chunk-4CEFDQPI.js";import"./chunk-2SC3HO66.js";import"./chunk-DQIP7MCZ.js";import{c as q,h as X,m as Y,o as Z,y as ee}from"./chunk-2E5AKA74.js";import{c as D}from"./chunk-FTHTFVHH.js";import{$ as j,B,Bc as J,Fc as K,Ja as h,Jb as _,Ka as m,Nb as L,Ob as T,Pb as E,Qb as z,Rb as $,Va as w,X as k,_a as I,ab as d,ac as v,bc as y,da as S,ga as A,mb as c,nb as p,oa as b,ob as U,pa as P,pb as G,qb as W,rb as H,sb as N,vb as C,xb as g,yc as Q}from"./chunk-ZIZWZZ4E.js";import{a as R,b as x}from"./chunk-GNOSNGXM.js";var O=(()=>{let r=class r{constructor(){this.authService=S(M),this.channelOptions=this.authService.getChannels()}filterSelectedChannels(t,i){let e=Object.assign([],this.channelOptions),n=[],a;return t.forEach(o=>{a=e.find(s=>s.ID==o?.parent?.id),a&&(a=x(R({},a),{Name:`${o?.parent?.label} - ${o?.label}`,LocationID:o?.id}),n.push(a))}),i.forEach(o=>{a=e.find(s=>s.ID==o.id),a&&n.push(a)}),n}generateFilterLocation(t,i){let e=[],n=[],a=[];return t.length>0?(e=t.map(o=>o.id),n=t.map(o=>o.parent.id).filter((o,s,f)=>f.indexOf(o)===s)):(e=[],n=[]),a=i.map(o=>o.id),a=a.concat(n).filter((o,s,f)=>f.indexOf(o)===s),{locationIds:e,channelIds:a}}};r.\u0275fac=function(i){return new(i||r)},r.\u0275prov=j({token:r,factory:r.\u0275fac});let l=r;return l})();function ue(l,r){if(l&1){let u=N();c(0,"button",15),C("click",function(){b(u);let i=g().ngIf,e=g();return P(e.onUpdateItems(i))}),U(1,"i",16),_(2," Update "),p()}}function me(l,r){if(l&1&&(c(0,"actions")(1,"div",13),I(2,ue,3,0,"button",14),p()()),l&2){let u=r.ngIf,t=g();h(2),d("ngIf",t.productService.hasSelectionVariant(u))}}function ge(l,r){l&1&&H(0)}function Ce(l,r){if(l&1){let u=N();G(0),c(1,"app-table",17),C("onToggle",function(i){b(u);let e=g();return P(e.onShowDifferenceStock(i))})("onSubmit",function(i){b(u);let e=g();return P(e.updateStockByVariant(i))}),p(),W()}if(l&2){let u=r.ngIf,t=g();h(),d("data",u)("channel",t.channels())("showProductToggle",!0)("hiddenIPOSInventory",t.searchFilter.HiddenIPOSInventory)}}var $e=(()=>{let r=class r{constructor(t,i,e,n,a,o){this.http=t,this.toastr=i,this.dialog=e,this.productService=n,this.authService=a,this.mainPanelService=o,this.paginationService=S(V),this.multiChannelService=S(O),this.searchFilter={PageNumber:1,RowCount:100},this.loaderEndpoint="InventoryLoader/GetMultipleInventoryComparison",this.dataEndpoint="Inventory/GetMultipleChannelComparison",this.allDataCountEndpoint="Inventory/GetMultipleChannelComparisonRowCount",this.selectedLocations=w([]),this.selectedChannels=w([]),this.channels=w([]),this.pageData={Title:"Inventory",Nav:[{Title:"Inventory Cache",Url:"/menu/inventory/pos",Active:!0},{Title:"Inventory Realtime",Url:"/menu/inventory/realtime",Active:!1}]},this.channelOptions=this.authService.getChannels()}ngOnInit(){this.initPageLoader()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.dataEndpoint,this.paginationService.fethRowCountEndpoint=this.allDataCountEndpoint,this.loader$=this.http.post(`/API/${this.loaderEndpoint}`,{}).pipe(k(t=>{t.Filter={PageNumber:t.Filter.PageNumber,filterModel:F.ALL,RowCount:t.Filter.PageSize,HiddenIPOSInventory:t.Filter.HiddenIPOSInventory},this.searchFilter=t.Filter,this.mainPanelService.openModalFilter()}))}onChannelChange(t=[]){let i=t.filter(n=>D.isValidGUID(n.id)==!1),e=t.filter(n=>D.isValidGUID(n.id));this.selectedLocations.set(i),this.selectedChannels.set(e)}onSearch(t){let i=this.multiChannelService.filterSelectedChannels(this.selectedLocations(),this.selectedChannels());this.channels.set(i);let e=this.multiChannelService.generateFilterLocation(this.selectedLocations(),this.selectedChannels());this.searchFilter.ListChannelID=e.channelIds,this.searchFilter.ListLocationID=e.locationIds,this.searchFilter.text=t,this.paginationService.reloadPagination(this.searchFilter)}updateStock(t,i){let e=this.productService.selectedVariantProduct(t);if(e.length>0){let n=[];e.forEach(s=>{s.Channel?.forEach(f=>{n.push({ID:s.ID,Code:s.Code,Inventory:s.Inventory,LocationID:f.LocationID})})});let o={ListChannelID:i.filter(s=>s.selected).map(s=>s.ID),List:n};this.http.post("/api/Inventory/UpdateChannel",o).subscribe(s=>{this.paginationService.reloadPagination(this.searchFilter),this.toastr.success("Successfully updated "+o.List.length+" variants in "+o.ListChannelID.length+" channels","Success")})}}updateStockByVariant(t){let i={ID:t.ChannelID,ChannelItemID:t.ChannelItemID,ChannelVariantID:t.ChannelVariationID,NewQuantity:parseFloat(t.Inventory),VariantID:t.ID,SKU:t.Sku,LocationID:t.LocationID};this.http.post("/api/Inventory/UpdateQuantityByItem",i).subscribe(e=>{this.paginationService.reloadPagination(this.searchFilter);let n=this.productService.findChannelById(i.ID,this.channelOptions);this.toastr.success("Successfully updated "+t.ItemName+"("+t.VarName+") inventory in "+n.Name+" to "+i.NewQuantity,"Success")})}onShowDifferenceStock(t){t?this.searchFilter.filterModel=F.DIFFERENCE:this.searchFilter.filterModel=F.ALL,this.paginationService.reloadPagination(this.searchFilter)}onUpdateItems(t){let i=this.productService.selectedVariantProduct(t),e=this.channelOptions.filter(n=>this.channels()?.find(a=>a.ID===n.ID));this.dialog.open(se,{data:{selectedItems:i,channels:JSON.parse(JSON.stringify(e))},width:"600px"}).afterClosed().pipe(B(n=>D.IsNotEmpty(n))).subscribe(n=>{this.updateStock(t,n)})}};r.\u0275fac=function(i){return new(i||r)(m(ne),m(te),m(ie),m(le),m(M),m(ae))},r.\u0275cmp=A({type:r,selectors:[["app-multi-channel-comparison"]],standalone:!0,features:[z([V,O]),$],decls:26,vars:22,consts:[["headerTitle","Inventory Comparison","textButton","Search",3,"onSubmit","pageData","hideSearchBox"],[4,"ngIf"],["for","selectChannel",1,"fw-bold","mb-3"],["id","selectChannel",3,"onChannelChange","multiple"],[1,"mt-5"],["for","PageNumber",1,"fw-bold"],["type","number","id","PageNumber","placeholder","PageNumber","name","PageNumber","data-toggle","tooltip","matTooltip","Page Number",1,"form-control","mt-2",3,"ngModelChange","ngModel"],["for","RowCount",1,"fw-bold"],["type","number","id","RowCount","placeholder","Page Size","name","RowCount","data-toggle","tooltip","matTooltip","Page Size",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[3,"onNextPage","onLastPage","onGetRowCount","totalData","hideCount","rowCount","pageNumber","disableNextButton","goToLastPage"],[1,"d-flex"],["type","button","class","btn btn-success shadow-sm rounded me-3",3,"click",4,"ngIf"],["type","button",1,"btn","btn-success","shadow-sm","rounded","me-3",3,"click"],[1,"fas","fa-chevron-circle-up"],["table","inventory",3,"onToggle","onSubmit","data","channel","showProductToggle","hiddenIPOSInventory"]],template:function(i,e){i&1&&(c(0,"mainpanel",0),C("onSubmit",function(a){return e.onSearch(a)}),I(1,me,3,1,"actions",1),v(2,"async"),c(3,"filters"),I(4,ge,1,0,"ng-container",1),v(5,"async"),c(6,"div")(7,"label",2),_(8,"Channel"),p(),c(9,"multiwarehouse-tree-select",3),C("onChannelChange",function(a){return e.onChannelChange(a)}),p()(),c(10,"div",4)(11,"label",5),_(12,"PageNumber"),p(),c(13,"input",6),E("ngModelChange",function(a){return T(e.searchFilter.PageNumber,a)||(e.searchFilter.PageNumber=a),a}),p()(),c(14,"div",4)(15,"label",7),_(16,"Page Size"),p(),c(17,"input",8),E("ngModelChange",function(a){return T(e.searchFilter.RowCount,a)||(e.searchFilter.RowCount=a),a}),p()()(),c(18,"content")(19,"div",9)(20,"div",10)(21,"div",11),I(22,Ce,2,4,"ng-container",1),v(23,"async"),c(24,"infinite-paginator",12),v(25,"async"),C("onNextPage",function(){return e.paginationService.onNextPage(e.searchFilter)})("onLastPage",function(){return e.paginationService.onLastPage(e.searchFilter)})("onGetRowCount",function(){return e.paginationService.getRowCount(e.searchFilter)}),p()()()()()()),i&2&&(d("pageData",e.pageData)("hideSearchBox",!1),h(),d("ngIf",y(2,14,e.paginationService.data$)),h(3),d("ngIf",y(5,16,e.loader$)),h(5),d("multiple",!0),h(4),L("ngModel",e.searchFilter.PageNumber),h(4),L("ngModel",e.searchFilter.RowCount),h(5),d("ngIf",y(23,18,e.paginationService.data$)),h(2),d("totalData",e.paginationService.totalData())("hideCount",e.paginationService.hideCount())("rowCount",y(25,20,e.paginationService.totalRowCount$))("pageNumber",e.paginationService.pageNumber())("disableNextButton",e.paginationService.disableNextButton())("goToLastPage",e.paginationService.isLastPage()))},dependencies:[K,Q,J,re,oe,ce,ee,q,Z,X,Y,pe,he],styles:[".no-bullet[_ngcontent-%COMP%]{list-style-type:none}"]});let l=r;return l})();export{$e as MultiChannelComparison};