dealpos 25.43.1 → 25.44.0

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 (96) hide show
  1. package/browser/{chunk-2JIKUIDL.js → chunk-2FWXO7SV.js} +1 -1
  2. package/browser/{chunk-57MXTPFO.js → chunk-2HUEFC2T.js} +1 -1
  3. package/browser/{chunk-C6IQAVJS.js → chunk-2KCCP5UQ.js} +1 -1
  4. package/browser/{chunk-VENGWIVD.js → chunk-2PX7ZCAH.js} +2 -2
  5. package/browser/{chunk-Z37RWBOK.js → chunk-35WLGG74.js} +1 -1
  6. package/browser/{chunk-OLSCBS7E.js → chunk-3PTKHKTZ.js} +1 -1
  7. package/browser/{chunk-XSFHNUQ6.js → chunk-476U7URX.js} +2 -2
  8. package/browser/{chunk-3GMOIUSS.js → chunk-4TW7XHFP.js} +1 -1
  9. package/browser/{chunk-NO3WSZS5.js → chunk-6ABP4TP7.js} +1 -1
  10. package/browser/{chunk-NFOTQGFN.js → chunk-6PWFGFWQ.js} +1 -1
  11. package/browser/chunk-6SNK3MMW.js +1 -0
  12. package/browser/{chunk-6RZ53266.js → chunk-7CMBWKFF.js} +1 -1
  13. package/browser/chunk-7J36T25H.js +1 -0
  14. package/browser/{chunk-H6GRYEQ4.js → chunk-7NGYBSTA.js} +2 -2
  15. package/browser/{chunk-Y2OQ4XO7.js → chunk-7V7QIPRV.js} +1 -1
  16. package/browser/{chunk-A2TEU2OJ.js → chunk-A4HMT7IS.js} +1 -1
  17. package/browser/{chunk-I6HHFYJH.js → chunk-AJLKESQV.js} +1 -1
  18. package/browser/{chunk-JVMOM4H4.js → chunk-ARKU4MG5.js} +1 -1
  19. package/browser/{chunk-BYKM6B3Q.js → chunk-BJBJJUF7.js} +1 -1
  20. package/browser/{chunk-Z2CJVOIM.js → chunk-BMMZ2W3C.js} +1 -1
  21. package/browser/{chunk-GFLMSLNA.js → chunk-BMW3GOBJ.js} +1 -1
  22. package/browser/{chunk-4CNWLAOB.js → chunk-BSQJETW6.js} +1 -1
  23. package/browser/chunk-BX366TSG.js +1 -0
  24. package/browser/chunk-C2W6JXEB.js +3 -0
  25. package/browser/{chunk-JMXQLXVT.js → chunk-CN4B6FUG.js} +1 -1
  26. package/browser/{chunk-DOQHHRXL.js → chunk-CXTL5YYJ.js} +2 -2
  27. package/browser/{chunk-T5WB2M55.js → chunk-DEVO5OTP.js} +1 -1
  28. package/browser/{chunk-NI5NXM2W.js → chunk-EVWNBQBC.js} +1 -1
  29. package/browser/{chunk-RN5G3YLF.js → chunk-F4F5V5CZ.js} +2 -2
  30. package/browser/{chunk-U5PGKEGA.js → chunk-FA4ADELT.js} +1 -1
  31. package/browser/{chunk-UBUK5KM7.js → chunk-FHMDB7MQ.js} +1 -1
  32. package/browser/{chunk-VYI363VS.js → chunk-G6USNHW7.js} +1 -1
  33. package/browser/{chunk-H3BDFRHN.js → chunk-GBQSPBVZ.js} +1 -1
  34. package/browser/{chunk-IFZ2NAV2.js → chunk-GV2PUDWZ.js} +2 -2
  35. package/browser/{chunk-NGCYLGR7.js → chunk-GYNHYLZQ.js} +1 -1
  36. package/browser/{chunk-UGXAYAI3.js → chunk-HCSPFPLE.js} +1 -1
  37. package/browser/chunk-HKZQN5TX.js +14 -0
  38. package/browser/{chunk-CDKC2IEJ.js → chunk-IHFA5AEL.js} +1 -1
  39. package/browser/{chunk-2GLNGDED.js → chunk-IOJ4YVHD.js} +1 -1
  40. package/browser/{chunk-LIBVAZGG.js → chunk-IQQGAD2W.js} +1 -1
  41. package/browser/{chunk-3IKQFILS.js → chunk-JUTITMC7.js} +2 -2
  42. package/browser/{chunk-WQJI7XHD.js → chunk-JXYRDQVO.js} +1 -1
  43. package/browser/{chunk-OV75G3U6.js → chunk-K4LAZCXZ.js} +1 -1
  44. package/browser/{chunk-PQETJOPQ.js → chunk-KKRF45KI.js} +1 -1
  45. package/browser/{chunk-4D4MCKGG.js → chunk-KXCEORNJ.js} +1 -1
  46. package/browser/{chunk-GXORILER.js → chunk-LI2NYODY.js} +1 -1
  47. package/browser/{chunk-CNAUUTLV.js → chunk-LLQVL4JL.js} +1 -1
  48. package/browser/{chunk-ZRLTY3JK.js → chunk-LVYO35LX.js} +1 -1
  49. package/browser/{chunk-52ZEPEED.js → chunk-M5PJHCX4.js} +1 -1
  50. package/browser/{chunk-JS46U7DQ.js → chunk-NRYWKVQ2.js} +1 -1
  51. package/browser/{chunk-SGMOAMW4.js → chunk-ODOWAGLZ.js} +1 -1
  52. package/browser/{chunk-BCG3SRBR.js → chunk-PANAC2WS.js} +1 -1
  53. package/browser/{chunk-6YAUV6CS.js → chunk-PQDYHLJ2.js} +1 -1
  54. package/browser/{chunk-NQOLXD3A.js → chunk-QHGWF2RX.js} +1 -1
  55. package/browser/{chunk-TDQR33OS.js → chunk-QVPSWY5E.js} +1 -1
  56. package/browser/{chunk-YVHW6R5M.js → chunk-QXU66IK7.js} +1 -1
  57. package/browser/{chunk-E6PWTYNB.js → chunk-RABEENVP.js} +1 -1
  58. package/browser/{chunk-YWN3ZCUG.js → chunk-RF2OEHPO.js} +1 -1
  59. package/browser/{chunk-W32SMIPG.js → chunk-RMOQAAKS.js} +1 -1
  60. package/browser/{chunk-UDLO26TH.js → chunk-RW4LIELV.js} +1 -1
  61. package/browser/{chunk-P4CJOEI6.js → chunk-S22XRS4J.js} +1 -1
  62. package/browser/chunk-S2QC3PGR.js +112 -0
  63. package/browser/chunk-S5ZMZ6ZK.js +1 -0
  64. package/browser/{chunk-U4L3DUPD.js → chunk-SJPYABFR.js} +1 -1
  65. package/browser/{chunk-LNYS472E.js → chunk-SMZ4VMLX.js} +1 -1
  66. package/browser/{chunk-RCY7OLTB.js → chunk-SVV5ZTGZ.js} +1 -1
  67. package/browser/{chunk-3Z3OMRKK.js → chunk-T6WJAS3H.js} +1 -1
  68. package/browser/{chunk-PVJW7F4C.js → chunk-TGFYFTBV.js} +1 -1
  69. package/browser/{chunk-5EQYYGRS.js → chunk-TMADIQOR.js} +1 -1
  70. package/browser/{chunk-6HRNGZFH.js → chunk-UMDNTO5M.js} +1 -1
  71. package/browser/{chunk-7N5UGQ7Y.js → chunk-USUWU5NE.js} +1 -1
  72. package/browser/{chunk-ZT4JJ72K.js → chunk-V26H2UIF.js} +1 -1
  73. package/browser/{chunk-NHKBCTZ6.js → chunk-V5ZK5RT7.js} +14 -14
  74. package/browser/{chunk-UP6OSHOB.js → chunk-VIJLHA7Q.js} +1 -1
  75. package/browser/{chunk-XFE22V65.js → chunk-VIPGZJM3.js} +1 -1
  76. package/browser/{chunk-W7ENV5BI.js → chunk-W5U5OOLP.js} +2 -2
  77. package/browser/{chunk-RQMKNBVM.js → chunk-WAMC5CEY.js} +1 -1
  78. package/browser/{chunk-3XLXCEOJ.js → chunk-WLGAEGPV.js} +1 -1
  79. package/browser/{chunk-DE6YZETL.js → chunk-WQDFMYT7.js} +1 -1
  80. package/browser/{chunk-CRD6NHJP.js → chunk-WQDUNDSA.js} +1 -1
  81. package/browser/{chunk-WRHHRT4D.js → chunk-XDINGYNX.js} +1 -1
  82. package/browser/{chunk-52JGOESX.js → chunk-XPWSJXFB.js} +1 -1
  83. package/browser/{chunk-JYLR5O5Q.js → chunk-XQ6JBIMX.js} +1 -1
  84. package/browser/chunk-YEAPJ2OC.js +1 -0
  85. package/browser/index.html +2 -2
  86. package/browser/{main-CSOK2PD4.js → main-GH4LELYQ.js} +2 -2
  87. package/browser/{styles-SJXE22QD.css → styles-NK7HCBOK.css} +1 -1
  88. package/package.json +1 -1
  89. package/browser/chunk-B353J3HM.js +0 -1
  90. package/browser/chunk-BO3347ID.js +0 -1
  91. package/browser/chunk-EY5ARDBV.js +0 -112
  92. package/browser/chunk-GNWOJUDL.js +0 -3
  93. package/browser/chunk-JD2KU6EZ.js +0 -1
  94. package/browser/chunk-KAVRH6F5.js +0 -1
  95. package/browser/chunk-SRYUX7SP.js +0 -1
  96. package/browser/chunk-XFH6XZNJ.js +0 -14
