dealpos 12.74.4 → 12.74.6

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 (104) hide show
  1. package/POS/{chunk-6IEQXRWB.js → chunk-2XIMYHXI.js} +1 -1
  2. package/POS/{chunk-CBEL7BDT.js → chunk-3M3PXHAP.js} +1 -1
  3. package/POS/{chunk-ESLQ67LS.js → chunk-3X2BQKCJ.js} +1 -1
  4. package/POS/{chunk-TNUX3LA6.js → chunk-44NGZJ36.js} +1 -1
  5. package/POS/{chunk-IHOJZK7V.js → chunk-4KPD74OL.js} +1 -1
  6. package/POS/{chunk-5QSE7GCA.js → chunk-4LXDT5MX.js} +1 -1
  7. package/POS/{chunk-EEVW3UND.js → chunk-4QLNFVUC.js} +1 -1
  8. package/POS/{chunk-ALN3JKAR.js → chunk-4UGKL2VZ.js} +1 -1
  9. package/POS/{chunk-UJKZLAB4.js → chunk-56B25S53.js} +2 -2
  10. package/POS/{chunk-HIV2H34O.js → chunk-5LWAX44Z.js} +1 -1
  11. package/POS/{chunk-52G66D2R.js → chunk-5XU3FRSH.js} +1 -1
  12. package/POS/{chunk-JSTI6WZO.js → chunk-5Y4G33DQ.js} +1 -1
  13. package/POS/{chunk-TNPR2ZN6.js → chunk-62A2XAJV.js} +1 -1
  14. package/POS/{chunk-Q6LBQWGT.js → chunk-6SG6O2FT.js} +1 -1
  15. package/POS/{chunk-Y4FHTKX6.js → chunk-74ACQAXG.js} +1 -1
  16. package/POS/{chunk-ILH6XXY4.js → chunk-7ZZDWAEL.js} +1 -1
  17. package/POS/{chunk-MQLB3G54.js → chunk-ARMRYWG5.js} +1 -1
  18. package/POS/{chunk-3BSGR7EC.js → chunk-BJZNHUDB.js} +1 -1
  19. package/POS/{chunk-OAD5FN6M.js → chunk-CBWBJAL5.js} +1 -1
  20. package/POS/{chunk-BIQ6HDZK.js → chunk-CDNJHHWL.js} +1 -1
  21. package/POS/{chunk-IVAC2LF6.js → chunk-CN3EREQ7.js} +1 -1
  22. package/POS/{chunk-GFV4JKVC.js → chunk-CQ736HRR.js} +1 -1
  23. package/POS/{chunk-SATTK77Z.js → chunk-CVJKY4EF.js} +1 -1
  24. package/POS/{chunk-GVOO33HP.js → chunk-CWTTAMCA.js} +1 -1
  25. package/POS/{chunk-ZI3SZSCQ.js → chunk-CXV7B7EM.js} +1 -1
  26. package/POS/{chunk-5LTB2AZ4.js → chunk-D3KP5OWI.js} +1 -1
  27. package/POS/{chunk-44DAZ7C7.js → chunk-D5RA7CKJ.js} +1 -1
  28. package/POS/{chunk-Z6PAM3SO.js → chunk-DBATH5JX.js} +1 -1
  29. package/POS/{chunk-6DVDYYJA.js → chunk-DK4UUYLW.js} +1 -1
  30. package/POS/{chunk-BGLNLYAP.js → chunk-DXDPU2YU.js} +2 -2
  31. package/POS/{chunk-STAJBXLE.js → chunk-DXQT4UVS.js} +1 -1
  32. package/POS/{chunk-47CLNH4C.js → chunk-ENKWDAP3.js} +1 -1
  33. package/POS/{chunk-7YHV5QX7.js → chunk-EXRW4OQ6.js} +1 -1
  34. package/POS/{chunk-7F3ZLA2R.js → chunk-EYADCCOW.js} +1 -1
  35. package/POS/{chunk-VG2IEWGL.js → chunk-F46GHYIY.js} +1 -1
  36. package/POS/chunk-FDZLCN6C.js +1 -0
  37. package/POS/{chunk-B35SFODE.js → chunk-FHJEVQD6.js} +1 -1
  38. package/POS/{chunk-NRFWKAJD.js → chunk-FPFJVY5A.js} +1 -1
  39. package/POS/chunk-FTKR56EO.js +1 -0
  40. package/POS/{chunk-AVKYKG2L.js → chunk-FZVAU3NK.js} +1 -1
  41. package/POS/{chunk-LJ32XCVG.js → chunk-G3M3WJFF.js} +1 -1
  42. package/POS/{chunk-BKFBL2AC.js → chunk-H2XUK3CP.js} +1 -1
  43. package/POS/{chunk-SLPIFBK4.js → chunk-H4PLJEVH.js} +1 -1
  44. package/POS/{chunk-RP2QAFIQ.js → chunk-HF46NHWQ.js} +1 -1
  45. package/POS/{chunk-XVNMQFCH.js → chunk-HGF7S5AV.js} +1 -1
  46. package/POS/{chunk-BEMNOWE4.js → chunk-HQXAT3RW.js} +1 -1
  47. package/POS/{chunk-SVINLOLR.js → chunk-I2KDN2R2.js} +1 -1
  48. package/POS/{chunk-ZJ3Z6KH6.js → chunk-IGBYI6BQ.js} +1 -1
  49. package/POS/{chunk-ZYTHYLK7.js → chunk-JCC4M3XA.js} +1 -1
  50. package/POS/{chunk-Y4UDJMHY.js → chunk-JNVJNM3X.js} +1 -1
  51. package/POS/{chunk-7RJP4FNM.js → chunk-L6CDFNH4.js} +2 -2
  52. package/POS/{chunk-J44YMP6F.js → chunk-LBPB4Z7N.js} +1 -1
  53. package/POS/{chunk-BLM4AOMZ.js → chunk-LMXTERRX.js} +1 -1
  54. package/POS/{chunk-Z76DR22M.js → chunk-LYVPP52Y.js} +1 -1
  55. package/POS/{chunk-XXJZL56G.js → chunk-M3ZX3VMT.js} +1 -1
  56. package/POS/{chunk-3QDPAEIH.js → chunk-MWQMYDBG.js} +1 -1
  57. package/POS/{chunk-WTUMKJSP.js → chunk-MXSLH4R5.js} +1 -1
  58. package/POS/{chunk-ZWA2EKWJ.js → chunk-MY4TO2SD.js} +1 -1
  59. package/POS/{chunk-ITUFWOIX.js → chunk-N45KQKYW.js} +1 -1
  60. package/POS/{chunk-624T7ZHB.js → chunk-NDNYTEBQ.js} +1 -1
  61. package/POS/{chunk-LVCIELMM.js → chunk-NFEYCCJ3.js} +1 -1
  62. package/POS/{chunk-ELNVKNTW.js → chunk-P4RRA4NC.js} +1 -1
  63. package/POS/{chunk-7DXDN3TE.js → chunk-PCBIJHIM.js} +1 -1
  64. package/POS/{chunk-QJCBBOTZ.js → chunk-PJEQSD5C.js} +1 -1
  65. package/POS/{chunk-Z4DPTPVV.js → chunk-PLINQ2AL.js} +1 -1
  66. package/POS/{chunk-AHPMBCOW.js → chunk-PXIBZ3QC.js} +1 -1
  67. package/POS/{chunk-MDWSX5VH.js → chunk-QGSOHCZX.js} +1 -1
  68. package/POS/{chunk-SD7PDZEM.js → chunk-QHGROBNY.js} +1 -1
  69. package/POS/chunk-QWHGTFAH.js +18 -0
  70. package/POS/{chunk-CFCD6VQY.js → chunk-S2SFW2GR.js} +2 -2
  71. package/POS/{chunk-A23K46LE.js → chunk-SQZ3NTEO.js} +1 -1
  72. package/POS/{chunk-RZDN3Y4U.js → chunk-TW4KPVOP.js} +1 -1
  73. package/POS/{chunk-BI3XXTPA.js → chunk-U2D4TXT6.js} +1 -1
  74. package/POS/{chunk-DIJWYYN7.js → chunk-U2MLPX4F.js} +1 -1
  75. package/POS/{chunk-GBJXEBBX.js → chunk-U7MSGYLG.js} +1 -1
  76. package/POS/{chunk-XF65KEEC.js → chunk-UEAB4TZ2.js} +1 -1
  77. package/POS/{chunk-SZBJF5PL.js → chunk-UMRFPIIO.js} +1 -1
  78. package/POS/{chunk-KHC3TMFQ.js → chunk-URZAHHBT.js} +1 -1
  79. package/POS/{chunk-65P53562.js → chunk-USLMI273.js} +1 -1
  80. package/POS/{chunk-Y6X24YGJ.js → chunk-UUW7PTL3.js} +1 -1
  81. package/POS/{chunk-ZTGPRYKF.js → chunk-UXRK33ZU.js} +1 -1
  82. package/POS/{chunk-QVF3XGQD.js → chunk-V7FEB5RU.js} +1 -1
  83. package/POS/{chunk-GRH4VW2G.js → chunk-VA365TFG.js} +1 -1
  84. package/POS/{chunk-E5DL6ZSF.js → chunk-VGKQDJSZ.js} +1 -1
  85. package/POS/{chunk-O6JLTNXI.js → chunk-VICSPN46.js} +1 -1
  86. package/POS/{chunk-UO4WQ2S3.js → chunk-W4VLSFSF.js} +1 -1
  87. package/POS/{chunk-KFCN56ZR.js → chunk-WVN2JCZP.js} +1 -1
  88. package/POS/{chunk-CYK37Z2V.js → chunk-WYYKDNAM.js} +1 -1
  89. package/POS/{chunk-GBCORKZO.js → chunk-X4R3TD42.js} +1 -1
  90. package/POS/{chunk-XC2ITAZP.js → chunk-XNG3ZXC3.js} +1 -1
  91. package/POS/{chunk-SC6V25BY.js → chunk-XTPCAOGH.js} +1 -1
  92. package/POS/{chunk-C2AC2PYD.js → chunk-XZ3GZHMU.js} +1 -1
  93. package/POS/{chunk-23QREBOQ.js → chunk-YNV7BDA6.js} +1 -1
  94. package/POS/{chunk-TJXB33NN.js → chunk-YVIUJBDM.js} +1 -1
  95. package/POS/{chunk-R6DSFYXQ.js → chunk-YXSTC2WD.js} +1 -1
  96. package/POS/{chunk-PZBPTM23.js → chunk-ZBBFUYSS.js} +1 -1
  97. package/POS/{chunk-QGJ3ZFW5.js → chunk-ZL7MR22Y.js} +1 -1
  98. package/POS/{chunk-SAV23JGM.js → chunk-ZPF67H57.js} +1 -1
  99. package/POS/index.html +2 -2
  100. package/POS/{main-2DXB55NG.js → main-H75QVV5R.js} +2 -2
  101. package/package.json +1 -1
  102. package/POS/chunk-5424OTDU.js +0 -1
  103. package/POS/chunk-CTQOJXZS.js +0 -18
  104. package/POS/chunk-XFQHUC4L.js +0 -1
