dealpos 25.34.1 → 25.34.2

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 (78) hide show
  1. package/browser/{chunk-VATYB7D2.js → chunk-25BC7SZ4.js} +1 -1
  2. package/browser/{chunk-ZJADGYH2.js → chunk-2BDJSELV.js} +1 -1
  3. package/browser/{chunk-3YFATA26.js → chunk-2HHBXJEO.js} +1 -1
  4. package/browser/{chunk-VSI4JNSZ.js → chunk-3BG6ASGM.js} +1 -1
  5. package/browser/{chunk-PBQ234TA.js → chunk-4NZOKTH5.js} +1 -1
  6. package/browser/{chunk-2OMEZ74I.js → chunk-4PR4BJUK.js} +1 -1
  7. package/browser/{chunk-3Z5CZZ6X.js → chunk-5CQCPILV.js} +1 -1
  8. package/browser/{chunk-4C2QE4YI.js → chunk-5GH4ZXOF.js} +1 -1
  9. package/browser/{chunk-SGGVO55K.js → chunk-62UWQT4T.js} +1 -1
  10. package/browser/{chunk-CBDM5J7M.js → chunk-72XYSM6H.js} +1 -1
  11. package/browser/{chunk-LPZZU4W7.js → chunk-7NO4UMH2.js} +1 -1
  12. package/browser/{chunk-CLYU2LHR.js → chunk-7Z2SV5BR.js} +1 -1
  13. package/browser/{chunk-NSFBVDKX.js → chunk-AHS5SF2F.js} +1 -1
  14. package/browser/{chunk-NJGIKPSO.js → chunk-AJRF756I.js} +1 -1
  15. package/browser/{chunk-VBGFPCZ3.js → chunk-BRQWRKJL.js} +2 -2
  16. package/browser/{chunk-5WYC7FO6.js → chunk-C3H5RJ53.js} +1 -1
  17. package/browser/{chunk-FSPLCPQ4.js → chunk-CN5MONMQ.js} +1 -1
  18. package/browser/{chunk-IOAB2GMO.js → chunk-CQK5VZ5U.js} +1 -1
  19. package/browser/chunk-CUZHOUTT.js +56 -0
  20. package/browser/{chunk-NXQTU6P3.js → chunk-D2XFIIRV.js} +1 -1
  21. package/browser/{chunk-XGTQTP5F.js → chunk-DMFQV366.js} +1 -1
  22. package/browser/{chunk-DF4WNZ6Y.js → chunk-E5ORAYAT.js} +1 -1
  23. package/browser/{chunk-3H3Q54I7.js → chunk-EAWBXXCY.js} +3 -3
  24. package/browser/{chunk-UOCP6QTZ.js → chunk-EDHRH3CR.js} +1 -1
  25. package/browser/{chunk-Z5A2EY24.js → chunk-EOMRO75T.js} +1 -1
  26. package/browser/{chunk-DNIBZXGV.js → chunk-EQ2X33Y7.js} +1 -1
  27. package/browser/{chunk-XL3XCQTT.js → chunk-ESP5Q6M4.js} +1 -1
  28. package/browser/{chunk-5GGG4GND.js → chunk-EU46AUBS.js} +1 -1
  29. package/browser/{chunk-NCORWQZN.js → chunk-F22SO2DI.js} +1 -1
  30. package/browser/{chunk-ETTIK367.js → chunk-FCFX7UK4.js} +1 -1
  31. package/browser/{chunk-6IHCBHSE.js → chunk-GF2O25PD.js} +2 -2
  32. package/browser/{chunk-64MZA77G.js → chunk-GQHEZKF4.js} +1 -1
  33. package/browser/{chunk-OR7N7CSR.js → chunk-GWQ4DDRC.js} +1 -1
  34. package/browser/{chunk-5KIYRKDB.js → chunk-H443OY7B.js} +1 -1
  35. package/browser/{chunk-NY66EA6F.js → chunk-H7MG6BZV.js} +1 -1
  36. package/browser/{chunk-LKCQXF5A.js → chunk-HV6RH7IP.js} +1 -1
  37. package/browser/{chunk-3VA5WMWZ.js → chunk-I2PXSKTR.js} +1 -1
  38. package/browser/{chunk-36RGBV34.js → chunk-JN6CQ5QY.js} +1 -1
  39. package/browser/{chunk-5ZCNYDCJ.js → chunk-KT3FCUIJ.js} +1 -1
  40. package/browser/{chunk-SQVMTAI2.js → chunk-L4347XVN.js} +1 -1
  41. package/browser/{chunk-X3WVCXXG.js → chunk-LACWVEXI.js} +1 -1
  42. package/browser/{chunk-RD5HGAJH.js → chunk-N3Q5L6AW.js} +1 -1
  43. package/browser/{chunk-GWG7WRVP.js → chunk-N6VULU5K.js} +1 -1
  44. package/browser/{chunk-EBSSDFZZ.js → chunk-NAXPCX5Z.js} +1 -1
  45. package/browser/{chunk-DXHZWPYP.js → chunk-NFRDO3AW.js} +4 -4
  46. package/browser/{chunk-FH6QQHH6.js → chunk-NJDZFFP2.js} +1 -1
  47. package/browser/{chunk-UBBDPYIG.js → chunk-OU6CKG3G.js} +2 -2
  48. package/browser/{chunk-RBLT7TTZ.js → chunk-OYKMBHH3.js} +1 -1
  49. package/browser/{chunk-YGOR7BZI.js → chunk-PDRERXXI.js} +1 -1
  50. package/browser/{chunk-G2QVLA6R.js → chunk-PDRVE7KS.js} +1 -1
  51. package/browser/{chunk-2XFGPNRX.js → chunk-QOCXUHST.js} +1 -1
  52. package/browser/{chunk-SONQYL4J.js → chunk-RMREHOQS.js} +1 -1
  53. package/browser/{chunk-IOEKVELS.js → chunk-RQ6V6FSE.js} +1 -1
  54. package/browser/{chunk-57JVQ5XT.js → chunk-SE46QMUZ.js} +1 -1
  55. package/browser/{chunk-WXMYB7ME.js → chunk-SPAKEDRE.js} +1 -1
  56. package/browser/{chunk-26U6TQCL.js → chunk-SWDAMUEG.js} +1 -1
  57. package/browser/{chunk-V2TGWSBG.js → chunk-SWSPY4BC.js} +1 -1
  58. package/browser/{chunk-LC4PI4K6.js → chunk-TTZXIO6J.js} +1 -1
  59. package/browser/{chunk-PDGZ5NZX.js → chunk-U66O4HUW.js} +1 -1
  60. package/browser/{chunk-43CUXODX.js → chunk-U66Y6MUA.js} +1 -1
  61. package/browser/{chunk-BP7CJNHN.js → chunk-UA2K3ZOT.js} +1 -1
  62. package/browser/chunk-UQ6A6MQR.js +1 -0
  63. package/browser/{chunk-CAC2DS3M.js → chunk-UWVVQXFV.js} +1 -1
  64. package/browser/{chunk-RJUFWPXG.js → chunk-UYK6ATMD.js} +1 -1
  65. package/browser/{chunk-TNEGOJTY.js → chunk-WCY6QKIK.js} +1 -1
  66. package/browser/{chunk-2UN5FQLR.js → chunk-WNZ62LV6.js} +1 -1
  67. package/browser/{chunk-KMKWQ2QP.js → chunk-WOA7FL24.js} +2 -2
  68. package/browser/{chunk-YH5B36PP.js → chunk-XKCGHK65.js} +1 -1
  69. package/browser/{chunk-R3UHPMNN.js → chunk-XO4AWRUP.js} +1 -1
  70. package/browser/{chunk-T56QSFQS.js → chunk-YB3KY7OI.js} +1 -1
  71. package/browser/{chunk-UZDFE5I7.js → chunk-YSSOFAAI.js} +1 -1
  72. package/browser/{chunk-LH6HEU7W.js → chunk-Z5SXUHI6.js} +1 -1
  73. package/browser/{chunk-BC3QHOF7.js → chunk-ZZO3UETT.js} +1 -1
  74. package/browser/index.html +2 -2
  75. package/browser/{main-STTU72FT.js → main-4APAI7VK.js} +2 -2
  76. package/package.json +1 -1
  77. package/browser/chunk-S6UO67AT.js +0 -1
  78. package/browser/chunk-UQU2VLMB.js +0 -56