@@ -1,4 +1,4 @@
1
- import{a as $t,b as Jt}from"./chunk-JFLT7NX3.js";import{a as bo}from"./chunk-YXCPHYC5.js";import{a as No}from"./chunk-QUHI6RHC.js";import{e as Do}from"./chunk-FIHWJAIR.js";import{a as Pi}from"./chunk-W3VF2RCW.js";import{a as So}from"./chunk-OKIBXXRJ.js";import{a as he,b as Re,e as Eo}from"./chunk-PD445FIT.js";import{a as _o,b as wo,c as Ro}from"./chunk-SRRURHLT.js";import{a as yo}from"./chunk-SGFSKIUE.js";import{a as ko}from"./chunk-5M3JINH2.js";import{b as Sn,c as vo}from"./chunk-C2KD7R6L.js";import{a as io}from"./chunk-YNDNTAII.js";import{a as Dt}from"./chunk-4SKJU2FQ.js";import{a as Po}from"./chunk-RFO7MTFT.js";import{a as Oi,b as Di,c as Mi}from"./chunk-4PPRFE5H.js";import{b as Oo}from"./chunk-O2QTP22K.js";import{a as Ao}from"./chunk-M3HHWYKD.js";import{a as Ye}from"./chunk-J6U6UYNI.js";import{a as Si,b as De}from"./chunk-AEHOR4RJ.js";import{a as yn,b as qt,c as bn}from"./chunk-7IDMO3VZ.js";import{a as Xe,b as pt,c as pe}from"./chunk-HT35KHLT.js";import{b as Co}from"./chunk-DAIHPIA2.js";import{a as ho}from"./chunk-BXQFYW4R.js";import{g as fo}from"./chunk-4UYZJCFI.js";import{b as To}from"./chunk-Z65FTA7V.js";import{d as Io}from"./chunk-HOM424UE.js";import{a as xo}from"./chunk-IAZFUBFX.js";import{a as Mo}from"./chunk-MPSML3FA.js";import{d as bi}from"./chunk-GIDGCFLX.js";import{p as oo}from"./chunk-H3OZSV6V.js";import{d as no}from"./chunk-VZEPVRCY.js";import{h as ro}from"./chunk-MFCXEITE.js";import{a as so,c as Pt}from"./chunk-MUJ6277G.js";import{B as uo,C as ie,D as Se,G as go,u as ee,v as te,w as St}from"./chunk-H7F34T25.js";import{b as vi,c as Gt}from"./chunk-JOXTERIM.js";import{F as Ot,N as yi,O as j,g as lo,n as _i,o as co,q as mo,t as po}from"./chunk-TSIYPTYI.js";import{d as bt,e as ao}from"./chunk-XYB3YDKL.js";import{a as rt}from"./chunk-7VKFVS7K.js";import{a as ui,c as gi}from"./chunk-ZVDY66SR.js";import{a as Z,b as to,e as X,f as fe,g as we}from"./chunk-3YKVLHZG.js";import{a as me}from"./chunk-2FWFPV5I.js";import{A as Xn,B as eo,F as hi,c as Ie,e as fi,h as be,i as $n,k as Jn,l as Ze,n as zn,o as Te,p as Yn,s as yt,x as Kn,y as Zn}from"./chunk-RVXZOIFQ.js";import{a as h,d as Ci}from"./chunk-ZZGSAFGO.js";import{a as qn}from"./chunk-TDQR33OS.js";import{$ as ai,$a as l,$b as Wt,$c as Ln,Ac as M,Bc as K,Cc as _t,Db as w,E as ce,Eb as it,Fc as xe,Gb as nt,Hb as ot,I as tt,Ia as Ct,Ib as a,Ja as jt,Jb as s,Kb as _,Lb as U,M as ht,Ma as E,Mb as W,N as je,Nb as di,Ob as T,Pc as oe,Q as Ve,Qb as b,Qd as Un,Rb as d,Rd as Wn,Td as Gn,Va as $e,Vd as V,Wa as mt,Wc as Le,Xa as Nn,Y as Fe,Yc as ye,Yd as ge,Zb as Qt,Zc as se,_b as Ut,_c as Fn,aa as Y,ad as Bn,b as ni,bd as Hn,cd as Je,d as Oe,da as Me,db as S,dc as q,e as _e,ec as m,ed as ze,fa as ae,fc as D,gc as O,gd as $,hc as vt,ib as li,ic as kn,ja as x,jc as L,jd as le,k as gt,ka as si,kb as N,kc as A,lb as ci,lc as B,ma as g,n as Rn,na as I,o as Ae,p as ft,q as oi,qb as f,r as ri,rc as H,sc as Qe,t as J,td as jn,u as qe,ub as mi,uc as Vn,v as En,va as C,vb as p,wa as v,wb as An,xd as Qn,zb as pi,zc as y}from"./chunk-UXRO4UFY.js";import{a as ti,h as Ke,j as ii}from"./chunk-7DCB7DB2.js";var Ue=class{constructor(e){this.roleService=e;e&&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;_ContactsCreate;_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._ContactsCreate=this.roleService.contact.Create,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(e){this._CouponInputLock=e}get Retrieve(){return this._Retrieve}get DateEditor(){return this._DateEditor}set DateEditor(e){this._DateEditor=e}get NumberEditor(){return this._NumberEditor}set NumberEditor(e){this._NumberEditor=e}get PriceVisible(){return this._PriceVisible}get UnitPriceEditor(){return this._UnitPriceEditor}set UnitPriceEditor(e){this._UnitPriceEditor=e}get PricebookSelector(){return this._PricebookSelector}set PricebookSelector(e){this._PricebookSelector=e}get Cost(){return this._Cost}get Return(){return this._Return}set Return(e){this._Return=e}get Discount(){return this._Discount}set Discount(e){this._Discount=e}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(e){this._Tax=e}get DeleteItem(){return this._DeleteItem}set DeleteItem(e){this._DeleteItem=e}get BundlingPrice(){return this._BundlingPrice}get Email(){return this._EmailRestriction}get ParkedDeletionAuthorized(){return this._ParkedDeletionAuthorized}set ParkedDeletionAuthorized(e){this._ParkedDeletionAuthorized=e}get SellEditor(){return this._SellEditor}get PrepaidPackageCreate(){return this._PrepaidPackageCreate}get Order(){return this._Order}get Reprint(){return this._Reprint}get Contacts(){return this._Contacts}get ContactsCreate(){return this._ContactsCreate}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 zt=class{DeliveryEntityID;Type;NewOrderID;constructor(){this.DeliveryEntityID="",this.Type=3}};var xi=class{Type;Amount;Notification;ApplyToProduct;Requirement};var G=class{Order;Invoice;Shipping;Action;Payments;Items;CartItems;Promotion;ContactName;SplitParkLabel;get cartQuantity(){let e=0;for(let t of this.CartItems)e+=t.Quantity;return e}constructor(){this.Order=new Sn,this.Invoice=new qt,this.Shipping=new bn,this.Action=new zt,this.Payments=Array(),this.Items=Array(),this.CartItems=Array(),this.ContactName=""}get TotalPaidAmount(){let e=0;return this.Payments.forEach(t=>{e+=t.PaidAmount}),e}get RedeemableAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID!=1);return this.GetAmountByCart(e)}get TotalQuantity(){let e=0;return this.CartItems.forEach(t=>{t.PromotionGift||(e+=t.Quantity)}),e}get CashOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==1);return this.GetAmountByCart(e)}get PointOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==2);return this.GetAmountByCart(e)}get PrepaidPackageItem(){return this.CartItems.filter(t=>t.Variant.TypeID==10)}GetAmountByCart(e){let t=0;return e.forEach(i=>{t+=i.Total}),t=t*(100-this.Order.Discount)/100,t=t*(100-this.Order.Discount2)/100,t}getRewards(){return this.CartItems.filter(t=>t.PromotionGift)}};Ke([Xe(()=>Sn)],G.prototype,"Order",2),Ke([Xe(()=>qt)],G.prototype,"Invoice",2),Ke([Xe(()=>bn)],G.prototype,"Shipping",2),Ke([Xe(()=>zt)],G.prototype,"Action",2),Ke([Xe(()=>Ye)],G.prototype,"Payments",2),Ke([Xe(()=>Si)],G.prototype,"Items",2),Ke([Xe(()=>De)],G.prototype,"CartItems",2),Ke([Xe(()=>xi)],G.prototype,"Promotion",2);var Ii=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 Mt=class n{constructor(e,t,i,o){this.httpService=e;this._localDataService=t;this._onlineStatusService=i;this._toastrService=o;this._onlineStatusService.getOnlineStatus$().subscribe(r=>{this.isOnline=r})}_Data=new _e(null);Data$=this._Data.pipe(Ve(),ce(e=>e!==null));isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}getSalesOrderPrint(e){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:e})}submitOrder(e,t){let i=this.generatePOSDataForSubmission(e,this.isOnline);if(this.isOnline)return this.submitOnline(i).pipe(this.handleTimeOutError(i));if(t.ModuleSell.EnableOfflineTransaction)return this._localDataService.syncOrder(i).pipe(J(()=>this.generateCompleteData(i)));this._toastrService.warning("Offline order is not Supported!","Info!")}uploadOfflineOrder(e){return this._localDataService.uploadSingleOrder(e).pipe(tt(t=>t?.message?.includes("objectStore does not exists")?this.submitOnline(e):ft(()=>t)))}submitOnline(e){return this.httpService.post(j.SubmitOrder,e,qn.pos.submitOrderTimeout)}handleTimeOutError(e){return ni(tt(t=>{if(t instanceof ri||t?.name=="TimeoutError"){let i=this.generateCompleteData(e);this.pushNewValue(i)}throw t}))}generatePOSDataForSubmission(e,t=!0){let i=Object.assign(new G,e);i.Items=[],i.Order.CustomerID==null&&(i.Order.CustomerID=h.GuidEmpty),i.Order.SalesID==null&&(i.Order.SalesID=h.GuidEmpty);let o=1;i.Payments=i.Payments.map(c=>(c.Date=i.Order.Date,c.Index=o,o++,delete c.TypeID,c));let r=1;for(let c of i.CartItems){let u=new Si;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 t?(delete i.CartItems,delete i.Order.ClientTimestamp):i.Order.ClientTimestamp=new Date,i}generateCompleteData(e){let t=new Ii;return t.InvoiceNumber=e.Order.Number,t.OrderTimeString=new Date().toString(),t.PaymentStateID=e.Action?.Type,t.PaymentStateLabel="Offline",t.Success=!0,t.OutDeliveryID=e.Action.DeliveryEntityID,t}GetReturnInvoice(e,t){return this.httpService.get(j.ReturInvoice,[{key:"EntityID",value:t},{key:"Number",value:e}])}GetInvoiceBySoID(e){return this.httpService.get(j.GetPOSDataByID,[{key:"ID",value:e}])}UploadCSV(e,t){let i={CartItems:e,EntityID:t};return this.httpService.post(j.UploadCsv,i)}sendEmail(e,t){return new Promise((i,o)=>{this._localDataService.isProductFromServer().subscribe(r=>{if(r){let c={invoiceID:t,email:e};this.httpService.post(j.SendInvoiceEmail,c).subscribe({next:u=>{i(u)},error:u=>{o(u)}})}else o(ie.wrongOfflineAction)})})}sendWhatsaap(e,t){let i={InvoiceID:e,PhoneNumber:t};return this.httpService.post(j.SendInvoiceWhatsapp,i)}createCustomerByInvoice(e,t){let i={InvoiceID:e,Mobile:t};return this.httpService.post(j.CreateCustomerInvoice,i)}saveCommission(e,t){let i={SOID:e,commission:t};return this.httpService.POSText("/API/Transaction/SetCommission",i)}generateReceiptA4(e){let t={ID:e};return this.httpService.post(j.InvoiceA4,t)}getVacant(e){return this.httpService.get(j.GetVacant,[{key:"EntityID",value:e}])}static \u0275fac=function(t){return new(t||n)(g(ge),g(Se),g(he),g(V))};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var Kt=(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))(Kt||{});var F=class n{constructor(e,t,i){this._OrderHttpService=e;this._customerHttpService=t;this._toastrService=i}_Data=new _e(new G);transaction_id;Data$=this._Data.asObservable();get Data(){return this._Data.value}pushNewValue(e){if(e)this._Data.next(e);else{let t=this.Data;this._Data.next(t)}}submitOrder(e){return new Promise((t,i)=>{this.checkTransactionId(),this._OrderHttpService.submitOrder(this.Data,e).subscribe({next:o=>{t(o)},error:o=>{this.Data.Items=[],i(o)}})})}uploadOfflineOrder(){return this.checkTransactionId(),this._OrderHttpService.uploadOfflineOrder(this.Data)}checkTransactionId(){let t=this.Data.Payments.find(i=>i.TypeID==3);h.IsNotEmpty(t)&&h.IsEmpty(this.transaction_id)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure")}updateCustomerID(e){return this.Data.Order.CustomerID=e,this.pushNewValue(this.Data),new Promise((t,i)=>{this._customerHttpService.GetPrivilegeByID(e,this.Data.Order.EntityID).subscribe({next:o=>{this._customerHttpService.Data=o,this.pushNewValue(this.Data),t(o)},error:o=>{this.Data.Order.CustomerID=null,this.Data.ContactName=null;let r=o.error?.Message;o.status==409?this._toastrService.warning(r,"Warning"):this._toastrService.error(r,`API Error - ${o.status}`),i(o)}})})}static \u0275fac=function(t){return new(t||n)(g(Mt),g(Re),g(V))};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var z=class n{constructor(e,t,i){this._localDataService=e;this._onlineStatusService=t;this._httpService=i;this._onlineStatusService.getOnlineStatus$().subscribe(o=>{this.isOnline=o})}_Data=new _e(null);Data$=this._Data.asObservable().pipe(ce(e=>e!==null),Ve());isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}requestObservable(){return this.isOnline?this._httpService.get(j.GetPOSStorage).pipe(J(e=>({data:e,type:"Online"}))):this._localDataService.getPOSStorage().pipe(ce(e=>e!=null),J(e=>({data:e,type:"Offline"})))}getOutletName(e){return this.Data.Entities.find(i=>i.ID==e)?.Name}static \u0275fac=function(t){return new(t||n)(g(Se),g(he),g(ge))};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var Pe=class n{constructor(e){this.roleService=e;this.pushNewValue(new Ue(e))}_Data=new _e(new Ue(null));get Data(){return this._Data.value}Data$=this._Data.asObservable();pushNewValue(e){this._Data.next(e)}static \u0275fac=function(t){return new(t||n)(g(Ci))};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var Xt=class{ID;Code;EntityID;Name;Description;Start;StartDisplay;State;Open;CashierID;OpeningCash;EntityName;LoginID;Active;CustomerDisplayEnabled;OvoConfigurationID;CustomerDisplayID;ListImage;Suspended};var Ti=class n{odsConfigType=E(0);setODSConfig(e){this.odsConfigType.set(e)}isEnabled(){return this.odsConfigType()>0}static \u0275fac=function(t){return new(t||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var tr=n=>({active:n}),ir=n=>({gray:n});function nr(n,e){if(n&1){let t=T();a(0,"span",17),b("click",function(o){C(t);let r=d().$implicit;return d().closeRegister(r),v(o.stopPropagation())}),s()}}function or(n,e){n&1&&(a(0,"div")(1,"span",18),m(2,"VACANT"),s()())}function rr(n,e){if(n&1&&(a(0,"div")(1,"span",19),_(2,"i",20),a(3,"span",21),m(4),s()(),a(5,"span",22),_(6,"i",23),a(7,"span",21),m(8),s()()()),n&2){let t=d().$implicit;l(4),D(t.LoginID),l(4),O("",t.StartDisplay.split(" ")[3]," - Now")}}function ar(n,e){if(n&1){let t=T();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),b("click",function(){let o=C(t).$implicit,r=d();return v(r.select(o))}),a(4,"span"),_(5,"i",13),m(6),y(7,"limitTo"),s(),f(8,nr,1,0,"span",14),s(),a(9,"div",15),b("click",function(){let o=C(t).$implicit,r=d();return v(r.select(o))}),f(10,or,3,0,"div",16)(11,rr,9,2,"div",16),s()()()()}if(n&2){let t=e.$implicit,i=d();l(),p("ngClass",t.Active?"active":""),l(),p("ngClass",H(11,tr,(t==null?null:t.ID)==(i.selectedRegister==null?null:i.selectedRegister.ID))),l(),p("ngClass",H(13,ir,t!=i.selectedRegister)),l(3),D(K(7,8,t.Name,15)),l(2),p("ngIf",t.State!="Close"),l(),p("ngSwitch",t.State),l(),p("ngSwitchCase","Close"),l(),p("ngSwitchCase","Open")}}var wi=class n{constructor(e,t,i,o,r,c,u){this._dialogRef=e;this._outletService=t;this._posService=i;this._userRoleService=o;this.router=r;this.httpService=c;this._odsService=u}originalSelectedRegister=null;registers;searchInput="";selectedRegister=new Xt;modalConfig=new ee;role;get AppConfigJSON(){return this._posService.Data.AppConfigJSON}destroy$=new Oe;ngOnInit(){this.subscribeToObsChanges(),this.initModalConfig()}subscribeToObsChanges(){this._posService.Data$.pipe(Me(this.destroy$)).subscribe(e=>{this.registers=e.Registers}),this._outletService.Data$.pipe(Me(this.destroy$)).subscribe(e=>{this.selectedRegister=this.findOutletRegisterById(e.RegisterID),this.originalSelectedRegister=this.selectedRegister?ti({},this.selectedRegister):null}),this._userRoleService.Data$.pipe(Me(this.destroy$)).subscribe(e=>{this.role=e})}findOutletRegisterById(e){let t=this.registers.find(i=>i.ID===e);return t||new Xt}initModalConfig(){this.modalConfig.hideFooter=!0,this.modalConfig.hideScrollbar=!0,this.modalConfig.title="Choose an outlet"}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}onClose(){this._dialogRef.close()}select(e){if(this.AppConfigJSON.ModuleShift.Closure.Enabled)if(this.selectedRegister.ID!=null&&this.selectedRegister.Open&&e.CashierID==null)confirm("You already have an active register with "+this.selectedRegister.Name+`!
1
+ import{a as $t,b as Jt}from"./chunk-JFLT7NX3.js";import{a as bo}from"./chunk-YXCPHYC5.js";import{a as No}from"./chunk-QUHI6RHC.js";import{e as Do}from"./chunk-FIHWJAIR.js";import{a as Pi}from"./chunk-W3VF2RCW.js";import{a as So}from"./chunk-OKIBXXRJ.js";import{a as he,b as Re,e as Eo}from"./chunk-PD445FIT.js";import{a as _o,b as wo,c as Ro}from"./chunk-SRRURHLT.js";import{a as yo}from"./chunk-SGFSKIUE.js";import{a as ko}from"./chunk-5M3JINH2.js";import{b as Sn,c as vo}from"./chunk-C2KD7R6L.js";import{a as io}from"./chunk-YNDNTAII.js";import{a as Dt}from"./chunk-4SKJU2FQ.js";import{a as Po}from"./chunk-RFO7MTFT.js";import{a as Oi,b as Di,c as Mi}from"./chunk-4PPRFE5H.js";import{b as Oo}from"./chunk-O2QTP22K.js";import{a as Ao}from"./chunk-M3HHWYKD.js";import{a as Ye}from"./chunk-J6U6UYNI.js";import{a as Si,b as De}from"./chunk-AEHOR4RJ.js";import{a as yn,b as qt,c as bn}from"./chunk-7IDMO3VZ.js";import{a as Xe,b as pt,c as pe}from"./chunk-HT35KHLT.js";import{b as Co}from"./chunk-DAIHPIA2.js";import{a as ho}from"./chunk-BXQFYW4R.js";import{g as fo}from"./chunk-4UYZJCFI.js";import{b as To}from"./chunk-Z65FTA7V.js";import{d as Io}from"./chunk-HOM424UE.js";import{a as xo}from"./chunk-IAZFUBFX.js";import{a as Mo}from"./chunk-MPSML3FA.js";import{d as bi}from"./chunk-GIDGCFLX.js";import{p as oo}from"./chunk-H3OZSV6V.js";import{d as no}from"./chunk-VZEPVRCY.js";import{h as ro}from"./chunk-MFCXEITE.js";import{a as so,c as Pt}from"./chunk-MUJ6277G.js";import{B as uo,C as ie,D as Se,G as go,u as ee,v as te,w as St}from"./chunk-H7F34T25.js";import{b as vi,c as Gt}from"./chunk-JOXTERIM.js";import{F as Ot,N as yi,O as j,g as lo,n as _i,o as co,q as mo,t as po}from"./chunk-TSIYPTYI.js";import{d as bt,e as ao}from"./chunk-XYB3YDKL.js";import{a as rt}from"./chunk-7VKFVS7K.js";import{a as ui,c as gi}from"./chunk-ZVDY66SR.js";import{a as Z,b as to,e as X,f as fe,g as we}from"./chunk-3YKVLHZG.js";import{a as me}from"./chunk-2FWFPV5I.js";import{A as Xn,B as eo,F as hi,c as Ie,e as fi,h as be,i as $n,k as Jn,l as Ze,n as zn,o as Te,p as Yn,s as yt,x as Kn,y as Zn}from"./chunk-RVXZOIFQ.js";import{a as h,d as Ci}from"./chunk-ZZGSAFGO.js";import{a as qn}from"./chunk-QVPSWY5E.js";import{$ as ai,$a as l,$b as Wt,$c as Ln,Ac as M,Bc as K,Cc as _t,Db as w,E as ce,Eb as it,Fc as xe,Gb as nt,Hb as ot,I as tt,Ia as Ct,Ib as a,Ja as jt,Jb as s,Kb as _,Lb as U,M as ht,Ma as E,Mb as W,N as je,Nb as di,Ob as T,Pc as oe,Q as Ve,Qb as b,Qd as Un,Rb as d,Rd as Wn,Td as Gn,Va as $e,Vd as V,Wa as mt,Wc as Le,Xa as Nn,Y as Fe,Yc as ye,Yd as ge,Zb as Qt,Zc as se,_b as Ut,_c as Fn,aa as Y,ad as Bn,b as ni,bd as Hn,cd as Je,d as Oe,da as Me,db as S,dc as q,e as _e,ec as m,ed as ze,fa as ae,fc as D,gc as O,gd as $,hc as vt,ib as li,ic as kn,ja as x,jc as L,jd as le,k as gt,ka as si,kb as N,kc as A,lb as ci,lc as B,ma as g,n as Rn,na as I,o as Ae,p as ft,q as oi,qb as f,r as ri,rc as H,sc as Qe,t as J,td as jn,u as qe,ub as mi,uc as Vn,v as En,va as C,vb as p,wa as v,wb as An,xd as Qn,zb as pi,zc as y}from"./chunk-UXRO4UFY.js";import{a as ti,h as Ke,j as ii}from"./chunk-7DCB7DB2.js";var Ue=class{constructor(e){this.roleService=e;e&&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;_ContactsCreate;_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._ContactsCreate=this.roleService.contact.Create,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(e){this._CouponInputLock=e}get Retrieve(){return this._Retrieve}get DateEditor(){return this._DateEditor}set DateEditor(e){this._DateEditor=e}get NumberEditor(){return this._NumberEditor}set NumberEditor(e){this._NumberEditor=e}get PriceVisible(){return this._PriceVisible}get UnitPriceEditor(){return this._UnitPriceEditor}set UnitPriceEditor(e){this._UnitPriceEditor=e}get PricebookSelector(){return this._PricebookSelector}set PricebookSelector(e){this._PricebookSelector=e}get Cost(){return this._Cost}get Return(){return this._Return}set Return(e){this._Return=e}get Discount(){return this._Discount}set Discount(e){this._Discount=e}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(e){this._Tax=e}get DeleteItem(){return this._DeleteItem}set DeleteItem(e){this._DeleteItem=e}get BundlingPrice(){return this._BundlingPrice}get Email(){return this._EmailRestriction}get ParkedDeletionAuthorized(){return this._ParkedDeletionAuthorized}set ParkedDeletionAuthorized(e){this._ParkedDeletionAuthorized=e}get SellEditor(){return this._SellEditor}get PrepaidPackageCreate(){return this._PrepaidPackageCreate}get Order(){return this._Order}get Reprint(){return this._Reprint}get Contacts(){return this._Contacts}get ContactsCreate(){return this._ContactsCreate}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 zt=class{DeliveryEntityID;Type;NewOrderID;constructor(){this.DeliveryEntityID="",this.Type=3}};var xi=class{Type;Amount;Notification;ApplyToProduct;Requirement};var G=class{Order;Invoice;Shipping;Action;Payments;Items;CartItems;Promotion;ContactName;SplitParkLabel;get cartQuantity(){let e=0;for(let t of this.CartItems)e+=t.Quantity;return e}constructor(){this.Order=new Sn,this.Invoice=new qt,this.Shipping=new bn,this.Action=new zt,this.Payments=Array(),this.Items=Array(),this.CartItems=Array(),this.ContactName=""}get TotalPaidAmount(){let e=0;return this.Payments.forEach(t=>{e+=t.PaidAmount}),e}get RedeemableAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID!=1);return this.GetAmountByCart(e)}get TotalQuantity(){let e=0;return this.CartItems.forEach(t=>{t.PromotionGift||(e+=t.Quantity)}),e}get CashOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==1);return this.GetAmountByCart(e)}get PointOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==2);return this.GetAmountByCart(e)}get PrepaidPackageItem(){return this.CartItems.filter(t=>t.Variant.TypeID==10)}GetAmountByCart(e){let t=0;return e.forEach(i=>{t+=i.Total}),t=t*(100-this.Order.Discount)/100,t=t*(100-this.Order.Discount2)/100,t}getRewards(){return this.CartItems.filter(t=>t.PromotionGift)}};Ke([Xe(()=>Sn)],G.prototype,"Order",2),Ke([Xe(()=>qt)],G.prototype,"Invoice",2),Ke([Xe(()=>bn)],G.prototype,"Shipping",2),Ke([Xe(()=>zt)],G.prototype,"Action",2),Ke([Xe(()=>Ye)],G.prototype,"Payments",2),Ke([Xe(()=>Si)],G.prototype,"Items",2),Ke([Xe(()=>De)],G.prototype,"CartItems",2),Ke([Xe(()=>xi)],G.prototype,"Promotion",2);var Ii=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 Mt=class n{constructor(e,t,i,o){this.httpService=e;this._localDataService=t;this._onlineStatusService=i;this._toastrService=o;this._onlineStatusService.getOnlineStatus$().subscribe(r=>{this.isOnline=r})}_Data=new _e(null);Data$=this._Data.pipe(Ve(),ce(e=>e!==null));isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}getSalesOrderPrint(e){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:e})}submitOrder(e,t){let i=this.generatePOSDataForSubmission(e,this.isOnline);if(this.isOnline)return this.submitOnline(i).pipe(this.handleTimeOutError(i));if(t.ModuleSell.EnableOfflineTransaction)return this._localDataService.syncOrder(i).pipe(J(()=>this.generateCompleteData(i)));this._toastrService.warning("Offline order is not Supported!","Info!")}uploadOfflineOrder(e){return this._localDataService.uploadSingleOrder(e).pipe(tt(t=>t?.message?.includes("objectStore does not exists")?this.submitOnline(e):ft(()=>t)))}submitOnline(e){return this.httpService.post(j.SubmitOrder,e,qn.pos.submitOrderTimeout)}handleTimeOutError(e){return ni(tt(t=>{if(t instanceof ri||t?.name=="TimeoutError"){let i=this.generateCompleteData(e);this.pushNewValue(i)}throw t}))}generatePOSDataForSubmission(e,t=!0){let i=Object.assign(new G,e);i.Items=[],i.Order.CustomerID==null&&(i.Order.CustomerID=h.GuidEmpty),i.Order.SalesID==null&&(i.Order.SalesID=h.GuidEmpty);let o=1;i.Payments=i.Payments.map(c=>(c.Date=i.Order.Date,c.Index=o,o++,delete c.TypeID,c));let r=1;for(let c of i.CartItems){let u=new Si;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 t?(delete i.CartItems,delete i.Order.ClientTimestamp):i.Order.ClientTimestamp=new Date,i}generateCompleteData(e){let t=new Ii;return t.InvoiceNumber=e.Order.Number,t.OrderTimeString=new Date().toString(),t.PaymentStateID=e.Action?.Type,t.PaymentStateLabel="Offline",t.Success=!0,t.OutDeliveryID=e.Action.DeliveryEntityID,t}GetReturnInvoice(e,t){return this.httpService.get(j.ReturInvoice,[{key:"EntityID",value:t},{key:"Number",value:e}])}GetInvoiceBySoID(e){return this.httpService.get(j.GetPOSDataByID,[{key:"ID",value:e}])}UploadCSV(e,t){let i={CartItems:e,EntityID:t};return this.httpService.post(j.UploadCsv,i)}sendEmail(e,t){return new Promise((i,o)=>{this._localDataService.isProductFromServer().subscribe(r=>{if(r){let c={invoiceID:t,email:e};this.httpService.post(j.SendInvoiceEmail,c).subscribe({next:u=>{i(u)},error:u=>{o(u)}})}else o(ie.wrongOfflineAction)})})}sendWhatsaap(e,t){let i={InvoiceID:e,PhoneNumber:t};return this.httpService.post(j.SendInvoiceWhatsapp,i)}createCustomerByInvoice(e,t){let i={InvoiceID:e,Mobile:t};return this.httpService.post(j.CreateCustomerInvoice,i)}saveCommission(e,t){let i={SOID:e,commission:t};return this.httpService.POSText("/API/Transaction/SetCommission",i)}generateReceiptA4(e){let t={ID:e};return this.httpService.post(j.InvoiceA4,t)}getVacant(e){return this.httpService.get(j.GetVacant,[{key:"EntityID",value:e}])}static \u0275fac=function(t){return new(t||n)(g(ge),g(Se),g(he),g(V))};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var Kt=(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))(Kt||{});var F=class n{constructor(e,t,i){this._OrderHttpService=e;this._customerHttpService=t;this._toastrService=i}_Data=new _e(new G);transaction_id;Data$=this._Data.asObservable();get Data(){return this._Data.value}pushNewValue(e){if(e)this._Data.next(e);else{let t=this.Data;this._Data.next(t)}}submitOrder(e){return new Promise((t,i)=>{this.checkTransactionId(),this._OrderHttpService.submitOrder(this.Data,e).subscribe({next:o=>{t(o)},error:o=>{this.Data.Items=[],i(o)}})})}uploadOfflineOrder(){return this.checkTransactionId(),this._OrderHttpService.uploadOfflineOrder(this.Data)}checkTransactionId(){let t=this.Data.Payments.find(i=>i.TypeID==3);h.IsNotEmpty(t)&&h.IsEmpty(this.transaction_id)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure")}updateCustomerID(e){return this.Data.Order.CustomerID=e,this.pushNewValue(this.Data),new Promise((t,i)=>{this._customerHttpService.GetPrivilegeByID(e,this.Data.Order.EntityID).subscribe({next:o=>{this._customerHttpService.Data=o,this.pushNewValue(this.Data),t(o)},error:o=>{this.Data.Order.CustomerID=null,this.Data.ContactName=null;let r=o.error?.Message;o.status==409?this._toastrService.warning(r,"Warning"):this._toastrService.error(r,`API Error - ${o.status}`),i(o)}})})}static \u0275fac=function(t){return new(t||n)(g(Mt),g(Re),g(V))};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var z=class n{constructor(e,t,i){this._localDataService=e;this._onlineStatusService=t;this._httpService=i;this._onlineStatusService.getOnlineStatus$().subscribe(o=>{this.isOnline=o})}_Data=new _e(null);Data$=this._Data.asObservable().pipe(ce(e=>e!==null),Ve());isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}requestObservable(){return this.isOnline?this._httpService.get(j.GetPOSStorage).pipe(J(e=>({data:e,type:"Online"}))):this._localDataService.getPOSStorage().pipe(ce(e=>e!=null),J(e=>({data:e,type:"Offline"})))}getOutletName(e){return this.Data.Entities.find(i=>i.ID==e)?.Name}static \u0275fac=function(t){return new(t||n)(g(Se),g(he),g(ge))};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var Pe=class n{constructor(e){this.roleService=e;this.pushNewValue(new Ue(e))}_Data=new _e(new Ue(null));get Data(){return this._Data.value}Data$=this._Data.asObservable();pushNewValue(e){this._Data.next(e)}static \u0275fac=function(t){return new(t||n)(g(Ci))};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var Xt=class{ID;Code;EntityID;Name;Description;Start;StartDisplay;State;Open;CashierID;OpeningCash;EntityName;LoginID;Active;CustomerDisplayEnabled;OvoConfigurationID;CustomerDisplayID;ListImage;Suspended};var Ti=class n{odsConfigType=E(0);setODSConfig(e){this.odsConfigType.set(e)}isEnabled(){return this.odsConfigType()>0}static \u0275fac=function(t){return new(t||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var tr=n=>({active:n}),ir=n=>({gray:n});function nr(n,e){if(n&1){let t=T();a(0,"span",17),b("click",function(o){C(t);let r=d().$implicit;return d().closeRegister(r),v(o.stopPropagation())}),s()}}function or(n,e){n&1&&(a(0,"div")(1,"span",18),m(2,"VACANT"),s()())}function rr(n,e){if(n&1&&(a(0,"div")(1,"span",19),_(2,"i",20),a(3,"span",21),m(4),s()(),a(5,"span",22),_(6,"i",23),a(7,"span",21),m(8),s()()()),n&2){let t=d().$implicit;l(4),D(t.LoginID),l(4),O("",t.StartDisplay.split(" ")[3]," - Now")}}function ar(n,e){if(n&1){let t=T();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),b("click",function(){let o=C(t).$implicit,r=d();return v(r.select(o))}),a(4,"span"),_(5,"i",13),m(6),y(7,"limitTo"),s(),f(8,nr,1,0,"span",14),s(),a(9,"div",15),b("click",function(){let o=C(t).$implicit,r=d();return v(r.select(o))}),f(10,or,3,0,"div",16)(11,rr,9,2,"div",16),s()()()()}if(n&2){let t=e.$implicit,i=d();l(),p("ngClass",t.Active?"active":""),l(),p("ngClass",H(11,tr,(t==null?null:t.ID)==(i.selectedRegister==null?null:i.selectedRegister.ID))),l(),p("ngClass",H(13,ir,t!=i.selectedRegister)),l(3),D(K(7,8,t.Name,15)),l(2),p("ngIf",t.State!="Close"),l(),p("ngSwitch",t.State),l(),p("ngSwitchCase","Close"),l(),p("ngSwitchCase","Open")}}var wi=class n{constructor(e,t,i,o,r,c,u){this._dialogRef=e;this._outletService=t;this._posService=i;this._userRoleService=o;this.router=r;this.httpService=c;this._odsService=u}originalSelectedRegister=null;registers;searchInput="";selectedRegister=new Xt;modalConfig=new ee;role;get AppConfigJSON(){return this._posService.Data.AppConfigJSON}destroy$=new Oe;ngOnInit(){this.subscribeToObsChanges(),this.initModalConfig()}subscribeToObsChanges(){this._posService.Data$.pipe(Me(this.destroy$)).subscribe(e=>{this.registers=e.Registers}),this._outletService.Data$.pipe(Me(this.destroy$)).subscribe(e=>{this.selectedRegister=this.findOutletRegisterById(e.RegisterID),this.originalSelectedRegister=this.selectedRegister?ti({},this.selectedRegister):null}),this._userRoleService.Data$.pipe(Me(this.destroy$)).subscribe(e=>{this.role=e})}findOutletRegisterById(e){let t=this.registers.find(i=>i.ID===e);return t||new Xt}initModalConfig(){this.modalConfig.hideFooter=!0,this.modalConfig.hideScrollbar=!0,this.modalConfig.title="Choose an outlet"}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}onClose(){this._dialogRef.close()}select(e){if(this.AppConfigJSON.ModuleShift.Closure.Enabled)if(this.selectedRegister.ID!=null&&this.selectedRegister.Open&&e.CashierID==null)confirm("You already have an active register with "+this.selectedRegister.Name+`!
2
2
  Do you want to end your session?`)&&(this.onClose(),this.router.navigate(["menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}}));else if(!e.Open||this.selectedRegister.ID==e.ID)this.selectedRegister=e,this.onSubmitSelectedRegister();else{if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+e.Name+" - Unauthorized Access");return}alert("This Register has already active register, Are you sure you want to end this register?"),this.onClose(),this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}})}else this.selectedRegister=e,this.onSubmitSelectedRegister()}onSubmitSelectedRegister(){if(this.selectedRegister.ID==null){alert("Please select a register first!");return}this._outletService.pushNewRegister(this.selectedRegister),this.loadOdsConfig(this.selectedRegister.EntityID),this._dialogRef.close({selectedRegister:this.selectedRegister,openStartingCashDialog:this.selectedRegister.ID!=this.originalSelectedRegister?.ID})}closeRegister(e){let t=this.selectedRegister.ID;if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+e.Name+" - Unauthorized Access");return}t==e.ID?this.router.navigate(["/menu/Shift/Main/My_Shift"]):this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}}),this.onClose()}loadOdsConfig(e){this.httpService.get(`/api/outlet/GetOrderDisplayBroadcastMode?EntityID=${e}`).pipe(ae(t=>{this._odsService.setODSConfig(t.form.OrderDisplayBroadcastMode)})).subscribe()}static \u0275fac=function(t){return new(t||n)(S(X),S(ne),S(z),S(Pe),S(Un),S(ge),S(Ti))};static \u0275cmp=N({type:n,selectors:[["pos-modal-register"]],standalone:!1,decls:11,vars:7,consts:[[3,"onClose","config"],[1,"ms-0","mb-8","search-container",3,"hidden"],[1,"input-group","mb-3","rounded-start-1"],[1,"input-group-text","txtFilter","rounded-end-0"],["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","rounded-1","rounded-start-0",3,"ngModelChange","ngModel"],[1,"container","custom-scroll"],[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,"d-inline"],[1,"open"],["aria-hidden","true",1,"fa-regular","fa-clock","pe-2"]],template:function(t,i){t&1&&(a(0,"modal-material",0),b("onClose",function(){return i.onClose()}),a(1,"content")(2,"div",1)(3,"div",2)(4,"span",3),_(5,"i",4),s(),a(6,"input",5),B("ngModelChange",function(r){return A(i.searchInput,r)||(i.searchInput=r),r}),s()()(),a(7,"div",6)(8,"div",7),f(9,ar,12,15,"div",8),y(10,"FilterByName"),s()()()()),t&2&&(p("config",i.modalConfig),l(2),p("hidden",i.registers.length<=6),l(4),L("ngModel",i.searchInput),l(3),p("ngForOf",K(10,4,i.registers,i.searchInput)))},dependencies:[Le,ye,se,Fn,Ln,Ie,be,Te,te,_i,po],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}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.search-container[_ngcontent-%COMP%]{transition:all .3s ease;width:97%}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]{position:relative;transition:all .3s ease;height:2.3rem}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover, .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e4d,0 0 8px 4px #89b03e33;border-radius:4px}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]{transition:all .3s ease;border-left:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]:focus{box-shadow:none!important;border-color:#ced4da!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .input-group-text[_ngcontent-%COMP%]{transition:all .3s ease;background-color:#fff;border-right:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .input-group-text[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .input-group-text[_ngcontent-%COMP%]{background-color:#89b03e1a;border-color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .fa-magnifying-glass[_ngcontent-%COMP%]{transition:all .3s ease}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .fa-magnifying-glass[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .fa-magnifying-glass[_ngcontent-%COMP%]{color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e66,0 0 12px 6px #89b03e40!important}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar{width:6px}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:#f1f1f1;border-radius:3px}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#89b03e;border-radius:3px}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:#7a9e37}.container[_ngcontent-%COMP%]{overflow-y:auto;overflow-x:hidden;max-height:260px;min-height:150px}.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 sr=["inputCash"],Ri=class n{constructor(e,t){this.dialogRef=e;this.data=t;this.generateModalTitle$.subscribe()}registerService=I(ne);loadPOSService=I(z);register=this.registerService.Data;username=this.loadPOSService?.Data?.UserName;amount=E(0);config=new ee;currentRegisterName;generateModalTitle$=this.registerService.Data$.pipe(ce(e=>h.IsNotEmpty(e)),ae(()=>{let e=this.registerService.getOutletRegister(),t=e?.Name?.length>18?`${e?.Name?.substring(0,18)}...`:e?.Name;this.config.title="Open Shift",this.currentRegisterName=t}),Z());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(t){return new(t||n)(S(X),S(fe))};static \u0275cmp=N({type:n,selectors:[["POS-modal-opening-cash"]],viewQuery:function(t,i){if(t&1&&Qt(sr,5),t&2){let o;Ut(o=Wt())&&(i.inputCashEl=o.first)}},standalone:!1,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(t,i){if(t&1){let o=T();a(0,"modal-material",1),b("onOk",function(){return C(o),v(i.onOk())})("onCancel",function(){return C(o),v(i.dialogRef.close())})("onClose",function(){return C(o),v(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),B("ngModelChange",function(c){return C(o),A(i.amount,c)||(i.amount=c),v(c)}),s()()()()()()}t&2&&(p("config",i.config),l(7),D(i.currentRegisterName),l(5),D(i.username),l(5),D(K(18,5,i.today,"EEEE, HH:mm")),l(6),L("ngModel",i.amount))},dependencies:[Ie,be,Te,te,Pt,ze],styles:[".table-title-width[_ngcontent-%COMP%]{width:120px}"]})};var Ei=class{OrderNumberElement;InvoiceNumberElement;NewOrderID};var It=class n{constructor(e,t,i){this._httpService=e;this._onlineStatusService=t;this._localDataService=i;this._onlineStatusService.getOnlineStatus$().subscribe(o=>{this.isOnline=o})}isOnline;GenerateNumber(e,t){if(this.isOnline)return this._httpService.get(j.GenerateNumber,[{key:"EntityID",value:e},{key:"TypeID",value:1}]);{let i=new Ei;return h.IsNotEmpty(t.NumberElement)&&(t.NumberElement.Seed+=1),h.IsNotEmpty(t.InvoiceNumberElement)&&(t.InvoiceNumberElement.Seed+=1),i.InvoiceNumberElement=t.InvoiceNumberElement,i.OrderNumberElement=t.NumberElement,i.NewOrderID=h.Guid_NewGuid(),Ae(i)}}findRegisterById(e){return new Promise(t=>{this._localDataService.isConfigFromServer().subscribe(i=>{i?this._httpService.get(j.GetRegisterInfo,[{key:"RegisterID",value:e}]).subscribe(o=>{t(o)}):this._localDataService.findRegisterByID(e).subscribe(o=>{t(o)})})})}recordOpeningCash(e){return oi(this._httpService.post("/API/POS/RecordOpeningCash",e))}static \u0275fac=function(t){return new(t||n)(g(ge),g(he),g(Se))};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var ne=class n{constructor(e,t,i,o,r,c){this._signalRClientService=e;this._matDialog=t;this._posHttpResponseService=i;this._CoreHttpService=o;this._toastrService=r;this._roleService=c}datePipe=I(ze);_Data=new _e(null);Data$=this._Data.asObservable().pipe(ce(e=>e!==null),Ve());get Data(){return this._Data.value}getSalesname(e){return this.Data&&this.Data.ListSales?this._Data.value.ListSales.find(t=>t.ID==e)?.Name:""}setActiveRegisterFromOptions(e,t){let o=this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled;if(e.length>1){let r=e.find(c=>c.LoginID==t);if(r)this.pushNewRegister(r);else{let c=this.getOutletRegisterFromLocalStorage(),u=this.Data?.RegisterID?this.Data.RegisterID:c?.ID;e.some(k=>k.ID==u)?o?this.openChooseRegisterModal():this.initRegisterFromLocalStorage():this.openChooseRegisterModal()}}e.length==1&&(this.pushNewRegister(e[0]),h.IsEmpty(e[0].LoginID)&&h.IsEmpty(e[0].CashierID)&&this.openOpeningCashModal(e[0].ID)),e.length==0&&this._toastrService.warning("You do not have access to any OUTLET","Warning")}openChooseRegisterModal(){this._matDialog.open(wi,{id:"registerModal",disableClose:!0}).afterClosed().pipe(ce(e=>h.IsNotEmpty(e?.selectedRegister))).subscribe(e=>{e.selectedRegister&&this.openOpeningCashModal(e.selectedRegister.ID)})}openOpeningCashModal(e){this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled&&this._matDialog.open(Ri,{disableClose:!0}).afterClosed().pipe(ce(o=>h.IsNotEmpty(o))).subscribe(o=>{let r={RegisterID:e,OpAmount:o.amount};this._CoreHttpService.recordOpeningCash(r).then(()=>{this.updateRegisterList(r)})})}updateRegisterList(e){let i=this._posHttpResponseService.Data.Registers.map(r=>r.ID==e.RegisterID?this.mapRegisterAsActiveRegister(r,e):r),o=this._posHttpResponseService.Data;o.Registers=i,this._posHttpResponseService.pushNewValue(o)}mapRegisterAsActiveRegister(e,t){let i=localStorage.getItem("AccountInfo");if(i){let r=JSON.parse(i);e.LoginID=r.UserName}e.OpeningCash=t.OpAmount,e.Open=!0,e.State="Open";let o=this.datePipe.transform(new Date,"dd MM yyyy HH:mm");return e.StartDisplay=o,e}initRegisterFromLocalStorage(){if(this._roleService.Data.DeleteItem==!1){let t=this.getOutletRegisterFromLocalStorage();t&&this.pushNewRegister(t)}}pushNewRegister(e){let t=this._Data.value,i=t?t.RegisterID:null;i!=e.ID&&this._CoreHttpService.findRegisterById(e.ID).then(o=>{o.RegisterCode=e.Code,o.DefaultPrintTemplate=o.PrintTemplate,this._signalRClientService.SubscribeGroup(o.RegisterID,i),this.saveOutletRegisterToLocalStorage(e),this.pushNewValue(o)})}getOutletRegister(){let e=this.Data.RegisterID;return this._posHttpResponseService.Data.Registers.find(o=>o.ID==e)}pushNewValue(e){this._Data.next(e)}saveOutletRegisterToLocalStorage(e){if(this._roleService.Data.DeleteItem==!1){let i=JSON.stringify(e);localStorage.setItem("outlet_register",i)}}getOutletRegisterFromLocalStorage(){let e=this._roleService.Data.DeleteItem,t=localStorage.getItem("outlet_register"),i=null;return t&&(e?localStorage.removeItem("outlet_register"):i=JSON.parse(t)),i}findOutletRegisterById(e){return this._posHttpResponseService.Data.Registers.find(o=>o.ID===e)}static \u0275fac=function(t){return new(t||n)(g(rt),g(we),g(z),g(It),g(V),g(Pe))};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};function lr(n,e){if(n&1&&(a(0,"span",5),m(1),y(2,"number"),s()),n&2){let t=d(3);l(),O("-",M(2,1,t.coupon.Amount),"%")}}function cr(n,e){if(n&1&&(a(0,"span",5),m(1),y(2,"number"),s()),n&2){let t=d(3);l(),O(" -",M(2,1,t.coupon.Amount)," ")}}function mr(n,e){if(n&1){let t=T();a(0,"button",9),b("click",function(){C(t);let o=d().$implicit,r=d(2);return v(r.onRemoveCouponDiscount(o))}),m(1," Remove "),s()}}function pr(n,e){if(n&1){let t=T();a(0,"button",10),b("click",function(){C(t);let o=d().$implicit,r=d(2);return v(r.onApplyCouponDiscount(o))}),m(1," Apply "),s()}if(n&2){let t=d(3);p("disabled",t.hasAppliedCouponDiscount())}}function dr(n,e){if(n&1&&(a(0,"tr")(1,"td"),m(2),s(),a(3,"td"),m(4),s(),a(5,"td",4),m(6),y(7,"number"),s(),a(8,"td",4),f(9,lr,3,3,"span",5)(10,cr,3,3,"span",5),s(),a(11,"td",6),f(12,mr,2,0,"button",7)(13,pr,2,1,"button",8),s()()),n&2){let t=e.$implicit,i=d(2);l(2),D(t==null||t.Variant==null?null:t.Variant.Name),l(2),D(t==null||t.Variant==null?null:t.Variant.Code),l(2),D(M(7,5,t.UnitPrice)),l(3),w((i.coupon==null||i.coupon.Requirement==null?null:i.coupon.Requirement.Type)==i.couponType.DiscountPercentage?9:10),l(3),w((t==null?null:t.CouponDiscount)>0?12:13)}}function ur(n,e){if(n&1&&nt(0,dr,14,7,"tr",null,it),n&2){let t=d();ot(t.eligibleItems())}}function gr(n,e){n&1&&(a(0,"tr")(1,"td",11),_(2,"app-empty-state",12),s()())}var Ni=class n{constructor(e){this.data=e;this.coupon=this.data.coupon,this.initModalConfig(),this.initEligibleItems()}dialogRef=I(X);config;eligibleItems=E([]);coupon;couponType=$t;hasAppliedCouponDiscount=E(!1);initModalConfig(){this.config=new ee,this.config.title="Choose Item to Apply Discount",this.config.hideFooter=!0}initEligibleItems(){let e=this.data.coupon?.ApplyToProduct.map(t=>t.ID);e&&(this.eligibleItems.update(()=>this.data.cartItems.filter(i=>e.includes(i.VariantID))),this.hasAppliedCouponDiscount.update(()=>this.eligibleItems().some(t=>t.CouponDiscount>0)))}onApplyCouponDiscount(e){let t=[e];this.hasAppliedCouponDiscount.update(()=>!0),this.dialogRef.close(t)}onRemoveCouponDiscount(e){this.eligibleItems.update(t=>{let i=t.findIndex(o=>o.VariantID===e.VariantID);return i>-1&&(t[i].Discount=0,t[i].CouponDiscount=0),t}),this.hasAppliedCouponDiscount.update(()=>!1)}onClose(){this.dialogRef.close()}static \u0275fac=function(t){return new(t||n)(S(fe))};static \u0275cmp=N({type:n,selectors:[["app-modal-coupon-selected-item"]],decls:17,vars:2,consts:[[3,"onCancel","onClose","config"],[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"],["colspan","5"],["title","No eligible products","message","No products in the cart qualify for coupon use"]],template:function(t,i){t&1&&(a(0,"modal-material",0),b("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),a(1,"content")(2,"table",1)(3,"thead",2)(4,"tr")(5,"th",3),m(6,"Name"),s(),a(7,"th",3),m(8,"Code"),s(),a(9,"th",3),m(10,"Price"),s(),a(11,"th",3),m(12,"Discount"),s(),_(13,"th",3),s()(),a(14,"tbody"),f(15,ur,2,0)(16,gr,3,0,"tr"),s()()()()),t&2&&(p("config",i.config),l(15),w(i.eligibleItems().length!==0?15:16))},dependencies:[le,$,St,te,ho],encapsulation:2})};var st=class{ModuleSell;ApplicationLoyalty;ApplicationMath;CoreDefaults;ModuleDelivery;ApplicationParkAndRetrieve;ApplicationRegisterClosure;PaymentConfigGopay;PaymentConfigLink;PrintConfigInvoice;CorePrint;PaymentConfigEmpatKali;ApplicationSettings;PrintConfigGeneral;ModuleProducts;ModuleContact;ApplicationTransactionNumbering;ModuleOrders;ModuleShift;ModuleBuy;ModuleAdjustment;TadaCouponVisible;CouponRedemptionType;ProviderOption};var re=class n{constructor(e,t,i,o){this._orderDataService=e;this._posService=t;this.POSMATH=i;this.decimalPipe=o;this._orderDataService.Data$.pipe(Y(r=>this._posService.Data$.pipe(J(c=>({appConfig:c.AppConfigJSON,salesOrder:r}))))).subscribe(r=>{this.salesOrderData=r.salesOrder,this.appConfigJSON=r.appConfig,this.calculateDiscountAmount(),this.pushNewValue(this.grandTotal)})}_Data=new _e(0);Data$=this._Data.asObservable().pipe(Ve());tax=new bo;discountAfterTax=0;currencySymbol="Rp";get Data(){return this._Data.value}salesOrderData=new G;appConfigJSON=new st;pushNewValue(e){this._Data.next(e)}get grandTotal(){let e=this.TotalAfterSurcharge;return isNaN(e)?0:e}setDecimalDigit(e){let t=this.decimalPipe.transform(e,"1.0-4");return e=parseFloat(t.split(",").join("")),e}get TotalAfterTax(){let e=this.TaxAmount,t=this.TotalBeforeTax+e;return t=this.POSMATH.Round(t,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm),t}get TotalBeforeTax(){let e=this.tax?.CalculationTypeID===1,t=0;return e?t=this.DiscountTotal-this.TaxAmount:t=this.DiscountTotal,t}get TotalAfterSurcharge(){let e=this.TotalAfterTax+this.SurchargeAmount;return this.POSMATH.Round(e,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm)}get TotalAfterDiscountTaxable(){return this.GrossTotalTaxable-this.DiscountTotal}get TaxAmount(){if(this.tax!=null){let e=0,t=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.DecimalPlaceValue,i=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.RoundAlgorithm,o=this.GrossTotalTaxable;return this.tax.CalculationTypeID==1?e=this.tax.Rate/(100+this.tax.Rate)*o:e=this.tax.Rate/100*o,e=this.POSMATH.Round(e,t,i),e}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 e=this.salesOrderData.Order.DiscountAmount,t=0;this.AfterDiscount2Amount>=0&&e>0&&e>this.AfterDiscount2Amount&&(t=this.AfterDiscount2Amount),t!==0&&t<=e&&this.GrossTotal!==0&&(e=t),this.salesOrderData.Order.DiscountAmount=e}get GrossTotal(){return this.sum(this.salesOrderData.CartItems,"Total")}get GrossTotalTaxable(){let e=this.salesOrderData.CartItems.filter(i=>i.Taxable),t=this.sum(e,"Total");if(e.length!==0){let i=this.calculateDiscountTaxableItem(e);t=t*(100-this.salesOrderData.Order.Discount)/100,t=t*(100-this.salesOrderData.Order.Discount2)/100,t=t-i}return t}calculateDiscountTaxableItem(e){let t=this.GrossTotal,i=this.salesOrderData.Order.DiscountAmount,o=0,r=0,c=0,u=0;for(let P of e)o=P.getItemAfterDiscount/t,r=o*i,u=r*P.Quantity,c+=u;return c}get GrossTotalNonTaxable(){let e=this.salesOrderData.CartItems.filter(i=>i.Taxable==!1),t=this.sum(e,"Total");return t=t*(100-this.salesOrderData.Order.Discount)/100,t=t*(100-this.salesOrderData.Order.Discount2)/100,t=t-this.salesOrderData.Order.DiscountAmount,t}sum(e,t){let i=e.reduce((o,r)=>o+r[t],0);return i=this.setDecimalDigit(i),i}GetPointOnlyAmount(){let e=this.salesOrderData.CartItems.filter(t=>t.Variant.PaymentTypeID==2);return this.GetAmountByCart(e)}GetCashOnlyAmount(){let e=this.salesOrderData.CartItems.filter(t=>t.Variant.PaymentTypeID==1);return this.GetAmountByCart(e)}GetCashAndPointAmountCart(){let e=this.salesOrderData.CartItems.filter(t=>t.Variant.PaymentTypeID!=1);return this.GetAmountByCart(e)}GetAmountByCart(e){let t=this.sum(e,"Total");return t=t*(100-this.salesOrderData.Order.Discount)/100,t=t*(100-this.salesOrderData.Order.Discount2)/100,t}calculateGrossTotal(e){return this.sum(e,"Total")}static \u0275fac=function(t){return new(t||n)(g(F),g(z),g(So),g($))};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var Ai=class{Code;Provider;EntityID;Customer;ShoppingCart};var Tt=class n{salesOrderService=I(F);registerService=I(ne);customerService=I(Re);orderCalculator=I(re);generateRedeemCouponDto(e,t){let i=new Ai,o=this.registerService.Data?.EntityID;return i.Code=e,i.Provider=t,i.ShoppingCart={Amount:this.orderCalculator.Data,Items:this.generateItems()},i.EntityID=o,i.Customer=this.generateCustomer(t),i}generateItems(){return this.salesOrderService.Data.CartItems.map(i=>({Price:i.Price,Quantity:i.Quantity,VariantID:i.VariantID,Code:i?.Variant?.Code}))}generateCustomer(e){let t=this.customerService.Data,i=this.salesOrderService?.Data?.Order?.CustomerID,o=null;return h.IsNotEmpty(i)&&(o={Phone:t.Mobile,Email:t.Email},e==="Internal"&&(o=ti({ID:i},o))),o}static \u0275fac=function(t){return new(t||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var wt=class n{constructor(e,t,i,o,r,c){this._httpService=e;this._orderDataService=t;this._userRoleService=i;this.toastr=o;this._invoiceCalculatorService=r;this.promotionCouponFactoryService=c;this.subscribeToObservable()}dialog=I(we);role;originalRoleData;_coupon=E(null);salesOrderBeforePromotion=E(null);isShowToastrInApplyCoupon=E(!1);get coupon(){return this._coupon()}subscribeToObservable(){this._userRoleService.Data$.subscribe(e=>{this.role=e,h.IsEmpty(this.originalRoleData)&&(this.originalRoleData=pe(Ue,e))})}RedeemCoupon(e,t,i=!1){i||(this.isShowToastrInApplyCoupon.set(!0),this.copyOriginalSalesOrder());let o=this.promotionCouponFactoryService.generateRedeemCouponDto(e,"Internal");this._httpService.post(j.ValidateInternalCoupon,o).subscribe({next:r=>{switch(this._orderDataService.Data.Order.PromotionCoupon=e,this._orderDataService.Data.Order.PromotionNote=t,this._orderDataService.Data.Order.CouponType=1,r.Requirement?.Type){case 1:this.HandleDiscountPercentage(r);break;case 2:this.HandleDiscountAmount(r);break;case 3:this.handleCouponReturnAccess(r);break;case 4:this.handleCouponParkedDeletionAccess();break;case 5:this.handleFullAccessCoupon();break;case 6:this.handleDeleteItemCoupon();break}this._coupon.set(r),this.isShowToastrInApplyCoupon.set(!1)},error:r=>{this.removeAppliedCoupon(!1),this.isShowToastrInApplyCoupon.set(!1)}})}setCouponOnEdit(e){this._coupon.set(e),this.generateOriginalSalesOrderOnEdit()}generateOriginalSalesOrderOnEdit(){let e=pe(G,this._orderDataService.Data);e.Order.PromotionCoupon=null,e.Order.PromotionNote=null,e.Order.Discount=0,e.Order.DiscountAmount=0,this.salesOrderBeforePromotion.set(e)}copyOriginalSalesOrder(){let e=pe(G,this._orderDataService.Data);this.salesOrderBeforePromotion.set(e)}HandleDiscountPercentage(e,t=!1){e.Amount>0?e.Requirement?.MaximumDiscount>0?this.applyConfigMaxDiscount(e,t):e.Requirement?.FullPriceProductOnly?this.applyFullPriceDisc(e,t):this.applyDiscountPercentage(e,t):(this.role.Discount=t?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyFullPriceDisc(e,t=!1){let i=this._orderDataService.Data,o=this.filterItemWithDisc(i.CartItems),r=this.filterItemWithCouponDisc(i.CartItems);if(t)r.length>0?(i.CartItems=this.resetItemsDisc(i.CartItems),this._orderDataService.pushNewValue()):this.applyDiscountPercentage(e,t);else if(o.length>0){let c=this.filterItemWithoutDisc(i.CartItems);c.length>0?this.applyConfigItemsScope(e,c).subscribe(u=>{let P=this.applyItemsDisc(u,e);i.CartItems=this.updateCartItems(P,e),this._orderDataService.pushNewValue(i),this.showToastr(e)}):(this.removeAppliedCoupon(!1),this._orderDataService.pushNewValue(),this.toastr.error("No products in the cart qualify for coupon use","Coupon Not Applied"))}else this.applyDiscountPercentage(e,t)}updateCartItems(e,t){let o=this._orderDataService.Data.CartItems.map((r,c)=>{let u=e.find(P=>this.isSameCartItem(P,r));return u||r});return o=this.applyOneOfFirstQuantity(o,t),o}applyOneOfFirstQuantity(e,t){if(t?.Requirement?.RequirementDiscountType==2){let i=e.findIndex(o=>o.CouponDiscount>0);if(e[i]?.Quantity>1){let o=pt(De,e[i]);o.Quantity=1,o.ID=h.GuidEmpty,e[i].Quantity=e[i].Quantity-1,e[i].CouponDiscount=0,e[i].Discount=0,e[i].DiscountAmount=0,e.push(o)}}return e}filterItemWithDisc(e){return e.filter(i=>i.Discount>0||i.DiscountAmount>0||i.Price!=i?.Variant?.UnitPrice||h.IsNotEmpty(i.PriceBookID)||i.PriceTypeID==2)}filterItemWithoutDisc(e){return e.filter(i=>this.itemConditionFullPriceOnly(i))}filterItemWithCouponDisc(e){return e.filter(i=>i.CouponDiscount>0)}applyDiscountPercentage(e,t=!1){let i=this._orderDataService.Data.Order.CustomerDiscountRate,o=e.Amount;if(t){let r=this._orderDataService.Data;this._orderDataService.Data.Order.Discount=0,r.CartItems=this.resetItemsDisc(r.CartItems),this._orderDataService.pushNewValue(r)}else o>=i?e.ApplyToProduct?.length>0?this.applyDiscountRequiredItems(e):(this._orderDataService.Data.Order.Discount=e.Amount,this._orderDataService.pushNewValue(),this.showToastr(e)):(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.removeAppliedDiscountOnCustomerChange())}applyDiscountRequiredItems(e){let i=this._orderDataService.Data.CartItems.filter(o=>e.ApplyToProduct.map(r=>r.ID)?.includes(o.VariantID));this.applyConfigItemsScope(e,i).subscribe(o=>{let r=o.map(u=>(u.Discount=e.Amount,u.CouponDiscount=e.Amount,u)),c=this.updateCartItems(r,e);this._orderDataService.Data.CartItems=c,this._orderDataService.pushNewValue(),this.showToastr(e)})}showToastr(e){let t=e?.Requirement?.Notify;h.IsNotEmpty(t)&&this.isShowToastrInApplyCoupon()&&this.toastr.success(t,"Coupon Applied")}applyConfigMaxDiscount(e,t=!1){let i=this._orderDataService.Data.CartItems;e.Requirement?.FullPriceProductOnly&&(i=i.filter(o=>this.itemConditionFullPriceOnly(o))),this.applyConfigItemsScope(e,i,t).subscribe(o=>{this.applyMaxDiscount(e,o,t)})}applyConfigItemsScope(e,t,i=!1){let o=e.Requirement?.RequirementDiscountType;return(o==1||o==2)&&i==!1?this.dialog.open(Ni,{data:{coupon:e,cartItems:t},id:"modal-coupon-selected-item"}).afterClosed().pipe(ae(c=>{let k=this._orderDataService.Data.CartItems.some(Q=>Q.CouponDiscount>0);!c&&!k&&this.removeAppliedDiscountOnCustomerChange()}),ce(c=>!!c)):Ae(t)}applyMaxDiscount(e,t,i=!1){let o=this._invoiceCalculatorService.calculateGrossTotal(t),r=this._orderDataService.Data,c=o*e.Amount/100,u=e.Requirement?.MaximumDiscount,P=t;c>=u?(r.Order.DiscountAmount=i?0:u,P=this.resetItemsDisc(t)):(r.Order.DiscountAmount=0,P=i?this.resetItemsDisc(t):this.applyItemsDisc(t,e)),r.CartItems=this.updateCartItems(P,e),this._orderDataService.pushNewValue(r),i||this.showToastr(e)}resetItemsDisc(e){return this.coupon?.Requirement?.RequirementDiscountType==2?e=this.resetConfigOneOfFirstQuantity(e):e=e.map(t=>(t.CouponDiscount>0&&(t.Discount=0,t.DiscountAmount=0,t.CouponDiscount=0),t)),e}resetConfigOneOfFirstQuantity(e){let t=e.findIndex(i=>i.CouponDiscount>0);if(t!==-1){let i=e.findIndex(o=>o.CouponDiscount==0&&e[t]?.VariantID==o?.VariantID);i!==-1?(e.splice(t,1),e[i].Quantity+=1):(e[t].CouponDiscount=0,e[t].Discount=0,e[t].DiscountAmount=0)}return e}applyItemsDisc(e,t){return t.ApplyToProduct?.length>0?e=this.applyDiscByVariant(e,t):e=e.map(i=>(i.Discount=t.Amount,i.CouponDiscount=t.Amount,i)),e}applyDiscByVariant(e,t){return e=e.map(i=>(t.ApplyToProduct.find(r=>r.ID==i.VariantID)&&this.itemConditionFullPriceOnly(i)&&(i.Discount=t.Amount,i.CouponDiscount=t.Amount),i)),e}itemConditionFullPriceOnly(e){return(e.Discount==0||e.CouponDiscount>0)&&e.DiscountAmount==0&&e.Price==e?.Variant?.UnitPrice&&h.IsEmpty(e.PriceBookID)}HandleDiscountAmount(e,t=!1){e.Amount>0?(e.ApplyToProduct?.length>0?this.applyDiscountInItem(e,t):(t?this._orderDataService.Data.Order.DiscountAmount=0:(this._orderDataService.Data.Order.DiscountAmount=e.Amount,this.showToastr(e)),this._orderDataService.pushNewValue()),this.resetCustomerPoint(t)):(this.role.Discount=t?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyDiscountInItem(e,t=!1){let i=this._orderDataService.Data;if(t)i.CartItems=this.resetItemsDisc(i.CartItems);else{let r=i.CartItems.filter(c=>e.ApplyToProduct.map(u=>u.ID)?.includes(c.VariantID));this.applyConfigItemsScope(e,r,t).subscribe(c=>{let u=c.map(P=>(P.DiscountAmount=e.Amount,P.CouponDiscount=e.Amount,P));i.CartItems=this.updateCartItems(u,e),this._orderDataService.pushNewValue(i),this.showToastr(e)})}}resetCustomerPoint(e){if(!e){let t=this._orderDataService.Data;t.Order.PointUsed=0}}handleCouponReturnAccess(e){let t=pe(Ue,this.role);t.Return=!0,this._userRoleService.pushNewValue(t),this.isShowToastrInApplyCoupon()&&this.toastr.success("You got access to return a sales transaction!","Coupon Applied")}handleCouponParkedDeletionAccess(){let e=pe(Ue,this.role);e.ParkedDeletionAuthorized=!0,this._userRoleService.pushNewValue(e),this.isShowToastrInApplyCoupon()&&this.toastr.success("You Have Access to delete park and delete item when retrieve!","Coupon Applied")}handleFullAccessCoupon(){let e=pe(Ue,this.role);e.UnitPriceEditor=!0,e.Discount=!0,e.Return=!0,e.Tax=!0,e.NumberEditor=!0,e.DateEditor=!0,e.PricebookSelector=!0,e.DeleteItem=!0,e.ParkedDeletionAuthorized=!0,this._userRoleService.pushNewValue(e),this.isShowToastrInApplyCoupon()&&this.toastr.success("You now have Full Access for this Order!","Coupon Applied")}handleDeleteItemCoupon(){let e=pe(Ue,this.role);e.DeleteItem=!0,this._userRoleService.pushNewValue(e),this.isShowToastrInApplyCoupon()&&this.toastr.success("You Have Access to delete item","Coupon Applied")}removeAppliedCoupon(e=!0){this._userRoleService.pushNewValue(this.originalRoleData),this._orderDataService.pushNewValue(this.salesOrderBeforePromotion()),this.salesOrderBeforePromotion.set(null),this._coupon.set(null),e&&this.toastr.warning("Coupon Cancelled","Warning")}resetCouponOnNewTransaction(){this._userRoleService.pushNewValue(this.originalRoleData),this._coupon.set(null)}removeAppliedDiscountOnCustomerChange(){if(this.coupon)switch(this.coupon.Requirement?.Type){case 1:this.HandleDiscountPercentage(this._coupon(),!0),this.removeAppliedCouponOnCustomerChange();break;case 2:this.HandleDiscountAmount(this._coupon(),!0),this.removeAppliedCouponOnCustomerChange();break}}removeAppliedCouponOnCustomerChange(){if(this.coupon){let e=this._orderDataService.Data;e.Order.PromotionCoupon=null,e.Order.PromotionNote=null,this._coupon.set(null),this._userRoleService.pushNewValue(this.originalRoleData),this._orderDataService.pushNewValue(e)}}isSameCartItem(e,t){return e.VariantID===t.VariantID&&e.Quantity===t.Quantity&&e.Price===t.Price&&e.Discount===t.Discount&&e.PriceBookID===t.PriceBookID}static \u0275fac=function(t){return new(t||n)(g(ge),g(F),g(Pe),g(V),g(re),g(Tt))};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var Rt=class{CommissionID;ReturNumber;parkTemporaryItem;posState;InputTextValue;constructor(){this.posState=0,this.CommissionID="",this.ReturNumber="",this.parkTemporaryItem=[],this.InputTextValue=""}};var ki=class n{constructor(e,t,i){this._promotionEventService=e;this._dialogRef=t;this.data=i;this.modalConfig=new ee,this.modalConfig.hideCancel=!0,this.modalConfig.hideClose=!0,this.modalConfig.headerType=me.Warning,this.modalConfig.title="Promotion Requirement unfulfilled!",this.modalConfig.customWidth="350px",this.modalConfig.okText="Ok",this.selectedPromotion=e.selectedPromotion}modalConfig;selectedPromotion;onOk(){this._promotionEventService.restoreOrder(),this._dialogRef.close()}static \u0275fac=function(t){return new(t||n)(S(Ne),S(X),S(fe))};static \u0275cmp=N({type:n,selectors:[["POS-modal-promotion-confirm"]],standalone:!1,decls:9,vars:4,consts:[[3,"onOk","config"],[1,"fst-italic","text-danger","mb-3"],[1,"mb-0"]],template:function(t,i){t&1&&(a(0,"modal-material",0),b("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()()()()),t&2&&(p("config",i.modalConfig),l(4),D(i.selectedPromotion==null?null:i.selectedPromotion.Name),l(2),D(i.selectedPromotion==null?null:i.selectedPromotion.Description),l(2),D(i.data==null?null:i.data.message))},dependencies:[te],encapsulation:2})};var Vi=class extends De{};var At=class n{constructor(e,t,i,o,r,c,u,P,k,Q){this.variantService=e;this._posService=t;this._orderDataService=i;this.toastr=o;this._orderProcessorService=r;this._customerHttpService=c;this.promotionCouponService=u;this.promotionCouponExternalService=P;this.userRoleService=k;this.decimalPipe=Q;this.subscribeToObservable()}salesOrderData;appConfigJson;entityID;audio=new Audio;subscribeToObservable(){this._posService.Data$.pipe(Z()).subscribe(e=>{this.appConfigJson=e.AppConfigJSON}),this._orderDataService.Data$.pipe(Z()).subscribe(e=>{this.salesOrderData=e,this.entityID=e.Order.EntityID}),this._orderProcessorService.Data$.pipe(Z()).subscribe(e=>{e.posState==3&&this.clearCartItemsInLocalStorage()})}addCartItemById(e,t,i=!0){return new Promise((o,r)=>{this.variantService.findVariantByID(e,this.entityID,i).then(c=>{this.createNewCartItem(c,t),o(c)}).catch(c=>{r(c)})})}addCartItemByCode(e){return new Promise((t,i)=>{let o=this.appConfigJson.ModuleSell.DigitalScale;o.Digit>0&&h.IsNotEmpty(o.Regex)&&e.length==o.Digit?this.parseDigitalScaleBarcodeWithRegex(e,o).then(c=>{c||(this.toastr.info("Matching Regex Rule to Barcode","Digital Scale"),this.findVariantByCode(e).then(u=>t(u)).catch(u=>i(u)))}):this.findVariantByCode(e).then(c=>t(c)).catch(c=>i(c))})}findVariantByCode(e){let t=this.appConfigJson.ModuleSell.BarcodeSerialEnabled;return new Promise((i,o)=>{this.variantService.findVariantByCode(e,this.entityID,t).then(r=>{i(r),this.createNewCartItem(r)}).catch(r=>{this.playBellRing(),o(r)})})}addItemBySerial(e){this.variantService.findVariantBySerial(e,this.entityID).subscribe(t=>{let i=this.salesOrderData.CartItems;if(i.length>0){let o,r=[],c=i.findIndex(u=>u.Variant.ID==t.ID);r=[],c!==-1?(o=i[c].Serial?.findIndex(u=>u.Number==e),r=[...i[c].Serial?i[c].Serial:[]],o==-1?(r.push({Number:e,Quantity:1}),i[c].Quantity=r.length):r.length>0?r[o].Quantity+=1:(r=[{Number:e,Quantity:1}],this.addNewSerials(t,e)),i[c].Serial=[...r],i[c].Quantity=i[c].calculateSerialQty(),this.updateCartItem(i[c],c)):this.addNewSerials(t,e)}else this.addNewSerials(t,e)})}addNewSerials(e,t){e.Serial=[{Number:t,Quantity:1}],this.createNewCartItem(e)}playBellRing(){this.audio.src="//res.cloudinary.com/pos/video/upload/v1659947782/POS/Music/bell_ring.mp3",this.audio.load(),this.audio.play()}updateCartItem(e,t){this.salesOrderData.CartItems[t]=e,this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint(),this.reApplyPromotionCoupon(),this.saveItemsToLocalStorage()}deleteCartItem(e){this.salesOrderData.CartItems=this.salesOrderData.CartItems.filter(t=>t!==e),this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint(),this.isRemoveItemRequirement(e)&&this.reApplyPromotionCoupon()}parseDigitalScaleBarcodeWithRegex(e,t){return new Promise(i=>{let o=this.appConfigJson.ModuleSell.BarcodeSerialEnabled,r=new RegExp(t.Regex),c=e.match(r);if(console.log(c),h.IsNotEmpty(c)){let u=c[1],P=parseFloat(c[2]);console.log(P,"productQuantity"),P=P/t.QuantityDivider,this.variantService.findVariantByCode(u,this.entityID,o).then(k=>{this.createNewCartItem(k,null,P),i(!0)}).catch(()=>{i(!1)})}else i(!1)})}createNewCartItem(e,t,i){let o=new De,r=this.appConfigJson.ModuleSell.ProductNotes.CopyProductDescription,c=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;o.patchByVariant(e,r,c),o=this.applyReward(o,t),h.IsEmpty(t)&&(o=this.applyPriceBook(o)),this.validateCartItem(o)&&(o.Quantity=i||o.Quantity,t?.PromotionType==2?this.handlingPromotionQuantity(o):this.pushNewItemToArray(o,o.PromotionGift),this.applyCustomerPoint()),this.addAvailableComponent(o)}applyCustomerPoint(){let e=this.salesOrderData.Order.CustomerID,t=h.IsEmpty(e);this._orderProcessorService.reedemPointToDiscount(t)}handlingPromotionQuantity(e){let t=pe(De,this.salesOrderData.CartItems),i=t.findIndex(o=>o.VariantID==e.VariantID&&o.PromotionGift);i!==-1?t[i].Quantity+=e.Quantity?e.Quantity:1:t=[...t,e],this.salesOrderData.CartItems=t,this._orderDataService.pushNewValue(this.salesOrderData)}applyPromotionProduct(e){let t=e.Variant.DiscountAmount;return t&&(e.Price=e.UnitPriceOriginal-t),e}applyReward(e,t){if(t){let i=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;e.Discount=t.Discount,e.Price=t.OriginalPrice;let o=t.OriginalPrice-t.UnitPrice;e.Price=e.UnitPriceOriginal-o,e.UnitPrice=e.UnitPriceOriginal-o,e.PromotionGift=!0,e.PromotionID=t.PromotionID,e.Quantity=t.Quantity?t.Quantity:1,e.PriceTypeID=3,e.Cost+=t.ExtraCost,e.UnitCost+=t.ExtraCost,e.PriceNote=t.PromotionName,i&&(e.Note=`${e.Note?e.Note:""} ${t.PromotionName} `)}return e}addAvailableComponent(e){let t=e.Price!=0,i=this.appConfigJson.ModuleSell.SellProductComponentDefaultPrice,o=e.Variant;if(o.Component!=null&&o.Component.length>0)for(let r of o.Component){let c=new Vi;c.patchByVariant(r),c.Quantity=e.Quantity*r.Quantity,t&&!i&&(r.UnitPrice=0),c.Price=r.UnitPrice,this.pushNewItemToArray(c)}}pushNewItemToArray(e,t=!1){let i=this.salesOrderData.CartItems.findIndex(o=>o.VariantID==e.VariantID);if(e=this.applyPromotionProduct(e),i==-1||t)this.salesOrderData.CartItems.push(e);else{let o=this.appConfigJson.ModuleSell.QuickKey.NewRowBehaviour;if(o==2)this.salesOrderData.CartItems.push(e);else if(o==1)this._orderProcessorService.Data.posState==4?this.salesOrderData.CartItems.push(e):this.addingQuantityItem(i,e);else{if(!this.validatePrepaidPackage(e,i)){this.toastr.error("This prepaid package is already in the cart while editing. Please remove it first before adding again.","Cannot Add Item");return}this.addingQuantityItem(i,e)}}this._orderDataService.pushNewValue(this.salesOrderData),this.saveItemsToLocalStorage(),this.reApplyPromotionCoupon()}saveItemsToLocalStorage(){let e=this.userRoleService.Data.DeleteItem,t=this._orderProcessorService.Data?.posState;if(!e&&t!==4){let o=this._orderDataService.Data.CartItems;try{localStorage.setItem("cart_items",JSON.stringify(o))}catch(r){console.error("Error saving cart items to localStorage:",r)}}}clearCartItemsInLocalStorage(){let e=this.promotionCouponService?.coupon,t=this.userRoleService.Data?.DeleteItem;if(e&&(!t||e.Requirement?.Type==5||e.Requirement?.Type==6))try{localStorage.removeItem("cart_items")}catch(i){console.error("Error clearing cart items from localStorage:",i)}}validatePrepaidPackage(e,t){let i=this.salesOrderData.CartItems[t],o=this._orderProcessorService.Data.posState,r=e.Variant.TypeID==10,c=h.IsNotEmpty(i.ID),u=!0;return o==2&&r&&c&&(u=!1),u}reApplyPromotionCoupon(){let e=this.salesOrderData.Order.CouponProvider,t=e=="Internal"||h.IsEmpty(e),i=this.salesOrderData.Order.PromotionCoupon,o=this.salesOrderData.Order.PromotionNote;h.IsNotEmpty(i)&&(t?this.promotionCouponService.RedeemCoupon(i,o,!0):this.promotionCouponExternalService.redeemCoupon(i,"External",o))}isRemoveItemRequirement(e){let t=this.promotionCouponService?.coupon,i=t?.ApplyToProduct,o=!0;return h.IsNotEmpty(t)&&i?.length>0&&(o=i.some(r=>r.ID==e.VariantID)),o}addingQuantityItem(e,t){let i=this.salesOrderData.CartItems.filter(u=>u.VariantID==t.VariantID),o=i.length,r=i.find(u=>!u.PromotionGift);this.salesOrderData.CartItems[e].PromotionGift&&o==1?this.salesOrderData.CartItems.push(t):(r.Quantity+=t.Quantity,r=this.applyPromotionProduct(r)),r&&(r=this.applyPriceBook(r))}validateCartItem(e){return e.Variant.CategoryTypeID==-1?(this.toastr.info(e.Variant.Name+" cannot be sold, check Category "+e.Variant.CategoryName+" settings","info"),!1):!(!this.validatePriceMinimum(e)||!this.validateSerialItem(e))}validatePriceMinimum(e){let t=!0,i=this.userRoleService.Data.PriceMinimum,o=this.appConfigJson.ModuleSell.ProductDialog.PriceMinimumTypeID;if(i){let r=0;switch(o){case 1:r=e.UnitPrice;break;case 2:r=e.UnitCost;break;case 3:r=e.UnitPriceMinimum;break}if(e.Price<r){t=!1;let c=h.StringFormat("You have no right to sell this item lower than {0}",this.decimalPipe.transform(r));alert(c)}}return t}validateSerialItem(e){let t=!0;if(e?.Serial?.length>0&&e.Variant.TypeID==4&&e.Quantity>0){let i=0;e?.Serial?.forEach(o=>{i+=o.Quantity}),i!=e.Quantity&&(this.toastr.error("Serial must be equal with the quantity","Error"),t=!1)}return t}applyPriceBook(e){let t=e.Variant.PriceBook!=null?e.Variant.PriceBook:[],i=this.findCustomerPricebook(t);if(t&&t.length!==0){let o=t.sort(function(r,c){return c.MinimumQuantity-r.MinimumQuantity}).filter(r=>e.Quantity>=r.MinimumQuantity&&r.MinimumQuantity!=0);o.length>0||h.IsNotEmpty(i)?h.IsNotEmpty(i)?e=this.applyPricebookToItem(e,i):e=this.applyPricebookToItem(e,o[0]):e=this.resetAppliedPricebook(e)}return e}resetAppliedPricebook(e){let i=(e?.Variant?.PriceBook).find(o=>o.ID==e.PriceBookID);return h.IsNotEmpty(i)&&(e.Discount=e.Variant.PriceDiscount,e.PriceBookID=h.GuidEmpty,e.Price=e.Variant.UnitPrice,e.UnitPrice=e.Variant.UnitPrice,e.PriceTypeID=0,e=this.applyPromotionProduct(e),e=this.removePromotionNote(e)),e}removePromotionNote(e){let t=this.appConfigJson.ModuleSell.ProductNotes;if(this.appConfigJson?.ModuleSell?.Pricebook?.PricebookVisible&&(e.Note=e.Note?.replace(e.PriceNote,""),e.PriceNote=""),t.CopyPromotionName){let o=e.Variant?.PriceNote;e.Note=`${o||""} ${e.Note?e.Note:""}`,e.PriceNote=o}return e}applyPricebookToItem(e,t){return e.Discount=t.PriceDiscount,e.UnitPrice=t.UnitPrice,e.PriceBookID=t.ID,e.Price=t.UnitPrice,e.PriceTypeID=2,e=this.assignItemNote(e,t),e}assignItemNote(e,t){return this.appConfigJson?.ModuleSell?.Pricebook?.PricebookVisible?(e.Note?.includes(e.PriceNote)?e.Note=e.Note?.replace(e.PriceNote,t.Name):e.Note=`${t.Name} ${e.Note?e.Note:""}`,e.PriceNote=t.Name):(e.Note="",e.PriceNote=""),e}findCustomerPricebook(e=[]){let t=this._customerHttpService.Data,i;return t&&(i=e.find(o=>o.ID==t.PricebookID)),i}static \u0275fac=function(t){return new(t||n)(g(yo),g(z),g(F),g(V),g(He),g(Re),g(wt),g(Fi),g(Pe),g($))};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};function vr(n,e){if(n&1&&(a(0,"div",9)(1,"div",4),_(2,"input",10),s()()),n&2){let t=d();l(2),p("formControl",t.searchControl)}}function _r(n,e){n&1&&(a(0,"span"),m(1,"Apply"),s())}function yr(n,e){n&1&&(a(0,"span"),m(1,"Applying..."),s())}function br(n,e){if(n&1){let t=T();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),b("click",function(){let o=C(t).$implicit,r=d();return v(r.onSelectReward(o))}),f(13,_r,2,0,"span",14)(14,yr,2,0,"span",14),s()()()}if(n&2){let t=e.$implicit,i=d();l(2),D(t.VariantName),l(2),D(t.VariantCode),l(2),D(M(7,7,t.OriginalPrice)),l(3),D(M(10,9,t.UnitPrice)),l(3),p("disabled",i.isApplyingReward()),l(),p("ngIf",!i.isApplyingReward()),l(),p("ngIf",i.isApplyingReward())}}var Bi=class n{constructor(e,t,i,o,r,c){this._dialogRef=e;this._matDialog=t;this._shoppingCartService=i;this._promotionEventService=o;this._toastr=r;this.data=c;this.selectedPromotion=this._promotionEventService.selectedPromotion}modalConfig=new ee;selectedPromotion;rewards$;searchControl=new Ze;isApplyingReward=E(!1);ngOnInit(){this.modalConfig.title="Select a Reward",this.modalConfig.hideFooter=!0,this.initRewards(!0)}initRewards(e){this.rewards$=this.searchControl.valueChanges.pipe(ai(""),ht(e?0:500),Ve(),Y(t=>{let i;return i=Ae(this.data.rewards).pipe(J(o=>o.filter(r=>this.findKeywordInValue(t,r?.VariantCode)||this.findKeywordInValue(t,r?.VariantName)))),e=!0,i}))}findKeywordInValue(e,t){return t?.toUpperCase()?.indexOf(e?.toUpperCase())>-1}onSelectReward(e){return ii(this,null,function*(){if(!this.isApplyingReward()){this.isApplyingReward.set(!0);try{e.PromotionType=this.data.promotion.TypeID,yield this._shoppingCartService.addCartItemById(e.VariantID,e,!0).then(()=>{this._matDialog.closeAll(),this._promotionEventService.pushNewValue(this._promotionEventService.Data),this.showToastAppliedPromo()})}finally{this.isApplyingReward.set(!1)}}})}showToastAppliedPromo(){this._toastr.success("Applied "+this.selectedPromotion.Name+" to order!","Applied successfully!")}close(){this._dialogRef.close()}static \u0275fac=function(t){return new(t||n)(S(X),S(we),S(At),S(Ne),S(V),S(fe))};static \u0275cmp=N({type:n,selectors:[["POS-modal-select-item"]],standalone:!1,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","disabled"],[4,"ngIf"]],template:function(t,i){t&1&&(a(0,"modal-material",0),b("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),a(1,"content")(2,"div",1),f(3,vr,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(),_(17,"th",7),s()(),a(18,"tbody"),f(19,br,15,11,"tr",8),y(20,"async"),y(21,"sortBy"),s()()()()()()()),t&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",_t(21,5,M(20,3,i.rewards$),"desc","VariantCode")))},dependencies:[ye,se,Ie,be,yt,te,Je,$,Ot],styles:[".table-scroll[_ngcontent-%COMP%]{max-height:400px;overflow-y:auto}table[_ngcontent-%COMP%]{max-width:600px!important;overflow-x:hidden}"]})};function Sr(n,e){if(n&1&&(U(0),a(1,"div",13)(2,"div",7),_(3,"input",14),s()(),W()),n&2){let t=d();l(3),p("formControl",t.searchCtrl)}}function Pr(n,e){n&1&&(U(0),a(1,"th",15),m(2,"Qty"),s(),W())}function Or(n,e){n&1&&_(0,"th",10)}function Dr(n,e){if(n&1){let t=T();U(0),a(1,"td")(2,"input",17),B("ngModelChange",function(o){C(t);let r=d().$implicit;return A(r.Quantity,o)||(r.Quantity=o),v(o)}),s()(),W()}if(n&2){let t=d().$implicit;l(2),L("ngModel",t.Quantity)}}function Mr(n,e){n&1&&(a(0,"span"),m(1,"Apply"),s())}function xr(n,e){n&1&&(a(0,"span"),m(1,"Applying..."),s())}function Ir(n,e){if(n&1){let t=T();a(0,"td",18)(1,"button",19),b("click",function(){C(t);let o=d().$implicit,r=d();return v(r.onApplyReward(o))}),f(2,Mr,2,0,"span",5)(3,xr,2,0,"span",5),s()()}if(n&2){let t=d(2);l(),p("disabled",t.isApplyingReward()),l(),p("ngIf",!t.isApplyingReward()),l(),p("ngIf",t.isApplyingReward())}}function Tr(n,e){if(n&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(),f(11,Dr,3,1,"ng-container",11)(12,Ir,4,3,"ng-template",null,1,xe),s()),n&2){let t=e.$implicit,i=q(13),o=d();l(2),D(t.VariantName),l(2),D(t.VariantCode),l(2),D(M(7,6,t.OriginalPrice)),l(3),D(M(10,8,t.UnitPrice)),l(2),p("ngIf",o.rewardQuantity>1)("ngIfElse",i)}}var Hi=class n{constructor(e,t,i,o,r,c){this.data=e;this.shoppingCartService=t;this.promotionEventService=i;this.dialogRef=o;this.matDialog=r;this.toastr=c;this.searchCtrl=new Ze,this.rewardQuantity=e.rewardQuantity,this.sourceRewards=[...e.rewards]}modalConfig;rewards$;rewardQuantity;rewards;sourceRewards=[];searchCtrl;isApplyingReward=E(!1);ngOnInit(){this.initModalConfig(),this.initSearchCtrl(!0)}initModalConfig(){this.modalConfig=new ee,this.modalConfig.title="Select a Reward",this.rewardQuantity<2&&(this.modalConfig.hideFooter=!0)}initSearchCtrl(e){this.rewards$=this.searchCtrl.valueChanges.pipe(ai(""),ht(e?0:500),Ve(),Y(t=>{let i;return i=Ae(this.sourceRewards).pipe(J(o=>(o.length===1&&(o[0].Quantity=this.rewardQuantity),o)),J(o=>o.filter(r=>this.findKeywordInValue(t,r?.VariantCode)||this.findKeywordInValue(t,r?.VariantName)))),e=!1,i}),ae(t=>{this.rewards=t}))}findKeywordInValue(e,t){return t?.toUpperCase()?.indexOf(e.toUpperCase())>-1}onApplyReward(e){return ii(this,null,function*(){if(!this.isApplyingReward()){this.isApplyingReward.set(!0);try{yield this.addRewardToShoppingCart(e)}finally{this.isApplyingReward.set(!1)}}})}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 e=0;return this.rewards.forEach(t=>{e+=t.Quantity?t.Quantity:0}),e}addRewardToShoppingCart(e){return e.PromotionType=this.data.promotion.TypeID,this.shoppingCartService.addCartItemById(e.VariantID,e,!0).then(()=>{this.matDialog.closeAll(),this.promotionEventService.pushNewValue(this.promotionEventService.Data)})}static \u0275fac=function(t){return new(t||n)(S(fe),S(At),S(Ne),S(X),S(we),S(V))};static \u0275cmp=N({type:n,selectors:[["app-modal-quantity-reward"]],standalone:!1,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","disabled"]],template:function(t,i){if(t&1){let o=T();a(0,"modal-material",2),b("onCancel",function(){return C(o),v(i.onClose())})("onOk",function(){return C(o),v(i.onOk())})("onClose",function(){return C(o),v(i.onClose())}),a(1,"header")(2,"small",3),m(3),s()(),a(4,"content")(5,"div",4),f(6,Sr,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(),f(20,Pr,3,0,"ng-container",11)(21,Or,1,0,"ng-template",null,0,xe),s()(),a(23,"tbody"),f(24,Tr,14,10,"tr",12),y(25,"async"),y(26,"sortBy"),s()()()()()()()}if(t&2){let o=q(22);p("config",i.modalConfig),l(3),O(" ( ",i.rewardQuantity," products reward ) "),l(3),p("ngIf",(i.sourceRewards==null?null:i.sourceRewards.length)>5),l(14),p("ngIf",i.rewardQuantity>1)("ngIfElse",o),l(4),p("ngForOf",_t(26,8,M(25,6,i.rewards$),"desc","VariantCode"))}},dependencies:[ye,se,Ie,be,Te,yt,te,Pt,Je,$,Ot],encapsulation:2})};var Ne=class n{constructor(e,t,i,o,r,c,u,P,k){this._orderDataService=e;this._outletService=t;this._invoiceCalculatorService=i;this._dialog=o;this._httpService=r;this._posService=c;this._toastr=u;this._signalrService=P;this.decimalPipe=k;this.previousQuantity=0,this.previousTotalEligible=0,this.subscribeNotification(),this._posService.Data$.subscribe(Q=>{this.taxes=Q.Taxes}),this._outletService.Data$.subscribe(Q=>{this.loadPromotions(Q.Promotion)}),this._orderDataService.Data$.pipe(ce(Q=>{this.salesOrderData=Q;let ve=this.calculateOrderReward(Q.getRewards()),Cn=this.calculateOrderReward(this.previousRewards);return this.previousQuantity!=Q.TotalQuantity||Cn<ve||this.isRestroreOrder}),ht(100)).subscribe(Q=>{this.isRestroreOrder=!1,this.checkQtyPromotion(),this.applyQuantityPromotion(),this.previousRewards=[...Q.getRewards()]}),this._invoiceCalculatorService.Data$.subscribe(Q=>{this.checkEligiblePromotionWithMinSpend()})}_Data=new _e([]);get Data(){return this._Data.getValue()}Data$=this._Data.asObservable();selectedPromotion=null;onClickToastPromo=new Oe;previousQuantity;salesOrderData;orderDataBeforePromotion;taxes=[];previousTotalEligible;previousRewards=[];isRestroreOrder=!1;calculateOrderReward(e){let t=0;return e.length>0&&(t=e.map(i=>i.Quantity).reduce((i,o)=>i+o)),t}checkQtyPromotion(){let e=this._orderDataService.Data;this.checkEligibleQtyPromotion(e.CartItems),this.checkEligibleTierPromotion(e.CartItems),this.previousQuantity=e.TotalQuantity}subscribeNotification(){this._signalrService.OnPromotionEventChange.pipe(Z(),Y(()=>{let e=this._outletService.Data?.RegisterID;return this.getPromotions(e)})).subscribe(()=>{this._toastr.info("Promotion Event Updated","Promotion Update")})}getPromotions(e){return this._httpService.get(j.GetListPromotion,[{key:"RegisterID",value:e}]).pipe(ae(t=>{this.loadPromotions(t)}))}loadPromotions(e){let t=this.getPromotionDesc(e);this.pushNewValue(t),this.checkQtyPromotion(),this.checkEligiblePromotionWithMinSpend()}pushNewValue(e){this.showToastEligiblePromotion(),this._Data.next(e)}checkSelectedPromotionRequirement(e){this.selectedPromotion!=null&&this.selectedPromotion.TypeID==e&&this.Data.find(i=>i.ID===this.selectedPromotion.ID)?.Eligible===!1&&(this._dialog.open(ki,{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(e=[]){return e?.map(i=>(i.Description=this.generatePromotionDesc(i),i))}checkEligiblePromotionWithMinSpend(){let e=this._invoiceCalculatorService.Data,t=this.Data?.filter(o=>(o.TypeID===1||o.TypeID==3)&&!this.checkExpiredPromotion(o)).map(o=>(e>=o.MinimumAmount?o.Eligible=!0:o.Eligible=!1,o)),i=this.mappingEligiblePromotion(t);this.pushNewValue(i),this.checkSelectedPromotionRequirement(1),this.checkSelectedPromotionRequirement(3)}checkEligibleQtyPromotion(e){let t=0,i=this.Data?.filter(r=>r.TypeID===2&&!this.checkExpiredPromotion(r)).map(r=>(r.Eligible=!1,r.ListVariant.length>0?(t=this.getQuantityByRequirementType(e,"variant",r.ListVariant),t>=r.MinimumAmount&&(r.Eligible=!0)):r.ListCategory.length>0?(t=this.getQuantityByRequirementType(e,"category",r.ListCategory),t>=r.MinimumAmount&&(r.Eligible=!0)):this.salesOrderData.TotalQuantity>=r.MinimumAmount&&(r.Eligible=!0),r)),o=this.mappingEligiblePromotion(i);this.pushNewValue(o)}checkEligibleTierPromotion(e){let t,i=this.Data?.filter(r=>r.TypeID===5&&!this.checkExpiredPromotion(r)).map(r=>(r.Eligible=!1,r.ListVariant.length>0?t=this.getQuantityByRequirementType(e,"variant",r.ListVariant):r.ListCategory.length>0?t=this.getQuantityByRequirementType(e,"category",r.ListCategory):t=this.salesOrderData.TotalQuantity,r.PromotionTieredQuantity.forEach(c=>{t>=c.Quantity&&(r.Eligible=!0)}),r)),o=this.mappingEligiblePromotion(i);this.pushNewValue(o)}getQuantityByRequirementType(e,t,i){let o=0,r;return t=="variant"?e.forEach(c=>{r=i.findIndex(u=>u.ID===c.VariantID),r!==-1&&(o+=c.Quantity)}):e.forEach(c=>{c.Variant&&(r=i.findIndex(u=>u.ID===c.Variant.CategoryID),r!==-1&&(o+=c.Quantity))}),o}mappingEligiblePromotion(e=[]){let t=this.Data;if(e?.length>0){let i;t=this.Data?.map(o=>(i=e.findIndex(r=>r.ID==o.ID),i!==-1&&(o=e[i]),o))}return t}checkExpiredPromotion(e){let t=new Date,i=new Date(e.StartDate),r=(h.IsEmpty(e.StartTime)?"00:00:00":e.StartTime).split(":").map(k=>parseInt(k));i.setHours(r[0],r[1],r[2]);let c=new Date(e.ExpirationDate),P=(h.IsEmpty(e.EndTime)?"23:59:59":e.EndTime).split(":").map(k=>parseInt(k));return c.setHours(P[0],P[1],P[2]),!(t.getTime()>=i.getTime()&&t.getTime()<=c.getTime())}showToastEligiblePromotion(){let e=this.getTotalEligiblePromotion(),t=h.IsNotEmpty(this.salesOrderData.Order.ID);this.previousTotalEligible!==e&&e>0&&!t&&this._toastr.info(e+" promotion(s) can be applied!","Promo available!",{timeOut:2e4}).onTap.pipe(je(1)).subscribe(()=>{this.onClickToastPromo.next(!0)}),this.previousTotalEligible=e}getTotalEligiblePromotion(){return this.Data?.filter(t=>t.Eligible).length}generatePromotionDesc(e){let t="";switch(e.TypeID){case 2:t+="Minimum "+this.decimalPipe.transform(e.MinimumAmount)+" ",e.ListVariant.length>0?(t=t+" piece of ",t+=this.generateItemListDescription(e.ListVariant)):e.ListCategory.length>0?(t+="from category ",t+=this.generateItemListDescription(e.ListCategory)):t+="items";break;case 1:t+="Minimum spend Rp. "+this.decimalPipe.transform(e.MinimumAmount);break;case 3:t+=`Apply
3
3
  ${e.Discount1!==0?"discount1 = "+e.Discount1+"%":""}
4
4
  ${e.Discount1!==0&&e.Discount2!==0?" and ":""}
@@ -1 +1 @@
1
- import{a as _t,b as ut}from"./chunk-BO3347ID.js";import{a as pt}from"./chunk-FKDZ5OWB.js";import{a as mt}from"./chunk-T5WB2M55.js";import{a as st}from"./chunk-BXQFYW4R.js";import"./chunk-4UYZJCFI.js";import"./chunk-BYXBJQAS.js";import{d as ct,e as dt}from"./chunk-GIDGCFLX.js";import"./chunk-XBRBYCWJ.js";import"./chunk-3RK6DDJD.js";import"./chunk-FP4HFB5J.js";import"./chunk-H3OZSV6V.js";import"./chunk-YEDKRNXU.js";import"./chunk-VZEPVRCY.js";import"./chunk-7QWJJPNG.js";import{d as at,e as rt}from"./chunk-6647Y35T.js";import"./chunk-VHAM2DWK.js";import{a as Z}from"./chunk-JPXXXD26.js";import{a as U}from"./chunk-SGMOAMW4.js";import{f as lt}from"./chunk-2GLNGDED.js";import{b as Y}from"./chunk-QHBWVJIQ.js";import"./chunk-JYLR5O5Q.js";import"./chunk-NI5NXM2W.js";import"./chunk-6JAL37Y4.js";import"./chunk-4QQTEPQT.js";import{a as tt}from"./chunk-XZR3IMWZ.js";import{e as nt,f as ot}from"./chunk-OLSCBS7E.js";import"./chunk-B6LPY2IZ.js";import"./chunk-CWITQVZH.js";import"./chunk-QHRP323Q.js";import"./chunk-WDQ4UKKY.js";import"./chunk-MFCXEITE.js";import"./chunk-MUJ6277G.js";import"./chunk-LMJVRREP.js";import"./chunk-3LBZDIW2.js";import"./chunk-KTCV3KOE.js";import"./chunk-KZDE63UL.js";import"./chunk-JVMOM4H4.js";import{b as $}from"./chunk-P4CJOEI6.js";import"./chunk-3GOO5E5D.js";import"./chunk-XMYLHF4C.js";import"./chunk-H7F34T25.js";import{b as Q,c as J}from"./chunk-JOXTERIM.js";import{N as it,g as et}from"./chunk-TSIYPTYI.js";import"./chunk-XYB3YDKL.js";import"./chunk-7VKFVS7K.js";import"./chunk-ZVDY66SR.js";import{g as X}from"./chunk-3YKVLHZG.js";import"./chunk-ZHY3BUQJ.js";import"./chunk-VFTGIP5A.js";import"./chunk-LE3BKIDY.js";import"./chunk-2FWFPV5I.js";import"./chunk-EEEAUYZ6.js";import{F as H}from"./chunk-RVXZOIFQ.js";import"./chunk-2JIKUIDL.js";import"./chunk-NO3WSZS5.js";import{d as K}from"./chunk-ZZGSAFGO.js";import"./chunk-TDQR33OS.js";import{$a as i,Ac as u,Bc as C,Db as p,Eb as k,Fc as j,Gb as M,Hb as N,Ib as o,Jb as n,Kb as E,Ob as P,Qb as h,Rb as c,Rd as R,Yd as z,Zc as q,db as T,ec as r,fc as w,gc as s,gd as W,jc as g,jd as A,kb as L,kc as I,lc as S,ob as O,qb as y,qc as D,rc as b,ub as V,va as x,vb as _,wa as v,wd as G,zc as d}from"./chunk-UXRO4UFY.js";import"./chunk-7DCB7DB2.js";var xt=()=>["/menu/Outlets/Master/Outlets/Info"],ft=t=>({ID:t}),vt=()=>["/menu/Products/Catalog/Products/Info"];function yt(t,l){if(t&1){let e=P();o(0,"button",11),h("click",function(){x(e);let a=c();return v(a.openExportModal())}),E(1,"i",12),r(2," Export "),n()}}function Tt(t,l){if(t&1){let e=P();o(0,"div",13)(1,"h6"),r(2,"Outlet Group"),n(),o(3,"POS-outlet-group-tree-select",14),S("selectedOutletGroupIDChange",function(a){x(e);let f=c();return I(f.pageData.Filter.OutletGroupID,a)||(f.pageData.Filter.OutletGroupID=a),v(a)}),n(),o(4,"h6"),r(5,"Category"),n(),o(6,"POS-product-category-select",15),S("selectedCategoryIDChange",function(a){x(e);let f=c();return I(f.pageData.Filter.CategoryID,a)||(f.pageData.Filter.CategoryID=a),v(a)}),n(),o(7,"autocompleteV3",16),S("modelNameChange",function(a){x(e);let f=c();return I(f.pageData.Filter.ListProductID,a)||(f.pageData.Filter.ListProductID=a),v(a)}),n(),o(8,"h6"),r(9,"From - To"),n(),o(10,"div")(11,"datepicker",17),S("dateChange",function(a){x(e);let f=c();return I(f.pageData.Filter.From,a)||(f.pageData.Filter.From=a),v(a)}),n()(),o(12,"div",18)(13,"datepicker",19),S("dateChange",function(a){x(e);let f=c();return I(f.pageData.Filter.To,a)||(f.pageData.Filter.To=a),v(a)}),n()(),o(14,"h6"),r(15,"Inventory Type"),n(),o(16,"radio-options",20),S("modelChange",function(a){x(e);let f=c();return I(f.pageData.Filter.InventoryType,a)||(f.pageData.Filter.InventoryType=a),v(a)}),n()()}if(t&2){let e=c();i(3),_("showClear",!0),g("selectedOutletGroupID",e.pageData.Filter.OutletGroupID),i(3),g("selectedCategoryID",e.pageData.Filter.CategoryID),_("showClear",!0),i(),g("modelName",e.pageData.Filter.ListProductID),_("placeholder","Search Product")("isShowEmptyMessage",!0)("emptyMessage","No Product found")("tooltipMessage","Search by product name")("label","Product to Analyze")("listDataEndpoint","/api/ac/GetProductSuggestionByCodeNName")("valueField","Key"),i(4),_("isFloatingLabel",!1),g("date",e.pageData.Filter.From),_("hidelClearBtn",!0),i(2),_("isFloatingLabel",!1),g("date",e.pageData.Filter.To),_("hidelClearBtn",!0),i(3),g("model",e.pageData.Filter.InventoryType),_("options",e.pageData.Options.InventoryTypes)}}function gt(t,l){t&1&&(o(0,"th",8),r(1,"Code"),n())}function It(t,l){t&1&&(o(0,"th",9)(1,"span",21),r(2," Start "),n()())}function St(t,l){t&1&&(o(0,"th",9)(1,"span",22),r(2," Bought "),n()())}function Pt(t,l){t&1&&(o(0,"th",9)(1,"span",23),r(2," Sold "),n()())}function ht(t,l){t&1&&(o(0,"th",9)(1,"span",24),r(2," T.In "),n()())}function Ft(t,l){t&1&&(o(0,"th",9)(1,"span",25),r(2," T.Out "),n()())}function Et(t,l){t&1&&(o(0,"th",9)(1,"span",26),r(2," Adj "),n()())}function wt(t,l){t&1&&(o(0,"th",9)(1,"span",27),r(2," End "),n()())}function Dt(t,l){t&1&&(o(0,"th",9)(1,"span",28),r(2," Now "),n()())}function bt(t,l){t&1&&(o(0,"th",9)(1,"span",29),r(2," % "),n()())}function Bt(t,l){if(t&1&&(o(0,"td",31),r(1),n()),t&2){let e=c().$implicit;i(),s(" ",e.ProductCode," ")}}function Lt(t,l){if(t&1&&(o(0,"td",32),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;_("colsFontColor",e.Start),i(),s(" ",u(2,2,e.Start)," ")}}function Ot(t,l){if(t&1&&(o(0,"td",33),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;i(),s(" ",u(2,1,e.Bought)," ")}}function Vt(t,l){if(t&1&&(o(0,"td",34),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;i(),s(" ",u(2,1,e.Sold)," ")}}function kt(t,l){if(t&1&&(o(0,"td",33),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;i(),s(" ",u(2,1,e.TransferredIn)," ")}}function Mt(t,l){if(t&1&&(o(0,"td",34),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;i(),s(" ",u(2,1,e.TransferredOut)," ")}}function Nt(t,l){if(t&1&&(o(0,"td",32),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;_("colsFontColor",e.Adjustment),i(),s(" ",e.Adjustment<0?e.Adjustment*-1:u(2,2,e.Adjustment)," ")}}function jt(t,l){if(t&1&&(o(0,"td",32),r(1),n()),t&2){let e=c().$implicit;_("colsFontColor",e.End),i(),s(" ",e.End," ")}}function qt(t,l){if(t&1&&(o(0,"td",32),r(1),n()),t&2){let e=c().$implicit;_("colsFontColor",e.Now),i(),s(" ",e.Now," ")}}function Wt(t,l){if(t&1&&(o(0,"td",31),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;i(),s(" ",u(2,1,e.SellTransferInRate)," ")}}function At(t,l){if(t&1&&(o(0,"tr")(1,"td")(2,"a",30),r(3),n()(),o(4,"td")(5,"a",30),r(6),n()(),y(7,Bt,2,1,"td",31)(8,Lt,3,4,"td",32)(9,Ot,3,3,"td",33)(10,Vt,3,3,"td",34)(11,kt,3,3,"td",33)(12,Mt,3,3,"td",34)(13,Nt,3,4,"td",32)(14,jt,2,2,"td",32)(15,qt,2,2,"td",32)(16,Wt,3,3,"td",31),n()),t&2){let e=l.$implicit,m=c(2);i(2),_("routerLink",D(16,xt))("queryParams",b(17,ft,e.OutletID)),i(),s(" ",e.OutletName," "),i(2),_("routerLink",D(19,vt))("queryParams",b(20,ft,e.ProductID)),i(),w(e.ProductName),i(),p(m.column.code.selected?7:-1),i(),p(m.column.start.selected?8:-1),i(),p(m.column.bought.selected?9:-1),i(),p(m.column.sold.selected?10:-1),i(),p(m.column.transferredIn.selected?11:-1),i(),p(m.column.transferredOut.selected?12:-1),i(),p(m.column.adjust.selected?13:-1),i(),p(m.column.end.selected?14:-1),i(),p(m.column.now.selected?15:-1),i(),p(m.column.percent.selected?16:-1)}}function Gt(t,l){if(t&1&&M(0,At,17,22,"tr",null,k),t&2){let e=c();N(e.infiniteList)}}function Rt(t,l){t&1&&(o(0,"tr")(1,"td",35),E(2,"app-empty-state"),n()())}function Ht(t,l){if(t&1&&(o(0,"td",32),d(1,"sum"),d(2,"quantityFraction"),r(3),d(4,"sum"),d(5,"quantityFraction"),n()),t&2){let e=c(2);_("colsFontColor",u(2,5,C(1,2,e.infiniteList,"Start"))),i(3),s(" ",u(5,10,C(4,7,e.infiniteList,"Start"))," ")}}function zt(t,l){if(t&1&&(o(0,"td",33),r(1),d(2,"sum"),d(3,"quantityFraction"),n()),t&2){let e=c(2);i(),s(" ",u(3,4,C(2,1,e.infiniteList,"Bought"))," ")}}function Kt(t,l){if(t&1&&(o(0,"td",34),r(1),d(2,"sum"),d(3,"quantityFraction"),n()),t&2){let e=c(2);i(),s(" ",u(3,4,C(2,1,e.infiniteList,"Sold"))," ")}}function Qt(t,l){if(t&1&&(o(0,"td",33),r(1),d(2,"sum"),d(3,"quantityFraction"),n()),t&2){let e=c(2);i(),s(" ",u(3,4,C(2,1,e.infiniteList,"TransferredIn"))," ")}}function Jt(t,l){if(t&1&&(o(0,"td",34),r(1),d(2,"sum"),d(3,"quantityFraction"),n()),t&2){let e=c(2);i(),s(" ",u(3,4,C(2,1,e.infiniteList,"TransferredOut"))," ")}}function Ut(t,l){if(t&1&&(o(0,"td",38),d(1,"sum"),d(2,"quantityFraction"),r(3),d(4,"sum"),d(5,"quantityFraction"),n()),t&2){let e=c(2);_("colsFontColor",u(2,5,C(1,2,e.infiniteList,"Adjustment"))),i(3),s(" ",u(5,10,C(4,7,e.infiniteList,"Adjustment"))," ")}}function Xt(t,l){if(t&1&&(o(0,"td",32),d(1,"sum"),d(2,"quantityFraction"),r(3),d(4,"sum"),d(5,"quantityFraction"),n()),t&2){let e=c(2);_("colsFontColor",u(2,5,C(1,2,e.infiniteList,"End"))),i(3),s(" ",u(5,10,C(4,7,e.infiniteList,"End"))," ")}}function Yt(t,l){if(t&1&&(o(0,"td",32),d(1,"sum"),d(2,"quantityFraction"),r(3),d(4,"sum"),d(5,"quantityFraction"),n()),t&2){let e=c(2);_("colsFontColor",u(2,5,C(1,2,e.infiniteList,"Now"))),i(3),s(" ",u(5,10,C(4,7,e.infiniteList,"Now"))," ")}}function Zt(t,l){if(t&1&&(o(0,"tfoot")(1,"tr",36)(2,"th",37),r(3," Total: "),n(),y(4,Ht,6,12,"td",32)(5,zt,4,6,"td",33)(6,Kt,4,6,"td",34)(7,Qt,4,6,"td",33)(8,Jt,4,6,"td",34)(9,Ut,6,12,"td",38)(10,Xt,6,12,"td",32)(11,Yt,6,12,"td",32),n()()),t&2){let e=c();i(2),V("colspan",e.column.code.selected?3:2),i(2),p(e.column.start.selected?4:-1),i(),p(e.column.bought.selected?5:-1),i(),p(e.column.sold.selected?6:-1),i(),p(e.column.transferredIn.selected?7:-1),i(),p(e.column.transferredOut.selected?8:-1),i(),p(e.column.adjust.selected?9:-1),i(),p(e.column.end.selected?10:-1),i(),p(e.column.now.selected?11:-1)}}function $t(t,l){if(t&1){let e=P();o(0,"span",45),h("click",function(){x(e);let a=c(2);return v(a.StoreRowsCountAPIResult("inventory/GetCountProductInventoryTraffic"))}),o(1,"i",46),r(2,"?"),n()()}}function te(t,l){if(t&1&&(o(0,"span"),r(1),d(2,"number"),n()),t&2){let e=c(2);i(),w(u(2,1,e.listTotal))}}function ee(t,l){if(t&1){let e=P();o(0,"div",10)(1,"div",39)(2,"div",40),r(3),d(4,"number"),y(5,$t,3,0,"span",41)(6,te,3,3,"span",42),r(7),n()(),o(8,"a",43),h("click",function(){x(e);let a=c();return v(a.NextPage(!0))}),E(9,"i",44),r(10," Next"),n()()}if(t&2){let e=c();i(3),s(" Showing 1 - ",u(4,4,e.infiniteList.length)," of "),i(2),_("ngIf",!e.pageData.HideStoreApiCount),i(),_("ngIf",e.pageData.HideStoreApiCount),i(),s(" records ~ ",e.pageData.Filter.PageNumber," Page ")}}var Ct=class t extends U{constructor(e,m,a,f,B,F,ie){super(e,m,"inventory/GetProductInventoryTraffic","inventoryloader/GetProductInventoryTraffic",void 0,void 0,!0);this.httpService=m;this.csvConverter=a;this.pageTitle=f;this.converter=B;this.roleService=F;this.matDialog=ie;this.pageTitle.setTitle(this.menuData.T)}column={code:{selected:!0,name:"Code"},start:{selected:!0,name:"Start"},bought:{selected:!1,name:"Bought"},sold:{selected:!0,name:"Sold"},transferredIn:{selected:!0,name:"T.In"},transferredOut:{selected:!0,name:"T.Out"},adjust:{selected:!1,name:"Adjust"},end:{selected:!0,name:"End"},now:{selected:!0,name:"Now"},percent:{selected:!1,name:"Percentage"}};selectedProduct=[];postBindData(){this.menuData.H=this.data.PageTitle}openExportModal(){this.matDialog.open(Y,{data:{title:"Product Inventory Traffic",exportTypes:[{ID:"inventoryexport/GetExportProductInventoryTraffic",Value:"Default",FileName:"Product Inventory Traffic"}],filterExport:this.pageData.Filter,getAllDataLengthAPI:"",pagination:!0}})}static \u0275fac=function(m){return new(m||t)(T($),T(z),T(tt),T(G),T(pt),T(K),T(X))};static \u0275cmp=L({type:t,selectors:[["POS-product-inventory-traffic"]],features:[O],decls:31,vars:19,consts:[["pageFilterTemplate",""],[3,"onSubmit","filterChange","pageData","hideSearchBox","isFilterOnDropdown","filter","column"],["class","btn btn-outline-secondary me-3",3,"click",4,"ngIf"],[1,"container-fluid","mt-3"],[1,"table-responsive"],["id","tableGrid",1,"table","border-bottom"],[1,"thead-light","sticky-top-thead"],[2,"width","150px"],[1,"text-end",2,"width","100px"],[1,"text-end",2,"width","80px"],[1,"d-flex","justify-content-between","mt-5"],[1,"btn","btn-outline-secondary","me-3",3,"click"],["aria-hidden","true",1,"fa-solid","fa-upload"],[1,"dialog-filter"],[1,"tree-select-as-filter",3,"selectedOutletGroupIDChange","showClear","selectedOutletGroupID"],[1,"tree-select-as-filter",3,"selectedCategoryIDChange","selectedCategoryID","showClear"],[3,"modelNameChange","modelName","placeholder","isShowEmptyMessage","emptyMessage","tooltipMessage","label","listDataEndpoint","valueField"],["placeholder","From","appearance","outline","name","From",3,"dateChange","isFloatingLabel","date","hidelClearBtn"],[1,"mt-4"],["placeholder","To","appearance","outline","name","To",3,"dateChange","isFloatingLabel","date","hidelClearBtn"],["name","ProductTypeId",3,"modelChange","model","options"],["matTooltip","Stock based on start date (from date filter)","matTooltipPosition","above"],["matTooltip","Movement Stock from Inbound Logistics (Supplier Bill)","matTooltipPosition","above"],["matTooltip","Movement Stock from Outbound Logistics (Customer Invoice)","matTooltipPosition","above"],["matTooltip","Stock received from other outlets","matTooltipPosition","above"],["matTooltip","Stock sent to other outlets","matTooltipPosition","above"],["matTooltip","Total stock adjustments made","matTooltipPosition","above"],["matTooltip","Stock based on end date (to date filter)","matTooltipPosition","above"],["matTooltip","Current on-hand inventory","matTooltipPosition","above"],["matTooltip","Percentage of sold items compared to the total items received from other outlets.","matTooltipPosition","above",1,"text-end"],[3,"routerLink","queryParams"],[1,"text-end"],[1,"text-end",3,"colsFontColor"],[1,"text-end","text-success"],[1,"text-end","text-danger"],["colspan","12"],[1,"table-footer"],[1,"empty-column","text-end"],[1,"text-end","text-success",3,"colsFontColor"],[1,"me-auto","d-sm-block","collapse","mt-3"],[1,"fw-bold","fst-italic","hidden-xxs"],["style","cursor: pointer",3,"click",4,"ngIf"],[4,"ngIf"],["role","button",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fa-solid","fa-arrow-right"],[2,"cursor","pointer",3,"click"],["matTooltipPosition","above","matTooltip","Retrieve rows count",1,"border","p-3"]],template:function(m,a){if(m&1){let f=P();o(0,"mainpanel-cmp",1),h("onSubmit",function(){return x(f),v(a.searchFromPageOne())}),S("filterChange",function(F){return x(f),I(a.pageData.Filter,F)||(a.pageData.Filter=F),v(F)}),o(1,"actions"),y(2,yt,3,0,"button",2),n(),o(3,"filters"),y(4,Tt,17,20,"ng-template",null,0,j),n(),o(6,"content")(7,"div",3)(8,"div",4)(9,"table",5)(10,"thead",6)(11,"tr")(12,"th",7),r(13,"Outlet"),n(),o(14,"th"),r(15,"Product"),n(),y(16,gt,2,0,"th",8)(17,It,3,0,"th",9)(18,St,3,0,"th",9)(19,Pt,3,0,"th",9)(20,ht,3,0,"th",9)(21,Ft,3,0,"th",9)(22,Et,3,0,"th",9)(23,wt,3,0,"th",9)(24,Dt,3,0,"th",9)(25,bt,3,0,"th",9),n()(),o(26,"tbody"),y(27,Gt,2,0)(28,Rt,3,0,"tr"),n(),y(29,Zt,12,9,"tfoot"),n()(),y(30,ee,11,6,"div",10),n()()()}m&2&&(_("pageData",a.menuData)("hideSearchBox",!0)("isFilterOnDropdown",!1),g("filter",a.pageData.Filter),_("column",a.column),i(2),_("ngIf",a.roleService.global.Export),i(14),p(a.column.code.selected?16:-1),i(),p(a.column.start.selected?17:-1),i(),p(a.column.bought.selected?18:-1),i(),p(a.column.sold.selected?19:-1),i(),p(a.column.transferredIn.selected?20:-1),i(),p(a.column.transferredOut.selected?21:-1),i(),p(a.column.adjust.selected?22:-1),i(),p(a.column.end.selected?23:-1),i(),p(a.column.now.selected?24:-1),i(),p(a.column.percent.selected?25:-1),i(2),p(a.infiniteList&&a.infiniteList.length>0?27:28),i(2),p(a.infiniteList&&a.infiniteList.length>0?29:-1),i(),p(a.infiniteList&&a.infiniteList.length>0?30:-1))},dependencies:[ot,nt,A,q,W,H,mt,lt,_t,it,et,R,Z,dt,ct,rt,at,st,ut,J,Q],encapsulation:2})};export{Ct as Product_Inventory_TrafficComponent};
1
+ import{a as _t,b as ut}from"./chunk-BX366TSG.js";import{a as pt}from"./chunk-FKDZ5OWB.js";import{a as mt}from"./chunk-DEVO5OTP.js";import{a as st}from"./chunk-BXQFYW4R.js";import"./chunk-4UYZJCFI.js";import"./chunk-BYXBJQAS.js";import{d as ct,e as dt}from"./chunk-GIDGCFLX.js";import"./chunk-XBRBYCWJ.js";import"./chunk-3RK6DDJD.js";import"./chunk-FP4HFB5J.js";import"./chunk-H3OZSV6V.js";import"./chunk-YEDKRNXU.js";import"./chunk-VZEPVRCY.js";import"./chunk-7QWJJPNG.js";import{d as at,e as rt}from"./chunk-6647Y35T.js";import"./chunk-VHAM2DWK.js";import{a as Z}from"./chunk-JPXXXD26.js";import{a as U}from"./chunk-ODOWAGLZ.js";import{f as lt}from"./chunk-IOJ4YVHD.js";import{b as Y}from"./chunk-QHBWVJIQ.js";import"./chunk-XQ6JBIMX.js";import"./chunk-EVWNBQBC.js";import"./chunk-6JAL37Y4.js";import"./chunk-4QQTEPQT.js";import{a as tt}from"./chunk-XZR3IMWZ.js";import{e as nt,f as ot}from"./chunk-3PTKHKTZ.js";import"./chunk-B6LPY2IZ.js";import"./chunk-CWITQVZH.js";import"./chunk-QHRP323Q.js";import"./chunk-WDQ4UKKY.js";import"./chunk-MFCXEITE.js";import"./chunk-MUJ6277G.js";import"./chunk-LMJVRREP.js";import"./chunk-3LBZDIW2.js";import"./chunk-KTCV3KOE.js";import"./chunk-KZDE63UL.js";import"./chunk-ARKU4MG5.js";import{b as $}from"./chunk-S22XRS4J.js";import"./chunk-3GOO5E5D.js";import"./chunk-XMYLHF4C.js";import"./chunk-H7F34T25.js";import{b as Q,c as J}from"./chunk-JOXTERIM.js";import{N as it,g as et}from"./chunk-TSIYPTYI.js";import"./chunk-XYB3YDKL.js";import"./chunk-7VKFVS7K.js";import"./chunk-ZVDY66SR.js";import{g as X}from"./chunk-3YKVLHZG.js";import"./chunk-ZHY3BUQJ.js";import"./chunk-VFTGIP5A.js";import"./chunk-LE3BKIDY.js";import"./chunk-2FWFPV5I.js";import"./chunk-EEEAUYZ6.js";import{F as H}from"./chunk-RVXZOIFQ.js";import"./chunk-2FWXO7SV.js";import"./chunk-6ABP4TP7.js";import{d as K}from"./chunk-ZZGSAFGO.js";import"./chunk-QVPSWY5E.js";import{$a as i,Ac as u,Bc as C,Db as p,Eb as k,Fc as j,Gb as M,Hb as N,Ib as o,Jb as n,Kb as E,Ob as P,Qb as h,Rb as c,Rd as R,Yd as z,Zc as q,db as T,ec as r,fc as w,gc as s,gd as W,jc as g,jd as A,kb as L,kc as I,lc as S,ob as O,qb as y,qc as D,rc as b,ub as V,va as x,vb as _,wa as v,wd as G,zc as d}from"./chunk-UXRO4UFY.js";import"./chunk-7DCB7DB2.js";var xt=()=>["/menu/Outlets/Master/Outlets/Info"],ft=t=>({ID:t}),vt=()=>["/menu/Products/Catalog/Products/Info"];function yt(t,l){if(t&1){let e=P();o(0,"button",11),h("click",function(){x(e);let a=c();return v(a.openExportModal())}),E(1,"i",12),r(2," Export "),n()}}function Tt(t,l){if(t&1){let e=P();o(0,"div",13)(1,"h6"),r(2,"Outlet Group"),n(),o(3,"POS-outlet-group-tree-select",14),S("selectedOutletGroupIDChange",function(a){x(e);let f=c();return I(f.pageData.Filter.OutletGroupID,a)||(f.pageData.Filter.OutletGroupID=a),v(a)}),n(),o(4,"h6"),r(5,"Category"),n(),o(6,"POS-product-category-select",15),S("selectedCategoryIDChange",function(a){x(e);let f=c();return I(f.pageData.Filter.CategoryID,a)||(f.pageData.Filter.CategoryID=a),v(a)}),n(),o(7,"autocompleteV3",16),S("modelNameChange",function(a){x(e);let f=c();return I(f.pageData.Filter.ListProductID,a)||(f.pageData.Filter.ListProductID=a),v(a)}),n(),o(8,"h6"),r(9,"From - To"),n(),o(10,"div")(11,"datepicker",17),S("dateChange",function(a){x(e);let f=c();return I(f.pageData.Filter.From,a)||(f.pageData.Filter.From=a),v(a)}),n()(),o(12,"div",18)(13,"datepicker",19),S("dateChange",function(a){x(e);let f=c();return I(f.pageData.Filter.To,a)||(f.pageData.Filter.To=a),v(a)}),n()(),o(14,"h6"),r(15,"Inventory Type"),n(),o(16,"radio-options",20),S("modelChange",function(a){x(e);let f=c();return I(f.pageData.Filter.InventoryType,a)||(f.pageData.Filter.InventoryType=a),v(a)}),n()()}if(t&2){let e=c();i(3),_("showClear",!0),g("selectedOutletGroupID",e.pageData.Filter.OutletGroupID),i(3),g("selectedCategoryID",e.pageData.Filter.CategoryID),_("showClear",!0),i(),g("modelName",e.pageData.Filter.ListProductID),_("placeholder","Search Product")("isShowEmptyMessage",!0)("emptyMessage","No Product found")("tooltipMessage","Search by product name")("label","Product to Analyze")("listDataEndpoint","/api/ac/GetProductSuggestionByCodeNName")("valueField","Key"),i(4),_("isFloatingLabel",!1),g("date",e.pageData.Filter.From),_("hidelClearBtn",!0),i(2),_("isFloatingLabel",!1),g("date",e.pageData.Filter.To),_("hidelClearBtn",!0),i(3),g("model",e.pageData.Filter.InventoryType),_("options",e.pageData.Options.InventoryTypes)}}function gt(t,l){t&1&&(o(0,"th",8),r(1,"Code"),n())}function It(t,l){t&1&&(o(0,"th",9)(1,"span",21),r(2," Start "),n()())}function St(t,l){t&1&&(o(0,"th",9)(1,"span",22),r(2," Bought "),n()())}function Pt(t,l){t&1&&(o(0,"th",9)(1,"span",23),r(2," Sold "),n()())}function ht(t,l){t&1&&(o(0,"th",9)(1,"span",24),r(2," T.In "),n()())}function Ft(t,l){t&1&&(o(0,"th",9)(1,"span",25),r(2," T.Out "),n()())}function Et(t,l){t&1&&(o(0,"th",9)(1,"span",26),r(2," Adj "),n()())}function wt(t,l){t&1&&(o(0,"th",9)(1,"span",27),r(2," End "),n()())}function Dt(t,l){t&1&&(o(0,"th",9)(1,"span",28),r(2," Now "),n()())}function bt(t,l){t&1&&(o(0,"th",9)(1,"span",29),r(2," % "),n()())}function Bt(t,l){if(t&1&&(o(0,"td",31),r(1),n()),t&2){let e=c().$implicit;i(),s(" ",e.ProductCode," ")}}function Lt(t,l){if(t&1&&(o(0,"td",32),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;_("colsFontColor",e.Start),i(),s(" ",u(2,2,e.Start)," ")}}function Ot(t,l){if(t&1&&(o(0,"td",33),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;i(),s(" ",u(2,1,e.Bought)," ")}}function Vt(t,l){if(t&1&&(o(0,"td",34),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;i(),s(" ",u(2,1,e.Sold)," ")}}function kt(t,l){if(t&1&&(o(0,"td",33),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;i(),s(" ",u(2,1,e.TransferredIn)," ")}}function Mt(t,l){if(t&1&&(o(0,"td",34),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;i(),s(" ",u(2,1,e.TransferredOut)," ")}}function Nt(t,l){if(t&1&&(o(0,"td",32),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;_("colsFontColor",e.Adjustment),i(),s(" ",e.Adjustment<0?e.Adjustment*-1:u(2,2,e.Adjustment)," ")}}function jt(t,l){if(t&1&&(o(0,"td",32),r(1),n()),t&2){let e=c().$implicit;_("colsFontColor",e.End),i(),s(" ",e.End," ")}}function qt(t,l){if(t&1&&(o(0,"td",32),r(1),n()),t&2){let e=c().$implicit;_("colsFontColor",e.Now),i(),s(" ",e.Now," ")}}function Wt(t,l){if(t&1&&(o(0,"td",31),r(1),d(2,"quantityFraction"),n()),t&2){let e=c().$implicit;i(),s(" ",u(2,1,e.SellTransferInRate)," ")}}function At(t,l){if(t&1&&(o(0,"tr")(1,"td")(2,"a",30),r(3),n()(),o(4,"td")(5,"a",30),r(6),n()(),y(7,Bt,2,1,"td",31)(8,Lt,3,4,"td",32)(9,Ot,3,3,"td",33)(10,Vt,3,3,"td",34)(11,kt,3,3,"td",33)(12,Mt,3,3,"td",34)(13,Nt,3,4,"td",32)(14,jt,2,2,"td",32)(15,qt,2,2,"td",32)(16,Wt,3,3,"td",31),n()),t&2){let e=l.$implicit,m=c(2);i(2),_("routerLink",D(16,xt))("queryParams",b(17,ft,e.OutletID)),i(),s(" ",e.OutletName," "),i(2),_("routerLink",D(19,vt))("queryParams",b(20,ft,e.ProductID)),i(),w(e.ProductName),i(),p(m.column.code.selected?7:-1),i(),p(m.column.start.selected?8:-1),i(),p(m.column.bought.selected?9:-1),i(),p(m.column.sold.selected?10:-1),i(),p(m.column.transferredIn.selected?11:-1),i(),p(m.column.transferredOut.selected?12:-1),i(),p(m.column.adjust.selected?13:-1),i(),p(m.column.end.selected?14:-1),i(),p(m.column.now.selected?15:-1),i(),p(m.column.percent.selected?16:-1)}}function Gt(t,l){if(t&1&&M(0,At,17,22,"tr",null,k),t&2){let e=c();N(e.infiniteList)}}function Rt(t,l){t&1&&(o(0,"tr")(1,"td",35),E(2,"app-empty-state"),n()())}function Ht(t,l){if(t&1&&(o(0,"td",32),d(1,"sum"),d(2,"quantityFraction"),r(3),d(4,"sum"),d(5,"quantityFraction"),n()),t&2){let e=c(2);_("colsFontColor",u(2,5,C(1,2,e.infiniteList,"Start"))),i(3),s(" ",u(5,10,C(4,7,e.infiniteList,"Start"))," ")}}function zt(t,l){if(t&1&&(o(0,"td",33),r(1),d(2,"sum"),d(3,"quantityFraction"),n()),t&2){let e=c(2);i(),s(" ",u(3,4,C(2,1,e.infiniteList,"Bought"))," ")}}function Kt(t,l){if(t&1&&(o(0,"td",34),r(1),d(2,"sum"),d(3,"quantityFraction"),n()),t&2){let e=c(2);i(),s(" ",u(3,4,C(2,1,e.infiniteList,"Sold"))," ")}}function Qt(t,l){if(t&1&&(o(0,"td",33),r(1),d(2,"sum"),d(3,"quantityFraction"),n()),t&2){let e=c(2);i(),s(" ",u(3,4,C(2,1,e.infiniteList,"TransferredIn"))," ")}}function Jt(t,l){if(t&1&&(o(0,"td",34),r(1),d(2,"sum"),d(3,"quantityFraction"),n()),t&2){let e=c(2);i(),s(" ",u(3,4,C(2,1,e.infiniteList,"TransferredOut"))," ")}}function Ut(t,l){if(t&1&&(o(0,"td",38),d(1,"sum"),d(2,"quantityFraction"),r(3),d(4,"sum"),d(5,"quantityFraction"),n()),t&2){let e=c(2);_("colsFontColor",u(2,5,C(1,2,e.infiniteList,"Adjustment"))),i(3),s(" ",u(5,10,C(4,7,e.infiniteList,"Adjustment"))," ")}}function Xt(t,l){if(t&1&&(o(0,"td",32),d(1,"sum"),d(2,"quantityFraction"),r(3),d(4,"sum"),d(5,"quantityFraction"),n()),t&2){let e=c(2);_("colsFontColor",u(2,5,C(1,2,e.infiniteList,"End"))),i(3),s(" ",u(5,10,C(4,7,e.infiniteList,"End"))," ")}}function Yt(t,l){if(t&1&&(o(0,"td",32),d(1,"sum"),d(2,"quantityFraction"),r(3),d(4,"sum"),d(5,"quantityFraction"),n()),t&2){let e=c(2);_("colsFontColor",u(2,5,C(1,2,e.infiniteList,"Now"))),i(3),s(" ",u(5,10,C(4,7,e.infiniteList,"Now"))," ")}}function Zt(t,l){if(t&1&&(o(0,"tfoot")(1,"tr",36)(2,"th",37),r(3," Total: "),n(),y(4,Ht,6,12,"td",32)(5,zt,4,6,"td",33)(6,Kt,4,6,"td",34)(7,Qt,4,6,"td",33)(8,Jt,4,6,"td",34)(9,Ut,6,12,"td",38)(10,Xt,6,12,"td",32)(11,Yt,6,12,"td",32),n()()),t&2){let e=c();i(2),V("colspan",e.column.code.selected?3:2),i(2),p(e.column.start.selected?4:-1),i(),p(e.column.bought.selected?5:-1),i(),p(e.column.sold.selected?6:-1),i(),p(e.column.transferredIn.selected?7:-1),i(),p(e.column.transferredOut.selected?8:-1),i(),p(e.column.adjust.selected?9:-1),i(),p(e.column.end.selected?10:-1),i(),p(e.column.now.selected?11:-1)}}function $t(t,l){if(t&1){let e=P();o(0,"span",45),h("click",function(){x(e);let a=c(2);return v(a.StoreRowsCountAPIResult("inventory/GetCountProductInventoryTraffic"))}),o(1,"i",46),r(2,"?"),n()()}}function te(t,l){if(t&1&&(o(0,"span"),r(1),d(2,"number"),n()),t&2){let e=c(2);i(),w(u(2,1,e.listTotal))}}function ee(t,l){if(t&1){let e=P();o(0,"div",10)(1,"div",39)(2,"div",40),r(3),d(4,"number"),y(5,$t,3,0,"span",41)(6,te,3,3,"span",42),r(7),n()(),o(8,"a",43),h("click",function(){x(e);let a=c();return v(a.NextPage(!0))}),E(9,"i",44),r(10," Next"),n()()}if(t&2){let e=c();i(3),s(" Showing 1 - ",u(4,4,e.infiniteList.length)," of "),i(2),_("ngIf",!e.pageData.HideStoreApiCount),i(),_("ngIf",e.pageData.HideStoreApiCount),i(),s(" records ~ ",e.pageData.Filter.PageNumber," Page ")}}var Ct=class t extends U{constructor(e,m,a,f,B,F,ie){super(e,m,"inventory/GetProductInventoryTraffic","inventoryloader/GetProductInventoryTraffic",void 0,void 0,!0);this.httpService=m;this.csvConverter=a;this.pageTitle=f;this.converter=B;this.roleService=F;this.matDialog=ie;this.pageTitle.setTitle(this.menuData.T)}column={code:{selected:!0,name:"Code"},start:{selected:!0,name:"Start"},bought:{selected:!1,name:"Bought"},sold:{selected:!0,name:"Sold"},transferredIn:{selected:!0,name:"T.In"},transferredOut:{selected:!0,name:"T.Out"},adjust:{selected:!1,name:"Adjust"},end:{selected:!0,name:"End"},now:{selected:!0,name:"Now"},percent:{selected:!1,name:"Percentage"}};selectedProduct=[];postBindData(){this.menuData.H=this.data.PageTitle}openExportModal(){this.matDialog.open(Y,{data:{title:"Product Inventory Traffic",exportTypes:[{ID:"inventoryexport/GetExportProductInventoryTraffic",Value:"Default",FileName:"Product Inventory Traffic"}],filterExport:this.pageData.Filter,getAllDataLengthAPI:"",pagination:!0}})}static \u0275fac=function(m){return new(m||t)(T($),T(z),T(tt),T(G),T(pt),T(K),T(X))};static \u0275cmp=L({type:t,selectors:[["POS-product-inventory-traffic"]],features:[O],decls:31,vars:19,consts:[["pageFilterTemplate",""],[3,"onSubmit","filterChange","pageData","hideSearchBox","isFilterOnDropdown","filter","column"],["class","btn btn-outline-secondary me-3",3,"click",4,"ngIf"],[1,"container-fluid","mt-3"],[1,"table-responsive"],["id","tableGrid",1,"table","border-bottom"],[1,"thead-light","sticky-top-thead"],[2,"width","150px"],[1,"text-end",2,"width","100px"],[1,"text-end",2,"width","80px"],[1,"d-flex","justify-content-between","mt-5"],[1,"btn","btn-outline-secondary","me-3",3,"click"],["aria-hidden","true",1,"fa-solid","fa-upload"],[1,"dialog-filter"],[1,"tree-select-as-filter",3,"selectedOutletGroupIDChange","showClear","selectedOutletGroupID"],[1,"tree-select-as-filter",3,"selectedCategoryIDChange","selectedCategoryID","showClear"],[3,"modelNameChange","modelName","placeholder","isShowEmptyMessage","emptyMessage","tooltipMessage","label","listDataEndpoint","valueField"],["placeholder","From","appearance","outline","name","From",3,"dateChange","isFloatingLabel","date","hidelClearBtn"],[1,"mt-4"],["placeholder","To","appearance","outline","name","To",3,"dateChange","isFloatingLabel","date","hidelClearBtn"],["name","ProductTypeId",3,"modelChange","model","options"],["matTooltip","Stock based on start date (from date filter)","matTooltipPosition","above"],["matTooltip","Movement Stock from Inbound Logistics (Supplier Bill)","matTooltipPosition","above"],["matTooltip","Movement Stock from Outbound Logistics (Customer Invoice)","matTooltipPosition","above"],["matTooltip","Stock received from other outlets","matTooltipPosition","above"],["matTooltip","Stock sent to other outlets","matTooltipPosition","above"],["matTooltip","Total stock adjustments made","matTooltipPosition","above"],["matTooltip","Stock based on end date (to date filter)","matTooltipPosition","above"],["matTooltip","Current on-hand inventory","matTooltipPosition","above"],["matTooltip","Percentage of sold items compared to the total items received from other outlets.","matTooltipPosition","above",1,"text-end"],[3,"routerLink","queryParams"],[1,"text-end"],[1,"text-end",3,"colsFontColor"],[1,"text-end","text-success"],[1,"text-end","text-danger"],["colspan","12"],[1,"table-footer"],[1,"empty-column","text-end"],[1,"text-end","text-success",3,"colsFontColor"],[1,"me-auto","d-sm-block","collapse","mt-3"],[1,"fw-bold","fst-italic","hidden-xxs"],["style","cursor: pointer",3,"click",4,"ngIf"],[4,"ngIf"],["role","button",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fa-solid","fa-arrow-right"],[2,"cursor","pointer",3,"click"],["matTooltipPosition","above","matTooltip","Retrieve rows count",1,"border","p-3"]],template:function(m,a){if(m&1){let f=P();o(0,"mainpanel-cmp",1),h("onSubmit",function(){return x(f),v(a.searchFromPageOne())}),S("filterChange",function(F){return x(f),I(a.pageData.Filter,F)||(a.pageData.Filter=F),v(F)}),o(1,"actions"),y(2,yt,3,0,"button",2),n(),o(3,"filters"),y(4,Tt,17,20,"ng-template",null,0,j),n(),o(6,"content")(7,"div",3)(8,"div",4)(9,"table",5)(10,"thead",6)(11,"tr")(12,"th",7),r(13,"Outlet"),n(),o(14,"th"),r(15,"Product"),n(),y(16,gt,2,0,"th",8)(17,It,3,0,"th",9)(18,St,3,0,"th",9)(19,Pt,3,0,"th",9)(20,ht,3,0,"th",9)(21,Ft,3,0,"th",9)(22,Et,3,0,"th",9)(23,wt,3,0,"th",9)(24,Dt,3,0,"th",9)(25,bt,3,0,"th",9),n()(),o(26,"tbody"),y(27,Gt,2,0)(28,Rt,3,0,"tr"),n(),y(29,Zt,12,9,"tfoot"),n()(),y(30,ee,11,6,"div",10),n()()()}m&2&&(_("pageData",a.menuData)("hideSearchBox",!0)("isFilterOnDropdown",!1),g("filter",a.pageData.Filter),_("column",a.column),i(2),_("ngIf",a.roleService.global.Export),i(14),p(a.column.code.selected?16:-1),i(),p(a.column.start.selected?17:-1),i(),p(a.column.bought.selected?18:-1),i(),p(a.column.sold.selected?19:-1),i(),p(a.column.transferredIn.selected?20:-1),i(),p(a.column.transferredOut.selected?21:-1),i(),p(a.column.adjust.selected?22:-1),i(),p(a.column.end.selected?23:-1),i(),p(a.column.now.selected?24:-1),i(),p(a.column.percent.selected?25:-1),i(2),p(a.infiniteList&&a.infiniteList.length>0?27:28),i(2),p(a.infiniteList&&a.infiniteList.length>0?29:-1),i(),p(a.infiniteList&&a.infiniteList.length>0?30:-1))},dependencies:[ot,nt,A,q,W,H,mt,lt,_t,it,et,R,Z,dt,ct,rt,at,st,ut,J,Q],encapsulation:2})};export{Ct as Product_Inventory_TrafficComponent};
@@ -1,4 +1,4 @@
1
- import{a as L}from"./chunk-3GOO5E5D.js";import{a as be}from"./chunk-LE3BKIDY.js";import{V as ue,W as he,la as pe,ma as D,ua as de}from"./chunk-EEEAUYZ6.js";import{a as ae,g as se}from"./chunk-RVXZOIFQ.js";import{a as re,c as le}from"./chunk-2JIKUIDL.js";import{a as R}from"./chunk-ZZGSAFGO.js";import{$a as a,$b as $,Fa as I,Ib as l,Jb as u,Kb as b,Lb as O,Ma as Y,Mb as z,Mc as f,Nc as ee,Ob as Z,Qb as K,Qd as oe,Rb as g,Rd as ne,Sc as te,Td as ce,Wc as V,Yb as A,Zb as X,Zc as F,_b as w,bd as ie,db as M,ec as E,gc as J,ia as q,ja as Q,jd as B,ka as H,kb as d,lb as G,na as P,ob as x,pc as W,qb as k,qc as T,rc as C,ua as U,ub as s,va as v,vb as c,wa as S,xa as _,yb as N,za as m,zb as p}from"./chunk-UXRO4UFY.js";var ye=e=>({"pe-none":e}),ve=()=>["/menu/Profile/Main/My_Subscription"],Se=e=>({"text-decoration-none":e}),_e=e=>({"text-capitalize":e});function Ie(e,n){if(e&1&&(l(0,"div",1)(1,"h5",2),E(2),l(3,"a",3)(4,"u",4)(5,"span",4),E(6,"please"),u(),E(7," process your payment! "),u()()()()),e&2){let t=g();p("alert rounded-0 mb-0 text-center border-bottom "+(t.subscriptionState==null?null:t.subscriptionState.class)),a(2),J(" ",t.subscriptionState==null?null:t.subscriptionState.message," "),a(),c("ngClass",C(7,ye,t.isMySubscriptionMenu))("routerLink",T(9,ve)),a(),c("ngClass",C(10,Se,t.isMySubscriptionMenu)),a(),c("ngClass",C(12,_e,t.isNotEmpty(t.currentSubStatus)&&t.currentSubStatus!=t.subsStatusEnum.OVERDUE))}}var me=class e{constructor(n,t,o){this.document=n;this.router=t;this.authService=o}subscriptionStatus;subscriptionState;currentSubStatus;subsStatusEnum=re;isMySubscriptionMenu;htmlStyleElement;htmlBodyElement;ngOnInit(){this.checkMySubscriptionMenu(),this.initSubscriptionStatus(),this.getCurrentSubscriptionStatus()}getCurrentSubscriptionStatus(){this.overrideCssStickyHeader()}checkMySubscriptionMenu(){this.isMySubscriptionMenu=!1,this.router.url.includes("/Profile/Main/My_Subscription")&&(this.isMySubscriptionMenu=!0)}isNotEmpty(n){return R.IsNotEmpty(n)}overrideCssStickyHeader(){if(R.IsNotEmpty(this.currentSubStatus)&&this.currentSubStatus!==0){let n=`.sticky-top-thead th {
1
+ import{a as L}from"./chunk-3GOO5E5D.js";import{a as be}from"./chunk-LE3BKIDY.js";import{V as ue,W as he,la as pe,ma as D,ua as de}from"./chunk-EEEAUYZ6.js";import{a as ae,g as se}from"./chunk-RVXZOIFQ.js";import{a as re,c as le}from"./chunk-2FWXO7SV.js";import{a as R}from"./chunk-ZZGSAFGO.js";import{$a as a,$b as $,Fa as I,Ib as l,Jb as u,Kb as b,Lb as O,Ma as Y,Mb as z,Mc as f,Nc as ee,Ob as Z,Qb as K,Qd as oe,Rb as g,Rd as ne,Sc as te,Td as ce,Wc as V,Yb as A,Zb as X,Zc as F,_b as w,bd as ie,db as M,ec as E,gc as J,ia as q,ja as Q,jd as B,ka as H,kb as d,lb as G,na as P,ob as x,pc as W,qb as k,qc as T,rc as C,ua as U,ub as s,va as v,vb as c,wa as S,xa as _,yb as N,za as m,zb as p}from"./chunk-UXRO4UFY.js";var ye=e=>({"pe-none":e}),ve=()=>["/menu/Profile/Main/My_Subscription"],Se=e=>({"text-decoration-none":e}),_e=e=>({"text-capitalize":e});function Ie(e,n){if(e&1&&(l(0,"div",1)(1,"h5",2),E(2),l(3,"a",3)(4,"u",4)(5,"span",4),E(6,"please"),u(),E(7," process your payment! "),u()()()()),e&2){let t=g();p("alert rounded-0 mb-0 text-center border-bottom "+(t.subscriptionState==null?null:t.subscriptionState.class)),a(2),J(" ",t.subscriptionState==null?null:t.subscriptionState.message," "),a(),c("ngClass",C(7,ye,t.isMySubscriptionMenu))("routerLink",T(9,ve)),a(),c("ngClass",C(10,Se,t.isMySubscriptionMenu)),a(),c("ngClass",C(12,_e,t.isNotEmpty(t.currentSubStatus)&&t.currentSubStatus!=t.subsStatusEnum.OVERDUE))}}var me=class e{constructor(n,t,o){this.document=n;this.router=t;this.authService=o}subscriptionStatus;subscriptionState;currentSubStatus;subsStatusEnum=re;isMySubscriptionMenu;htmlStyleElement;htmlBodyElement;ngOnInit(){this.checkMySubscriptionMenu(),this.initSubscriptionStatus(),this.getCurrentSubscriptionStatus()}getCurrentSubscriptionStatus(){this.overrideCssStickyHeader()}checkMySubscriptionMenu(){this.isMySubscriptionMenu=!1,this.router.url.includes("/Profile/Main/My_Subscription")&&(this.isMySubscriptionMenu=!0)}isNotEmpty(n){return R.IsNotEmpty(n)}overrideCssStickyHeader(){if(R.IsNotEmpty(this.currentSubStatus)&&this.currentSubStatus!==0){let n=`.sticky-top-thead th {
2
2
  top: 100px !important;
3
3
  z-index: 1020;
4
4
  }`;this.htmlBodyElement=this.document.getElementsByTagName("body")[0],this.htmlStyleElement=this.document.createElement("style"),this.htmlStyleElement.appendChild(this.document.createTextNode(n)),this.htmlBodyElement.appendChild(this.htmlStyleElement)}}initSubscriptionStatus(){this.currentSubStatus=this.authService.getSubscriptionStatus(),this.subscriptionStatus=[{status:1,class:"alert-warning",message:"Your subscription is overdue. To avoid suspension, "},{status:2,class:"alert-danger",message:"Your subscription is partially suspended."},{status:3,class:"alert-danger",message:"Your subscription is suspended."}],this.subscriptionState=this.subscriptionStatus.filter(n=>n.status==this.currentSubStatus)[0]}ngOnDestroy(){this.htmlBodyElement&&this.htmlBodyElement.removeChild(this.htmlStyleElement)}static \u0275fac=function(t){return new(t||e)(M(te),M(oe),M(le))};static \u0275cmp=d({type:e,selectors:[["subscription-alert"]],decls:1,vars:1,consts:[["role","alert",3,"class",4,"ngIf"],["role","alert"],[1,"fw-normal"],[1,"alert-link",3,"ngClass","routerLink"],[3,"ngClass"]],template:function(t,o){t&1&&k(0,Ie,8,14,"div",0),t&2&&c("ngIf",(o.subscriptionState==null?null:o.subscriptionState.status)==o.currentSubStatus&&o.isNotEmpty(o.currentSubStatus))},dependencies:[B,V,F,ce,ne],encapsulation:2})};var ke=(()=>{class e extends L{static \u0275fac=(()=>{let t;return function(i){return(t||(t=m(e)))(i||e)}})();static \u0275cmp=d({type:e,selectors:[["CheckIcon"]],features:[x],decls:2,vars:5,consts:[["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M4.86199 11.5948C4.78717 11.5923 4.71366 11.5745 4.64596 11.5426C4.57826 11.5107 4.51779 11.4652 4.46827 11.4091L0.753985 7.69483C0.683167 7.64891 0.623706 7.58751 0.580092 7.51525C0.536478 7.44299 0.509851 7.36177 0.502221 7.27771C0.49459 7.19366 0.506156 7.10897 0.536046 7.03004C0.565935 6.95111 0.613367 6.88 0.674759 6.82208C0.736151 6.76416 0.8099 6.72095 0.890436 6.69571C0.970973 6.67046 1.05619 6.66385 1.13966 6.67635C1.22313 6.68886 1.30266 6.72017 1.37226 6.76792C1.44186 6.81567 1.4997 6.8786 1.54141 6.95197L4.86199 10.2503L12.6397 2.49483C12.7444 2.42694 12.8689 2.39617 12.9932 2.40745C13.1174 2.41873 13.2343 2.47141 13.3251 2.55705C13.4159 2.64268 13.4753 2.75632 13.4938 2.87973C13.5123 3.00315 13.4888 3.1292 13.4271 3.23768L5.2557 11.4091C5.20618 11.4652 5.14571 11.5107 5.07801 11.5426C5.01031 11.5745 4.9368 11.5923 4.86199 11.5948Z","fill","currentColor"]],template:function(o,i){o&1&&(_(),l(0,"svg",0),b(1,"path",1),u()),o&2&&(p(i.getClassNames()),s("aria-label",i.ariaLabel)("aria-hidden",i.ariaHidden)("role",i.role))},encapsulation:2})}return e})();var fe=(()=>{class e extends L{static \u0275fac=(()=>{let t;return function(i){return(t||(t=m(e)))(i||e)}})();static \u0275cmp=d({type:e,selectors:[["MinusIcon"]],features:[x],decls:2,vars:5,consts:[["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M13.2222 7.77778H0.777778C0.571498 7.77778 0.373667 7.69584 0.227806 7.54998C0.0819442 7.40412 0 7.20629 0 7.00001C0 6.79373 0.0819442 6.5959 0.227806 6.45003C0.373667 6.30417 0.571498 6.22223 0.777778 6.22223H13.2222C13.4285 6.22223 13.6263 6.30417 13.7722 6.45003C13.9181 6.5959 14 6.79373 14 7.00001C14 7.20629 13.9181 7.40412 13.7722 7.54998C13.6263 7.69584 13.4285 7.77778 13.2222 7.77778Z","fill","currentColor"]],template:function(o,i){o&1&&(_(),l(0,"svg",0),b(1,"path",1),u()),o&2&&(p(i.getClassNames()),s("aria-label",i.ariaLabel)("aria-hidden",i.ariaHidden)("role",i.role))},encapsulation:2})}return e})();var Me=["checkboxicon"],we=["input"],$e=()=>({"p-checkbox-input":!0}),Ee=e=>({checked:e,class:"p-checkbox-icon"});function Te(e,n){if(e&1&&b(0,"span",8),e&2){let t=g(3);c("ngClass",t.checkboxIcon),s("data-pc-section","icon")}}function Ve(e,n){e&1&&b(0,"CheckIcon",9),e&2&&(c("styleClass","p-checkbox-icon"),s("data-pc-section","icon"))}function Fe(e,n){if(e&1&&(O(0),k(1,Te,1,2,"span",7)(2,Ve,1,2,"CheckIcon",6),z()),e&2){let t=g(2);a(),c("ngIf",t.checkboxIcon),a(),c("ngIf",!t.checkboxIcon)}}function Be(e,n){e&1&&b(0,"MinusIcon",9),e&2&&(c("styleClass","p-checkbox-icon"),s("data-pc-section","icon"))}function De(e,n){if(e&1&&(O(0),k(1,Fe,3,2,"ng-container",4)(2,Be,1,2,"MinusIcon",6),z()),e&2){let t=g();a(),c("ngIf",t.checked),a(),c("ngIf",t._indeterminate())}}function Le(e,n){}function Ne(e,n){e&1&&k(0,Le,0,0,"ng-template")}var Oe=({dt:e})=>`
@@ -1 +1 @@
1
- import{b as c}from"./chunk-2JIKUIDL.js";import{ja as r,na as s}from"./chunk-UXRO4UFY.js";var i=class{to;from;constructor(){this.to=new Date,this.from=new Date}};var n=class o{cookiesService=s(c);_cookiesName="PaymentDate";dateFilter={from:new Date,to:new Date};set(e){this.saveFilterToCookie(e),this.dateFilter=e}initFilterDate(e){let t;if(this.checkCookieExists())t=this.get();else{let a=e.From||new Date,m=e.To||new Date;t={from:a,to:m}}return e.From=t.from,e.To=t.to,e}get(){return this.checkCookieExists()?this.dateFilter=JSON.parse(this.cookiesService.get(this._cookiesName)):this.dateFilter=new i,this.dateFilter}checkCookieExists(){return this.cookiesService.check(this._cookiesName)}saveFilterToCookie(e){this.cookiesService.set(this._cookiesName,JSON.stringify(e),this.getExpiredDate(),"/")}clear(){this.cookiesService.delete(this._cookiesName,"/"),this.dateFilter=new i}getExpiredDate(){let e=new Date,a=1*60*60*1e3;return e.setTime(e.getTime()+a),e}static \u0275fac=function(t){return new(t||o)};static \u0275prov=r({token:o,factory:o.\u0275fac,providedIn:"root"})};export{n as a};
1
+ import{b as c}from"./chunk-2FWXO7SV.js";import{ja as r,na as s}from"./chunk-UXRO4UFY.js";var i=class{to;from;constructor(){this.to=new Date,this.from=new Date}};var n=class o{cookiesService=s(c);_cookiesName="PaymentDate";dateFilter={from:new Date,to:new Date};set(e){this.saveFilterToCookie(e),this.dateFilter=e}initFilterDate(e){let t;if(this.checkCookieExists())t=this.get();else{let a=e.From||new Date,m=e.To||new Date;t={from:a,to:m}}return e.From=t.from,e.To=t.to,e}get(){return this.checkCookieExists()?this.dateFilter=JSON.parse(this.cookiesService.get(this._cookiesName)):this.dateFilter=new i,this.dateFilter}checkCookieExists(){return this.cookiesService.check(this._cookiesName)}saveFilterToCookie(e){this.cookiesService.set(this._cookiesName,JSON.stringify(e),this.getExpiredDate(),"/")}clear(){this.cookiesService.delete(this._cookiesName,"/"),this.dateFilter=new i}getExpiredDate(){let e=new Date,a=1*60*60*1e3;return e.setTime(e.getTime()+a),e}static \u0275fac=function(t){return new(t||o)};static \u0275prov=r({token:o,factory:o.\u0275fac,providedIn:"root"})};export{n as a};
@@ -1 +1 @@
1
- import{a as Ge}from"./chunk-TSEZZNO5.js";import{a as Ae,f as Ne}from"./chunk-ZT4JJ72K.js";import{b as Le,c as Re,d as Be,e as We,f as je,g as ze}from"./chunk-6CWGCLY5.js";import"./chunk-O2QTP22K.js";import{b as $e}from"./chunk-YRGGDRUH.js";import"./chunk-Q4CKRRGM.js";import"./chunk-PIYM2FOP.js";import{d as Fe}from"./chunk-2OWHEMAL.js";import"./chunk-XZELBTQR.js";import"./chunk-B5SDXVDR.js";import"./chunk-YWN3ZCUG.js";import"./chunk-L7YSVT7G.js";import"./chunk-RX7JS4CO.js";import{b as xe}from"./chunk-XBRBYCWJ.js";import"./chunk-3RK6DDJD.js";import{a as he}from"./chunk-FP4HFB5J.js";import"./chunk-YEDKRNXU.js";import{d as Se}from"./chunk-VZEPVRCY.js";import"./chunk-7QWJJPNG.js";import{b as De,c as ke,e as Ue,f as Ve}from"./chunk-OLSCBS7E.js";import"./chunk-LIBVAZGG.js";import"./chunk-5JJSLRVS.js";import"./chunk-CWITQVZH.js";import"./chunk-LMJVRREP.js";import"./chunk-3LBZDIW2.js";import"./chunk-KTCV3KOE.js";import"./chunk-KZDE63UL.js";import{d as Pe,e as Oe}from"./chunk-JVMOM4H4.js";import{a as be,b as Ee}from"./chunk-P4CJOEI6.js";import"./chunk-3GOO5E5D.js";import"./chunk-XMYLHF4C.js";import{u as ye,v as Te,w as Me}from"./chunk-H7F34T25.js";import"./chunk-JOXTERIM.js";import{O as H}from"./chunk-TSIYPTYI.js";import{e as we,f as ve,g as Ie}from"./chunk-3YKVLHZG.js";import"./chunk-ZHY3BUQJ.js";import"./chunk-VFTGIP5A.js";import"./chunk-LE3BKIDY.js";import"./chunk-2FWFPV5I.js";import{la as Ce}from"./chunk-EEEAUYZ6.js";import{F as L,G as fe,h as ue,o as _e}from"./chunk-RVXZOIFQ.js";import"./chunk-2JIKUIDL.js";import"./chunk-NO3WSZS5.js";import"./chunk-ZZGSAFGO.js";import"./chunk-TDQR33OS.js";import{$a as a,$b as A,Ac as S,Bc as ae,Db as b,E as K,Eb as te,Gb as ie,Hb as ne,I as Y,Ia as $,Ib as n,Ja as k,Jb as o,Kb as x,Lb as y,Ma as U,Mb as T,Ob as h,Qb as f,Rb as d,Sb as oe,Tb as Q,Wa as X,Wc as me,Y as j,Yd as ge,Zb as V,Zc as se,_b as F,aa as J,cd as de,db as G,dc as N,ec as l,fa as z,fc as c,gc as w,gd as ce,jc as P,jd as M,k as q,kb as I,kc as O,lc as D,na as E,ob as Z,qb as C,qc as re,rc as le,tc as pe,va as u,vb as s,wa as _,xb as ee,zc as g}from"./chunk-UXRO4UFY.js";import"./chunk-7DCB7DB2.js";var Ye=["stepperRef"],Je=[[["preview"]],[["complete"]]],Xe=["preview","complete"];function Ze(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function et(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function tt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function it(t,r){t&1&&(x(0,"i",8),n(1,"span"),l(2,"Upload"),o())}function nt(t,r){if(t&1){let e=h();n(0,"div",9)(1,"div",10)(2,"POS-uppy",11),f("fileUploaded",function(i){u(e);let m=d(2);return _(m.onDropFile(i))}),o()(),n(3,"div",12)(4,"p",13),l(5," Please refer this "),n(6,"a",14),l(7,"article"),o(),l(8," for more information "),o()()()}if(t&2){let e=d(2);a(2),s("sampleUrl",e.sampleUrl())("subtitle","Accepted file formats: .csv & max file size: 1 MB"),a(4),s("href",e.articleLink(),X)}}function ot(t,r){if(t&1&&C(0,nt,9,3,"div",9),t&2){d();let e=N(1);b(e.selectedIndex===0?0:-1)}}function rt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function lt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function pt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function at(t,r){t&1&&(x(0,"i",15),n(1,"span"),l(2,"Preview"),o())}function mt(t,r){t&1&&Q(0)}function st(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function dt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function ct(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function ut(t,r){t&1&&(x(0,"i",16),n(1,"span"),l(2,"Finish"),o())}function _t(t,r){t&1&&Q(0,1)}var R=class t{sampleUrl=k();articleLink=k();_onDropFile=$({alias:"onDropFile"});disabledEdit=k(!1);_onStateChange=$({alias:"onStateChange"});_stepper;get stepper(){return this._stepper}nextStep(){this._stepper&&(this.stepper.selected.completed=!0,this._stepper.next())}previousStep(){this._stepper&&this._stepper.previous()}resetStep(){this._stepper&&this._stepper.reset()}onStepChange(r){r.selectedIndex===1?this._onStateChange.emit(1):r.selectedIndex===2?this._onStateChange.emit(2):this._onStateChange.emit(0)}onDropFile(r){this._onDropFile.emit(r)}onRemoveFile(){}stateUpload(){}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=I({type:t,selectors:[["pos-import-stepper"]],viewQuery:function(e,p){if(e&1&&V(Ye,5),e&2){let i;F(i=A())&&(p._stepper=i.first)}},inputs:{sampleUrl:[1,"sampleUrl"],articleLink:[1,"articleLink"],disabledEdit:[1,"disabledEdit"]},outputs:{_onDropFile:"onDropFile",_onStateChange:"onStateChange"},ngContentSelectors:Xe,decls:20,vars:7,consts:[["stepperRef",""],[3,"selectionChange","linear"],[3,"completed","editable"],["matStepperIcon","done"],["matStepperIcon","create"],["matStepperIcon","edit"],["matStepLabel",""],["matStepContent",""],[1,"fa-solid","fa-upload","me-3"],[1,"d-flex","flex-column","align-items-center","justify-content-center","gap-2"],[2,"max-width","580px"],["file","",3,"fileUploaded","sampleUrl","subtitle"],[1,"d-flex","w-100",2,"max-width","580px"],[1,"fst-italic"],["target","_blank",3,"href"],[1,"fa-regular","fa-file","me-3"],[1,"fa-solid","fa-check","me-3"]],template:function(e,p){if(e&1){let i=h();oe(Je),n(0,"mat-stepper",1,0),f("selectionChange",function(v){return u(i),_(p.onStepChange(v))}),n(2,"mat-step",2),C(3,Ze,1,1,"ng-template",3)(4,et,1,1,"ng-template",4)(5,tt,1,1,"ng-template",5)(6,it,3,0,"ng-template",6)(7,ot,1,1,"ng-template",7),o(),n(8,"mat-step",2),C(9,rt,1,1,"ng-template",3)(10,lt,1,1,"ng-template",4)(11,pt,1,1,"ng-template",5)(12,at,3,0,"ng-template",6)(13,mt,1,0,"ng-template",7),o(),n(14,"mat-step",2),C(15,st,1,1,"ng-template",3)(16,dt,1,1,"ng-template",4)(17,ct,1,1,"ng-template",5)(18,ut,3,0,"ng-template",6)(19,_t,1,0,"ng-template",7),o()()}e&2&&(s("linear",!0),a(2),s("completed",!1)("editable",!p.disabledEdit()),a(6),s("completed",!1)("editable",!p.disabledEdit()),a(6),s("completed",!1)("editable",!1))},dependencies:[M,Se,L,fe,he,xe,$e,Fe,ze,We,Le,je,Re,Be],styles:[".mat-horizontal-stepper-header-container{width:50%!important;margin:0 auto} .mat-horizontal-stepper-wrapper{gap:1rem} .mat-horizontal-stepper-content{display:flex;justify-content:center} p-table .p-datatable-tbody>tr{border-bottom-width:1px;border-color:#dee2e6} p-table .p-datatable-tbody>tr>th{font-family:Roboto,system-ui!important;font-weight:400;font-style:normal} .p-datatable .p-datatable-wrapper .p-datatable-table .p-datatable-thead>tr>th{font-family:Roboto,Courier,monospace;font-weight:700;font-style:normal;color:#333} .p-datatable .p-datatable-wrapper .p-datatable-table .p-datatable-tbody>tr>td{font-family:Roboto,Courier,monospace;font-weight:400;font-style:normal;color:#333}"]})};var B=class t{configModal=new ye;dialogRef=E(we);data=E(ve);constructor(){this.initDialogConfig()}initDialogConfig(){this.configModal.title="Preview Summary",this.configModal.hideCancel=!0,this.configModal.okText="Import (F2)",this.configModal.customWidth="500px"}onOk(){this.dialogRef.close(!0)}onClose(){this.dialogRef.close(!1)}ngOnInit(){}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=I({type:t,selectors:[["app-dialog-import-preview"]],decls:30,vars:10,consts:[[3,"onOk","onCancel","onClose","config"],[1,"card","mb-0"],[1,"card-header","py-6","bg-gradient-success"],[1,"card-body"],[1,"row"],[1,"col"],[1,"d-flex","flex-column","gap-2"],[2,"font-size","1.9rem"],[2,"font-size","1rem"]],template:function(e,p){e&1&&(n(0,"modal-material",0),f("onOk",function(){return p.onOk()})("onCancel",function(){return p.onClose()})("onClose",function(){return p.onClose()}),x(1,"header"),n(2,"content")(3,"div",1)(4,"div",2)(5,"h3"),l(6,"Import Summary"),o()(),n(7,"div",3)(8,"div",4)(9,"div",5)(10,"div",6)(11,"span",7),l(12),g(13,"number"),o(),n(14,"span",8),l(15,"New Outlet"),o()()(),n(16,"div",5)(17,"div",6)(18,"span",7),l(19),g(20,"number"),o(),n(21,"span",8),l(22,"Update Outlet"),o()()(),n(23,"div",5)(24,"div",6)(25,"span",7),l(26),g(27,"number"),o(),n(28,"span",8),l(29,"New Outlet Group"),o()()()()()()()()),e&2&&(s("config",p.configModal),a(12),c(S(13,4,p.data==null?null:p.data.new)),a(7),c(S(20,6,p.data==null?null:p.data.update)),a(7),c(S(27,8,p.data==null?null:p.data.newOutletGroup)))},dependencies:[M,ce,Me,Te],encapsulation:2})};var gt=["importStepper"],Ct=()=>({"min-width":"50rem"}),St=(t,r,e)=>({"btn-success":t,"btn-outline-secondary":r,"not-allowed":e}),ht=t=>({"mb-1":t});function xt(t,r){if(t&1){let e=h();n(0,"button",14),f("click",function(){u(e);let i=d();return _(i.onPreviousStep())}),l(1," Back "),o()}}function bt(t,r){if(t&1){let e=h();n(0,"button",15),g(1,"async"),g(2,"async"),f("click",function(){u(e);let i=d();return _(i.onNextStep())}),l(3," Next "),o()}if(t&2){let e,p,i=d();s("ngClass",pe(6,St,i.currentState()===1,i.currentState()!==1,!((e=S(1,2,i.importPreview$))!=null&&e.CanProceed)))("disabled",!((p=S(2,4,i.importPreview$))!=null&&p.CanProceed)&&i.currentState()===1)}}function wt(t,r){if(t&1){let e=h();n(0,"button",14),f("click",function(){u(e);let i=d();return _(i.onReset())}),l(1," New "),o()}}function vt(t,r){if(t&1){let e=h();n(0,"tr")(1,"th",16),l(2,"Name"),o(),n(3,"th",17),l(4,"Code"),o(),n(5,"th",18),l(6," Status "),n(7,"i",19),f("click",function(i){u(e);let m=N(9);return _(m.toggle(i))}),o(),n(8,"p-popover",null,1)(10,"div",20)(11,"div",21)(12,"p-checkbox",22),f("ngModelChange",function(i){u(e);let m=d();return _(m.selectAll(i))}),o(),n(13,"label",23),l(14,"All"),o()(),n(15,"div",24)(16,"p-checkbox",25),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(17,"label",26),l(18,"Unchanged"),o()(),n(19,"div",24)(20,"p-checkbox",27),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(21,"label",28),l(22,"New"),o()(),n(23,"div",24)(24,"p-checkbox",29),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(25,"label",30),l(26,"Error"),o()(),n(27,"div",24)(28,"p-checkbox",31),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(29,"label",32),l(30,"Update"),o()()()()(),n(31,"th"),l(32,"Message"),o()()}if(t&2){let e=d();a(12),s("ngModel",e.pickAll),a(4),P("ngModel",e.filterTreeCondition),a(4),P("ngModel",e.filterTreeCondition),a(4),P("ngModel",e.filterTreeCondition),a(4),P("ngModel",e.filterTreeCondition)}}function It(t,r){if(t&1&&(n(0,"div",33)(1,"span",34),l(2),o(),n(3,"span"),l(4),o()()),t&2){let e=r.$implicit,p=r.$index,i=d().$implicit;s("ngClass",le(3,ht,p<i.Issues.length-1)),a(2),w(" ",e.Issue,". "),a(2),w("",e.Solution," ")}}function yt(t,r){if(t&1&&(n(0,"tr")(1,"td"),l(2),o(),n(3,"td"),l(4),o(),n(5,"td"),l(6),o(),n(7,"td"),ie(8,It,5,5,"div",33,te),o()()),t&2){let e=r.$implicit;a(2),c(e.Name),a(2),c(e.Code),a(),ee("bg-gradient-success",e.Action=="New")("bg-gradient-warning",e.Action=="Update")("bg-gradient-danger",e.Action=="Error"),a(),w(" ",e.Action," "),a(2),ne(e.Issues)}}function Tt(t,r){if(t&1&&(y(0),n(1,"div",38)(2,"span"),l(3),o(),l(4,", "),n(5,"span"),l(6),o(),n(7,"span"),l(8),o(),n(9,"span"),l(10,"succesfully imported"),o()(),T()),t&2){let e=r.ngIf;a(3),w("",e==null?null:e.Summary.NewOutlet," New Outlets"),a(3),w("",e==null?null:e.Summary.UpdateOutlet," Updated Outlets"),a(2),w("and ",e==null?null:e.Summary.NewOutletGroup," New Outlet Group")}}function Mt(t,r){if(t&1&&(n(0,"div",13),x(1,"i",35),n(2,"h1",36),l(3,"Upload Complete!"),o(),C(4,Tt,11,3,"ng-container",37),g(5,"async"),o()),t&2){let e=d();a(4),s("ngIf",S(5,1,e.importPreview$))}}var qe=class t extends be{constructor(e,p){super(e);this.httpService=p;this.menuData$.subscribe()}pickAll=["All"];filterTreeCondition=["Unchanged","New","Error","Update"];importStepper;fileToImport=U(null);importPreview$;sampleUrl="https://cdn.dealpos.xyz/web-import-template/Outlet_Import_Template.csv";articleLink="https://support.dealpos.com/en/articles/11069092-import-new-outlet";currentState=U(0);confirmImport$;importPreview=U(null);dialog=E(Ie);onDropFile(e){this.fileToImport.set(e)}onNextStep(){switch(this.currentState()){case 0:this.onPreviewImport();break;case 1:this.onImport();break;default:break}}onPreviousStep(){this.importStepper.previousStep()}onReset(){this.importPreview.set(null),this.importPreview$=null,this.confirmImport$=null,this.fileToImport.set(null),this.currentState.update(()=>0),this.importStepper.resetStep()}onStateChange(e){this.currentState.update(()=>e)}onPreviewImport(){this.pickAll=["All"],this.filterTreeCondition=["Unchanged","New","Error","Update"];let e=new FormData;e.append("file",this.fileToImport()),this.importPreview$=this.httpService.postFormData(H.previewImportOutlet,e).pipe(z(p=>{this.importPreview.set(p),this.importStepper.nextStep()}),j(1))}onImport(){this.confirmImport$=this.dialog.open(B,{data:{new:this.importPreview()?.Summary?.NewOutlet,update:this.importPreview()?.Summary?.UpdateOutlet,newOutletGroup:this.importPreview()?.Summary?.NewOutletGroup}}).afterClosed().pipe(K(e=>e==!0),J(()=>this.httpService.post(H.importOutlet,{CacheKey:this.importPreview()?.CacheKey})),z(e=>{this.importStepper.nextStep()}),Y(e=>(this.pickAll=[],this.filterTreeCondition=["Error"],q)),j(1))}selectAll(e){this.pickAll=e,this.pickAll.length==0?this.filterTreeCondition=[]:this.filterTreeCondition=["Unchanged","New","Error","Update"]}static \u0275fac=function(p){return new(p||t)(G(Ee),G(ge))};static \u0275cmp=I({type:t,selectors:[["app-outlet-import"]],viewQuery:function(p,i){if(p&1&&V(gt,5),p&2){let m;F(m=A())&&(i.importStepper=m.first)}},features:[Z],decls:17,vars:21,consts:[["importStepper",""],["op",""],[3,"pageData","hideSearchBox","hideSearchDropdown"],["ngProjectAs","actions",5,["actions"]],["type","button",1,"btn","btn-outline-secondary"],[1,"btn",3,"ngClass","disabled"],["ngProjectAs","content",5,["content"]],[3,"onDropFile","onStateChange","sampleUrl","disabledEdit","articleLink"],["ngProjectAs","preview",5,["preview"]],[1,"w-100",3,"value","scrollable","tableStyle"],["pTemplate","header"],["pTemplate","body"],["ngProjectAs","complete",5,["complete"]],[1,"d-flex","flex-column","align-items-center"],["type","button",1,"btn","btn-outline-secondary",3,"click"],[1,"btn",3,"click","ngClass","disabled"],[2,"width","300px"],[2,"width","200px"],[2,"width","100px"],[1,"fa","fa-filter","pointer",3,"click"],[2,"width","150px"],[1,"border-bottom","pb-3","d-flex","align-items-center","column-gap-3"],["label","Select All","name","filterTreeCondition","value","All","inputId","all",3,"ngModelChange","ngModel"],["for","all",1,"ms-2"],[1,"mt-4","d-flex","align-items-center","column-gap-3"],["label","Unchanged","name","filterTreeCondition","value","Unchanged","inputId","unchanged",3,"ngModelChange","ngModel"],["for","unchanged",1,"ms-2"],["label","New","name","filterTreeCondition","value","New","inputId","new",3,"ngModelChange","ngModel"],["for","new",1,"ms-2"],["label","Error","name","filterTreeCondition","value","Error","inputId","error",3,"ngModelChange","ngModel"],["for","error",1,"ms-2"],["label","Updated","name","filterTreeCondition","value","Update","inputId","update",3,"ngModelChange","ngModel"],["for","update",1,"ms-2"],[3,"ngClass"],[1,"me-1"],[1,"fa-solid","fa-circle-check","text-success",2,"font-size","110px"],[1,"mt-8"],[4,"ngIf"],[1,"d-flex","gap-2","fw-normal","fs-4","mt-2"]],template:function(p,i){if(p&1){let m=h();n(0,"mainpanel-cmp",2),y(1,3),C(2,xt,2,0,"button",4)(3,bt,4,10,"button",5)(4,wt,2,0,"button",4),T(),y(5,6),n(6,"pos-import-stepper",7,0),f("onDropFile",function(W){return u(m),_(i.onDropFile(W))})("onStateChange",function(W){return u(m),_(i.onStateChange(W))}),y(8,8),n(9,"p-table",9),g(10,"async"),g(11,"filterTree"),C(12,vt,33,5,"ng-template",10)(13,yt,10,9,"ng-template",11),o(),T(),y(14,12),C(15,Mt,6,3,"div",13),g(16,"async"),T(),o(),T(),o()}if(p&2){let m,v;s("pageData",i.menuData)("hideSearchBox",!0)("hideSearchDropdown",!0),a(2),b(i.currentState()==1?2:-1),a(),b(i.fileToImport()&&((m=i.fileToImport())==null?null:m.size)>0&&i.currentState()<2?3:-1),a(),b(i.currentState()===2?4:-1),a(2),s("sampleUrl",i.sampleUrl)("disabledEdit",i.currentState()===2)("articleLink",i.articleLink),a(3),s("value",ae(11,15,(v=S(10,13,i.importPreview$))==null?null:v.DataRow,i.filterTreeCondition))("scrollable",!0)("tableStyle",re(20,Ct)),a(6),b(S(16,18,i.confirmImport$)?15:-1)}},dependencies:[M,me,se,de,R,Ve,Ue,Ne,Ae,Ce,Oe,Pe,L,ue,_e,ke,De,Ge],encapsulation:2})};export{qe as OutletImportComponent};
1
+ import{a as Ge}from"./chunk-TSEZZNO5.js";import{a as Ae,f as Ne}from"./chunk-V26H2UIF.js";import{b as Le,c as Re,d as Be,e as We,f as je,g as ze}from"./chunk-6CWGCLY5.js";import"./chunk-O2QTP22K.js";import{b as $e}from"./chunk-YRGGDRUH.js";import"./chunk-Q4CKRRGM.js";import"./chunk-PIYM2FOP.js";import{d as Fe}from"./chunk-2OWHEMAL.js";import"./chunk-XZELBTQR.js";import"./chunk-B5SDXVDR.js";import"./chunk-RF2OEHPO.js";import"./chunk-L7YSVT7G.js";import"./chunk-RX7JS4CO.js";import{b as xe}from"./chunk-XBRBYCWJ.js";import"./chunk-3RK6DDJD.js";import{a as he}from"./chunk-FP4HFB5J.js";import"./chunk-YEDKRNXU.js";import{d as Se}from"./chunk-VZEPVRCY.js";import"./chunk-7QWJJPNG.js";import{b as De,c as ke,e as Ue,f as Ve}from"./chunk-3PTKHKTZ.js";import"./chunk-IQQGAD2W.js";import"./chunk-5JJSLRVS.js";import"./chunk-CWITQVZH.js";import"./chunk-LMJVRREP.js";import"./chunk-3LBZDIW2.js";import"./chunk-KTCV3KOE.js";import"./chunk-KZDE63UL.js";import{d as Pe,e as Oe}from"./chunk-ARKU4MG5.js";import{a as be,b as Ee}from"./chunk-S22XRS4J.js";import"./chunk-3GOO5E5D.js";import"./chunk-XMYLHF4C.js";import{u as ye,v as Te,w as Me}from"./chunk-H7F34T25.js";import"./chunk-JOXTERIM.js";import{O as H}from"./chunk-TSIYPTYI.js";import{e as we,f as ve,g as Ie}from"./chunk-3YKVLHZG.js";import"./chunk-ZHY3BUQJ.js";import"./chunk-VFTGIP5A.js";import"./chunk-LE3BKIDY.js";import"./chunk-2FWFPV5I.js";import{la as Ce}from"./chunk-EEEAUYZ6.js";import{F as L,G as fe,h as ue,o as _e}from"./chunk-RVXZOIFQ.js";import"./chunk-2FWXO7SV.js";import"./chunk-6ABP4TP7.js";import"./chunk-ZZGSAFGO.js";import"./chunk-QVPSWY5E.js";import{$a as a,$b as A,Ac as S,Bc as ae,Db as b,E as K,Eb as te,Gb as ie,Hb as ne,I as Y,Ia as $,Ib as n,Ja as k,Jb as o,Kb as x,Lb as y,Ma as U,Mb as T,Ob as h,Qb as f,Rb as d,Sb as oe,Tb as Q,Wa as X,Wc as me,Y as j,Yd as ge,Zb as V,Zc as se,_b as F,aa as J,cd as de,db as G,dc as N,ec as l,fa as z,fc as c,gc as w,gd as ce,jc as P,jd as M,k as q,kb as I,kc as O,lc as D,na as E,ob as Z,qb as C,qc as re,rc as le,tc as pe,va as u,vb as s,wa as _,xb as ee,zc as g}from"./chunk-UXRO4UFY.js";import"./chunk-7DCB7DB2.js";var Ye=["stepperRef"],Je=[[["preview"]],[["complete"]]],Xe=["preview","complete"];function Ze(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function et(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function tt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function it(t,r){t&1&&(x(0,"i",8),n(1,"span"),l(2,"Upload"),o())}function nt(t,r){if(t&1){let e=h();n(0,"div",9)(1,"div",10)(2,"POS-uppy",11),f("fileUploaded",function(i){u(e);let m=d(2);return _(m.onDropFile(i))}),o()(),n(3,"div",12)(4,"p",13),l(5," Please refer this "),n(6,"a",14),l(7,"article"),o(),l(8," for more information "),o()()()}if(t&2){let e=d(2);a(2),s("sampleUrl",e.sampleUrl())("subtitle","Accepted file formats: .csv & max file size: 1 MB"),a(4),s("href",e.articleLink(),X)}}function ot(t,r){if(t&1&&C(0,nt,9,3,"div",9),t&2){d();let e=N(1);b(e.selectedIndex===0?0:-1)}}function rt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function lt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function pt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function at(t,r){t&1&&(x(0,"i",15),n(1,"span"),l(2,"Preview"),o())}function mt(t,r){t&1&&Q(0)}function st(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function dt(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function ct(t,r){if(t&1&&l(0),t&2){let e=r.index;c(e+1)}}function ut(t,r){t&1&&(x(0,"i",16),n(1,"span"),l(2,"Finish"),o())}function _t(t,r){t&1&&Q(0,1)}var R=class t{sampleUrl=k();articleLink=k();_onDropFile=$({alias:"onDropFile"});disabledEdit=k(!1);_onStateChange=$({alias:"onStateChange"});_stepper;get stepper(){return this._stepper}nextStep(){this._stepper&&(this.stepper.selected.completed=!0,this._stepper.next())}previousStep(){this._stepper&&this._stepper.previous()}resetStep(){this._stepper&&this._stepper.reset()}onStepChange(r){r.selectedIndex===1?this._onStateChange.emit(1):r.selectedIndex===2?this._onStateChange.emit(2):this._onStateChange.emit(0)}onDropFile(r){this._onDropFile.emit(r)}onRemoveFile(){}stateUpload(){}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=I({type:t,selectors:[["pos-import-stepper"]],viewQuery:function(e,p){if(e&1&&V(Ye,5),e&2){let i;F(i=A())&&(p._stepper=i.first)}},inputs:{sampleUrl:[1,"sampleUrl"],articleLink:[1,"articleLink"],disabledEdit:[1,"disabledEdit"]},outputs:{_onDropFile:"onDropFile",_onStateChange:"onStateChange"},ngContentSelectors:Xe,decls:20,vars:7,consts:[["stepperRef",""],[3,"selectionChange","linear"],[3,"completed","editable"],["matStepperIcon","done"],["matStepperIcon","create"],["matStepperIcon","edit"],["matStepLabel",""],["matStepContent",""],[1,"fa-solid","fa-upload","me-3"],[1,"d-flex","flex-column","align-items-center","justify-content-center","gap-2"],[2,"max-width","580px"],["file","",3,"fileUploaded","sampleUrl","subtitle"],[1,"d-flex","w-100",2,"max-width","580px"],[1,"fst-italic"],["target","_blank",3,"href"],[1,"fa-regular","fa-file","me-3"],[1,"fa-solid","fa-check","me-3"]],template:function(e,p){if(e&1){let i=h();oe(Je),n(0,"mat-stepper",1,0),f("selectionChange",function(v){return u(i),_(p.onStepChange(v))}),n(2,"mat-step",2),C(3,Ze,1,1,"ng-template",3)(4,et,1,1,"ng-template",4)(5,tt,1,1,"ng-template",5)(6,it,3,0,"ng-template",6)(7,ot,1,1,"ng-template",7),o(),n(8,"mat-step",2),C(9,rt,1,1,"ng-template",3)(10,lt,1,1,"ng-template",4)(11,pt,1,1,"ng-template",5)(12,at,3,0,"ng-template",6)(13,mt,1,0,"ng-template",7),o(),n(14,"mat-step",2),C(15,st,1,1,"ng-template",3)(16,dt,1,1,"ng-template",4)(17,ct,1,1,"ng-template",5)(18,ut,3,0,"ng-template",6)(19,_t,1,0,"ng-template",7),o()()}e&2&&(s("linear",!0),a(2),s("completed",!1)("editable",!p.disabledEdit()),a(6),s("completed",!1)("editable",!p.disabledEdit()),a(6),s("completed",!1)("editable",!1))},dependencies:[M,Se,L,fe,he,xe,$e,Fe,ze,We,Le,je,Re,Be],styles:[".mat-horizontal-stepper-header-container{width:50%!important;margin:0 auto} .mat-horizontal-stepper-wrapper{gap:1rem} .mat-horizontal-stepper-content{display:flex;justify-content:center} p-table .p-datatable-tbody>tr{border-bottom-width:1px;border-color:#dee2e6} p-table .p-datatable-tbody>tr>th{font-family:Roboto,system-ui!important;font-weight:400;font-style:normal} .p-datatable .p-datatable-wrapper .p-datatable-table .p-datatable-thead>tr>th{font-family:Roboto,Courier,monospace;font-weight:700;font-style:normal;color:#333} .p-datatable .p-datatable-wrapper .p-datatable-table .p-datatable-tbody>tr>td{font-family:Roboto,Courier,monospace;font-weight:400;font-style:normal;color:#333}"]})};var B=class t{configModal=new ye;dialogRef=E(we);data=E(ve);constructor(){this.initDialogConfig()}initDialogConfig(){this.configModal.title="Preview Summary",this.configModal.hideCancel=!0,this.configModal.okText="Import (F2)",this.configModal.customWidth="500px"}onOk(){this.dialogRef.close(!0)}onClose(){this.dialogRef.close(!1)}ngOnInit(){}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=I({type:t,selectors:[["app-dialog-import-preview"]],decls:30,vars:10,consts:[[3,"onOk","onCancel","onClose","config"],[1,"card","mb-0"],[1,"card-header","py-6","bg-gradient-success"],[1,"card-body"],[1,"row"],[1,"col"],[1,"d-flex","flex-column","gap-2"],[2,"font-size","1.9rem"],[2,"font-size","1rem"]],template:function(e,p){e&1&&(n(0,"modal-material",0),f("onOk",function(){return p.onOk()})("onCancel",function(){return p.onClose()})("onClose",function(){return p.onClose()}),x(1,"header"),n(2,"content")(3,"div",1)(4,"div",2)(5,"h3"),l(6,"Import Summary"),o()(),n(7,"div",3)(8,"div",4)(9,"div",5)(10,"div",6)(11,"span",7),l(12),g(13,"number"),o(),n(14,"span",8),l(15,"New Outlet"),o()()(),n(16,"div",5)(17,"div",6)(18,"span",7),l(19),g(20,"number"),o(),n(21,"span",8),l(22,"Update Outlet"),o()()(),n(23,"div",5)(24,"div",6)(25,"span",7),l(26),g(27,"number"),o(),n(28,"span",8),l(29,"New Outlet Group"),o()()()()()()()()),e&2&&(s("config",p.configModal),a(12),c(S(13,4,p.data==null?null:p.data.new)),a(7),c(S(20,6,p.data==null?null:p.data.update)),a(7),c(S(27,8,p.data==null?null:p.data.newOutletGroup)))},dependencies:[M,ce,Me,Te],encapsulation:2})};var gt=["importStepper"],Ct=()=>({"min-width":"50rem"}),St=(t,r,e)=>({"btn-success":t,"btn-outline-secondary":r,"not-allowed":e}),ht=t=>({"mb-1":t});function xt(t,r){if(t&1){let e=h();n(0,"button",14),f("click",function(){u(e);let i=d();return _(i.onPreviousStep())}),l(1," Back "),o()}}function bt(t,r){if(t&1){let e=h();n(0,"button",15),g(1,"async"),g(2,"async"),f("click",function(){u(e);let i=d();return _(i.onNextStep())}),l(3," Next "),o()}if(t&2){let e,p,i=d();s("ngClass",pe(6,St,i.currentState()===1,i.currentState()!==1,!((e=S(1,2,i.importPreview$))!=null&&e.CanProceed)))("disabled",!((p=S(2,4,i.importPreview$))!=null&&p.CanProceed)&&i.currentState()===1)}}function wt(t,r){if(t&1){let e=h();n(0,"button",14),f("click",function(){u(e);let i=d();return _(i.onReset())}),l(1," New "),o()}}function vt(t,r){if(t&1){let e=h();n(0,"tr")(1,"th",16),l(2,"Name"),o(),n(3,"th",17),l(4,"Code"),o(),n(5,"th",18),l(6," Status "),n(7,"i",19),f("click",function(i){u(e);let m=N(9);return _(m.toggle(i))}),o(),n(8,"p-popover",null,1)(10,"div",20)(11,"div",21)(12,"p-checkbox",22),f("ngModelChange",function(i){u(e);let m=d();return _(m.selectAll(i))}),o(),n(13,"label",23),l(14,"All"),o()(),n(15,"div",24)(16,"p-checkbox",25),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(17,"label",26),l(18,"Unchanged"),o()(),n(19,"div",24)(20,"p-checkbox",27),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(21,"label",28),l(22,"New"),o()(),n(23,"div",24)(24,"p-checkbox",29),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(25,"label",30),l(26,"Error"),o()(),n(27,"div",24)(28,"p-checkbox",31),D("ngModelChange",function(i){u(e);let m=d();return O(m.filterTreeCondition,i)||(m.filterTreeCondition=i),_(i)}),o(),n(29,"label",32),l(30,"Update"),o()()()()(),n(31,"th"),l(32,"Message"),o()()}if(t&2){let e=d();a(12),s("ngModel",e.pickAll),a(4),P("ngModel",e.filterTreeCondition),a(4),P("ngModel",e.filterTreeCondition),a(4),P("ngModel",e.filterTreeCondition),a(4),P("ngModel",e.filterTreeCondition)}}function It(t,r){if(t&1&&(n(0,"div",33)(1,"span",34),l(2),o(),n(3,"span"),l(4),o()()),t&2){let e=r.$implicit,p=r.$index,i=d().$implicit;s("ngClass",le(3,ht,p<i.Issues.length-1)),a(2),w(" ",e.Issue,". "),a(2),w("",e.Solution," ")}}function yt(t,r){if(t&1&&(n(0,"tr")(1,"td"),l(2),o(),n(3,"td"),l(4),o(),n(5,"td"),l(6),o(),n(7,"td"),ie(8,It,5,5,"div",33,te),o()()),t&2){let e=r.$implicit;a(2),c(e.Name),a(2),c(e.Code),a(),ee("bg-gradient-success",e.Action=="New")("bg-gradient-warning",e.Action=="Update")("bg-gradient-danger",e.Action=="Error"),a(),w(" ",e.Action," "),a(2),ne(e.Issues)}}function Tt(t,r){if(t&1&&(y(0),n(1,"div",38)(2,"span"),l(3),o(),l(4,", "),n(5,"span"),l(6),o(),n(7,"span"),l(8),o(),n(9,"span"),l(10,"succesfully imported"),o()(),T()),t&2){let e=r.ngIf;a(3),w("",e==null?null:e.Summary.NewOutlet," New Outlets"),a(3),w("",e==null?null:e.Summary.UpdateOutlet," Updated Outlets"),a(2),w("and ",e==null?null:e.Summary.NewOutletGroup," New Outlet Group")}}function Mt(t,r){if(t&1&&(n(0,"div",13),x(1,"i",35),n(2,"h1",36),l(3,"Upload Complete!"),o(),C(4,Tt,11,3,"ng-container",37),g(5,"async"),o()),t&2){let e=d();a(4),s("ngIf",S(5,1,e.importPreview$))}}var qe=class t extends be{constructor(e,p){super(e);this.httpService=p;this.menuData$.subscribe()}pickAll=["All"];filterTreeCondition=["Unchanged","New","Error","Update"];importStepper;fileToImport=U(null);importPreview$;sampleUrl="https://cdn.dealpos.xyz/web-import-template/Outlet_Import_Template.csv";articleLink="https://support.dealpos.com/en/articles/11069092-import-new-outlet";currentState=U(0);confirmImport$;importPreview=U(null);dialog=E(Ie);onDropFile(e){this.fileToImport.set(e)}onNextStep(){switch(this.currentState()){case 0:this.onPreviewImport();break;case 1:this.onImport();break;default:break}}onPreviousStep(){this.importStepper.previousStep()}onReset(){this.importPreview.set(null),this.importPreview$=null,this.confirmImport$=null,this.fileToImport.set(null),this.currentState.update(()=>0),this.importStepper.resetStep()}onStateChange(e){this.currentState.update(()=>e)}onPreviewImport(){this.pickAll=["All"],this.filterTreeCondition=["Unchanged","New","Error","Update"];let e=new FormData;e.append("file",this.fileToImport()),this.importPreview$=this.httpService.postFormData(H.previewImportOutlet,e).pipe(z(p=>{this.importPreview.set(p),this.importStepper.nextStep()}),j(1))}onImport(){this.confirmImport$=this.dialog.open(B,{data:{new:this.importPreview()?.Summary?.NewOutlet,update:this.importPreview()?.Summary?.UpdateOutlet,newOutletGroup:this.importPreview()?.Summary?.NewOutletGroup}}).afterClosed().pipe(K(e=>e==!0),J(()=>this.httpService.post(H.importOutlet,{CacheKey:this.importPreview()?.CacheKey})),z(e=>{this.importStepper.nextStep()}),Y(e=>(this.pickAll=[],this.filterTreeCondition=["Error"],q)),j(1))}selectAll(e){this.pickAll=e,this.pickAll.length==0?this.filterTreeCondition=[]:this.filterTreeCondition=["Unchanged","New","Error","Update"]}static \u0275fac=function(p){return new(p||t)(G(Ee),G(ge))};static \u0275cmp=I({type:t,selectors:[["app-outlet-import"]],viewQuery:function(p,i){if(p&1&&V(gt,5),p&2){let m;F(m=A())&&(i.importStepper=m.first)}},features:[Z],decls:17,vars:21,consts:[["importStepper",""],["op",""],[3,"pageData","hideSearchBox","hideSearchDropdown"],["ngProjectAs","actions",5,["actions"]],["type","button",1,"btn","btn-outline-secondary"],[1,"btn",3,"ngClass","disabled"],["ngProjectAs","content",5,["content"]],[3,"onDropFile","onStateChange","sampleUrl","disabledEdit","articleLink"],["ngProjectAs","preview",5,["preview"]],[1,"w-100",3,"value","scrollable","tableStyle"],["pTemplate","header"],["pTemplate","body"],["ngProjectAs","complete",5,["complete"]],[1,"d-flex","flex-column","align-items-center"],["type","button",1,"btn","btn-outline-secondary",3,"click"],[1,"btn",3,"click","ngClass","disabled"],[2,"width","300px"],[2,"width","200px"],[2,"width","100px"],[1,"fa","fa-filter","pointer",3,"click"],[2,"width","150px"],[1,"border-bottom","pb-3","d-flex","align-items-center","column-gap-3"],["label","Select All","name","filterTreeCondition","value","All","inputId","all",3,"ngModelChange","ngModel"],["for","all",1,"ms-2"],[1,"mt-4","d-flex","align-items-center","column-gap-3"],["label","Unchanged","name","filterTreeCondition","value","Unchanged","inputId","unchanged",3,"ngModelChange","ngModel"],["for","unchanged",1,"ms-2"],["label","New","name","filterTreeCondition","value","New","inputId","new",3,"ngModelChange","ngModel"],["for","new",1,"ms-2"],["label","Error","name","filterTreeCondition","value","Error","inputId","error",3,"ngModelChange","ngModel"],["for","error",1,"ms-2"],["label","Updated","name","filterTreeCondition","value","Update","inputId","update",3,"ngModelChange","ngModel"],["for","update",1,"ms-2"],[3,"ngClass"],[1,"me-1"],[1,"fa-solid","fa-circle-check","text-success",2,"font-size","110px"],[1,"mt-8"],[4,"ngIf"],[1,"d-flex","gap-2","fw-normal","fs-4","mt-2"]],template:function(p,i){if(p&1){let m=h();n(0,"mainpanel-cmp",2),y(1,3),C(2,xt,2,0,"button",4)(3,bt,4,10,"button",5)(4,wt,2,0,"button",4),T(),y(5,6),n(6,"pos-import-stepper",7,0),f("onDropFile",function(W){return u(m),_(i.onDropFile(W))})("onStateChange",function(W){return u(m),_(i.onStateChange(W))}),y(8,8),n(9,"p-table",9),g(10,"async"),g(11,"filterTree"),C(12,vt,33,5,"ng-template",10)(13,yt,10,9,"ng-template",11),o(),T(),y(14,12),C(15,Mt,6,3,"div",13),g(16,"async"),T(),o(),T(),o()}if(p&2){let m,v;s("pageData",i.menuData)("hideSearchBox",!0)("hideSearchDropdown",!0),a(2),b(i.currentState()==1?2:-1),a(),b(i.fileToImport()&&((m=i.fileToImport())==null?null:m.size)>0&&i.currentState()<2?3:-1),a(),b(i.currentState()===2?4:-1),a(2),s("sampleUrl",i.sampleUrl)("disabledEdit",i.currentState()===2)("articleLink",i.articleLink),a(3),s("value",ae(11,15,(v=S(10,13,i.importPreview$))==null?null:v.DataRow,i.filterTreeCondition))("scrollable",!0)("tableStyle",re(20,Ct)),a(6),b(S(16,18,i.confirmImport$)?15:-1)}},dependencies:[M,me,se,de,R,Ve,Ue,Ne,Ae,Ce,Oe,Pe,L,ue,_e,ke,De,Ge],encapsulation:2})};export{qe as OutletImportComponent};
@@ -1 +1 @@
1
- import{a as r}from"./chunk-P4CJOEI6.js";import{K as a}from"./chunk-UXRO4UFY.js";var s=class extends r{constructor(t,e,o,n){super(t);this.httpService=e;let p=this.getInfoID(n);this.menuData$.pipe(a(()=>this.getBindDataObservable(o,p))).subscribe({next:i=>{this.bindData(i),this.postBindData(i)}})}data;getInfoID(t){return t.snapshot.queryParams.ID}getBindDataObservable(t,e){return this.httpService.post(`/API/${t}`,{ID:e})}bindData(t){this.data=t}postBindData(t){}};export{s as a};
1
+ import{a as r}from"./chunk-S22XRS4J.js";import{K as a}from"./chunk-UXRO4UFY.js";var s=class extends r{constructor(t,e,o,n){super(t);this.httpService=e;let p=this.getInfoID(n);this.menuData$.pipe(a(()=>this.getBindDataObservable(o,p))).subscribe({next:i=>{this.bindData(i),this.postBindData(i)}})}data;getInfoID(t){return t.snapshot.queryParams.ID}getBindDataObservable(t,e){return this.httpService.post(`/API/${t}`,{ID:e})}bindData(t){this.data=t}postBindData(t){}};export{s as a};
@@ -1 +1 @@
1
- import{d as $,e as ee}from"./chunk-6647Y35T.js";import"./chunk-VHAM2DWK.js";import{a as z}from"./chunk-JPXXXD26.js";import{a as H,b as G,c as A}from"./chunk-VQBXUZ6U.js";import{a as oe,b as ne}from"./chunk-BBGWXLHJ.js";import{f as te}from"./chunk-2GLNGDED.js";import{c as ie}from"./chunk-VENGWIVD.js";import{b as Q}from"./chunk-QHBWVJIQ.js";import{a as q}from"./chunk-JYLR5O5Q.js";import"./chunk-NI5NXM2W.js";import"./chunk-6JAL37Y4.js";import"./chunk-4QQTEPQT.js";import{e as Y,f as Z}from"./chunk-OLSCBS7E.js";import"./chunk-LIBVAZGG.js";import"./chunk-5JJSLRVS.js";import"./chunk-B6LPY2IZ.js";import"./chunk-CWITQVZH.js";import"./chunk-QHRP323Q.js";import"./chunk-WDQ4UKKY.js";import"./chunk-MFCXEITE.js";import"./chunk-MUJ6277G.js";import"./chunk-LMJVRREP.js";import"./chunk-3LBZDIW2.js";import"./chunk-KTCV3KOE.js";import"./chunk-KZDE63UL.js";import"./chunk-JVMOM4H4.js";import{b as K}from"./chunk-P4CJOEI6.js";import"./chunk-3GOO5E5D.js";import"./chunk-XMYLHF4C.js";import"./chunk-H7F34T25.js";import"./chunk-JOXTERIM.js";import{N as X,g as U}from"./chunk-TSIYPTYI.js";import"./chunk-XYB3YDKL.js";import"./chunk-7VKFVS7K.js";import"./chunk-ZVDY66SR.js";import{g as J}from"./chunk-3YKVLHZG.js";import"./chunk-ZHY3BUQJ.js";import"./chunk-VFTGIP5A.js";import"./chunk-LE3BKIDY.js";import"./chunk-2FWFPV5I.js";import"./chunk-EEEAUYZ6.js";import{F as W,h as B,o as R}from"./chunk-RVXZOIFQ.js";import"./chunk-2JIKUIDL.js";import"./chunk-NO3WSZS5.js";import{d as k}from"./chunk-ZZGSAFGO.js";import"./chunk-TDQR33OS.js";import{$a as p,Ac as P,Bc as T,Eb as b,Fc as V,Gb as M,Hb as O,Ib as i,Jb as o,Kb as v,Ob as _,Qb as S,Rb as m,Yd as j,Zc as F,db as u,ec as l,fc as h,gc as w,jc as x,jd as N,kb as E,kc as C,lc as y,ob as I,qb as f,va as c,vb as d,wa as s,zc as D}from"./chunk-UXRO4UFY.js";import"./chunk-7DCB7DB2.js";function re(r,g){if(r&1){let e=_();i(0,"button",5),S("click",function(){c(e);let t=m();return s(t.openExportModal())}),v(1,"i",6),l(2," Export "),o()}}function le(r,g){if(r&1){let e=_();i(0,"h6"),l(1,"Outlet"),o(),i(2,"outlet-selector",7),y("ngModelChange",function(t){c(e);let a=m();return C(a.pageData.Filter.Outlet,t)||(a.pageData.Filter.Outlet=t),s(t)}),o(),i(3,"h6"),l(4,"Category"),o(),i(5,"POS-product-category-select",8),y("selectedCategoryIDChange",function(t){c(e);let a=m();return C(a.pageData.Filter.Category,t)||(a.pageData.Filter.Category=t),s(t)}),o(),i(6,"h6"),l(7,"Discontinued"),o(),i(8,"radio-options",9),y("modelChange",function(t){c(e);let a=m();return C(a.pageData.Filter.Discontinued,t)||(a.pageData.Filter.Discontinued=t),s(t)}),o()}if(r&2){let e=m();p(2),d("accessType",2),x("ngModel",e.pageData.Filter.Outlet),p(3),x("selectedCategoryID",e.pageData.Filter.Category),d("showClear",!0),p(3),d("options",e.pageData==null||e.pageData.Options==null?null:e.pageData.Options.Discontinued),x("model",e.pageData.Filter.Discontinued)}}function pe(r,g){if(r&1&&(i(0,"tr")(1,"td"),l(2),o(),i(3,"td"),l(4),o(),i(5,"td",20),l(6),D(7,"quantityFraction"),o()()),r&2){let e=g.$implicit;p(2),h(e.EntityName),p(2),h(e.Name),p(2),w(" ",P(7,3,e.Inventory)," ")}}function me(r,g){if(r&1){let e=_();i(0,"div",10)(1,"div",11)(2,"table",12),S("matSortChange",function(t){c(e);let a=m();return s(a.onSortData(t))}),i(3,"thead",13)(4,"tr",14)(5,"th",15),l(6,"Outlet"),o(),i(7,"th",16),l(8,"Storage Location"),o(),i(9,"th",17),l(10," On Hand "),o()()(),i(11,"tbody"),M(12,pe,8,5,"tr",null,b),o(),i(14,"tfoot")(15,"tr",18),v(16,"td",19),i(17,"td",19),l(18,"Total :"),o(),i(19,"td",20),l(20),D(21,"sum"),D(22,"quantityFraction"),o()()()(),i(23,"POS-complex-pagination",21),S("jumpToPage",function(){c(e);let t=m();return s(t.getListData())})("previousPage",function(){c(e);let t=m();return s(t.getListData())})("nextPage",function(){c(e);let t=m();return s(t.getListData())}),o()()()}if(r&2){let e=m();p(12),O(e.data.Data),p(8),w(" ",P(22,6,T(21,3,e.data.Data,"Inventory"))," "),p(3),d("total",e.data.Data==null?null:e.data.Data.length)("pageData",e.pageData)}}var ae=class r extends q{constructor(e,n,t,a){super(e,n,"Inventory/GetProductStorageLocation","InventoryLoader/InventoryReport");this.httpService=n;this.dialog=t;this.roleService=a}datasource;postInit(e){this.datasource=JSON.parse(JSON.stringify(e.Data))}openExportModal(){this.dialog.open(Q,{data:{title:"Storage Location",exportTypes:[{ID:"Inventory/GetProductStorageLocation",Value:"Default",FileName:"Storage Location"}],filterExport:this.pageData.Filter,getAllDataLengthAPI:"inventory/GetCountProductStorageLocation",pagination:!0}})}onSortData(e){let n=this.data.Data?.slice();if(!e.active||e.direction===""){this.data.Data=this.datasource;return}let t=e.direction==="asc";this.data.Data=n.sort((a,L)=>this.compare(a[e.active],L[e.active],t))}static \u0275fac=function(n){return new(n||r)(u(K),u(j),u(J),u(k))};static \u0275cmp=E({type:r,selectors:[["app-storage-location"]],features:[I],decls:9,vars:5,consts:[["pageFilterTemplate",""],[3,"onSubmit","pageData","hideSearchBox","isFilterOnDropdown"],[1,"d-flex"],["class","btn btn-outline-secondary me-3",3,"click",4,"ngIf"],["class","container-fluid mt-3",4,"ngIf"],[1,"btn","btn-outline-secondary","me-3",3,"click"],["aria-hidden","true",1,"fa-solid","fa-upload"],["placeholder","Choose an outlet","appendTo","body",3,"ngModelChange","accessType","ngModel"],[1,"tree-select-as-filter",3,"selectedCategoryIDChange","selectedCategoryID","showClear"],["name","Discontinued",3,"modelChange","options","model"],[1,"container-fluid","mt-3"],[1,"table-responsive"],["id","tableGrid","matSort","",1,"table",3,"matSortChange"],[1,"thead-light","sticky-top-thead"],[1,"header"],["mat-sort-header","EntityName",2,"width","450px"],["mat-sort-header","Brand"],["mat-sort-header","Inventory","arrowPosition","before",1,"text-end",2,"padding-right","100px","width","190px"],[1,"table-footer","fw-bold"],[1,"empty-column"],[1,"text-end",2,"padding-right","100px"],["api","inventory/GetCountProductStorageLocation",3,"jumpToPage","previousPage","nextPage","total","pageData"]],template:function(n,t){if(n&1){let a=_();i(0,"mainpanel-cmp",1),S("onSubmit",function(){return c(a),s(t.searchFromPageOne())}),i(1,"actions")(2,"div",2),f(3,re,3,0,"button",3),o()(),i(4,"filters"),f(5,le,9,6,"ng-template",null,0,V),o(),i(7,"content"),f(8,me,24,8,"div",4),o()()}n&2&&(d("pageData",t.menuData)("hideSearchBox",!0)("isFilterOnDropdown",!1),p(3),d("ngIf",t.roleService.global.Export),p(5),d("ngIf",t.data))},dependencies:[N,F,Z,Y,z,X,U,ee,$,te,ie,W,B,R,ne,oe,A,H,G],encapsulation:2})};export{ae as StorageLocationComponent};
1
+ import{d as $,e as ee}from"./chunk-6647Y35T.js";import"./chunk-VHAM2DWK.js";import{a as z}from"./chunk-JPXXXD26.js";import{a as H,b as G,c as A}from"./chunk-VQBXUZ6U.js";import{a as oe,b as ne}from"./chunk-BBGWXLHJ.js";import{f as te}from"./chunk-IOJ4YVHD.js";import{c as ie}from"./chunk-2PX7ZCAH.js";import{b as Q}from"./chunk-QHBWVJIQ.js";import{a as q}from"./chunk-XQ6JBIMX.js";import"./chunk-EVWNBQBC.js";import"./chunk-6JAL37Y4.js";import"./chunk-4QQTEPQT.js";import{e as Y,f as Z}from"./chunk-3PTKHKTZ.js";import"./chunk-IQQGAD2W.js";import"./chunk-5JJSLRVS.js";import"./chunk-B6LPY2IZ.js";import"./chunk-CWITQVZH.js";import"./chunk-QHRP323Q.js";import"./chunk-WDQ4UKKY.js";import"./chunk-MFCXEITE.js";import"./chunk-MUJ6277G.js";import"./chunk-LMJVRREP.js";import"./chunk-3LBZDIW2.js";import"./chunk-KTCV3KOE.js";import"./chunk-KZDE63UL.js";import"./chunk-ARKU4MG5.js";import{b as K}from"./chunk-S22XRS4J.js";import"./chunk-3GOO5E5D.js";import"./chunk-XMYLHF4C.js";import"./chunk-H7F34T25.js";import"./chunk-JOXTERIM.js";import{N as X,g as U}from"./chunk-TSIYPTYI.js";import"./chunk-XYB3YDKL.js";import"./chunk-7VKFVS7K.js";import"./chunk-ZVDY66SR.js";import{g as J}from"./chunk-3YKVLHZG.js";import"./chunk-ZHY3BUQJ.js";import"./chunk-VFTGIP5A.js";import"./chunk-LE3BKIDY.js";import"./chunk-2FWFPV5I.js";import"./chunk-EEEAUYZ6.js";import{F as W,h as B,o as R}from"./chunk-RVXZOIFQ.js";import"./chunk-2FWXO7SV.js";import"./chunk-6ABP4TP7.js";import{d as k}from"./chunk-ZZGSAFGO.js";import"./chunk-QVPSWY5E.js";import{$a as p,Ac as P,Bc as T,Eb as b,Fc as V,Gb as M,Hb as O,Ib as i,Jb as o,Kb as v,Ob as _,Qb as S,Rb as m,Yd as j,Zc as F,db as u,ec as l,fc as h,gc as w,jc as x,jd as N,kb as E,kc as C,lc as y,ob as I,qb as f,va as c,vb as d,wa as s,zc as D}from"./chunk-UXRO4UFY.js";import"./chunk-7DCB7DB2.js";function re(r,g){if(r&1){let e=_();i(0,"button",5),S("click",function(){c(e);let t=m();return s(t.openExportModal())}),v(1,"i",6),l(2," Export "),o()}}function le(r,g){if(r&1){let e=_();i(0,"h6"),l(1,"Outlet"),o(),i(2,"outlet-selector",7),y("ngModelChange",function(t){c(e);let a=m();return C(a.pageData.Filter.Outlet,t)||(a.pageData.Filter.Outlet=t),s(t)}),o(),i(3,"h6"),l(4,"Category"),o(),i(5,"POS-product-category-select",8),y("selectedCategoryIDChange",function(t){c(e);let a=m();return C(a.pageData.Filter.Category,t)||(a.pageData.Filter.Category=t),s(t)}),o(),i(6,"h6"),l(7,"Discontinued"),o(),i(8,"radio-options",9),y("modelChange",function(t){c(e);let a=m();return C(a.pageData.Filter.Discontinued,t)||(a.pageData.Filter.Discontinued=t),s(t)}),o()}if(r&2){let e=m();p(2),d("accessType",2),x("ngModel",e.pageData.Filter.Outlet),p(3),x("selectedCategoryID",e.pageData.Filter.Category),d("showClear",!0),p(3),d("options",e.pageData==null||e.pageData.Options==null?null:e.pageData.Options.Discontinued),x("model",e.pageData.Filter.Discontinued)}}function pe(r,g){if(r&1&&(i(0,"tr")(1,"td"),l(2),o(),i(3,"td"),l(4),o(),i(5,"td",20),l(6),D(7,"quantityFraction"),o()()),r&2){let e=g.$implicit;p(2),h(e.EntityName),p(2),h(e.Name),p(2),w(" ",P(7,3,e.Inventory)," ")}}function me(r,g){if(r&1){let e=_();i(0,"div",10)(1,"div",11)(2,"table",12),S("matSortChange",function(t){c(e);let a=m();return s(a.onSortData(t))}),i(3,"thead",13)(4,"tr",14)(5,"th",15),l(6,"Outlet"),o(),i(7,"th",16),l(8,"Storage Location"),o(),i(9,"th",17),l(10," On Hand "),o()()(),i(11,"tbody"),M(12,pe,8,5,"tr",null,b),o(),i(14,"tfoot")(15,"tr",18),v(16,"td",19),i(17,"td",19),l(18,"Total :"),o(),i(19,"td",20),l(20),D(21,"sum"),D(22,"quantityFraction"),o()()()(),i(23,"POS-complex-pagination",21),S("jumpToPage",function(){c(e);let t=m();return s(t.getListData())})("previousPage",function(){c(e);let t=m();return s(t.getListData())})("nextPage",function(){c(e);let t=m();return s(t.getListData())}),o()()()}if(r&2){let e=m();p(12),O(e.data.Data),p(8),w(" ",P(22,6,T(21,3,e.data.Data,"Inventory"))," "),p(3),d("total",e.data.Data==null?null:e.data.Data.length)("pageData",e.pageData)}}var ae=class r extends q{constructor(e,n,t,a){super(e,n,"Inventory/GetProductStorageLocation","InventoryLoader/InventoryReport");this.httpService=n;this.dialog=t;this.roleService=a}datasource;postInit(e){this.datasource=JSON.parse(JSON.stringify(e.Data))}openExportModal(){this.dialog.open(Q,{data:{title:"Storage Location",exportTypes:[{ID:"Inventory/GetProductStorageLocation",Value:"Default",FileName:"Storage Location"}],filterExport:this.pageData.Filter,getAllDataLengthAPI:"inventory/GetCountProductStorageLocation",pagination:!0}})}onSortData(e){let n=this.data.Data?.slice();if(!e.active||e.direction===""){this.data.Data=this.datasource;return}let t=e.direction==="asc";this.data.Data=n.sort((a,L)=>this.compare(a[e.active],L[e.active],t))}static \u0275fac=function(n){return new(n||r)(u(K),u(j),u(J),u(k))};static \u0275cmp=E({type:r,selectors:[["app-storage-location"]],features:[I],decls:9,vars:5,consts:[["pageFilterTemplate",""],[3,"onSubmit","pageData","hideSearchBox","isFilterOnDropdown"],[1,"d-flex"],["class","btn btn-outline-secondary me-3",3,"click",4,"ngIf"],["class","container-fluid mt-3",4,"ngIf"],[1,"btn","btn-outline-secondary","me-3",3,"click"],["aria-hidden","true",1,"fa-solid","fa-upload"],["placeholder","Choose an outlet","appendTo","body",3,"ngModelChange","accessType","ngModel"],[1,"tree-select-as-filter",3,"selectedCategoryIDChange","selectedCategoryID","showClear"],["name","Discontinued",3,"modelChange","options","model"],[1,"container-fluid","mt-3"],[1,"table-responsive"],["id","tableGrid","matSort","",1,"table",3,"matSortChange"],[1,"thead-light","sticky-top-thead"],[1,"header"],["mat-sort-header","EntityName",2,"width","450px"],["mat-sort-header","Brand"],["mat-sort-header","Inventory","arrowPosition","before",1,"text-end",2,"padding-right","100px","width","190px"],[1,"table-footer","fw-bold"],[1,"empty-column"],[1,"text-end",2,"padding-right","100px"],["api","inventory/GetCountProductStorageLocation",3,"jumpToPage","previousPage","nextPage","total","pageData"]],template:function(n,t){if(n&1){let a=_();i(0,"mainpanel-cmp",1),S("onSubmit",function(){return c(a),s(t.searchFromPageOne())}),i(1,"actions")(2,"div",2),f(3,re,3,0,"button",3),o()(),i(4,"filters"),f(5,le,9,6,"ng-template",null,0,V),o(),i(7,"content"),f(8,me,24,8,"div",4),o()()}n&2&&(d("pageData",t.menuData)("hideSearchBox",!0)("isFilterOnDropdown",!1),p(3),d("ngIf",t.roleService.global.Export),p(5),d("ngIf",t.data))},dependencies:[N,F,Z,Y,z,X,U,ee,$,te,ie,W,B,R,ne,oe,A,H,G],encapsulation:2})};export{ae as StorageLocationComponent};
@@ -0,0 +1 @@
1
+ import{b as ae,c as ce}from"./chunk-FKDZ5OWB.js";import{g as me}from"./chunk-4UYZJCFI.js";import{d as le,e as re}from"./chunk-ARKU4MG5.js";import{A as oe,G as se}from"./chunk-H7F34T25.js";import{b as ie,c as ne}from"./chunk-JOXTERIM.js";import{F as Z,G as ee,h as X,o as Y}from"./chunk-RVXZOIFQ.js";import{$a as p,$b as $,Fa as c,Fc as z,I as F,Ib as m,Jb as u,Ka as T,Ma as M,Ob as b,Qb as v,Rb as V,Vd as J,Yd as te,Zb as H,_b as P,c as E,cb as L,db as I,e as k,ec as S,fa as N,fc as x,gc as Q,ja as O,jc as q,jd as G,kb as D,kc as W,lc as K,mb as j,na as g,o as A,qb as R,qc as C,rc as B,ua as f,va as r,vb as w,wa as a,yb as U}from"./chunk-UXRO4UFY.js";var _=class o{selectionsSubject=new k(new Map);getSelectedItems(t){return this.selectionsSubject.value.get(t)||[]}setSelectedItems(t,e){let i=new Map(this.selectionsSubject.value);i.set(t,[...e]),this.selectionsSubject.next(i)}clearSelectedItems(t){let e=new Map(this.selectionsSubject.value);e.delete(t),this.selectionsSubject.next(e)}getSelectedItems$(t){return new E(e=>{let i=this.selectionsSubject.subscribe(n=>{e.next(n.get(t)||[])});return()=>i.unsubscribe()})}getAllSelections(){return this.selectionsSubject.value}clearAllSelections(){this.selectionsSubject.next(new Map)}static \u0275fac=function(e){return new(e||o)};static \u0275prov=O({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ce=["autocomplete"],ue=()=>({width:"100%"}),_e=()=>({width:"100%",maxWidth:"400px"}),ye=o=>({style:o});function Me(o,t){if(o&1){let e=b();m(0,"div",5),v("click",function(n){let s=r(e).$implicit,l=V();return a(l.toggleCheckbox(s,n))}),m(1,"p-checkbox",6),K("ngModelChange",function(n){let s=r(e).$implicit;return W(s._checked,n)||(s._checked=n),a(n)}),v("onChange",function(){let n=r(e).$implicit,s=V();return a(s.onCheckboxChange(n))})("click",function(n){return r(e),a(n.stopPropagation())}),u(),m(2,"div",7)(3,"div",8),S(4),u(),m(5,"div",9),S(6),u()()()}if(o&2){let e,i=t.$implicit;p(),q("ngModel",i._checked),w("binary",!0),p(3),x((e=i.Value)!==null&&e!==void 0?e:i.Name),p(2),Q(" ",i.Code," ")}}var de=class o{autocomplete;matTooltip;modelName;isMultiple=!0;placeholder="Search";isShowEmptyMessage=!1;emptyMessage="No results found";tooltipMessage="";valueField="Key";label;listDataEndpoint;maxSelectedItems=0;modelNameChange=new c;onSelectItem=new c;onRemoveItem=new c;completeMethod=new c;onSelect=new c;onUnselect=new c;httpService=g(te);toastr=g(J);autocompleteV3Service=g(_);selectedItems=M([]);suggestionList;internalSuggestionList=M([]);ngOnInit(){if(this.isMultiple&&this.modelName&&Array.isArray(this.modelName)&&this.modelName.length>0){if(this.suggestionList&&this.suggestionList.length>0){let e=this.modelName.map(i=>this.suggestionList.find(n=>n[this.valueField]===i)).filter(i=>i!==void 0);if(e.length>0){this.selectedItems.set(e),this.autocompleteV3Service.setSelectedItems(this.listDataEndpoint,e);return}}let t=this.autocompleteV3Service.getSelectedItems(this.listDataEndpoint);if(t&&t.length>0){let e=t.filter(i=>this.modelName.includes(i[this.valueField]));if(e.length>0){this.selectedItems.set(e);return}}}}ngOnChanges(t){let e=t.modelName;e&&e.currentValue.length===0&&this.resetSelection()}resetSelection(){this.selectedItems.set([])}onModelChange(t){if(this.isMultiple&&Array.isArray(t)){this.selectedItems.set(t),this.autocompleteV3Service.setSelectedItems(this.listDataEndpoint,t);let e=t.map(i=>i[this.valueField]);this.modelNameChange.emit(e)}else this.isMultiple||this.modelNameChange.emit(t)}onCompleteHandler(t){let e=t.query;if(this.suggestionList&&this.suggestionList.length>0){let s=this.selectedItems(),l=this.suggestionList.filter(d=>{let h=e.toLowerCase(),y=(d.Name||"").toLowerCase(),ge=(d.Key||"").toLowerCase(),fe=y.includes(h)||ge.includes(h),ve=!s.some(Se=>Se[this.valueField]===d[this.valueField]);return fe&&ve});this.internalSuggestionList.set(l);return}let i=new URLSearchParams({Prefix:e,Count:"100"}).toString(),n=this.listDataEndpoint;n&&this.httpService.get(`${n}?${i}`).pipe(F(()=>A([])),N(s=>{let l=this.selectedItems(),d=s.filter(h=>!l.some(y=>y[this.valueField]===h[this.valueField]));this.internalSuggestionList.set(d)})).subscribe()}onSelectHandler(t){let e=this.isMultiple,i=this.maxSelectedItems;if(e&&i>0){let n=this.selectedItems();if(n.length>=i){this.toastr.warning(`Maximum ${i} items can be selected`,"Selection Limit"),setTimeout(()=>{this.modelNameChange.emit([...n])},0);return}}this.onSelectItem.emit(t),this.onSelect.emit(t)}onRemoveHandler(t){this.onRemoveItem.emit(t.value),this.onUnselect.emit(t.value),t.value&&(t.value._checked=!1)}isChecked(t){let e=this.selectedItems(),i=this.valueField;return e.some(n=>n[i]===t[i])}clearSelections(){this.selectedItems.set([]),this.autocompleteV3Service.clearSelectedItems(this.listDataEndpoint),this.modelNameChange.emit([])}getCurrentSelectionsFromService(){return this.autocompleteV3Service.getSelectedItems(this.listDataEndpoint)}onCheckboxChange(t){if(t._checked)this.isChecked(t)||(this.selectedItems.set([...this.selectedItems(),t]),this.onModelChange(this.selectedItems()));else{let e=this.selectedItems().filter(i=>i[this.valueField]!==t[this.valueField]);this.selectedItems.set(e),this.onModelChange(e)}setTimeout(()=>{this.autocomplete&&this.autocomplete.inputEL.nativeElement.focus()},0)}toggleCheckbox(t,e){t._checked=!t._checked,this.onCheckboxChange(t),e.stopPropagation()}ngOnDestroy(){}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=D({type:o,selectors:[["autocompleteV3"]],viewQuery:function(e,i){if(e&1&&H(Ce,5),e&2){let n;P(n=$())&&(i.autocomplete=n.first)}},inputs:{matTooltip:"matTooltip",modelName:"modelName",isMultiple:"isMultiple",placeholder:"placeholder",isShowEmptyMessage:"isShowEmptyMessage",emptyMessage:"emptyMessage",tooltipMessage:"tooltipMessage",valueField:"valueField",label:"label",listDataEndpoint:"listDataEndpoint",maxSelectedItems:"maxSelectedItems"},outputs:{modelNameChange:"modelNameChange",onSelectItem:"onSelectItem",onRemoveItem:"onRemoveItem",completeMethod:"completeMethod",onSelect:"onSelect",onUnselect:"onUnselect"},features:[f],decls:8,vars:17,consts:[["autocomplete",""],["item",""],[1,"d-flex","flex-column","gap-2",2,"margin-top","1rem"],[1,"w-100",2,"width","100%"],["optionLabel","Value",1,"w-100",3,"ngModelChange","completeMethod","onSelect","onUnselect","matTooltip","ngModel","suggestions","multiple","placeholder","showEmptyMessage","emptyMessage","inputStyle","overlayOptions"],[1,"d-flex","align-items-center","gap-2","p-6","w-100",3,"click"],[2,"margin","0",3,"ngModelChange","onChange","click","ngModel","binary"],[1,"ms-2"],[1,"font-medium"],[1,"text-muted",2,"font-size","10px !important"]],template:function(e,i){if(e&1){let n=b();m(0,"div",2)(1,"h6"),S(2),u(),m(3,"div",3)(4,"p-autocomplete",4,0),v("ngModelChange",function(l){return r(n),a(i.onModelChange(l))})("completeMethod",function(l){return r(n),a(i.onCompleteHandler(l))})("onSelect",function(l){return r(n),a(i.onSelectHandler(l))})("onUnselect",function(l){return r(n),a(i.onRemoveHandler(l))}),R(6,Me,7,4,"ng-template",null,1,z),u()()()}e&2&&(p(2),x(i.label),p(2),U(C(12,ue)),w("matTooltip",i.tooltipMessage)("ngModel",i.selectedItems())("suggestions",i.internalSuggestionList())("multiple",i.isMultiple)("placeholder",i.placeholder)("showEmptyMessage",i.isShowEmptyMessage)("emptyMessage",i.emptyMessage)("inputStyle",C(13,ue))("overlayOptions",B(15,ye,C(14,_e))))},dependencies:[oe,G,ee,X,Z,Y,ne,ie,se,me,ce,ae,re,le],encapsulation:2})};var he=class o{constructor(t,e){this.el=t;this.renderer=e}value=null;ngOnChanges(){if(this.value===null||this.value===void 0)return;this.renderer.removeClass(this.el.nativeElement,"text-black"),this.renderer.removeClass(this.el.nativeElement,"text-success"),this.renderer.removeClass(this.el.nativeElement,"text-danger");let t=this.value===0?"text-black":this.value>=1?"text-success":"text-danger";this.renderer.addClass(this.el.nativeElement,t)}static \u0275fac=function(e){return new(e||o)(I(T),I(L))};static \u0275dir=j({type:o,selectors:[["","colsFontColor",""]],inputs:{value:[0,"colsFontColor","value"]},features:[f]})};export{de as a,he as b};