marketplacepos 3.19.3 → 3.20.1

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 (97) hide show
  1. package/Marketplace/3rdpartylicenses.txt +12 -12
  2. package/Marketplace/{chunk-O5MOPAT5.js → chunk-2E5AKA74.js} +1 -1
  3. package/Marketplace/chunk-2FRMUOJY.js +15 -0
  4. package/Marketplace/{chunk-ZWDUUAFA.js → chunk-2L6CZFW7.js} +1 -1
  5. package/Marketplace/{chunk-CTKEWRX4.js → chunk-2SC3HO66.js} +1 -1
  6. package/Marketplace/chunk-2V4K6SEC.js +1 -0
  7. package/Marketplace/{chunk-CHPESC5O.js → chunk-33L2SBIN.js} +1 -1
  8. package/Marketplace/chunk-47PEHCOU.js +1 -0
  9. package/Marketplace/{chunk-3XWOT6GZ.js → chunk-4CEFDQPI.js} +1 -1
  10. package/Marketplace/{chunk-E4XM7VHY.js → chunk-4O74KBBT.js} +1 -1
  11. package/Marketplace/{chunk-JKF36COK.js → chunk-5HY6FBUD.js} +1 -1
  12. package/Marketplace/{chunk-S36U4I4O.js → chunk-65RMQ5Q5.js} +1 -1
  13. package/Marketplace/{chunk-ATJPUUZQ.js → chunk-6UDYSYXW.js} +1 -1
  14. package/Marketplace/{chunk-AHA2WBEK.js → chunk-7V2SU4MA.js} +1 -1
  15. package/Marketplace/{chunk-WVKDNFEM.js → chunk-7VKIP3Z6.js} +2 -2
  16. package/Marketplace/chunk-7WUKCDMC.js +1 -0
  17. package/Marketplace/{chunk-K6H25CD6.js → chunk-7YWHTN3X.js} +1 -1
  18. package/Marketplace/{chunk-W3POM6UQ.js → chunk-A37OKNC2.js} +1 -1
  19. package/Marketplace/{chunk-HRB6G2LU.js → chunk-ALKBIH7J.js} +2 -2
  20. package/Marketplace/{chunk-4URWFKAM.js → chunk-BGWVHGAY.js} +1 -1
  21. package/Marketplace/{chunk-3LSSEMTW.js → chunk-BKFG7NIB.js} +1 -1
  22. package/Marketplace/{chunk-M4JG6342.js → chunk-BTY6PS53.js} +1 -1
  23. package/Marketplace/chunk-BZPMSXEO.js +9 -0
  24. package/Marketplace/{chunk-4QK7Y7R2.js → chunk-C6QIBOCB.js} +1 -1
  25. package/Marketplace/{chunk-3TNPJNQS.js → chunk-CJILX5R7.js} +1 -1
  26. package/Marketplace/{chunk-PYBQPNRY.js → chunk-D6L7HUOY.js} +1 -1
  27. package/Marketplace/{chunk-3ZQBMP7R.js → chunk-D76K4RZ7.js} +1 -1
  28. package/Marketplace/chunk-DA5WII5E.js +2 -0
  29. package/Marketplace/{chunk-GXHE2CDH.js → chunk-DQIP7MCZ.js} +1 -1
  30. package/Marketplace/{chunk-73DE2GZF.js → chunk-DYLT6RRK.js} +1 -1
  31. package/Marketplace/{chunk-GP6U42SV.js → chunk-E5BOLHDG.js} +1 -1
  32. package/Marketplace/{chunk-3UKBESDQ.js → chunk-EGYILQWG.js} +1 -1
  33. package/Marketplace/{chunk-6NTRXLMW.js → chunk-EIBGI6U2.js} +1 -1
  34. package/Marketplace/{chunk-GEOZCTY6.js → chunk-EN6KXWCY.js} +1 -1
  35. package/Marketplace/chunk-EXZPDDOY.js +1 -0
  36. package/Marketplace/{chunk-X4WLRMDP.js → chunk-FTHTFVHH.js} +1 -1
  37. package/Marketplace/{chunk-XNGU3O4O.js → chunk-GNY5TY3R.js} +1 -1
  38. package/Marketplace/{chunk-RVVTVU4B.js → chunk-GQG2K3LS.js} +1 -1
  39. package/Marketplace/{chunk-2ORPFPW3.js → chunk-HCJ6C5OR.js} +1 -1
  40. package/Marketplace/{chunk-PBJG5QAA.js → chunk-HHIG3XFB.js} +1 -1
  41. package/Marketplace/{chunk-G3NZDAHG.js → chunk-HOTEJTGP.js} +1 -1
  42. package/Marketplace/chunk-IG57OCJS.js +9 -0
  43. package/Marketplace/{chunk-FZDYEHNC.js → chunk-IIPI4CHY.js} +1 -1
  44. package/Marketplace/chunk-JEC3SZTG.js +1 -0
  45. package/Marketplace/{chunk-NVF24LK5.js → chunk-JHYIHRQH.js} +1 -1
  46. package/Marketplace/{chunk-IIANF3VA.js → chunk-JUWM7ABO.js} +1 -1
  47. package/Marketplace/{chunk-WH3FZ3VM.js → chunk-JY3L4RUM.js} +1 -1
  48. package/Marketplace/{chunk-44IWQ2WK.js → chunk-KZ6AD6KW.js} +1 -1
  49. package/Marketplace/{chunk-KGSUB5OH.js → chunk-L4BFVIW5.js} +1 -1
  50. package/Marketplace/{chunk-2C32PU5X.js → chunk-LAQL3BQZ.js} +1 -1
  51. package/Marketplace/chunk-MADSP2BP.js +52 -0
  52. package/Marketplace/{chunk-VZHIFACR.js → chunk-MKJON4UM.js} +1 -1
  53. package/Marketplace/{chunk-BH2R22DH.js → chunk-ML2BGDS4.js} +1 -1
  54. package/Marketplace/{chunk-3ORAGDUV.js → chunk-MZNSPLFO.js} +1 -1
  55. package/Marketplace/{chunk-XMQ2CMLS.js → chunk-NAZU3HCR.js} +1 -1
  56. package/Marketplace/chunk-NNXYTNL6.js +1 -0
  57. package/Marketplace/{chunk-OIQXRKAG.js → chunk-OTR5MBON.js} +1 -1
  58. package/Marketplace/{chunk-BTXJZOGD.js → chunk-PTFQX4VB.js} +1 -1
  59. package/Marketplace/{chunk-ACYUSHMS.js → chunk-PYD2YWAN.js} +1 -1
  60. package/Marketplace/chunk-QNEE46MU.js +3 -0
  61. package/Marketplace/{chunk-NF2ANZGK.js → chunk-QYY5XVLP.js} +1 -1
  62. package/Marketplace/{chunk-LVFJFYVO.js → chunk-RDSLGGC4.js} +1 -1
  63. package/Marketplace/{chunk-4ULJZM2I.js → chunk-SQTY2CZY.js} +1 -1
  64. package/Marketplace/{chunk-AUCIW6VR.js → chunk-TE62OPBT.js} +1 -1
  65. package/Marketplace/{chunk-IDJG7E4L.js → chunk-TVRLQACG.js} +1 -1
  66. package/Marketplace/{chunk-FMYZSZEX.js → chunk-ULELZXI5.js} +1 -1
  67. package/Marketplace/{chunk-R6PEAOIJ.js → chunk-V64ZU2C6.js} +1 -1
  68. package/Marketplace/{chunk-ONKOEBKR.js → chunk-VBCIYCOF.js} +1 -1
  69. package/Marketplace/{chunk-4YCZLOHQ.js → chunk-WKSTGJK5.js} +1 -1
  70. package/Marketplace/{chunk-I7OLAB5O.js → chunk-WTMUHE4V.js} +1 -1
  71. package/Marketplace/{chunk-WUCXNOY6.js → chunk-XG2DR4LW.js} +1 -1
  72. package/Marketplace/{chunk-URIDNNCK.js → chunk-XQQPMC44.js} +1 -1
  73. package/Marketplace/chunk-XUOIJTB4.js +1 -0
  74. package/Marketplace/{chunk-LV34VUJQ.js → chunk-XUSY2QT2.js} +1 -1
  75. package/Marketplace/{chunk-JHJNKEH6.js → chunk-XWXDJLRN.js} +1 -1
  76. package/Marketplace/{chunk-K62KUEI5.js → chunk-XYJNR26Y.js} +1 -1
  77. package/Marketplace/{chunk-YJFARXIC.js → chunk-YCTTFHDT.js} +1 -1
  78. package/Marketplace/{chunk-CGUWFGH3.js → chunk-YCVNABR6.js} +1 -1
  79. package/Marketplace/chunk-YVTEU2IF.js +14 -0
  80. package/Marketplace/chunk-ZA7FXMFZ.js +3 -0
  81. package/Marketplace/chunk-ZIZWZZ4E.js +8 -0
  82. package/Marketplace/chunk-ZX3SBNZT.js +3 -0
  83. package/Marketplace/index.html +3 -3
  84. package/Marketplace/{main-UMNDP57A.js → main-AEC57EMC.js} +1 -1
  85. package/package.json +1 -1
  86. package/Marketplace/chunk-6UK5EDKC.js +0 -5
  87. package/Marketplace/chunk-76GYL4GA.js +0 -1
  88. package/Marketplace/chunk-BFEEK5YU.js +0 -1
  89. package/Marketplace/chunk-BLH75XXY.js +0 -9
  90. package/Marketplace/chunk-CSYQB3ZA.js +0 -1
  91. package/Marketplace/chunk-HSFUKC7R.js +0 -8
  92. package/Marketplace/chunk-KRKQFGMS.js +0 -1
  93. package/Marketplace/chunk-NEQN5BMS.js +0 -15
  94. package/Marketplace/chunk-SNTDL3ZC.js +0 -22
  95. package/Marketplace/chunk-X6J6RWD3.js +0 -1
  96. package/Marketplace/chunk-XH22CID4.js +0 -2
  97. package/Marketplace/chunk-ZPFSBV72.js +0 -3