@@ -1 +1 @@
1
- import{a as c}from"./chunk-7JSHH4R2.js";import{a as t}from"./chunk-VATYB7D2.js";import{ja as i}from"./chunk-4JRXN7L6.js";import{a}from"./chunk-7DCB7DB2.js";var n=class o{constructor(){}inititalizeIntercom(){let e=this.getFromLocalStorage();e?.Enabled&&window.Intercom("boot",{app_id:t.intercom.appId,name:e.Name,email:e.Email,created_at:e.Created,user_hash:e.Hash})}shutdown(){this.getFromLocalStorage()?.Enabled&&(window.Intercom("shutdown"),this.clearStorage())}clearStorage(){localStorage.removeItem("Intercom")}updateLocalStorage(e){localStorage.setItem("Intercom",JSON.stringify(e))}getFromLocalStorage(){let e=localStorage.getItem("Intercom");return JSON.parse(e)}hideLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(e.hide_default_launcher=!0,window.Intercom("update",a({app_id:t.intercom.appId},e)),this.updateLocalStorage(e))}showLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(e.hide_default_launcher=!1,window.Intercom("update",a({app_id:t.intercom.appId},e)),this.updateLocalStorage(e))}isHideLauncher(){let e=this.getFromLocalStorage();return c.IsEmpty(e?.hide_default_launcher)?!1:e?.hide_default_launcher}static \u0275fac=function(r){return new(r||o)};static \u0275prov=i({token:o,factory:o.\u0275fac,providedIn:"root"})};export{n as a};
1
+ import{a as c}from"./chunk-7JSHH4R2.js";import{a as t}from"./chunk-25BC7SZ4.js";import{ja as i}from"./chunk-4JRXN7L6.js";import{a}from"./chunk-7DCB7DB2.js";var n=class o{constructor(){}inititalizeIntercom(){let e=this.getFromLocalStorage();e?.Enabled&&window.Intercom("boot",{app_id:t.intercom.appId,name:e.Name,email:e.Email,created_at:e.Created,user_hash:e.Hash})}shutdown(){this.getFromLocalStorage()?.Enabled&&(window.Intercom("shutdown"),this.clearStorage())}clearStorage(){localStorage.removeItem("Intercom")}updateLocalStorage(e){localStorage.setItem("Intercom",JSON.stringify(e))}getFromLocalStorage(){let e=localStorage.getItem("Intercom");return JSON.parse(e)}hideLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(e.hide_default_launcher=!0,window.Intercom("update",a({app_id:t.intercom.appId},e)),this.updateLocalStorage(e))}showLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(e.hide_default_launcher=!1,window.Intercom("update",a({app_id:t.intercom.appId},e)),this.updateLocalStorage(e))}isHideLauncher(){let e=this.getFromLocalStorage();return c.IsEmpty(e?.hide_default_launcher)?!1:e?.hide_default_launcher}static \u0275fac=function(r){return new(r||o)};static \u0275prov=i({token:o,factory:o.\u0275fac,providedIn:"root"})};export{n as a};
@@ -1 +1 @@
1
- import{a as A,b as G}from"./chunk-YKAH43AJ.js";import{d as Z,e as $}from"./chunk-OEP3LYTH.js";import{a as K}from"./chunk-BC3QHOF7.js";import{h as X,i as Y}from"./chunk-DNIBZXGV.js";import{b as U}from"./chunk-SQVMTAI2.js";import{e as Q}from"./chunk-6Y6JUUIW.js";import{D as H,c as B,h as R,o as j}from"./chunk-K2RY2UAW.js";import{d as q}from"./chunk-7JSHH4R2.js";import{$a as p,Bc as y,Fc as W,Ib as i,Jb as o,Ob as S,Qb as C,Rb as s,Rd as V,Td as N,Vd as O,Wc as M,Yc as I,Yd as z,Zc as T,db as _,ec as m,ed as E,gc as x,gd as P,jc as b,jd as J,kb as F,kc as h,lc as f,ob as v,qb as u,qc as w,rc as L,sc as k,va as d,vb as l,wa as g,zc as D}from"./chunk-4JRXN7L6.js";var te=()=>["/menu/Developer/Webhook/Job_Logs/Detail"],ie=a=>({ID:a}),oe=(a,c)=>({"text-success":a,"text-danger":c});function ae(a,c){if(a&1){let e=S();i(0,"div",12)(1,"h6"),m(2,"Status"),o(),i(3,"ng-select",13),f("ngModelChange",function(t){d(e);let r=s(2);return h(r.pageData.Filter.Status,t)||(r.pageData.Filter.Status=t),g(t)}),o(),i(4,"h6"),m(5,"Job ID"),o(),i(6,"input",14),f("ngModelChange",function(t){d(e);let r=s(2);return h(r.pageData.Filter.JobID,t)||(r.pageData.Filter.JobID=t),g(t)}),o(),i(7,"h6"),m(8,"From"),o(),i(9,"datepicker",15),f("dateChange",function(t){d(e);let r=s(2);return h(r.pageData.Filter.From,t)||(r.pageData.Filter.From=t),g(t)}),o(),i(10,"h6"),m(11,"To"),o(),i(12,"datepicker",16),f("dateChange",function(t){d(e);let r=s(2);return h(r.pageData.Filter.To,t)||(r.pageData.Filter.To=t),g(t)}),o()()}if(a&2){let e=s(2);p(3),l("disabled",!e.role.developer.Edit)("items",e.pageData.Options.Status),b("ngModel",e.pageData.Filter.Status),p(3),b("ngModel",e.pageData.Filter.JobID),p(3),l("isFloatingLabel",!1),b("date",e.pageData.Filter.From),p(3),l("isFloatingLabel",!1),b("date",e.pageData.Filter.To)}}function ne(a,c){if(a&1&&(i(0,"tr",17)(1,"td")(2,"a",18),m(3),D(4,"date"),o()(),i(5,"td"),m(6),D(7,"number"),o(),i(8,"td",19),m(9),o()()),a&2){let e=c.$implicit;p(2),l("routerLink",w(12,te))("queryParams",L(13,ie,e._id)),p(),x(" ",y(4,6,e._source["@timestamp_received"],"dd MMM yyyy HH:mm")," "),p(3),x("",y(7,9,e.DurationInSecond,"1.1-1")," s"),p(2),l("ngClass",k(15,oe,e._source.log.respCode==200,e._source.log.respCode!=200)),p(),x(" ",e._source.log.respCode," ")}}function re(a,c){if(a&1){let e=S();i(0,"mat-paginator",20),C("page",function(t){d(e);let r=s(2);return g(r.onPaginationChange(t))}),o()}if(a&2){let e=s(2);l("length",e.pagination.listTotal)("pageSize",e.pagination.pageSize)("pageIndex",e.pageData.Filter.PageNumber==0?0:e.pageData.Filter.PageNumber-1)}}function pe(a,c){if(a&1){let e=S();i(0,"mainpanel-cmp",2),C("onSubmit",function(){d(e);let t=s();return g(t.searchFromPageOne())}),i(1,"filters"),u(2,ae,13,8,"ng-template",null,0,W),o(),i(4,"content")(5,"div",3)(6,"div",4)(7,"table",5)(8,"thead",6)(9,"tr",7)(10,"th",8),m(11,"Created"),o(),i(12,"th",8),m(13,"Duration"),o(),i(14,"th",8),m(15,"Status"),o()()(),i(16,"tbody"),u(17,ne,10,18,"tr",9),o()()(),i(18,"div",10),u(19,re,1,3,"mat-paginator",11),o()()()()}if(a&2){let e=s();l("pageData",e.menuData)("hideSearchBox",!0)("isFilterOnDropdown",!1),p(17),l("ngForOf",e.data.hits),p(2),l("ngIf",e.pagination.listTotal>0)}}var ee=class a extends K{constructor(e,n,t,r){super(e,n,"Developer/DeveloperSpace/Webhook/JobLogs","Developer/DeveloperSpace/WebhookLoader/GetLogs",t);this.httpService=n;this.role=r}postInit(e){this.data.hits=this.data?.hits.map(n=>(n.DurationInSecond=parseInt(n._source?.Duration)/1e3,n)),this.data.ListTotal=e?.total?.value}static \u0275fac=function(n){return new(n||a)(_(U),_(z),_(O),_(q))};static \u0275cmp=F({type:a,selectors:[["app-webhook-job-logs"]],features:[v],decls:1,vars:1,consts:[["pageFilterTemplate",""],[3,"pageData","hideSearchBox","isFilterOnDropdown","onSubmit",4,"ngIf"],[3,"onSubmit","pageData","hideSearchBox","isFilterOnDropdown"],[1,"container-fluid","mt-5"],[1,"table-responsive"],["id","tableGrid",1,"table"],[1,"thead-light","sticky-top-thead"],[1,"header"],[2,"width","50px"],["class","border-bottom",4,"ngFor","ngForOf"],[1,"mt-2"],[3,"length","pageSize","pageIndex","page",4,"ngIf"],[1,"dialog-filter"],["bindLabel","Value","bindValue","Key","placeholder","Choose a status","appendTo","body",3,"ngModelChange","disabled","items","ngModel"],["type","text",1,"form-control",3,"ngModelChange","ngModel"],["placeholder","From","appearance","outline",3,"dateChange","isFloatingLabel","date"],["placeholder","To","appearance","outline",3,"dateChange","isFloatingLabel","date"],[1,"border-bottom"],[3,"routerLink","queryParams"],[3,"ngClass"],[3,"page","length","pageSize","pageIndex"]],template:function(n,t){n&1&&u(0,pe,20,5,"mainpanel-cmp",1),n&2&&l("ngIf",t.data)},dependencies:[J,M,I,T,P,E,Y,X,$,Z,G,A,Q,H,B,R,j,N,V],encapsulation:2})};export{ee as a};
1
+ import{a as A,b as G}from"./chunk-YKAH43AJ.js";import{d as Z,e as $}from"./chunk-OEP3LYTH.js";import{a as K}from"./chunk-ZZO3UETT.js";import{h as X,i as Y}from"./chunk-EQ2X33Y7.js";import{b as U}from"./chunk-L4347XVN.js";import{e as Q}from"./chunk-6Y6JUUIW.js";import{D as H,c as B,h as R,o as j}from"./chunk-K2RY2UAW.js";import{d as q}from"./chunk-7JSHH4R2.js";import{$a as p,Bc as y,Fc as W,Ib as i,Jb as o,Ob as S,Qb as C,Rb as s,Rd as V,Td as N,Vd as O,Wc as M,Yc as I,Yd as z,Zc as T,db as _,ec as m,ed as E,gc as x,gd as P,jc as b,jd as J,kb as F,kc as h,lc as f,ob as v,qb as u,qc as w,rc as L,sc as k,va as d,vb as l,wa as g,zc as D}from"./chunk-4JRXN7L6.js";var te=()=>["/menu/Developer/Webhook/Job_Logs/Detail"],ie=a=>({ID:a}),oe=(a,c)=>({"text-success":a,"text-danger":c});function ae(a,c){if(a&1){let e=S();i(0,"div",12)(1,"h6"),m(2,"Status"),o(),i(3,"ng-select",13),f("ngModelChange",function(t){d(e);let r=s(2);return h(r.pageData.Filter.Status,t)||(r.pageData.Filter.Status=t),g(t)}),o(),i(4,"h6"),m(5,"Job ID"),o(),i(6,"input",14),f("ngModelChange",function(t){d(e);let r=s(2);return h(r.pageData.Filter.JobID,t)||(r.pageData.Filter.JobID=t),g(t)}),o(),i(7,"h6"),m(8,"From"),o(),i(9,"datepicker",15),f("dateChange",function(t){d(e);let r=s(2);return h(r.pageData.Filter.From,t)||(r.pageData.Filter.From=t),g(t)}),o(),i(10,"h6"),m(11,"To"),o(),i(12,"datepicker",16),f("dateChange",function(t){d(e);let r=s(2);return h(r.pageData.Filter.To,t)||(r.pageData.Filter.To=t),g(t)}),o()()}if(a&2){let e=s(2);p(3),l("disabled",!e.role.developer.Edit)("items",e.pageData.Options.Status),b("ngModel",e.pageData.Filter.Status),p(3),b("ngModel",e.pageData.Filter.JobID),p(3),l("isFloatingLabel",!1),b("date",e.pageData.Filter.From),p(3),l("isFloatingLabel",!1),b("date",e.pageData.Filter.To)}}function ne(a,c){if(a&1&&(i(0,"tr",17)(1,"td")(2,"a",18),m(3),D(4,"date"),o()(),i(5,"td"),m(6),D(7,"number"),o(),i(8,"td",19),m(9),o()()),a&2){let e=c.$implicit;p(2),l("routerLink",w(12,te))("queryParams",L(13,ie,e._id)),p(),x(" ",y(4,6,e._source["@timestamp_received"],"dd MMM yyyy HH:mm")," "),p(3),x("",y(7,9,e.DurationInSecond,"1.1-1")," s"),p(2),l("ngClass",k(15,oe,e._source.log.respCode==200,e._source.log.respCode!=200)),p(),x(" ",e._source.log.respCode," ")}}function re(a,c){if(a&1){let e=S();i(0,"mat-paginator",20),C("page",function(t){d(e);let r=s(2);return g(r.onPaginationChange(t))}),o()}if(a&2){let e=s(2);l("length",e.pagination.listTotal)("pageSize",e.pagination.pageSize)("pageIndex",e.pageData.Filter.PageNumber==0?0:e.pageData.Filter.PageNumber-1)}}function pe(a,c){if(a&1){let e=S();i(0,"mainpanel-cmp",2),C("onSubmit",function(){d(e);let t=s();return g(t.searchFromPageOne())}),i(1,"filters"),u(2,ae,13,8,"ng-template",null,0,W),o(),i(4,"content")(5,"div",3)(6,"div",4)(7,"table",5)(8,"thead",6)(9,"tr",7)(10,"th",8),m(11,"Created"),o(),i(12,"th",8),m(13,"Duration"),o(),i(14,"th",8),m(15,"Status"),o()()(),i(16,"tbody"),u(17,ne,10,18,"tr",9),o()()(),i(18,"div",10),u(19,re,1,3,"mat-paginator",11),o()()()()}if(a&2){let e=s();l("pageData",e.menuData)("hideSearchBox",!0)("isFilterOnDropdown",!1),p(17),l("ngForOf",e.data.hits),p(2),l("ngIf",e.pagination.listTotal>0)}}var ee=class a extends K{constructor(e,n,t,r){super(e,n,"Developer/DeveloperSpace/Webhook/JobLogs","Developer/DeveloperSpace/WebhookLoader/GetLogs",t);this.httpService=n;this.role=r}postInit(e){this.data.hits=this.data?.hits.map(n=>(n.DurationInSecond=parseInt(n._source?.Duration)/1e3,n)),this.data.ListTotal=e?.total?.value}static \u0275fac=function(n){return new(n||a)(_(U),_(z),_(O),_(q))};static \u0275cmp=F({type:a,selectors:[["app-webhook-job-logs"]],features:[v],decls:1,vars:1,consts:[["pageFilterTemplate",""],[3,"pageData","hideSearchBox","isFilterOnDropdown","onSubmit",4,"ngIf"],[3,"onSubmit","pageData","hideSearchBox","isFilterOnDropdown"],[1,"container-fluid","mt-5"],[1,"table-responsive"],["id","tableGrid",1,"table"],[1,"thead-light","sticky-top-thead"],[1,"header"],[2,"width","50px"],["class","border-bottom",4,"ngFor","ngForOf"],[1,"mt-2"],[3,"length","pageSize","pageIndex","page",4,"ngIf"],[1,"dialog-filter"],["bindLabel","Value","bindValue","Key","placeholder","Choose a status","appendTo","body",3,"ngModelChange","disabled","items","ngModel"],["type","text",1,"form-control",3,"ngModelChange","ngModel"],["placeholder","From","appearance","outline",3,"dateChange","isFloatingLabel","date"],["placeholder","To","appearance","outline",3,"dateChange","isFloatingLabel","date"],[1,"border-bottom"],[3,"routerLink","queryParams"],[3,"ngClass"],[3,"page","length","pageSize","pageIndex"]],template:function(n,t){n&1&&u(0,pe,20,5,"mainpanel-cmp",1),n&2&&l("ngIf",t.data)},dependencies:[J,M,I,T,P,E,Y,X,$,Z,G,A,Q,H,B,R,j,N,V],encapsulation:2})};export{ee as a};
@@ -1,4 +1,4 @@
1
- import{a as ji}from"./chunk-VFJPOXT6.js";import{a as Li,c as Qi}from"./chunk-6CDGFNNW.js";import{a as Kt}from"./chunk-5Q3HGSZF.js";import{a as ki,b as Vi,c as Ri,d as $i,e as Bi,f as Be}from"./chunk-D52JQ3MJ.js";import"./chunk-ZZNHFTQQ.js";import{a as Fi}from"./chunk-LJW4PWIO.js";import{a as Wt}from"./chunk-F7A5YBE3.js";import{a as hi}from"./chunk-HYW3752X.js";import{a as qt}from"./chunk-UTWTOJPR.js";import{a as In}from"./chunk-6JDIOP24.js";import{c as Mi,d as Pi}from"./chunk-D7BXRSNE.js";import"./chunk-Q4A7DDAZ.js";import{a as Ei}from"./chunk-5X4TYOVV.js";import{a as Ni}from"./chunk-COYV3BME.js";import"./chunk-CESNQI72.js";import"./chunk-SE7OFLAL.js";import"./chunk-SSHYD4OE.js";import"./chunk-WLRXTHLM.js";import{a as Ht,b as Si,c as Ii}from"./chunk-ALB3KGN5.js";import"./chunk-RQ2KLKBZ.js";import{a as Pt}from"./chunk-UN45PHQC.js";import"./chunk-MPU5CCEX.js";import"./chunk-BYXBJQAS.js";import"./chunk-RW6DQMII.js";import{b as _i}from"./chunk-EHJK2TZP.js";import"./chunk-3KWHPBIS.js";import"./chunk-D4XF6ATY.js";import"./chunk-PP6MNON6.js";import{d as vi,e as Ut}from"./chunk-OEP3LYTH.js";import"./chunk-YK5T2UAX.js";import"./chunk-3RK6DDJD.js";import"./chunk-ZW6IATXM.js";import{a as Ai}from"./chunk-HBAMQBGL.js";import"./chunk-PZXRSIP6.js";import{a as oi}from"./chunk-UD6LJYER.js";import{b as Oi,c as Ti,d as wi}from"./chunk-3DNIXXKN.js";import{b as Di}from"./chunk-OO3NXLPI.js";import{a as Jt,b as Gt}from"./chunk-FJMA54MJ.js";import"./chunk-DWJWACWY.js";import"./chunk-SCGWHTH7.js";import"./chunk-YZNN2TWC.js";import{e as vt}from"./chunk-SM5U723M.js";import"./chunk-LIZXMNGH.js";import{a as xi}from"./chunk-ASUCEKKD.js";import"./chunk-BYXBJQAS.js";import{a as Qt}from"./chunk-JFW3YXFQ.js";import"./chunk-ZRO2AZMB.js";import"./chunk-CO5HNLC3.js";import{a as ri,b as li,c as si}from"./chunk-EDH3WSAT.js";import"./chunk-3LN2ZQ5M.js";import"./chunk-GF3LE5GG.js";import"./chunk-FQT6I56Q.js";import"./chunk-VJPD6EYA.js";import"./chunk-PILVBZE6.js";import{a as ci,d as pi,f as mi,h as di}from"./chunk-EXXHAXIE.js";import{a as ot,b as at}from"./chunk-IRFJ42AU.js";import{a as ui,b as fi}from"./chunk-SQVMTAI2.js";import"./chunk-R252C5HM.js";import{a as ii}from"./chunk-AFTCPQ2Z.js";import{B as Lt,C as we,D as Ee,E as Ne,F as gi,H as yi,I as bi,O as Ci,q as ai,u as Te,v as Re,w as ne}from"./chunk-BSUUV75R.js";import{ga as bt,ha as Ct}from"./chunk-H34CGBCE.js";import{P as $e}from"./chunk-23F7BAD4.js";import{a as zn,b as Yn,c as Xn}from"./chunk-GIKR6Y2K.js";import{e as _t}from"./chunk-6Y6JUUIW.js";import{a as ee}from"./chunk-LS4HUMWF.js";import"./chunk-LAKOPFJU.js";import"./chunk-SDIK6O2Z.js";import{a as xe}from"./chunk-2FWFPV5I.js";import"./chunk-4SXNNKVU.js";import{C as ti,D as Oe,E as Ke,a as Ge,b as Zn,c as he,h as le,l as me,o as Pe,r as ei,s as qe}from"./chunk-K2RY2UAW.js";import{a as ni}from"./chunk-4C2QE4YI.js";import{a as P,d as De}from"./chunk-7JSHH4R2.js";import"./chunk-VATYB7D2.js";import{$ as ct,$a as l,$b as At,Ac as y,Bc as Sn,D as tt,Db as mt,E as V,Fc as be,H as An,I as _e,Ib as a,Jb as r,Ka as Dn,Kb as I,Lb as Q,M as kn,Ma as pt,Mb as U,N as hn,Ob as B,Od as qn,Q as Vn,Qb as _,Qc as Hn,Qd as Kn,Rb as d,Rd as Bt,T as Rn,Td as jt,Ub as xn,Va as Bn,Vd as Je,W as Mt,Wa as nt,Wc as it,Y as te,Yc as He,Yd as se,Zb as Nt,Zc as pe,_a as jn,_b as Ft,aa as Z,bc as kt,ca as $n,cb as Ln,cc as Vt,cd as Ve,d as ve,db as f,dc as ue,e as Xe,ec as m,ed as Jn,f as En,fa as E,fb as Qn,fc as X,ga as de,gb as Et,gc as j,gd as Me,hc as We,ja as oe,jc as H,jd as F,k as Ae,kb as N,kc as L,lc as J,ma as W,n as Nn,na as ce,o as Ze,ob as Un,p as Fn,pc as ke,qb as D,qc as Rt,rc as ae,sc as $t,sd as Gn,t as u,u as Ie,v as _n,va as x,vb as c,wa as S,xb as yt,y as st,zb as Wn,zc as g}from"./chunk-4JRXN7L6.js";import{a as T,b as R,d as wn,j as gt}from"./chunk-7DCB7DB2.js";var q=class i{constructor(t,e){this.http=e;this.buyForm=t.group({NewOrderID:[""],Order:t.group({Att:[""],SupplierID:[""],Number:[""],Date:[new Date],ID:[P.GuidEmpty]}),Invoice:t.group({ID:[P.GuidEmpty],Due:[new Date],Tax:[0]}),Payment:t.group({ID:[P.GuidEmpty],Amount:[0],MethodID:[0],Code:[""],Note:[""],ImageUrl:[""]})})}outlet=new me({ID:"",Name:"Choose an Outlet"});dueDays=new me(0);deliveryEntityID=new me(P.GuidEmpty);noteForm=new me({Note:"",TagID:"",Currency:{ID:"",ExchangeRate:0,Symbol:""},InvoiceNumber:""});discountAndTaxForm=new me({Discount:{Amount:0,Percentage:0},Tax:{ID:"",CalculationTypeName:"",Rate:0,Label:"",Discontinue:!1}});buyForm;setPONumber(t){let e="";if(t.Seed){let n=t.Seed+"";for(;n.length<t.Digit;)n="0"+n;e=P.StringFormat(t.Prefix,n)}this.buyForm.controls.Order.controls.Number.setValue(e)}setDueDateBasedOnDaysDue(t){console.log(t);let e=this.invoiceDate,n=new Date(P.cloneObject(e));n.setDate(n.getDate()+t),this.buyForm.controls.Invoice.controls.Due.setValue(n)}get dueDate(){return this.buyForm.controls.Invoice.controls.Due.value}get invoiceDate(){return this.buyForm.controls.Order.controls.Date.value}setAmount(t){this.buyForm.controls.Payment.controls.Amount.setValue(t)}setPaymentMethodID(t){this.buyForm.controls.Payment.controls.MethodID.setValue(t)}setTaxAmount(t){this.buyForm.controls.Invoice.controls.Tax.setValue(t)}setNewOrderID(t){this.buyForm.controls.NewOrderID.setValue(t)}setTax(t){let e=T({},this.discountAndTaxForm.value.Discount);this.discountAndTaxForm.setValue({Discount:e,Tax:t})}setCurrency(t){let e=this.noteForm.value;this.noteForm.setValue(R(T({},e),{Currency:t}))}setDeliveryEntityID(t){this.deliveryEntityID.setValue(t)}setdueDays(t){this.dueDays.setValue(t)}setBulkOrderForm(t){this.buyForm.controls.Order.setValue(t)}setBulkNoteForm(t){this.noteForm.setValue(t)}setBulkDiscountAndTaxForm(t){this.discountAndTaxForm.setValue(t)}setOutletForm(t){this.outlet.setValue(t)}setBulkInvoice(t){this.buyForm.controls.Invoice.setValue(T(T({},this.buyForm.controls.Invoice.value),t))}setBulkPayment(t){this.buyForm.controls.Payment.setValue(t)}resetOutletForm(){this.outlet.setValue({ID:"",Name:"Choose an Outlet"})}resetDueDaysForm(){this.dueDays.setValue(0)}resetDeliveryEntityID(){this.deliveryEntityID.setValue(P.GuidEmpty)}resetNoteForm(){this.noteForm.setValue(R(T({},this.noteForm.value),{Note:"",TagID:"",InvoiceNumber:""}))}resetDiscountAndTaxForm(){let t=this.discountAndTaxForm.value;this.discountAndTaxForm.setValue(R(T({},t),{Discount:{Amount:0,Percentage:0}}))}resetBuyForm(){this.buyForm.reset(),this.buyForm.controls.Invoice.controls.ID.setValue(P.GuidEmpty),this.buyForm.controls.Invoice.controls.Due.setValue(new Date),this.buyForm.controls.Order.controls.Date.setValue(new Date),this.buyForm.controls.Order.controls.ID.setValue(P.GuidEmpty),this.generateNumberOnNewTransaction()}generateNumberOnNewTransaction(){this.http.post("/API/Buy/GenerateNumber",{ID:this.outlet.value.ID}).subscribe(t=>{this.setNewOrderID(P.Guid_NewGuid()),this.buyForm.controls.Order.controls.Number.setValue(t.Number)})}static \u0275fac=function(e){return new(e||i)(W(ti),W(se))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var ge=class i{entities$;appConfigJSON$;taxes$;currencies$;supplierPOTypes$;predefinedNotes$;denomination$;defaultDueDays$;constructor(t,e){let n=t.get("/API/Buy2/Load").pipe(E(o=>e.setCurrency(o.Currencies.find(s=>s.ID==o.AppConfigJSON.CoreDefaults.CurrencyID))),te(1));this.denomination$=n.pipe(u(o=>o.Denomination)),this.entities$=n.pipe(u(o=>o.Entities)),this.appConfigJSON$=n.pipe(u(o=>o.AppConfigJSON)),this.taxes$=n.pipe(u(o=>o.Taxes),te(1)),this.currencies$=n.pipe(u(o=>o.Currencies),te(1)),this.supplierPOTypes$=n.pipe(u(o=>o.SupplierPOTypes)),this.predefinedNotes$=n.pipe(u(o=>o.PredefinedNotes)),this.defaultDueDays$=n.pipe(u(o=>o.AppConfigJSON.ModuleBuy.PaymentDialog.DefaultDueDays),E(o=>e.setdueDays(o)),E(o=>e.setDueDateBasedOnDaysDue(o)))}updateDueDays(){this.defaultDueDays$.subscribe()}static \u0275fac=function(e){return new(e||i)(W(se),W(q))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var rt=class i{returnInvoiceNumber=new me("");invoiceInfo$;constructor(t,e,n){let o=e.outlet.valueChanges.pipe(u(p=>p.ID),ee());this.invoiceInfo$=this.returnInvoiceNumber.valueChanges.pipe(V(p=>!!p),de(o),Z(([p,M])=>t.post("/API/Buy/GetSupplierInvoiceRetur2",{EntityID:M,Number:p}).pipe(_e(()=>Ae))),te(1),ee());let s=this.invoiceInfo$.pipe(u(p=>T({},p.Order)),E(p=>{let M={Att:p.Att,SupplierID:{Key:p.SupplierID,Value:p.SupplierName,OnSet:!0},Date:new Date,Number:e.buyForm.controls.Order.controls.Number.value,ID:P.GuidEmpty};e.setBulkOrderForm(M)}),ee()),O=this.invoiceInfo$.pipe(u(p=>p.Order),E(p=>{let M={Note:`Return #${p.Number}`,TagID:p.TypeID,Currency:{ID:p.CurrencyID,ExchangeRate:p.CurrencyRate,Symbol:p.CurrencySymbol??"$"},InvoiceNumber:p.Number};e.setBulkNoteForm(M)}),ee()),v=this.invoiceInfo$.pipe(u(p=>p.Order),de(n.taxes$),u(([p,M])=>R(T({},p),{Tax:M.find(G=>G.ID===p.TaxTypeID)})),E(p=>{let M={Discount:{Amount:p.DiscountAmount,Percentage:p.Discount},Tax:{ID:p.TaxTypeID,Rate:p.Tax?.Rate,CalculationTypeName:p.Tax?.CalculationTypeName,Label:p.Tax?.Label,Discontinue:!p.Tax?.Label}};e.setBulkDiscountAndTaxForm(M)}),ee()),$=this.invoiceInfo$.pipe(u(p=>p.DeliveryEntityID),E(p=>e.setDeliveryEntityID(p)),ee()),K=this.invoiceInfo$.pipe(u(p=>p.Invoice),E(p=>{let M={ID:p.ID,Tax:p.Tax};e.setBulkInvoice(M)}),ee()),h=this.invoiceInfo$.pipe(u(p=>p.Payment),E(p=>{let M={ID:P.GuidEmpty,Amount:p.Amount,MethodID:p.MethodID,Note:p.Note,Code:p.Code,ImageUrl:p.ImageUrl};e.setBulkPayment(M)}),ee());Ie(s,O,v,$,K,h).pipe(ee()).subscribe()}static \u0275fac=function(e){return new(e||i)(W(se),W(q),W(ge))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var ie=class i{constructor(t,e,n,o){this.matDialog=o;let s=e.outlet.valueChanges.pipe(u(p=>p.ID));this.addVariantThroughSerial$=this._addVariantThroughSerial.asObservable().pipe(de(s),Z(([p,M])=>t.get($e.GetVariantBySerial,[{key:"Serial",value:p},{key:"EntityID",value:M}]).pipe(_e(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>R(T({},p),{Quantity:1,Total:p.UnitPrice,VariantID:p.ID})),u(p=>({action:"addAsSerial",variant:p})));let O=this.variantAutocomplete.valueChanges.pipe(V(p=>P.IsNotEmpty(p)&&p.type=="Code"),u(p=>p.str),de(s),Z(([p,M])=>t.get($e.GetVariantByCode,[{key:"Code",value:p},{key:"EntityID",value:M},{key:"Promotion",value:!0}]).pipe(_e(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>R(T({},p),{Quantity:1,Total:p.UnitPrice*((100-p.PriceDiscount)/100),Discount:p.PriceDiscount,VariantID:p.ID}))),v=this.variantAutocomplete.valueChanges.pipe(V(p=>P.IsNotEmpty(p)&&p.type=="ID"),u(p=>p.str)),$=this.variantQuickKey.valueChanges,K=tt(v,$).pipe(de(s),Z(([p,M])=>t.get($e.GetVariantByID,[{key:"ID",value:p},{key:"EntityID",value:M}]).pipe(_e(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>R(T({},p),{Quantity:1,Total:p.UnitPrice*((100-p.OrderPriceDiscount)/100),Discount:p.OrderPriceDiscount,VariantID:p.ID}))),h=tt(K,O).pipe(E(p=>{p.CategoryTypeID===1&&this.toastr.info(`${p.Name} is sellable only.`,xe.Info)}),V(p=>p.CategoryTypeID!==1),u(p=>({action:"add",variant:p})),E(()=>{this.cartDisplayRef&&setTimeout(()=>{let p=this.cartDisplayRef.nativeElement.scrollHeight;this.cartDisplayRef.nativeElement.scrollTop=p},1)})),A=n.invoiceInfo$.pipe(u(p=>({action:"returnInvoice",variants:p.Items.map(M=>R(T({},M.Variant),{Quantity:M.Quantity,Total:M.Total,UnitPrice:M.UnitPrice,Discount:M.Discount,Serial:M.Serial,ID:M.ID,DiscountAmount:M.DiscountAmount,VariantID:M.VariantID,UnitQuantity:M.UnitQuantity}))})));this.cart$=tt(h,A,this.deleteVariant$,this.dragDropCart$,this.returnCart$,this.updateVariant$,this.returnVariant$,this.purchaseVariant$,this.clearCart$,this.onEditForm$,this.addVariantThroughSerial$,this.addVariant$,this.onUploadCart$,this.listenRFID$).pipe(Mt((p,M)=>{let G=[...p],Y=[],b=M.action;if(b=="add"){let C=M.variant;Y=!!G.find(k=>k.VariantID==C.ID)?G.map(k=>k.VariantID==C.ID?R(T({},k),{Quantity:k.Quantity+1,Total:k.Total+k.UnitPrice}):k):[...G,C]}else if(b=="returnInvoice"||b=="onEditForm")Y=M.variants;else if(b=="delete"){let C=M.index;Y=G.filter((w,k)=>k!=C)}else if(b=="sort"){let C=M.ev;Y=G,ci(Y,C.previousIndex,C.currentIndex)}else if(b=="returnCart")Y=G.map(C=>R(T({},C),{Quantity:-Math.abs(C.Quantity),Total:-Math.abs(C.Total)}));else if(b=="update"){let C=M.index;Y=G.map((w,k)=>k==C?M.variant:w)}else if(b=="returnVariant"){let C=M.index;Y=G.map((w,k)=>k==C?R(T({},w),{Quantity:-Math.abs(w.Quantity),Total:-Math.abs(w.Total)}):w)}else if(b=="purchaseVariant"){let C=M.index;Y=G.map((w,k)=>k==C?R(T({},w),{Quantity:Math.abs(w.Quantity),Total:Math.abs(w.Total)}):w)}else if(b=="clearCart")Y=[];else if(b=="addAsSerial"){let C=R(T({},M.variant),{Serial:[{Number:M.variant.Serial.Number,Quantity:1,ExpiryDate:M.variant.Serial.ExpiryDate}]});if(!!G.find(k=>k.ID==C.ID)){let k=C.Serial[0],Ce=G.find(fe=>fe.ID==C.ID),wt=!!Ce.Serial.find(fe=>fe.Number==k.Number)?[...Ce.Serial].map(fe=>fe.Number==k.Number?R(T({},fe),{Quantity:fe.Quantity+1}):fe):[...Ce.Serial,k];Y=G.map(fe=>fe.ID==C.ID?R(T({},fe),{Quantity:fe.Quantity+1,Total:fe.Total+fe.UnitPrice,Serial:wt}):fe)}else Y=[...G,R(T({},C),{Quantity:1,Total:C.UnitPrice})]}else if(b=="uploadCart")Y=[...G,...M.variants];else if(b=="addNewRow"){let C=M.variant;Y=[...G,C]}else if(b=="rfid"){let C=M.variants;Object.keys(C).forEach(w=>{if(C.hasOwnProperty(w)){let k=C[w];if(k&&Object.keys(k.variant).length>0){let Ce=G.findIndex(ft=>ft.Code.toLowerCase()===w.toLowerCase());if(Ce!==-1){let ft=Number(k.count);G[Ce].Quantity+=ft,G[Ce].Total=+G[Ce].UnitPrice*+G[Ce].Quantity,delete C[w],Y=[...G]}else{let ft=k.variant,wt=Number(k.count),fe=this.setUnitPrice(ft),Ki=this.formatItemObject(R(T({},fe),{Quantity:wt,Total:+fe.UnitPrice*+wt}));delete C[w],Y=[...G,Ki]}}}})}return Y},[]),ct([]),te(1)),this.totalVariantOrdered$=this.cart$.pipe(u(p=>p.map(M=>M.Quantity)),u(p=>p.reduce((M,G)=>M+G,0)),ct(0))}toastr=ce(Je);cartDisplayRef;variantAutocomplete=new me;variantQuickKey=new me;_listenRFID=new ve;listenRFID$=this._listenRFID.asObservable().pipe(u(t=>({action:"rfid",variants:t})));_deleteVariant=new ve;deleteVariant$=this._deleteVariant.asObservable().pipe(u(t=>({action:"delete",index:t})));_dragDropCart=new ve;dragDropCart$=this._dragDropCart.asObservable().pipe(u(t=>({action:"sort",ev:t})));_returnCart=new ve;returnCart$=this._returnCart.asObservable().pipe(u(()=>({action:"returnCart"})));_onEditForm=new Xe(null);onEditForm$=this._onEditForm.asObservable().pipe(V(t=>!!t),u(t=>({action:"onEditForm",variants:t})));_clearCart=new ve;clearCart$=this._clearCart.asObservable().pipe(u(()=>({action:"clearCart"})));_updateVariant=new ve;updateVariant$=this._updateVariant.asObservable().pipe(u(t=>({action:"update",variant:t.variant,index:t.index})));_returnVariant=new ve;returnVariant$=this._returnVariant.asObservable().pipe(u(t=>({action:"returnVariant",index:t})));_purchaseVariant=new ve;purchaseVariant$=this._purchaseVariant.asObservable().pipe(u(t=>({action:"purchaseVariant",index:t})));_addVariant=new ve;addVariant$=this._addVariant.asObservable().pipe(u(t=>({action:"addNewRow",variant:t})));_onUploadCart=new ve;onUploadCart$=this._onUploadCart.asObservable().pipe(u(t=>({action:"uploadCart",variants:t})));cart$;totalVariantOrdered$;_addVariantThroughSerial=new ve;addVariantThroughSerial$;deleteVariant(t){this._deleteVariant.next(t)}dragDropCart(t){this._dragDropCart.next(t)}returnCart(){this._returnCart.next()}updateVariant(t,e){this._updateVariant.next({variant:t,index:e})}returnVariant(t){this._returnVariant.next(t)}purchaseVariant(t){this._purchaseVariant.next(t)}clearCart(){this._clearCart.next()}editForm(t){this._onEditForm.next(t)}addVariant(t){this._addVariant.next(t)}addVariantThroughSerial(t){this._addVariantThroughSerial.next(t)}uploadCart(t){this._onUploadCart.next(t)}setUnitPrice(t){let e=T({},t);return P.IsNotEmpty(t.OrderPrice)?e.UnitPrice=t.OrderPrice:e.UnitPrice=t.UnitCost,e}formatItemObject=t=>{let o=t,{ID:e}=o,n=wn(o,["ID"]);return R(T({},n),{Quantity:n.Quantity??1,Total:n.Total??n.UnitPrice,VariantID:e})};addCartRFID(t){this._listenRFID.next(t)}static \u0275fac=function(e){return new(e||i)(W(se),W(q),W(rt),W(ne))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var je=class i{_isEdit=new ve;isEdit$;id$;isUnpaid$;dialog=ce(ne);constructor(t,e,n,o,s){let O=Ze(t.snapshot.queryParams);this.isEdit$=tt(O.pipe(u(b=>!!b.ID)),this._isEdit.asObservable()).pipe(te(1)),this.id$=O.pipe(V(b=>b.ID),u(b=>b.ID));let v=this.id$.pipe(Z(b=>e.post("/api/Buy2/GetDataByID2",{ID:b})),te(1)),$=st(()=>o.entities$).pipe(Z(b=>v.pipe(u(C=>[C.Order,b]))),E(([b,C])=>{let w={Att:b.Att,SupplierID:{Key:b.SupplierID,Value:b.SupplierName,OnSet:!0},Date:b.Date,Number:b.Number,ID:b.ID};n.setBulkOrderForm(w)}),E(([b,C])=>{let w=C.find(k=>k.ID==b.EntityID);n.setOutletForm(w)})),K=v.pipe(u(b=>b.Items),u(b=>b.map(C=>R(T({},C.Variant),{Quantity:C.Quantity,Total:C.Total,Note:C.Note,UnitPrice:C.UnitPrice,Discount:C.Discount,Serial:C.Serial,ID:C.ID,VariantID:C.VariantID,UnitQuantity:C.UnitQuantity,QtyRequested:C.QtyRequested,DiscountAmount:C.DiscountAmount}))),E(b=>s.editForm(b))),h=st(()=>o.currencies$).pipe(Z(b=>v.pipe(u(C=>[C.Order,b,C.Invoice]))),u(([b,C,w])=>R(T({},b),{Number:b.Number!=w.Number?w.Number:b.Number,Currency:C.find(k=>k.ID===b.CurrencyID)})),E(b=>{let C={Note:b.Note,TagID:b.TypeID,Currency:T({},b.Currency),InvoiceNumber:b.Number};n.setBulkNoteForm(C)})),A=v.pipe(u(b=>b.DeliveryEntityID),E(b=>n.setDeliveryEntityID(b))),p=st(()=>o.taxes$).pipe(Z(b=>v.pipe(u(C=>[C.Order,b]))),u(([b,C])=>R(T({},b),{Taxes:C})),E(b=>{let C=b.Taxes.find(k=>k.ID===b.TaxTypeID);C?.Bin&&this.dialog.open(Ht,{id:"ModalInfo",data:{title:"Default Tax Discontinued",message:`
1
+ import{a as ji}from"./chunk-VFJPOXT6.js";import{a as Li,c as Qi}from"./chunk-6CDGFNNW.js";import{a as Kt}from"./chunk-5Q3HGSZF.js";import{a as ki,b as Vi,c as Ri,d as $i,e as Bi,f as Be}from"./chunk-D52JQ3MJ.js";import"./chunk-ZZNHFTQQ.js";import{a as Fi}from"./chunk-LJW4PWIO.js";import{a as Wt}from"./chunk-F7A5YBE3.js";import{a as hi}from"./chunk-HYW3752X.js";import{a as qt}from"./chunk-UTWTOJPR.js";import{a as In}from"./chunk-6JDIOP24.js";import{c as Mi,d as Pi}from"./chunk-D7BXRSNE.js";import"./chunk-Q4A7DDAZ.js";import{a as Ei}from"./chunk-5X4TYOVV.js";import{a as Ni}from"./chunk-COYV3BME.js";import"./chunk-CESNQI72.js";import"./chunk-SE7OFLAL.js";import"./chunk-SSHYD4OE.js";import"./chunk-WLRXTHLM.js";import{a as Ht,b as Si,c as Ii}from"./chunk-ALB3KGN5.js";import"./chunk-RQ2KLKBZ.js";import{a as Pt}from"./chunk-UN45PHQC.js";import"./chunk-MPU5CCEX.js";import"./chunk-BYXBJQAS.js";import"./chunk-RW6DQMII.js";import{b as _i}from"./chunk-EHJK2TZP.js";import"./chunk-3KWHPBIS.js";import"./chunk-D4XF6ATY.js";import"./chunk-PP6MNON6.js";import{d as vi,e as Ut}from"./chunk-OEP3LYTH.js";import"./chunk-YK5T2UAX.js";import"./chunk-3RK6DDJD.js";import"./chunk-ZW6IATXM.js";import{a as Ai}from"./chunk-HBAMQBGL.js";import"./chunk-PZXRSIP6.js";import{a as oi}from"./chunk-UD6LJYER.js";import{b as Oi,c as Ti,d as wi}from"./chunk-3DNIXXKN.js";import{b as Di}from"./chunk-OO3NXLPI.js";import{a as Jt,b as Gt}from"./chunk-FJMA54MJ.js";import"./chunk-DWJWACWY.js";import"./chunk-SCGWHTH7.js";import"./chunk-YZNN2TWC.js";import{e as vt}from"./chunk-SM5U723M.js";import"./chunk-LIZXMNGH.js";import{a as xi}from"./chunk-ASUCEKKD.js";import"./chunk-BYXBJQAS.js";import{a as Qt}from"./chunk-JFW3YXFQ.js";import"./chunk-ZRO2AZMB.js";import"./chunk-CO5HNLC3.js";import{a as ri,b as li,c as si}from"./chunk-EDH3WSAT.js";import"./chunk-3LN2ZQ5M.js";import"./chunk-GF3LE5GG.js";import"./chunk-FQT6I56Q.js";import"./chunk-VJPD6EYA.js";import"./chunk-PILVBZE6.js";import{a as ci,d as pi,f as mi,h as di}from"./chunk-EXXHAXIE.js";import{a as ot,b as at}from"./chunk-IRFJ42AU.js";import{a as ui,b as fi}from"./chunk-L4347XVN.js";import"./chunk-R252C5HM.js";import{a as ii}from"./chunk-AFTCPQ2Z.js";import{B as Lt,C as we,D as Ee,E as Ne,F as gi,H as yi,I as bi,O as Ci,q as ai,u as Te,v as Re,w as ne}from"./chunk-BSUUV75R.js";import{ga as bt,ha as Ct}from"./chunk-H34CGBCE.js";import{P as $e}from"./chunk-23F7BAD4.js";import{a as zn,b as Yn,c as Xn}from"./chunk-GIKR6Y2K.js";import{e as _t}from"./chunk-6Y6JUUIW.js";import{a as ee}from"./chunk-LS4HUMWF.js";import"./chunk-LAKOPFJU.js";import"./chunk-SDIK6O2Z.js";import{a as xe}from"./chunk-2FWFPV5I.js";import"./chunk-4SXNNKVU.js";import{C as ti,D as Oe,E as Ke,a as Ge,b as Zn,c as he,h as le,l as me,o as Pe,r as ei,s as qe}from"./chunk-K2RY2UAW.js";import{a as ni}from"./chunk-5GH4ZXOF.js";import{a as P,d as De}from"./chunk-7JSHH4R2.js";import"./chunk-25BC7SZ4.js";import{$ as ct,$a as l,$b as At,Ac as y,Bc as Sn,D as tt,Db as mt,E as V,Fc as be,H as An,I as _e,Ib as a,Jb as r,Ka as Dn,Kb as I,Lb as Q,M as kn,Ma as pt,Mb as U,N as hn,Ob as B,Od as qn,Q as Vn,Qb as _,Qc as Hn,Qd as Kn,Rb as d,Rd as Bt,T as Rn,Td as jt,Ub as xn,Va as Bn,Vd as Je,W as Mt,Wa as nt,Wc as it,Y as te,Yc as He,Yd as se,Zb as Nt,Zc as pe,_a as jn,_b as Ft,aa as Z,bc as kt,ca as $n,cb as Ln,cc as Vt,cd as Ve,d as ve,db as f,dc as ue,e as Xe,ec as m,ed as Jn,f as En,fa as E,fb as Qn,fc as X,ga as de,gb as Et,gc as j,gd as Me,hc as We,ja as oe,jc as H,jd as F,k as Ae,kb as N,kc as L,lc as J,ma as W,n as Nn,na as ce,o as Ze,ob as Un,p as Fn,pc as ke,qb as D,qc as Rt,rc as ae,sc as $t,sd as Gn,t as u,u as Ie,v as _n,va as x,vb as c,wa as S,xb as yt,y as st,zb as Wn,zc as g}from"./chunk-4JRXN7L6.js";import{a as T,b as R,d as wn,j as gt}from"./chunk-7DCB7DB2.js";var q=class i{constructor(t,e){this.http=e;this.buyForm=t.group({NewOrderID:[""],Order:t.group({Att:[""],SupplierID:[""],Number:[""],Date:[new Date],ID:[P.GuidEmpty]}),Invoice:t.group({ID:[P.GuidEmpty],Due:[new Date],Tax:[0]}),Payment:t.group({ID:[P.GuidEmpty],Amount:[0],MethodID:[0],Code:[""],Note:[""],ImageUrl:[""]})})}outlet=new me({ID:"",Name:"Choose an Outlet"});dueDays=new me(0);deliveryEntityID=new me(P.GuidEmpty);noteForm=new me({Note:"",TagID:"",Currency:{ID:"",ExchangeRate:0,Symbol:""},InvoiceNumber:""});discountAndTaxForm=new me({Discount:{Amount:0,Percentage:0},Tax:{ID:"",CalculationTypeName:"",Rate:0,Label:"",Discontinue:!1}});buyForm;setPONumber(t){let e="";if(t.Seed){let n=t.Seed+"";for(;n.length<t.Digit;)n="0"+n;e=P.StringFormat(t.Prefix,n)}this.buyForm.controls.Order.controls.Number.setValue(e)}setDueDateBasedOnDaysDue(t){console.log(t);let e=this.invoiceDate,n=new Date(P.cloneObject(e));n.setDate(n.getDate()+t),this.buyForm.controls.Invoice.controls.Due.setValue(n)}get dueDate(){return this.buyForm.controls.Invoice.controls.Due.value}get invoiceDate(){return this.buyForm.controls.Order.controls.Date.value}setAmount(t){this.buyForm.controls.Payment.controls.Amount.setValue(t)}setPaymentMethodID(t){this.buyForm.controls.Payment.controls.MethodID.setValue(t)}setTaxAmount(t){this.buyForm.controls.Invoice.controls.Tax.setValue(t)}setNewOrderID(t){this.buyForm.controls.NewOrderID.setValue(t)}setTax(t){let e=T({},this.discountAndTaxForm.value.Discount);this.discountAndTaxForm.setValue({Discount:e,Tax:t})}setCurrency(t){let e=this.noteForm.value;this.noteForm.setValue(R(T({},e),{Currency:t}))}setDeliveryEntityID(t){this.deliveryEntityID.setValue(t)}setdueDays(t){this.dueDays.setValue(t)}setBulkOrderForm(t){this.buyForm.controls.Order.setValue(t)}setBulkNoteForm(t){this.noteForm.setValue(t)}setBulkDiscountAndTaxForm(t){this.discountAndTaxForm.setValue(t)}setOutletForm(t){this.outlet.setValue(t)}setBulkInvoice(t){this.buyForm.controls.Invoice.setValue(T(T({},this.buyForm.controls.Invoice.value),t))}setBulkPayment(t){this.buyForm.controls.Payment.setValue(t)}resetOutletForm(){this.outlet.setValue({ID:"",Name:"Choose an Outlet"})}resetDueDaysForm(){this.dueDays.setValue(0)}resetDeliveryEntityID(){this.deliveryEntityID.setValue(P.GuidEmpty)}resetNoteForm(){this.noteForm.setValue(R(T({},this.noteForm.value),{Note:"",TagID:"",InvoiceNumber:""}))}resetDiscountAndTaxForm(){let t=this.discountAndTaxForm.value;this.discountAndTaxForm.setValue(R(T({},t),{Discount:{Amount:0,Percentage:0}}))}resetBuyForm(){this.buyForm.reset(),this.buyForm.controls.Invoice.controls.ID.setValue(P.GuidEmpty),this.buyForm.controls.Invoice.controls.Due.setValue(new Date),this.buyForm.controls.Order.controls.Date.setValue(new Date),this.buyForm.controls.Order.controls.ID.setValue(P.GuidEmpty),this.generateNumberOnNewTransaction()}generateNumberOnNewTransaction(){this.http.post("/API/Buy/GenerateNumber",{ID:this.outlet.value.ID}).subscribe(t=>{this.setNewOrderID(P.Guid_NewGuid()),this.buyForm.controls.Order.controls.Number.setValue(t.Number)})}static \u0275fac=function(e){return new(e||i)(W(ti),W(se))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var ge=class i{entities$;appConfigJSON$;taxes$;currencies$;supplierPOTypes$;predefinedNotes$;denomination$;defaultDueDays$;constructor(t,e){let n=t.get("/API/Buy2/Load").pipe(E(o=>e.setCurrency(o.Currencies.find(s=>s.ID==o.AppConfigJSON.CoreDefaults.CurrencyID))),te(1));this.denomination$=n.pipe(u(o=>o.Denomination)),this.entities$=n.pipe(u(o=>o.Entities)),this.appConfigJSON$=n.pipe(u(o=>o.AppConfigJSON)),this.taxes$=n.pipe(u(o=>o.Taxes),te(1)),this.currencies$=n.pipe(u(o=>o.Currencies),te(1)),this.supplierPOTypes$=n.pipe(u(o=>o.SupplierPOTypes)),this.predefinedNotes$=n.pipe(u(o=>o.PredefinedNotes)),this.defaultDueDays$=n.pipe(u(o=>o.AppConfigJSON.ModuleBuy.PaymentDialog.DefaultDueDays),E(o=>e.setdueDays(o)),E(o=>e.setDueDateBasedOnDaysDue(o)))}updateDueDays(){this.defaultDueDays$.subscribe()}static \u0275fac=function(e){return new(e||i)(W(se),W(q))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var rt=class i{returnInvoiceNumber=new me("");invoiceInfo$;constructor(t,e,n){let o=e.outlet.valueChanges.pipe(u(p=>p.ID),ee());this.invoiceInfo$=this.returnInvoiceNumber.valueChanges.pipe(V(p=>!!p),de(o),Z(([p,M])=>t.post("/API/Buy/GetSupplierInvoiceRetur2",{EntityID:M,Number:p}).pipe(_e(()=>Ae))),te(1),ee());let s=this.invoiceInfo$.pipe(u(p=>T({},p.Order)),E(p=>{let M={Att:p.Att,SupplierID:{Key:p.SupplierID,Value:p.SupplierName,OnSet:!0},Date:new Date,Number:e.buyForm.controls.Order.controls.Number.value,ID:P.GuidEmpty};e.setBulkOrderForm(M)}),ee()),O=this.invoiceInfo$.pipe(u(p=>p.Order),E(p=>{let M={Note:`Return #${p.Number}`,TagID:p.TypeID,Currency:{ID:p.CurrencyID,ExchangeRate:p.CurrencyRate,Symbol:p.CurrencySymbol??"$"},InvoiceNumber:p.Number};e.setBulkNoteForm(M)}),ee()),v=this.invoiceInfo$.pipe(u(p=>p.Order),de(n.taxes$),u(([p,M])=>R(T({},p),{Tax:M.find(G=>G.ID===p.TaxTypeID)})),E(p=>{let M={Discount:{Amount:p.DiscountAmount,Percentage:p.Discount},Tax:{ID:p.TaxTypeID,Rate:p.Tax?.Rate,CalculationTypeName:p.Tax?.CalculationTypeName,Label:p.Tax?.Label,Discontinue:!p.Tax?.Label}};e.setBulkDiscountAndTaxForm(M)}),ee()),$=this.invoiceInfo$.pipe(u(p=>p.DeliveryEntityID),E(p=>e.setDeliveryEntityID(p)),ee()),K=this.invoiceInfo$.pipe(u(p=>p.Invoice),E(p=>{let M={ID:p.ID,Tax:p.Tax};e.setBulkInvoice(M)}),ee()),h=this.invoiceInfo$.pipe(u(p=>p.Payment),E(p=>{let M={ID:P.GuidEmpty,Amount:p.Amount,MethodID:p.MethodID,Note:p.Note,Code:p.Code,ImageUrl:p.ImageUrl};e.setBulkPayment(M)}),ee());Ie(s,O,v,$,K,h).pipe(ee()).subscribe()}static \u0275fac=function(e){return new(e||i)(W(se),W(q),W(ge))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var ie=class i{constructor(t,e,n,o){this.matDialog=o;let s=e.outlet.valueChanges.pipe(u(p=>p.ID));this.addVariantThroughSerial$=this._addVariantThroughSerial.asObservable().pipe(de(s),Z(([p,M])=>t.get($e.GetVariantBySerial,[{key:"Serial",value:p},{key:"EntityID",value:M}]).pipe(_e(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>R(T({},p),{Quantity:1,Total:p.UnitPrice,VariantID:p.ID})),u(p=>({action:"addAsSerial",variant:p})));let O=this.variantAutocomplete.valueChanges.pipe(V(p=>P.IsNotEmpty(p)&&p.type=="Code"),u(p=>p.str),de(s),Z(([p,M])=>t.get($e.GetVariantByCode,[{key:"Code",value:p},{key:"EntityID",value:M},{key:"Promotion",value:!0}]).pipe(_e(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>R(T({},p),{Quantity:1,Total:p.UnitPrice*((100-p.PriceDiscount)/100),Discount:p.PriceDiscount,VariantID:p.ID}))),v=this.variantAutocomplete.valueChanges.pipe(V(p=>P.IsNotEmpty(p)&&p.type=="ID"),u(p=>p.str)),$=this.variantQuickKey.valueChanges,K=tt(v,$).pipe(de(s),Z(([p,M])=>t.get($e.GetVariantByID,[{key:"ID",value:p},{key:"EntityID",value:M}]).pipe(_e(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>R(T({},p),{Quantity:1,Total:p.UnitPrice*((100-p.OrderPriceDiscount)/100),Discount:p.OrderPriceDiscount,VariantID:p.ID}))),h=tt(K,O).pipe(E(p=>{p.CategoryTypeID===1&&this.toastr.info(`${p.Name} is sellable only.`,xe.Info)}),V(p=>p.CategoryTypeID!==1),u(p=>({action:"add",variant:p})),E(()=>{this.cartDisplayRef&&setTimeout(()=>{let p=this.cartDisplayRef.nativeElement.scrollHeight;this.cartDisplayRef.nativeElement.scrollTop=p},1)})),A=n.invoiceInfo$.pipe(u(p=>({action:"returnInvoice",variants:p.Items.map(M=>R(T({},M.Variant),{Quantity:M.Quantity,Total:M.Total,UnitPrice:M.UnitPrice,Discount:M.Discount,Serial:M.Serial,ID:M.ID,DiscountAmount:M.DiscountAmount,VariantID:M.VariantID,UnitQuantity:M.UnitQuantity}))})));this.cart$=tt(h,A,this.deleteVariant$,this.dragDropCart$,this.returnCart$,this.updateVariant$,this.returnVariant$,this.purchaseVariant$,this.clearCart$,this.onEditForm$,this.addVariantThroughSerial$,this.addVariant$,this.onUploadCart$,this.listenRFID$).pipe(Mt((p,M)=>{let G=[...p],Y=[],b=M.action;if(b=="add"){let C=M.variant;Y=!!G.find(k=>k.VariantID==C.ID)?G.map(k=>k.VariantID==C.ID?R(T({},k),{Quantity:k.Quantity+1,Total:k.Total+k.UnitPrice}):k):[...G,C]}else if(b=="returnInvoice"||b=="onEditForm")Y=M.variants;else if(b=="delete"){let C=M.index;Y=G.filter((w,k)=>k!=C)}else if(b=="sort"){let C=M.ev;Y=G,ci(Y,C.previousIndex,C.currentIndex)}else if(b=="returnCart")Y=G.map(C=>R(T({},C),{Quantity:-Math.abs(C.Quantity),Total:-Math.abs(C.Total)}));else if(b=="update"){let C=M.index;Y=G.map((w,k)=>k==C?M.variant:w)}else if(b=="returnVariant"){let C=M.index;Y=G.map((w,k)=>k==C?R(T({},w),{Quantity:-Math.abs(w.Quantity),Total:-Math.abs(w.Total)}):w)}else if(b=="purchaseVariant"){let C=M.index;Y=G.map((w,k)=>k==C?R(T({},w),{Quantity:Math.abs(w.Quantity),Total:Math.abs(w.Total)}):w)}else if(b=="clearCart")Y=[];else if(b=="addAsSerial"){let C=R(T({},M.variant),{Serial:[{Number:M.variant.Serial.Number,Quantity:1,ExpiryDate:M.variant.Serial.ExpiryDate}]});if(!!G.find(k=>k.ID==C.ID)){let k=C.Serial[0],Ce=G.find(fe=>fe.ID==C.ID),wt=!!Ce.Serial.find(fe=>fe.Number==k.Number)?[...Ce.Serial].map(fe=>fe.Number==k.Number?R(T({},fe),{Quantity:fe.Quantity+1}):fe):[...Ce.Serial,k];Y=G.map(fe=>fe.ID==C.ID?R(T({},fe),{Quantity:fe.Quantity+1,Total:fe.Total+fe.UnitPrice,Serial:wt}):fe)}else Y=[...G,R(T({},C),{Quantity:1,Total:C.UnitPrice})]}else if(b=="uploadCart")Y=[...G,...M.variants];else if(b=="addNewRow"){let C=M.variant;Y=[...G,C]}else if(b=="rfid"){let C=M.variants;Object.keys(C).forEach(w=>{if(C.hasOwnProperty(w)){let k=C[w];if(k&&Object.keys(k.variant).length>0){let Ce=G.findIndex(ft=>ft.Code.toLowerCase()===w.toLowerCase());if(Ce!==-1){let ft=Number(k.count);G[Ce].Quantity+=ft,G[Ce].Total=+G[Ce].UnitPrice*+G[Ce].Quantity,delete C[w],Y=[...G]}else{let ft=k.variant,wt=Number(k.count),fe=this.setUnitPrice(ft),Ki=this.formatItemObject(R(T({},fe),{Quantity:wt,Total:+fe.UnitPrice*+wt}));delete C[w],Y=[...G,Ki]}}}})}return Y},[]),ct([]),te(1)),this.totalVariantOrdered$=this.cart$.pipe(u(p=>p.map(M=>M.Quantity)),u(p=>p.reduce((M,G)=>M+G,0)),ct(0))}toastr=ce(Je);cartDisplayRef;variantAutocomplete=new me;variantQuickKey=new me;_listenRFID=new ve;listenRFID$=this._listenRFID.asObservable().pipe(u(t=>({action:"rfid",variants:t})));_deleteVariant=new ve;deleteVariant$=this._deleteVariant.asObservable().pipe(u(t=>({action:"delete",index:t})));_dragDropCart=new ve;dragDropCart$=this._dragDropCart.asObservable().pipe(u(t=>({action:"sort",ev:t})));_returnCart=new ve;returnCart$=this._returnCart.asObservable().pipe(u(()=>({action:"returnCart"})));_onEditForm=new Xe(null);onEditForm$=this._onEditForm.asObservable().pipe(V(t=>!!t),u(t=>({action:"onEditForm",variants:t})));_clearCart=new ve;clearCart$=this._clearCart.asObservable().pipe(u(()=>({action:"clearCart"})));_updateVariant=new ve;updateVariant$=this._updateVariant.asObservable().pipe(u(t=>({action:"update",variant:t.variant,index:t.index})));_returnVariant=new ve;returnVariant$=this._returnVariant.asObservable().pipe(u(t=>({action:"returnVariant",index:t})));_purchaseVariant=new ve;purchaseVariant$=this._purchaseVariant.asObservable().pipe(u(t=>({action:"purchaseVariant",index:t})));_addVariant=new ve;addVariant$=this._addVariant.asObservable().pipe(u(t=>({action:"addNewRow",variant:t})));_onUploadCart=new ve;onUploadCart$=this._onUploadCart.asObservable().pipe(u(t=>({action:"uploadCart",variants:t})));cart$;totalVariantOrdered$;_addVariantThroughSerial=new ve;addVariantThroughSerial$;deleteVariant(t){this._deleteVariant.next(t)}dragDropCart(t){this._dragDropCart.next(t)}returnCart(){this._returnCart.next()}updateVariant(t,e){this._updateVariant.next({variant:t,index:e})}returnVariant(t){this._returnVariant.next(t)}purchaseVariant(t){this._purchaseVariant.next(t)}clearCart(){this._clearCart.next()}editForm(t){this._onEditForm.next(t)}addVariant(t){this._addVariant.next(t)}addVariantThroughSerial(t){this._addVariantThroughSerial.next(t)}uploadCart(t){this._onUploadCart.next(t)}setUnitPrice(t){let e=T({},t);return P.IsNotEmpty(t.OrderPrice)?e.UnitPrice=t.OrderPrice:e.UnitPrice=t.UnitCost,e}formatItemObject=t=>{let o=t,{ID:e}=o,n=wn(o,["ID"]);return R(T({},n),{Quantity:n.Quantity??1,Total:n.Total??n.UnitPrice,VariantID:e})};addCartRFID(t){this._listenRFID.next(t)}static \u0275fac=function(e){return new(e||i)(W(se),W(q),W(rt),W(ne))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var je=class i{_isEdit=new ve;isEdit$;id$;isUnpaid$;dialog=ce(ne);constructor(t,e,n,o,s){let O=Ze(t.snapshot.queryParams);this.isEdit$=tt(O.pipe(u(b=>!!b.ID)),this._isEdit.asObservable()).pipe(te(1)),this.id$=O.pipe(V(b=>b.ID),u(b=>b.ID));let v=this.id$.pipe(Z(b=>e.post("/api/Buy2/GetDataByID2",{ID:b})),te(1)),$=st(()=>o.entities$).pipe(Z(b=>v.pipe(u(C=>[C.Order,b]))),E(([b,C])=>{let w={Att:b.Att,SupplierID:{Key:b.SupplierID,Value:b.SupplierName,OnSet:!0},Date:b.Date,Number:b.Number,ID:b.ID};n.setBulkOrderForm(w)}),E(([b,C])=>{let w=C.find(k=>k.ID==b.EntityID);n.setOutletForm(w)})),K=v.pipe(u(b=>b.Items),u(b=>b.map(C=>R(T({},C.Variant),{Quantity:C.Quantity,Total:C.Total,Note:C.Note,UnitPrice:C.UnitPrice,Discount:C.Discount,Serial:C.Serial,ID:C.ID,VariantID:C.VariantID,UnitQuantity:C.UnitQuantity,QtyRequested:C.QtyRequested,DiscountAmount:C.DiscountAmount}))),E(b=>s.editForm(b))),h=st(()=>o.currencies$).pipe(Z(b=>v.pipe(u(C=>[C.Order,b,C.Invoice]))),u(([b,C,w])=>R(T({},b),{Number:b.Number!=w.Number?w.Number:b.Number,Currency:C.find(k=>k.ID===b.CurrencyID)})),E(b=>{let C={Note:b.Note,TagID:b.TypeID,Currency:T({},b.Currency),InvoiceNumber:b.Number};n.setBulkNoteForm(C)})),A=v.pipe(u(b=>b.DeliveryEntityID),E(b=>n.setDeliveryEntityID(b))),p=st(()=>o.taxes$).pipe(Z(b=>v.pipe(u(C=>[C.Order,b]))),u(([b,C])=>R(T({},b),{Taxes:C})),E(b=>{let C=b.Taxes.find(k=>k.ID===b.TaxTypeID);C?.Bin&&this.dialog.open(Ht,{id:"ModalInfo",data:{title:"Default Tax Discontinued",message:`
2
2
  <div class="d-flex justify-content-center my-4">
3
3
  <img class="img-2x" src="https://res.cloudinary.com/pos/image/upload/v1705387550/POS/Images/Cashier/globalerror.svg"
4
4
  alt="Empty Sales Order Tag" />
@@ -1 +1 @@
1
- import{a as Ge}from"./chunk-CHMP2XLU.js";import{a as Ae,f as Ne}from"./chunk-64MZA77G.js";import"./chunk-VLGOLBLH.js";import"./chunk-36RGBV34.js";import"./chunk-X2FYFSD6.js";import"./chunk-2GYZF4SG.js";import"./chunk-UKKFUEUF.js";import{b as Le,c as Re,d as Be,e as We,f as je,g as ze}from"./chunk-ZFSUD7PJ.js";import"./chunk-Q4A7DDAZ.js";import{b as $e}from"./chunk-MPU5CCEX.js";import"./chunk-EHJK2TZP.js";import"./chunk-3KWHPBIS.js";import{d as Fe}from"./chunk-D4XF6ATY.js";import"./chunk-PP6MNON6.js";import{b as xe}from"./chunk-YK5T2UAX.js";import"./chunk-3RK6DDJD.js";import{a as he}from"./chunk-ZW6IATXM.js";import"./chunk-SCGWHTH7.js";import{d as Se}from"./chunk-YZNN2TWC.js";import"./chunk-LIZXMNGH.js";import"./chunk-2SGAADSU.js";import"./chunk-YKM33JR5.js";import"./chunk-3LN2ZQ5M.js";import"./chunk-GF3LE5GG.js";import"./chunk-FQT6I56Q.js";import{d as Pe,e as Oe,f as De,g as ke,h as Ue,i as Ve}from"./chunk-DNIBZXGV.js";import"./chunk-BP7CJNHN.js";import{a as be,b as Ee}from"./chunk-SQVMTAI2.js";import"./chunk-R252C5HM.js";import"./chunk-AFTCPQ2Z.js";import{C as ye,D as Te,E as Me,u as we,v as ve,w as Ie}from"./chunk-BSUUV75R.js";import"./chunk-H34CGBCE.js";import{P as H}from"./chunk-23F7BAD4.js";import"./chunk-LS4HUMWF.js";import"./chunk-LAKOPFJU.js";import"./chunk-SDIK6O2Z.js";import"./chunk-2FWFPV5I.js";import{ja as Ce}from"./chunk-4SXNNKVU.js";import{D as L,E as fe,h as ue,o as _e}from"./chunk-K2RY2UAW.js";import"./chunk-ZJADGYH2.js";import"./chunk-4C2QE4YI.js";import"./chunk-7JSHH4R2.js";import"./chunk-VATYB7D2.js";import{$a as a,$b as A,Ac as S,Bc as ae,Db as b,E as K,Eb as te,Gb as ie,Hb as ne,I as Y,Ia as $,Ib as n,Ja as k,Jb as o,Kb as x,Lb as y,Ma as U,Mb as T,Ob as h,Qb as f,Rb as d,Sb as oe,Tb as Q,Wa as X,Wc as me,Y as j,Yd as ge,Zb as V,Zc as se,_b as F,aa as J,cd as de,db as G,dc as N,ec as l,fa as z,fc as c,gc as w,gd as ce,jc as P,jd as M,k as q,kb as I,kc as O,lc as D,na as E,ob as Z,qb as C,qc as re,rc as le,tc as pe,va as u,vb as s,wa as _,xb as ee,zc as g}from"./chunk-4JRXN7L6.js";import"./chunk-7DCB7DB2.js";var Ye=["stepperRef"],Je=[[["preview"]],[["complete"]]],Xe=["preview","complete"];function Ze(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function et(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function tt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function it(t,r){t&1&&(x(0,"i",8),n(1,"span"),l(2,"Upload"),o())}function nt(t,r){if(t&1){let e=h();n(0,"div",9)(1,"div",10)(2,"POS-uppy",11),f("fileUploaded",function(i){u(e);let m=d(2);return _(m.onDropFile(i))}),o()(),n(3,"div",12)(4,"p",13),l(5," Please refer this "),n(6,"a",14),l(7,"article"),o(),l(8," for more information "),o()()()}if(t&2){let e=d(2);a(2),s("sampleUrl",e.sampleUrl())("subtitle","Accepted file formats: .csv & max file size: 1 MB"),a(4),s("href",e.articleLink(),X)}}function ot(t,r){if(t&1&&C(0,nt,9,3,"div",9),t&2){d();let e=N(1);b(e.selectedIndex===0?0:-1)}}function rt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function lt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function pt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function at(t,r){t&1&&(x(0,"i",15),n(1,"span"),l(2,"Preview"),o())}function mt(t,r){t&1&&Q(0)}function st(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function dt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function ct(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function ut(t,r){t&1&&(x(0,"i",16),n(1,"span"),l(2,"Finish"),o())}function _t(t,r){t&1&&Q(0,1)}var R=class t{sampleUrl=k();articleLink=k();_onDropFile=$({alias:"onDropFile"});disabledEdit=k(!1);_onStateChange=$({alias:"onStateChange"});_stepper;get stepper(){return this._stepper}nextStep(){this._stepper&&(this.stepper.selected.completed=!0,this._stepper.next())}previousStep(){this._stepper&&this._stepper.previous()}resetStep(){this._stepper&&this._stepper.reset()}onStepChange(r){r.selectedIndex===1?this._onStateChange.emit(1):r.selectedIndex===2?this._onStateChange.emit(2):this._onStateChange.emit(0)}onDropFile(r){this._onDropFile.emit(r)}onRemoveFile(){}stateUpload(){}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=I({type:t,selectors:[["pos-import-stepper"]],viewQuery:function(e,p){if(e&1&&V(Ye,5),e&2){let i;F(i=A())&&(p._stepper=i.first)}},inputs:{sampleUrl:[1,"sampleUrl"],articleLink:[1,"articleLink"],disabledEdit:[1,"disabledEdit"]},outputs:{_onDropFile:"onDropFile",_onStateChange:"onStateChange"},ngContentSelectors:Xe,decls:20,vars:7,consts:[["stepperRef",""],[3,"selectionChange","linear"],[3,"completed","editable"],["matStepperIcon","done"],["matStepperIcon","create"],["matStepperIcon","edit"],["matStepLabel",""],["matStepContent",""],[1,"fa-solid","fa-upload","me-3"],[1,"d-flex","flex-column","align-items-center","justify-content-center","gap-2"],[2,"max-width","580px"],["file","",3,"fileUploaded","sampleUrl","subtitle"],[1,"d-flex","w-100",2,"max-width","580px"],[1,"fst-italic"],["target","_blank",3,"href"],[1,"fa-regular","fa-file","me-3"],[1,"fa-solid","fa-check","me-3"]],template:function(e,p){if(e&1){let i=h();oe(Je),n(0,"mat-stepper",1,0),f("selectionChange",function(v){return u(i),_(p.onStepChange(v))}),n(2,"mat-step",2),C(3,Ze,1,1,"ng-template",3)(4,et,1,1,"ng-template",4)(5,tt,1,1,"ng-template",5)(6,it,3,0,"ng-template",6)(7,ot,1,1,"ng-template",7),o(),n(8,"mat-step",2),C(9,rt,1,1,"ng-template",3)(10,lt,1,1,"ng-template",4)(11,pt,1,1,"ng-template",5)(12,at,3,0,"ng-template",6)(13,mt,1,0,"ng-template",7),o(),n(14,"mat-step",2),C(15,st,1,1,"ng-template",3)(16,dt,1,1,"ng-template",4)(17,ct,1,1,"ng-template",5)(18,ut,3,0,"ng-template",6)(19,_t,1,0,"ng-template",7),o()()}e&2&&(s("linear",!0),a(2),s("completed",!1)("editable",!p.disabledEdit()),a(6),s("completed",!1)("editable",!p.disabledEdit()),a(6),s("completed",!1)("editable",!1))},dependencies:[M,Se,L,fe,he,xe,$e,Fe,ze,We,Le,je,Re,Be],styles:[".mat-horizontal-stepper-header-container{width:50%!important;margin:0 auto} .mat-horizontal-stepper-wrapper{gap:1rem} .mat-horizontal-stepper-content{display:flex;justify-content:center} p-table .p-datatable-tbody>tr{border-bottom-width:1px;border-color:#dee2e6} p-table .p-datatable-tbody>tr>th{font-family:Roboto,system-ui!important;font-weight:400;font-style:normal} .p-datatable .p-datatable-wrapper .p-datatable-table .p-datatable-thead>tr>th{font-family:Roboto,Courier,monospace;font-weight:700;font-style:normal;color:#333} .p-datatable .p-datatable-wrapper .p-datatable-table .p-datatable-tbody>tr>td{font-family:Roboto,Courier,monospace;font-weight:400;font-style:normal;color:#333}"]})};var B=class t{configModal=new ye;dialogRef=E(we);data=E(ve);constructor(){this.initDialogConfig()}initDialogConfig(){this.configModal.title="Preview Summary",this.configModal.hideCancel=!0,this.configModal.okText="Import (F2)",this.configModal.customWidth="500px"}onOk(){this.dialogRef.close(!0)}onClose(){this.dialogRef.close(!1)}ngOnInit(){}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=I({type:t,selectors:[["app-dialog-import-preview"]],decls:30,vars:10,consts:[[3,"onOk","onCancel","onClose","config"],[1,"card","mb-0"],[1,"card-header","py-6","bg-gradient-success"],[1,"card-body"],[1,"row"],[1,"col"],[1,"d-flex","flex-column","gap-2"],[2,"font-size","1.9rem"],[2,"font-size","1rem"]],template:function(e,p){e&1&&(n(0,"modal-material",0),f("onOk",function(){return p.onOk()})("onCancel",function(){return p.onClose()})("onClose",function(){return p.onClose()}),x(1,"header"),n(2,"content")(3,"div",1)(4,"div",2)(5,"h3"),l(6,"Import Summary"),o()(),n(7,"div",3)(8,"div",4)(9,"div",5)(10,"div",6)(11,"span",7),l(12),g(13,"number"),o(),n(14,"span",8),l(15,"New Outlet"),o()()(),n(16,"div",5)(17,"div",6)(18,"span",7),l(19),g(20,"number"),o(),n(21,"span",8),l(22,"Update Outlet"),o()()(),n(23,"div",5)(24,"div",6)(25,"span",7),l(26),g(27,"number"),o(),n(28,"span",8),l(29,"New Outlet Group"),o()()()()()()()()),e&2&&(s("config",p.configModal),a(12),c(S(13,4,p.data==null?null:p.data.new)),a(7),c(S(20,6,p.data==null?null:p.data.update)),a(7),c(S(27,8,p.data==null?null:p.data.newOutletGroup)))},dependencies:[M,ce,Me,Te],encapsulation:2})};var gt=["importStepper"],Ct=()=>({"min-width":"50rem"}),St=(t,r,e)=>({"btn-success":t,"btn-outline-secondary":r,"not-allowed":e}),ht=t=>({"mb-1":t});function xt(t,r){if(t&1){let e=h();n(0,"button",14),f("click",function(){u(e);let i=d();return _(i.onPreviousStep())}),l(1," Back "),o()}}function bt(t,r){if(t&1){let e=h();n(0,"button",15),g(1,"async"),g(2,"async"),f("click",function(){u(e);let i=d();return _(i.onNextStep())}),l(3," Next "),o()}if(t&2){let e,p,i=d();s("ngClass",pe(6,St,i.currentState()===1,i.currentState()!==1,!((e=S(1,2,i.importPreview$))!=null&&e.CanProceed)))("disabled",!((p=S(2,4,i.importPreview$))!=null&&p.CanProceed)&&i.currentState()===1)}}function wt(t,r){if(t&1){let e=h();n(0,"button",14),f("click",function(){u(e);let i=d();return _(i.onReset())}),l(1," New "),o()}}function vt(t,r){if(t&1){let e=h();n(0,"tr")(1,"th",16),l(2,"Name"),o(),n(3,"th",17),l(4,"Code"),o(),n(5,"th",18),l(6," Status "),n(7,"i",19),f("click",function(i){u(e);let m=N(9);return _(m.toggle(i))}),o(),n(8,"p-popover",null,1)(10,"div",20)(11,"div",21)(12,"p-checkbox",22),f("ngModelChange",function(i){u(e);let m=d();return _(m.selectAll(i))}),o(),n(13,"label",23),l(14,"All"),o()(),n(15,"div",24)(16,"p-checkbox",25),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(17,"label",26),l(18,"Unchanged"),o()(),n(19,"div",24)(20,"p-checkbox",27),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(21,"label",28),l(22,"New"),o()(),n(23,"div",24)(24,"p-checkbox",29),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(25,"label",30),l(26,"Error"),o()(),n(27,"div",24)(28,"p-checkbox",31),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(29,"label",32),l(30,"Update"),o()()()()(),n(31,"th"),l(32,"Message"),o()()}if(t&2){let e=d();a(12),s("ngModel",e.pickAll),a(4),P("ngModel",e.filterTreeCondition),a(4),P("ngModel",e.filterTreeCondition),a(4),P("ngModel",e.filterTreeCondition),a(4),P("ngModel",e.filterTreeCondition)}}function It(t,r){if(t&1&&(n(0,"div",33)(1,"span",34),l(2),o(),n(3,"span"),l(4),o()()),t&2){let e=r.$implicit,p=r.$index,i=d().$implicit;s("ngClass",le(3,ht,p<i.Issues.length-1)),a(2),w(" ",e.Issue,". "),a(2),w("",e.Solution," ")}}function yt(t,r){if(t&1&&(n(0,"tr")(1,"td"),l(2),o(),n(3,"td"),l(4),o(),n(5,"td"),l(6),o(),n(7,"td"),ie(8,It,5,5,"div",33,te),o()()),t&2){let e=r.$implicit;a(2),c(e.Name),a(2),c(e.Code),a(),ee("bg-gradient-success",e.Action=="New")("bg-gradient-warning",e.Action=="Update")("bg-gradient-danger",e.Action=="Error"),a(),w(" ",e.Action," "),a(2),ne(e.Issues)}}function Tt(t,r){if(t&1&&(y(0),n(1,"div",38)(2,"span"),l(3),o(),l(4,", "),n(5,"span"),l(6),o(),n(7,"span"),l(8),o(),n(9,"span"),l(10,"succesfully imported"),o()(),T()),t&2){let e=r.ngIf;a(3),w("",e==null?null:e.Summary.NewOutlet," New Outlets"),a(3),w("",e==null?null:e.Summary.UpdateOutlet," Updated Outlets"),a(2),w("and ",e==null?null:e.Summary.NewOutletGroup," New Outlet Group")}}function Mt(t,r){if(t&1&&(n(0,"div",13),x(1,"i",35),n(2,"h1",36),l(3,"Upload Complete!"),o(),C(4,Tt,11,3,"ng-container",37),g(5,"async"),o()),t&2){let e=d();a(4),s("ngIf",S(5,1,e.importPreview$))}}var qe=class t extends be{constructor(e,p){super(e);this.httpService=p;this.menuData$.subscribe()}pickAll=["All"];filterTreeCondition=["Unchanged","New","Error","Update"];importStepper;fileToImport=U(null);importPreview$;sampleUrl="https://cdn.dealpos.xyz/web-import-template/Outlet_Import_Template.csv";articleLink="https://support.dealpos.com/en/articles/11069092-import-new-outlet";currentState=U(0);confirmImport$;importPreview=U(null);dialog=E(Ie);onDropFile(e){this.fileToImport.set(e)}onNextStep(){switch(this.currentState()){case 0:this.onPreviewImport();break;case 1:this.onImport();break;default:break}}onPreviousStep(){this.importStepper.previousStep()}onReset(){this.importPreview.set(null),this.importPreview$=null,this.confirmImport$=null,this.fileToImport.set(null),this.currentState.update(()=>0),this.importStepper.resetStep()}onStateChange(e){this.currentState.update(()=>e)}onPreviewImport(){this.pickAll=["All"],this.filterTreeCondition=["Unchanged","New","Error","Update"];let e=new FormData;e.append("file",this.fileToImport()),this.importPreview$=this.httpService.postFormData(H.previewImportOutlet,e).pipe(z(p=>{this.importPreview.set(p),this.importStepper.nextStep()}),j(1))}onImport(){this.confirmImport$=this.dialog.open(B,{data:{new:this.importPreview()?.Summary?.NewOutlet,update:this.importPreview()?.Summary?.UpdateOutlet,newOutletGroup:this.importPreview()?.Summary?.NewOutletGroup}}).afterClosed().pipe(K(e=>e==!0),J(()=>this.httpService.post(H.importOutlet,{CacheKey:this.importPreview()?.CacheKey})),z(e=>{this.importStepper.nextStep()}),Y(e=>(this.pickAll=[],this.filterTreeCondition=["Error"],q)),j(1))}selectAll(e){this.pickAll=e,this.pickAll.length==0?this.filterTreeCondition=[]:this.filterTreeCondition=["Unchanged","New","Error","Update"]}static \u0275fac=function(p){return new(p||t)(G(Ee),G(ge))};static \u0275cmp=I({type:t,selectors:[["app-outlet-import"]],viewQuery:function(p,i){if(p&1&&V(gt,5),p&2){let m;F(m=A())&&(i.importStepper=m.first)}},features:[Z],decls:17,vars:21,consts:[["importStepper",""],["op",""],[3,"pageData","hideSearchBox","hideSearchDropdown"],["ngProjectAs","actions",5,["actions"]],["type","button",1,"btn","btn-outline-secondary"],[1,"btn",3,"ngClass","disabled"],["ngProjectAs","content",5,["content"]],[3,"onDropFile","onStateChange","sampleUrl","disabledEdit","articleLink"],["ngProjectAs","preview",5,["preview"]],[1,"w-100",3,"value","scrollable","tableStyle"],["pTemplate","header"],["pTemplate","body"],["ngProjectAs","complete",5,["complete"]],[1,"d-flex","flex-column","align-items-center"],["type","button",1,"btn","btn-outline-secondary",3,"click"],[1,"btn",3,"click","ngClass","disabled"],[2,"width","300px"],[2,"width","200px"],[2,"width","100px"],[1,"fa","fa-filter","pointer",3,"click"],[2,"width","150px"],[1,"border-bottom","pb-3","d-flex","align-items-center","column-gap-3"],["label","Select All","name","filterTreeCondition","value","All","inputId","all",3,"ngModelChange","ngModel"],["for","all",1,"ms-2"],[1,"mt-4","d-flex","align-items-center","column-gap-3"],["label","Unchanged","name","filterTreeCondition","value","Unchanged","inputId","unchanged",3,"ngModelChange","ngModel"],["for","unchanged",1,"ms-2"],["label","New","name","filterTreeCondition","value","New","inputId","new",3,"ngModelChange","ngModel"],["for","new",1,"ms-2"],["label","Error","name","filterTreeCondition","value","Error","inputId","error",3,"ngModelChange","ngModel"],["for","error",1,"ms-2"],["label","Updated","name","filterTreeCondition","value","Update","inputId","update",3,"ngModelChange","ngModel"],["for","update",1,"ms-2"],[3,"ngClass"],[1,"me-1"],[1,"fa-solid","fa-circle-check","text-success",2,"font-size","110px"],[1,"mt-8"],[4,"ngIf"],[1,"d-flex","gap-2","fw-normal","fs-4","mt-2"]],template:function(p,i){if(p&1){let m=h();n(0,"mainpanel-cmp",2),y(1,3),C(2,xt,2,0,"button",4)(3,bt,4,10,"button",5)(4,wt,2,0,"button",4),T(),y(5,6),n(6,"pos-import-stepper",7,0),f("onDropFile",function(W){return u(m),_(i.onDropFile(W))})("onStateChange",function(W){return u(m),_(i.onStateChange(W))}),y(8,8),n(9,"p-table",9),g(10,"async"),g(11,"filterTree"),C(12,vt,33,5,"ng-template",10)(13,yt,10,9,"ng-template",11),o(),T(),y(14,12),C(15,Mt,6,3,"div",13),g(16,"async"),T(),o(),T(),o()}if(p&2){let m,v;s("pageData",i.menuData)("hideSearchBox",!0)("hideSearchDropdown",!0),a(2),b(i.currentState()==1?2:-1),a(),b(i.fileToImport()&&((m=i.fileToImport())==null?null:m.size)>0&&i.currentState()<2?3:-1),a(),b(i.currentState()===2?4:-1),a(2),s("sampleUrl",i.sampleUrl)("disabledEdit",i.currentState()===2)("articleLink",i.articleLink),a(3),s("value",ae(11,15,(v=S(10,13,i.importPreview$))==null?null:v.DataRow,i.filterTreeCondition))("scrollable",!0)("tableStyle",re(20,Ct)),a(6),b(S(16,18,i.confirmImport$)?15:-1)}},dependencies:[M,me,se,de,R,Ve,Ue,Ne,Ae,Ce,Oe,Pe,L,ue,_e,ke,De,Ge],encapsulation:2})};export{qe as OutletImportComponent};
1
+ import{a as Ge}from"./chunk-CHMP2XLU.js";import{a as Ae,f as Ne}from"./chunk-GQHEZKF4.js";import"./chunk-VLGOLBLH.js";import"./chunk-JN6CQ5QY.js";import"./chunk-X2FYFSD6.js";import"./chunk-2GYZF4SG.js";import"./chunk-UKKFUEUF.js";import{b as Le,c as Re,d as Be,e as We,f as je,g as ze}from"./chunk-ZFSUD7PJ.js";import"./chunk-Q4A7DDAZ.js";import{b as $e}from"./chunk-MPU5CCEX.js";import"./chunk-EHJK2TZP.js";import"./chunk-3KWHPBIS.js";import{d as Fe}from"./chunk-D4XF6ATY.js";import"./chunk-PP6MNON6.js";import{b as xe}from"./chunk-YK5T2UAX.js";import"./chunk-3RK6DDJD.js";import{a as he}from"./chunk-ZW6IATXM.js";import"./chunk-SCGWHTH7.js";import{d as Se}from"./chunk-YZNN2TWC.js";import"./chunk-LIZXMNGH.js";import"./chunk-2SGAADSU.js";import"./chunk-YKM33JR5.js";import"./chunk-3LN2ZQ5M.js";import"./chunk-GF3LE5GG.js";import"./chunk-FQT6I56Q.js";import{d as Pe,e as Oe,f as De,g as ke,h as Ue,i as Ve}from"./chunk-EQ2X33Y7.js";import"./chunk-UA2K3ZOT.js";import{a as be,b as Ee}from"./chunk-L4347XVN.js";import"./chunk-R252C5HM.js";import"./chunk-AFTCPQ2Z.js";import{C as ye,D as Te,E as Me,u as we,v as ve,w as Ie}from"./chunk-BSUUV75R.js";import"./chunk-H34CGBCE.js";import{P as H}from"./chunk-23F7BAD4.js";import"./chunk-LS4HUMWF.js";import"./chunk-LAKOPFJU.js";import"./chunk-SDIK6O2Z.js";import"./chunk-2FWFPV5I.js";import{ja as Ce}from"./chunk-4SXNNKVU.js";import{D as L,E as fe,h as ue,o as _e}from"./chunk-K2RY2UAW.js";import"./chunk-2BDJSELV.js";import"./chunk-5GH4ZXOF.js";import"./chunk-7JSHH4R2.js";import"./chunk-25BC7SZ4.js";import{$a as a,$b as A,Ac as S,Bc as ae,Db as b,E as K,Eb as te,Gb as ie,Hb as ne,I as Y,Ia as $,Ib as n,Ja as k,Jb as o,Kb as x,Lb as y,Ma as U,Mb as T,Ob as h,Qb as f,Rb as d,Sb as oe,Tb as Q,Wa as X,Wc as me,Y as j,Yd as ge,Zb as V,Zc as se,_b as F,aa as J,cd as de,db as G,dc as N,ec as l,fa as z,fc as c,gc as w,gd as ce,jc as P,jd as M,k as q,kb as I,kc as O,lc as D,na as E,ob as Z,qb as C,qc as re,rc as le,tc as pe,va as u,vb as s,wa as _,xb as ee,zc as g}from"./chunk-4JRXN7L6.js";import"./chunk-7DCB7DB2.js";var Ye=["stepperRef"],Je=[[["preview"]],[["complete"]]],Xe=["preview","complete"];function Ze(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function et(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function tt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function it(t,r){t&1&&(x(0,"i",8),n(1,"span"),l(2,"Upload"),o())}function nt(t,r){if(t&1){let e=h();n(0,"div",9)(1,"div",10)(2,"POS-uppy",11),f("fileUploaded",function(i){u(e);let m=d(2);return _(m.onDropFile(i))}),o()(),n(3,"div",12)(4,"p",13),l(5," Please refer this "),n(6,"a",14),l(7,"article"),o(),l(8," for more information "),o()()()}if(t&2){let e=d(2);a(2),s("sampleUrl",e.sampleUrl())("subtitle","Accepted file formats: .csv & max file size: 1 MB"),a(4),s("href",e.articleLink(),X)}}function ot(t,r){if(t&1&&C(0,nt,9,3,"div",9),t&2){d();let e=N(1);b(e.selectedIndex===0?0:-1)}}function rt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function lt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function pt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function at(t,r){t&1&&(x(0,"i",15),n(1,"span"),l(2,"Preview"),o())}function mt(t,r){t&1&&Q(0)}function st(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function dt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function ct(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function ut(t,r){t&1&&(x(0,"i",16),n(1,"span"),l(2,"Finish"),o())}function _t(t,r){t&1&&Q(0,1)}var R=class t{sampleUrl=k();articleLink=k();_onDropFile=$({alias:"onDropFile"});disabledEdit=k(!1);_onStateChange=$({alias:"onStateChange"});_stepper;get stepper(){return this._stepper}nextStep(){this._stepper&&(this.stepper.selected.completed=!0,this._stepper.next())}previousStep(){this._stepper&&this._stepper.previous()}resetStep(){this._stepper&&this._stepper.reset()}onStepChange(r){r.selectedIndex===1?this._onStateChange.emit(1):r.selectedIndex===2?this._onStateChange.emit(2):this._onStateChange.emit(0)}onDropFile(r){this._onDropFile.emit(r)}onRemoveFile(){}stateUpload(){}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=I({type:t,selectors:[["pos-import-stepper"]],viewQuery:function(e,p){if(e&1&&V(Ye,5),e&2){let i;F(i=A())&&(p._stepper=i.first)}},inputs:{sampleUrl:[1,"sampleUrl"],articleLink:[1,"articleLink"],disabledEdit:[1,"disabledEdit"]},outputs:{_onDropFile:"onDropFile",_onStateChange:"onStateChange"},ngContentSelectors:Xe,decls:20,vars:7,consts:[["stepperRef",""],[3,"selectionChange","linear"],[3,"completed","editable"],["matStepperIcon","done"],["matStepperIcon","create"],["matStepperIcon","edit"],["matStepLabel",""],["matStepContent",""],[1,"fa-solid","fa-upload","me-3"],[1,"d-flex","flex-column","align-items-center","justify-content-center","gap-2"],[2,"max-width","580px"],["file","",3,"fileUploaded","sampleUrl","subtitle"],[1,"d-flex","w-100",2,"max-width","580px"],[1,"fst-italic"],["target","_blank",3,"href"],[1,"fa-regular","fa-file","me-3"],[1,"fa-solid","fa-check","me-3"]],template:function(e,p){if(e&1){let i=h();oe(Je),n(0,"mat-stepper",1,0),f("selectionChange",function(v){return u(i),_(p.onStepChange(v))}),n(2,"mat-step",2),C(3,Ze,1,1,"ng-template",3)(4,et,1,1,"ng-template",4)(5,tt,1,1,"ng-template",5)(6,it,3,0,"ng-template",6)(7,ot,1,1,"ng-template",7),o(),n(8,"mat-step",2),C(9,rt,1,1,"ng-template",3)(10,lt,1,1,"ng-template",4)(11,pt,1,1,"ng-template",5)(12,at,3,0,"ng-template",6)(13,mt,1,0,"ng-template",7),o(),n(14,"mat-step",2),C(15,st,1,1,"ng-template",3)(16,dt,1,1,"ng-template",4)(17,ct,1,1,"ng-template",5)(18,ut,3,0,"ng-template",6)(19,_t,1,0,"ng-template",7),o()()}e&2&&(s("linear",!0),a(2),s("completed",!1)("editable",!p.disabledEdit()),a(6),s("completed",!1)("editable",!p.disabledEdit()),a(6),s("completed",!1)("editable",!1))},dependencies:[M,Se,L,fe,he,xe,$e,Fe,ze,We,Le,je,Re,Be],styles:[".mat-horizontal-stepper-header-container{width:50%!important;margin:0 auto} .mat-horizontal-stepper-wrapper{gap:1rem} .mat-horizontal-stepper-content{display:flex;justify-content:center} p-table .p-datatable-tbody>tr{border-bottom-width:1px;border-color:#dee2e6} p-table .p-datatable-tbody>tr>th{font-family:Roboto,system-ui!important;font-weight:400;font-style:normal} .p-datatable .p-datatable-wrapper .p-datatable-table .p-datatable-thead>tr>th{font-family:Roboto,Courier,monospace;font-weight:700;font-style:normal;color:#333} .p-datatable .p-datatable-wrapper .p-datatable-table .p-datatable-tbody>tr>td{font-family:Roboto,Courier,monospace;font-weight:400;font-style:normal;color:#333}"]})};var B=class t{configModal=new ye;dialogRef=E(we);data=E(ve);constructor(){this.initDialogConfig()}initDialogConfig(){this.configModal.title="Preview Summary",this.configModal.hideCancel=!0,this.configModal.okText="Import (F2)",this.configModal.customWidth="500px"}onOk(){this.dialogRef.close(!0)}onClose(){this.dialogRef.close(!1)}ngOnInit(){}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=I({type:t,selectors:[["app-dialog-import-preview"]],decls:30,vars:10,consts:[[3,"onOk","onCancel","onClose","config"],[1,"card","mb-0"],[1,"card-header","py-6","bg-gradient-success"],[1,"card-body"],[1,"row"],[1,"col"],[1,"d-flex","flex-column","gap-2"],[2,"font-size","1.9rem"],[2,"font-size","1rem"]],template:function(e,p){e&1&&(n(0,"modal-material",0),f("onOk",function(){return p.onOk()})("onCancel",function(){return p.onClose()})("onClose",function(){return p.onClose()}),x(1,"header"),n(2,"content")(3,"div",1)(4,"div",2)(5,"h3"),l(6,"Import Summary"),o()(),n(7,"div",3)(8,"div",4)(9,"div",5)(10,"div",6)(11,"span",7),l(12),g(13,"number"),o(),n(14,"span",8),l(15,"New Outlet"),o()()(),n(16,"div",5)(17,"div",6)(18,"span",7),l(19),g(20,"number"),o(),n(21,"span",8),l(22,"Update Outlet"),o()()(),n(23,"div",5)(24,"div",6)(25,"span",7),l(26),g(27,"number"),o(),n(28,"span",8),l(29,"New Outlet Group"),o()()()()()()()()),e&2&&(s("config",p.configModal),a(12),c(S(13,4,p.data==null?null:p.data.new)),a(7),c(S(20,6,p.data==null?null:p.data.update)),a(7),c(S(27,8,p.data==null?null:p.data.newOutletGroup)))},dependencies:[M,ce,Me,Te],encapsulation:2})};var gt=["importStepper"],Ct=()=>({"min-width":"50rem"}),St=(t,r,e)=>({"btn-success":t,"btn-outline-secondary":r,"not-allowed":e}),ht=t=>({"mb-1":t});function xt(t,r){if(t&1){let e=h();n(0,"button",14),f("click",function(){u(e);let i=d();return _(i.onPreviousStep())}),l(1," Back "),o()}}function bt(t,r){if(t&1){let e=h();n(0,"button",15),g(1,"async"),g(2,"async"),f("click",function(){u(e);let i=d();return _(i.onNextStep())}),l(3," Next "),o()}if(t&2){let e,p,i=d();s("ngClass",pe(6,St,i.currentState()===1,i.currentState()!==1,!((e=S(1,2,i.importPreview$))!=null&&e.CanProceed)))("disabled",!((p=S(2,4,i.importPreview$))!=null&&p.CanProceed)&&i.currentState()===1)}}function wt(t,r){if(t&1){let e=h();n(0,"button",14),f("click",function(){u(e);let i=d();return _(i.onReset())}),l(1," New "),o()}}function vt(t,r){if(t&1){let e=h();n(0,"tr")(1,"th",16),l(2,"Name"),o(),n(3,"th",17),l(4,"Code"),o(),n(5,"th",18),l(6," Status "),n(7,"i",19),f("click",function(i){u(e);let m=N(9);return _(m.toggle(i))}),o(),n(8,"p-popover",null,1)(10,"div",20)(11,"div",21)(12,"p-checkbox",22),f("ngModelChange",function(i){u(e);let m=d();return _(m.selectAll(i))}),o(),n(13,"label",23),l(14,"All"),o()(),n(15,"div",24)(16,"p-checkbox",25),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(17,"label",26),l(18,"Unchanged"),o()(),n(19,"div",24)(20,"p-checkbox",27),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(21,"label",28),l(22,"New"),o()(),n(23,"div",24)(24,"p-checkbox",29),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(25,"label",30),l(26,"Error"),o()(),n(27,"div",24)(28,"p-checkbox",31),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(29,"label",32),l(30,"Update"),o()()()()(),n(31,"th"),l(32,"Message"),o()()}if(t&2){let e=d();a(12),s("ngModel",e.pickAll),a(4),P("ngModel",e.filterTreeCondition),a(4),P("ngModel",e.filterTreeCondition),a(4),P("ngModel",e.filterTreeCondition),a(4),P("ngModel",e.filterTreeCondition)}}function It(t,r){if(t&1&&(n(0,"div",33)(1,"span",34),l(2),o(),n(3,"span"),l(4),o()()),t&2){let e=r.$implicit,p=r.$index,i=d().$implicit;s("ngClass",le(3,ht,p<i.Issues.length-1)),a(2),w(" ",e.Issue,". "),a(2),w("",e.Solution," ")}}function yt(t,r){if(t&1&&(n(0,"tr")(1,"td"),l(2),o(),n(3,"td"),l(4),o(),n(5,"td"),l(6),o(),n(7,"td"),ie(8,It,5,5,"div",33,te),o()()),t&2){let e=r.$implicit;a(2),c(e.Name),a(2),c(e.Code),a(),ee("bg-gradient-success",e.Action=="New")("bg-gradient-warning",e.Action=="Update")("bg-gradient-danger",e.Action=="Error"),a(),w(" ",e.Action," "),a(2),ne(e.Issues)}}function Tt(t,r){if(t&1&&(y(0),n(1,"div",38)(2,"span"),l(3),o(),l(4,", "),n(5,"span"),l(6),o(),n(7,"span"),l(8),o(),n(9,"span"),l(10,"succesfully imported"),o()(),T()),t&2){let e=r.ngIf;a(3),w("",e==null?null:e.Summary.NewOutlet," New Outlets"),a(3),w("",e==null?null:e.Summary.UpdateOutlet," Updated Outlets"),a(2),w("and ",e==null?null:e.Summary.NewOutletGroup," New Outlet Group")}}function Mt(t,r){if(t&1&&(n(0,"div",13),x(1,"i",35),n(2,"h1",36),l(3,"Upload Complete!"),o(),C(4,Tt,11,3,"ng-container",37),g(5,"async"),o()),t&2){let e=d();a(4),s("ngIf",S(5,1,e.importPreview$))}}var qe=class t extends be{constructor(e,p){super(e);this.httpService=p;this.menuData$.subscribe()}pickAll=["All"];filterTreeCondition=["Unchanged","New","Error","Update"];importStepper;fileToImport=U(null);importPreview$;sampleUrl="https://cdn.dealpos.xyz/web-import-template/Outlet_Import_Template.csv";articleLink="https://support.dealpos.com/en/articles/11069092-import-new-outlet";currentState=U(0);confirmImport$;importPreview=U(null);dialog=E(Ie);onDropFile(e){this.fileToImport.set(e)}onNextStep(){switch(this.currentState()){case 0:this.onPreviewImport();break;case 1:this.onImport();break;default:break}}onPreviousStep(){this.importStepper.previousStep()}onReset(){this.importPreview.set(null),this.importPreview$=null,this.confirmImport$=null,this.fileToImport.set(null),this.currentState.update(()=>0),this.importStepper.resetStep()}onStateChange(e){this.currentState.update(()=>e)}onPreviewImport(){this.pickAll=["All"],this.filterTreeCondition=["Unchanged","New","Error","Update"];let e=new FormData;e.append("file",this.fileToImport()),this.importPreview$=this.httpService.postFormData(H.previewImportOutlet,e).pipe(z(p=>{this.importPreview.set(p),this.importStepper.nextStep()}),j(1))}onImport(){this.confirmImport$=this.dialog.open(B,{data:{new:this.importPreview()?.Summary?.NewOutlet,update:this.importPreview()?.Summary?.UpdateOutlet,newOutletGroup:this.importPreview()?.Summary?.NewOutletGroup}}).afterClosed().pipe(K(e=>e==!0),J(()=>this.httpService.post(H.importOutlet,{CacheKey:this.importPreview()?.CacheKey})),z(e=>{this.importStepper.nextStep()}),Y(e=>(this.pickAll=[],this.filterTreeCondition=["Error"],q)),j(1))}selectAll(e){this.pickAll=e,this.pickAll.length==0?this.filterTreeCondition=[]:this.filterTreeCondition=["Unchanged","New","Error","Update"]}static \u0275fac=function(p){return new(p||t)(G(Ee),G(ge))};static \u0275cmp=I({type:t,selectors:[["app-outlet-import"]],viewQuery:function(p,i){if(p&1&&V(gt,5),p&2){let m;F(m=A())&&(i.importStepper=m.first)}},features:[Z],decls:17,vars:21,consts:[["importStepper",""],["op",""],[3,"pageData","hideSearchBox","hideSearchDropdown"],["ngProjectAs","actions",5,["actions"]],["type","button",1,"btn","btn-outline-secondary"],[1,"btn",3,"ngClass","disabled"],["ngProjectAs","content",5,["content"]],[3,"onDropFile","onStateChange","sampleUrl","disabledEdit","articleLink"],["ngProjectAs","preview",5,["preview"]],[1,"w-100",3,"value","scrollable","tableStyle"],["pTemplate","header"],["pTemplate","body"],["ngProjectAs","complete",5,["complete"]],[1,"d-flex","flex-column","align-items-center"],["type","button",1,"btn","btn-outline-secondary",3,"click"],[1,"btn",3,"click","ngClass","disabled"],[2,"width","300px"],[2,"width","200px"],[2,"width","100px"],[1,"fa","fa-filter","pointer",3,"click"],[2,"width","150px"],[1,"border-bottom","pb-3","d-flex","align-items-center","column-gap-3"],["label","Select All","name","filterTreeCondition","value","All","inputId","all",3,"ngModelChange","ngModel"],["for","all",1,"ms-2"],[1,"mt-4","d-flex","align-items-center","column-gap-3"],["label","Unchanged","name","filterTreeCondition","value","Unchanged","inputId","unchanged",3,"ngModelChange","ngModel"],["for","unchanged",1,"ms-2"],["label","New","name","filterTreeCondition","value","New","inputId","new",3,"ngModelChange","ngModel"],["for","new",1,"ms-2"],["label","Error","name","filterTreeCondition","value","Error","inputId","error",3,"ngModelChange","ngModel"],["for","error",1,"ms-2"],["label","Updated","name","filterTreeCondition","value","Update","inputId","update",3,"ngModelChange","ngModel"],["for","update",1,"ms-2"],[3,"ngClass"],[1,"me-1"],[1,"fa-solid","fa-circle-check","text-success",2,"font-size","110px"],[1,"mt-8"],[4,"ngIf"],[1,"d-flex","gap-2","fw-normal","fs-4","mt-2"]],template:function(p,i){if(p&1){let m=h();n(0,"mainpanel-cmp",2),y(1,3),C(2,xt,2,0,"button",4)(3,bt,4,10,"button",5)(4,wt,2,0,"button",4),T(),y(5,6),n(6,"pos-import-stepper",7,0),f("onDropFile",function(W){return u(m),_(i.onDropFile(W))})("onStateChange",function(W){return u(m),_(i.onStateChange(W))}),y(8,8),n(9,"p-table",9),g(10,"async"),g(11,"filterTree"),C(12,vt,33,5,"ng-template",10)(13,yt,10,9,"ng-template",11),o(),T(),y(14,12),C(15,Mt,6,3,"div",13),g(16,"async"),T(),o(),T(),o()}if(p&2){let m,v;s("pageData",i.menuData)("hideSearchBox",!0)("hideSearchDropdown",!0),a(2),b(i.currentState()==1?2:-1),a(),b(i.fileToImport()&&((m=i.fileToImport())==null?null:m.size)>0&&i.currentState()<2?3:-1),a(),b(i.currentState()===2?4:-1),a(2),s("sampleUrl",i.sampleUrl)("disabledEdit",i.currentState()===2)("articleLink",i.articleLink),a(3),s("value",ae(11,15,(v=S(10,13,i.importPreview$))==null?null:v.DataRow,i.filterTreeCondition))("scrollable",!0)("tableStyle",re(20,Ct)),a(6),b(S(16,18,i.confirmImport$)?15:-1)}},dependencies:[M,me,se,de,R,Ve,Ue,Ne,Ae,Ce,Oe,Pe,L,ue,_e,ke,De,Ge],encapsulation:2})};export{qe as OutletImportComponent};
@@ -1 +1 @@
1
- import{c as U,d as W}from"./chunk-RJUFWPXG.js";import{a as X,b as Y}from"./chunk-Y4GWMIHA.js";import{ga as K,ha as Q}from"./chunk-H34CGBCE.js";import{a as A}from"./chunk-IXGNTK76.js";import{ja as J}from"./chunk-4SXNNKVU.js";import{D as G,h as B,o as q}from"./chunk-K2RY2UAW.js";import{a as C}from"./chunk-7JSHH4R2.js";import{$a as _,Ac as k,Db as H,Fa as M,Fc as F,Ib as c,Jb as m,Nb as L,Ob as V,Qb as j,Rb as n,Y as S,Yd as d,bd as N,ca as h,cd as P,d as x,db as b,dc as I,ec as v,fa as T,ga as u,gc as E,ja as w,jd as z,kb as $,ma as O,na as D,o as f,qb as a,va as p,vb as l,wa as g,zc as R}from"./chunk-4JRXN7L6.js";var y=class o{signalRClient=D(A);continuedCategories$;allCategories$;_onOpenTreeSelector=new x;onOpenTreeSelector$=this._onOpenTreeSelector.asObservable();constructor(t){this.continuedCategories$=this.onOpenTreeSelector$.pipe(u(this.signalRClient.recacheCategory$),h((e,[i,r])=>r||!e.length?(this.signalRClient.resetCategoryCache(),t.post("/api/catalog/product/GetProductStorageOptions")):f(e),[]),S(1)),this.allCategories$=this.onOpenTreeSelector$.pipe(u(this.signalRClient.recacheCategory$),h((e,[i,r])=>r||!e.length?t.get("/API/catalog/category/SelectOptions"):f(e),[]),S(1))}onOpenTreeSelector(){this._onOpenTreeSelector.next(!0)}forceLoadCategories(){this._onOpenTreeSelector.next(!0)}static \u0275fac=function(e){return new(e||o)(O(d))};static \u0275prov=w({token:o,factory:o.\u0275fac,providedIn:"root"})};function ie(o,t){o&1&&L(0)}function re(o,t){if(o&1&&(c(0,"p-floatLabel",1),a(1,ie,1,0,"ng-container",2),c(2,"label",3),v(3,"Category"),m()()),o&2){n();let e=I(3);_(),l("ngTemplateOutlet",e)}}function ne(o,t){o&1&&L(0)}function ae(o,t){if(o&1&&a(0,ne,1,0,"ng-container",2),o&2){n();let e=I(3);l("ngTemplateOutlet",e)}}function le(o,t){if(o&1&&(c(0,"div",6),v(1),m()),o&2){let e=n(2);l("matTooltip",e.selectedCategoryLabel),_(),E(" ",e.selectedCategoryLabel," ")}}function ce(o,t){if(o&1){let e=V();c(0,"p-treeSelect",4),R(1,"async"),j("click",function(){p(e);let r=n();return g(r.loadCategories())})("ngModelChange",function(r){p(e);let s=n();return g(s.onSelectCategory(r))})("onClear",function(){p(e);let r=n();return g(r.onClear())}),a(2,le,2,2,"ng-template",5),m()}if(o&2){let e=n();l("options",k(1,3,e.categories$))("ngModel",e.selectedCategory)("showClear",e.showClear)}}var Z=class o{constructor(t,e){this.http=t;this.treeSelector=e}continuedCategoriesOnly=!0;categories=[];showClear=!1;showLabel=!1;isInitializedCategoryLabel=!1;selectedCategory;selectedCategoryID;selectedCategoryIDChange=new M;selectedCategoryLabel;top=0;isLoadCategories=!1;categories$;ngAfterViewInit(){let t=document.querySelector("body");this.top=t.getBoundingClientRect().top*-1}ngOnInit(){this.isInitializedCategoryLabel&&(C.IsEmpty(this.selectedCategoryID)&&C.IsNotEmpty(this.categories)&&(this.selectedCategoryID=this.categories[0]?.key),this.selectedCategory=this.findSelectedCategory(this.categories,this.selectedCategoryID),this.generateLabelSelectedCategory(this.selectedCategory)),this.categories$=this.continuedCategoriesOnly?this.treeSelector.continuedCategories$:this.treeSelector.allCategories$,this.categories$=this.categories$.pipe(T(t=>{this.selectedCategory=this.findSelectedCategory(t,this.selectedCategoryID),this.generateLabelSelectedCategory(this.selectedCategory)}))}onSelectCategory(t){this.selectedCategory=t,this.generateLabelSelectedCategory(this.selectedCategory),this.selectedCategoryID=t?.key,this.selectedCategoryIDChange.emit(this.selectedCategoryID)}generateLabelSelectedCategory(t){if(t){let e=[];this.selectedCategoryLabel="";do e=[...e,t.label],t=t.parent;while(t!==void 0);this.selectedCategoryLabel=e.reverse().join("/")}else this.selectedCategoryLabel="Select Storage Location"}findSelectedCategory(t,e){if(C.IsNotEmpty(e))for(let i of t){if(i.key===e)return i;{i.children=i.children?i.children:[],i.children=i.children.map(s=>(s.parent=i,s));let r=this.findSelectedCategory(i.children,e);if(r)return r}}else return null}loadCategories(){this.treeSelector.onOpenTreeSelector()}onClear(){this.selectedCategoryID=null,this.selectedCategoryIDChange.emit(this.selectedCategoryID)}static \u0275fac=function(e){return new(e||o)(b(d),b(y))};static \u0275cmp=$({type:o,selectors:[["POS-storage-location-select"]],inputs:{continuedCategoriesOnly:"continuedCategoriesOnly",categories:"categories",showClear:"showClear",showLabel:"showLabel",isInitializedCategoryLabel:"isInitializedCategoryLabel",selectedCategoryID:"selectedCategoryID"},outputs:{selectedCategoryIDChange:"selectedCategoryIDChange"},decls:4,vars:1,consts:[["categorySelectTemplate",""],["variant","on",1,"w-100"],[4,"ngTemplateOutlet"],["for","selectCategory",1,"tree-category-label"],["appendTo","body","selectionMode","single","filter","true","filterInputAutoFocus","true","scrollHeight","250px","inputId","selectCategory","placeholder","Select Storage Location",3,"click","ngModelChange","onClear","options","ngModel","showClear"],["pTemplate","value"],["matTooltipPosition","above",3,"matTooltip"]],template:function(e,i){e&1&&a(0,re,4,1,"p-floatLabel",1)(1,ae,1,1,"ng-container")(2,ce,3,5,"ng-template",null,0,F),e&2&&H(i.showLabel?0:1)},dependencies:[z,N,P,Q,K,W,U,J,G,B,q,Y,X],styles:[".p-popover.p-component{z-index:10000000000000000000000!important} .p-treeselect-panel .p-treeselect-items-wrapper .p-tree{padding-left:4px!important} .p-float-label .p-inputwrapper-filled~label.tree-category-label{left:.5rem!important}"]})};export{Z as a};
1
+ import{c as U,d as W}from"./chunk-UYK6ATMD.js";import{a as X,b as Y}from"./chunk-Y4GWMIHA.js";import{ga as K,ha as Q}from"./chunk-H34CGBCE.js";import{a as A}from"./chunk-IXGNTK76.js";import{ja as J}from"./chunk-4SXNNKVU.js";import{D as G,h as B,o as q}from"./chunk-K2RY2UAW.js";import{a as C}from"./chunk-7JSHH4R2.js";import{$a as _,Ac as k,Db as H,Fa as M,Fc as F,Ib as c,Jb as m,Nb as L,Ob as V,Qb as j,Rb as n,Y as S,Yd as d,bd as N,ca as h,cd as P,d as x,db as b,dc as I,ec as v,fa as T,ga as u,gc as E,ja as w,jd as z,kb as $,ma as O,na as D,o as f,qb as a,va as p,vb as l,wa as g,zc as R}from"./chunk-4JRXN7L6.js";var y=class o{signalRClient=D(A);continuedCategories$;allCategories$;_onOpenTreeSelector=new x;onOpenTreeSelector$=this._onOpenTreeSelector.asObservable();constructor(t){this.continuedCategories$=this.onOpenTreeSelector$.pipe(u(this.signalRClient.recacheCategory$),h((e,[i,r])=>r||!e.length?(this.signalRClient.resetCategoryCache(),t.post("/api/catalog/product/GetProductStorageOptions")):f(e),[]),S(1)),this.allCategories$=this.onOpenTreeSelector$.pipe(u(this.signalRClient.recacheCategory$),h((e,[i,r])=>r||!e.length?t.get("/API/catalog/category/SelectOptions"):f(e),[]),S(1))}onOpenTreeSelector(){this._onOpenTreeSelector.next(!0)}forceLoadCategories(){this._onOpenTreeSelector.next(!0)}static \u0275fac=function(e){return new(e||o)(O(d))};static \u0275prov=w({token:o,factory:o.\u0275fac,providedIn:"root"})};function ie(o,t){o&1&&L(0)}function re(o,t){if(o&1&&(c(0,"p-floatLabel",1),a(1,ie,1,0,"ng-container",2),c(2,"label",3),v(3,"Category"),m()()),o&2){n();let e=I(3);_(),l("ngTemplateOutlet",e)}}function ne(o,t){o&1&&L(0)}function ae(o,t){if(o&1&&a(0,ne,1,0,"ng-container",2),o&2){n();let e=I(3);l("ngTemplateOutlet",e)}}function le(o,t){if(o&1&&(c(0,"div",6),v(1),m()),o&2){let e=n(2);l("matTooltip",e.selectedCategoryLabel),_(),E(" ",e.selectedCategoryLabel," ")}}function ce(o,t){if(o&1){let e=V();c(0,"p-treeSelect",4),R(1,"async"),j("click",function(){p(e);let r=n();return g(r.loadCategories())})("ngModelChange",function(r){p(e);let s=n();return g(s.onSelectCategory(r))})("onClear",function(){p(e);let r=n();return g(r.onClear())}),a(2,le,2,2,"ng-template",5),m()}if(o&2){let e=n();l("options",k(1,3,e.categories$))("ngModel",e.selectedCategory)("showClear",e.showClear)}}var Z=class o{constructor(t,e){this.http=t;this.treeSelector=e}continuedCategoriesOnly=!0;categories=[];showClear=!1;showLabel=!1;isInitializedCategoryLabel=!1;selectedCategory;selectedCategoryID;selectedCategoryIDChange=new M;selectedCategoryLabel;top=0;isLoadCategories=!1;categories$;ngAfterViewInit(){let t=document.querySelector("body");this.top=t.getBoundingClientRect().top*-1}ngOnInit(){this.isInitializedCategoryLabel&&(C.IsEmpty(this.selectedCategoryID)&&C.IsNotEmpty(this.categories)&&(this.selectedCategoryID=this.categories[0]?.key),this.selectedCategory=this.findSelectedCategory(this.categories,this.selectedCategoryID),this.generateLabelSelectedCategory(this.selectedCategory)),this.categories$=this.continuedCategoriesOnly?this.treeSelector.continuedCategories$:this.treeSelector.allCategories$,this.categories$=this.categories$.pipe(T(t=>{this.selectedCategory=this.findSelectedCategory(t,this.selectedCategoryID),this.generateLabelSelectedCategory(this.selectedCategory)}))}onSelectCategory(t){this.selectedCategory=t,this.generateLabelSelectedCategory(this.selectedCategory),this.selectedCategoryID=t?.key,this.selectedCategoryIDChange.emit(this.selectedCategoryID)}generateLabelSelectedCategory(t){if(t){let e=[];this.selectedCategoryLabel="";do e=[...e,t.label],t=t.parent;while(t!==void 0);this.selectedCategoryLabel=e.reverse().join("/")}else this.selectedCategoryLabel="Select Storage Location"}findSelectedCategory(t,e){if(C.IsNotEmpty(e))for(let i of t){if(i.key===e)return i;{i.children=i.children?i.children:[],i.children=i.children.map(s=>(s.parent=i,s));let r=this.findSelectedCategory(i.children,e);if(r)return r}}else return null}loadCategories(){this.treeSelector.onOpenTreeSelector()}onClear(){this.selectedCategoryID=null,this.selectedCategoryIDChange.emit(this.selectedCategoryID)}static \u0275fac=function(e){return new(e||o)(b(d),b(y))};static \u0275cmp=$({type:o,selectors:[["POS-storage-location-select"]],inputs:{continuedCategoriesOnly:"continuedCategoriesOnly",categories:"categories",showClear:"showClear",showLabel:"showLabel",isInitializedCategoryLabel:"isInitializedCategoryLabel",selectedCategoryID:"selectedCategoryID"},outputs:{selectedCategoryIDChange:"selectedCategoryIDChange"},decls:4,vars:1,consts:[["categorySelectTemplate",""],["variant","on",1,"w-100"],[4,"ngTemplateOutlet"],["for","selectCategory",1,"tree-category-label"],["appendTo","body","selectionMode","single","filter","true","filterInputAutoFocus","true","scrollHeight","250px","inputId","selectCategory","placeholder","Select Storage Location",3,"click","ngModelChange","onClear","options","ngModel","showClear"],["pTemplate","value"],["matTooltipPosition","above",3,"matTooltip"]],template:function(e,i){e&1&&a(0,re,4,1,"p-floatLabel",1)(1,ae,1,1,"ng-container")(2,ce,3,5,"ng-template",null,0,F),e&2&&H(i.showLabel?0:1)},dependencies:[z,N,P,Q,K,W,U,J,G,B,q,Y,X],styles:[".p-popover.p-component{z-index:10000000000000000000000!important} .p-treeselect-panel .p-treeselect-items-wrapper .p-tree{padding-left:4px!important} .p-float-label .p-inputwrapper-filled~label.tree-category-label{left:.5rem!important}"]})};export{Z as a};