@@ -1 +1 @@
1
- import{a as dt}from"./chunk-O6S4UZUR.js";import{v as mt,x as st,y as ct}from"./chunk-HIV2H34O.js";import{ua as lt}from"./chunk-MT5HSDQB.js";import{P as ut}from"./chunk-GDVVDQ62.js";import{a as pt}from"./chunk-2FWFPV5I.js";import{E as ot,a as Z,c as tt,h as et,l as it,s as nt}from"./chunk-BAI43IKV.js";import{a as J,d as rt}from"./chunk-ZSPCD25F.js";import{a as at}from"./chunk-G5LPH6YH.js";import{$b as v,Ab as p,Bb as l,Cb as f,D as x,E as s,Gb as R,Jb as $,Kc as z,L as A,Lb as u,Ra as D,Sc as W,Tb as N,Tc as B,Td as X,Ub as j,Vb as k,Wa as a,Xa as _,Xb as U,Yb as H,Yc as K,Zb as C,_ as w,_b as g,ad as Y,d as E,da as m,dd as q,ea as M,eb as T,gc as Q,hc as G,jb as c,la as h,nb as r,o as V,pa as S,pb as y,rc as I,sc as O,t as b,wa as P,xa as F,xc as L}from"./chunk-Z67YUEMZ.js";var ft=["searchFilter"];function vt(o,t){o&1&&f(0,"i",8)}function ht(o,t){if(o&1&&f(0,"img",16),o&2){let i=u().$implicit;r("src",i.ImgUrl,D)}}function _t(o,t){o&1&&(p(0,"div",17),f(1,"i",18),l())}function yt(o,t){if(o&1&&(p(0,"span"),g(1),I(2,"number"),l()),o&2){let i=u().$implicit,n=u();a(),v(O(2,1,i[n.amountProperty]))}}function Ct(o,t){if(o&1&&(p(0,"mat-option",9)(1,"div",10)(2,"div",11)(3,"div"),c(4,ht,1,1,"img",12)(5,_t,2,0,"ng-template",null,2,L),l(),p(7,"div",13)(8,"div"),g(9),l(),p(10,"small",14),g(11),l()()(),c(12,yt,3,3,"span",15),l()()),o&2){let i=t.$implicit,n=C(6),e=u();r("value",i),a(4),r("ngIf",i.ImgUrl)("ngIfElse",n),a(5),v(i.Value),a(2),v(i.Code),a(),r("ngIf",i[e.amountProperty])}}var gt=class o{constructor(t,i){this.http=t;z(()=>{let n=this.searchFilter().nativeElement;i.searchFilterNativeEl=n})}searchFilter=T("searchFilter");toastr=h(X);role=h(rt);isOnModalVariant=!1;autocompleteEndpoint=ut.GetVariantSuggestions;outletID;inputID;amountProperty="UnitPrice";filteredVariants$;variant=new it("");barcodeInput;_onEnter=new E;onEnter$=this._onEnter.asObservable();focusInterval;disabled=!1;onChange=t=>{};onTouched=()=>{};ngOnDestroy(){clearInterval(this.focusInterval)}ngAfterViewInit(){}keepInputFocus(){this.barcodeInput.nativeElement.focus(),this.focusInterval=setInterval(()=>{document.activeElement!==this.barcodeInput.nativeElement&&this.barcodeInput.nativeElement.focus()},200)}ngOnInit(){this.filteredVariants$=this.variant.valueChanges.pipe(s(e=>typeof e=="string"&&e.length>=3||e===""),A(300),w(e=>e===""?V([]):this.http.get(this.autocompleteEndpoint,[{key:"Prefix",value:e},{key:"Count",value:100},{key:"EntityID",value:this.outletID}]).pipe(m(d=>{d?.length==0&&this.toastr.warning(`Product with name ${e} is not found`,pt.Warning)}))));let t=this.variant.valueChanges.pipe(s(e=>typeof e!="string"&&!e.OnSet),m(e=>this.onChange({type:"ID",str:e.Key,value:e.Value}))),i=this.onEnter$.pipe(M(this.variant.valueChanges),b(([e,d])=>d),s(e=>typeof e=="string"),m(e=>this.onChange({type:"Code",str:e})));x(t,i).pipe(s(()=>!this.isOnModalVariant),m(()=>this.variant.setValue("")),m(()=>this.onChange(null))).subscribe()}writeValue(t){if(typeof t!="string"&&J.IsNotEmpty(t)){let i={Key:t.str,Value:t.value,OnSet:!0};this.variant.setValue(i)}}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}onEnter(){this._onEnter.next()}displayFn(t){return t&&t.Value?t.Value:""}static \u0275fac=function(i){return new(i||o)(_(at),_(dt))};static \u0275cmp=S({type:o,selectors:[["POS-variant-autocomplete"]],viewQuery:function(i,n){if(i&1&&(U(n.searchFilter,ft,5),N(ft,7)),i&2){H();let e;j(e=k())&&(n.barcodeInput=e.first)}},inputs:{isOnModalVariant:"isOnModalVariant",autocompleteEndpoint:"autocompleteEndpoint",outletID:"outletID",inputID:"inputID",amountProperty:"amountProperty"},standalone:!0,features:[Q([{provide:Z,multi:!0,useExisting:o}]),G],decls:8,vars:14,consts:[["searchFilter",""],["auto","matAutocomplete"],["EMPTY_IMAGE",""],[1,"position-relative"],["class","fa fa-barcode position-absolute",4,"ngIf"],["type","text","placeholder","Search product by name/code",1,"example-input",3,"keydown.enter","formControl","matAutocomplete","id"],["autoActiveFirstOption","",3,"displayWith"],[3,"value",4,"ngFor","ngForOf"],[1,"fa","fa-barcode","position-absolute"],[3,"value"],[1,"d-flex","align-items-center","justify-content-between"],[1,"d-flex","align-items-center","justify-content-start"],["width","30","height","30","class","me-2",3,"src",4,"ngIf","ngIfElse"],[1,"ms-3"],[1,"opacity-75"],[4,"ngIf"],["width","30","height","30",1,"me-2",3,"src"],[1,"empty-image","d-flex","justify-content-center","align-items-center","me-2"],[1,"fa-solid","fa-image","fa-image-autocomplete",2,"color","#b4b4b4c2"]],template:function(i,n){if(i&1){let e=R();p(0,"div",3),c(1,vt,1,0,"i",4),p(2,"input",5,0),$("keydown.enter",function(){return P(e),F(n.onEnter())}),l(),p(4,"mat-autocomplete",6,1),c(6,Ct,13,6,"mat-option",7),I(7,"async"),l()()}if(i&2){let e=C(5);y("px-0",n.isOnModalVariant)("px-5",!n.isOnModalVariant),a(),r("ngIf",!n.isOnModalVariant),a(),y("px-6",n.isOnModalVariant),r("formControl",n.variant)("matAutocomplete",e)("id",n.inputID),a(2),r("displayWith",n.displayFn),a(2),r("ngForOf",O(7,12,n.filteredVariants$))}},dependencies:[q,W,B,K,Y,ct,mt,lt,st,ot,tt,et,nt],styles:["input[_ngcontent-%COMP%]{height:38px!important;border-radius:.375rem;border:1px solid #ced4da;width:100%;padding-left:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i[_ngcontent-%COMP%]{top:13px;left:23px}div[_ngcontent-%COMP%] > .empty-image[_ngcontent-%COMP%]{height:32px;width:30px;border:solid 1px #dddddd}.fa-image-autocomplete[_ngcontent-%COMP%]{font-size:20px}div.mat-mdc-autocomplete-panel[_ngcontent-%COMP%] mat-option.mat-mdc-option[_ngcontent-%COMP%]{margin:.1rem 0;overflow:visible;line-height:initial;word-wrap:break-word;white-space:pre-wrap}div.mat-mdc-autocomplete-panel[_ngcontent-%COMP%] mat-option.mat-mdc-option[_ngcontent-%COMP%] span.mdc-list-item__primary-text[_ngcontent-%COMP%]{white-space:normal}.mat-mdc-option[_ngcontent-%COMP%]{font-size:13px;height:auto!important;padding:10px 6px!important} .mdc-list-item__primary-text{margin-right:0;width:100%}"]})};export{gt as a};
1
+ import{a as dt}from"./chunk-O6S4UZUR.js";import{v as mt,x as st,y as ct}from"./chunk-5LWAX44Z.js";import{ua as lt}from"./chunk-MT5HSDQB.js";import{P as ut}from"./chunk-GDVVDQ62.js";import{a as pt}from"./chunk-2FWFPV5I.js";import{E as ot,a as Z,c as tt,h as et,l as it,s as nt}from"./chunk-BAI43IKV.js";import{a as J,d as rt}from"./chunk-ZSPCD25F.js";import{a as at}from"./chunk-G5LPH6YH.js";import{$b as v,Ab as p,Bb as l,Cb as f,D as x,E as s,Gb as R,Jb as $,Kc as z,L as A,Lb as u,Ra as D,Sc as W,Tb as N,Tc as B,Td as X,Ub as j,Vb as k,Wa as a,Xa as _,Xb as U,Yb as H,Yc as K,Zb as C,_ as w,_b as g,ad as Y,d as E,da as m,dd as q,ea as M,eb as T,gc as Q,hc as G,jb as c,la as h,nb as r,o as V,pa as S,pb as y,rc as I,sc as O,t as b,wa as P,xa as F,xc as L}from"./chunk-Z67YUEMZ.js";var ft=["searchFilter"];function vt(o,t){o&1&&f(0,"i",8)}function ht(o,t){if(o&1&&f(0,"img",16),o&2){let i=u().$implicit;r("src",i.ImgUrl,D)}}function _t(o,t){o&1&&(p(0,"div",17),f(1,"i",18),l())}function yt(o,t){if(o&1&&(p(0,"span"),g(1),I(2,"number"),l()),o&2){let i=u().$implicit,n=u();a(),v(O(2,1,i[n.amountProperty]))}}function Ct(o,t){if(o&1&&(p(0,"mat-option",9)(1,"div",10)(2,"div",11)(3,"div"),c(4,ht,1,1,"img",12)(5,_t,2,0,"ng-template",null,2,L),l(),p(7,"div",13)(8,"div"),g(9),l(),p(10,"small",14),g(11),l()()(),c(12,yt,3,3,"span",15),l()()),o&2){let i=t.$implicit,n=C(6),e=u();r("value",i),a(4),r("ngIf",i.ImgUrl)("ngIfElse",n),a(5),v(i.Value),a(2),v(i.Code),a(),r("ngIf",i[e.amountProperty])}}var gt=class o{constructor(t,i){this.http=t;z(()=>{let n=this.searchFilter().nativeElement;i.searchFilterNativeEl=n})}searchFilter=T("searchFilter");toastr=h(X);role=h(rt);isOnModalVariant=!1;autocompleteEndpoint=ut.GetVariantSuggestions;outletID;inputID;amountProperty="UnitPrice";filteredVariants$;variant=new it("");barcodeInput;_onEnter=new E;onEnter$=this._onEnter.asObservable();focusInterval;disabled=!1;onChange=t=>{};onTouched=()=>{};ngOnDestroy(){clearInterval(this.focusInterval)}ngAfterViewInit(){}keepInputFocus(){this.barcodeInput.nativeElement.focus(),this.focusInterval=setInterval(()=>{document.activeElement!==this.barcodeInput.nativeElement&&this.barcodeInput.nativeElement.focus()},200)}ngOnInit(){this.filteredVariants$=this.variant.valueChanges.pipe(s(e=>typeof e=="string"&&e.length>=3||e===""),A(300),w(e=>e===""?V([]):this.http.get(this.autocompleteEndpoint,[{key:"Prefix",value:e},{key:"Count",value:100},{key:"EntityID",value:this.outletID}]).pipe(m(d=>{d?.length==0&&this.toastr.warning(`Product with name ${e} is not found`,pt.Warning)}))));let t=this.variant.valueChanges.pipe(s(e=>typeof e!="string"&&!e.OnSet),m(e=>this.onChange({type:"ID",str:e.Key,value:e.Value}))),i=this.onEnter$.pipe(M(this.variant.valueChanges),b(([e,d])=>d),s(e=>typeof e=="string"),m(e=>this.onChange({type:"Code",str:e})));x(t,i).pipe(s(()=>!this.isOnModalVariant),m(()=>this.variant.setValue("")),m(()=>this.onChange(null))).subscribe()}writeValue(t){if(typeof t!="string"&&J.IsNotEmpty(t)){let i={Key:t.str,Value:t.value,OnSet:!0};this.variant.setValue(i)}}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}onEnter(){this._onEnter.next()}displayFn(t){return t&&t.Value?t.Value:""}static \u0275fac=function(i){return new(i||o)(_(at),_(dt))};static \u0275cmp=S({type:o,selectors:[["POS-variant-autocomplete"]],viewQuery:function(i,n){if(i&1&&(U(n.searchFilter,ft,5),N(ft,7)),i&2){H();let e;j(e=k())&&(n.barcodeInput=e.first)}},inputs:{isOnModalVariant:"isOnModalVariant",autocompleteEndpoint:"autocompleteEndpoint",outletID:"outletID",inputID:"inputID",amountProperty:"amountProperty"},standalone:!0,features:[Q([{provide:Z,multi:!0,useExisting:o}]),G],decls:8,vars:14,consts:[["searchFilter",""],["auto","matAutocomplete"],["EMPTY_IMAGE",""],[1,"position-relative"],["class","fa fa-barcode position-absolute",4,"ngIf"],["type","text","placeholder","Search product by name/code",1,"example-input",3,"keydown.enter","formControl","matAutocomplete","id"],["autoActiveFirstOption","",3,"displayWith"],[3,"value",4,"ngFor","ngForOf"],[1,"fa","fa-barcode","position-absolute"],[3,"value"],[1,"d-flex","align-items-center","justify-content-between"],[1,"d-flex","align-items-center","justify-content-start"],["width","30","height","30","class","me-2",3,"src",4,"ngIf","ngIfElse"],[1,"ms-3"],[1,"opacity-75"],[4,"ngIf"],["width","30","height","30",1,"me-2",3,"src"],[1,"empty-image","d-flex","justify-content-center","align-items-center","me-2"],[1,"fa-solid","fa-image","fa-image-autocomplete",2,"color","#b4b4b4c2"]],template:function(i,n){if(i&1){let e=R();p(0,"div",3),c(1,vt,1,0,"i",4),p(2,"input",5,0),$("keydown.enter",function(){return P(e),F(n.onEnter())}),l(),p(4,"mat-autocomplete",6,1),c(6,Ct,13,6,"mat-option",7),I(7,"async"),l()()}if(i&2){let e=C(5);y("px-0",n.isOnModalVariant)("px-5",!n.isOnModalVariant),a(),r("ngIf",!n.isOnModalVariant),a(),y("px-6",n.isOnModalVariant),r("formControl",n.variant)("matAutocomplete",e)("id",n.inputID),a(2),r("displayWith",n.displayFn),a(2),r("ngForOf",O(7,12,n.filteredVariants$))}},dependencies:[q,W,B,K,Y,ct,mt,lt,st,ot,tt,et,nt],styles:["input[_ngcontent-%COMP%]{height:38px!important;border-radius:.375rem;border:1px solid #ced4da;width:100%;padding-left:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i[_ngcontent-%COMP%]{top:13px;left:23px}div[_ngcontent-%COMP%] > .empty-image[_ngcontent-%COMP%]{height:32px;width:30px;border:solid 1px #dddddd}.fa-image-autocomplete[_ngcontent-%COMP%]{font-size:20px}div.mat-mdc-autocomplete-panel[_ngcontent-%COMP%] mat-option.mat-mdc-option[_ngcontent-%COMP%]{margin:.1rem 0;overflow:visible;line-height:initial;word-wrap:break-word;white-space:pre-wrap}div.mat-mdc-autocomplete-panel[_ngcontent-%COMP%] mat-option.mat-mdc-option[_ngcontent-%COMP%] span.mdc-list-item__primary-text[_ngcontent-%COMP%]{white-space:normal}.mat-mdc-option[_ngcontent-%COMP%]{font-size:13px;height:auto!important;padding:10px 6px!important} .mdc-list-item__primary-text{margin-right:0;width:100%}"]})};export{gt as a};
@@ -1,4 +1,4 @@
1
- import{a as Qn}from"./chunk-TK5H65DN.js";import{a as ai,b as kt}from"./chunk-F6GAPEFT.js";import{a as si}from"./chunk-6L6CIH5M.js";import{a as eo}from"./chunk-XWVNK2WM.js";import{e as qn}from"./chunk-FRQUJI7X.js";import{b as Kn}from"./chunk-3ZOSPVLI.js";import{d as zn}from"./chunk-2Y7B46C6.js";import{a as Jn}from"./chunk-2WXXNY47.js";import{a as Un}from"./chunk-VL5CZ3UP.js";import{a as ve,b as Re,e as Xn}from"./chunk-Z76DR22M.js";import{b as Wn}from"./chunk-RSCDTEN4.js";import{a as Bn,b as Yn,c as Zn}from"./chunk-BKFBL2AC.js";import{a as jn}from"./chunk-GVOO33HP.js";import{a as io}from"./chunk-O6S4UZUR.js";import{b as Vn,d as Fn,g as Ln}from"./chunk-MQLB3G54.js";import{d as ri}from"./chunk-7DXDN3TE.js";import{b as Hn}from"./chunk-OUZJXAJ7.js";import{a as Ui}from"./chunk-TDMJJFSD.js";import{b as kn}from"./chunk-XPJLUSWU.js";import{a as Sn}from"./chunk-NLTAG37O.js";import{a as _t}from"./chunk-O3K7IJLM.js";import{a as Gn}from"./chunk-C2AC2PYD.js";import{m as On}from"./chunk-7F3ZLA2R.js";import{c as Pn}from"./chunk-ZGGGA457.js";import{a as $n}from"./chunk-Y2FEWNVO.js";import{a as to}from"./chunk-TPEQCCVZ.js";import{g as Dn}from"./chunk-V65EGOEW.js";import{a as xn,b as ht}from"./chunk-QY57IYQW.js";import{A as Rn,C as ze,G as Nn,H as Qe,K as At,L as Oe,M as ne,N as U,O as we,R as An,i as Pe,j as Mn,k as G,l as me,m as _e,s as W,t as q,u as ft}from"./chunk-HIV2H34O.js";import{Aa as ti,Ba as Nt}from"./chunk-MT5HSDQB.js";import{G as Ct,O as oi,P as j,g as In,n as ni,o as Tn,q as En,u as wn}from"./chunk-GDVVDQ62.js";import{a as Je}from"./chunk-OISKFPMF.js";import{a as pn,c as dn}from"./chunk-HZYB2HUT.js";import{e as ii}from"./chunk-4CDQU2XZ.js";import{a as te}from"./chunk-2FWFPV5I.js";import{D as bn,c as he,e as Xt,h as Ce,i as un,k as gn,l as Ge,n as fn,o as Te,p as hn,s as gt,v as Cn,w as _n,y as vn,z as yn}from"./chunk-BAI43IKV.js";import{a as f,d as ei}from"./chunk-ZSPCD25F.js";import{a as mn}from"./chunk-TNPR2ZN6.js";import{a as Ee}from"./chunk-G5LPH6YH.js";import{$b as O,Ab as a,Bb as s,Cb as b,Db as J,E as oe,Eb as z,Fb as Yt,Gb as M,I as Le,Ic as $e,Jb as S,L as lt,Lb as d,M as Ve,Od as cn,P as xe,Qa as He,Qc as Ie,Ra as ct,Sa as Zi,Sc as le,Tb as Et,Tc as ce,Td as k,Ub as wt,Uc as nn,Vb as Rt,Vc as on,W as $t,Wa as l,Wc as rn,Xa as v,Xc as an,Yc as dt,Z as Jt,Zb as B,_ as ie,_b as m,_c as ut,ac as D,ad as K,b as Gt,ba as ge,bc as Zt,cc as tn,d as Me,da as fe,db as pe,dc as V,dd as je,e as se,ec as F,fc as L,ha as T,hc as mt,ia as zt,jb as h,jc as R,k as rt,ka as g,kc as qe,la as $,ld as sn,mb as Xi,n as Ki,nb as p,o as ue,p as at,pa as A,q as Wt,qa as Kt,r as qt,rb as en,rc as y,sc as x,sd as ln,t as Z,tc as X,u as st,uc as pt,v as Yi,vb as E,wa as C,wb as tt,xa as _,xc as Be,yb as it,zb as nt}from"./chunk-Z67YUEMZ.js";var Ke=class{constructor(t){this.roleService=t;t&&this.setRole()}_Retrieve;_DateEditor;_NumberEditor;_PriceVisible;_UnitPriceEditor;_PricebookSelector;_Cost;_Return;_Discount;_SalesPerson;_PriceMinimum;_Payment;_CreditSalesLock;_CustomerInputLock;_PaymentCodeLock;_Shipping;_Tax;_DeleteItem;_BundlingPrice;_EmailRestriction;_ParkedDeletionAuthorized;_SellEditor;_ContactCreate;_PrepaidPackageCreate;_Order;_Reprint;_Contacts;_InventoryView;_DebtView;_ClearCart;_SellDelete;_DeliveryEditor;_CouponInputLock;_Park;_Commission;setRole(){this._Retrieve=this.roleService.sell.RetrieveR,this._DateEditor=this.roleService.global.Date,this._NumberEditor=this.roleService.sell.Number,this._PriceVisible=this.roleService.sell.PriceVisible,this._SalesPerson=this.roleService.sell.SalesPerson,this._UnitPriceEditor=this.roleService.sell.UnitPriceEditor,this._PricebookSelector=this.roleService.sell.PricebookSelector,this._Cost=this.roleService.product.Cost,this._Return=this.roleService.sell.Return,this._Discount=this.roleService.sell.Discount,this._PriceMinimum=this.roleService.sell.PriceMinimum,this._Payment=this.roleService.sell.Payment,this._CreditSalesLock=this.roleService.sell.CreditSalesLock,this._CustomerInputLock=this.roleService.sell.CustomerInputLock,this._PaymentCodeLock=this.roleService.sell.PaymentCodeLock,this._Shipping=this.roleService.sell.Shipping,this._Tax=this.roleService.sell.Tax,this._DeleteItem=this.roleService.sell.DeleteItem,this._BundlingPrice=this.roleService.sell.BundlingPrice,this._EmailRestriction=this.roleService.sell.Email,this._SellEditor=this.roleService.sell.Edit,this._ContactCreate=this.roleService.contact.Create,this._PrepaidPackageCreate=this.roleService.prepaidPackage.Create,this._Order=this.roleService.order.View,this._Contacts=this.roleService.contact.View,this._InventoryView=this.roleService.inventory.View,this._DebtView=this.roleService.debt.View,this._ClearCart=this.roleService.sell.DeleteItem,this._SellDelete=this.roleService.sell.Delete,this._DeliveryEditor=this.roleService.logistic.Edit,this._Reprint=this.roleService.order.Print,this._CouponInputLock=this.roleService.sell.CouponInputLock,this._Park=this.roleService.sell.Park,this._Commission=this.roleService.product.CommissionView}get Park(){return this._Park}get CouponInputLock(){return this._CouponInputLock}set CouponInputLock(t){this._CouponInputLock=t}get Retrieve(){return this._Retrieve}get DateEditor(){return this._DateEditor}set DateEditor(t){this._DateEditor=t}get NumberEditor(){return this._NumberEditor}set NumberEditor(t){this._NumberEditor=t}get PriceVisible(){return this._PriceVisible}get UnitPriceEditor(){return this._UnitPriceEditor}set UnitPriceEditor(t){this._UnitPriceEditor=t}get PricebookSelector(){return this._PricebookSelector}set PricebookSelector(t){this._PricebookSelector=t}get Cost(){return this._Cost}get Return(){return this._Return}set Return(t){this._Return=t}get Discount(){return this._Discount}set Discount(t){this._Discount=t}get SalesPerson(){return this._SalesPerson}get PriceMinimum(){return this._PriceMinimum}get Payment(){return this._Payment}get CreditSalesLock(){return this._CreditSalesLock}get CustomerInputLock(){return this._CustomerInputLock}get PaymentCodeLock(){return this._PaymentCodeLock}get Shipping(){return this._Shipping}get Tax(){return this._Tax}set Tax(t){this._Tax=t}get DeleteItem(){return this._DeleteItem}get BundlingPrice(){return this._BundlingPrice}get Email(){return this._EmailRestriction}get ParkedDeletionAuthorized(){return this._ParkedDeletionAuthorized}set ParkedDeletionAuthorized(t){this._ParkedDeletionAuthorized=t}get SellEditor(){return this._SellEditor}get ContactsCreate(){return this._ContactCreate}get PrepaidPackageCreate(){return this._PrepaidPackageCreate}get Order(){return this._Order}get Reprint(){return this._Reprint}get Contacts(){return this._Contacts}get InventoryView(){return this._InventoryView}get DebtView(){return this._DebtView}get ClearCartRestriction(){return this._ClearCart}get SellDelete(){return this._SellDelete}get DeliveryEditor(){return this._DeliveryEditor}get Commission(){return this._Commission}};var li=class{Success;Message;message;ObjectID;SalesOrderID;OutDeliveryID;Contact;LoyaltyPoint;InvoiceNumber;Creator;OrderTimeString;PrintMode;PaymentStateID;PaymentStateLabel;Final;constructor(){this.Success=!0,this.Message="",this.ObjectID="",this.SalesOrderID="",this.OutDeliveryID="",this.Contact=null,this.LoyaltyPoint="",this.InvoiceNumber="",this.Creator="",this.OrderTimeString="",this.PrintMode=0,this.PaymentStateID=0,this.PaymentStateLabel="",this.Final=0}};var vt=class o{constructor(t,e,i,n){this.httpService=t;this._localDataService=e;this._onlineStatusService=i;this._toastrService=n;this._onlineStatusService.getOnlineStatus$().subscribe(r=>{this.isOnline=r})}_Data=new se(null);Data$=this._Data.pipe(xe(),oe(t=>t!==null));isOnline;get Data(){return this._Data.value}pushNewValue(t){this._Data.next(t)}getSalesOrderPrint(t){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:t})}submitOrder(t,e){let i=this.generatePOSDataForSubmission(t,this.isOnline);if(this.isOnline)return this.submitOnline(i).pipe(this.handleTimeOutError(i));if(e.ModuleSell.EnableOfflineTransaction)return this._localDataService.syncOrder(i).pipe(Z(()=>this.generateCompleteData(i)));this._toastrService.warning("Offline order is not Supported!","Info!")}uploadOfflineOrder(t){return this._localDataService.uploadSingleOrder(t).pipe(Le(e=>e?.message?.includes("objectStore does not exists")?this.submitOnline(t):at(()=>e)))}submitOnline(t){return this.httpService.post(j.SubmitOrder,t,mn.pos.submitOrderTimeout)}handleTimeOutError(t){return Gt(Le(e=>{if(e instanceof qt||e?.name=="TimeoutError"){let i=this.generateCompleteData(t);this.pushNewValue(i)}throw e}))}generatePOSDataForSubmission(t,e=!0){let i=Object.assign(new ne,t);i.Items=[],i.Order.CustomerID==null&&(i.Order.CustomerID=f.GuidEmpty),i.Order.SalesID==null&&(i.Order.SalesID=f.GuidEmpty);let n=1;i.Payments=i.Payments.map(c=>(c.Date=i.Order.Date,c.Index=n,n++,delete c.TypeID,c));let r=1;for(let c of i.CartItems){let u=new Nn;u.ID=c.ID,u.VariantID=c.VariantID,u.Quantity=c.Quantity,u.Cost=c.Cost,u.Price=c.Price,u.Discount=c.Discount,u.DiscountAmount=c.DiscountAmount,u.Note=c.Note,u.Taxable=c.Variant.Taxable,u.LoyaltyPoint=c.LoyaltyPoint,u.UnitCost=c.Cost,u.UnitPrice=c.Price,u.UnitPriceOriginal=c.UnitPriceOriginal,u.UnitExpense=c.UnitExpense,u.EntityID=c.EntityID,u.Index=r,u.UnitQuantity=c.UnitQuantity,u.PriceTypeID=c.PriceTypeID,u.PriceNote=c.PriceNote,u.Splited=c.SplitQuantity>0,u.SplitQuantity=c.SplitQuantity,u.InventoryTypeID=c.Variant.TypeID,u.SalesID="",u.Serial=c.Serial,c.SalesID&&(u.SalesID=c.SalesID),delete c.CouponDiscount,i.Items.push(u),r++}return e?(delete i.CartItems,delete i.Order.ClientTimestamp):i.Order.ClientTimestamp=new Date,i}generateCompleteData(t){let e=new li;return e.InvoiceNumber=t.Order.Number,e.OrderTimeString=new Date().toString(),e.PaymentStateID=t.Action?.Type,e.PaymentStateLabel="Offline",e.Success=!0,e.OutDeliveryID=t.Action.DeliveryEntityID,e}GetReturnInvoice(t,e){return this.httpService.get(j.ReturInvoice,[{key:"EntityID",value:e},{key:"Number",value:t}])}GetInvoiceBySoID(t){return this.httpService.get(j.GetPOSDataByID,[{key:"ID",value:t}])}UploadCSV(t,e){let i={CartItems:t,EntityID:e};return this.httpService.post(j.UploadCsv,i)}sendEmail(t,e){return new Promise((i,n)=>{this._localDataService.isProductFromServer().subscribe(r=>{if(r){let c={invoiceID:e,email:t};this.httpService.post(j.SendInvoiceEmail,c).subscribe({next:u=>{i(u)},error:u=>{n(u)}})}else n(U.wrongOfflineAction)})})}sendWhatsaap(t,e){let i={InvoiceID:t,PhoneNumber:e};return this.httpService.post(j.SendInvoiceWhatsapp,i)}createCustomerByInvoice(t,e){let i={InvoiceID:t,Mobile:e};return this.httpService.post(j.CreateCustomerInvoice,i)}saveCommission(t,e){let i={SOID:t,commission:e};return this.httpService.POSText("/API/Transaction/SetCommission",i)}generateReceiptA4(t){let e={ID:t};return this.httpService.post(j.InvoiceA4,e)}getVacant(t){return this.httpService.get(j.GetVacant,[{key:"EntityID",value:t}])}static \u0275fac=function(e){return new(e||o)(g(Ee),g(we),g(ve),g(k))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var Q=class o{constructor(t,e,i){this._localDataService=t;this._onlineStatusService=e;this._httpService=i;this._onlineStatusService.getOnlineStatus$().subscribe(n=>{this.isOnline=n})}_Data=new se(null);Data$=this._Data.asObservable().pipe(oe(t=>t!==null),xe());isOnline;get Data(){return this._Data.value}pushNewValue(t){this._Data.next(t)}requestObservable(){return this.isOnline?this._httpService.get(j.GetPOSStorage).pipe(Z(t=>({data:t,type:"Online"}))):this._localDataService.getPOSStorage().pipe(oe(t=>t!=null),Z(t=>({data:t,type:"Offline"})))}getOutletName(t){return this.Data.Entities.find(i=>i.ID==t)?.Name}static \u0275fac=function(e){return new(e||o)(g(we),g(ve),g(Ee))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var ke=class o{constructor(t){this.roleService=t;this.pushNewValue(new Ke(t))}_Data=new se(new Ke(null));get Data(){return this._Data.value}Data$=this._Data.asObservable();pushNewValue(t){this._Data.next(t)}static \u0275fac=function(e){return new(e||o)(g(ei))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ht=class{ID;Code;EntityID;Name;Description;Start;StartDisplay;State;Open;CashierID;OpeningCash;EntityName;LoginID;Active;CustomerDisplayEnabled;OvoConfigurationID;CustomerDisplayID;ListImage;Suspended};var Co=o=>({active:o}),_o=o=>({gray:o});function vo(o,t){if(o&1){let e=M();a(0,"span",17),S("click",function(n){C(e);let r=d().$implicit;return d().closeRegister(r),_(n.stopPropagation())}),s()}}function yo(o,t){o&1&&(a(0,"div")(1,"span",18),m(2,"VACANT"),s()())}function bo(o,t){if(o&1&&(a(0,"div")(1,"span",19),b(2,"i",20),a(3,"font"),m(4),s()(),a(5,"span",21),b(6,"i",22),a(7,"font"),m(8),s()()()),o&2){let e=d().$implicit;l(4),O(e.LoginID),l(4),D("",e.StartDisplay.split(" ")[3]," - Now")}}function So(o,t){if(o&1){let e=M();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),S("click",function(){let n=C(e).$implicit,r=d();return _(r.select(n))}),a(4,"span"),b(5,"i",13),m(6),y(7,"limitTo"),s(),h(8,vo,1,0,"span",14),s(),a(9,"div",15),S("click",function(){let n=C(e).$implicit,r=d();return _(r.select(n))}),h(10,yo,3,0,"div",16)(11,bo,9,2,"div",16),s()()()()}if(o&2){let e=t.$implicit,i=d();l(),p("ngClass",e.Active?"active":""),l(),p("ngClass",R(11,Co,(e==null?null:e.ID)==(i.selectedRegister==null?null:i.selectedRegister.ID))),l(),p("ngClass",R(13,_o,e!=i.selectedRegister)),l(3),O(X(7,8,e.Name,15)),l(2),p("ngIf",e.State!="Close"),l(),p("ngSwitch",e.State),l(),p("ngSwitchCase","Close"),l(),p("ngSwitchCase","Open")}}var ci=class o{constructor(t,e,i,n,r){this._dialogRef=t;this._outletService=e;this._posService=i;this._userRoleService=n;this.router=r}registers;searchInput="";selectedRegister=new Ht;modalConfig=new W;role;get AppConfigJSON(){return this._posService.Data.AppConfigJSON}destroy$=new Me;ngOnInit(){this.subscribeToObsChanges(),this.initModalConfig()}subscribeToObsChanges(){this._posService.Data$.pipe(ge(this.destroy$)).subscribe(t=>{this.registers=t.Registers}),this._outletService.Data$.pipe(ge(this.destroy$)).subscribe(t=>{this.selectedRegister=this.findOutletRegisterById(t.RegisterID)}),this._userRoleService.Data$.pipe(ge(this.destroy$)).subscribe(t=>{this.role=t})}findOutletRegisterById(t){let e=this.registers.find(i=>i.ID===t);return e||new Ht}initModalConfig(){this.modalConfig.hideClose=!1,this.modalConfig.hideCancel=!1,this.modalConfig.bodyScrollable=!0,this.modalConfig.title="Choose an outlet"}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}close(){this._dialogRef.close()}onOk(){if(this.selectedRegister.ID==null){alert("Please select a register first!");return}this._outletService.pushNewRegister(this.selectedRegister),this._dialogRef.close(this.selectedRegister)}select(t){if(this.AppConfigJSON.ModuleShift.Closure.Enabled)if(this.selectedRegister.ID!=null&&this.selectedRegister.Open&&t.CashierID==null)confirm("You already have an active register with "+this.selectedRegister.Name+`!
1
+ import{a as Qn}from"./chunk-TK5H65DN.js";import{a as ai,b as kt}from"./chunk-F6GAPEFT.js";import{a as si}from"./chunk-6L6CIH5M.js";import{a as eo}from"./chunk-XWVNK2WM.js";import{e as qn}from"./chunk-FRQUJI7X.js";import{b as Kn}from"./chunk-3ZOSPVLI.js";import{d as zn}from"./chunk-2Y7B46C6.js";import{a as Jn}from"./chunk-2WXXNY47.js";import{a as Un}from"./chunk-VL5CZ3UP.js";import{a as ve,b as Re,e as Xn}from"./chunk-LYVPP52Y.js";import{b as Wn}from"./chunk-RSCDTEN4.js";import{a as Bn,b as Yn,c as Zn}from"./chunk-H2XUK3CP.js";import{a as jn}from"./chunk-CWTTAMCA.js";import{a as io}from"./chunk-O6S4UZUR.js";import{b as Vn,d as Fn,g as Ln}from"./chunk-ARMRYWG5.js";import{d as ri}from"./chunk-PCBIJHIM.js";import{b as Hn}from"./chunk-OUZJXAJ7.js";import{a as Ui}from"./chunk-TDMJJFSD.js";import{b as kn}from"./chunk-XPJLUSWU.js";import{a as Sn}from"./chunk-NLTAG37O.js";import{a as _t}from"./chunk-O3K7IJLM.js";import{a as Gn}from"./chunk-XZ3GZHMU.js";import{m as On}from"./chunk-EYADCCOW.js";import{c as Pn}from"./chunk-ZGGGA457.js";import{a as $n}from"./chunk-Y2FEWNVO.js";import{a as to}from"./chunk-TPEQCCVZ.js";import{g as Dn}from"./chunk-V65EGOEW.js";import{a as xn,b as ht}from"./chunk-QY57IYQW.js";import{A as Rn,C as ze,G as Nn,H as Qe,K as At,L as Oe,M as ne,N as U,O as we,R as An,i as Pe,j as Mn,k as G,l as me,m as _e,s as W,t as q,u as ft}from"./chunk-5LWAX44Z.js";import{Aa as ti,Ba as Nt}from"./chunk-MT5HSDQB.js";import{G as Ct,O as oi,P as j,g as In,n as ni,o as Tn,q as En,u as wn}from"./chunk-GDVVDQ62.js";import{a as Je}from"./chunk-OISKFPMF.js";import{a as pn,c as dn}from"./chunk-HZYB2HUT.js";import{e as ii}from"./chunk-4CDQU2XZ.js";import{a as te}from"./chunk-2FWFPV5I.js";import{D as bn,c as he,e as Xt,h as Ce,i as un,k as gn,l as Ge,n as fn,o as Te,p as hn,s as gt,v as Cn,w as _n,y as vn,z as yn}from"./chunk-BAI43IKV.js";import{a as f,d as ei}from"./chunk-ZSPCD25F.js";import{a as mn}from"./chunk-62A2XAJV.js";import{a as Ee}from"./chunk-G5LPH6YH.js";import{$b as O,Ab as a,Bb as s,Cb as b,Db as J,E as oe,Eb as z,Fb as Yt,Gb as M,I as Le,Ic as $e,Jb as S,L as lt,Lb as d,M as Ve,Od as cn,P as xe,Qa as He,Qc as Ie,Ra as ct,Sa as Zi,Sc as le,Tb as Et,Tc as ce,Td as k,Ub as wt,Uc as nn,Vb as Rt,Vc as on,W as $t,Wa as l,Wc as rn,Xa as v,Xc as an,Yc as dt,Z as Jt,Zb as B,_ as ie,_b as m,_c as ut,ac as D,ad as K,b as Gt,ba as ge,bc as Zt,cc as tn,d as Me,da as fe,db as pe,dc as V,dd as je,e as se,ec as F,fc as L,ha as T,hc as mt,ia as zt,jb as h,jc as R,k as rt,ka as g,kc as qe,la as $,ld as sn,mb as Xi,n as Ki,nb as p,o as ue,p as at,pa as A,q as Wt,qa as Kt,r as qt,rb as en,rc as y,sc as x,sd as ln,t as Z,tc as X,u as st,uc as pt,v as Yi,vb as E,wa as C,wb as tt,xa as _,xc as Be,yb as it,zb as nt}from"./chunk-Z67YUEMZ.js";var Ke=class{constructor(t){this.roleService=t;t&&this.setRole()}_Retrieve;_DateEditor;_NumberEditor;_PriceVisible;_UnitPriceEditor;_PricebookSelector;_Cost;_Return;_Discount;_SalesPerson;_PriceMinimum;_Payment;_CreditSalesLock;_CustomerInputLock;_PaymentCodeLock;_Shipping;_Tax;_DeleteItem;_BundlingPrice;_EmailRestriction;_ParkedDeletionAuthorized;_SellEditor;_ContactCreate;_PrepaidPackageCreate;_Order;_Reprint;_Contacts;_InventoryView;_DebtView;_ClearCart;_SellDelete;_DeliveryEditor;_CouponInputLock;_Park;_Commission;setRole(){this._Retrieve=this.roleService.sell.RetrieveR,this._DateEditor=this.roleService.global.Date,this._NumberEditor=this.roleService.sell.Number,this._PriceVisible=this.roleService.sell.PriceVisible,this._SalesPerson=this.roleService.sell.SalesPerson,this._UnitPriceEditor=this.roleService.sell.UnitPriceEditor,this._PricebookSelector=this.roleService.sell.PricebookSelector,this._Cost=this.roleService.product.Cost,this._Return=this.roleService.sell.Return,this._Discount=this.roleService.sell.Discount,this._PriceMinimum=this.roleService.sell.PriceMinimum,this._Payment=this.roleService.sell.Payment,this._CreditSalesLock=this.roleService.sell.CreditSalesLock,this._CustomerInputLock=this.roleService.sell.CustomerInputLock,this._PaymentCodeLock=this.roleService.sell.PaymentCodeLock,this._Shipping=this.roleService.sell.Shipping,this._Tax=this.roleService.sell.Tax,this._DeleteItem=this.roleService.sell.DeleteItem,this._BundlingPrice=this.roleService.sell.BundlingPrice,this._EmailRestriction=this.roleService.sell.Email,this._SellEditor=this.roleService.sell.Edit,this._ContactCreate=this.roleService.contact.Create,this._PrepaidPackageCreate=this.roleService.prepaidPackage.Create,this._Order=this.roleService.order.View,this._Contacts=this.roleService.contact.View,this._InventoryView=this.roleService.inventory.View,this._DebtView=this.roleService.debt.View,this._ClearCart=this.roleService.sell.DeleteItem,this._SellDelete=this.roleService.sell.Delete,this._DeliveryEditor=this.roleService.logistic.Edit,this._Reprint=this.roleService.order.Print,this._CouponInputLock=this.roleService.sell.CouponInputLock,this._Park=this.roleService.sell.Park,this._Commission=this.roleService.product.CommissionView}get Park(){return this._Park}get CouponInputLock(){return this._CouponInputLock}set CouponInputLock(t){this._CouponInputLock=t}get Retrieve(){return this._Retrieve}get DateEditor(){return this._DateEditor}set DateEditor(t){this._DateEditor=t}get NumberEditor(){return this._NumberEditor}set NumberEditor(t){this._NumberEditor=t}get PriceVisible(){return this._PriceVisible}get UnitPriceEditor(){return this._UnitPriceEditor}set UnitPriceEditor(t){this._UnitPriceEditor=t}get PricebookSelector(){return this._PricebookSelector}set PricebookSelector(t){this._PricebookSelector=t}get Cost(){return this._Cost}get Return(){return this._Return}set Return(t){this._Return=t}get Discount(){return this._Discount}set Discount(t){this._Discount=t}get SalesPerson(){return this._SalesPerson}get PriceMinimum(){return this._PriceMinimum}get Payment(){return this._Payment}get CreditSalesLock(){return this._CreditSalesLock}get CustomerInputLock(){return this._CustomerInputLock}get PaymentCodeLock(){return this._PaymentCodeLock}get Shipping(){return this._Shipping}get Tax(){return this._Tax}set Tax(t){this._Tax=t}get DeleteItem(){return this._DeleteItem}get BundlingPrice(){return this._BundlingPrice}get Email(){return this._EmailRestriction}get ParkedDeletionAuthorized(){return this._ParkedDeletionAuthorized}set ParkedDeletionAuthorized(t){this._ParkedDeletionAuthorized=t}get SellEditor(){return this._SellEditor}get ContactsCreate(){return this._ContactCreate}get PrepaidPackageCreate(){return this._PrepaidPackageCreate}get Order(){return this._Order}get Reprint(){return this._Reprint}get Contacts(){return this._Contacts}get InventoryView(){return this._InventoryView}get DebtView(){return this._DebtView}get ClearCartRestriction(){return this._ClearCart}get SellDelete(){return this._SellDelete}get DeliveryEditor(){return this._DeliveryEditor}get Commission(){return this._Commission}};var li=class{Success;Message;message;ObjectID;SalesOrderID;OutDeliveryID;Contact;LoyaltyPoint;InvoiceNumber;Creator;OrderTimeString;PrintMode;PaymentStateID;PaymentStateLabel;Final;constructor(){this.Success=!0,this.Message="",this.ObjectID="",this.SalesOrderID="",this.OutDeliveryID="",this.Contact=null,this.LoyaltyPoint="",this.InvoiceNumber="",this.Creator="",this.OrderTimeString="",this.PrintMode=0,this.PaymentStateID=0,this.PaymentStateLabel="",this.Final=0}};var vt=class o{constructor(t,e,i,n){this.httpService=t;this._localDataService=e;this._onlineStatusService=i;this._toastrService=n;this._onlineStatusService.getOnlineStatus$().subscribe(r=>{this.isOnline=r})}_Data=new se(null);Data$=this._Data.pipe(xe(),oe(t=>t!==null));isOnline;get Data(){return this._Data.value}pushNewValue(t){this._Data.next(t)}getSalesOrderPrint(t){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:t})}submitOrder(t,e){let i=this.generatePOSDataForSubmission(t,this.isOnline);if(this.isOnline)return this.submitOnline(i).pipe(this.handleTimeOutError(i));if(e.ModuleSell.EnableOfflineTransaction)return this._localDataService.syncOrder(i).pipe(Z(()=>this.generateCompleteData(i)));this._toastrService.warning("Offline order is not Supported!","Info!")}uploadOfflineOrder(t){return this._localDataService.uploadSingleOrder(t).pipe(Le(e=>e?.message?.includes("objectStore does not exists")?this.submitOnline(t):at(()=>e)))}submitOnline(t){return this.httpService.post(j.SubmitOrder,t,mn.pos.submitOrderTimeout)}handleTimeOutError(t){return Gt(Le(e=>{if(e instanceof qt||e?.name=="TimeoutError"){let i=this.generateCompleteData(t);this.pushNewValue(i)}throw e}))}generatePOSDataForSubmission(t,e=!0){let i=Object.assign(new ne,t);i.Items=[],i.Order.CustomerID==null&&(i.Order.CustomerID=f.GuidEmpty),i.Order.SalesID==null&&(i.Order.SalesID=f.GuidEmpty);let n=1;i.Payments=i.Payments.map(c=>(c.Date=i.Order.Date,c.Index=n,n++,delete c.TypeID,c));let r=1;for(let c of i.CartItems){let u=new Nn;u.ID=c.ID,u.VariantID=c.VariantID,u.Quantity=c.Quantity,u.Cost=c.Cost,u.Price=c.Price,u.Discount=c.Discount,u.DiscountAmount=c.DiscountAmount,u.Note=c.Note,u.Taxable=c.Variant.Taxable,u.LoyaltyPoint=c.LoyaltyPoint,u.UnitCost=c.Cost,u.UnitPrice=c.Price,u.UnitPriceOriginal=c.UnitPriceOriginal,u.UnitExpense=c.UnitExpense,u.EntityID=c.EntityID,u.Index=r,u.UnitQuantity=c.UnitQuantity,u.PriceTypeID=c.PriceTypeID,u.PriceNote=c.PriceNote,u.Splited=c.SplitQuantity>0,u.SplitQuantity=c.SplitQuantity,u.InventoryTypeID=c.Variant.TypeID,u.SalesID="",u.Serial=c.Serial,c.SalesID&&(u.SalesID=c.SalesID),delete c.CouponDiscount,i.Items.push(u),r++}return e?(delete i.CartItems,delete i.Order.ClientTimestamp):i.Order.ClientTimestamp=new Date,i}generateCompleteData(t){let e=new li;return e.InvoiceNumber=t.Order.Number,e.OrderTimeString=new Date().toString(),e.PaymentStateID=t.Action?.Type,e.PaymentStateLabel="Offline",e.Success=!0,e.OutDeliveryID=t.Action.DeliveryEntityID,e}GetReturnInvoice(t,e){return this.httpService.get(j.ReturInvoice,[{key:"EntityID",value:e},{key:"Number",value:t}])}GetInvoiceBySoID(t){return this.httpService.get(j.GetPOSDataByID,[{key:"ID",value:t}])}UploadCSV(t,e){let i={CartItems:t,EntityID:e};return this.httpService.post(j.UploadCsv,i)}sendEmail(t,e){return new Promise((i,n)=>{this._localDataService.isProductFromServer().subscribe(r=>{if(r){let c={invoiceID:e,email:t};this.httpService.post(j.SendInvoiceEmail,c).subscribe({next:u=>{i(u)},error:u=>{n(u)}})}else n(U.wrongOfflineAction)})})}sendWhatsaap(t,e){let i={InvoiceID:t,PhoneNumber:e};return this.httpService.post(j.SendInvoiceWhatsapp,i)}createCustomerByInvoice(t,e){let i={InvoiceID:t,Mobile:e};return this.httpService.post(j.CreateCustomerInvoice,i)}saveCommission(t,e){let i={SOID:t,commission:e};return this.httpService.POSText("/API/Transaction/SetCommission",i)}generateReceiptA4(t){let e={ID:t};return this.httpService.post(j.InvoiceA4,e)}getVacant(t){return this.httpService.get(j.GetVacant,[{key:"EntityID",value:t}])}static \u0275fac=function(e){return new(e||o)(g(Ee),g(we),g(ve),g(k))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var Q=class o{constructor(t,e,i){this._localDataService=t;this._onlineStatusService=e;this._httpService=i;this._onlineStatusService.getOnlineStatus$().subscribe(n=>{this.isOnline=n})}_Data=new se(null);Data$=this._Data.asObservable().pipe(oe(t=>t!==null),xe());isOnline;get Data(){return this._Data.value}pushNewValue(t){this._Data.next(t)}requestObservable(){return this.isOnline?this._httpService.get(j.GetPOSStorage).pipe(Z(t=>({data:t,type:"Online"}))):this._localDataService.getPOSStorage().pipe(oe(t=>t!=null),Z(t=>({data:t,type:"Offline"})))}getOutletName(t){return this.Data.Entities.find(i=>i.ID==t)?.Name}static \u0275fac=function(e){return new(e||o)(g(we),g(ve),g(Ee))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var ke=class o{constructor(t){this.roleService=t;this.pushNewValue(new Ke(t))}_Data=new se(new Ke(null));get Data(){return this._Data.value}Data$=this._Data.asObservable();pushNewValue(t){this._Data.next(t)}static \u0275fac=function(e){return new(e||o)(g(ei))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ht=class{ID;Code;EntityID;Name;Description;Start;StartDisplay;State;Open;CashierID;OpeningCash;EntityName;LoginID;Active;CustomerDisplayEnabled;OvoConfigurationID;CustomerDisplayID;ListImage;Suspended};var Co=o=>({active:o}),_o=o=>({gray:o});function vo(o,t){if(o&1){let e=M();a(0,"span",17),S("click",function(n){C(e);let r=d().$implicit;return d().closeRegister(r),_(n.stopPropagation())}),s()}}function yo(o,t){o&1&&(a(0,"div")(1,"span",18),m(2,"VACANT"),s()())}function bo(o,t){if(o&1&&(a(0,"div")(1,"span",19),b(2,"i",20),a(3,"font"),m(4),s()(),a(5,"span",21),b(6,"i",22),a(7,"font"),m(8),s()()()),o&2){let e=d().$implicit;l(4),O(e.LoginID),l(4),D("",e.StartDisplay.split(" ")[3]," - Now")}}function So(o,t){if(o&1){let e=M();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),S("click",function(){let n=C(e).$implicit,r=d();return _(r.select(n))}),a(4,"span"),b(5,"i",13),m(6),y(7,"limitTo"),s(),h(8,vo,1,0,"span",14),s(),a(9,"div",15),S("click",function(){let n=C(e).$implicit,r=d();return _(r.select(n))}),h(10,yo,3,0,"div",16)(11,bo,9,2,"div",16),s()()()()}if(o&2){let e=t.$implicit,i=d();l(),p("ngClass",e.Active?"active":""),l(),p("ngClass",R(11,Co,(e==null?null:e.ID)==(i.selectedRegister==null?null:i.selectedRegister.ID))),l(),p("ngClass",R(13,_o,e!=i.selectedRegister)),l(3),O(X(7,8,e.Name,15)),l(2),p("ngIf",e.State!="Close"),l(),p("ngSwitch",e.State),l(),p("ngSwitchCase","Close"),l(),p("ngSwitchCase","Open")}}var ci=class o{constructor(t,e,i,n,r){this._dialogRef=t;this._outletService=e;this._posService=i;this._userRoleService=n;this.router=r}registers;searchInput="";selectedRegister=new Ht;modalConfig=new W;role;get AppConfigJSON(){return this._posService.Data.AppConfigJSON}destroy$=new Me;ngOnInit(){this.subscribeToObsChanges(),this.initModalConfig()}subscribeToObsChanges(){this._posService.Data$.pipe(ge(this.destroy$)).subscribe(t=>{this.registers=t.Registers}),this._outletService.Data$.pipe(ge(this.destroy$)).subscribe(t=>{this.selectedRegister=this.findOutletRegisterById(t.RegisterID)}),this._userRoleService.Data$.pipe(ge(this.destroy$)).subscribe(t=>{this.role=t})}findOutletRegisterById(t){let e=this.registers.find(i=>i.ID===t);return e||new Ht}initModalConfig(){this.modalConfig.hideClose=!1,this.modalConfig.hideCancel=!1,this.modalConfig.bodyScrollable=!0,this.modalConfig.title="Choose an outlet"}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}close(){this._dialogRef.close()}onOk(){if(this.selectedRegister.ID==null){alert("Please select a register first!");return}this._outletService.pushNewRegister(this.selectedRegister),this._dialogRef.close(this.selectedRegister)}select(t){if(this.AppConfigJSON.ModuleShift.Closure.Enabled)if(this.selectedRegister.ID!=null&&this.selectedRegister.Open&&t.CashierID==null)confirm("You already have an active register with "+this.selectedRegister.Name+`!
2
2
  Do you want to end your session?`)&&(this.close(),this.router.navigate(["menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:t.ID}}));else if(!t.Open||this.selectedRegister.ID==t.ID)this.selectedRegister=t;else{if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+t.Name+" - Unauthorized Access");return}alert("This Register has already active register, Are you sure you want to end this register?"),this.close(),this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:t.ID}})}else this.selectedRegister=t}closeRegister(t){let e=this.selectedRegister.ID;if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+t.Name+" - Unauthorized Access");return}e==t.ID?this.router.navigate(["/menu/Shift/Main/My_Shift"]):this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:t.ID}}),this.close()}static \u0275fac=function(e){return new(e||o)(v(G),v(Y),v(Q),v(ke),v(cn))};static \u0275cmp=A({type:o,selectors:[["pos-modal-register"]],decls:12,vars:7,consts:[[3,"onOk","onCancel","onClose","config"],[1,"ms-0","mb-8",2,"width","200px",3,"hidden"],[1,"input-group","mb-3"],[1,"input-group-text","txtFilter"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["data-cy","SearchOutlet","type","text","placeholder","Filter by Name","aria-label","Search",1,"txtFilter","form-control","border-start-0",3,"ngModelChange","ngModel"],[1,"container"],[1,"row",2,"width","600px"],["class","col-4","data-cy","registers",4,"ngFor","ngForOf"],["data-cy","registers",1,"col-4"],[1,"card","border-0",3,"ngClass"],[1,"card-body","p-0",3,"ngClass"],[1,"card-title","mb-0",3,"click","ngClass"],[1,"fa-solid","fa-house","pe-1","fs-6"],["class","fa fa-xmark-circle fa-lg position-absolute","style","text-shadow: 0 1px 0 #afafaf; right: 5px; top: 16px;",3,"click",4,"ngIf"],[1,"card-text","px-0","py-2",3,"click","ngSwitch"],[4,"ngSwitchCase"],[1,"fa","fa-xmark-circle","fa-lg","position-absolute",2,"text-shadow","0 1px 0 #afafaf","right","5px","top","16px",3,"click"],[1,"idle"],[1,"cashier"],["aria-hidden","true",1,"fa","fa-user","pe-2"],[1,"open"],["aria-hidden","true",1,"fa-regular","fa-clock","pe-2"]],template:function(e,i){e&1&&(a(0,"modal-material",0),S("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),a(1,"content")(2,"div",1)(3,"div",2)(4,"span",3),b(5,"i",4),s(),a(6,"input",5),L("ngModelChange",function(r){return F(i.searchInput,r)||(i.searchInput=r),r}),s()()(),a(7,"div",6)(8,"div",7),h(9,So,12,15,"div",8),y(10,"FilterByName"),s()()(),b(11,"footer"),s()),e&2&&(p("config",i.modalConfig),l(2),p("hidden",i.registers.length<=6),l(4),V("ngModel",i.searchInput),l(3),p("ngForOf",X(10,4,i.registers,i.searchInput)))},dependencies:[Ie,le,ce,nn,on,he,Ce,Te,q,ni,wn],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.col-4[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]{width:180px;min-height:95px;margin-right:17px;margin-bottom:17px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]{display:block;outline:0;border:1px solid #B1AAAA;border-radius:5px;cursor:pointer}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{height:30px;border-radius:4px;padding:5px 10px;color:#fff;background:#b1aaaa;overflow:hidden}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover, .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%]{background:#ffffe1;border:1px solid #89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%]{background:#89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{border:1px solid #c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover > h6[_ngcontent-%COMP%]{background:#c9302c!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]{border:1px solid #f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover{border:1px solid #f6a828;background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover > strong[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] div[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.75rem!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{height:80px;padding:15px 10px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;font-weight:400;font-size:.875rem;width:100%;margin-bottom:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:first-child{margin-top:-10px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:last-child{margin-bottom:0}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{text-align:center;position:absolute;bottom:0;right:0;width:auto;background-color:#b1aaaa;border-radius:3px;padding:2px 5px;color:#fff;display:none!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.idle[_ngcontent-%COMP%]{display:block;font-size:1.25rem;text-align:center}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{position:absolute;width:27px;height:28px;cursor:pointer;top:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#000}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:last-of-type{right:-5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:nth-last-of-type(2){right:15px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{bottom:20px;right:5px;position:absolute}.col-4[_ngcontent-%COMP%] .duration[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{border:1px solid!important;position:absolute;bottom:-3px;left:58px;background:#fff;border-radius:5px}"]})};var Po=["inputCash"],mi=class o{constructor(t,e){this.dialogRef=t;this.data=e;this.generateModalTitle$.subscribe()}registerService=$(Y);loadPOSService=$(Q);register=this.registerService.Data;username=this.loadPOSService?.Data?.UserName;amount=pe(0);config=new W;currentRegisterName;generateModalTitle$=this.registerService.Data$.pipe(oe(t=>f.IsNotEmpty(t)),fe(()=>{let t=this.registerService.getOutletRegister(),e=t?.Name?.length>18?`${t?.Name?.substring(0,18)}...`:t?.Name;this.config.title="Open Shift",this.currentRegisterName=e}),Pe());today=new Date;inputCashEl;ngOnInit(){this.config.customWidth="350px",this.config.hideCancel=!0}ngAfterViewInit(){this.inputCashEl?.nativeElement?.focus()}onOk(){this.dialogRef.close({amount:this.amount()})}static \u0275fac=function(e){return new(e||o)(v(G),v(me))};static \u0275cmp=A({type:o,selectors:[["POS-modal-opening-cash"]],viewQuery:function(e,i){if(e&1&&Et(Po,5),e&2){let n;wt(n=Rt())&&(i.inputCashEl=n.first)}},decls:25,vars:8,consts:[["inputCash",""],[3,"onOk","onCancel","onClose","config"],[1,"table","fs-5","text"],[1,"py-3"],[1,"text-end","pe-3"],[1,"py-4"],[1,"text-end"],["data-cy","InputCash","autoNum","",1,"border","form-control-lg","text-end","w-100",3,"ngModelChange","ngModel"]],template:function(e,i){if(e&1){let n=M();a(0,"modal-material",1),S("onOk",function(){return C(n),_(i.onOk())})("onCancel",function(){return C(n),_(i.dialogRef.close())})("onClose",function(){return C(n),_(i.dialogRef.close())}),a(1,"content")(2,"table",2)(3,"tr")(4,"td",3),m(5,"Outlet Register"),s(),a(6,"td",4),m(7),s()(),a(8,"tr")(9,"td",5),m(10,"Current User"),s(),a(11,"td",4),m(12),s()(),a(13,"tr")(14,"td",5),m(15,"Starting Time"),s(),a(16,"td",4),m(17),y(18,"date"),s()(),a(19,"tr")(20,"td",3),m(21,"Starting Cash"),s(),a(22,"td",6)(23,"input",7,0),L("ngModelChange",function(c){return C(n),F(i.amount,c)||(i.amount=c),_(c)}),s()()()()()()}e&2&&(p("config",i.config),l(7),O(i.currentRegisterName),l(5),O(i.username),l(5),O(X(18,5,i.today,"EEEE, HH:mm")),l(6),V("ngModel",i.amount))},dependencies:[he,Ce,Te,q,ht,ut],styles:[".table-title-width[_ngcontent-%COMP%]{width:120px}"]})};var pi=class{OrderNumberElement;InvoiceNumberElement;NewOrderID};var bt=class o{constructor(t,e,i){this._httpService=t;this._onlineStatusService=e;this._localDataService=i;this._onlineStatusService.getOnlineStatus$().subscribe(n=>{this.isOnline=n})}isOnline;GenerateNumber(t,e){if(this.isOnline)return this._httpService.get(j.GenerateNumber,[{key:"EntityID",value:t},{key:"TypeID",value:1}]);{let i=new pi;return f.IsNotEmpty(e.NumberElement)&&(e.NumberElement.Seed+=1),f.IsNotEmpty(e.InvoiceNumberElement)&&(e.InvoiceNumberElement.Seed+=1),i.InvoiceNumberElement=e.InvoiceNumberElement,i.OrderNumberElement=e.NumberElement,i.NewOrderID=f.Guid_NewGuid(),ue(i)}}findRegisterById(t){return new Promise(e=>{this._localDataService.isConfigFromServer().subscribe(i=>{i?this._httpService.get(j.GetRegisterInfo,[{key:"RegisterID",value:t}]).subscribe(n=>{e(n)}):this._localDataService.findRegisterByID(t).subscribe(n=>{e(n)})})})}recordOpeningCash(t){return Wt(this._httpService.post("/API/POS/RecordOpeningCash",t))}static \u0275fac=function(e){return new(e||o)(g(Ee),g(ve),g(we))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var Y=class o{constructor(t,e,i,n,r){this._signalRClientService=t;this._matDialog=e;this._posHttpResponseService=i;this._CoreHttpService=n;this._toastrService=r}_Data=new se(null);Data$=this._Data.asObservable().pipe(oe(t=>t!==null),xe());get Data(){return this._Data.value}getSalesname(t){return this.Data&&this.Data.ListSales?this._Data.value.ListSales.find(e=>e.ID==t)?.Name:""}setActiveRegisterFromOptions(t,e){let n=this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled;if(t.length>1){let r=t.find(c=>c.LoginID==e);if(r)this.pushNewRegister(r);else{let c=this.Data?this.Data.RegisterID:null;f.IsEmpty(c)?this.openChooseRegisterModal():n&&this.openChooseRegisterModal()}}t.length==1&&(this.pushNewRegister(t[0]),f.IsEmpty(t[0].LoginID)&&f.IsEmpty(t[0].CashierID)&&this.openOpeningCashModal(t[0].ID)),t.length==0&&this._toastrService.warning("You do not have access to any OUTLET","Warning")}openChooseRegisterModal(){this._matDialog.open(ci,{id:"registerModal",disableClose:!0}).afterClosed().pipe(oe(t=>f.IsNotEmpty(t))).subscribe(t=>{t&&this.openOpeningCashModal(t.ID)})}openOpeningCashModal(t){this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled&&this._matDialog.open(mi,{disableClose:!0}).afterClosed().pipe(oe(n=>f.IsNotEmpty(n))).subscribe(n=>{let r={RegisterID:t,OpAmount:n.amount};this._CoreHttpService.recordOpeningCash(r)})}pushNewRegister(t){let e=this._Data.value,i=e?e.RegisterID:null;i!=t.ID&&this._CoreHttpService.findRegisterById(t.ID).then(n=>{n.RegisterCode=t.Code,n.DefaultPrintTemplate=n.PrintTemplate,this._signalRClientService.SubscribeGroup(n.RegisterID,i),this.pushNewValue(n)})}getOutletRegister(){let t=this.Data.RegisterID;return this._posHttpResponseService.Data.Registers.find(n=>n.ID==t)}pushNewValue(t){this._Data.next(t)}findOutletRegisterById(t){return this._posHttpResponseService.Data.Registers.find(n=>n.ID===t)}static \u0275fac=function(e){return new(e||o)(g(Je),g(_e),g(Q),g(bt),g(k))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var di=class{RegisterID;Number;Amount;TransactionID};var ot=class{GroupID;Method;Data};var ui=class{Status;InvoiceID;LoyaltyPoint;diff};var gi=class{GopayQr};var jt=(r=>(r[r.cash=1]="cash",r[r.card=2]="card",r[r.emoney=3]="emoney",r[r.other=4]="other",r[r.ECR=99]="ECR",r))(jt||{});var N=class o{constructor(t,e,i){this._OrderHttpService=t;this._customerHttpService=e;this._toastrService=i}_Data=new se(new ne);transaction_id;Data$=this._Data.asObservable();get Data(){return this._Data.value}pushNewValue(t){if(t)this._Data.next(t);else{let e=this.Data;this._Data.next(e)}}submitOrder(t){return new Promise((e,i)=>{this.checkTransactionId(),this._OrderHttpService.submitOrder(this.Data,t).subscribe({next:n=>{e(n)},error:n=>{this.Data.Items=[],i(n)}})})}uploadOfflineOrder(){return this.checkTransactionId(),this._OrderHttpService.uploadOfflineOrder(this.Data)}checkTransactionId(){let e=this.Data.Payments.find(i=>i.TypeID==3);f.IsNotEmpty(e)&&f.IsEmpty(this.transaction_id)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure")}updateCustomerID(t){return this.Data.Order.CustomerID=t,this.pushNewValue(this.Data),new Promise((e,i)=>{this._customerHttpService.GetPrivilegeByID(t,this.Data.Order.EntityID).subscribe({next:n=>{this._customerHttpService.Data=n,this.pushNewValue(this.Data),e(n)},error:n=>{this.Data.Order.CustomerID=null,this.Data.ContactName=null,i(n)}})})}static \u0275fac=function(e){return new(e||o)(g(vt),g(Re),g(k))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var fi=class{Name;Quantity;Discount;DiscountAmount;Price;UnitQuantity};var hi=class{Items;AmountSummary;GopayQr;Number;Customer;SalesName;CurrencySymbol;FinalAmount};var Ci=class o{_state=pe(this.initCustomerDisplayState());isEnabled=$e(()=>this._state()?.enabled);connect(){let e={enabled:!0,timestamp:new Date().toDateString()};localStorage.setItem("customerDisplay",JSON.stringify(e)),this._state.set(e)}initCustomerDisplayState(){let t=localStorage.getItem("customerDisplay"),e={enabled:!1,timestamp:""};return f.IsNotEmpty(t)&&(e=JSON.parse(t)),e}disconnect(){let e={enabled:!1,timestamp:new Date().toDateString()};localStorage.setItem("customerDisplay",JSON.stringify(e)),this._state.set(e)}static \u0275fac=function(e){return new(e||o)};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var re=class{Amount;CurrencySymbol;Label;Type;constructor(t,e,i,n){this.Amount=t,this.CurrencySymbol=e,this.Label=i,this.Type=n}};var Ze=class{ModuleSell;ApplicationLoyalty;ApplicationMath;CoreDefaults;ModuleDelivery;ApplicationParkAndRetrieve;ApplicationRegisterClosure;PaymentConfigGopay;PaymentConfigLink;PrintConfigInvoice;CorePrint;PaymentConfigEmpatKali;ApplicationSettings;PrintConfigGeneral;ModuleProducts;ModuleContact;ApplicationTransactionNumbering;ModuleOrders;ModuleShift;ModuleBuy;ModuleAdjustment;AddOnsKitchenDisplay;TadaCouponVisible;CouponRedemptionType};var ee=class o{constructor(t,e,i,n){this._orderDataService=t;this._posService=e;this.POSMATH=i;this.decimalPipe=n;this._orderDataService.Data$.pipe(ie(r=>this._posService.Data$.pipe(Z(c=>({appConfig:c.AppConfigJSON,salesOrder:r}))))).subscribe(r=>{this.salesOrderData=r.salesOrder,this.appConfigJSON=r.appConfig,this.calculateDiscountAmount(),this.pushNewValue(this.grandTotal)})}_Data=new se(0);Data$=this._Data.asObservable().pipe(xe());tax=new Qn;discountAfterTax=0;currencySymbol="Rp";get Data(){return this._Data.value}salesOrderData=new ne;appConfigJSON=new Ze;pushNewValue(t){this._Data.next(t)}get grandTotal(){let t=this.TotalAfterSurcharge;return isNaN(t)?0:t}setDecimalDigit(t){let e=this.decimalPipe.transform(t,"1.0-4");return t=parseFloat(e.split(",").join("")),t}get TotalAfterTax(){let t=this.TaxAmount,e=this.TotalBeforeTax+t;return e=this.POSMATH.Round(e,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm),e}get TotalBeforeTax(){let t=this.tax?.CalculationTypeID===1,e=0;return t?e=this.DiscountTotal-this.TaxAmount:e=this.DiscountTotal,e}get TotalAfterSurcharge(){let t=this.TotalAfterTax+this.SurchargeAmount;return this.POSMATH.Round(t,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm)}get TotalAfterDiscountTaxable(){return this.GrossTotalTaxable-this.DiscountTotal}get TaxAmount(){if(this.tax!=null){let t=0,e=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.DecimalPlaceValue,i=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.RoundAlgorithm,n=this.GrossTotalTaxable;return this.tax.CalculationTypeID==1?t=this.tax.Rate/(100+this.tax.Rate)*n:t=this.tax.Rate/100*n,t=this.POSMATH.Round(t,e,i),t}else return 0}get SurchargeAmount(){return this.TotalAfterTax*this.salesOrderData.Invoice.SurchargePcg/100}get Discount1Amount(){return this.GrossTotal*this.salesOrderData.Order.Discount/100}get AfterDiscount1Amount(){return this.GrossTotal-this.Discount1Amount}get Discount2Amount(){return this.AfterDiscount1Amount*this.salesOrderData.Order.Discount2/100}get AfterDiscount2Amount(){return this.AfterDiscount1Amount-this.Discount2Amount}get DiscountTotal(){return this.AfterDiscount2Amount-this.salesOrderData.Order.DiscountAmount}calculateDiscountAmount(){let t=this.salesOrderData.Order.DiscountAmount,e=0;this.AfterDiscount2Amount>=0&&t>0&&t>this.AfterDiscount2Amount&&(e=this.AfterDiscount2Amount),e!==0&&e<=t&&this.GrossTotal!==0&&(t=e),this.salesOrderData.Order.DiscountAmount=t}get GrossTotal(){return this.sum(this.salesOrderData.CartItems,"Total")}get GrossTotalTaxable(){let t=this.salesOrderData.CartItems.filter(i=>i.Taxable),e=this.sum(t,"Total");if(t.length!==0){let i=this.calculateDiscountTaxableItem(t);e=e*(100-this.salesOrderData.Order.Discount)/100,e=e*(100-this.salesOrderData.Order.Discount2)/100,e=e-i}return e}calculateDiscountTaxableItem(t){let e=this.GrossTotal,i=this.salesOrderData.Order.DiscountAmount,n=0,r=0,c=0,u=0;for(let P of t)n=P.getItemAfterDiscount/e,r=n*i,u=r*P.Quantity,c+=u;return c}get GrossTotalNonTaxable(){let t=this.salesOrderData.CartItems.filter(i=>i.Taxable==!1),e=this.sum(t,"Total");return e=e*(100-this.salesOrderData.Order.Discount)/100,e=e*(100-this.salesOrderData.Order.Discount2)/100,e=e-this.salesOrderData.Order.DiscountAmount,e}sum(t,e){let i=t.reduce((n,r)=>n+r[e],0);return i=this.setDecimalDigit(i),i}GetPointOnlyAmount(){let t=this.salesOrderData.CartItems.filter(e=>e.Variant.PaymentTypeID==2);return this.GetAmountByCart(t)}GetCashOnlyAmount(){let t=this.salesOrderData.CartItems.filter(e=>e.Variant.PaymentTypeID==1);return this.GetAmountByCart(t)}GetCashAndPointAmountCart(){let t=this.salesOrderData.CartItems.filter(e=>e.Variant.PaymentTypeID!=1);return this.GetAmountByCart(t)}GetAmountByCart(t){let e=this.sum(t,"Total");return e=e*(100-this.salesOrderData.Order.Discount)/100,e=e*(100-this.salesOrderData.Order.Discount2)/100,e}calculateGrossTotal(t){return this.sum(t,"Total")}static \u0275fac=function(e){return new(e||o)(g(N),g(Q),g(Un),g(K))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var _i=class o{constructor(t,e,i,n){this._invoiceCalculatorService=t;this._decimalPipe=e;this._poshttpResponseService=i;this._orderService=n;this._poshttpResponseService.Data$.pipe(Pe()).subscribe(r=>{this.appConfig=r.AppConfigJSON})}appConfig=new Ze;generateAmountSummary(){let t=[];this.isUseTax()?t=this.generateSummaryTax():t=this.generateSummaryNonTax();let e=this.generateSurchargeSummary();return e&&t.push(...e),t}generateSummaryTax(){let t=this._invoiceCalculatorService.tax?.CalculationTypeID,e=[];return t==1?e=this.generateSummaryTaxInclude():e=this.generateSummaryTaxExclude(),e}generateSummaryNonTax(){let t=[],e=this.generateCartItemAmount();if(t.push(e),this.isDiscounted()){let i=this.generateDiscountSummary(),n=this.generateAmountTotal("Total");t.push(...i,n)}return t}generateSummaryTaxInclude(){let t=[];return this.isTaxReserveSequence()?t=this.generateTaxIncludeReserveSequence():t=this.generateTaxIncludeNormalSequence(),t}generateTaxIncludeReserveSequence(){let t=[];if(this.isTaxDetailVisible()==!1){let r=this._invoiceCalculatorService.TotalBeforeTax,c=this.isDiscounted()?"Amount":"Before Tax",u=this.isDiscounted()?this._invoiceCalculatorService.GrossTotal:r,P=new re(u,this.currencySymbol,c,2);t.push(P)}if(this.isDiscounted()){let r=this.generateDiscountSummary(),c=this.generateBeforeTaxSummary();t.push(...r,c)}let i=this.generateTax(),n=this.generateAmountTotal();return t.push(...i,n),t}generateTaxIncludeNormalSequence(){let t=[],e=this.generateCartItemAmount();if(t.push(e),this.isDiscounted()){let n=this.generateDiscountSummary(),r=this.generateSummarySubTotal();t.push(...n,r)}let i=this.generateTax();if(t.push(...i),this.isTaxDetailVisible()==!1){let n=this.generateBeforeTaxSummary();t.push(n)}return t}generateSummaryTaxExclude(){let t=[],e=this.generateCartItemAmount(!0);if(t.push(e),this.isDiscounted()){let c=this.generateDiscountSummary(),u=this.generateSummarySubTotal();t.push(...c,u)}let i=this.generateTax(),n=this._invoiceCalculatorService.TotalAfterTax,r=new re(n,this.currencySymbol,"Total",1);return t.push(...i,r),t}generateAmountTotal(t="Total Amount"){let e=this._invoiceCalculatorService.Data;return new re(e,this.currencySymbol,t,1)}generateSummarySubTotal(){let t=this._invoiceCalculatorService.TotalAfterTax;return new re(t,this.currencySymbol,"SubTotal",1)}generateBeforeTaxSummary(){let t=this._invoiceCalculatorService.TotalBeforeTax;return new re(t,this.currencySymbol,"Before Tax",2)}isTaxDetailVisible(){return this.appConfig.PrintConfigInvoice?.Footer?.TaxDetailVisible}isUseTax(){let t=this._invoiceCalculatorService.tax;return t?.PrintVisible&&t?.Rate!=0}generateTax(){let t=[],e=this.isTaxDetailVisible(),i=e?2:1,n=this._invoiceCalculatorService.tax;if(e){let r=this.appConfig.PrintConfigInvoice.Footer.TaxableSales,c=this.calculateTaxableSales(),u=new re(c,this.currencySymbol,r,i);t.push(u)}if(n.TypeID==2){let r=this.generateTaxTypeMultiple();t.push(...r)}else{let r=this.generateSingleTaxSummary(n.Label,this._invoiceCalculatorService.TaxAmount,i);t.push(r)}if(e){let r=this.appConfig.PrintConfigInvoice.Footer.TaxExemptSales,c=this._invoiceCalculatorService.GrossTotalNonTaxable,u=new re(c,this.currencySymbol,r,i);t.push(u);let P=this.appConfig.PrintConfigInvoice.Footer.LabelWithZeroAmount;if(P){let I=new re(0,this.currencySymbol,P,i);t.push(I)}}return t}generateCartItemAmount(t=!1){let e=this.isDiscounted()||t?this._invoiceCalculatorService.GrossTotal:this._invoiceCalculatorService.TotalAfterTax;return new re(e,this.currencySymbol,"Amount",1)}get currencySymbol(){return this._invoiceCalculatorService.currencySymbol}generateDiscountSummary(){let t=[];if(this._invoiceCalculatorService.Discount1Amount!=0){let e=this._decimalPipe.transform(this._orderService.Data.Order.Discount),n=this.checkDiscountIgnoreDecimal(e)?"{0}":"{0} ({1}%)";t.push(new re(this._invoiceCalculatorService.Discount1Amount*-1,this._invoiceCalculatorService.currencySymbol,f.StringFormat(n,this.appConfig.CorePrint.Alias.Discount1,e),1))}if(this._invoiceCalculatorService.Discount2Amount!=0){let e=this._decimalPipe.transform(this._orderService.Data.Order.Discount2),n=this.checkDiscountIgnoreDecimal(e)?"{0}":"{0} ({1}%)";t.push(new re(this._invoiceCalculatorService.Discount2Amount*-1,this._invoiceCalculatorService.currencySymbol,f.StringFormat(n,this.appConfig.CorePrint.Alias.Discount2,e),1))}return this._orderService.Data.Order.DiscountAmount!=0&&this.appConfig.PrintConfigInvoice.ItemsFooter.DiscountAmountVisible&&t.push(new re(this._orderService.Data.Order.DiscountAmount*-1,this._invoiceCalculatorService.currencySymbol,"Discount ("+this._invoiceCalculatorService.currencySymbol+")",1)),t}calculateTaxableSales(){let t=this._invoiceCalculatorService.tax,e=this._invoiceCalculatorService.TaxAmount,i=this._invoiceCalculatorService.GrossTotalTaxable;return t.Rate==0?0:t.CalculationTypeID==1?i-e:i}generateTaxTypeMultiple(){let t=this.appConfig.PrintConfigInvoice.Footer.TaxDetailVisible?2:1,e=[],i=this._invoiceCalculatorService.tax;var n=this._invoiceCalculatorService.TaxAmount;if(i.TypeID==2){let r=i?.Components?i?.Components:[],c=this._invoiceCalculatorService.GrossTotalTaxable,u=this.calculateTotalRate(r);r.forEach(P=>{if(i.CalculationTypeID==0){let I=P.Rate/100*c;e=[...e,this.generateSingleTaxSummary(P.Label,I,t)],i.MultipleTaxTypeID==1&&(c+=I)}else{let I=P.Rate/u*n;e=[...e,this.generateSingleTaxSummary(P.Label,I,t)]}})}else e=[...e,this.generateSingleTaxSummary(i.Label,n,t)];return e}calculateTotalRate(t){let e=0;return t&&t.length>0&&(e=t.map(i=>i.Rate).reduce((i,n)=>i+n)),e}generateSingleTaxSummary(t,e,i){let n=this._invoiceCalculatorService.currencySymbol;return new re(e,n,t,i)}generateSurchargeSummary(){if(this._invoiceCalculatorService.SurchargeAmount==0)return;let t=[],e=this.appConfig.CorePrint,i=e&&e.Alias.SurchargePcg?e.Alias.SurchargePcg:"Surcharge";t.push(new re(this._invoiceCalculatorService.SurchargeAmount,this._invoiceCalculatorService.currencySymbol,f.StringFormat("{0} ({1}%)",i,this._decimalPipe.transform(this._orderService.Data?.Invoice.SurchargePcg)),1));let n=this.generateAmountTotal();return t.push(n),t}checkDiscountIgnoreDecimal(t){let i=this.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal,n=parseFloat(t)%1,r=!1;return n!==0&&i&&(r=!0),r}isDiscounted(){let t=this._invoiceCalculatorService.Discount1Amount,e=this._invoiceCalculatorService.Discount2Amount,i=this._orderService.Data.Order.DiscountAmount,n=!1;return(t!=0||e!=0||i!=0)&&(n=!0),n}isTaxReserveSequence(){let t=this._invoiceCalculatorService.tax,e=!!t,i=e?t.CalculationTypeID:null,n=this.appConfig.PrintConfigInvoice.ItemsFooter.TaxIncludeBeforeTotalAmount;return e&&i===1&&n}static \u0275fac=function(e){return new(e||o)(g(ee),g(K),g(Q),g(N))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var Xe=class o{constructor(t,e,i,n){this._receiptCalculatorService=t;this._cashierCalculatorService=e;this._signal=i;this._customerHttpService=n;this.broadcastOrderUpdate$.subscribe()}_salesOrderDataModelService=$(N);_outletService=$(Y);displayService=$(Ci);localdata=$(we);orderDataModel;broadcastOrderUpdate$=st([this._salesOrderDataModelService.Data$,this.localdata.isStoreOrderInServer(),Mn(this.displayService.isEnabled)]).pipe(Yi(([t,e,i])=>{let n=this._outletService?.Data?.RegisterID;if(e&&i&&n){this.orderDataModel=t;let r=this.ConstructCartModelForCustomerDisplay(),c=new ot;return c.GroupID=n+"_Subscriber",c.Method="POSCartAmountUpdated",c.Data=r,this._signal.broadcast(c).pipe(Le(u=>(console.log(u),rt)))}else return rt}),Le(t=>(console.log(t),rt)),Pe());ConstructCartModelForCustomerDisplay(){let t=this._customerHttpService.Data,e=new hi;e.Number=this.orderDataModel.Order.Number,e.Items=Array();for(let i of this.orderDataModel.CartItems){let n=new fi;n.Name=i.Variant.Name,n.Discount=i.Discount,n.DiscountAmount=i.DiscountAmount,n.Price=i.Price,n.Quantity=i.Quantity,n.UnitQuantity=i.UnitQuantity,e.Items.push(n)}return f.IsNotEmpty(this.orderDataModel.Order.SalesID)?e.SalesName=this._outletService.getSalesname(this.orderDataModel.Order.SalesID):e.SalesName="",f.IsNotEmpty(this.orderDataModel.Order.CustomerID)&&f.IsNotEmpty(t)&&(e.Customer=new _t,e.Customer.Email=t.Email,e.Customer.Mobile=t.Mobile,e.Customer.Name=this.orderDataModel.ContactName),e.CurrencySymbol=this._cashierCalculatorService.currencySymbol,e.FinalAmount=this._cashierCalculatorService.Data,e.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),e}BroadcastStateToCustomerDisplay(t,e="",i="",n=0){let r=new ui;r.Status=t,r.InvoiceID=e,r.LoyaltyPoint=i,r.diff=n;let c=new ot;return c.GroupID=this._outletService.Data.RegisterID+"_Subscriber",c.Method="POSStateUpdated",c.Data=r,this.displayService.isEnabled()?this.localdata.isStoreOrderInServer().pipe(ie(u=>u?this._signal.broadcast(c):ue(U.offlineMode))):rt}BroadcastQRToCustomerDisplay(t){let e=new gi;e.GopayQr=t;let i=new ot;return i.GroupID=this._outletService.Data.RegisterID+"_Subscriber",i.Method="POSQRPaymentActivated",i.Data=e,this.displayService.isEnabled()?this.localdata.isStoreOrderInServer().pipe(ie(n=>n?this._signal.broadcast(i):ue(U.offlineMode))):rt}BroadcastChangeToKitchenDisplay(t){let e=new ot;return e.GroupID=this._outletService.Data.EntityID+"_Subscriber",e.Method="ReceiveKitchenDisplayMessage",e.Data={state:t},this.localdata.isStoreOrderInServer().pipe(ie(i=>i?this._signal.broadcast(e):ue(U.offlineMode)))}static \u0275fac=function(e){return new(e||o)(g(_i),g(ee),g(Je),g(Re))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var vi=class o{constructor(t){this.httpService=t}VerifyPayment(t,e){let i=this.getVerifyPaymentUrl(e);return this.httpService.post(i,t)}getVerifyPaymentUrl(t){let e;switch(t){case 0:e=j.GopayVerifyPayment;break;case 1:e=j.BcaVerifyPayment;break}return e}generateLink(t){return this.httpService.post(j.GenerateLink,t)}generateQRCode(t,e){return this.httpService.post(t,e)}static \u0275fac=function(e){return new(e||o)(g(Ee))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var St=class o{constructor(t,e,i,n,r){this._posHubService=t;this._orderDataService=e;this._PaymentHttpService=i;this._InvoicecashierCalculatorService=n;this._toastrService=r}transactionId;qrPaymentMethodID;QRCodeHttpResponse;_paymentMethod;get paymentMethod(){return this._paymentMethod}resetPaymentMethod(){this._paymentMethod=null}onQRPaymentComplete(t,e){return new Promise((i,n)=>{if(t.transaction_id!==this.transactionId){let c=`transaction_id: ${t.transaction_id} / gross_amount: ${t.gross_amount}`;n({header:"Invalid QR Payment",message:c});return}if(t.gross_amount!==this._InvoicecashierCalculatorService.Data){let c=`paid_amount: ${t.gross_amount} vs invoice_amount: ${this._InvoicecashierCalculatorService.Data}`;n({header:"Invalid QR Payment",message:c});return}let r=this._orderDataService.Data.Order.Number;if(t.order_id.includes(r)==!1){let c=`Order ID: ${t.order_id} vs Order Number: ${r}`;n({header:"Invalid QR Payment",message:c});return}if(t.transaction_status!=="settlement"){let c=`Transaction status is ${t.transaction_status}`;n({header:"Invalid QR Payment",message:c});return}this.validateEMoneyPayment(e).subscribe(c=>{i(c)})})}generateNewPayment(t,e){let i=this._orderDataService.Data;f.IsEmpty(this.qrPaymentMethodID)&&alert("QR PaymentMethod.ID is not available!");let n=new ze;return n.PaidAmount=e,n.Amount=e,n.Date=i.Order.Date,n.MethodID=this.qrPaymentMethodID,n.Code=t,f.IsEmpty(t)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure"),n}sendStateCompleteToCustomerDisplay(t){this._posHubService.BroadcastStateToCustomerDisplay(1,t.ObjectID,t.LoyaltyPoint,0).subscribe()}generateQR(t,e){this._paymentMethod=e,this.qrPaymentMethodID=e.ID;let i=this.getServiceUrl(e.EMoneyTypeID);return this._PaymentHttpService.generateQRCode(i,t).pipe(Z(c=>(c=this.manipulateBCAQrisImg(c,e.EMoneyTypeID),this.transactionId=c.Transaction_id,this.QRCodeHttpResponse=c,this._orderDataService.transaction_id=c.Transaction_id,this.sendQRToCustomerDisplay(c.Url),c)))}sendQRToCustomerDisplay(t){this._posHubService.BroadcastQRToCustomerDisplay(t).subscribe()}validateEMoneyPayment(t){if(f.IsNotEmpty(this.transactionId)){let e=this._InvoicecashierCalculatorService.Data,i=this._paymentMethod?.EMoneyTypeID,n=this.generatePaymentVerificationData(e,i);return this._PaymentHttpService.VerifyPayment(n,i).pipe(ie(r=>(this.updatePosDataForSubmission(e),Ki(this._orderDataService.submitOrder(t)).pipe(fe(c=>{this.sendStateCompleteToCustomerDisplay(c)})))))}else{let e=new Error("Transaction ID is Empty");throw at(()=>e)}}generatePaymentVerificationData(t,e){let i=this._orderDataService.Data,n=new di;return n.Number=i.Order.Number,n.Amount=t,n.TransactionID=this.transactionId,n.RegisterID=i.Order.RegisterID,e==1&&(n.Number=this.QRCodeHttpResponse.Number),n}updatePosDataForSubmission(t){let e=this._orderDataService.Data,i=this.generateNewPayment(this.transactionId,t),n=[];n.push(i),e.Invoice.Due=null,e.Action.Type=3,e.Order.InvoicedStateID=3,e.Payments=n,this._orderDataService.pushNewValue(e)}getServiceUrl(t){let e;switch(t){case 0:e=j.GenerateGopayQrCode;break;case 1:e=j.GenerateBcaQrCode;break}return e}manipulateBCAQrisImg(t,e){return e==1&&(t.Url=`data:image/png;base64, ${t.Url}`),t}clearTransactionID(){this.transactionId=null,this._orderDataService.transaction_id=null,this.QRCodeHttpResponse=null}getTransactionId(){return this.transactionId}static \u0275fac=function(e){return new(e||o)(g(Xe),g(N),g(vi),g(ee),g(k))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var Pt=class{CommissionID;ReturNumber;parkTemporaryItem;posState;InputTextValue;constructor(){this.posState=0,this.CommissionID="",this.ReturNumber="",this.parkTemporaryItem=[],this.InputTextValue=""}};var yi=class o{constructor(t,e,i){this._promotionEventService=t;this._dialogRef=e;this.data=i;this.modalConfig=new W,this.modalConfig.hideCancel=!0,this.modalConfig.hideClose=!0,this.modalConfig.headerType=te.Warning,this.modalConfig.title="Promotion Requirement unfulfilled!",this.modalConfig.customWidth="350px",this.modalConfig.okText="Ok",this.selectedPromotion=t.selectedPromotion}modalConfig;selectedPromotion;onOk(){this._promotionEventService.restoreOrder(),this._dialogRef.close()}static \u0275fac=function(e){return new(e||o)(v(Se),v(G),v(me))};static \u0275cmp=A({type:o,selectors:[["POS-modal-promotion-confirm"]],decls:9,vars:4,consts:[[3,"onOk","config"],[1,"fst-italic","text-danger","mb-3"],[1,"mb-0"]],template:function(e,i){e&1&&(a(0,"modal-material",0),S("onOk",function(){return i.onOk()}),a(1,"content")(2,"div")(3,"h5"),m(4),s(),a(5,"p",1),m(6),s(),a(7,"p",2),m(8),s()()()()),e&2&&(p("config",i.modalConfig),l(4),O(i.selectedPromotion==null?null:i.selectedPromotion.Name),l(2),O(i.selectedPromotion==null?null:i.selectedPromotion.Description),l(2),O(i.data==null?null:i.data.message))},dependencies:[q]})};var bi=class extends Qe{};var co=(i=>(i[i.INTERNAL=1]="INTERNAL",i[i.EKSTERNAL=2]="EKSTERNAL",i[i.EKSTERNALINTERNAL=3]="EKSTERNALINTERNAL",i))(co||{});function To(o,t){if(o&1&&(a(0,"span",8),m(1),y(2,"number"),s()),o&2){let e=d(2);l(),D("-",x(2,1,e.coupon.amount),"%")}}function Eo(o,t){if(o&1&&(a(0,"span",8),m(1),y(2,"number"),s()),o&2){let e=d(2);l(),D(" -",x(2,1,e.coupon.amount)," ")}}function wo(o,t){if(o&1){let e=M();a(0,"button",12),S("click",function(){C(e);let n=d().$implicit,r=d();return _(r.onRemoveCouponDiscount(n))}),m(1," Remove "),s()}}function Ro(o,t){if(o&1){let e=M();a(0,"button",13),S("click",function(){C(e);let n=d().$implicit,r=d();return _(r.onApplyCouponDiscount(n))}),m(1," Apply "),s()}if(o&2){let e=d(2);p("disabled",e.hasAppliedCouponDiscount())}}function No(o,t){if(o&1&&(a(0,"tr")(1,"td"),m(2),s(),a(3,"td"),m(4),s(),a(5,"td",7),m(6),y(7,"number"),s(),a(8,"td",7),h(9,To,3,3,"span",8)(10,Eo,3,3,"span",8),s(),a(11,"td",9),h(12,wo,2,0,"button",10)(13,Ro,2,1,"button",11),s()()),o&2){let e=t.$implicit,i=d();l(2),O(e==null||e.Variant==null?null:e.Variant.Name),l(2),O(e==null||e.Variant==null?null:e.Variant.Code),l(2),O(x(7,5,e.UnitPrice)),l(3),E(i.coupon.Type==i.couponType.DiscountPercentage?9:10),l(3),E((e==null?null:e.CouponDiscount)>0?12:13)}}var Si=class o{constructor(t){this.data=t;this.coupon=this.data.coupon,this.initModalConfig(),this.initEligibleItems()}dialogRef=$(G);config;eligibleItems=pe([]);coupon;couponType=ai;hasAppliedCouponDiscount=pe(!1);initModalConfig(){this.config=new W,this.config.title="Choose Item to Apply Discount",this.config.hideFooter=!0}initEligibleItems(){let t=this.data.coupon?.ListVariantID;t&&(this.eligibleItems.update(()=>this.data.cartItems.filter(i=>t.includes(i.VariantID))),this.hasAppliedCouponDiscount.update(()=>this.eligibleItems().some(e=>e.CouponDiscount>0)))}onApplyCouponDiscount(t){let e=[t];this.hasAppliedCouponDiscount.update(()=>!0),this.dialogRef.close(e)}onRemoveCouponDiscount(t){this.eligibleItems.update(e=>{let i=e.findIndex(n=>n.VariantID===t.VariantID);return i>-1&&(e[i].Discount=0,e[i].CouponDiscount=0),e}),this.hasAppliedCouponDiscount.update(()=>!1)}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||o)(v(me))};static \u0275cmp=A({type:o,selectors:[["app-modal-coupon-selected-item"]],standalone:!0,features:[mt],decls:20,vars:1,consts:[[3,"onCancel","onClose","config"],[1,"container"],[1,"row"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[1,"text-end"],[1,"text-danger"],[1,"text-center"],[1,"btn","btn-sm","btn-danger"],[1,"btn","btn-sm","btn-success",3,"disabled"],[1,"btn","btn-sm","btn-danger",3,"click"],[1,"btn","btn-sm","btn-success",3,"click","disabled"]],template:function(e,i){e&1&&(a(0,"modal-material",0),S("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),a(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"table",4)(6,"thead",5)(7,"tr")(8,"th",6),m(9,"Name"),s(),a(10,"th",6),m(11,"Code"),s(),a(12,"th",6),m(13,"Price"),s(),a(14,"th",6),m(15,"Discount"),s(),b(16,"th",6),s()(),a(17,"tbody"),it(18,No,14,7,"tr",null,tt),s()()()()()()()),e&2&&(p("config",i.config),l(18),nt(i.eligibleItems()))},dependencies:[je,K,ft,q]})};var Dt=class o{constructor(t,e,i,n,r,c){this._httpService=t;this._orderDataService=e;this._userRoleService=i;this.toastr=n;this._invoiceCalculatorService=r;this._posHttpResponseService=c;this.subscribeToObservable()}dialog=$(_e);role;originalRoleData;_coupon;get coupon(){return this._coupon}subscribeToObservable(){this._userRoleService.Data$.subscribe(t=>{this.role=t,f.IsEmpty(this.originalRoleData)&&(this.originalRoleData=Oe(Ke,t))})}RedeemCoupon(t,e,i,n=!0){let r=this._orderDataService.Data?.Order?.CustomerID,c=this._invoiceCalculatorService.Data,u={Code:t,EntityID:this._orderDataService.Data.Order.EntityID,CouponType:i,CustomerID:r,Amount:c,ListVariantID:this.getVariantIdsInCart()},P=this.getApiUrl();this._httpService.post(P,u).subscribe({next:I=>{switch(this._orderDataService.Data.Order.PromotionCoupon=t,this._orderDataService.Data.Order.PromotionNote=e,this._orderDataService.Data.Order.CouponType=i,this.coupon?.Code!=I.Code&&this.resetAppliedCoupon(),I.Type){case 1:this.HandleDiscountPercentage(I,n);break;case 2:this.HandleDiscountAmount(I);break;case 3:this.HandleReturn();break;case 4:this.HandleParkedDeletion();break;case 5:this.HandleFullAccess(),n&&this.toastr.success("You now have Full Access for this Order!","Coupon Applied");break}this._coupon=I,this.orderNote(i,I)},error:I=>{this.resetAppliedCoupon(),this.removeAppliedCoupon()}})}getVariantIdsInCart(){return this._orderDataService.Data.CartItems.map(i=>i.VariantID)}getApiUrl(){let t=this._posHttpResponseService.Data?.AppConfigJSON,e=j.Coupon;return t.CouponRedemptionType==3&&(e=j.InternalEksternalCoupon),e}orderNote(t,e){t==2&&(f.IsNotEmpty(this._orderDataService.Data.Order.Note)?this._orderDataService.Data.Order.Note+=`
3
3
  Coupon TADA - `+e.Notify:this._orderDataService.Data.Order.Note=" Coupon TADA - "+e.Notify)}resetAppliedCoupon(){if(f.IsNotEmpty(this.coupon))switch(this.coupon.Type){case 2:this.HandleDiscountAmount(this.coupon,!0);break;case 1:this.HandleDiscountPercentage(this.coupon,!1,!0);break;case 5:this.resetRoleAfterAppliedCoupon();break;case 4:this.HandleParkedDeletion(!0);break;case 3:this.HandleReturn(!0);break}}resetAppliedCouponDiscount(){if(this.coupon){switch(this.coupon.Type){case 1:this.HandleDiscountPercentage(this._coupon,!1,!0);break;case 2:this.HandleDiscountAmount(this._coupon,!0);break}this.removeAppliedCoupon()}}HandleDiscountPercentage(t,e,i=!1){t.amount>0?t.MaximumDiscount>0?this.applyConfigMaxDiscount(t,i):t.FullPriceProductOnly?this.applyFullPriceDisc(t,e,i):this.applyDiscountPercentage(t,e,i):(this.role.Discount=i?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyFullPriceDisc(t,e,i=!1){let n=this._orderDataService.Data,r=this.filterItemWithDisc(n.CartItems),c=this.filterItemWithCouponDisc(n.CartItems);if(i)c.length>0?(n.CartItems=this.resetItemsDisc(n.CartItems),this._orderDataService.pushNewValue()):this.applyDiscountPercentage(t,!1,i);else if(r.length>0){let u=this.filterItemWithoutDisc(n.CartItems);u.length>0?this.applyConfigItemsScope(t,u).subscribe(P=>{let I=this.applyItemsDisc(P,t);n.CartItems=this.updateCartItems(I),this._orderDataService.pushNewValue(n),this.showToastr(t)}):(this.removeAppliedCoupon(),e=!1,this._orderDataService.pushNewValue())}else this.applyDiscountPercentage(t,!0,i)}updateCartItems(t){return this._orderDataService.Data.CartItems.map(n=>{let r=t.find(c=>c.VariantID==n.VariantID);return r||n})}filterItemWithDisc(t){return t.filter(i=>i.Discount>0||i.DiscountAmount>0||i.Price!=i?.Variant?.UnitPrice||f.IsNotEmpty(i.PriceBookID)||i.PriceTypeID==2)}filterItemWithoutDisc(t){return t.filter(i=>this.itemConditionFullPriceOnly(i))}filterItemWithCouponDisc(t){return t.filter(i=>i.CouponDiscount>0)}applyDiscountPercentage(t,e,i=!1){let n=this._orderDataService.Data.Order.CustomerDiscountRate,r=t.amount;if(i){let c=this._orderDataService.Data;this._orderDataService.Data.Order.Discount=0,c.CartItems=this.resetItemsDisc(c.CartItems),this._orderDataService.pushNewValue(c)}else r>=n?t.ListVariantID?.length>0?this.applyDiscountRequiredItems(t):(this._orderDataService.Data.Order.Discount=t.amount,this._orderDataService.pushNewValue(),this.showToastr(t)):(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.resetAppliedCouponDiscount())}applyDiscountRequiredItems(t){let i=this._orderDataService.Data.CartItems.filter(n=>t.ListVariantID.includes(n.VariantID));this.applyConfigItemsScope(t,i).subscribe(n=>{let r=n.map(u=>(u.Discount=t.amount,u.CouponDiscount=t.amount,u)),c=this.updateCartItems(r);this._orderDataService.Data.CartItems=c,this._orderDataService.pushNewValue(),this.showToastr(t)})}showToastr(t){t.Notify&&this.toastr.success(t.Notify,"Coupon Applied")}applyConfigMaxDiscount(t,e=!1){let i=this._orderDataService.Data.CartItems;t.FullPriceProductOnly&&(i=i.filter(n=>this.itemConditionFullPriceOnly(n))),this.applyConfigItemsScope(t,i).subscribe(n=>{this.applyMaxDiscount(t,n,e)})}applyConfigItemsScope(t,e){return t.MultipleItemRequirementDiscount==1?this.dialog.open(Si,{data:{coupon:t,cartItems:e}}).afterClosed().pipe(fe(n=>{let u=this._orderDataService.Data.CartItems.some(P=>P.CouponDiscount>0);!n&&!u&&this.resetAppliedCouponDiscount()}),oe(n=>!!n)):ue(e)}applyMaxDiscount(t,e,i){let n=this._invoiceCalculatorService.calculateGrossTotal(e),r=this._orderDataService.Data,c=n*t.amount/100,u=t.MaximumDiscount;if(c>=u)r.Order.DiscountAmount=i?0:u;else{r.Order.DiscountAmount==u&&(r.Order.DiscountAmount=0);let P=i?this.resetItemsDisc(e):this.applyItemsDisc(e,t);r.CartItems=this.updateCartItems(P)}this._orderDataService.pushNewValue(r)}resetItemsDisc(t){return t=t.map(e=>(e.CouponDiscount>0&&(e.Discount=0,e.DiscountAmount=0,e.CouponDiscount=0),e)),t}applyItemsDisc(t,e){return e.ListVariantID?.length>0?t=this.applyDiscByVariant(t,e):t=t.map(i=>(this.itemConditionFullPriceOnly(i)&&(i.Discount=e.amount,i.CouponDiscount=e.amount),i)),t}applyDiscByVariant(t,e){return t=t.map(i=>(e.ListVariantID.find(r=>r==i.VariantID)&&this.itemConditionFullPriceOnly(i)&&(i.Discount=e.amount,i.CouponDiscount=e.amount),i)),t}itemConditionFullPriceOnly(t){return(t.Discount==0||t.CouponDiscount>0)&&t.DiscountAmount==0&&t.Price==t?.Variant?.UnitPrice&&f.IsEmpty(t.PriceBookID)}HandleDiscountAmount(t,e=!1){t.amount>0?(t.ListVariantID.length>0?this.applyDiscountInItem(t,e):(this._orderDataService.Data.Order.DiscountAmount=e?0:t.amount,this._orderDataService.pushNewValue()),this.resetCustomerPoint(e)):(this.role.Discount=e?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyDiscountInItem(t,e=!1){let i=this._orderDataService.Data;if(e)i.CartItems=this.resetItemsDisc(i.CartItems);else{let r=i.CartItems.filter(c=>t.ListVariantID.includes(c.VariantID));this.applyConfigItemsScope(t,r).subscribe(c=>{let u=c.map(P=>(P.DiscountAmount=t.amount,P.CouponDiscount=t.amount,P));i.CartItems=this.updateCartItems(u),this._orderDataService.pushNewValue(i),this.showToastr(t)})}}resetCustomerPoint(t){if(!t){let e=this._orderDataService.Data;e.Order.PointUsed=0}}HandleReturn(t=!1){this.role.Return=t?this.originalRoleData.Return:!0,this._userRoleService.pushNewValue(this.role)}HandleParkedDeletion(t=!1){this.role.ParkedDeletionAuthorized=t?this.originalRoleData.ParkedDeletionAuthorized:!0,this._userRoleService.pushNewValue(this.role),this.toastr.success("You Have Access to delete park and delete item when retrieve!","Coupon Applied")}HandleFullAccess(){this.role.UnitPriceEditor=!0,this.role.Discount=!0,this.role.Return=!0,this.role.Tax=!1,this.role.NumberEditor=!0,this.role.DateEditor=!0,this.role.PricebookSelector=!0,this._userRoleService.pushNewValue(this.role)}resetRoleAfterAppliedCoupon(){let t=Oe(Ke,this.originalRoleData);this.role.UnitPriceEditor=t.UnitPriceEditor,this.role.Discount=t.Discount,this.role.Return=t.Return,this.role.Tax=t.Tax,this.role.NumberEditor=t.NumberEditor,this.role.DateEditor=t.DateEditor,this.role.PricebookSelector=t.PricebookSelector,this.role.ParkedDeletionAuthorized=t.ParkedDeletionAuthorized,this._userRoleService.pushNewValue(this.role)}removeAppliedCoupon(){let t=this._orderDataService.Data;t.Order.PromotionCoupon=null,t.Order.PromotionNote=null,this._coupon=null,this._orderDataService.pushNewValue()}static \u0275fac=function(e){return new(e||o)(g(Ee),g(N),g(ke),g(k),g(ee),g(Q))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};var Mt=class o{constructor(t,e,i,n,r,c,u,P,I){this.variantService=t;this._posService=e;this._orderDataService=i;this.toastr=n;this._orderProcessorService=r;this._customerHttpService=c;this.promotionCouponService=u;this.userRoleService=P;this.decimalPipe=I;this.subscribeToObservable()}salesOrderData;appConfigJson;entityID;audio=new Audio;subscribeToObservable(){this._posService.Data$.subscribe(t=>{this.appConfigJson=t.AppConfigJSON}),this._orderDataService.Data$.subscribe(t=>{this.salesOrderData=t,this.entityID=t.Order.EntityID})}addCartItemById(t,e,i=!0){return new Promise((n,r)=>{this.variantService.findVariantByID(t,this.entityID,i).then(c=>{this.createNewCartItem(c,e),n(c)}).catch(c=>{r(c)})})}addCartItemByCode(t){return new Promise((e,i)=>{let n=this.appConfigJson.ModuleSell.DigitalScale;n.Digit>0&&f.IsNotEmpty(n.Regex)&&t.length==n.Digit?this.parseDigitalScaleBarcodeWithRegex(t,n).then(c=>{c||(this.toastr.info("Matching Regex Rule to Barcode","Digital Scale"),this.findVariantByCode(t).then(u=>e(u)).catch(u=>i(u)))}):this.findVariantByCode(t).then(c=>e(c)).catch(c=>i(c))})}findVariantByCode(t){let e=this.appConfigJson.ModuleSell.BarcodeSerialEnabled;return new Promise((i,n)=>{this.variantService.findVariantByCode(t,this.entityID,e).then(r=>{i(r),this.createNewCartItem(r)}).catch(r=>{this.playBellRing(),n(r)})})}addItemBySerial(t){this.variantService.findVariantBySerial(t,this.entityID).subscribe(e=>{let i=this.salesOrderData.CartItems;if(i.length>0){let n,r=[],c=i.findIndex(u=>u.Variant.ID==e.ID);r=[],c!==-1?(n=i[c].Serial?.findIndex(u=>u.Number==t),r=[...i[c].Serial?i[c].Serial:[]],n==-1?(r.push({Number:t,Quantity:1}),i[c].Quantity=r.length):r.length>0?r[n].Quantity+=1:(r=[{Number:t,Quantity:1}],this.addNewSerials(e,t)),i[c].Serial=[...r],i[c].Quantity=i[c].calculateSerialQty(),this.updateCartItem(i[c],c)):this.addNewSerials(e,t)}else this.addNewSerials(e,t)})}addNewSerials(t,e){t.Serial=[{Number:e,Quantity:1}],this.createNewCartItem(t)}playBellRing(){this.audio.src="//res.cloudinary.com/pos/video/upload/v1659947782/POS/Music/bell_ring.mp3",this.audio.load(),this.audio.play()}updateCartItem(t,e){this.salesOrderData.CartItems[e]=t,this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint(),this.reApplyPromotionCoupon()}deleteCartItem(t){this.salesOrderData.CartItems=this.salesOrderData.CartItems.filter(e=>e!==t),this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint(),this.reApplyPromotionCoupon()}parseDigitalScaleBarcodeWithRegex(t,e){return new Promise(i=>{let n=this.appConfigJson.ModuleSell.BarcodeSerialEnabled,r=new RegExp(e.Regex),c=t.match(r);if(f.IsNotEmpty(c)){let u=c[1],P=parseFloat(c[2]);P=P/e.QuantityDivider,this.variantService.findVariantByCode(u,this.entityID,n).then(I=>{this.createNewCartItem(I,null,P),i(!0)}).catch(()=>{i(!1)})}else i(!1)})}createNewCartItem(t,e,i){let n=new Qe,r=this.appConfigJson.ModuleSell.ProductNotes.CopyProductDescription,c=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;n.patchByVariant(t,r,c),n=this.applyReward(n,e),f.IsEmpty(e)&&(n=this.applyPriceBook(n)),this.validateCartItem(n)&&(n.Quantity=i||n.Quantity,e?.PromotionType==2?this.handlingPromotionQuantity(n):this.pushNewItemToArray(n,n.PromotionGift),this.applyCustomerPoint()),this.addAvailableComponent(n)}applyCustomerPoint(){let t=this.salesOrderData.Order.CustomerID,e=f.IsEmpty(t);this._orderProcessorService.reedemPointToDiscount(e)}handlingPromotionQuantity(t){let e=Oe(Qe,this.salesOrderData.CartItems),i=e.findIndex(n=>n.VariantID==t.VariantID&&n.PromotionGift);i!==-1?e[i].Quantity+=t.Quantity?t.Quantity:1:e=[...e,t],this.salesOrderData.CartItems=e,this._orderDataService.pushNewValue(this.salesOrderData)}applyPromotionProduct(t){let e=t.Variant.DiscountAmount;return e&&(t.Price=t.UnitPriceOriginal-e),t}applyReward(t,e){if(e){let i=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;t.Discount=e.Discount,t.Price=e.OriginalPrice;let n=e.OriginalPrice-e.UnitPrice;t.Price=t.UnitPriceOriginal-n,t.UnitPrice=t.UnitPriceOriginal-n,t.PromotionGift=!0,t.PromotionID=e.PromotionID,t.Quantity=e.Quantity?e.Quantity:1,t.PriceTypeID=3,t.Cost+=e.ExtraCost,t.UnitCost+=e.ExtraCost,t.PriceNote=e.PromotionName,i&&(t.Note=e.PromotionName)}return t}addAvailableComponent(t){let e=t.Price!=0,i=this.appConfigJson.ModuleSell.SellProductComponentDefaultPrice,n=t.Variant;if(n.Component!=null&&n.Component.length>0)for(let r of n.Component){let c=new bi;c.patchByVariant(r),c.Quantity=t.Quantity*r.Quantity,e&&!i&&(r.UnitPrice=0),c.Price=r.UnitPrice,this.pushNewItemToArray(c)}}pushNewItemToArray(t,e=!1){let i=this.salesOrderData.CartItems.findIndex(n=>n.VariantID==t.VariantID);if(t=this.applyPromotionProduct(t),i==-1||e)this.salesOrderData.CartItems.push(t);else{let n=this.appConfigJson.ModuleSell.QuickKey.NewRowBehaviour;n==2?this.salesOrderData.CartItems.push(t):n==1?this._orderProcessorService.Data.posState==4?this.salesOrderData.CartItems.push(t):this.addingQuantityItem(i,t):this.addingQuantityItem(i,t)}this._orderDataService.pushNewValue(this.salesOrderData),this.reApplyPromotionCoupon()}reApplyPromotionCoupon(){let t=this.salesOrderData.Order.PromotionCoupon,e=this.salesOrderData.Order.CouponType,i=this.salesOrderData.Order.PromotionNote;f.IsNotEmpty(t)&&this.promotionCouponService.RedeemCoupon(t,i,e,!1)}addingQuantityItem(t,e){let i=this.salesOrderData.CartItems.filter(u=>u.VariantID==e.VariantID),n=i.length,r=i.find(u=>!u.PromotionGift);this.salesOrderData.CartItems[t].PromotionGift&&n==1?this.salesOrderData.CartItems.push(e):(r.Quantity+=e.Quantity,r=this.applyPromotionProduct(r)),r&&(r=this.applyPriceBook(r))}validateCartItem(t){return t.Variant.CategoryTypeID==-1?(this.toastr.info(t.Variant.Name+" cannot be sold, check Category "+t.Variant.CategoryName+" settings","info"),!1):!(!this.validatePriceMinimum(t)||!this.validateSerialItem(t))}validatePriceMinimum(t){let e=!0,i=this.userRoleService.Data.PriceMinimum,n=this.appConfigJson.ModuleSell.ProductDialog.PriceMinimumTypeID;if(i){let r=0;switch(n){case 1:r=t.UnitPrice;break;case 2:r=t.UnitCost;break;case 3:r=t.UnitPriceMinimum;break}if(t.Price<r){e=!1;let c=f.StringFormat("You have no right to sell this item lower than {0}",this.decimalPipe.transform(r));alert(c)}}return e}validateSerialItem(t){let e=!0;if(t?.Serial?.length>0&&t.Variant.TypeID==4&&t.Quantity>0){let i=0;t?.Serial?.forEach(n=>{i+=n.Quantity}),i!=t.Quantity&&(this.toastr.error("Serial must be equal with the quantity","Error"),e=!1)}return e}applyPriceBook(t){let e=t.Variant.PriceBook!=null?t.Variant.PriceBook:[],i=this.findCustomerPricebook(e);if(e&&e.length!==0){let n=e.sort(function(r,c){return c.MinimumQuantity-r.MinimumQuantity}).filter(r=>t.Quantity>=r.MinimumQuantity&&r.MinimumQuantity!=0);n.length>0||f.IsNotEmpty(i)?f.IsNotEmpty(i)?t=this.applyPricebookToItem(t,i):t=this.applyPricebookToItem(t,n[0]):t=this.resetAppliedPricebook(t)}return t}resetAppliedPricebook(t){let e=this.appConfigJson.ModuleSell.ProductNotes,n=(t?.Variant?.PriceBook).find(r=>r.ID==t.PriceBookID);return f.IsNotEmpty(n)&&(t.Discount=t.Variant.PriceDiscount,t.PriceBookID=f.GuidEmpty,t.Price=t.Variant.UnitPrice,t.UnitPrice=t.Variant.UnitPrice,t.PriceTypeID=0,t=this.applyPromotionProduct(t),e.CopyPromotionName?(t.Note=t.Variant.PriceNote,t.PriceNote=t.Variant.PriceNote):(t.Note="",t.PriceNote="")),t}applyPricebookToItem(t,e){let i=this.appConfigJson.ModuleSell.Pricebook.PricebookVisible;return t.Discount=e.PriceDiscount,t.PriceNote=e.Name,t.UnitPrice=e.UnitPrice,t.PriceBookID=e.ID,t.Price=e.UnitPrice,t.PriceTypeID=2,i?t.Note=e.Name:t.Note="",t}findCustomerPricebook(t=[]){let e=this._customerHttpService.Data,i;return e&&(i=t.find(n=>n.ID==e.PricebookID)),i}static \u0275fac=function(e){return new(e||o)(g(jn),g(Q),g(N),g(k),g(Ue),g(Re),g(Dt),g(ke),g(K))};static \u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"})};function ko(o,t){if(o&1&&(a(0,"div",9)(1,"div",4),b(2,"input",10),s()()),o&2){let e=d();l(2),p("formControl",e.searchControl)}}function Vo(o,t){if(o&1){let e=M();a(0,"tr")(1,"td"),m(2),s(),a(3,"td"),m(4),s(),a(5,"td",11),m(6),y(7,"number"),s(),a(8,"td",11),m(9),y(10,"number"),s(),a(11,"td",12)(12,"button",13),S("click",function(){let n=C(e).$implicit,r=d();return _(r.onSelectReward(n))}),m(13,"Apply"),s()()()}if(o&2){let e=t.$implicit;l(2),O(e.VariantName),l(2),O(e.VariantCode),l(2),O(x(7,4,e.OriginalPrice)),l(3),O(x(10,6,e.UnitPrice))}}var Oi=class o{constructor(t,e,i,n,r,c){this._dialogRef=t;this._matDialog=e;this._shoppingCartService=i;this._promotionEventService=n;this._toastr=r;this.data=c;this.selectedPromotion=this._promotionEventService.selectedPromotion}modalConfig=new W;selectedPromotion;rewards$;searchControl=new Ge;ngOnInit(){this.modalConfig.title="Select a Reward",this.modalConfig.hideFooter=!0,this.initRewards(!0)}initRewards(t){this.rewards$=this.searchControl.valueChanges.pipe(Jt(""),lt(t?0:500),xe(),ie(e=>{let i;return i=ue(this.data.rewards).pipe(Z(n=>n.filter(r=>this.findKeywordInValue(e,r?.VariantCode)||this.findKeywordInValue(e,r?.VariantName)))),t=!0,i}))}findKeywordInValue(t,e){return e?.toUpperCase()?.indexOf(t?.toUpperCase())>-1}onSelectReward(t){t.PromotionType=this.data.promotion.TypeID,this._shoppingCartService.addCartItemById(t.VariantID,t,!0).then(()=>{this._matDialog.closeAll(),this._promotionEventService.pushNewValue(this._promotionEventService.Data),this.showToastAppliedPromo()})}showToastAppliedPromo(){this._toastr.success("Applied "+this.selectedPromotion.Name+" to order!","Applied successfully!")}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||o)(v(G),v(_e),v(Mt),v(Se),v(k),v(me))};static \u0275cmp=A({type:o,selectors:[["POS-modal-select-item"]],decls:22,vars:9,consts:[[3,"onCancel","onClose","config"],[1,"container"],["class","row mb-3",4,"ngIf"],[1,"row"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[4,"ngFor","ngForOf"],[1,"row","mb-3"],["type","text","placeholder","Type to filter reward",1,"form-control",3,"formControl"],[1,"text-end"],[1,"text-center"],[1,"btn","btn-sm","btn-success",3,"click"]],template:function(e,i){e&1&&(a(0,"modal-material",0),S("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),a(1,"content")(2,"div",1),h(3,ko,3,1,"div",2),a(4,"div",3)(5,"div",4)(6,"table",5)(7,"thead",6)(8,"tr")(9,"th",7),m(10,"Name"),s(),a(11,"th",7),m(12,"Code"),s(),a(13,"th",7),m(14,"Price"),s(),a(15,"th",7),m(16,"Promo"),s(),b(17,"th",7),s()(),a(18,"tbody"),h(19,Vo,14,8,"tr",8),y(20,"async"),y(21,"sortBy"),s()()()()()()()),e&2&&(p("config",i.modalConfig),l(3),p("ngIf",(i.data==null||i.data.rewards==null?null:i.data.rewards.length)>5),l(16),p("ngForOf",pt(21,5,x(20,3,i.rewards$),"desc","VariantCode")))},dependencies:[le,ce,he,Ce,gt,q,dt,K,Ct],styles:[".table-scroll[_ngcontent-%COMP%]{max-height:400px;overflow-y:auto}table[_ngcontent-%COMP%]{max-width:600px!important;overflow-x:hidden}"]})};function Fo(o,t){if(o&1&&(J(0),a(1,"div",13)(2,"div",7),b(3,"input",14),s()(),z()),o&2){let e=d();l(3),p("formControl",e.searchCtrl)}}function Lo(o,t){o&1&&(J(0),a(1,"th",15),m(2,"Qty"),s(),z())}function Ho(o,t){o&1&&b(0,"th",10)}function Bo(o,t){if(o&1){let e=M();J(0),a(1,"td")(2,"input",17),L("ngModelChange",function(n){C(e);let r=d().$implicit;return F(r.Quantity,n)||(r.Quantity=n),_(n)}),s()(),z()}if(o&2){let e=d().$implicit;l(2),V("ngModel",e.Quantity)}}function jo(o,t){if(o&1){let e=M();a(0,"td",18)(1,"button",19),S("click",function(){C(e);let n=d().$implicit,r=d();return _(r.onApplyReward(n))}),m(2,"Apply"),s()()}}function Qo(o,t){if(o&1&&(a(0,"tr")(1,"td"),m(2),s(),a(3,"td"),m(4),s(),a(5,"td",16),m(6),y(7,"number"),s(),a(8,"td",16),m(9),y(10,"number"),s(),h(11,Bo,3,1,"ng-container",11)(12,jo,3,0,"ng-template",null,1,Be),s()),o&2){let e=t.$implicit,i=B(13),n=d();l(2),O(e.VariantName),l(2),O(e.VariantCode),l(2),O(x(7,6,e.OriginalPrice)),l(3),O(x(10,8,e.UnitPrice)),l(2),p("ngIf",n.rewardQuantity>1)("ngIfElse",i)}}var Di=class o{constructor(t,e,i,n,r,c){this.data=t;this.shoppingCartService=e;this.promotionEventService=i;this.dialogRef=n;this.matDialog=r;this.toastr=c;this.searchCtrl=new Ge,this.rewardQuantity=t.rewardQuantity,this.sourceRewards=[...t.rewards]}modalConfig;rewards$;rewardQuantity;rewards;sourceRewards=[];searchCtrl;ngOnInit(){this.initModalConfig(),this.initSearchCtrl(!0)}initModalConfig(){this.modalConfig=new W,this.modalConfig.title="Select a Reward",this.rewardQuantity<2&&(this.modalConfig.hideFooter=!0)}initSearchCtrl(t){this.rewards$=this.searchCtrl.valueChanges.pipe(Jt(""),lt(t?0:500),xe(),ie(e=>{let i;return i=ue(this.sourceRewards).pipe(Z(n=>(n.length===1&&(n[0].Quantity=this.rewardQuantity),n)),Z(n=>n.filter(r=>this.findKeywordInValue(e,r?.VariantCode)||this.findKeywordInValue(e,r?.VariantName)))),t=!1,i}),fe(e=>{this.rewards=e}))}findKeywordInValue(t,e){return e?.toUpperCase()?.indexOf(t.toUpperCase())>-1}onApplyReward(t){this.addRewardToShoppingCart(t)}onClose(){this.dialogRef.close()}onOk(){this.calculateRewardQty()>this.rewardQuantity?this.toastr.warning("Product reward exceeds the maximum amount earned","Warning"):[...this.rewards].filter(i=>i.Quantity>0).forEach(i=>{this.addRewardToShoppingCart(i)})}calculateRewardQty(){let t=0;return this.rewards.forEach(e=>{t+=e.Quantity?e.Quantity:0}),t}addRewardToShoppingCart(t){t.PromotionType=this.data.promotion.TypeID,this.shoppingCartService.addCartItemById(t.VariantID,t,!0).then(()=>{this.matDialog.closeAll(),this.promotionEventService.pushNewValue(this.promotionEventService.Data)})}static \u0275fac=function(e){return new(e||o)(v(me),v(Mt),v(Se),v(G),v(_e),v(k))};static \u0275cmp=A({type:o,selectors:[["app-modal-quantity-reward"]],decls:27,vars:12,consts:[["APPLY",""],["APPLY_BUTTON",""],[3,"onCancel","onOk","onClose","config"],[1,"ms-3"],[1,"container"],[4,"ngIf"],[1,"row","table-scroll"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[4,"ngIf","ngIfElse"],[4,"ngFor","ngForOf"],[1,"row","mb-3"],["type","text","placeholder","Type to filter reward",1,"form-control",3,"formControl"],["scope","col",2,"width","66px"],[1,"text-end"],["type","text","autoNum","","min","0",1,"form-control",3,"ngModelChange","ngModel"],[1,"text-center"],[1,"btn","btn-sm","btn-success",3,"click"]],template:function(e,i){if(e&1){let n=M();a(0,"modal-material",2),S("onCancel",function(){return C(n),_(i.onClose())})("onOk",function(){return C(n),_(i.onOk())})("onClose",function(){return C(n),_(i.onClose())}),a(1,"header")(2,"small",3),m(3),s()(),a(4,"content")(5,"div",4),h(6,Fo,4,1,"ng-container",5),a(7,"div",6)(8,"div",7)(9,"table",8)(10,"thead",9)(11,"tr")(12,"th",10),m(13,"Name"),s(),a(14,"th",10),m(15,"Code"),s(),a(16,"th",10),m(17,"Price"),s(),a(18,"th",10),m(19,"Promo"),s(),h(20,Lo,3,0,"ng-container",11)(21,Ho,1,0,"ng-template",null,0,Be),s()(),a(23,"tbody"),h(24,Qo,14,10,"tr",12),y(25,"async"),y(26,"sortBy"),s()()()()()()()}if(e&2){let n=B(22);p("config",i.modalConfig),l(3),D(" ( ",i.rewardQuantity," products reward ) "),l(3),p("ngIf",(i.sourceRewards==null?null:i.sourceRewards.length)>5),l(14),p("ngIf",i.rewardQuantity>1)("ngIfElse",n),l(4),p("ngForOf",pt(26,8,x(25,6,i.rewards$),"desc","VariantCode"))}},dependencies:[le,ce,he,Ce,Te,gt,q,ht,dt,K,Ct]})};var Se=class o{constructor(t,e,i,n,r,c,u,P,I){this._orderDataService=t;this._outletService=e;this._invoiceCalculatorService=i;this._dialog=n;this._httpService=r;this._posService=c;this._toastr=u;this._signalrService=P;this.decimalPipe=I;this.previousQuantity=0,this.previousTotalEligible=0,this.subscribeNotification(),this._posService.Data$.subscribe(H=>{this.taxes=H.Taxes}),this._outletService.Data$.subscribe(H=>{this.loadPromotions(H.Promotion)}),this._orderDataService.Data$.pipe(oe(H=>{this.salesOrderData=H;let ae=this.calculateOrderReward(H.getRewards()),Bi=this.calculateOrderReward(this.previousRewards);return this.previousQuantity!=H.TotalQuantity||Bi<ae||this.isRestroreOrder}),lt(100)).subscribe(H=>{this.isRestroreOrder=!1,this.checkQtyPromotion(),this.applyQuantityPromotion(),this.previousRewards=[...H.getRewards()]}),this._invoiceCalculatorService.Data$.subscribe(H=>{this.checkEligiblePromotionWithMinSpend()})}_Data=new se([]);get Data(){return this._Data.getValue()}Data$=this._Data.asObservable();selectedPromotion=null;onClickToastPromo=new Me;previousQuantity;salesOrderData;orderDataBeforePromotion;taxes=[];previousTotalEligible;previousRewards=[];isRestroreOrder=!1;calculateOrderReward(t){let e=0;return t.length>0&&(e=t.map(i=>i.Quantity).reduce((i,n)=>i+n)),e}checkQtyPromotion(){let t=this._orderDataService.Data;this.checkEligibleQtyPromotion(t.CartItems),this.checkEligibleTierPromotion(t.CartItems),this.previousQuantity=t.TotalQuantity}subscribeNotification(){this._signalrService.OnPromotionEventChange.pipe(Pe(),ie(()=>{let t=this._outletService.Data?.RegisterID;return this.getPromotions(t)})).subscribe(()=>{this._toastr.info("Promotion Event Updated","Promotion Update")})}getPromotions(t){return this._httpService.get(j.GetListPromotion,[{key:"RegisterID",value:t}]).pipe(fe(e=>{this.loadPromotions(e)}))}loadPromotions(t){let e=this.getPromotionDesc(t);this.pushNewValue(e),this.checkQtyPromotion(),this.checkEligiblePromotionWithMinSpend()}pushNewValue(t){this.showToastEligiblePromotion(),this._Data.next(t)}checkSelectedPromotionRequirement(t){this.selectedPromotion!=null&&this.selectedPromotion.TypeID==t&&this.Data.find(i=>i.ID===this.selectedPromotion.ID)?.Eligible===!1&&(this._dialog.open(yi,{id:"modal-promotion-confirm",data:{message:"Order will be restored to before the promotion is applied"},disableClose:!0}),this.isRestroreOrder=!0)}restoreOrder(){this._orderDataService.pushNewValue(this.orderDataBeforePromotion),this.selectedPromotion=null}getPromotionDesc(t=[]){return t?.map(i=>(i.Description=this.generatePromotionDesc(i),i))}checkEligiblePromotionWithMinSpend(){let t=this._invoiceCalculatorService.Data,e=this.Data?.filter(n=>(n.TypeID===1||n.TypeID==3)&&!this.checkExpiredPromotion(n)).map(n=>(t>=n.MinimumAmount?n.Eligible=!0:n.Eligible=!1,n)),i=this.mappingEligiblePromotion(e);this.pushNewValue(i),this.checkSelectedPromotionRequirement(1),this.checkSelectedPromotionRequirement(3)}checkEligibleQtyPromotion(t){let e=0,i=this.Data?.filter(r=>r.TypeID===2&&!this.checkExpiredPromotion(r)).map(r=>(r.Eligible=!1,r.ListVariant.length>0?(e=this.getQuantityByRequirementType(t,"variant",r.ListVariant),e>=r.MinimumAmount&&(r.Eligible=!0)):r.ListCategory.length>0?(e=this.getQuantityByRequirementType(t,"category",r.ListCategory),e>=r.MinimumAmount&&(r.Eligible=!0)):this.salesOrderData.TotalQuantity>=r.MinimumAmount&&(r.Eligible=!0),r)),n=this.mappingEligiblePromotion(i);this.pushNewValue(n)}checkEligibleTierPromotion(t){let e,i=this.Data?.filter(r=>r.TypeID===5&&!this.checkExpiredPromotion(r)).map(r=>(r.Eligible=!1,r.ListVariant.length>0?e=this.getQuantityByRequirementType(t,"variant",r.ListVariant):r.ListCategory.length>0?e=this.getQuantityByRequirementType(t,"category",r.ListCategory):e=this.salesOrderData.TotalQuantity,r.PromotionTieredQuantity.forEach(c=>{e>=c.Quantity&&(r.Eligible=!0)}),r)),n=this.mappingEligiblePromotion(i);this.pushNewValue(n)}getQuantityByRequirementType(t,e,i){let n=0,r;return e=="variant"?t.forEach(c=>{r=i.findIndex(u=>u.ID===c.VariantID),r!==-1&&(n+=c.Quantity)}):t.forEach(c=>{c.Variant&&(r=i.findIndex(u=>u.ID===c.Variant.CategoryID),r!==-1&&(n+=c.Quantity))}),n}mappingEligiblePromotion(t=[]){let e=this.Data;if(t?.length>0){let i;e=this.Data?.map(n=>(i=t.findIndex(r=>r.ID==n.ID),i!==-1&&(n=t[i]),n))}return e}checkExpiredPromotion(t){let e=new Date,i=new Date(t.StartDate),r=(f.IsEmpty(t.StartTime)?"00:00:00":t.StartTime).split(":").map(I=>parseInt(I));i.setHours(r[0],r[1],r[2]);let c=new Date(t.ExpirationDate),P=(f.IsEmpty(t.EndTime)?"23:59:59":t.EndTime).split(":").map(I=>parseInt(I));return c.setHours(P[0],P[1],P[2]),!(e.getTime()>=i.getTime()&&e.getTime()<=c.getTime())}showToastEligiblePromotion(){let t=this.getTotalEligiblePromotion(),e=f.IsNotEmpty(this.salesOrderData.Order.ID);this.previousTotalEligible!==t&&t>0&&!e&&this._toastr.info(t+" promotion(s) can be applied!","Promo available!",{timeOut:2e4}).onTap.pipe(Ve(1)).subscribe(()=>{this.onClickToastPromo.next(!0)}),this.previousTotalEligible=t}getTotalEligiblePromotion(){return this.Data?.filter(e=>e.Eligible).length}generatePromotionDesc(t){let e="";switch(t.TypeID){case 2:e+="Minimum "+this.decimalPipe.transform(t.MinimumAmount)+" ",t.ListVariant.length>0?(e=e+" piece of ",e+=this.generateItemListDescription(t.ListVariant)):t.ListCategory.length>0?(e+="from category ",e+=this.generateItemListDescription(t.ListCategory)):e+="items";break;case 1:e+="Minimum spend Rp. "+this.decimalPipe.transform(t.MinimumAmount);break;case 3:e+=`Apply
4
4
  ${t.Discount1!==0?"discount1 = "+t.Discount1+"%":""}
@@ -1 +1 @@
1
- import{a}from"./chunk-GRH4VW2G.js";import{J as o}from"./chunk-Z67YUEMZ.js";var s=class extends a{constructor(t,e,r,n){super(t);this.httpService=e;this.formDataAPI=r;this.route=n;let p=this.route.snapshot.queryParams;this.menuData$.pipe(o(()=>this.httpService.post(`/api/${this.formDataAPI}`,p))).subscribe(i=>{this.data=i,this.postBindForm(i)})}data={};get formData(){return this.data.Form}set formData(t){this.data.Form=t}get options(){return this.data.Options?this.data.Options:{}}get Roles(){return this.data.Roles?this.data.Roles:{}}postBindForm(t){}onSubmit(t,e=!1){this.preSubmitForm(),this.httpService.post(`/api/${t}`,this.formData).subscribe({next:r=>{this.onSubmitSuccess(r)},error:r=>{this.onSubmitError(r)}})}compare(t,e,r){return(t<e?-1:1)*(r?1:-1)}preSubmitForm(){}onSubmitSuccess(t){}onSubmitError(t){}};export{s as a};
1
+ import{a}from"./chunk-VA365TFG.js";import{J as o}from"./chunk-Z67YUEMZ.js";var s=class extends a{constructor(t,e,r,n){super(t);this.httpService=e;this.formDataAPI=r;this.route=n;let p=this.route.snapshot.queryParams;this.menuData$.pipe(o(()=>this.httpService.post(`/api/${this.formDataAPI}`,p))).subscribe(i=>{this.data=i,this.postBindForm(i)})}data={};get formData(){return this.data.Form}set formData(t){this.data.Form=t}get options(){return this.data.Options?this.data.Options:{}}get Roles(){return this.data.Roles?this.data.Roles:{}}postBindForm(t){}onSubmit(t,e=!1){this.preSubmitForm(),this.httpService.post(`/api/${t}`,this.formData).subscribe({next:r=>{this.onSubmitSuccess(r)},error:r=>{this.onSubmitError(r)}})}compare(t,e,r){return(t<e?-1:1)*(r?1:-1)}preSubmitForm(){}onSubmitSuccess(t){}onSubmitError(t){}};export{s as a};
@@ -1 +1 @@
1
- import{c as f}from"./chunk-23QREBOQ.js";import{a as m}from"./chunk-TNPR2ZN6.js";import{a as u}from"./chunk-G5LPH6YH.js";import{I as c,Td as v,ha as s,hd as h,k as n,ka as e,ld as l}from"./chunk-Z67YUEMZ.js";var d=class o{constructor(t,r,p,i){this.httpService=t;this.authService=r;this.httpClientService=p;this.toastr=i}port=window.location.href.split("localhost:")[1]?.split("/")[0];hostURL=t=>m.production?t:`https://localhost:${this.port}${t}`;configure2FA(t){return this.httpService.post("/api/Authentication/Setup_2FA",t)}validateCode(t,r){let p=this.authService.loginResponse?.Token,i=new h({"Content-Type":"application/json","Cache-Control":"no-cache"});i=i.append("Authorization","Bearer "+p);let S={ValidationCode:t,UserID:r};return this.httpClientService.post(this.hostURL("/api/Login/Validate_2FA "),S,{headers:i}).pipe(c(a=>(this.toastr.error(a?.error?.Message,"Error - "+a.status),n)))}disableTwoFactorAuthentication(){let t={enabled:!1};return this.httpService.post("/api/Authentication/Setup_2FA",t)}static \u0275fac=function(r){return new(r||o)(e(u),e(f),e(l),e(v))};static \u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"})};export{d as a};
1
+ import{c as f}from"./chunk-YNV7BDA6.js";import{a as m}from"./chunk-62A2XAJV.js";import{a as u}from"./chunk-G5LPH6YH.js";import{I as c,Td as v,ha as s,hd as h,k as n,ka as e,ld as l}from"./chunk-Z67YUEMZ.js";var d=class o{constructor(t,r,p,i){this.httpService=t;this.authService=r;this.httpClientService=p;this.toastr=i}port=window.location.href.split("localhost:")[1]?.split("/")[0];hostURL=t=>m.production?t:`https://localhost:${this.port}${t}`;configure2FA(t){return this.httpService.post("/api/Authentication/Setup_2FA",t)}validateCode(t,r){let p=this.authService.loginResponse?.Token,i=new h({"Content-Type":"application/json","Cache-Control":"no-cache"});i=i.append("Authorization","Bearer "+p);let S={ValidationCode:t,UserID:r};return this.httpClientService.post(this.hostURL("/api/Login/Validate_2FA "),S,{headers:i}).pipe(c(a=>(this.toastr.error(a?.error?.Message,"Error - "+a.status),n)))}disableTwoFactorAuthentication(){let t={enabled:!1};return this.httpService.post("/api/Authentication/Setup_2FA",t)}static \u0275fac=function(r){return new(r||o)(e(u),e(f),e(l),e(v))};static \u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"})};export{d as a};
@@ -1 +1 @@
1
- import{a as X}from"./chunk-L4NSMSGV.js";import{d as U}from"./chunk-7DXDN3TE.js";import{b as Q}from"./chunk-Z4DPTPVV.js";import{a as A,b as q}from"./chunk-NSEV3YZR.js";import{a as H}from"./chunk-Y6X24YGJ.js";import{a as K}from"./chunk-A7P7JJBX.js";import{g as J}from"./chunk-O6JLTNXI.js";import{b as z}from"./chunk-GRH4VW2G.js";import{m as G}from"./chunk-HIV2H34O.js";import{h as O,o as N}from"./chunk-BAI43IKV.js";import{d as j}from"./chunk-ZSPCD25F.js";import{a as B}from"./chunk-G5LPH6YH.js";import{$b as v,Ab as a,Bb as r,Cb as L,Gb as C,Jb as h,Lb as l,Md as M,Pd as P,Sc as b,Tc as W,Td as k,Wa as m,Xa as x,_b as o,_c as V,ac as F,dc as _,ec as S,fc as u,gb as T,jb as f,lc as E,nb as c,oc as R,pa as w,rc as y,tc as D,wa as s,xa as d,xc as I}from"./chunk-Z67YUEMZ.js";var Z=(p,g,e,n,t,i)=>({LogisticServiceID:p,EntityID:g,From:e,To:n,StartTime:t,EndTime:i}),$=(p,g,e)=>({From:p,To:g,LogisticsServiceID:e});function ee(p,g){if(p&1){let e=C();a(0,"button",14),h("click",function(){s(e);let t=l(2);return d(t.openExportModal())}),L(1,"i",15),o(2," Export "),r()}}function te(p,g){if(p&1){let e=C();a(0,"div",16)(1,"h6"),o(2,"Outlet"),r(),a(3,"outlet-selector",17),u("ngModelChange",function(t){s(e);let i=l(2);return S(i.pageData.Filter.EntityID,t)||(i.pageData.Filter.EntityID=t),d(t)}),r(),a(4,"h6"),o(5,"From"),r(),a(6,"datepicker",18),u("dateChange",function(t){s(e);let i=l(2);return S(i.pageData.Filter.From,t)||(i.pageData.Filter.From=t),d(t)}),r(),a(7,"h6"),o(8,"To"),r(),a(9,"datepicker",19),u("dateChange",function(t){s(e);let i=l(2);return S(i.pageData.Filter.To,t)||(i.pageData.Filter.To=t),d(t)}),r(),a(10,"h6"),o(11,"Time"),r(),a(12,"div",20)(13,"div",21)(14,"app-timepicker",22),u("timeChange",function(t){s(e);let i=l(2);return S(i.pageData.Filter.StartTime,t)||(i.pageData.Filter.StartTime=t),d(t)}),r()(),a(15,"div",21)(16,"app-timepicker",22),u("timeChange",function(t){s(e);let i=l(2);return S(i.pageData.Filter.EndTime,t)||(i.pageData.Filter.EndTime=t),d(t)}),r()()()()}if(p&2){let e=l(2);m(3),c("accessType",2),_("ngModel",e.pageData.Filter.EntityID),c("outlets",e.pageData.Options==null?null:e.pageData.Options.Entities),m(3),_("date",e.pageData.Filter.From),m(3),_("date",e.pageData.Filter.To),m(5),c("fullWidth",!0),_("time",e.pageData.Filter.StartTime),m(2),c("fullWidth",!0),_("time",e.pageData.Filter.EndTime)}}function ie(p,g){if(p&1&&(a(0,"tr")(1,"td"),o(2),r(),a(3,"td"),o(4),r(),a(5,"td",23)(6,"a",24),y(7,"date"),y(8,"date"),o(9),r()(),a(10,"td",23)(11,"a",25),y(12,"date"),y(13,"date"),o(14),r()(),a(15,"td",23),o(16),r()()),p&2){let e=g.$implicit,n=g.index,t=l(2);m(2),v(n+1),m(2),v(e.Name),m(2),c("queryParams",R(19,Z,e.ID,t.pageData.Filter.EntityID,D(7,7,t.pageData.Filter.From,"yyyy-MM-dd"),D(8,10,t.pageData.Filter.To,"yyyy-MM-dd"),t.pageData.Filter.StartTime,t.pageData.Filter.EndTime)),m(3),F(" ",e.Trans," "),m(2),c("queryParams",E(26,$,D(12,13,t.pageData.Filter.From,"yyyy-MM-dd"),D(13,16,t.pageData.Filter.To,"yyyy-MM-dd"),e.ID)),m(3),F(" ",e.Qty," "),m(2),v(e.Weight)}}function ae(p,g){if(p&1){let e=C();a(0,"mainpanel-cmp",2),u("textChange",function(t){s(e);let i=l();return S(i.pageData.Filter.Name,t)||(i.pageData.Filter.Name=t),d(t)}),h("onSubmit",function(){s(e);let t=l();return d(t.searchFromPageOne())}),u("filterChange",function(t){s(e);let i=l();return S(i.pageData.Filter,t)||(i.pageData.Filter=t),d(t)}),a(1,"actions"),f(2,ee,3,0,"button",3),a(3,"a",4),o(4," View Detail "),r()(),a(5,"filters"),f(6,te,17,9,"ng-template",null,0,I),r(),a(8,"content")(9,"div",5)(10,"table",6),h("matSortChange",function(t){s(e);let i=l();return d(i.sortData(t))}),a(11,"thead",7)(12,"tr")(13,"th",8),o(14,"No"),r(),a(15,"th"),o(16,"Logistics Service Name"),r(),a(17,"th",9),o(18,"Trans"),r(),a(19,"th",10),o(20,"Qty"),r(),a(21,"th",11),o(22,"Weight "),a(23,"small",12),o(24,"(gram)"),r()()()(),a(25,"tbody"),f(26,ie,17,30,"tr",13),r()()()()()}if(p&2){let e=l();c("pageData",e.menuData),_("text",e.pageData.Filter.Name),c("isFilterOnDropdown",!1),_("filter",e.pageData.Filter),m(2),c("ngIf",e.roleService.global.Export),m(24),c("ngForOf",e.data.Data)}}var Y=class p extends H{constructor(e,n,t,i,ne,re){super(e,n,"Report/GetLogisticsService","ReportLoader/GetLogisticsService",t,i);this.matDialog=ne;this.roleService=re}originalData=[];postInit(e){this.originalData=e.Data}sortData(e){let n=this.data.Data.slice();if(!e.active||e.direction===""){this.data.Data=this.originalData;return}this.data.Data=n.sort((t,i)=>this.compare(t[e.active],i[e.active],e.direction==="asc"))}openExportModal(){this.matDialog.open(Q,{data:{title:"Logistic Service",exportTypes:[{ID:"ReportExport/LogisticService",Value:"Default",FileName:"Logistics Service"}],filterExport:this.pageData.Filter,getAllDataLengthAPI:"",pagination:!1}})}onChangeTime(e,n){let t=e.toTimeString().split(" ")[0].slice(0,5);this.pageData.Filter[n]=t}static \u0275fac=function(n){return new(n||p)(x(z),x(B),x(k),x(M),x(G),x(j))};static \u0275cmp=w({type:p,selectors:[["POS-logistics-service-report"]],features:[T],decls:1,vars:1,consts:[["pageFilterTemplate",""],[3,"pageData","text","isFilterOnDropdown","filter","textChange","onSubmit","filterChange",4,"ngIf"],[3,"textChange","onSubmit","filterChange","pageData","text","isFilterOnDropdown","filter"],["class","btn btn-outline-secondary me-3",3,"click",4,"ngIf"],["routerLink","/menu/Logistics/Report/Outbound/Logistics_Service/Detail",1,"btn","btn-outline-secondary"],[1,"container-fluid","mt-5"],["id","tableGrid","matSort","",1,"table",3,"matSortChange"],[1,"thead-light","sticky-top-thead"],[2,"width","50px"],["mat-sort-header","Trans",1,"align-right"],["mat-sort-header","Qty",1,"align-right"],["mat-sort-header","Weight",1,"align-right",2,"width","180px"],[1,"fst-italic","text-dark"],[4,"ngFor","ngForOf"],[1,"btn","btn-outline-secondary","me-3",3,"click"],["aria-hidden","true",1,"fa-solid","fa-upload"],[1,"dialog-filter"],["appendTo","body","bindLabel","Name","bindValue","ID","placeholder","Choose Outlet",3,"ngModelChange","accessType","ngModel","outlets"],["name","From",3,"dateChange","date"],["name","To",3,"dateChange","date"],[1,"row"],[1,"col-6"],[3,"timeChange","fullWidth","time"],[1,"text-end"],["routerLink","/menu/Logistics/Report/Outbound/Logistics_Service/Detail",3,"queryParams"],["routerLink","/menu/Reports/Sales_Report/Standard/Products_Sold",3,"queryParams"]],template:function(n,t){n&1&&f(0,ae,27,6,"mainpanel-cmp",1),n&2&&c("ngIf",t.data)},dependencies:[b,W,P,O,N,J,U,A,q,X,K,V]})};export{Y as a};
1
+ import{a as X}from"./chunk-L4NSMSGV.js";import{d as U}from"./chunk-PCBIJHIM.js";import{b as Q}from"./chunk-PLINQ2AL.js";import{a as A,b as q}from"./chunk-NSEV3YZR.js";import{a as H}from"./chunk-UUW7PTL3.js";import{a as K}from"./chunk-A7P7JJBX.js";import{g as J}from"./chunk-VICSPN46.js";import{b as z}from"./chunk-VA365TFG.js";import{m as G}from"./chunk-5LWAX44Z.js";import{h as O,o as N}from"./chunk-BAI43IKV.js";import{d as j}from"./chunk-ZSPCD25F.js";import{a as B}from"./chunk-G5LPH6YH.js";import{$b as v,Ab as a,Bb as r,Cb as L,Gb as C,Jb as h,Lb as l,Md as M,Pd as P,Sc as b,Tc as W,Td as k,Wa as m,Xa as x,_b as o,_c as V,ac as F,dc as _,ec as S,fc as u,gb as T,jb as f,lc as E,nb as c,oc as R,pa as w,rc as y,tc as D,wa as s,xa as d,xc as I}from"./chunk-Z67YUEMZ.js";var Z=(p,g,e,n,t,i)=>({LogisticServiceID:p,EntityID:g,From:e,To:n,StartTime:t,EndTime:i}),$=(p,g,e)=>({From:p,To:g,LogisticsServiceID:e});function ee(p,g){if(p&1){let e=C();a(0,"button",14),h("click",function(){s(e);let t=l(2);return d(t.openExportModal())}),L(1,"i",15),o(2," Export "),r()}}function te(p,g){if(p&1){let e=C();a(0,"div",16)(1,"h6"),o(2,"Outlet"),r(),a(3,"outlet-selector",17),u("ngModelChange",function(t){s(e);let i=l(2);return S(i.pageData.Filter.EntityID,t)||(i.pageData.Filter.EntityID=t),d(t)}),r(),a(4,"h6"),o(5,"From"),r(),a(6,"datepicker",18),u("dateChange",function(t){s(e);let i=l(2);return S(i.pageData.Filter.From,t)||(i.pageData.Filter.From=t),d(t)}),r(),a(7,"h6"),o(8,"To"),r(),a(9,"datepicker",19),u("dateChange",function(t){s(e);let i=l(2);return S(i.pageData.Filter.To,t)||(i.pageData.Filter.To=t),d(t)}),r(),a(10,"h6"),o(11,"Time"),r(),a(12,"div",20)(13,"div",21)(14,"app-timepicker",22),u("timeChange",function(t){s(e);let i=l(2);return S(i.pageData.Filter.StartTime,t)||(i.pageData.Filter.StartTime=t),d(t)}),r()(),a(15,"div",21)(16,"app-timepicker",22),u("timeChange",function(t){s(e);let i=l(2);return S(i.pageData.Filter.EndTime,t)||(i.pageData.Filter.EndTime=t),d(t)}),r()()()()}if(p&2){let e=l(2);m(3),c("accessType",2),_("ngModel",e.pageData.Filter.EntityID),c("outlets",e.pageData.Options==null?null:e.pageData.Options.Entities),m(3),_("date",e.pageData.Filter.From),m(3),_("date",e.pageData.Filter.To),m(5),c("fullWidth",!0),_("time",e.pageData.Filter.StartTime),m(2),c("fullWidth",!0),_("time",e.pageData.Filter.EndTime)}}function ie(p,g){if(p&1&&(a(0,"tr")(1,"td"),o(2),r(),a(3,"td"),o(4),r(),a(5,"td",23)(6,"a",24),y(7,"date"),y(8,"date"),o(9),r()(),a(10,"td",23)(11,"a",25),y(12,"date"),y(13,"date"),o(14),r()(),a(15,"td",23),o(16),r()()),p&2){let e=g.$implicit,n=g.index,t=l(2);m(2),v(n+1),m(2),v(e.Name),m(2),c("queryParams",R(19,Z,e.ID,t.pageData.Filter.EntityID,D(7,7,t.pageData.Filter.From,"yyyy-MM-dd"),D(8,10,t.pageData.Filter.To,"yyyy-MM-dd"),t.pageData.Filter.StartTime,t.pageData.Filter.EndTime)),m(3),F(" ",e.Trans," "),m(2),c("queryParams",E(26,$,D(12,13,t.pageData.Filter.From,"yyyy-MM-dd"),D(13,16,t.pageData.Filter.To,"yyyy-MM-dd"),e.ID)),m(3),F(" ",e.Qty," "),m(2),v(e.Weight)}}function ae(p,g){if(p&1){let e=C();a(0,"mainpanel-cmp",2),u("textChange",function(t){s(e);let i=l();return S(i.pageData.Filter.Name,t)||(i.pageData.Filter.Name=t),d(t)}),h("onSubmit",function(){s(e);let t=l();return d(t.searchFromPageOne())}),u("filterChange",function(t){s(e);let i=l();return S(i.pageData.Filter,t)||(i.pageData.Filter=t),d(t)}),a(1,"actions"),f(2,ee,3,0,"button",3),a(3,"a",4),o(4," View Detail "),r()(),a(5,"filters"),f(6,te,17,9,"ng-template",null,0,I),r(),a(8,"content")(9,"div",5)(10,"table",6),h("matSortChange",function(t){s(e);let i=l();return d(i.sortData(t))}),a(11,"thead",7)(12,"tr")(13,"th",8),o(14,"No"),r(),a(15,"th"),o(16,"Logistics Service Name"),r(),a(17,"th",9),o(18,"Trans"),r(),a(19,"th",10),o(20,"Qty"),r(),a(21,"th",11),o(22,"Weight "),a(23,"small",12),o(24,"(gram)"),r()()()(),a(25,"tbody"),f(26,ie,17,30,"tr",13),r()()()()()}if(p&2){let e=l();c("pageData",e.menuData),_("text",e.pageData.Filter.Name),c("isFilterOnDropdown",!1),_("filter",e.pageData.Filter),m(2),c("ngIf",e.roleService.global.Export),m(24),c("ngForOf",e.data.Data)}}var Y=class p extends H{constructor(e,n,t,i,ne,re){super(e,n,"Report/GetLogisticsService","ReportLoader/GetLogisticsService",t,i);this.matDialog=ne;this.roleService=re}originalData=[];postInit(e){this.originalData=e.Data}sortData(e){let n=this.data.Data.slice();if(!e.active||e.direction===""){this.data.Data=this.originalData;return}this.data.Data=n.sort((t,i)=>this.compare(t[e.active],i[e.active],e.direction==="asc"))}openExportModal(){this.matDialog.open(Q,{data:{title:"Logistic Service",exportTypes:[{ID:"ReportExport/LogisticService",Value:"Default",FileName:"Logistics Service"}],filterExport:this.pageData.Filter,getAllDataLengthAPI:"",pagination:!1}})}onChangeTime(e,n){let t=e.toTimeString().split(" ")[0].slice(0,5);this.pageData.Filter[n]=t}static \u0275fac=function(n){return new(n||p)(x(z),x(B),x(k),x(M),x(G),x(j))};static \u0275cmp=w({type:p,selectors:[["POS-logistics-service-report"]],features:[T],decls:1,vars:1,consts:[["pageFilterTemplate",""],[3,"pageData","text","isFilterOnDropdown","filter","textChange","onSubmit","filterChange",4,"ngIf"],[3,"textChange","onSubmit","filterChange","pageData","text","isFilterOnDropdown","filter"],["class","btn btn-outline-secondary me-3",3,"click",4,"ngIf"],["routerLink","/menu/Logistics/Report/Outbound/Logistics_Service/Detail",1,"btn","btn-outline-secondary"],[1,"container-fluid","mt-5"],["id","tableGrid","matSort","",1,"table",3,"matSortChange"],[1,"thead-light","sticky-top-thead"],[2,"width","50px"],["mat-sort-header","Trans",1,"align-right"],["mat-sort-header","Qty",1,"align-right"],["mat-sort-header","Weight",1,"align-right",2,"width","180px"],[1,"fst-italic","text-dark"],[4,"ngFor","ngForOf"],[1,"btn","btn-outline-secondary","me-3",3,"click"],["aria-hidden","true",1,"fa-solid","fa-upload"],[1,"dialog-filter"],["appendTo","body","bindLabel","Name","bindValue","ID","placeholder","Choose Outlet",3,"ngModelChange","accessType","ngModel","outlets"],["name","From",3,"dateChange","date"],["name","To",3,"dateChange","date"],[1,"row"],[1,"col-6"],[3,"timeChange","fullWidth","time"],[1,"text-end"],["routerLink","/menu/Logistics/Report/Outbound/Logistics_Service/Detail",3,"queryParams"],["routerLink","/menu/Reports/Sales_Report/Standard/Products_Sold",3,"queryParams"]],template:function(n,t){n&1&&f(0,ae,27,6,"mainpanel-cmp",1),n&2&&c("ngIf",t.data)},dependencies:[b,W,P,O,N,J,U,A,q,X,K,V]})};export{Y as a};