@@ -1,9 +0,0 @@
1
- import{a as E}from"./chunk-WVKDNFEM.js";import{g as j}from"./chunk-2C32PU5X.js";import{b as S,e as n}from"./chunk-NVF24LK5.js";import{b as s,c as g}from"./chunk-X4WLRMDP.js";import{$ as l,B as I,E as u,Ua as U,Wc as w,d as P,da as c,n as d,q as A,w as C}from"./chunk-HSFUKC7R.js";var D=(()=>{let r=class r{constructor(){this.httpService=c(n)}getAttributes(o,t){return this.httpService.get("api/product/shopee/GetAttributesTree",[{key:"ID",value:o},{key:"CategoryID",value:t}])}getCategories(o){return this.httpService.get("api/product/shopee/GetCategories",[{key:"ID",value:o}])}uploadProduct(o){return this.httpService.post("api/product/shopee/AddProduct",o).pipe(u(e=>d(null)))}generateAttribute(o){return o.map(t=>({attribute_id:t.attribute_id,attribute_value_list:t.attribute_value_list.map(e=>({value_id:e.value_id,name:e.name}))})),o}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var R=(()=>{let r=class r{constructor(){this.httpService=c(n)}getCategories(o){return this.httpService.get("api/product/tiktok/GetCategories",[{key:"ID",value:o}])}uploadProduct(o){return this.httpService.post("api/product/tiktok/AddProduct",o).pipe(u(e=>d(null)))}generateAttribute(o){let t;return o.map(e=>(e.type=="PRODUCT_PROPERTY"?t={id:e.id,name:e.name,type:e.type,values:e.values}:t={id:e.id,name:e.values[0].id,type:e.type},t))}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var H=(()=>{let r=class r{constructor(){this.httpService=c(n)}getAttributes(o,t){return this.httpService.get("api/product/lazada/GetAttributes",[{key:"ID",value:o},{key:"CategoryID",value:t}])}getCategories(o){return this.httpService.get("api/product/lazada/GetCategories",[{key:"ID",value:o}])}uploadProduct(o){return this.httpService.post("api/product/lazada/AddProduct",o).pipe(u(e=>d(null)))}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var T=(()=>{let r=class r{constructor(){this.httpService=c(n)}getAttributes(o,t){return this.httpService.get("api/product/woo/GetAttributes",[{key:"ID",value:o},{key:"CategoryID",value:t}])}getCategories(o){return this.httpService.get("api/product/woo/GetCategories",[{key:"ID",value:o}])}uploadProduct(o){return this.httpService.post("api/product/woo/AddProduct",o).pipe(u(e=>d(null)))}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var y=class{};var b=class{};var F=(()=>{let r=class r{constructor(){this.httpService=c(n)}getCategories(o){return this.httpService.get("api/product/tokopedia/GetCategories",[{key:"ID",value:o}])}uploadProduct(o){return this.httpService.post("api/product/tokopedia/AddProduct",o).pipe(u(e=>d(null)))}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var x=(()=>{let r=class r{constructor(){this.toastrService=c(S)}showToastrUploadMultiple(o){let t=[],e=[],a=this.getResponseList(o);if(o.filter(p=>g.IsNotEmpty(p)).forEach(p=>{typeof p?.Response=="string"?e=[...e,a.length>1?this.setHtmlli(p.Response):this.setHtmlli(p.Response,!1)]:(p?.Response?.Success_list.forEach(f=>{t=[...t,a.length>1?this.setHtmlli(`
2
- <div>
3
- Product ${f.Name} was <div class="d-inline fw-bold">successfully</div> uploaded to ${p.Channel}
4
- </div>
5
- `):this.setHtmlli(`
6
- <div>
7
- Product ${f.Name} was <div class="d-inline fw-bold">successfully</div> uploaded to ${p.Channel}
8
- </div>
9
- `,!1)]}),p?.Response.Fail_list.forEach(f=>{e=[...e,a.length>1?this.setHtmlli(f.Message):this.setHtmlli(f.Message,!1)]}))}),e.length>0&&t.length>0){let p=[...t,...e];this.toastrService.warning(this.concatMessage(p),"Warning!",{enableHtml:!0})}else t.length>0&&e.length==0?this.toastrService.success(this.concatMessage(t),"Success",{enableHtml:!0}):this.toastrService.error(this.concatMessage(e),"Error",{enableHtml:!0})}concatMessage(o=[]){let t="";return o.forEach(e=>{t+=e}),o.length>1?`<ol>${t}</ol>`:t}getResponseList(o){let t=[];return o.filter(e=>g.IsNotEmpty(e)).forEach(e=>{typeof e.Response=="string"?t=[...t,e.Response]:(e?.Response.Success_list.forEach(a=>{t=[...t,a.Name]}),e?.Response.Fail_list.forEach(a=>{t=[...t,a.Message]}))}),t}setHtmlli(o,t=!0){return t?`<li>${o}</li>`:o}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var M=(()=>{let r=class r{constructor(){this.httpService=c(n)}uploadProduct(o){return this.httpService.post("api/product/shopify/AddProduct",o).pipe(u(e=>d(null)))}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var Gt=(()=>{let r=class r{constructor(){this.authService=c(j),this.productService=c(E),this.shoppeUploadService=c(D),this.tiktokUploadService=c(R),this.lazadaUploadService=c(H),this.tokopediaUploadService=c(F),this.wooUploadService=c(T),this.shopifyUploadService=c(M),this.toastrHandlingService=c(x),this.toastr=c(S),this.router=c(w),this.httpService=c(n),this._selectedProduct=new P(this.getStoredProducts()),this.selectedProduct$=this._selectedProduct.asObservable().pipe(I(o=>o&&o.length>0))}getStoredProducts(){let o=localStorage.getItem("productsUpload");if(o){let t=JSON.parse(o);return t&&t.length>0?t:[]}else return[]}setSelectedProduct(o){localStorage.setItem("productsUpload",JSON.stringify(o)),this._selectedProduct.next(o)}clearSelectedProduct(){localStorage.removeItem("productsUpload"),this._selectedProduct.next([])}getUnselectedChannels(){let o=this.authService.getChannels(),t=this._selectedProduct.getValue();return this.productService.filterUnselectedChannel(t,o)}getDefaultCategory(){return this.httpService.get("api/v1/Channel/ProductCategory/Default")}get channelProductUpload(){let o=this.getUnselectedChannels();return U(o.map(e=>{let a=new y;return a.id=e.ID,a.name=e.Name,a.type=e.TypeID,a.categoryId=null,a.attributes=[],a.selected=!1,a}))}onUploadProduct(o){let t=o.filter(e=>e.selected&&g.IsNotEmpty(e.categoryId)||e.selected&&e.type==s.Shopify);if(t.length>0){let e=this.generateDataForUpload(t);this.uploadProduct(e)}else this.toastr.warning("Please select a channel and category to upload the product.","Warning!")}uploadProduct(o){let t=this.generateObservableForUpload(o);C(t).pipe(A(e=>{let a=[];return e.forEach(p=>{a=[...a,...p]}),a})).subscribe({next:(e=[])=>{g.IsNotEmpty(e)&&this.toastrHandlingService.showToastrUploadMultiple(e),this.hasSuccessRes(e)&&this.onSuccessUpload()}})}hasSuccessRes(o){let t=!1;return o.forEach(e=>{e?.Response.Success_list?.length>0&&g.IsNotEmpty(e)&&(t=!0)}),t}onSuccessUpload(){this.router.navigate(["/menu/products/status/sold-in-channel"]),this.clearSelectedProduct()}generateObservableForUpload(o){let t=[],e=[],a=[],p=[],f=[],k=[];o.forEach(h=>{switch(h.ChannelType){case s.Shopee:e.push(h);break;case s.Tiktok:t.push(h);break;case s.Lazada:a.push(h);break;case s.Tokopedia:p.push(h);break;case s.WooCommerce:f.push(h);break;case s.Shopify:k.push(h);break}});let m=[];return[{type:s.Shopee,data:e},{type:s.Tiktok,data:t},{type:s.Lazada,data:a},{type:s.Tokopedia,data:p},{type:s.WooCommerce,data:f},{type:s.Shopify,data:k}].filter(h=>h.data.length>0).forEach(h=>{switch(h.type){case s.Shopee:m.push(this.shoppeUploadService.uploadProduct(e));break;case s.Tiktok:m.push(this.tiktokUploadService.uploadProduct(t));break;case s.Lazada:m.push(this.lazadaUploadService.uploadProduct(a));break;case s.Tokopedia:m.push(this.tokopediaUploadService.uploadProduct(p));break;case s.WooCommerce:m.push(this.wooUploadService.uploadProduct(f));break;case s.Shopify:m.push(this.shopifyUploadService.uploadProduct(k));break}}),m}generateDataForUpload(o){let t=[];return o.forEach(e=>{let a=new b;a.ChannelID=e.id,a.ChannelType=e.type,a.Products=this._selectedProduct.getValue(),e.type==s.Shopify?delete a.CategoryID:a.CategoryID=e.categoryId,e.type==s.WooCommerce||e.type==s.Shopify?a.Attribute=e.attributes[0]:a.Attributes=this.formatAttributes(e.type,e.attributes),t.push(a)}),t}formatAttributes(o,t){let e;switch(o){case s.Shopee:e=this.shoppeUploadService.generateAttribute(t);break;case s.Tiktok:e=this.tiktokUploadService.generateAttribute(t);break;case s.WooCommerce:e=this.tiktokUploadService.generateAttribute(t);break;case s.Tokopedia:e=t;break;case s.Shopify:e=t;break;default:e=[];break}return e}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();export{D as a,R as b,H as c,T as d,Gt as e};
@@ -1 +0,0 @@
1
- import{a as he}from"./chunk-2ORPFPW3.js";import"./chunk-LV34VUJQ.js";import{a as ce}from"./chunk-AUCIW6VR.js";import{a as se}from"./chunk-S36U4I4O.js";import{a as F}from"./chunk-XHAXYWZ7.js";import{b as pe,c as V}from"./chunk-3ORAGDUV.js";import"./chunk-BVIRHZTZ.js";import"./chunk-GP6U42SV.js";import"./chunk-W3POM6UQ.js";import"./chunk-6UK5EDKC.js";import"./chunk-NEQN5BMS.js";import"./chunk-4QK7Y7R2.js";import{a as le}from"./chunk-WVKDNFEM.js";import"./chunk-73DE2GZF.js";import"./chunk-3ZQBMP7R.js";import"./chunk-6NTRXLMW.js";import{g as M}from"./chunk-2C32PU5X.js";import{b as te,e as ne}from"./chunk-NVF24LK5.js";import"./chunk-KCDL7SWP.js";import{d as ie,l as ae,m as oe,n as re}from"./chunk-3XWOT6GZ.js";import"./chunk-CTKEWRX4.js";import"./chunk-GXHE2CDH.js";import{c as q,h as X,m as Y,o as Z,y as ee}from"./chunk-O5MOPAT5.js";import{c as D}from"./chunk-X4WLRMDP.js";import{$ as j,$a as d,$b as y,B,Dc as K,Ia as h,Ib as _,Ja as m,Mb as L,Nb as T,Ob as E,Pb as z,Qb as $,Ua as w,X as k,Za as I,_b as v,da as S,ga as A,lb as c,mb as p,nb as U,oa as b,ob as G,pa as P,pb as W,qb as H,rb as N,ub as C,wb as g,wc as Q,zc as J}from"./chunk-HSFUKC7R.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};