dealpos 26.34.1 → 26.34.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/browser/{chunk-PZOHVKU4.js → chunk-2E2VQCBF.js} +1 -1
  2. package/browser/{chunk-UXIALNLU.js → chunk-2RAS3CZ2.js} +1 -1
  3. package/browser/{chunk-Z7MLSOCL.js → chunk-2RDKGLNP.js} +1 -1
  4. package/browser/{chunk-65NYFPWS.js → chunk-2XPLFAHQ.js} +1 -1
  5. package/browser/{chunk-FHA5YCWG.js → chunk-35ZAPTUN.js} +1 -1
  6. package/browser/{chunk-5UJ5AQ7O.js → chunk-36USSIER.js} +1 -1
  7. package/browser/{chunk-U6M7UILX.js → chunk-3F35YXFV.js} +1 -1
  8. package/browser/{chunk-52WRQUF5.js → chunk-3X5FHDRP.js} +1 -1
  9. package/browser/{chunk-K2F5WUCF.js → chunk-4GJRPPUI.js} +1 -1
  10. package/browser/{chunk-ANJ3XBOG.js → chunk-4MO3EVQO.js} +1 -1
  11. package/browser/{chunk-D3WKGXK7.js → chunk-5DIWU3MD.js} +1 -1
  12. package/browser/{chunk-RB5RBWX4.js → chunk-5M67D5BT.js} +1 -1
  13. package/browser/{chunk-4ZKKZ4FU.js → chunk-5M7JO2N3.js} +1 -1
  14. package/browser/{chunk-NRAW3ITG.js → chunk-5PA2WWSJ.js} +1 -1
  15. package/browser/{chunk-LAX3ANRT.js → chunk-6KGY7NOT.js} +1 -1
  16. package/browser/{chunk-7HYAL6DQ.js → chunk-6PCVFBB3.js} +1 -1
  17. package/browser/{chunk-CPINGCPC.js → chunk-723PV2ST.js} +1 -1
  18. package/browser/{chunk-DLWI6JEQ.js → chunk-77WJ3EU6.js} +1 -1
  19. package/browser/{chunk-I4RA5EOB.js → chunk-7D2KW3WC.js} +2 -2
  20. package/browser/chunk-A3ILIZ67.js +1 -0
  21. package/browser/{chunk-FHG32NTA.js → chunk-A6P2MJGH.js} +1 -1
  22. package/browser/{chunk-T22D3RM2.js → chunk-ADDCEDEC.js} +1 -1
  23. package/browser/{chunk-ZIEQ254Q.js → chunk-AGSTKSL5.js} +1 -1
  24. package/browser/{chunk-MFYD7DGY.js → chunk-AICMCLVR.js} +1 -1
  25. package/browser/{chunk-PPCDF7HN.js → chunk-ANLD6YR7.js} +1 -1
  26. package/browser/{chunk-L3B3UP7R.js → chunk-ASS34GSF.js} +1 -1
  27. package/browser/{chunk-RHLDVMNJ.js → chunk-AT3Y46MO.js} +1 -1
  28. package/browser/{chunk-SE7JVQAA.js → chunk-BGF4AJ6E.js} +1 -1
  29. package/browser/{chunk-3VBNSOP2.js → chunk-C5TZZG4J.js} +1 -1
  30. package/browser/{chunk-TJMKB7XP.js → chunk-C6DSKX47.js} +1 -1
  31. package/browser/{chunk-OTINYOAY.js → chunk-C6RYNK5S.js} +1 -1
  32. package/browser/{chunk-GZBEW62B.js → chunk-CUILFAIN.js} +2 -2
  33. package/browser/{chunk-JKZ23K5C.js → chunk-DGH43OUN.js} +2 -2
  34. package/browser/{chunk-P2AFWZKX.js → chunk-DK3WGVWD.js} +1 -1
  35. package/browser/{chunk-FMMXJB7Y.js → chunk-DKDMJXKT.js} +1 -1
  36. package/browser/{chunk-BSKB3J2G.js → chunk-DLYZMRXG.js} +1 -1
  37. package/browser/{chunk-XYYDJP7Q.js → chunk-DOVA5WJL.js} +1 -1
  38. package/browser/{chunk-M3GRHJV5.js → chunk-DX6QR2ND.js} +1 -1
  39. package/browser/{chunk-4DJDNAUR.js → chunk-EB5UNIEQ.js} +1 -1
  40. package/browser/{chunk-OVNQ2SE7.js → chunk-ENX6LJBQ.js} +1 -1
  41. package/browser/{chunk-ZZ5VQX3U.js → chunk-ER72CLR7.js} +1 -1
  42. package/browser/{chunk-24UPLEDJ.js → chunk-EWOYNORP.js} +2 -2
  43. package/browser/{chunk-RAV2XYMA.js → chunk-F3OSPCFX.js} +1 -1
  44. package/browser/{chunk-2NC2HNXU.js → chunk-GAL4NJUJ.js} +1 -1
  45. package/browser/{chunk-45GBJRP2.js → chunk-GB4DQYVD.js} +2 -2
  46. package/browser/{chunk-VHZFABJG.js → chunk-GXBV4RIH.js} +1 -1
  47. package/browser/{chunk-BYP626MT.js → chunk-HNCIIWMT.js} +1 -1
  48. package/browser/{chunk-WJF2TUCB.js → chunk-HYH3E5JS.js} +1 -1
  49. package/browser/{chunk-GB6RM6BR.js → chunk-HZ7TPWZJ.js} +1 -1
  50. package/browser/{chunk-XJ64LFGG.js → chunk-I72724Z6.js} +1 -1
  51. package/browser/{chunk-JBBRTVT2.js → chunk-IADK6LEP.js} +1 -1
  52. package/browser/{chunk-Q3YYUVTI.js → chunk-IMBSC7BN.js} +1 -1
  53. package/browser/{chunk-VQDP5RWL.js → chunk-IPZIM5FO.js} +1 -1
  54. package/browser/{chunk-7R2VZXFY.js → chunk-ITQMAEKJ.js} +1 -1
  55. package/browser/{chunk-NFPDQLH4.js → chunk-IYC5AO5A.js} +1 -1
  56. package/browser/{chunk-OD2CP4AW.js → chunk-IZ6Q3533.js} +1 -1
  57. package/browser/{chunk-VN3EWMAS.js → chunk-KG7DYUGI.js} +1 -1
  58. package/browser/{chunk-ZUROZQ72.js → chunk-KJQUPLA2.js} +1 -1
  59. package/browser/{chunk-23HUCHT3.js → chunk-KYX7WVDC.js} +1 -1
  60. package/browser/{chunk-JMYDOBSL.js → chunk-LCNN4QQX.js} +1 -1
  61. package/browser/{chunk-VTZIOGOR.js → chunk-LU5PSJWR.js} +1 -1
  62. package/browser/{chunk-7SNDIQFQ.js → chunk-LUEGEKT6.js} +2 -2
  63. package/browser/{chunk-I42VGDGI.js → chunk-M245PEBU.js} +1 -1
  64. package/browser/{chunk-H2QB2276.js → chunk-MG275HJD.js} +1 -1
  65. package/browser/{chunk-QTIBG46G.js → chunk-MNPH5MJY.js} +1 -1
  66. package/browser/{chunk-O2RTFZQ5.js → chunk-MPMWNXLU.js} +1 -1
  67. package/browser/{chunk-QIIQ7BNX.js → chunk-NAQFCPQR.js} +1 -1
  68. package/browser/{chunk-OVQMYSAJ.js → chunk-NLHHAE32.js} +1 -1
  69. package/browser/{chunk-RVXN6EXH.js → chunk-NR6SJE4L.js} +1 -1
  70. package/browser/{chunk-S327F6QI.js → chunk-NXENBZHM.js} +1 -1
  71. package/browser/{chunk-ULDWY33X.js → chunk-NXRQO3CT.js} +1 -1
  72. package/browser/{chunk-YJ3NVOLL.js → chunk-NXYK54IQ.js} +1 -1
  73. package/browser/{chunk-DPQUO52Z.js → chunk-OB6OKZWC.js} +1 -1
  74. package/browser/{chunk-ZPUFEIC3.js → chunk-OTD2DXCE.js} +1 -1
  75. package/browser/{chunk-B3D7LMIW.js → chunk-OXIRTSQO.js} +1 -1
  76. package/browser/{chunk-WYFVKWEF.js → chunk-PLFURF4R.js} +1 -1
  77. package/browser/{chunk-JXZJFHH5.js → chunk-POC2HZPX.js} +1 -1
  78. package/browser/{chunk-CTUR265L.js → chunk-PUNUN27W.js} +1 -1
  79. package/browser/{chunk-WZGLWJII.js → chunk-Q6PQK26R.js} +1 -1
  80. package/browser/{chunk-WBIB2DPP.js → chunk-S4DMLBLY.js} +1 -1
  81. package/browser/{chunk-KQWXF4TC.js → chunk-SG3RAVWM.js} +1 -1
  82. package/browser/{chunk-RFA6GY2L.js → chunk-SGZ6OSWM.js} +1 -1
  83. package/browser/{chunk-NQ6AEJ5K.js → chunk-SHERPUSH.js} +1 -1
  84. package/browser/{chunk-ZFZXHYJ3.js → chunk-STOB3FU7.js} +1 -1
  85. package/browser/{chunk-KVXI5AP6.js → chunk-SYV2U7VI.js} +1 -1
  86. package/browser/{chunk-FPQO5GSM.js → chunk-TDDEFUGT.js} +1 -1
  87. package/browser/{chunk-AMY4VXBK.js → chunk-TL7UAVHY.js} +1 -1
  88. package/browser/{chunk-7WSH7BGB.js → chunk-U2XFJFVG.js} +1 -1
  89. package/browser/{chunk-D7RUXXSX.js → chunk-UUQ5KEQQ.js} +1 -1
  90. package/browser/{chunk-GJQXIY7H.js → chunk-UWH3566X.js} +1 -1
  91. package/browser/{chunk-WIXJ4PA7.js → chunk-VGGG47N6.js} +1 -1
  92. package/browser/{chunk-F6KF56YS.js → chunk-VPA47OR5.js} +1 -1
  93. package/browser/{chunk-LVTTKNKW.js → chunk-VUQTKGJR.js} +1 -1
  94. package/browser/{chunk-PXJ5VXEW.js → chunk-WGVMZQ4R.js} +1 -1
  95. package/browser/{chunk-M53XSHPM.js → chunk-WN2LILZQ.js} +1 -1
  96. package/browser/{chunk-SS4ITGIM.js → chunk-WVD6C7B3.js} +2 -2
  97. package/browser/{chunk-EXLYH32H.js → chunk-X3U6RZ5U.js} +1 -1
  98. package/browser/{chunk-SQZ3YRAS.js → chunk-XF3YBAGN.js} +1 -1
  99. package/browser/{chunk-2YXT4J3Y.js → chunk-XFXDMUNJ.js} +1 -1
  100. package/browser/{chunk-NPXWTAYO.js → chunk-XI67HFFK.js} +1 -1
  101. package/browser/{chunk-JKKLPKQZ.js → chunk-XL2ZP2VN.js} +1 -1
  102. package/browser/{chunk-65U2NBGA.js → chunk-XQ26A56B.js} +1 -1
  103. package/browser/{chunk-ZENWXNLS.js → chunk-XSPSBRRE.js} +1 -1
  104. package/browser/{chunk-Z7JC4IPH.js → chunk-YO4NGXGF.js} +1 -1
  105. package/browser/{chunk-IGFH2B5H.js → chunk-YZIXNBFG.js} +1 -1
  106. package/browser/{chunk-MTVI7VTK.js → chunk-ZDBFO3IO.js} +1 -1
  107. package/browser/{chunk-45XQ3BDF.js → chunk-ZFF7BCSR.js} +1 -1
  108. package/browser/{chunk-GETSJ4NJ.js → chunk-ZQDRMI4B.js} +1 -1
  109. package/browser/{chunk-H2WQQHX5.js → chunk-ZYFB3JGV.js} +1 -1
  110. package/browser/index.html +2 -2
  111. package/browser/{main-425A5YUA.js → main-SSNEYLNO.js} +1 -1
  112. package/package.json +1 -1
  113. package/browser/chunk-ZUCDOZY2.js +0 -1
@@ -1 +1 @@
1
- import{a as Vn}from"./chunk-VOJLWM2C.js";import{a as pt}from"./chunk-5PHA4WZQ.js";import{a as wn,e as kn,f as Nn}from"./chunk-DK6ONJHH.js";import{a as On}from"./chunk-IO3KXPQJ.js";import{a as An}from"./chunk-WGF2DWRU.js";import{a as En}from"./chunk-ZD6GJKYE.js";import"./chunk-IVB7IRPI.js";import{a as un}from"./chunk-56EEOGR3.js";import{a as Tn}from"./chunk-HBAQBI6Z.js";import"./chunk-WIK4TZNX.js";import{b as In,c as ct}from"./chunk-ZUROZQ72.js";import{a as Pn}from"./chunk-CWCFOXYW.js";import{b as bn}from"./chunk-RJ2JHVQR.js";import{a as Dn,b as Mn}from"./chunk-ZUCDOZY2.js";import{a as vn,b as yn,c as hn,d as Le,e as xn}from"./chunk-N5C5ZHMO.js";import"./chunk-NQX7EX5A.js";import{b as st,c as mt,d as dt}from"./chunk-OD2CP4AW.js";import{b as _n}from"./chunk-44KERJRQ.js";import{a as lt}from"./chunk-WEFCC4HB.js";import{a as Sn}from"./chunk-QYVLBMOX.js";import"./chunk-L6LVX24R.js";import{a as at,b as Cn}from"./chunk-S77FVPQM.js";import"./chunk-BN7VHFSY.js";import{c as gn}from"./chunk-I3WUTJXX.js";import"./chunk-3VBNSOP2.js";import"./chunk-DDLXGCOB.js";import{a as fn}from"./chunk-D6BLXBMN.js";import"./chunk-CXFPGQEQ.js";import"./chunk-X6YLB6XJ.js";import"./chunk-5UX75GPD.js";import"./chunk-YGCGJLGT.js";import"./chunk-EPA44ZP7.js";import"./chunk-OQGBLRIB.js";import"./chunk-NLPCJ6S7.js";import"./chunk-L2JJOSI2.js";import"./chunk-UJW36IT2.js";import"./chunk-K4GA7MPU.js";import"./chunk-U7MSEY2J.js";import{h as pn}from"./chunk-DLWI6JEQ.js";import{a as ve}from"./chunk-B4JLXIEC.js";import{a as nn,d as on,f as rn,h as an}from"./chunk-RZ4WHN74.js";import"./chunk-5QQBII3Q.js";import{a as ln}from"./chunk-6HAO7FHW.js";import"./chunk-JKKLPKQZ.js";import{a as cn}from"./chunk-5UJ5AQ7O.js";import"./chunk-XS4YRZDR.js";import"./chunk-VKEUSILH.js";import"./chunk-ZZ5VQX3U.js";import{k as tn,o as sn,q as mn,r as dn}from"./chunk-NRO23IIB.js";import"./chunk-FPTMOFHU.js";import"./chunk-PZ32564R.js";import{a as ot,b as rt}from"./chunk-NBVEREBF.js";import"./chunk-PPMQE2JW.js";import"./chunk-SE73OGQM.js";import"./chunk-SE7JVQAA.js";import{d as Be}from"./chunk-UGZHR6TH.js";import"./chunk-BSKB3J2G.js";import{a as Fe,b as Re,c as oe}from"./chunk-IUUNN5TF.js";import"./chunk-E6HRLULV.js";import"./chunk-Z3W63F6G.js";import"./chunk-5QKCGJTV.js";import"./chunk-QHSP67RW.js";import{a as N,b as R}from"./chunk-BMSUBRBS.js";import{a as L}from"./chunk-C7OXYN2X.js";import{a as De,b as Ae,c as Ve}from"./chunk-JATJNKS5.js";import"./chunk-5FOSDRT2.js";import"./chunk-2QP5NONI.js";import"./chunk-KTHJFSOM.js";import"./chunk-MTUBHLOV.js";import{F as ie,G as Ne,a as it,c as te,h as J,m as we,p as ne,s as Zt,t as ke}from"./chunk-LFSG3DBR.js";import"./chunk-MTVI7VTK.js";import{a as en}from"./chunk-NRAW3ITG.js";import"./chunk-G2RIVW3B.js";import{b as _e}from"./chunk-LNPJ2D7B.js";import{a as g}from"./chunk-PPTZHIIZ.js";import"./chunk-NQ6AEJ5K.js";import{n as nt,q as G}from"./chunk-X6Z7MJUZ.js";import{$ as Y,$a as X,Ab as pe,B as Vt,Ba as S,Bb as ue,Cb as ge,D as T,Db as u,Eb as r,Fb as a,Fc as v,Gb as I,Gc as h,H as Ft,Hb as Z,Hc as wt,Ib as ce,Jb as Ht,Kb as Ce,L as Rt,Lb as fe,Na as Je,Nd as Xt,Oc as q,P as Bt,Pa as Ke,Pb as V,Pd as Ee,Qd as et,R as Ut,Sa as Ye,Sb as p,Sc as B,Sd as tt,Tb as Pe,Tc as be,Ua as c,Ub as m,Uc as Yt,V as jt,X as Me,ac as zt,bb as Wt,bc as Gt,cc as Xe,d as Nt,da as w,db as P,dc as Jt,hc as s,i as At,ib as $t,ic as F,id as ee,ja as k,jb as qt,jc as x,kc as Ie,l as Ot,mc as U,na as d,nc as j,oc as Q,od as Oe,r as de,ra as b,sa as _,sc as Et,sd as z,vd as A,wb as C,wc as Te,xa as Qt,xc as Ze,ya as Lt,yb as f,yc as $,zc as Kt}from"./chunk-VKQVNDWA.js";import{a as O,b as le}from"./chunk-NF7PG5F2.js";var ut=class{AppConfigJSON;Currencies;SalesOrderTags;Entities;Payments;Taxes;SalesPOTypes;EstimateOptions;Data};var Ue=class{CurrencyID;CustomerID;Date;Discount;DiscountAmount;EntityID;ID;Note;Number;SalesID;TaxTypeID;TypeID;constructor(){this.CustomerID=g.GuidEmpty,this.EntityID=g.GuidEmpty,this.ID=g.GuidEmpty,this.TaxTypeID=g.GuidEmpty,this.Discount=0,this.DiscountAmount=0,this.Date=new Date().toDateString(),this.Note=""}};var re=class{Email;Key;Mobile;Name;Phone;Value;PricebookID;StateID};var gt=class{ID;Index;Symbol;Name;ExchangeRate;ConversionSuggestion;ExchangeRateDate;ExchangeRateDateDisplay};var Ct=class{ID;Name;DueDays;BlockDays;Description;PrintTemplateID;AccountID};var ft=class{DeliveryID;InvoiceID;InvoiceNumber;Message;OrderID;PaymentStateID;PaymentStateLabel;PrintMode;Success};var D=class o{estimateState=An({loadForm:new ut,outlet:{Name:"",ID:g.GuidEmpty},order:new Ue,cartItems:[],customer:new re,tax:new Cn,currency:new gt,tag:new Ct,discount:{discountAmount:0,discount:0},state:0,complete:new ft});loadForm=this.estimateState.select(e=>Object.freeze(e.loadForm()));order=this.estimateState.select(e=>Object.freeze(e.order()));outlet=this.estimateState.select(e=>Object.freeze(e.outlet()));cartItems=this.estimateState.select(e=>Object.freeze(e.cartItems()));customer=this.estimateState.select(e=>Object.freeze(e.customer()));tax=this.estimateState.select(e=>Object.freeze(e.tax()));currency=this.estimateState.select(e=>Object.freeze(e.currency()));tag=this.estimateState.select(e=>Object.freeze(e.tag()));discount=this.estimateState.select(e=>Object.freeze(e.discount()));state=this.estimateState.select(e=>Object.freeze(e.state()));complete=this.estimateState.select(e=>Object.freeze(e.complete()));updateLoadForm(e){this.estimateState.update("loadForm",e)}updateOutlet(e){this.estimateState.update("outlet",e)}updateOrder(e){this.estimateState.update("order",e)}updateCartItems(e){this.estimateState.update("cartItems",e)}updateCustomer(e){this.estimateState.update("customer",e)}updateTax(e){this.estimateState.update("tax",e)}updateCurrency(e){this.estimateState.update("currency",e)}updateTag(e){this.estimateState.update("tag",e)}updateDiscount(e){this.estimateState.update("discount",e)}updateState(e){this.estimateState.update("state",e)}updateComplete(e){this.estimateState.update("complete",e)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var ae=class{ID;Name;Code;Cost;ThumbnailUrl;CouponDiscount;Discount;DiscountAmount;EntityID;Expense;InventoryTypeID;LoyaltyPoint;Note;PromotionGift;Quantity;UnitQuantity;SalesID;VariantID;VariantUnitQuantity;isMaxInventory;UOM;UOMName;UnitCost;UnitPrice;TypeID;Storage;Taxable;Price;Serial;PriceBookID;Variant;PriceTypeID;PriceNote;UnitPriceMinimum;get Total(){return this.Price*(this.Quantity*this.UnitQuantity)*((100-this.Discount)/100)}get getItemAfterDiscount(){let e=this.getDiscPercentagePerItem();return this.DiscountAmount<e?e-this.DiscountAmount:0}getDiscPercentagePerItem(){let e=this.UnitPrice;return this.Discount>0&&(e=(100-this.Discount)/100*this.UnitPrice),e}};var ye=class o{constructor(){}generateCartItem(e){let t=new ae;return t.Name=e.Name,t.ThumbnailUrl=e.ThumbnailUrl,t.Price=e.UnitPrice,t.UnitPrice=e.UnitPrice,t.UnitCost=e.UnitCost,t.UnitQuantity=e.UnitQuantity,t.Quantity=1,t.Code=e.Code,t.TypeID=e.TypeID,t.Discount=e.PriceDiscount,t.VariantUnitQuantity=e.VariantUnitQuantity,t.Storage=e.Storage,t.UOM=e.UOM,t.UOMName=e.UOMName,t.VariantID=e.ID,t.Taxable=e.Taxable,t.InventoryTypeID=e.TypeID,t.PriceTypeID=e.PriceTypeID,t.PriceNote=e.PriceNote,t.Variant=e,t.UnitPriceMinimum=e.UnitPriceMinimum,t}generateCartItemOnEdit(e){let t=new ae;return t.ID=e.ID,t.Name=e.Variant?.Name,t.ThumbnailUrl=e.Variant?.ThumbnailUrl,t.Price=e.Price,t.UnitPrice=e.Price,t.UnitCost=e.Cost,t.UnitQuantity=e.Variant?.UnitQuantity,t.Quantity=e.Quantity,t.Code=e.Variant?.Code,t.TypeID=e.Variant?.TypeID,t.Discount=e.Discount,t.VariantUnitQuantity=e.Variant?.VariantUnitQuantity,t.Storage=e.Variant?.Storage,t.UOM=e.Variant?.UOM,t.UOMName=e.Variant?.UOMName,t.VariantID=e.VariantID,t.Taxable=e.Taxable,t.Note=e.Note,t.Serial=e.Serial,t.InventoryTypeID=e.InventoryTypeID,t.PriceTypeID=e.PriceTypeID,t.Variant=e.Variant,t.PriceNote=e.PriceNote,t}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var We=class o{httpService=d(G);storeService=d(D);factoryService=d(ye);activatedRoute=d(Xt);getLoadForm$=this.activatedRoute.queryParams.pipe(Y(e=>this.httpService.post("/API/estimate/LoadForm",e)),w(e=>this.storeService.updateLoadForm(e)),w(e=>{g.IsNotEmpty(e.Data)?this.onEditOrder(e):(this.initDefaultCurrency(),this.initTag(),this.initTax())}),N());constructor(){this.getLoadForm$.subscribe()}onEditOrder(e){let t=e.Data,n=this.findTaxById(t.Order.TaxTypeID),i=this.findCurrencyById(t.Order.CurrencyID),l=this.findOutletById(t.Order.EntityID),y=this.findTagById(t.Order.TypeID),M=this.getCartItemsOnEdit(e);this.storeService.updateState(1),this.storeService.updateOrder(t.Order),this.storeService.updateCartItems(M),this.storeService.updateCustomer({Key:t.Order.CustomerID,Value:t.ContactName}),this.storeService.updateTax(n),this.storeService.updateCurrency(i),this.storeService.updateOutlet(l),this.storeService.updateDiscount({discount:t.Order.Discount,discountAmount:t.Order.DiscountAmount}),this.storeService.updateTag(y)}getCartItemsOnEdit(e){return e.Data.Items.map(i=>this.factoryService.generateCartItemOnEdit(i))}initDefaultCurrency(){let e=this.storeService.loadForm()?.AppConfigJSON?.CoreDefaults?.CurrencyID,t=this.storeService.loadForm()?.Currencies.find(n=>n.ID===e);this.storeService.updateCurrency(t)}initTag(){let e=this.storeService.loadForm()?.SalesOrderTags;this.storeService.updateTag(e[0])}initTax(){let e=this.storeService.loadForm()?.Taxes;this.storeService.updateTax(e[0])}findTaxById(e){return(this.storeService.loadForm()?.Taxes).find(i=>i.ID===e)}findCurrencyById(e){return(this.storeService.loadForm()?.Currencies).find(i=>i.ID===e)}findOutletById(e){return(this.storeService.loadForm()?.Entities).find(i=>i.ID===e)}findTagById(e){return(this.storeService.loadForm()?.SalesOrderTags).find(i=>i.ID===e)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var $e=class o{storeService=d(D);isOpenDialog$=R(this.storeService.loadForm).pipe(T(e=>g.IsNotEmpty(e.Entities)),de(()=>{let e=!1,t=this.storeService.state(),n=this.storeService.outlet();return(t==0||t==1)&&(e=g.IsEmpty(n.ID)),e}));updateOutlet(e){this.storeService.updateOutlet(e)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac,providedIn:"root"})};var se=class o{storeService=d(D);httpService=d(G);router=d(Ee);orderNumber$=R(this.storeService.outlet).pipe(T(e=>g.IsNotEmpty(e.ID)),Y(e=>{if(this.storeService.state()==0)return this.httpService.post(L.EstimateGenerateNumber,{ID:e.ID}).pipe(de(t=>t.Number));{let t=this.storeService.order().Number;return Ot(t)}}),w(e=>{this.storeService.state()==0&&this.updateOrderNumber(e)}),N());salesPersons$=R(this.storeService.outlet).pipe(Y(e=>g.IsNotEmpty(e.ID)?this.httpService.get(L.GetSalesPersonByOutletId,[{key:"ID",value:e.ID}]):Ot([])),Me(1));updateTagOrder$=R(this.storeService.tag).pipe(w(e=>{let t=O({},this.storeService.order());t.TypeID=e.ID,this.storeService.updateOrder(t)}),N());updateCurrencyOrder$=R(this.storeService.currency).pipe(w(e=>{let t=O({},this.storeService.order());t.CurrencyID=e.ID,this.storeService.updateOrder(t)}),N());updateTaxOrder$=R(this.storeService.tax).pipe(w(e=>{let t=O({},this.storeService.order());t.TaxTypeID=e.ID,this.storeService.updateOrder(t)}),N());updateDiscountOrder$=R(this.storeService.discount).pipe(w(e=>{let t=O({},this.storeService.order());t.Discount=e.discount,t.DiscountAmount=e.discountAmount,this.storeService.updateOrder(t)}),N());updateCustomerOrder$=R(this.storeService.customer).pipe(w(e=>{let t=O({},this.storeService.order());t.CustomerID=e.Key,this.storeService.updateOrder(t)}),N());updateEntityId$=R(this.storeService.outlet).pipe(T(e=>g.IsNotEmpty(e.ID)),w(e=>{let t=O({},this.storeService.order());t.EntityID=e.ID,this.storeService.updateOrder(t)}),N());constructor(){this.updateTagOrder$.subscribe(),this.updateCurrencyOrder$.subscribe(),this.updateTaxOrder$.subscribe(),this.updateDiscountOrder$.subscribe(),this.updateCustomerOrder$.subscribe(),this.updateEntityId$.subscribe()}newOrder(){let e=this.storeService.loadForm(),t=this.getDefaultCurrency(),n=this.storeService.outlet();this.storeService.updateOrder(new Ue),this.storeService.updateCartItems([]),this.storeService.updateCustomer(new re),this.storeService.updateTax(O({},e.Taxes[0])),this.storeService.updateCurrency(O({},t)),this.storeService.updateTag(O({},e.SalesOrderTags[0])),this.storeService.updateDiscount({discountAmount:0,discount:0}),this.storeService.updateOutlet(O({},n)),this.router.navigate([],{queryParams:{}}),this.storeService.updateState(0)}getDefaultCurrency(){let e=this.storeService.loadForm()?.AppConfigJSON?.CoreDefaults?.CurrencyID;return this.storeService.loadForm()?.Currencies.find(n=>n.ID===e)}updateOrderNumber(e){g.IsNotEmpty(e)&&this.storeService.order().Number!==e&&this.storeService.updateOrder(le(O({},this.storeService.order()),{Number:e}))}updateOrderDate(e){g.IsNotEmpty(e)&&this.storeService.order().Date!==e&&this.storeService.updateOrder(le(O({},this.storeService.order()),{Date:e}))}updateSalesPersonId(e){let t=O({},this.storeService.order());t.SalesID=e,this.storeService.updateOrder(t)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var qe=class o{storeService=d(D);httpService=d(G);quickkeys$=R(this.storeService.outlet).pipe(T(e=>g.IsNotEmpty(e.ID)),Bt((e,t)=>e.ID===t.ID),Y(e=>this.httpService.get(L.GetQuickKeyByEntityID,[{key:"ID",value:e.ID}])),Me(1));static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Fn=o=>({"qtyBtn-disabled":o}),bt=class o{disabled=!1;decimalPlaces=4;max=1e15;min=-1e15;quantity;constructor(){}ngOnInit(){}incrementQty(){this.quantity<this.max&&(this.quantity++,this.onChange(this.quantity))}decrementQty(){this.quantity>this.min&&(this.quantity--,this.onChange(this.quantity))}quantityChange(){this.onChange(this.quantity)}onChange=e=>{};onTouched=()=>{};writeValue(e){g.IsEmpty(e)?this.quantity=0:this.quantity=e}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["POS-input-quantity"]],inputs:{disabled:"disabled",decimalPlaces:"decimalPlaces",max:"max",min:"min"},features:[Te([{provide:it,multi:!0,useExisting:o}])],decls:6,vars:11,consts:[[1,"input-group"],["type","button","id","button-addon1",1,"btn","btn-outline-secondary","fw-bold","rounded-0","fs-2","border-end-0","py-4","qty-input","d-flex","align-items-center","qty_btn","justify-content-center",3,"click","ngClass","disabled"],["id","txtCartQuantity","type","text","autoNum","",1,"form-control","input-numpad","qty-input","text-center",3,"ngModelChange","ngModel","disabled","decimalPlaces"],["type","button","id","button-addon2",1,"btn","btn-outline-secondary","fw-bold","rounded-0","fs-5","border-start-0","py-4","qty-input","d-flex","align-items-center","qty_btn","justify-content-center",3,"click","ngClass","disabled"]],template:function(t,n){t&1&&(r(0,"div",0)(1,"button",1),p("click",function(){return n.decrementQty()}),s(2,"-"),a(),r(3,"input",2),Q("ngModelChange",function(l){return j(n.quantity,l)||(n.quantity=l),l}),p("ngModelChange",function(){return n.quantityChange()}),a(),r(4,"button",3),p("click",function(){return n.incrementQty()}),s(5,"+"),a()()),t&2&&(c(),u("ngClass",$(7,Fn,n.disabled))("disabled",n.disabled),c(2),U("ngModel",n.quantity),u("disabled",n.disabled)("decimalPlaces",n.decimalPlaces),c(),u("ngClass",$(9,Fn,n.disabled))("disabled",n.disabled))},dependencies:[A,ee,ie,te,J,ne,ve],styles:[".qtyBtn-disabled[_ngcontent-%COMP%]{background-color:#e9ecef;color:#000!important}button.qty_btn[_ngcontent-%COMP%]{background:#eee;border:1px solid #ddd;width:36px}.qty-input[_ngcontent-%COMP%]{height:36px!important}"]})};var xe=class o{storeService=d(D);autoApplyPricebook(e){let t=e?.Variant?.PriceBook?e?.Variant?.PriceBook:[],n=this.storeService.customer(),i=this.findCustomerPricebook(t,n),l=this.sortAppliedPricebooks(t,e.Quantity);return l.length>0||g.IsNotEmpty(i)?g.IsNotEmpty(i)?e=this.applyPricebook(e,i):e=this.applyPricebook(e,l[0]):e.PriceTypeID===2&&(e=this.removePricebook(e)),e}findCustomerPricebook(e=[],t){let n;return g.IsNotEmpty(t)&&g.IsNotEmpty(t?.Key)&&(n=e.find(i=>i.ID==t.PricebookID)),n}applyCustomerPricebook(){let e=[],t=this.storeService.customer(),n=this.storeService.cartItems();return g.IsNotEmpty(t.PricebookID)&&n.forEach(i=>{let l=this.findCustomerPricebook(i.Variant.PriceBook,t);l&&(i=this.applyPricebook(i,l),e.push(i))}),e}removeCustomerPricebook(e){let t=[];return this.storeService.cartItems().forEach(i=>{this.findCustomerPricebook(i.Variant.PriceBook,e)&&(i=this.removePricebook(i),t.push(i))}),t}sortAppliedPricebooks(e=[],t){return e.sort((n,i)=>i.MinimumQuantity-n.MinimumQuantity).filter(n=>t>=n.MinimumQuantity&&n.MinimumQuantity!=0)}applyPricebook(e,t){let n=this.storeService.loadForm()?.AppConfigJSON?.ModuleSell?.Pricebook?.PricebookVisible;return e.Discount=t.PriceDiscount,e.UnitPrice=t.UnitPrice,e.PriceBookID=t.ID,e.Price=t.UnitPrice,e.PriceTypeID=2,e.PriceNote=t.Name,n?e.Note=t.Name:e.Note="",e}removePricebook(e){return e.Discount=e.Variant.PriceDiscount,e.UnitPrice=e.Variant.UnitPrice,e.PriceBookID=null,e.Price=e.Variant.UnitPrice,e.PriceTypeID=0,e.Note="",e.PriceNote="",e}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var kt=o=>({selected:o}),Qn=()=>["/menu/Products/Catalog/Variants/Info"],Ln=o=>({ID:o});function Wn(o,e){if(o&1){let t=V();r(0,"a",13),p("click",function(){b(t);let i=m();return _(i.tabState.set("PRODUCT"))}),s(1," Product "),a()}if(o&2){let t=m();u("ngClass",$(1,kt,t.tabState()=="PRODUCT"))}}function $n(o,e){if(o&1){let t=V();r(0,"a",14),p("click",function(){b(t);let i=m();return _(i.tabState.set("SERIAL"))}),s(1," Serial "),a()}if(o&2){let t=m();u("ngClass",$(1,kt,t.tabState()=="SERIAL"))}}function qn(o,e){if(o&1&&(r(0,"div",10),I(1,"div",15),a()),o&2){let t=m();c(),u("innerHTML",t.cartItemService.priceMinimumRestrictionWarning(),Je)}}function Hn(o,e){if(o&1&&(r(0,"div",16)(1,"div",25),I(2,"POS-variant-autocomplete",26),a()()),o&2){let t=m(2);c(2),u("formControl",t.variantSearchCtrl)}}function zn(o,e){if(o&1&&(r(0,"span"),s(1),a()),o&2){let t=m(2);c(),x("(",t.cartItem().UOMName,")")}}function Gn(o,e){if(o&1){let t=V();r(0,"div",19)(1,"h6"),s(2,"Pricebook"),a(),r(3,"ng-select",27),Q("ngModelChange",function(i){b(t);let l=m(2);return j(l.cartItem().PriceBookID,i)||(l.cartItem().PriceBookID=i),_(i)}),p("ngModelChange",function(i){b(t);let l=m(2);return _(l.onSelectPricebook(i))}),a()()}if(o&2){let t,n=m(2);c(3),u("items",(t=n.cartItem())==null||t.Variant==null?null:t.Variant.PriceBook),U("ngModel",n.cartItem().PriceBookID)}}function Jn(o,e){if(o&1){let t=V();C(0,Hn,3,1,"div",16),r(1,"div",16)(2,"div",17)(3,"h6"),s(4," Qty "),C(5,zn,2,1,"span"),a(),r(6,"POS-input-quantity",18,0),Q("ngModelChange",function(i){b(t);let l=m();return j(l.cartItem().Quantity,i)||(l.cartItem().Quantity=i),_(i)}),p("ngModelChange",function(){b(t);let i=m();return _(i.onQtyChange())}),a()(),r(8,"div",19)(9,"h6"),s(10,"Discount (%)"),a(),r(11,"input",20),Q("ngModelChange",function(i){b(t);let l=m();return j(l.cartItem().Discount,i)||(l.cartItem().Discount=i),_(i)}),a()(),r(12,"div",19)(13,"h6"),s(14,"Price"),a(),r(15,"input",21,1),Q("ngModelChange",function(i){b(t);let l=m();return j(l.cartItem().Price,i)||(l.cartItem().Price=i),_(i)}),a()(),C(17,Gn,4,2,"div",19),a(),r(18,"div",22)(19,"div",23)(20,"POS-tinymce-editor",24),Q("ngModelChange",function(i){b(t);let l=m();return j(l.cartItem().Note,i)||(l.cartItem().Note=i),_(i)}),a()()()}if(o&2){let t,n=m();f(n.isEditState()==!1?0:-1),c(5),f(n.cartItem().UOMName?5:-1),c(),U("ngModel",n.cartItem().Quantity),u("decimalPlaces",n.isSerialItem()?0:4),c(5),U("ngModel",n.cartItem().Discount),c(4),U("ngModel",n.cartItem().Price),u("disabled",!(!(n.roleService==null||n.roleService.sell==null)&&n.roleService.sell.UnitPriceEditor)),c(2),f(((t=n.cartItem().Variant)==null||t.PriceBook==null?null:t.PriceBook.length)>0?17:-1),c(3),U("ngModel",n.cartItem().Note)}}function Kn(o,e){o&1&&(I(0,"i",44),r(1,"h6"),s(2,"No Image"),a())}function Yn(o,e){if(o&1&&I(0,"img",30),o&2){let t=m(2);u("src",t.cartItem().ThumbnailUrl,Ke)}}function Xn(o,e){if(o&1&&(r(0,"tr")(1,"td",45),s(2),v(3,"number"),a(),r(4,"td",45),s(5),v(6,"number"),a(),r(7,"td",45),s(8),v(9,"number"),a()()),o&2){let t=e;c(2),x(" ",h(3,3,t==null?null:t.OnHand)," "),c(3),x(" ",h(6,5,t==null?null:t.Allocated)," "),c(3),x(" ",h(9,7,(t==null?null:t.OnHand)-(t==null?null:t.Allocated))," ")}}function Zn(o,e){if(o&1){let t=V();r(0,"tr")(1,"th",42),s(2," Cost "),a(),r(3,"td",46)(4,"input",47),Q("ngModelChange",function(i){b(t);let l=m(2);return j(l.cartItem().UnitCost,i)||(l.cartItem().UnitCost=i),_(i)}),a()()()}if(o&2){let t,n=m(2);c(4),U("ngModel",n.cartItem().UnitCost),u("readonly",!(!((t=n.appConfig())==null||t.ModuleSell==null)&&t.ModuleSell.Cost.Enabled))}}function ei(o,e){if(o&1&&(r(0,"tr")(1,"th",42),s(2," Content "),a(),r(3,"td",43)(4,"div",48),s(5),v(6,"number"),a()()()),o&2){let t,n=m(2);c(5),Ie(" ",(t=n.cartItem())==null?null:t.VariantUnitQuantity," (@",h(6,2,n.cartItem().Price/((t=n.cartItem())==null?null:t.VariantUnitQuantity)),") ")}}function ti(o,e){if(o&1&&(r(0,"div",40)(1,"table",49)(2,"thead")(3,"tr")(4,"th",50),s(5,"Storage Location"),a()()(),r(6,"tbody")(7,"tr")(8,"td"),s(9),a()()()()()),o&2){let t=m(2);c(9),x(" ",t.cartItem().Storage," ")}}function ni(o,e){if(o&1&&(r(0,"div",11)(1,"div",28)(2,"a",29),C(3,Kn,3,0)(4,Yn,1,1,"img",30),a()(),r(5,"div",31)(6,"div",32)(7,"div",23)(8,"div",33),I(9,"i",34),r(10,"div",35),s(11," Inventory "),a()(),r(12,"table",36)(13,"thead")(14,"tr")(15,"th",37),s(16," On Hand "),a(),r(17,"th",37),s(18," Allocated "),a(),r(19,"th",38),s(20," Available "),a()()(),r(21,"tbody"),C(22,Xn,10,9,"tr"),v(23,"async"),a()()()(),r(24,"div",39)(25,"div",40)(26,"table",41)(27,"thead"),C(28,Zn,5,2,"tr"),r(29,"tr")(30,"th",42),s(31," Price "),a(),r(32,"td",43),s(33),v(34,"number"),a()(),C(35,ei,7,4,"tr"),a()()(),C(36,ti,10,1,"div",40),a()()()),o&2){let t,n,i,l,y,M,W,K=m();c(2),u("routerLink",Ze(12,Qn))("queryParams",$(13,Ln,(t=K.cartItem())==null?null:t.ID)),c(),f(((n=K.cartItem())==null?null:n.ThumbnailUrl)==null?3:4),c(19),f((i=h(23,8,K.variantInventory$))?22:-1,i),c(6),f(!((l=K.appConfig())==null||l.ModuleSell==null)&&l.ModuleSell.Cost.Visible&&(!(K.roleService==null||K.roleService.product==null)&&K.roleService.product.Cost)?28:-1),c(5),x(" ",h(34,10,(y=K.cartItem())==null?null:y.Price)," "),c(2),f(((M=K.cartItem())==null?null:M.VariantUnitQuantity)>1?35:-1),c(),f(!((W=K.appConfig())==null||W.ModuleSell==null||W.ModuleSell.Grid==null)&&W.ModuleSell.Grid.StorageVisible&&((W=K.cartItem())!=null&&W.Storage)?36:-1)}}function ii(o,e){if(o&1){let t=V();r(0,"app-item-serial",51),p("cartItemChange",function(i){b(t);let l=m();return _(l.onSerialChanges(i))}),a()}if(o&2){let t=m();u("entityId",t.storeService.outlet().ID)("cartItem",t.cartItem())}}var ze=class o{constructor(e,t){this.data=e;this.dialogRef=t;this.cartItem=S(e),this.initVariantInventory(),this.initIsSerialItem(),this.initModalConfig(),this.initDialogState()}data;dialogRef;storeService=d(D);cartItemService=d(me);roleService=d(_e);toastr=d(nt);pricebookService=d(xe);modalConfig=new Ae;tabState=S("CART");cartItem;appConfig=S(this.storeService.loadForm()?.AppConfigJSON);isSerialItem=S(!1);variantInventory$;isEditState=S(!1);showProductTab=S(!1);variantSearchCtrl=new we;getItemFromSearch$=this.variantSearchCtrl.valueChanges.pipe(T(e=>g.IsNotEmpty(e)),Y(e=>{if(e.type==="ID")return this.cartItemService.getItemByVariantId(e.str);if(e.type==="Code")return this.cartItemService.getItemByVariantByCode(e.str)}),w(e=>{this.cartItem.set(e),this.initModalTitle(),this.initProductTab(),this.initIsSerialItem(),this.initVariantInventory()}),N());ngOnInit(){this.isEditState()||this.getItemFromSearch$.subscribe()}initDialogState(){this.isEditState.set(g.IsNotEmpty(this.cartItem().VariantID)),this.initProductTab()}initVariantInventory(){this.variantInventory$=this.cartItemService.getVariantInventory(this.cartItem().VariantID).pipe(Me(1))}initProductTab(){this.showProductTab.set(g.IsNotEmpty(this.cartItem().VariantID))}initIsSerialItem(){this.isSerialItem.set(this.cartItem().TypeID==9)}initModalConfig(){this.initModalTitle(),this.modalConfig.customWidth="680px",this.modalConfig.noPadding=!0,this.modalConfig.bodyScrollable=!0}initModalTitle(){this.modalConfig.title=this.cartItem()?.Name??"Add Variant"}onSerialChanges(e){this.cartItem.set(e)}onQtyChange(){let e=this.pricebookService.autoApplyPricebook(this.cartItem());this.cartItem.set(e)}onSelectPricebook(e){let t;if(g.IsNotEmpty(e)){let i=this.cartItem().Variant.PriceBook.find(l=>l.ID===e);t=this.pricebookService.applyPricebook(this.cartItem(),i)}else t=this.pricebookService.removePricebook(this.cartItem());this.cartItem.set(t)}onCancel(){this.dialogRef.close()}onSave(){if(g.IsNotEmpty(this.cartItem().VariantID)&&g.IsNotEmpty(this.cartItem().Name)){if(!this.cartItemService.validatePriceMinimum(this.cartItem(),this.appConfig))return;this.dialogRef.close(this.cartItem())}else this.toastr.warning("Please select a product","Warning")}ngOnDestroy(){this.cartItemService.priceMinimumRestrictionWarning.set("")}static \u0275fac=function(t){return new(t||o)(X(Re),X(Fe))};static \u0275cmp=P({type:o,selectors:[["app-dialog-item"]],decls:14,vars:10,consts:[["quantity",""],["price",""],[3,"onOk","onCancel","onClose","config"],[1,"mb-5"],[1,"container","w-100","h-100","mt-8"],[1,"row","border-bottom","mx-5"],["data-cy","input_sell",1,"btn","btn-link",3,"click","ngClass"],["data-cy","product",1,"btn","btn-link",3,"ngClass"],["data-cy","serial",1,"btn","btn-link",3,"ngClass"],[1,"mx-8"],[1,"bg-gradient-warning","p-4","justify-content-center","align-items-center","d-flex","gap-2",2,"margin-top","12px","border-radius","8px"],[1,"row","my-8"],[3,"entityId","cartItem"],["data-cy","product",1,"btn","btn-link",3,"click","ngClass"],["data-cy","serial",1,"btn","btn-link",3,"click","ngClass"],[3,"innerHTML"],[1,"row","mt-8"],[1,"col-auto","pe-0",2,"width","145px"],[3,"ngModelChange","ngModel","decimalPlaces"],[1,"col-auto","pe-0"],["type","text","percentage","","autoNum","",1,"form-control","input-cart",2,"width","100px",3,"ngModelChange","ngModel"],["id","inputPrice","type","text","autoNum","",1,"form-control","input-cart",2,"width","112px",3,"ngModelChange","ngModel","disabled"],[1,"row","my-6"],[1,"col-12"],["height","220px",3,"ngModelChange","ngModel"],[1,"col-12","px-0"],[3,"formControl"],["bindLabel","Name","bindValue","ID","placeholder","Pricebook","appendTo","body",2,"width","170px",3,"ngModelChange","items","ngModel"],[1,"col-sm-4","d-flex","justify-content-center","flex-column","align-items-center","text-body-secondary"],["target","_blank",2,"color","inherit",3,"routerLink","queryParams"],[1,"border","rounded",3,"src"],[1,"col-sm-8","inventory"],[1,"row","mb-8"],[1,"d-flex"],["aria-hidden","true",1,"fa-archive","fa-solid","fa-1x","pt-3","pe-2"],[2,"font-size","15px","font-family",'"Roboto Slab"'],[1,"table","table-bordered","text-center","inventory-table"],[1,"table-light","py-6","border-end",2,"text-transform","none"],[1,"table-light","py-6",2,"text-transform","none"],[1,"row"],[1,"col-6"],[1,"table","table-bordered",2,"width","171px"],[1,"table-light",2,"text-transform","none"],[1,"pe-6","text-end"],["aria-hidden","true",1,"fa-solid","fa-image","fa-5x"],[1,"py-6"],[1,"p-0"],["type","text","autoNum","",1,"form-control","border-0","bg-white","text-end",3,"ngModelChange","ngModel","readonly"],["ngClass","ms-3"],[1,"table","table-bordered","text-center"],[1,"table-light"],[3,"cartItemChange","entityId","cartItem"]],template:function(t,n){t&1&&(r(0,"modal-material",2),p("onOk",function(){return n.onSave()})("onCancel",function(){return n.onCancel()})("onClose",function(){return n.onCancel()}),r(1,"content",3)(2,"div",4)(3,"div",5)(4,"div")(5,"a",6),p("click",function(){return n.tabState.set("CART")}),s(6," Cart "),a(),C(7,Wn,2,3,"a",7),C(8,$n,2,3,"a",8),a()(),r(9,"div",9),C(10,qn,2,1,"div",10),C(11,Jn,21,9),C(12,ni,37,15,"div",11),C(13,ii,1,2,"app-item-serial",12),a()()()()),t&2&&(u("config",n.modalConfig),c(5),u("ngClass",$(8,kt,n.tabState()=="CART")),c(2),f(n.showProductTab()?7:-1),c(),f(n.isSerialItem()?8:-1),c(2),f(n.cartItemService.priceMinimumRestrictionWarning()&&n.cartItemService.priceMinimumRestrictionWarning().trim()!==""?10:-1),c(),f(n.tabState()=="CART"?11:-1),c(),f(n.tabState()=="PRODUCT"?12:-1),c(),f(n.tabState()=="SERIAL"?13:-1))},dependencies:[A,ee,Ve,ie,te,J,ne,ve,lt,tt,et,pt,Ne,ke,Mn,Dn,bt,Be,Oe,z],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}.inventory-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .inventory-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{line-height:6px!important}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519}.input-cart[_ngcontent-%COMP%]{height:36px!important}"],changeDetection:0})};var me=class o{httpService=d(G);storeService=d(D);factoryService=d(ye);pricebookService=d(xe);userRoleService=d(bn);decimalPipe=d(z);dialog=d(oe);variantSearchCtrl=new we;viewContainerRef=d(Wt);selectedCustomer;cartItemEvent=new Nt;onEditCartItems$=R(this.storeService.cartItems).pipe(T(()=>this.storeService.state()==1),de(e=>({action:"INIT",items:e})),Ut());priceMinimumRestrictionWarning=S("");applyCustomerPricebook$=R(this.storeService.customer).pipe(w(e=>{this.onApplyCustomerPricebook(e)}),N());cartItems$=Vt(this.onEditCartItems$,this.cartItemEvent.asObservable()).pipe(jt((e,t)=>{let n=[];switch(t.action){case"INIT":n=t.items;break;case"ADD":n=this.addNewItem(e,t);break;case"UPDATE":n=this.updateItems(e,t);break;case"REMOVE":n=e.filter((i,l)=>t.index!==l);break;case"CLEAR":n=[];break;case"PURCHASE":n=this.updateItems(e,t);break;case"RETURN":n=this.updateItems(e,t);break;case"DROP":n=t.items;break}return this.storeService.updateCartItems(n),n},this.storeService.cartItems()));addCartItemBySearch$=this.variantSearchCtrl.valueChanges.pipe(T(e=>g.IsNotEmpty(e)),w(e=>{e.type==="ID"?this.addItemByVariantId(e.str):e.type==="Code"&&this.addItemByVariantCode(e.str)}),N());constructor(){this.addCartItemBySearch$.subscribe(),this.applyCustomerPricebook$.subscribe()}onApplyCustomerPricebook(e){let t=[],n=this.storeService.cartItems();g.IsNotEmpty(e.PricebookID)?(this.selectedCustomer=e,t=this.pricebookService.applyCustomerPricebook()):g.IsNotEmpty(this.selectedCustomer)&&(t=this.pricebookService.removeCustomerPricebook(this.selectedCustomer),this.selectedCustomer=null),n.forEach((i,l)=>{let y=t.find(M=>M.VariantID===i.VariantID);y&&this.updateCartItem({cartItem:y,index:l})})}onApplyPricebook(e){return this.pricebookService.autoApplyPricebook(e)}onOpenAddDialog(){this.dialog.open(ze,{data:new ae,viewContainerRef:this.viewContainerRef}).afterClosed().pipe(T(e=>g.IsNotEmpty(e))).subscribe(e=>{this.cartItemEvent.next({item:e,action:"ADD",newRow:!0})})}onOpenEditDialog(e){this.dialog.open(ze,{data:O({},e.cartItem),viewContainerRef:this.viewContainerRef}).afterClosed().pipe(T(t=>g.IsNotEmpty(t))).subscribe(t=>{this.cartItemEvent.next({item:t,action:"UPDATE",index:e.index})})}onSelectQuickkeyItem(e){this.addItemByVariantId(e)}addNewItem(e,t){let n=[],i=e.find(l=>l.VariantID===t.item?.VariantID);return i?t.newRow?(t.item=this.onApplyPricebook(t.item),n=[...e,t.item]):(i.Quantity+=1,i=this.onApplyPricebook(i),n=[...e]):(t.item=this.onApplyPricebook(t.item),n=[...e,t.item]),n}updateItems(e,t){return e.map((i,l)=>l===t.index?gn(ae,t.item):i)}onDropItems(e){this.cartItemEvent.next({action:"DROP",items:e})}addItemByVariantId(e){this.getItemByVariantId(e).pipe(w(t=>{this.cartItemEvent.next({item:t,action:"ADD",newRow:!1})})).subscribe()}addItemByVariantCode(e){this.getItemByVariantByCode(e).pipe(w(t=>{this.cartItemEvent.next({item:t,action:"ADD",newRow:!1})})).subscribe()}removeCartItem(e){this.cartItemEvent.next({action:"REMOVE",index:e.index})}updateCartItem(e){this.cartItemEvent.next({action:"UPDATE",item:e.cartItem,index:e.index})}clearCart(){this.dialog.open(Vn,{data:{title:"Clear Order Items",message:'<p class="h4">Are you sure you want to clear all order items?</p>',headerType:De.Warning}}).afterClosed().pipe(T(e=>e)).subscribe(()=>{this.cartItemEvent.next({action:"CLEAR"})})}onPurchaseItem(e){this.cartItemEvent.next({action:"PURCHASE",item:e.cartItem,index:e.index})}onReturnItem(e){this.cartItemEvent.next({action:"RETURN",item:e.cartItem,index:e.index})}getItemByVariantId(e){return this.httpService.get(L.GetVariantByID,[{key:"ID",value:e},{key:"EntityID",value:this.storeService.outlet().ID}]).pipe(de(t=>this.factoryService.generateCartItem(t)))}getItemByVariantByCode(e){return this.httpService.get(L.GetVariantByCode,[{key:"Code",value:e},{key:"EntityID",value:this.storeService.outlet().ID},{key:"Promotion",value:!0}]).pipe(de(t=>this.factoryService.generateCartItem(t)))}getVariantInventory(e){return this.httpService.get(L.GetVariantStockByID,[{key:"EntityID",value:this.storeService.outlet().ID},{key:"ID",value:e}])}validatePriceMinimum(e,t){let n=!0,i=this.userRoleService.Data.PriceMinimum,l=t().ModuleSell.ProductDialog.PriceMinimumTypeID;if(i){let y=0;switch(l){case 1:y=e.UnitPrice;break;case 2:y=e.UnitCost;break;case 3:y=e.UnitPriceMinimum;break}if(e.Price<y){n=!1;let M=g.StringFormat("<span><i class='fa-solid fa-triangle-exclamation me-2 d-inline'></i>Cannot sell lower than <h5 class='d-inline m-0'>{0}</h5></span>",this.decimalPipe.transform(y));this.priceMinimumRestrictionWarning.set(M)}else n=!0,this.priceMinimumRestrictionWarning.set("")}return n}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};function oi(o,e){if(o&1&&(r(0,"td",8),s(1),a()),o&2){let t=m().$index;c(),x("",t+1,".")}}function ri(o,e){if(o&1&&(r(0,"div",11),I(1,"img",31),a()),o&2){let t=m().$implicit;c(),u("src",t.ThumbnailUrl,Ke)}}function ai(o,e){o&1&&(r(0,"div",12),I(1,"i",32),a())}function li(o,e){if(o&1&&I(0,"small",16),o&2){let t=m().$implicit;u("innerHtml",t.Note,Je)}}function ci(o,e){if(o&1&&(r(0,"span",20),s(1),v(2,"number"),a()),o&2){let t=m().$implicit;c(),F(wt(2,1,t.Quantity,"1.0-4"))}}function si(o,e){if(o&1&&(r(0,"span",33),s(1,"x"),a(),r(2,"div",34)(3,"span",35),s(4),v(5,"number"),a()()),o&2){let t=m().$implicit;c(4),F(h(5,1,t.UnitQuantity))}}function mi(o,e){if(o&1&&(r(0,"span",21),s(1),v(2,"number"),a()),o&2){let t=m().$implicit;c(),x("@",h(2,1,t.VariantUnitQuantity))}}function di(o,e){if(o&1&&(r(0,"small",22),s(1),a()),o&2){let t=m().$implicit;c(),F(t.UOM?t==null?null:t.UOMName:"")}}function pi(o,e){if(o&1&&(r(0,"div",24),s(1),v(2,"number"),a()),o&2){let t=m().$implicit;c(),x(" ",wt(2,1,t.Price,"1.0-4")," ")}}function ui(o,e){if(o&1){let t=V();r(0,"tr",7),p("contextmenu",function(i){let l=b(t),y=l.$implicit,M=l.$index,W=m(2);return _(W.onContextMenu(i,y,M))}),C(1,oi,2,1,"td",8),r(2,"td",9),p("click",function(){let i=b(t),l=i.$implicit,y=i.$index,M=m(2);return _(M.onEdit(l,y))}),r(3,"div",10),C(4,ri,2,1,"div",11)(5,ai,2,0,"div",12),r(6,"div",13)(7,"div"),s(8),a(),r(9,"span",14),s(10),a(),r(11,"div"),I(12,"app-serial-note",15),a(),C(13,li,1,1,"small",16),a()()(),r(14,"td",17),p("click",function(){let i=b(t),l=i.$implicit,y=i.$index,M=m(2);return _(M.onEdit(l,y))}),r(15,"div",18)(16,"div",19),C(17,ci,3,4,"span",20),C(18,si,6,3),C(19,mi,3,3,"span",21),C(20,di,2,1,"small",22),a()()(),r(21,"td",23),p("click",function(){let i=b(t),l=i.$implicit,y=i.$index,M=m(2);return _(M.onEdit(l,y))}),C(22,pi,3,4,"div",24),a(),r(23,"td",23),p("click",function(){let i=b(t),l=i.$implicit,y=i.$index,M=m(2);return _(M.onEdit(l,y))}),r(24,"div",25),s(25),v(26,"number"),a()(),r(27,"td",26),p("click",function(){let i=b(t),l=i.$implicit,y=i.$index,M=m(2);return _(M.onEdit(l,y))}),r(28,"div",18)(29,"div",20),s(30),v(31,"number"),a()()(),r(32,"td",27)(33,"div",28)(34,"span",29),p("click",function(){let i=b(t),l=i.$implicit,y=i.$index,M=m(2);return _(M.onRemove(l,y))}),I(35,"i",30),a()()()()}if(o&2){let t,n,i=e.$implicit,l=m(2);c(),f(!((t=l.appConfig())==null||t.ModuleSell==null||t.ModuleSell.Grid==null)&&t.ModuleSell.Grid.RowNumberVisible?1:-1),c(3),f(i.ThumbnailUrl?4:5),c(4),F(i.Name),c(2),F(i.Code),c(2),u("serials",i==null?null:i.Serial),c(),f(i.Note?13:-1),c(4),f(i.Quantity!==1&&i.Quantity!==0||i.UnitQuantity>1||i.VariantUnitQuantity>1?17:-1),c(),f(i.UnitQuantity>1?18:-1),c(),f(i.VariantUnitQuantity>1?19:-1),c(),f(i.UOM&&(!((n=l.appConfig())==null||n.ModuleSell==null||n.ModuleSell.Grid==null)&&n.ModuleSell.Grid.UOMVisible)?20:-1),c(2),f(i.Price!==i.Total?22:-1),c(3),x(" ",i.Discount?h(26,13,i.Discount*-1)+"%":""," "),c(5),x(" ",l.roleService.product!=null&&l.roleService.product.Price?h(31,15,i.Total):" - "," ")}}function gi(o,e){if(o&1){let t=V();r(0,"table",1)(1,"tbody",5),p("cdkDropListDropped",function(i){b(t);let l=m();return _(l.onDrop(i))}),ue(2,ui,36,17,"tr",6,pe),a()()}if(o&2){let t=m();c(2),ge(t.cartItems())}}function Ci(o,e){o&1&&(r(0,"div",2)(1,"div",36)(2,"div",37)(3,"div",38)(4,"div",39),I(5,"i",40),a(),r(6,"div",41)(7,"span"),s(8,"Empty Cart"),a(),I(9,"br"),r(10,"span"),s(11,"Add products to the cart"),a(),I(12,"br"),r(13,"span"),s(14,"or scan barcode"),a()()()()()())}function fi(o,e){if(o&1){let t=V();r(0,"button",42),p("click",function(){let i=b(t).item,l=m();return _(l.onReverse(i,!0))}),s(1,"Return"),a(),r(2,"button",42),p("click",function(){let i=b(t).item,l=m();return _(l.onReverse(i,!1))}),s(3,"Purchase"),a()}}var _t=class o{roleService=d(_e);appConfig=be();cartItems=be([]);onRemoveEvent=B({alias:"onRemove"});onEditEvent=B({alias:"onEdit"});onDropItems=B();onReturnEvent=B({alias:"onReturn"});onPurchaseEvent=B({alias:"onPurchase"});contextMenu=Yt.required(Le);contextMenuPosition=S({x:"0px",y:"0px"});contextMenuIndex=S(-1);onContextMenu(e,t,n){e.preventDefault(),this.contextMenuPosition.set({x:e.clientX+"px",y:e.clientY+"px"}),this.contextMenuIndex.set(n),this.contextMenu().menuData={item:t},this.contextMenu().openMenu()}onDrop(e){let t=[...this.cartItems()];nn(t,e.previousIndex,e.currentIndex),this.onDropItems.emit(t)}onEdit(e,t){this.onEditEvent.emit({cartItem:e,index:t})}onRemove(e,t){this.onRemoveEvent.emit({cartItem:e,index:t})}onReverse(e,t){let n=this.contextMenuIndex(),i=Object.assign(new ae,e);t?(i.Quantity>0&&(i.Quantity=i.Quantity*-1),this.onReturnEvent.emit({cartItem:i,index:n})):(i.Quantity<0&&(i.Quantity=i.Quantity*-1),this.onPurchaseEvent.emit({cartItem:i,index:n}))}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["POS-cart-display"]],viewQuery:function(t,n){t&1&&zt(n.contextMenu,Le,5),t&2&&Gt()},inputs:{appConfig:[1,"appConfig"],cartItems:[1,"cartItems"]},outputs:{onRemoveEvent:"onRemove",onEditEvent:"onEdit",onDropItems:"onDropItems",onReturnEvent:"onReturn",onPurchaseEvent:"onPurchase"},decls:6,vars:6,consts:[["contextMenu","matMenu"],[1,"table","table-borderless"],[1,"row","g-0","h-100"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],["matMenuContent",""],["cdkDropList","",3,"cdkDropListDropped"],["cdkDrag","",1,"border-bottom"],["cdkDrag","",1,"border-bottom",3,"contextmenu"],[2,"width","10px"],[1,"pe-0",2,"width","50%",3,"click"],[1,"d-flex","align-items-center"],[1,"ratio","ratio-1x1",2,"width","55px"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[1,"d-block","ms-4",2,"line-height","18px"],[1,"fw-normal","fs-6","text-muted"],[3,"serials"],["title","Note",1,"special-TinyMCE","m-0","fst-italic","d-block",3,"innerHtml"],[1,"px-0","text-end",2,"width","15%",3,"click"],[1,"d-flex","align-items-center","justify-content-end"],[1,"d-flex","text-end","fw-normal","align-items-center",2,"line-height","20px"],[1,"fs-5"],["title","Variant Unit Quantity",1,"fs-5"],["title","UOM",1,"ps-1","fs-5"],[3,"click"],[1,"fs-5","text-end"],[1,"fw-normal","fs-5","text-danger"],[1,"pe-0",3,"click"],[1,"mt-6","ps-0"],[1,"d-flex","justify-content-end","align-items-center"],["role","button","title","Delete Item",1,"fs-3","cursor-pointer",3,"click"],[1,"fa","fa-trash","text-danger","fs-4"],[1,"item-image",3,"src"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],[1,"fs-6","me-1","ms-1"],[1,"d-flex","algin-items-center"],["title","Unit Quantity",1,"fs-5","me-1"],[1,"col-12"],[1,"d-flex","justify-content-center","align-items-center","h-100"],[1,"row"],[1,"col-12","d-flex","justify-content-center"],[1,"fa-regular","fa-cart-arrow-up","text-secondary",2,"font-size","110px"],[1,"col-12","justify-content-center","text-center","mt-5","empty-cart-description","text-secondary","headings-font-family"],["mat-menu-item","",3,"click"]],template:function(t,n){if(t&1&&(C(0,gi,4,0,"table",1)(1,Ci,15,0,"div",2),I(2,"div",3),r(3,"mat-menu",null,0),qt(5,fi,4,0,"ng-template",4),a()),t&2){let i=Xe(4);f(n.cartItems()&&n.cartItems().length>0?0:1),c(2),Jt("left",n.contextMenuPosition().x)("top",n.contextMenuPosition().y),u("matMenuTriggerFor",i)}},dependencies:[A,an,rn,on,kn,Sn,xn,hn,vn,yn,Le,z],styles:[".item-image[_ngcontent-%COMP%]{height:50px;width:56px;display:block;border:solid 1px #dddddd;border-radius:5px;object-fit:contain}.example-menu[_ngcontent-%COMP%]{display:inline-flex;flex-direction:column;min-width:180px;max-width:280px;background-color:#fff;padding:6px 0}.example-menu-item[_ngcontent-%COMP%]{background-color:transparent;cursor:pointer;border:none;-webkit-user-select:none;user-select:none;min-width:64px;line-height:36px;padding:0 16px;display:flex;align-items:center;flex-direction:row;flex:1}.example-menu-item[_ngcontent-%COMP%]:hover{background-color:#f5f5f5}.example-menu-item[_ngcontent-%COMP%]:active{background-color:#dcdcdc}.table[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:not(caption) > *[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{padding:12px 10px} .cdk-menu.cdk-menu-group.example-menu{box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.empty-cart-description[_ngcontent-%COMP%]{font-size:14px;font-weight:500;color:#c7c7c7}"],changeDetection:0})};var _i=(o,e)=>({"text-danger":o,"text-custom-warning":e});function vi(o,e){if(o&1&&(r(0,"mat-option",5)(1,"div",7)(2,"div",8)(3,"div"),s(4),a()()()()),o&2){let t=e.$implicit,n=m();u("value",t),c(2),u("ngClass",Kt(4,_i,t.StateID==n.customerState.Suspended,t.StateID==n.customerState.WaitingForApproval))("title",t.StateID==n.customerState.Suspended?"Suspended":t.StateID==n.customerState.WaitingForApproval?"Waiting for Approval":""),c(2),F(t==null?null:t.Value)}}function yi(o,e){if(o&1){let t=V();r(0,"i",9),p("click",function(){b(t);let i=m();return _(i.openCustomerDetail())}),a()}}var vt=class o{httpService=d(G);router=d(Ee);customerCtrl=new we;customerFiltered$=this.customerCtrl.valueChanges.pipe(T(e=>typeof e=="string"&&e.length>=3),Rt(300),Y(e=>this.getCustomerSuggestion(e)));customerSelected$=this.customerCtrl.valueChanges.pipe(T(e=>typeof e!="string"),w(e=>{this.onChange(e)}));createNewCustomer=B();clickInput=B();customerState=Tn;constructor(){this.customerSelected$.pipe(N()).subscribe()}getCustomerSuggestion(e){return this.httpService.get(L.GetCustomerSuggestions,[{key:"count",value:100},{key:"prefix",value:e}])}displayFn(e){return e?.Value}onCreateCustomer(){this.createNewCustomer.emit()}onClickInputValue(){this.clickInput.emit()}onChange=e=>{};onTouched=()=>{};writeValue(e){this.customerCtrl.patchValue(e,{onlySelf:!0,emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}openCustomerDetail(){let e=this.customerCtrl.value.Key;if(g.IsNotEmpty(e)){let t=this.router.serializeUrl(this.router.createUrlTree(["/menu/Contacts/Contact/Customers/Info"],{queryParams:{ID:e}}));window.open(t,"_blank")}}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["POS-customer-autocomplete"]],outputs:{createNewCustomer:"createNewCustomer",clickInput:"clickInput"},features:[Te([{provide:it,multi:!0,useExisting:o}])],decls:9,vars:6,consts:[["auto","matAutocomplete"],[1,"d-flex","align-items-center","position-relative"],["matTooltipPosition","above","matTooltip","New Customer","role","button",1,"fa-light","fa-user-plus","position-absolute","cursor-pointer",2,"font-size","12px",3,"click"],["type","text","placeholder","Assign Customer",3,"click","formControl","matAutocomplete"],[3,"displayWith"],[3,"value"],["matTooltipPosition","left","matTooltip","Open Customer Details",1,"fa-regular","fa-arrow-up-right-from-square","position-absolute"],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"ms-3","text-wrap","text-break",3,"ngClass","title"],["matTooltipPosition","left","matTooltip","Open Customer Details",1,"fa-regular","fa-arrow-up-right-from-square","position-absolute",3,"click"]],template:function(t,n){if(t&1&&(r(0,"div",1)(1,"i",2),p("click",function(){return n.onCreateCustomer()}),a(),r(2,"input",3),p("click",function(){return n.onClickInputValue()}),a(),r(3,"mat-autocomplete",4,0),ue(5,vi,5,7,"mat-option",5,pe),v(7,"async"),a(),C(8,yi,1,0,"i",6),a()),t&2){let i=Xe(4);c(2),u("formControl",n.customerCtrl)("matAutocomplete",i),c(),u("displayWith",n.displayFn),c(2),ge(h(7,4,n.customerFiltered$)),c(3),f(n.customerCtrl&&(n.customerCtrl!=null&&n.customerCtrl.value)&&(!(n.customerCtrl==null||n.customerCtrl.value==null)&&n.customerCtrl.value.Key)?8:-1)}},dependencies:[A,ee,dn,sn,tn,mn,Ne,te,J,ke,rt,ot,ct,Oe],styles:["input[_ngcontent-%COMP%]{width:100%;height:38px!important;border-radius:.375rem;border:1px solid #ced4da;padding-left:32px;padding-right:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i.fa-user-plus[_ngcontent-%COMP%]{font-size:16px;top:12px;left:11px}.text-custom-warning[_ngcontent-%COMP%]{color:#ff7a00d6}i.fa-arrow-up-right-from-square[_ngcontent-%COMP%]{position:absolute;right:13px;top:50%;transform:translateY(-50%);font-size:12px;z-index:2;cursor:pointer}"],changeDetection:0})};var Ge=class o{storeService=d(D);dialog=d(oe);httpService=d(G);createNewCustomer(){this.dialog.open(In,{data:{options:this.storeService.loadForm()?.EstimateOptions,config:this.storeService.loadForm()?.AppConfigJSON?.ModuleContact,type:"customer",title:"New Customer Form"}}).afterClosed().pipe(T(e=>g.IsNotEmpty(e))).subscribe(e=>{let t=new re;t.Key=e.CustomerID,t.Value=e.ContactName,this.storeService.updateCustomer(t)})}onSelectCustomer(e){let t=this.storeService.outlet();this.httpService.get(L.GetCustomerPrivilegeByID,[{key:"ID",value:e.Key},{key:"EntityID",value:t.ID}]).pipe(Ft(()=>{let n=new re;return this.storeService.updateCustomer(n),At})).subscribe(n=>{let i=JSON.parse(JSON.stringify(e));i.PricebookID=n.PricebookID,this.storeService.updateCustomer(i)})}onDeleteCustomer(){g.IsNotEmpty(this.storeService?.customer()?.Key)&&this.dialog.open(Pn,{data:{title:"Re-assign customer",message:"Are you sure to re-assign the customer?"}}).afterClosed().pipe(T(e=>e)).subscribe(()=>{let e=new re;this.storeService.updateCustomer(e)})}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var yt=class o{onClickEvent=B();onClick(){this.onClickEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["app-note-button"]],outputs:{onClickEvent:"onClickEvent"},decls:2,vars:0,consts:[["type","button",1,"btn","btn-gray","w-100","fs-3","px-0","py-6","headings-font-family",3,"click"],[1,"fa-regular","fa-note-sticky","fa-xl"]],template:function(t,n){t&1&&(Z(0,"button",0),Pe("click",function(){return n.onClick()}),Ht(1,"i",1),ce())},styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"],changeDetection:0})};function hi(o,e){if(o&1&&(Z(0,"div"),s(1),v(2,"number"),ce()),o&2){let t=m();c(),x(" ",h(2,1,t.totalAmount())," ")}}function xi(o,e){o&1&&s(0," - ")}var ht=class o{payEvent=B();totalItems=be(0);totalQuantity=be(0);totalAmount=be(0);rolePrice=be(!0);constructor(){}ngOnInit(){}onPay(){this.payEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["app-pay-button"]],inputs:{totalItems:[1,"totalItems"],totalQuantity:[1,"totalQuantity"],totalAmount:[1,"totalAmount"],rolePrice:[1,"rolePrice"]},outputs:{payEvent:"payEvent"},decls:10,vars:5,consts:[["type","button",1,"btn","btn-success","fs-1","py-4","w-100",3,"click"],[1,"d-flex","align-items-center","justify-content-between"],[1,"fs-6"]],template:function(t,n){t&1&&(Z(0,"button",0),Pe("click",function(){return n.onPay()}),Z(1,"div",1)(2,"div")(3,"span"),s(4,"Submit"),ce(),Z(5,"small",2),s(6),v(7,"number"),ce()(),C(8,hi,3,3,"div")(9,xi,1,0),ce()()),t&2&&(c(6),Ie(" (",h(7,3,n.totalItems())," Items & ",n.totalQuantity()," Qty) "),c(2),f(n.rolePrice()?8:9))},dependencies:[A,z],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0;position:relative;flex:1 1 auto;border-left:.1px solid #fff}"],changeDetection:0})};var xt=class o{onClickEvent=B();onClick(){this.onClickEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["app-discount-button"]],outputs:{onClickEvent:"onClickEvent"},decls:2,vars:0,consts:[["type","button","matTooltip","Discount / Tax","matTooltipPosition","above",1,"btn","btn-success","fs-5",3,"click"],[1,"fa-light","fa-percent"]],template:function(t,n){t&1&&(r(0,"button",0),p("click",function(){return n.onClick()}),I(1,"i",1),a())},dependencies:[rt,ot],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;border-top-right-radius:0;border-bottom-right-radius:0;position:relative;flex:1 1 auto}"],changeDetection:0})};var Qe=class o{store=d(D);toastr=d(nt);dialog=d(oe);_backEndService=d(un);updateState$=R(this.store.complete).pipe(T(e=>e.Success),w(()=>this.store.updateState(3)),N());constructor(){this.updateState$.subscribe()}onPay(){if(this.validatePayOrder()==!1)return;let t={Items:this.cartItemPreSubmission(),Order:O({},this.store.order())};this._backEndService.submitTransaction(t,L.SubmitEstimate).subscribe(n=>{this.store.updateComplete(n)})}cartItemPreSubmission(){let e=JSON.parse(JSON.stringify(this.store.cartItems()));return e=e.map(t=>(delete t.Variant,t)),e}validatePayOrder(){let e=!0;return g.IsEmpty(this.store.outlet().ID)&&(this.toastr.error("Please select outlet before proceeding..",De.Error),e=!1),g.IsEmpty(this.store.customer().Key)&&(this.toastr.warning("Please select a customer!",De.Warning),e=!1),this.store.cartItems().length==0&&(this.toastr.error("You must have at least one item.",De.Error),e=!1),g.IsEmpty(this.store.order().Number)&&(this.toastr.error("Number cannot be empty.",De.Error),e=!1),e}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var St=class o{constructor(e,t){this.dialogRef=t;this.discountAmount.set(e.discountAmount),this.discount.set(e.discount),this.tax=S(e.tax),this.currency=S(e.currency),this.taxes.set(e.taxes),this.initModalConfig()}dialogRef;modalConfig=S(new Ae);discountAmount=S(0);discount=S(0);tax=S(null);discounts=S([0,0,0]);currency=S(null);taxes=S([]);initModalConfig(){this.modalConfig.update(e=>le(O({},e),{title:"Discount and Tax",customWidth:"400px"}))}onClose(){this.dialogRef.close()}onSave(){this.dialogRef.close({discountAmount:this.discountAmount(),discount:this.discount(),tax:this.tax()})}onSelectTax(e){this.tax.set(e)}onDiscountCalculatorChange(e,t){let n=this.discounts();n[t]=e,this.discounts.set(n),this.calculateDiscountCalculator()}calculateDiscountCalculator(){let e=this.discounts(),t=100;e.forEach(i=>{i&&i>0&&(t=t*(100-i)/100)});let n=100-t;this.discount.set(n)}static \u0275fac=function(t){return new(t||o)(X(Re),X(Fe))};static \u0275cmp=P({type:o,selectors:[["app-dialog-discount"]],decls:48,vars:10,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],["matTooltipPosition","above","matTooltip","Discount","tabTitle","Discount"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-3"],[1,"fw-bold","d-block"],[1,"col-9"],["type","text","data-cy","discount1","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],[1,"ms-1"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],["type","text","data-cy","discountamount","autoNum","",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],["matTooltipPosition","above","matTooltip","Tax","tabTitle","Tax"],["bindLabel","Label","appendTo","body","bindValue","ID","placeholder","Tax","data-cy","Tax",2,"width","150px",3,"change","clearable","ngModel","items"],["matTooltipPosition","above","matTooltip","Calculation","tabTitle","Calculator"],[1,"row","mt-6","g-0","d-flex","align-items-center","justify-content-start"],[1,"col-4"],[1,"col-8","ps-4"],["type","text","data-cy","discountCal1","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"mx-2"],["type","text","data-cy","discountCal2","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal3","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"]],template:function(t,n){if(t&1&&(r(0,"modal-material",0),p("keydown.F2",function(){return n.onSave()})("onOk",function(){return n.onSave()})("onCancel",function(){return n.onClose()})("onClose",function(){return n.onClose()}),r(1,"content")(2,"div",1)(3,"custom-tabs"),Ce(4),r(5,"tab",2)(6,"div",3)(7,"div",4)(8,"label",5),s(9,"Discount %"),a()(),r(10,"div",6)(11,"input",7),Q("ngModelChange",function(l){return j(n.discount,l)||(n.discount=l),l}),a(),r(12,"span",8),s(13,"%"),a()()(),r(14,"div",9)(15,"div",4)(16,"label",5),s(17),a()(),r(18,"div",6)(19,"input",10),Q("ngModelChange",function(l){return j(n.discountAmount,l)||(n.discountAmount=l),l}),a()()()(),fe(),Ce(20),r(21,"tab",11)(22,"div",3)(23,"div",4)(24,"label",5),s(25,"Tax"),a()(),r(26,"div",6)(27,"ng-select",12),p("change",function(l){return n.onSelectTax(l)}),a()()()(),fe(),Ce(28),r(29,"tab",13)(30,"div",14)(31,"div",15)(32,"label",5),s(33,"Discount Calculator"),a()(),r(34,"div",16)(35,"input",17),p("ngModelChange",function(l){return n.onDiscountCalculatorChange(l,0)}),a(),r(36,"span"),s(37," %"),a(),r(38,"span",18),s(39,"+"),a(),r(40,"input",19),p("ngModelChange",function(l){return n.onDiscountCalculatorChange(l,1)}),a(),r(41,"span"),s(42," %"),a(),r(43,"span",18),s(44,"+"),a(),r(45,"input",20),p("ngModelChange",function(l){return n.onDiscountCalculatorChange(l,2)}),a(),r(46,"span"),s(47," %"),a()()()(),fe(),a()()()()),t&2){let i,l;u("config",n.modalConfig()),c(11),U("ngModel",n.discount),c(6),x(" Discount ",(i=n.currency())==null?null:i.Symbol," "),c(2),U("ngModel",n.discountAmount),c(8),u("clearable",!1)("ngModel",(l=n.tax())==null?null:l.ID)("items",n.taxes()),c(8),u("ngModel",n.discounts()[0]),c(5),u("ngModel",n.discounts()[1]),c(5),u("ngModel",n.discounts()[2])}},dependencies:[A,Ve,st,dt,mt,ie,te,J,ne,Be,ve],encapsulation:2,changeDetection:0})};var Se=class o{storeService=d(D);totalItemsQty=q(()=>this.storeService.cartItems().reduce((n,i)=>n+i.Quantity,0));totalItemsAmount=q(()=>this.storeService.cartItems().reduce((n,i)=>n+i.Total,0));taxAmount=q(()=>{let e=this.storeService.tax(),t=0;return e.Rate>0&&(e.CalculationTypeID==1?t=this.calculateTaxInclude(e):t=this.calculateTaxAdd(e)),t});totalAmount=q(()=>{let e=this.storeService.tax(),t=this.storeService.order().DiscountAmount,n=this.storeService.order().Discount,i=this.totalItemsAmount(),l=this.calculatePercentagDisc(n,i),y=i-t-l;return e.CalculationTypeID==0&&(y=y+this.taxAmount()),y});discountPercentageAmount=q(()=>{let e=this.storeService.order().Discount,t=this.totalItemsAmount();return this.calculatePercentagDisc(e,t)});calculateTaxInclude(e){let t=this.grossTotalTaxable();return e.Rate/(100+e.Rate)*t}calculateTaxAdd(e){let t=this.grossTotalTaxable();return e.Rate/100*t}grossTotalTaxable(){let e=this.taxableItems(),t=this.calculateTaxableItemsPrice(),n=this.storeService.discount();if(e.length!==0){let i=this.calculateDiscountTaxableItem();t=t*(100-n.discount)/100,t=t-i}return t}calculateDiscountTaxableItem(){let e=this.taxableItems(),t=this.totalItemsAmount(),n=this.storeService.discount().discountAmount,i=0,l=0,y=0,M=0;for(let W of e)i=W.getItemAfterDiscount/t,l=i*n,M=l*W.Quantity,y+=M;return y}calculatePercentagDisc(e,t){return e/100*t}calculateTaxableItemsPrice(){return this.taxableItems().filter(n=>n.Taxable).reduce((n,i)=>n+i.Total,0)}taxableItems(){return this.storeService.cartItems().filter(t=>t.Taxable)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Di=o=>({selected:o});function Mi(o,e){if(o&1){let t=V();r(0,"div",9)(1,"span",14),s(2,"@"),a(),r(3,"input",15),Q("ngModelChange",function(i){b(t);let l=m();return j(l.currency().ExchangeRate,i)||(l.currency().ExchangeRate=i),_(i)}),a()()}if(o&2){let t=m();c(3),U("ngModel",t.currency().ExchangeRate)}}function Pi(o,e){if(o&1){let t=V();r(0,"div",13)(1,"label",16)(2,"input",17),p("ngModelChange",function(){let i=b(t).$implicit,l=m();return _(l.onChangeTag(i.ID))}),a(),s(3),a()()}if(o&2){let t,n=e.$implicit,i=e.$index,l=m();c(),u("for",Et("potype-"+i))("ngClass",$(7,Di,((t=l.tag())==null?null:t.ID)==n.ID)),c(),u("id",Et("potype-"+i))("ngModel",l.tag().ID),c(),x(" ",n.Name," ")}}var It=class o{constructor(e,t){this.dialogRef=t;this.initModalConfig(),this.currencies.set(e.currencies),this.note.set(e.note),this.tags.set(e.tags),this.tag=S(e.tag),this.currency=S(e.currency),this.defaultCurrencyId=S(e.defaultCurrencyId)}dialogRef;modalConfig=S(new Ae);currencies=S([]);tags=S([]);tag;currency;defaultCurrencyId;note=S("");initModalConfig(){this.modalConfig.update(e=>le(O({},e),{title:"Order Note",customWidth:"700px"}))}onChangeCurrency(e){let t=this.currencies()?.find(n=>n.ID===e);this.currency.set(t)}onChangeTag(e){let t=this.tags()?.find(n=>n.ID===e);this.tag.set(t)}onClose(){this.dialogRef.close()}onSave(){this.dialogRef.close({currency:this.currency(),tag:this.tag(),note:this.note()})}static \u0275fac=function(t){return new(t||o)(X(Re),X(Fe))};static \u0275cmp=P({type:o,selectors:[["app-dialog-note"]],decls:20,vars:6,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],["matTooltipPosition","above","matTooltip","Notes","tabTitle","Notes"],[3,"ngModelChange","ngModel"],["matTooltipPosition","above","matTooltip","Currency","tabTitle","Currency"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],[1,"row","ms-4"],[1,"ps-0","col-sm-4"],["bindLabel","Name","bindValue","ID","placeholder","Currency","appendTo","body",3,"ngModelChange","items","clearable","ngModel"],[1,"col-sm-4","d-flex"],["matTooltipPosition","above","matTooltip","Tag","tabTitle","Tag"],[1,"row"],[1,"col-12"],[1,"rad-btn"],[1,"pt-4"],["type","text","autoNum","",1,"border","border-light",3,"ngModelChange","ngModel"],[3,"for","ngClass"],["type","radio",3,"ngModelChange","ngModel","id"]],template:function(t,n){if(t&1&&(r(0,"modal-material",0),p("keydown.F2",function(){return n.onSave()})("onOk",function(){return n.onSave()})("onCancel",function(){return n.onClose()})("onClose",function(){return n.onClose()}),r(1,"content")(2,"div",1)(3,"custom-tabs"),Ce(4),r(5,"tab",2)(6,"POS-tinymce-editor",3),Q("ngModelChange",function(l){return j(n.note,l)||(n.note=l),l}),a()(),fe(),Ce(7),r(8,"tab",4)(9,"div",5)(10,"div",6)(11,"div",7)(12,"ng-select",8),p("ngModelChange",function(l){return n.onChangeCurrency(l)}),a()(),C(13,Mi,4,1,"div",9),a()()(),fe(),Ce(14),r(15,"tab",10)(16,"div",11)(17,"div",12),ue(18,Pi,4,9,"div",13,pe),a()()(),fe(),a()()()()),t&2){let i;u("config",n.modalConfig()),c(6),U("ngModel",n.note),c(6),u("items",n.currencies())("clearable",!1)("ngModel",n.currency().ID),c(),f(((i=n.currency())==null?null:i.ID)!=n.defaultCurrencyId()?13:-1),c(5),ge(n.tags())}},dependencies:[A,ee,Ve,st,dt,mt,ie,te,Zt,J,ne,Be,ve,lt],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}.rad-btn[_ngcontent-%COMP%]{position:relative;display:inline-block}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #dddddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label.selected[_ngcontent-%COMP%]{background:#dcdcdc;border:1px solid #dcdcdc}"],changeDetection:0})};var Dt=class o{onClickEvent=B();constructor(){}ngOnInit(){}onClick(){this.onClickEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["app-clear-button"]],outputs:{onClickEvent:"onClickEvent"},decls:3,vars:0,consts:[["type","button",1,"btn","btn-gray","w-100","fs-3","px-0","py-6","headings-font-family",3,"click"]],template:function(t,n){t&1&&(Z(0,"button",0),Pe("click",function(){return n.onClick()}),Z(1,"span"),s(2,"Clear"),ce()())},styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"],changeDetection:0})};function Ti(o,e){if(o&1&&(r(0,"tr")(1,"th",11),s(2,"Amount"),a(),r(3,"td",12),s(4),v(5,"number"),a()()),o&2){let t=m();c(4),F(h(5,1,t.calculationService==null?null:t.calculationService.totalItemsAmount()))}}function Oi(o,e){if(o&1&&(r(0,"tr")(1,"th",11),s(2),a(),r(3,"td",13),s(4),v(5,"number"),a()()),o&2){let t=m(2);c(2),x("Discount ",t.storeService==null?null:t.storeService.discount().discount,"%"),c(2),x(" ",h(5,2,t.calculationService.discountPercentageAmount()*-1))}}function Ei(o,e){if(o&1&&(r(0,"tr")(1,"th",11),s(2),a(),r(3,"td",13),s(4),v(5,"number"),a()()),o&2){let t,n,i=m(2);c(2),x("Discount ",(t=i.storeService.currency())==null?null:t.Symbol),c(2),x(" ",h(5,2,((n=i.storeService.discount())==null?null:n.discountAmount)*-1))}}function wi(o,e){if(o&1&&(r(0,"tr")(1,"th",11),s(2),a(),r(3,"td",12),s(4),v(5,"number"),a()()),o&2){let t,n=m(2);c(2),F((t=n.storeService.tax())==null?null:t.Label),c(2),F(h(5,2,n.calculationService.taxAmount()))}}function ki(o,e){if(o&1&&(C(0,Oi,6,4,"tr"),C(1,Ei,6,4,"tr"),C(2,wi,6,4,"tr")),o&2){let t,n,i=m();f(i.storeService.discount().discount!=0?0:-1),c(),f(((t=i.storeService.discount())==null?null:t.discountAmount)!=0?1:-1),c(),f(((n=i.storeService.tax())==null?null:n.Rate)!=0?2:-1)}}var Mt=class o{storeService=d(D);orderService=d(se);roleService=d(_e);payService=d(Qe);calculationService=d(Se);cartService=d(me);dialog=d(oe);taxCalculationType=at;totalItemsQty=q(()=>this.storeService.cartItems()?.length);isShowAmount=q(()=>this.storeService?.tax()?.CalculationTypeID==0&&this.storeService?.tax()?.Rate||this.storeService.discount()?.discount!=0||this.storeService.discount()?.discountAmount!=0);onOpenDialogNote(){this.dialog.open(It,{data:{tags:this.storeService.loadForm().SalesOrderTags,currencies:this.storeService.loadForm().Currencies,currency:this.storeService.currency(),tag:this.storeService.tag(),defaultCurrencyId:this.storeService.loadForm()?.AppConfigJSON?.CoreDefaults?.CurrencyID,note:this.storeService.order().Note}}).afterClosed().pipe(T(e=>g.IsNotEmpty(e))).subscribe(e=>{this.storeService.updateCurrency(e.currency),this.storeService.updateTag(e.tag),this.storeService.updateOrder(le(O({},this.storeService.order()),{Note:e.note}))})}onOpenDialogDiscount(){this.dialog.open(St,{data:{discountAmount:this.storeService.order().DiscountAmount,discount:this.storeService.order().Discount,tax:this.storeService.tax(),currency:this.storeService.currency(),taxes:this.storeService.loadForm().Taxes}}).afterClosed().pipe(T(e=>g.IsNotEmpty(e))).subscribe(e=>{this.storeService.updateDiscount({discountAmount:e.discountAmount,discount:e.discount}),this.storeService.updateTax(e.tax)})}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["POS-cart-action"]],decls:13,vars:6,consts:[[1,"row","g-0","px-5","justify-content-end"],[1,"col-6",2,"padding-right","15px"],[1,"table","table-borderless"],[1,"row","g-0","pb-6","px-5"],[1,"col-5","d-flex","justify-content-between","pe-5",2,"column-gap","12px"],[2,"flex-grow","1",3,"onClickEvent"],[2,"flex-grow","3",3,"onClickEvent"],[1,"col-7"],[1,"btn-group","w-100"],[1,"d-inline-flex",3,"onClickEvent"],[1,"d-inline-flex","w-100",3,"payEvent","rolePrice","totalQuantity","totalItems","totalAmount"],[1,"text-start"],[1,"text-end","fs-5"],[1,"text-end","fs-5","text-danger"]],template:function(t,n){t&1&&(r(0,"div",0)(1,"div",1)(2,"table",2),C(3,Ti,6,3,"tr"),C(4,ki,3,3),a()()(),r(5,"div",3)(6,"div",4)(7,"app-note-button",5),p("onClickEvent",function(){return n.onOpenDialogNote()}),a(),r(8,"app-clear-button",6),p("onClickEvent",function(){return n.cartService.clearCart()}),a()(),r(9,"div",7)(10,"div",8)(11,"app-discount-button",9),p("onClickEvent",function(){return n.onOpenDialogDiscount()}),a(),r(12,"app-pay-button",10),p("payEvent",function(){return n.payService.onPay()}),a()()()()),t&2&&(c(3),f(n.isShowAmount()?3:-1),c(),f(n.calculationService.totalItemsQty()>0?4:-1),c(8),u("rolePrice",n.roleService.product.Price)("totalQuantity",n.calculationService.totalItemsQty())("totalItems",n.totalItemsQty())("totalAmount",n.calculationService.totalAmount()))},dependencies:[A,xt,yt,ht,Dt,z],encapsulation:2,changeDetection:0})};var Bn=o=>({ID:o}),Ni=()=>["/menu/Orders/Orders/Estimate/Info"],Ai=o=>({"border-top":o});function Vi(o,e){if(o&1&&(r(0,"div",23)(1,"div",28),s(2),a(),r(3,"div",28),s(4),v(5,"number"),a()()),o&2){let t=e.$implicit;c(2),F(t.Name),c(2),x("",h(5,2,t.Total)," ")}}function Fi(o,e){if(o&1&&(r(0,"div",24)(1,"div",29),s(2),a(),r(3,"div",29),s(4),v(5,"number"),a()()),o&2){let t,n=m();c(2),x("Amount: ",(t=n.storeService.currency())==null?null:t.Symbol),c(2),F(h(5,2,n.calculationService.totalItemsAmount()))}}function Ri(o,e){if(o&1&&(r(0,"div",25)(1,"div",29),s(2),v(3,"number"),a(),r(4,"div",30),s(5),v(6,"number"),a()()),o&2){let t,n=m();c(2),Ie("","Discount "+h(3,3,(t=n.storeService.discount())==null?null:t.discount)+" %",": ",(t=n.storeService.currency())==null?null:t.Symbol),c(3),F(h(6,5,n.calculationService.discountPercentageAmount()*-1))}}function Bi(o,e){if(o&1&&(r(0,"div",25)(1,"div",29),s(2),a(),r(3,"div",30),s(4),v(5,"number"),a()()),o&2){let t,n,i=m();c(2),x("Discount: ",(t=i.storeService.currency())==null?null:t.Symbol),c(2),x("",h(5,2,((n=i.storeService.discount())==null?null:n.discountAmount)*-1)," ")}}function Ui(o,e){if(o&1&&(r(0,"div",25)(1,"div",29),s(2),a(),r(3,"div",29),s(4),v(5,"number"),a()()),o&2){let t,n=m();c(2),Ie("",(t=n.storeService.tax())==null?null:t.Label,": ",(t=n.storeService.currency())==null?null:t.Symbol),c(2),F(h(5,3,n.calculationService.taxAmount()))}}var Pt=class o{orderService=d(se);calculationService=d(Se);storeService=d(D);isShowAmount=q(()=>this.storeService?.tax()?.CalculationTypeID==0&&this.storeService?.tax()?.Rate||this.storeService.discount()?.discount!=0||this.storeService.discount()?.discountAmount!=0);handleF8(){this.orderService.newOrder()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["POS-complete"]],hostBindings:function(t,n){t&1&&p("keydown.F8",function(){return n.handleF8()},Ye)},decls:41,vars:20,consts:[[1,"pt-7",2,"border-bottom","1px solid rgba(0, 0, 0, 0.1)"],[1,"ps-7","fw-normal","pb-9"],[1,"order-complete"],[1,"container-fluid","pt-8"],[1,"row"],[1,"col-8"],[1,"card"],[1,"card-header",2,"padding-bottom","15px"],[1,"fw-normal",2,"font-size","32px"],[1,"fa-solid","fa-check","me-3"],[1,"card-body"],[1,"row",2,"height","115px"],[1,"col","text-center","my-auto"],[1,"btn","btn-success","w-50",2,"font-size","20px",3,"click"],[1,"card-footer"],[1,"d-flex","justify-content-between","my-6"],["target","_blank","routerLink","/print/Estimate",1,"btn","bg-light-gray","btn-secondary",3,"queryParams"],[1,"fa-solid","fa-print","me-2"],[1,"col-4"],[1,"card-header","bg-light-gray",2,"padding-bottom","15px"],[1,"fst-italic"],["target","_blank",3,"routerLink","queryParams"],[1,"card-body","py-4"],[1,"row","justify-content-between","border-bottom","py-2"],[1,"row","justify-content-end","mt-2","pb-2"],[1,"row","justify-content-end","pb-2"],[1,"row","justify-content-end","pt-4",3,"ngClass"],[1,"col-4","text-end","h5"],[1,"col","text-end"],[1,"col-4","text-end"],[1,"col-4","text-end","text-danger"]],template:function(t,n){if(t&1&&(r(0,"div",0)(1,"h1",1),s(2,"Estimate"),a()(),r(3,"section",2)(4,"div",3)(5,"div",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"h1",8),I(10,"i",9),s(11,"Order Complete "),a()(),r(12,"div",10)(13,"div",11)(14,"div",12)(15,"a",13),p("click",function(){return n.orderService.newOrder()}),s(16,"New Order (F8)"),a()()()(),r(17,"div",14)(18,"div",15)(19,"a",16),I(20,"i",17),s(21,"Print Receipt"),a()()()()(),r(22,"div",18)(23,"div",6)(24,"div",19)(25,"h3",20)(26,"a",21),s(27),a()()(),r(28,"div",22),ue(29,Vi,6,4,"div",23,pe),C(31,Fi,6,4,"div",24),C(32,Ri,7,7,"div",25),C(33,Bi,6,4,"div",25),C(34,Ui,6,5,"div",25),r(35,"div",26)(36,"div",27),s(37),a(),r(38,"div",27),s(39),v(40,"number"),a()()()()()()()()),t&2){let i,l,y,M,W;c(19),u("queryParams",$(13,Bn,n.storeService.complete().OrderID)),c(7),u("routerLink",Ze(15,Ni))("queryParams",$(16,Bn,n.storeService.complete().OrderID)),c(),x("Estimate #",(i=n.storeService.complete())==null?null:i.InvoiceNumber),c(2),ge(n.storeService.cartItems()),c(2),f(n.isShowAmount()?31:-1),c(),f(((l=n.storeService.discount())==null?null:l.discount)>0?32:-1),c(),f(((y=n.storeService.discount())==null?null:y.discountAmount)>0?33:-1),c(),f(((M=n.storeService.tax())==null?null:M.Rate)>0?34:-1),c(),u("ngClass",$(18,Ai,n.isShowAmount())),c(2),x("Total: ",(W=n.storeService.currency())==null?null:W.Symbol),c(2),F(h(40,11,n.calculationService.totalAmount()))}},dependencies:[A,ee,tt,et,pn,z],styles:[".order-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%]{border-bottom:1px solid rgba(0,0,0,.125);padding-bottom:.9375rem}.order-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:2rem}.order-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%] .container[_ngcontent-%COMP%]{max-width:500px;margin-top:30px;margin-bottom:30px}"],changeDetection:0})};var Tt=class o{route=d(Ee);dialog=d(oe);addItem=new Lt;handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.onAddItem()}onAddItem(){this.addItem.emit()}redirectToPrevious(){this.route.navigate(["/menu/Estimate/V1"])}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["POS-more-action"]],hostBindings:function(t,n){t&1&&p("keydown.F4",function(){return n.handleF8()},Ye)},outputs:{addItem:"onAddItem"},decls:14,vars:0,consts:[["id","moreMenu","data-bs-toggle","dropdown",1,"d-flex","align-items-center","cursor-pointer"],[1,"me-2"],[1,"fa-solid","fa-caret-down","fa-lg"],[1,"fs-6","headings-font-family","pb-1"],[1,"h-100","d-flex","align-items-center","justify-content-between"],["aria-labelledby","moreMenu",1,"dropdown-menu","more-actions"],[1,"d-flex"],[1,"dropdown-header","text-dark","col"],[1,"h5","mb-4"],[1,"dropdown-divider","m-0"],[1,"cursor-pointer",3,"click"],["icon","fa-circle-plus fa-solid","label","Add New"]],template:function(t,n){t&1&&(r(0,"span",0)(1,"span",1),I(2,"i",2),a(),r(3,"span",3),s(4,"More Actions"),a()(),r(5,"div",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"div",8),s(10,"Item"),a(),I(11,"div",9),r(12,"li",10),p("click",function(){return n.onAddItem()}),I(13,"POS-dropdown-item-more-action",11),a()()()()())},dependencies:[Nn],encapsulation:2,changeDetection:0})};function ji(o,e){o&1&&I(0,"POS-complete")}function Qi(o,e){if(o&1){let t=V();r(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4)(4,"div",5)(5,"POS-select-outlet-form",6),v(6,"async"),p("ngModelChange",function(i){b(t);let l=m();return _(l.outletService.updateOutlet(i))}),a()(),r(7,"POS-invoice-number-form",7),v(8,"async"),p("ngModelChange",function(i){b(t);let l=m();return _(l.orderService.updateOrderNumber(i))}),a(),r(9,"POS-invoice-date",8),p("ngModelChange",function(i){b(t);let l=m();return _(l.orderService.updateOrderDate(i))}),a()()(),r(10,"div",9)(11,"div",10)(12,"div",11)(13,"POS-more-action",12),p("onAddItem",function(){b(t);let i=m();return _(i.cartItemService.onOpenAddDialog())}),a()(),r(14,"div",13)(15,"ng-select-infinite",14,0),v(17,"async"),p("selectedChange",function(i){b(t);let l=m();return _(l.orderService.updateSalesPersonId(i))}),a()()()()(),r(18,"div",15)(19,"div",16)(20,"POS-quick-key",17),v(21,"async"),p("onSelectVariant",function(i){b(t);let l=m();return _(l.cartItemService.onSelectQuickkeyItem(i))}),a()(),r(22,"div",18)(23,"div",19)(24,"div",20),I(25,"POS-variant-autocomplete",21),a(),r(26,"div",13)(27,"POS-customer-autocomplete",22),p("createNewCustomer",function(){b(t);let i=m();return _(i.customerService.createNewCustomer())})("ngModelChange",function(i){b(t);let l=m();return _(l.customerService.onSelectCustomer(i))})("clickInput",function(){b(t);let i=m();return _(i.customerService.onDeleteCustomer())}),a()()(),r(28,"POS-cart-display",23),v(29,"async"),p("onRemove",function(i){b(t);let l=m();return _(l.cartItemService.removeCartItem(i))})("onEdit",function(i){b(t);let l=m();return _(l.cartItemService.onOpenEditDialog(i))})("onDropItems",function(i){b(t);let l=m();return _(l.cartItemService.onDropItems(i))})("onPurchase",function(i){b(t);let l=m();return _(l.cartItemService.onPurchaseItem(i))})("onReturn",function(i){b(t);let l=m();return _(l.cartItemService.onReturnItem(i))}),a(),I(30,"POS-cart-action"),a()()()}if(o&2){let t,n=m();c(5),u("ngModel",n.storeService.outlet())("outlets",n.storeService.loadForm().Entities)("isOpenAfterLoad",h(6,18,n.outletService.isOpenDialog$)),c(2),u("ngModel",h(8,20,n.orderService.orderNumber$))("isEdit",n.isEditOrder()),c(2),u("ngModel",n.storeService.order().Date)("disabled",!(!(n.role==null||n.role.global==null)&&n.role.global.Date))("tooltip",!(n.role==null||n.role.global==null)&&n.role.global.Date?"":"Date role is required"),c(6),u("clearable",!0)("optionTitle",!0)("items",h(17,22,n.orderService.salesPersons$))("selected",n.storeService.order().SalesID),c(5),u("quickKey",h(21,24,n.quickkeyService.quickkeys$))("outletID",n.storeService.outlet().ID),c(5),u("formControl",n.cartItemService.variantSearchCtrl),c(2),u("ngModel",n.storeService.customer()),c(),u("cartItems",h(29,26,n.cartItemService.cartItems$))("appConfig",(t=n.storeService.loadForm())==null?null:t.AppConfigJSON)}}var Un=class o extends ln{loadFormService=d(We);storeService=d(D);role=d(_e);outletService=d($e);orderService=d(se);quickkeyService=d(qe);cartItemService=d(me);customerService=d(Ge);intercomService=d(en);destroyRef=d(Qt);isCompleteOrder=q(()=>this.storeService.state()==3);isEditOrder=q(()=>this.storeService.state()==1);constructor(e){super(e),this.menuData$.pipe(N(this.destroyRef)).subscribe(),this.intercomService.hideLauncher()}ngOnDestroy(){this.intercomService.showLauncher()}static \u0275fac=function(t){return new(t||o)(X(cn))};static \u0275cmp=P({type:o,selectors:[["POS-estimate-v2"]],features:[Te([D,We,$e,se,qe,me,Ge,Qe,Se,ye,xe]),$t],decls:2,vars:1,consts:[["ngSelectInfinite",""],[1,"container-fluid"],[1,"row","header","border-bottom"],[1,"col-5","border-end"],[1,"left-toolbar-container","h-100","d-flex","align-items-center","justify-content-between"],[1,"d-flex"],[3,"ngModelChange","ngModel","outlets","isOpenAfterLoad"],["transactionType","Estimate",3,"ngModelChange","ngModel","isEdit"],[3,"ngModelChange","ngModel","disabled","tooltip"],[1,"col-7","d-flex","align-items-center"],[1,"row","flex-grow-1"],[1,"col-lg-7","col-5","d-flex","align-items-center"],[3,"onAddItem"],[1,"col-5","ps-0"],["bindValue","ID","bindLabel","Name","placeholder","Assign Sales Person",1,"sales-person","select-max-width",3,"selectedChange","clearable","optionTitle","items","selected"],[1,"row","content"],[1,"col-5","border-end","pt-1"],[3,"onSelectVariant","quickKey","outletID"],[1,"col-7","pt-5","px-0","d-flex","flex-column"],[1,"row","w-100","ms-0"],[1,"col-7","px-0"],[3,"formControl"],[3,"createNewCustomer","ngModelChange","clickInput","ngModel"],[1,"cart-display",3,"onRemove","onEdit","onDropItems","onPurchase","onReturn","cartItems","appConfig"]],template:function(t,n){t&1&&C(0,ji,1,0,"POS-complete")(1,Qi,31,28,"div",1),t&2&&f(n.isCompleteOrder()?0:1)},dependencies:[A,On,Ne,J,ke,En,ie,ne,_n,fn,wn,_t,vt,ct,pt,Mt,Pt,Tt,Oe],styles:["ng-select-infinite.sales-person.select-max-width>ng-select{padding-right:10px;height:38px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{font-size:.75rem;border:.5px solid #d7d7d7;padding-right:6px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-arrow-wrapper{width:12px;padding-bottom:2px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-value-container{padding-left:6px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{min-height:38px!important;height:38px!important;border:none} ng-select-infinite.sales-person.select-max-width.offline>.ng-select.ng-select-single .ng-select-container{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input{padding-left:5px!important} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input>input{padding-top:5px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single>ng-dropdown-panel.ng-dropdown-panel{font-size:.75rem;width:95%!important} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-focused .ng-select-container{box-shadow:none!important;border-color:transparent!important}.left-toolbar-container[_ngcontent-%COMP%]{position:relative}.left-toolbar-container[_ngcontent-%COMP%] POS-invoice-number-form[_ngcontent-%COMP%]{position:absolute;top:34px;left:32px}.header[_ngcontent-%COMP%]{min-height:60px}.content[_ngcontent-%COMP%]{min-height:calc(100vh - 60px)}.supplier-more-menu[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.cart-display[_ngcontent-%COMP%]{flex-grow:1;height:0px;overflow-y:auto}input[_ngcontent-%COMP%]{width:100%;height:38px!important;border:0;border-bottom:1px solid #ced4da;padding-left:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i[_ngcontent-%COMP%]{font-size:16px;top:10.6px;left:13px}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]{transition:.4s}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(1){-webkit-transform:rotate(-45deg) translate(-8px,4px);transform:rotate(-45deg) translate(-8px,4px)}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(2){opacity:0}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(3){-webkit-transform:rotate(45deg) translate(-5px,0px);transform:rotate(45deg) translate(-5px)}.mobile-button[_ngcontent-%COMP%]{display:none}@media(max-width:990px){.mobile-button[_ngcontent-%COMP%]{display:block}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.more-actions[_ngcontent-%COMP%] div.d-flex[_ngcontent-%COMP%]{width:30rem}"],changeDetection:0})};export{Un as EstimateV2Component};
1
+ import{a as Vn}from"./chunk-VOJLWM2C.js";import{a as pt}from"./chunk-5PHA4WZQ.js";import{a as wn,e as kn,f as Nn}from"./chunk-DK6ONJHH.js";import{a as On}from"./chunk-IO3KXPQJ.js";import{a as An}from"./chunk-WGF2DWRU.js";import{a as En}from"./chunk-ZD6GJKYE.js";import"./chunk-IVB7IRPI.js";import{a as un}from"./chunk-56EEOGR3.js";import{a as Tn}from"./chunk-HBAQBI6Z.js";import"./chunk-WIK4TZNX.js";import{b as In,c as ct}from"./chunk-KJQUPLA2.js";import{a as Pn}from"./chunk-CWCFOXYW.js";import{b as bn}from"./chunk-RJ2JHVQR.js";import{a as Dn,b as Mn}from"./chunk-A3ILIZ67.js";import{a as vn,b as yn,c as hn,d as Le,e as xn}from"./chunk-N5C5ZHMO.js";import"./chunk-NQX7EX5A.js";import{b as st,c as mt,d as dt}from"./chunk-IZ6Q3533.js";import{b as _n}from"./chunk-44KERJRQ.js";import{a as lt}from"./chunk-WEFCC4HB.js";import{a as Sn}from"./chunk-QYVLBMOX.js";import"./chunk-L6LVX24R.js";import{a as at,b as Cn}from"./chunk-S77FVPQM.js";import"./chunk-BN7VHFSY.js";import{c as gn}from"./chunk-I3WUTJXX.js";import"./chunk-C5TZZG4J.js";import"./chunk-DDLXGCOB.js";import{a as fn}from"./chunk-D6BLXBMN.js";import"./chunk-CXFPGQEQ.js";import"./chunk-X6YLB6XJ.js";import"./chunk-5UX75GPD.js";import"./chunk-YGCGJLGT.js";import"./chunk-EPA44ZP7.js";import"./chunk-OQGBLRIB.js";import"./chunk-NLPCJ6S7.js";import"./chunk-L2JJOSI2.js";import"./chunk-UJW36IT2.js";import"./chunk-K4GA7MPU.js";import"./chunk-U7MSEY2J.js";import{h as pn}from"./chunk-77WJ3EU6.js";import{a as ve}from"./chunk-B4JLXIEC.js";import{a as nn,d as on,f as rn,h as an}from"./chunk-RZ4WHN74.js";import"./chunk-5QQBII3Q.js";import{a as ln}from"./chunk-6HAO7FHW.js";import"./chunk-XL2ZP2VN.js";import{a as cn}from"./chunk-36USSIER.js";import"./chunk-XS4YRZDR.js";import"./chunk-VKEUSILH.js";import"./chunk-ER72CLR7.js";import{k as tn,o as sn,q as mn,r as dn}from"./chunk-NRO23IIB.js";import"./chunk-FPTMOFHU.js";import"./chunk-PZ32564R.js";import{a as ot,b as rt}from"./chunk-NBVEREBF.js";import"./chunk-PPMQE2JW.js";import"./chunk-SE73OGQM.js";import"./chunk-BGF4AJ6E.js";import{d as Be}from"./chunk-UGZHR6TH.js";import"./chunk-DLYZMRXG.js";import{a as Fe,b as Re,c as oe}from"./chunk-IUUNN5TF.js";import"./chunk-E6HRLULV.js";import"./chunk-Z3W63F6G.js";import"./chunk-5QKCGJTV.js";import"./chunk-QHSP67RW.js";import{a as N,b as R}from"./chunk-BMSUBRBS.js";import{a as L}from"./chunk-C7OXYN2X.js";import{a as De,b as Ae,c as Ve}from"./chunk-JATJNKS5.js";import"./chunk-5FOSDRT2.js";import"./chunk-2QP5NONI.js";import"./chunk-KTHJFSOM.js";import"./chunk-MTUBHLOV.js";import{F as ie,G as Ne,a as it,c as te,h as J,m as we,p as ne,s as Zt,t as ke}from"./chunk-LFSG3DBR.js";import"./chunk-ZDBFO3IO.js";import{a as en}from"./chunk-5PA2WWSJ.js";import"./chunk-G2RIVW3B.js";import{b as _e}from"./chunk-LNPJ2D7B.js";import{a as g}from"./chunk-PPTZHIIZ.js";import"./chunk-SHERPUSH.js";import{n as nt,q as G}from"./chunk-X6Z7MJUZ.js";import{$ as Y,$a as X,Ab as pe,B as Vt,Ba as S,Bb as ue,Cb as ge,D as T,Db as u,Eb as r,Fb as a,Fc as v,Gb as I,Gc as h,H as Ft,Hb as Z,Hc as wt,Ib as ce,Jb as Ht,Kb as Ce,L as Rt,Lb as fe,Na as Je,Nd as Xt,Oc as q,P as Bt,Pa as Ke,Pb as V,Pd as Ee,Qd as et,R as Ut,Sa as Ye,Sb as p,Sc as B,Sd as tt,Tb as Pe,Tc as be,Ua as c,Ub as m,Uc as Yt,V as jt,X as Me,ac as zt,bb as Wt,bc as Gt,cc as Xe,d as Nt,da as w,db as P,dc as Jt,hc as s,i as At,ib as $t,ic as F,id as ee,ja as k,jb as qt,jc as x,kc as Ie,l as Ot,mc as U,na as d,nc as j,oc as Q,od as Oe,r as de,ra as b,sa as _,sc as Et,sd as z,vd as A,wb as C,wc as Te,xa as Qt,xc as Ze,ya as Lt,yb as f,yc as $,zc as Kt}from"./chunk-VKQVNDWA.js";import{a as O,b as le}from"./chunk-NF7PG5F2.js";var ut=class{AppConfigJSON;Currencies;SalesOrderTags;Entities;Payments;Taxes;SalesPOTypes;EstimateOptions;Data};var Ue=class{CurrencyID;CustomerID;Date;Discount;DiscountAmount;EntityID;ID;Note;Number;SalesID;TaxTypeID;TypeID;constructor(){this.CustomerID=g.GuidEmpty,this.EntityID=g.GuidEmpty,this.ID=g.GuidEmpty,this.TaxTypeID=g.GuidEmpty,this.Discount=0,this.DiscountAmount=0,this.Date=new Date().toDateString(),this.Note=""}};var re=class{Email;Key;Mobile;Name;Phone;Value;PricebookID;StateID};var gt=class{ID;Index;Symbol;Name;ExchangeRate;ConversionSuggestion;ExchangeRateDate;ExchangeRateDateDisplay};var Ct=class{ID;Name;DueDays;BlockDays;Description;PrintTemplateID;AccountID};var ft=class{DeliveryID;InvoiceID;InvoiceNumber;Message;OrderID;PaymentStateID;PaymentStateLabel;PrintMode;Success};var D=class o{estimateState=An({loadForm:new ut,outlet:{Name:"",ID:g.GuidEmpty},order:new Ue,cartItems:[],customer:new re,tax:new Cn,currency:new gt,tag:new Ct,discount:{discountAmount:0,discount:0},state:0,complete:new ft});loadForm=this.estimateState.select(e=>Object.freeze(e.loadForm()));order=this.estimateState.select(e=>Object.freeze(e.order()));outlet=this.estimateState.select(e=>Object.freeze(e.outlet()));cartItems=this.estimateState.select(e=>Object.freeze(e.cartItems()));customer=this.estimateState.select(e=>Object.freeze(e.customer()));tax=this.estimateState.select(e=>Object.freeze(e.tax()));currency=this.estimateState.select(e=>Object.freeze(e.currency()));tag=this.estimateState.select(e=>Object.freeze(e.tag()));discount=this.estimateState.select(e=>Object.freeze(e.discount()));state=this.estimateState.select(e=>Object.freeze(e.state()));complete=this.estimateState.select(e=>Object.freeze(e.complete()));updateLoadForm(e){this.estimateState.update("loadForm",e)}updateOutlet(e){this.estimateState.update("outlet",e)}updateOrder(e){this.estimateState.update("order",e)}updateCartItems(e){this.estimateState.update("cartItems",e)}updateCustomer(e){this.estimateState.update("customer",e)}updateTax(e){this.estimateState.update("tax",e)}updateCurrency(e){this.estimateState.update("currency",e)}updateTag(e){this.estimateState.update("tag",e)}updateDiscount(e){this.estimateState.update("discount",e)}updateState(e){this.estimateState.update("state",e)}updateComplete(e){this.estimateState.update("complete",e)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var ae=class{ID;Name;Code;Cost;ThumbnailUrl;CouponDiscount;Discount;DiscountAmount;EntityID;Expense;InventoryTypeID;LoyaltyPoint;Note;PromotionGift;Quantity;UnitQuantity;SalesID;VariantID;VariantUnitQuantity;isMaxInventory;UOM;UOMName;UnitCost;UnitPrice;TypeID;Storage;Taxable;Price;Serial;PriceBookID;Variant;PriceTypeID;PriceNote;UnitPriceMinimum;get Total(){return this.Price*(this.Quantity*this.UnitQuantity)*((100-this.Discount)/100)}get getItemAfterDiscount(){let e=this.getDiscPercentagePerItem();return this.DiscountAmount<e?e-this.DiscountAmount:0}getDiscPercentagePerItem(){let e=this.UnitPrice;return this.Discount>0&&(e=(100-this.Discount)/100*this.UnitPrice),e}};var ye=class o{constructor(){}generateCartItem(e){let t=new ae;return t.Name=e.Name,t.ThumbnailUrl=e.ThumbnailUrl,t.Price=e.UnitPrice,t.UnitPrice=e.UnitPrice,t.UnitCost=e.UnitCost,t.UnitQuantity=e.UnitQuantity,t.Quantity=1,t.Code=e.Code,t.TypeID=e.TypeID,t.Discount=e.PriceDiscount,t.VariantUnitQuantity=e.VariantUnitQuantity,t.Storage=e.Storage,t.UOM=e.UOM,t.UOMName=e.UOMName,t.VariantID=e.ID,t.Taxable=e.Taxable,t.InventoryTypeID=e.TypeID,t.PriceTypeID=e.PriceTypeID,t.PriceNote=e.PriceNote,t.Variant=e,t.UnitPriceMinimum=e.UnitPriceMinimum,t}generateCartItemOnEdit(e){let t=new ae;return t.ID=e.ID,t.Name=e.Variant?.Name,t.ThumbnailUrl=e.Variant?.ThumbnailUrl,t.Price=e.Price,t.UnitPrice=e.Price,t.UnitCost=e.Cost,t.UnitQuantity=e.Variant?.UnitQuantity,t.Quantity=e.Quantity,t.Code=e.Variant?.Code,t.TypeID=e.Variant?.TypeID,t.Discount=e.Discount,t.VariantUnitQuantity=e.Variant?.VariantUnitQuantity,t.Storage=e.Variant?.Storage,t.UOM=e.Variant?.UOM,t.UOMName=e.Variant?.UOMName,t.VariantID=e.VariantID,t.Taxable=e.Taxable,t.Note=e.Note,t.Serial=e.Serial,t.InventoryTypeID=e.InventoryTypeID,t.PriceTypeID=e.PriceTypeID,t.Variant=e.Variant,t.PriceNote=e.PriceNote,t}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var We=class o{httpService=d(G);storeService=d(D);factoryService=d(ye);activatedRoute=d(Xt);getLoadForm$=this.activatedRoute.queryParams.pipe(Y(e=>this.httpService.post("/API/estimate/LoadForm",e)),w(e=>this.storeService.updateLoadForm(e)),w(e=>{g.IsNotEmpty(e.Data)?this.onEditOrder(e):(this.initDefaultCurrency(),this.initTag(),this.initTax())}),N());constructor(){this.getLoadForm$.subscribe()}onEditOrder(e){let t=e.Data,n=this.findTaxById(t.Order.TaxTypeID),i=this.findCurrencyById(t.Order.CurrencyID),l=this.findOutletById(t.Order.EntityID),y=this.findTagById(t.Order.TypeID),M=this.getCartItemsOnEdit(e);this.storeService.updateState(1),this.storeService.updateOrder(t.Order),this.storeService.updateCartItems(M),this.storeService.updateCustomer({Key:t.Order.CustomerID,Value:t.ContactName}),this.storeService.updateTax(n),this.storeService.updateCurrency(i),this.storeService.updateOutlet(l),this.storeService.updateDiscount({discount:t.Order.Discount,discountAmount:t.Order.DiscountAmount}),this.storeService.updateTag(y)}getCartItemsOnEdit(e){return e.Data.Items.map(i=>this.factoryService.generateCartItemOnEdit(i))}initDefaultCurrency(){let e=this.storeService.loadForm()?.AppConfigJSON?.CoreDefaults?.CurrencyID,t=this.storeService.loadForm()?.Currencies.find(n=>n.ID===e);this.storeService.updateCurrency(t)}initTag(){let e=this.storeService.loadForm()?.SalesOrderTags;this.storeService.updateTag(e[0])}initTax(){let e=this.storeService.loadForm()?.Taxes;this.storeService.updateTax(e[0])}findTaxById(e){return(this.storeService.loadForm()?.Taxes).find(i=>i.ID===e)}findCurrencyById(e){return(this.storeService.loadForm()?.Currencies).find(i=>i.ID===e)}findOutletById(e){return(this.storeService.loadForm()?.Entities).find(i=>i.ID===e)}findTagById(e){return(this.storeService.loadForm()?.SalesOrderTags).find(i=>i.ID===e)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var $e=class o{storeService=d(D);isOpenDialog$=R(this.storeService.loadForm).pipe(T(e=>g.IsNotEmpty(e.Entities)),de(()=>{let e=!1,t=this.storeService.state(),n=this.storeService.outlet();return(t==0||t==1)&&(e=g.IsEmpty(n.ID)),e}));updateOutlet(e){this.storeService.updateOutlet(e)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac,providedIn:"root"})};var se=class o{storeService=d(D);httpService=d(G);router=d(Ee);orderNumber$=R(this.storeService.outlet).pipe(T(e=>g.IsNotEmpty(e.ID)),Y(e=>{if(this.storeService.state()==0)return this.httpService.post(L.EstimateGenerateNumber,{ID:e.ID}).pipe(de(t=>t.Number));{let t=this.storeService.order().Number;return Ot(t)}}),w(e=>{this.storeService.state()==0&&this.updateOrderNumber(e)}),N());salesPersons$=R(this.storeService.outlet).pipe(Y(e=>g.IsNotEmpty(e.ID)?this.httpService.get(L.GetSalesPersonByOutletId,[{key:"ID",value:e.ID}]):Ot([])),Me(1));updateTagOrder$=R(this.storeService.tag).pipe(w(e=>{let t=O({},this.storeService.order());t.TypeID=e.ID,this.storeService.updateOrder(t)}),N());updateCurrencyOrder$=R(this.storeService.currency).pipe(w(e=>{let t=O({},this.storeService.order());t.CurrencyID=e.ID,this.storeService.updateOrder(t)}),N());updateTaxOrder$=R(this.storeService.tax).pipe(w(e=>{let t=O({},this.storeService.order());t.TaxTypeID=e.ID,this.storeService.updateOrder(t)}),N());updateDiscountOrder$=R(this.storeService.discount).pipe(w(e=>{let t=O({},this.storeService.order());t.Discount=e.discount,t.DiscountAmount=e.discountAmount,this.storeService.updateOrder(t)}),N());updateCustomerOrder$=R(this.storeService.customer).pipe(w(e=>{let t=O({},this.storeService.order());t.CustomerID=e.Key,this.storeService.updateOrder(t)}),N());updateEntityId$=R(this.storeService.outlet).pipe(T(e=>g.IsNotEmpty(e.ID)),w(e=>{let t=O({},this.storeService.order());t.EntityID=e.ID,this.storeService.updateOrder(t)}),N());constructor(){this.updateTagOrder$.subscribe(),this.updateCurrencyOrder$.subscribe(),this.updateTaxOrder$.subscribe(),this.updateDiscountOrder$.subscribe(),this.updateCustomerOrder$.subscribe(),this.updateEntityId$.subscribe()}newOrder(){let e=this.storeService.loadForm(),t=this.getDefaultCurrency(),n=this.storeService.outlet();this.storeService.updateOrder(new Ue),this.storeService.updateCartItems([]),this.storeService.updateCustomer(new re),this.storeService.updateTax(O({},e.Taxes[0])),this.storeService.updateCurrency(O({},t)),this.storeService.updateTag(O({},e.SalesOrderTags[0])),this.storeService.updateDiscount({discountAmount:0,discount:0}),this.storeService.updateOutlet(O({},n)),this.router.navigate([],{queryParams:{}}),this.storeService.updateState(0)}getDefaultCurrency(){let e=this.storeService.loadForm()?.AppConfigJSON?.CoreDefaults?.CurrencyID;return this.storeService.loadForm()?.Currencies.find(n=>n.ID===e)}updateOrderNumber(e){g.IsNotEmpty(e)&&this.storeService.order().Number!==e&&this.storeService.updateOrder(le(O({},this.storeService.order()),{Number:e}))}updateOrderDate(e){g.IsNotEmpty(e)&&this.storeService.order().Date!==e&&this.storeService.updateOrder(le(O({},this.storeService.order()),{Date:e}))}updateSalesPersonId(e){let t=O({},this.storeService.order());t.SalesID=e,this.storeService.updateOrder(t)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var qe=class o{storeService=d(D);httpService=d(G);quickkeys$=R(this.storeService.outlet).pipe(T(e=>g.IsNotEmpty(e.ID)),Bt((e,t)=>e.ID===t.ID),Y(e=>this.httpService.get(L.GetQuickKeyByEntityID,[{key:"ID",value:e.ID}])),Me(1));static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Fn=o=>({"qtyBtn-disabled":o}),bt=class o{disabled=!1;decimalPlaces=4;max=1e15;min=-1e15;quantity;constructor(){}ngOnInit(){}incrementQty(){this.quantity<this.max&&(this.quantity++,this.onChange(this.quantity))}decrementQty(){this.quantity>this.min&&(this.quantity--,this.onChange(this.quantity))}quantityChange(){this.onChange(this.quantity)}onChange=e=>{};onTouched=()=>{};writeValue(e){g.IsEmpty(e)?this.quantity=0:this.quantity=e}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["POS-input-quantity"]],inputs:{disabled:"disabled",decimalPlaces:"decimalPlaces",max:"max",min:"min"},features:[Te([{provide:it,multi:!0,useExisting:o}])],decls:6,vars:11,consts:[[1,"input-group"],["type","button","id","button-addon1",1,"btn","btn-outline-secondary","fw-bold","rounded-0","fs-2","border-end-0","py-4","qty-input","d-flex","align-items-center","qty_btn","justify-content-center",3,"click","ngClass","disabled"],["id","txtCartQuantity","type","text","autoNum","",1,"form-control","input-numpad","qty-input","text-center",3,"ngModelChange","ngModel","disabled","decimalPlaces"],["type","button","id","button-addon2",1,"btn","btn-outline-secondary","fw-bold","rounded-0","fs-5","border-start-0","py-4","qty-input","d-flex","align-items-center","qty_btn","justify-content-center",3,"click","ngClass","disabled"]],template:function(t,n){t&1&&(r(0,"div",0)(1,"button",1),p("click",function(){return n.decrementQty()}),s(2,"-"),a(),r(3,"input",2),Q("ngModelChange",function(l){return j(n.quantity,l)||(n.quantity=l),l}),p("ngModelChange",function(){return n.quantityChange()}),a(),r(4,"button",3),p("click",function(){return n.incrementQty()}),s(5,"+"),a()()),t&2&&(c(),u("ngClass",$(7,Fn,n.disabled))("disabled",n.disabled),c(2),U("ngModel",n.quantity),u("disabled",n.disabled)("decimalPlaces",n.decimalPlaces),c(),u("ngClass",$(9,Fn,n.disabled))("disabled",n.disabled))},dependencies:[A,ee,ie,te,J,ne,ve],styles:[".qtyBtn-disabled[_ngcontent-%COMP%]{background-color:#e9ecef;color:#000!important}button.qty_btn[_ngcontent-%COMP%]{background:#eee;border:1px solid #ddd;width:36px}.qty-input[_ngcontent-%COMP%]{height:36px!important}"]})};var xe=class o{storeService=d(D);autoApplyPricebook(e){let t=e?.Variant?.PriceBook?e?.Variant?.PriceBook:[],n=this.storeService.customer(),i=this.findCustomerPricebook(t,n),l=this.sortAppliedPricebooks(t,e.Quantity);return l.length>0||g.IsNotEmpty(i)?g.IsNotEmpty(i)?e=this.applyPricebook(e,i):e=this.applyPricebook(e,l[0]):e.PriceTypeID===2&&(e=this.removePricebook(e)),e}findCustomerPricebook(e=[],t){let n;return g.IsNotEmpty(t)&&g.IsNotEmpty(t?.Key)&&(n=e.find(i=>i.ID==t.PricebookID)),n}applyCustomerPricebook(){let e=[],t=this.storeService.customer(),n=this.storeService.cartItems();return g.IsNotEmpty(t.PricebookID)&&n.forEach(i=>{let l=this.findCustomerPricebook(i.Variant.PriceBook,t);l&&(i=this.applyPricebook(i,l),e.push(i))}),e}removeCustomerPricebook(e){let t=[];return this.storeService.cartItems().forEach(i=>{this.findCustomerPricebook(i.Variant.PriceBook,e)&&(i=this.removePricebook(i),t.push(i))}),t}sortAppliedPricebooks(e=[],t){return e.sort((n,i)=>i.MinimumQuantity-n.MinimumQuantity).filter(n=>t>=n.MinimumQuantity&&n.MinimumQuantity!=0)}applyPricebook(e,t){let n=this.storeService.loadForm()?.AppConfigJSON?.ModuleSell?.Pricebook?.PricebookVisible;return e.Discount=t.PriceDiscount,e.UnitPrice=t.UnitPrice,e.PriceBookID=t.ID,e.Price=t.UnitPrice,e.PriceTypeID=2,e.PriceNote=t.Name,n?e.Note=t.Name:e.Note="",e}removePricebook(e){return e.Discount=e.Variant.PriceDiscount,e.UnitPrice=e.Variant.UnitPrice,e.PriceBookID=null,e.Price=e.Variant.UnitPrice,e.PriceTypeID=0,e.Note="",e.PriceNote="",e}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var kt=o=>({selected:o}),Qn=()=>["/menu/Products/Catalog/Variants/Info"],Ln=o=>({ID:o});function Wn(o,e){if(o&1){let t=V();r(0,"a",13),p("click",function(){b(t);let i=m();return _(i.tabState.set("PRODUCT"))}),s(1," Product "),a()}if(o&2){let t=m();u("ngClass",$(1,kt,t.tabState()=="PRODUCT"))}}function $n(o,e){if(o&1){let t=V();r(0,"a",14),p("click",function(){b(t);let i=m();return _(i.tabState.set("SERIAL"))}),s(1," Serial "),a()}if(o&2){let t=m();u("ngClass",$(1,kt,t.tabState()=="SERIAL"))}}function qn(o,e){if(o&1&&(r(0,"div",10),I(1,"div",15),a()),o&2){let t=m();c(),u("innerHTML",t.cartItemService.priceMinimumRestrictionWarning(),Je)}}function Hn(o,e){if(o&1&&(r(0,"div",16)(1,"div",25),I(2,"POS-variant-autocomplete",26),a()()),o&2){let t=m(2);c(2),u("formControl",t.variantSearchCtrl)}}function zn(o,e){if(o&1&&(r(0,"span"),s(1),a()),o&2){let t=m(2);c(),x("(",t.cartItem().UOMName,")")}}function Gn(o,e){if(o&1){let t=V();r(0,"div",19)(1,"h6"),s(2,"Pricebook"),a(),r(3,"ng-select",27),Q("ngModelChange",function(i){b(t);let l=m(2);return j(l.cartItem().PriceBookID,i)||(l.cartItem().PriceBookID=i),_(i)}),p("ngModelChange",function(i){b(t);let l=m(2);return _(l.onSelectPricebook(i))}),a()()}if(o&2){let t,n=m(2);c(3),u("items",(t=n.cartItem())==null||t.Variant==null?null:t.Variant.PriceBook),U("ngModel",n.cartItem().PriceBookID)}}function Jn(o,e){if(o&1){let t=V();C(0,Hn,3,1,"div",16),r(1,"div",16)(2,"div",17)(3,"h6"),s(4," Qty "),C(5,zn,2,1,"span"),a(),r(6,"POS-input-quantity",18,0),Q("ngModelChange",function(i){b(t);let l=m();return j(l.cartItem().Quantity,i)||(l.cartItem().Quantity=i),_(i)}),p("ngModelChange",function(){b(t);let i=m();return _(i.onQtyChange())}),a()(),r(8,"div",19)(9,"h6"),s(10,"Discount (%)"),a(),r(11,"input",20),Q("ngModelChange",function(i){b(t);let l=m();return j(l.cartItem().Discount,i)||(l.cartItem().Discount=i),_(i)}),a()(),r(12,"div",19)(13,"h6"),s(14,"Price"),a(),r(15,"input",21,1),Q("ngModelChange",function(i){b(t);let l=m();return j(l.cartItem().Price,i)||(l.cartItem().Price=i),_(i)}),a()(),C(17,Gn,4,2,"div",19),a(),r(18,"div",22)(19,"div",23)(20,"POS-tinymce-editor",24),Q("ngModelChange",function(i){b(t);let l=m();return j(l.cartItem().Note,i)||(l.cartItem().Note=i),_(i)}),a()()()}if(o&2){let t,n=m();f(n.isEditState()==!1?0:-1),c(5),f(n.cartItem().UOMName?5:-1),c(),U("ngModel",n.cartItem().Quantity),u("decimalPlaces",n.isSerialItem()?0:4),c(5),U("ngModel",n.cartItem().Discount),c(4),U("ngModel",n.cartItem().Price),u("disabled",!(!(n.roleService==null||n.roleService.sell==null)&&n.roleService.sell.UnitPriceEditor)),c(2),f(((t=n.cartItem().Variant)==null||t.PriceBook==null?null:t.PriceBook.length)>0?17:-1),c(3),U("ngModel",n.cartItem().Note)}}function Kn(o,e){o&1&&(I(0,"i",44),r(1,"h6"),s(2,"No Image"),a())}function Yn(o,e){if(o&1&&I(0,"img",30),o&2){let t=m(2);u("src",t.cartItem().ThumbnailUrl,Ke)}}function Xn(o,e){if(o&1&&(r(0,"tr")(1,"td",45),s(2),v(3,"number"),a(),r(4,"td",45),s(5),v(6,"number"),a(),r(7,"td",45),s(8),v(9,"number"),a()()),o&2){let t=e;c(2),x(" ",h(3,3,t==null?null:t.OnHand)," "),c(3),x(" ",h(6,5,t==null?null:t.Allocated)," "),c(3),x(" ",h(9,7,(t==null?null:t.OnHand)-(t==null?null:t.Allocated))," ")}}function Zn(o,e){if(o&1){let t=V();r(0,"tr")(1,"th",42),s(2," Cost "),a(),r(3,"td",46)(4,"input",47),Q("ngModelChange",function(i){b(t);let l=m(2);return j(l.cartItem().UnitCost,i)||(l.cartItem().UnitCost=i),_(i)}),a()()()}if(o&2){let t,n=m(2);c(4),U("ngModel",n.cartItem().UnitCost),u("readonly",!(!((t=n.appConfig())==null||t.ModuleSell==null)&&t.ModuleSell.Cost.Enabled))}}function ei(o,e){if(o&1&&(r(0,"tr")(1,"th",42),s(2," Content "),a(),r(3,"td",43)(4,"div",48),s(5),v(6,"number"),a()()()),o&2){let t,n=m(2);c(5),Ie(" ",(t=n.cartItem())==null?null:t.VariantUnitQuantity," (@",h(6,2,n.cartItem().Price/((t=n.cartItem())==null?null:t.VariantUnitQuantity)),") ")}}function ti(o,e){if(o&1&&(r(0,"div",40)(1,"table",49)(2,"thead")(3,"tr")(4,"th",50),s(5,"Storage Location"),a()()(),r(6,"tbody")(7,"tr")(8,"td"),s(9),a()()()()()),o&2){let t=m(2);c(9),x(" ",t.cartItem().Storage," ")}}function ni(o,e){if(o&1&&(r(0,"div",11)(1,"div",28)(2,"a",29),C(3,Kn,3,0)(4,Yn,1,1,"img",30),a()(),r(5,"div",31)(6,"div",32)(7,"div",23)(8,"div",33),I(9,"i",34),r(10,"div",35),s(11," Inventory "),a()(),r(12,"table",36)(13,"thead")(14,"tr")(15,"th",37),s(16," On Hand "),a(),r(17,"th",37),s(18," Allocated "),a(),r(19,"th",38),s(20," Available "),a()()(),r(21,"tbody"),C(22,Xn,10,9,"tr"),v(23,"async"),a()()()(),r(24,"div",39)(25,"div",40)(26,"table",41)(27,"thead"),C(28,Zn,5,2,"tr"),r(29,"tr")(30,"th",42),s(31," Price "),a(),r(32,"td",43),s(33),v(34,"number"),a()(),C(35,ei,7,4,"tr"),a()()(),C(36,ti,10,1,"div",40),a()()()),o&2){let t,n,i,l,y,M,W,K=m();c(2),u("routerLink",Ze(12,Qn))("queryParams",$(13,Ln,(t=K.cartItem())==null?null:t.ID)),c(),f(((n=K.cartItem())==null?null:n.ThumbnailUrl)==null?3:4),c(19),f((i=h(23,8,K.variantInventory$))?22:-1,i),c(6),f(!((l=K.appConfig())==null||l.ModuleSell==null)&&l.ModuleSell.Cost.Visible&&(!(K.roleService==null||K.roleService.product==null)&&K.roleService.product.Cost)?28:-1),c(5),x(" ",h(34,10,(y=K.cartItem())==null?null:y.Price)," "),c(2),f(((M=K.cartItem())==null?null:M.VariantUnitQuantity)>1?35:-1),c(),f(!((W=K.appConfig())==null||W.ModuleSell==null||W.ModuleSell.Grid==null)&&W.ModuleSell.Grid.StorageVisible&&((W=K.cartItem())!=null&&W.Storage)?36:-1)}}function ii(o,e){if(o&1){let t=V();r(0,"app-item-serial",51),p("cartItemChange",function(i){b(t);let l=m();return _(l.onSerialChanges(i))}),a()}if(o&2){let t=m();u("entityId",t.storeService.outlet().ID)("cartItem",t.cartItem())}}var ze=class o{constructor(e,t){this.data=e;this.dialogRef=t;this.cartItem=S(e),this.initVariantInventory(),this.initIsSerialItem(),this.initModalConfig(),this.initDialogState()}data;dialogRef;storeService=d(D);cartItemService=d(me);roleService=d(_e);toastr=d(nt);pricebookService=d(xe);modalConfig=new Ae;tabState=S("CART");cartItem;appConfig=S(this.storeService.loadForm()?.AppConfigJSON);isSerialItem=S(!1);variantInventory$;isEditState=S(!1);showProductTab=S(!1);variantSearchCtrl=new we;getItemFromSearch$=this.variantSearchCtrl.valueChanges.pipe(T(e=>g.IsNotEmpty(e)),Y(e=>{if(e.type==="ID")return this.cartItemService.getItemByVariantId(e.str);if(e.type==="Code")return this.cartItemService.getItemByVariantByCode(e.str)}),w(e=>{this.cartItem.set(e),this.initModalTitle(),this.initProductTab(),this.initIsSerialItem(),this.initVariantInventory()}),N());ngOnInit(){this.isEditState()||this.getItemFromSearch$.subscribe()}initDialogState(){this.isEditState.set(g.IsNotEmpty(this.cartItem().VariantID)),this.initProductTab()}initVariantInventory(){this.variantInventory$=this.cartItemService.getVariantInventory(this.cartItem().VariantID).pipe(Me(1))}initProductTab(){this.showProductTab.set(g.IsNotEmpty(this.cartItem().VariantID))}initIsSerialItem(){this.isSerialItem.set(this.cartItem().TypeID==9)}initModalConfig(){this.initModalTitle(),this.modalConfig.customWidth="680px",this.modalConfig.noPadding=!0,this.modalConfig.bodyScrollable=!0}initModalTitle(){this.modalConfig.title=this.cartItem()?.Name??"Add Variant"}onSerialChanges(e){this.cartItem.set(e)}onQtyChange(){let e=this.pricebookService.autoApplyPricebook(this.cartItem());this.cartItem.set(e)}onSelectPricebook(e){let t;if(g.IsNotEmpty(e)){let i=this.cartItem().Variant.PriceBook.find(l=>l.ID===e);t=this.pricebookService.applyPricebook(this.cartItem(),i)}else t=this.pricebookService.removePricebook(this.cartItem());this.cartItem.set(t)}onCancel(){this.dialogRef.close()}onSave(){if(g.IsNotEmpty(this.cartItem().VariantID)&&g.IsNotEmpty(this.cartItem().Name)){if(!this.cartItemService.validatePriceMinimum(this.cartItem(),this.appConfig))return;this.dialogRef.close(this.cartItem())}else this.toastr.warning("Please select a product","Warning")}ngOnDestroy(){this.cartItemService.priceMinimumRestrictionWarning.set("")}static \u0275fac=function(t){return new(t||o)(X(Re),X(Fe))};static \u0275cmp=P({type:o,selectors:[["app-dialog-item"]],decls:14,vars:10,consts:[["quantity",""],["price",""],[3,"onOk","onCancel","onClose","config"],[1,"mb-5"],[1,"container","w-100","h-100","mt-8"],[1,"row","border-bottom","mx-5"],["data-cy","input_sell",1,"btn","btn-link",3,"click","ngClass"],["data-cy","product",1,"btn","btn-link",3,"ngClass"],["data-cy","serial",1,"btn","btn-link",3,"ngClass"],[1,"mx-8"],[1,"bg-gradient-warning","p-4","justify-content-center","align-items-center","d-flex","gap-2",2,"margin-top","12px","border-radius","8px"],[1,"row","my-8"],[3,"entityId","cartItem"],["data-cy","product",1,"btn","btn-link",3,"click","ngClass"],["data-cy","serial",1,"btn","btn-link",3,"click","ngClass"],[3,"innerHTML"],[1,"row","mt-8"],[1,"col-auto","pe-0",2,"width","145px"],[3,"ngModelChange","ngModel","decimalPlaces"],[1,"col-auto","pe-0"],["type","text","percentage","","autoNum","",1,"form-control","input-cart",2,"width","100px",3,"ngModelChange","ngModel"],["id","inputPrice","type","text","autoNum","",1,"form-control","input-cart",2,"width","112px",3,"ngModelChange","ngModel","disabled"],[1,"row","my-6"],[1,"col-12"],["height","220px",3,"ngModelChange","ngModel"],[1,"col-12","px-0"],[3,"formControl"],["bindLabel","Name","bindValue","ID","placeholder","Pricebook","appendTo","body",2,"width","170px",3,"ngModelChange","items","ngModel"],[1,"col-sm-4","d-flex","justify-content-center","flex-column","align-items-center","text-body-secondary"],["target","_blank",2,"color","inherit",3,"routerLink","queryParams"],[1,"border","rounded",3,"src"],[1,"col-sm-8","inventory"],[1,"row","mb-8"],[1,"d-flex"],["aria-hidden","true",1,"fa-archive","fa-solid","fa-1x","pt-3","pe-2"],[2,"font-size","15px","font-family",'"Roboto Slab"'],[1,"table","table-bordered","text-center","inventory-table"],[1,"table-light","py-6","border-end",2,"text-transform","none"],[1,"table-light","py-6",2,"text-transform","none"],[1,"row"],[1,"col-6"],[1,"table","table-bordered",2,"width","171px"],[1,"table-light",2,"text-transform","none"],[1,"pe-6","text-end"],["aria-hidden","true",1,"fa-solid","fa-image","fa-5x"],[1,"py-6"],[1,"p-0"],["type","text","autoNum","",1,"form-control","border-0","bg-white","text-end",3,"ngModelChange","ngModel","readonly"],["ngClass","ms-3"],[1,"table","table-bordered","text-center"],[1,"table-light"],[3,"cartItemChange","entityId","cartItem"]],template:function(t,n){t&1&&(r(0,"modal-material",2),p("onOk",function(){return n.onSave()})("onCancel",function(){return n.onCancel()})("onClose",function(){return n.onCancel()}),r(1,"content",3)(2,"div",4)(3,"div",5)(4,"div")(5,"a",6),p("click",function(){return n.tabState.set("CART")}),s(6," Cart "),a(),C(7,Wn,2,3,"a",7),C(8,$n,2,3,"a",8),a()(),r(9,"div",9),C(10,qn,2,1,"div",10),C(11,Jn,21,9),C(12,ni,37,15,"div",11),C(13,ii,1,2,"app-item-serial",12),a()()()()),t&2&&(u("config",n.modalConfig),c(5),u("ngClass",$(8,kt,n.tabState()=="CART")),c(2),f(n.showProductTab()?7:-1),c(),f(n.isSerialItem()?8:-1),c(2),f(n.cartItemService.priceMinimumRestrictionWarning()&&n.cartItemService.priceMinimumRestrictionWarning().trim()!==""?10:-1),c(),f(n.tabState()=="CART"?11:-1),c(),f(n.tabState()=="PRODUCT"?12:-1),c(),f(n.tabState()=="SERIAL"?13:-1))},dependencies:[A,ee,Ve,ie,te,J,ne,ve,lt,tt,et,pt,Ne,ke,Mn,Dn,bt,Be,Oe,z],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}.inventory-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .inventory-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{line-height:6px!important}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519}.input-cart[_ngcontent-%COMP%]{height:36px!important}"],changeDetection:0})};var me=class o{httpService=d(G);storeService=d(D);factoryService=d(ye);pricebookService=d(xe);userRoleService=d(bn);decimalPipe=d(z);dialog=d(oe);variantSearchCtrl=new we;viewContainerRef=d(Wt);selectedCustomer;cartItemEvent=new Nt;onEditCartItems$=R(this.storeService.cartItems).pipe(T(()=>this.storeService.state()==1),de(e=>({action:"INIT",items:e})),Ut());priceMinimumRestrictionWarning=S("");applyCustomerPricebook$=R(this.storeService.customer).pipe(w(e=>{this.onApplyCustomerPricebook(e)}),N());cartItems$=Vt(this.onEditCartItems$,this.cartItemEvent.asObservable()).pipe(jt((e,t)=>{let n=[];switch(t.action){case"INIT":n=t.items;break;case"ADD":n=this.addNewItem(e,t);break;case"UPDATE":n=this.updateItems(e,t);break;case"REMOVE":n=e.filter((i,l)=>t.index!==l);break;case"CLEAR":n=[];break;case"PURCHASE":n=this.updateItems(e,t);break;case"RETURN":n=this.updateItems(e,t);break;case"DROP":n=t.items;break}return this.storeService.updateCartItems(n),n},this.storeService.cartItems()));addCartItemBySearch$=this.variantSearchCtrl.valueChanges.pipe(T(e=>g.IsNotEmpty(e)),w(e=>{e.type==="ID"?this.addItemByVariantId(e.str):e.type==="Code"&&this.addItemByVariantCode(e.str)}),N());constructor(){this.addCartItemBySearch$.subscribe(),this.applyCustomerPricebook$.subscribe()}onApplyCustomerPricebook(e){let t=[],n=this.storeService.cartItems();g.IsNotEmpty(e.PricebookID)?(this.selectedCustomer=e,t=this.pricebookService.applyCustomerPricebook()):g.IsNotEmpty(this.selectedCustomer)&&(t=this.pricebookService.removeCustomerPricebook(this.selectedCustomer),this.selectedCustomer=null),n.forEach((i,l)=>{let y=t.find(M=>M.VariantID===i.VariantID);y&&this.updateCartItem({cartItem:y,index:l})})}onApplyPricebook(e){return this.pricebookService.autoApplyPricebook(e)}onOpenAddDialog(){this.dialog.open(ze,{data:new ae,viewContainerRef:this.viewContainerRef}).afterClosed().pipe(T(e=>g.IsNotEmpty(e))).subscribe(e=>{this.cartItemEvent.next({item:e,action:"ADD",newRow:!0})})}onOpenEditDialog(e){this.dialog.open(ze,{data:O({},e.cartItem),viewContainerRef:this.viewContainerRef}).afterClosed().pipe(T(t=>g.IsNotEmpty(t))).subscribe(t=>{this.cartItemEvent.next({item:t,action:"UPDATE",index:e.index})})}onSelectQuickkeyItem(e){this.addItemByVariantId(e)}addNewItem(e,t){let n=[],i=e.find(l=>l.VariantID===t.item?.VariantID);return i?t.newRow?(t.item=this.onApplyPricebook(t.item),n=[...e,t.item]):(i.Quantity+=1,i=this.onApplyPricebook(i),n=[...e]):(t.item=this.onApplyPricebook(t.item),n=[...e,t.item]),n}updateItems(e,t){return e.map((i,l)=>l===t.index?gn(ae,t.item):i)}onDropItems(e){this.cartItemEvent.next({action:"DROP",items:e})}addItemByVariantId(e){this.getItemByVariantId(e).pipe(w(t=>{this.cartItemEvent.next({item:t,action:"ADD",newRow:!1})})).subscribe()}addItemByVariantCode(e){this.getItemByVariantByCode(e).pipe(w(t=>{this.cartItemEvent.next({item:t,action:"ADD",newRow:!1})})).subscribe()}removeCartItem(e){this.cartItemEvent.next({action:"REMOVE",index:e.index})}updateCartItem(e){this.cartItemEvent.next({action:"UPDATE",item:e.cartItem,index:e.index})}clearCart(){this.dialog.open(Vn,{data:{title:"Clear Order Items",message:'<p class="h4">Are you sure you want to clear all order items?</p>',headerType:De.Warning}}).afterClosed().pipe(T(e=>e)).subscribe(()=>{this.cartItemEvent.next({action:"CLEAR"})})}onPurchaseItem(e){this.cartItemEvent.next({action:"PURCHASE",item:e.cartItem,index:e.index})}onReturnItem(e){this.cartItemEvent.next({action:"RETURN",item:e.cartItem,index:e.index})}getItemByVariantId(e){return this.httpService.get(L.GetVariantByID,[{key:"ID",value:e},{key:"EntityID",value:this.storeService.outlet().ID}]).pipe(de(t=>this.factoryService.generateCartItem(t)))}getItemByVariantByCode(e){return this.httpService.get(L.GetVariantByCode,[{key:"Code",value:e},{key:"EntityID",value:this.storeService.outlet().ID},{key:"Promotion",value:!0}]).pipe(de(t=>this.factoryService.generateCartItem(t)))}getVariantInventory(e){return this.httpService.get(L.GetVariantStockByID,[{key:"EntityID",value:this.storeService.outlet().ID},{key:"ID",value:e}])}validatePriceMinimum(e,t){let n=!0,i=this.userRoleService.Data.PriceMinimum,l=t().ModuleSell.ProductDialog.PriceMinimumTypeID;if(i){let y=0;switch(l){case 1:y=e.UnitPrice;break;case 2:y=e.UnitCost;break;case 3:y=e.UnitPriceMinimum;break}if(e.Price<y){n=!1;let M=g.StringFormat("<span><i class='fa-solid fa-triangle-exclamation me-2 d-inline'></i>Cannot sell lower than <h5 class='d-inline m-0'>{0}</h5></span>",this.decimalPipe.transform(y));this.priceMinimumRestrictionWarning.set(M)}else n=!0,this.priceMinimumRestrictionWarning.set("")}return n}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};function oi(o,e){if(o&1&&(r(0,"td",8),s(1),a()),o&2){let t=m().$index;c(),x("",t+1,".")}}function ri(o,e){if(o&1&&(r(0,"div",11),I(1,"img",31),a()),o&2){let t=m().$implicit;c(),u("src",t.ThumbnailUrl,Ke)}}function ai(o,e){o&1&&(r(0,"div",12),I(1,"i",32),a())}function li(o,e){if(o&1&&I(0,"small",16),o&2){let t=m().$implicit;u("innerHtml",t.Note,Je)}}function ci(o,e){if(o&1&&(r(0,"span",20),s(1),v(2,"number"),a()),o&2){let t=m().$implicit;c(),F(wt(2,1,t.Quantity,"1.0-4"))}}function si(o,e){if(o&1&&(r(0,"span",33),s(1,"x"),a(),r(2,"div",34)(3,"span",35),s(4),v(5,"number"),a()()),o&2){let t=m().$implicit;c(4),F(h(5,1,t.UnitQuantity))}}function mi(o,e){if(o&1&&(r(0,"span",21),s(1),v(2,"number"),a()),o&2){let t=m().$implicit;c(),x("@",h(2,1,t.VariantUnitQuantity))}}function di(o,e){if(o&1&&(r(0,"small",22),s(1),a()),o&2){let t=m().$implicit;c(),F(t.UOM?t==null?null:t.UOMName:"")}}function pi(o,e){if(o&1&&(r(0,"div",24),s(1),v(2,"number"),a()),o&2){let t=m().$implicit;c(),x(" ",wt(2,1,t.Price,"1.0-4")," ")}}function ui(o,e){if(o&1){let t=V();r(0,"tr",7),p("contextmenu",function(i){let l=b(t),y=l.$implicit,M=l.$index,W=m(2);return _(W.onContextMenu(i,y,M))}),C(1,oi,2,1,"td",8),r(2,"td",9),p("click",function(){let i=b(t),l=i.$implicit,y=i.$index,M=m(2);return _(M.onEdit(l,y))}),r(3,"div",10),C(4,ri,2,1,"div",11)(5,ai,2,0,"div",12),r(6,"div",13)(7,"div"),s(8),a(),r(9,"span",14),s(10),a(),r(11,"div"),I(12,"app-serial-note",15),a(),C(13,li,1,1,"small",16),a()()(),r(14,"td",17),p("click",function(){let i=b(t),l=i.$implicit,y=i.$index,M=m(2);return _(M.onEdit(l,y))}),r(15,"div",18)(16,"div",19),C(17,ci,3,4,"span",20),C(18,si,6,3),C(19,mi,3,3,"span",21),C(20,di,2,1,"small",22),a()()(),r(21,"td",23),p("click",function(){let i=b(t),l=i.$implicit,y=i.$index,M=m(2);return _(M.onEdit(l,y))}),C(22,pi,3,4,"div",24),a(),r(23,"td",23),p("click",function(){let i=b(t),l=i.$implicit,y=i.$index,M=m(2);return _(M.onEdit(l,y))}),r(24,"div",25),s(25),v(26,"number"),a()(),r(27,"td",26),p("click",function(){let i=b(t),l=i.$implicit,y=i.$index,M=m(2);return _(M.onEdit(l,y))}),r(28,"div",18)(29,"div",20),s(30),v(31,"number"),a()()(),r(32,"td",27)(33,"div",28)(34,"span",29),p("click",function(){let i=b(t),l=i.$implicit,y=i.$index,M=m(2);return _(M.onRemove(l,y))}),I(35,"i",30),a()()()()}if(o&2){let t,n,i=e.$implicit,l=m(2);c(),f(!((t=l.appConfig())==null||t.ModuleSell==null||t.ModuleSell.Grid==null)&&t.ModuleSell.Grid.RowNumberVisible?1:-1),c(3),f(i.ThumbnailUrl?4:5),c(4),F(i.Name),c(2),F(i.Code),c(2),u("serials",i==null?null:i.Serial),c(),f(i.Note?13:-1),c(4),f(i.Quantity!==1&&i.Quantity!==0||i.UnitQuantity>1||i.VariantUnitQuantity>1?17:-1),c(),f(i.UnitQuantity>1?18:-1),c(),f(i.VariantUnitQuantity>1?19:-1),c(),f(i.UOM&&(!((n=l.appConfig())==null||n.ModuleSell==null||n.ModuleSell.Grid==null)&&n.ModuleSell.Grid.UOMVisible)?20:-1),c(2),f(i.Price!==i.Total?22:-1),c(3),x(" ",i.Discount?h(26,13,i.Discount*-1)+"%":""," "),c(5),x(" ",l.roleService.product!=null&&l.roleService.product.Price?h(31,15,i.Total):" - "," ")}}function gi(o,e){if(o&1){let t=V();r(0,"table",1)(1,"tbody",5),p("cdkDropListDropped",function(i){b(t);let l=m();return _(l.onDrop(i))}),ue(2,ui,36,17,"tr",6,pe),a()()}if(o&2){let t=m();c(2),ge(t.cartItems())}}function Ci(o,e){o&1&&(r(0,"div",2)(1,"div",36)(2,"div",37)(3,"div",38)(4,"div",39),I(5,"i",40),a(),r(6,"div",41)(7,"span"),s(8,"Empty Cart"),a(),I(9,"br"),r(10,"span"),s(11,"Add products to the cart"),a(),I(12,"br"),r(13,"span"),s(14,"or scan barcode"),a()()()()()())}function fi(o,e){if(o&1){let t=V();r(0,"button",42),p("click",function(){let i=b(t).item,l=m();return _(l.onReverse(i,!0))}),s(1,"Return"),a(),r(2,"button",42),p("click",function(){let i=b(t).item,l=m();return _(l.onReverse(i,!1))}),s(3,"Purchase"),a()}}var _t=class o{roleService=d(_e);appConfig=be();cartItems=be([]);onRemoveEvent=B({alias:"onRemove"});onEditEvent=B({alias:"onEdit"});onDropItems=B();onReturnEvent=B({alias:"onReturn"});onPurchaseEvent=B({alias:"onPurchase"});contextMenu=Yt.required(Le);contextMenuPosition=S({x:"0px",y:"0px"});contextMenuIndex=S(-1);onContextMenu(e,t,n){e.preventDefault(),this.contextMenuPosition.set({x:e.clientX+"px",y:e.clientY+"px"}),this.contextMenuIndex.set(n),this.contextMenu().menuData={item:t},this.contextMenu().openMenu()}onDrop(e){let t=[...this.cartItems()];nn(t,e.previousIndex,e.currentIndex),this.onDropItems.emit(t)}onEdit(e,t){this.onEditEvent.emit({cartItem:e,index:t})}onRemove(e,t){this.onRemoveEvent.emit({cartItem:e,index:t})}onReverse(e,t){let n=this.contextMenuIndex(),i=Object.assign(new ae,e);t?(i.Quantity>0&&(i.Quantity=i.Quantity*-1),this.onReturnEvent.emit({cartItem:i,index:n})):(i.Quantity<0&&(i.Quantity=i.Quantity*-1),this.onPurchaseEvent.emit({cartItem:i,index:n}))}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["POS-cart-display"]],viewQuery:function(t,n){t&1&&zt(n.contextMenu,Le,5),t&2&&Gt()},inputs:{appConfig:[1,"appConfig"],cartItems:[1,"cartItems"]},outputs:{onRemoveEvent:"onRemove",onEditEvent:"onEdit",onDropItems:"onDropItems",onReturnEvent:"onReturn",onPurchaseEvent:"onPurchase"},decls:6,vars:6,consts:[["contextMenu","matMenu"],[1,"table","table-borderless"],[1,"row","g-0","h-100"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],["matMenuContent",""],["cdkDropList","",3,"cdkDropListDropped"],["cdkDrag","",1,"border-bottom"],["cdkDrag","",1,"border-bottom",3,"contextmenu"],[2,"width","10px"],[1,"pe-0",2,"width","50%",3,"click"],[1,"d-flex","align-items-center"],[1,"ratio","ratio-1x1",2,"width","55px"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[1,"d-block","ms-4",2,"line-height","18px"],[1,"fw-normal","fs-6","text-muted"],[3,"serials"],["title","Note",1,"special-TinyMCE","m-0","fst-italic","d-block",3,"innerHtml"],[1,"px-0","text-end",2,"width","15%",3,"click"],[1,"d-flex","align-items-center","justify-content-end"],[1,"d-flex","text-end","fw-normal","align-items-center",2,"line-height","20px"],[1,"fs-5"],["title","Variant Unit Quantity",1,"fs-5"],["title","UOM",1,"ps-1","fs-5"],[3,"click"],[1,"fs-5","text-end"],[1,"fw-normal","fs-5","text-danger"],[1,"pe-0",3,"click"],[1,"mt-6","ps-0"],[1,"d-flex","justify-content-end","align-items-center"],["role","button","title","Delete Item",1,"fs-3","cursor-pointer",3,"click"],[1,"fa","fa-trash","text-danger","fs-4"],[1,"item-image",3,"src"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],[1,"fs-6","me-1","ms-1"],[1,"d-flex","algin-items-center"],["title","Unit Quantity",1,"fs-5","me-1"],[1,"col-12"],[1,"d-flex","justify-content-center","align-items-center","h-100"],[1,"row"],[1,"col-12","d-flex","justify-content-center"],[1,"fa-regular","fa-cart-arrow-up","text-secondary",2,"font-size","110px"],[1,"col-12","justify-content-center","text-center","mt-5","empty-cart-description","text-secondary","headings-font-family"],["mat-menu-item","",3,"click"]],template:function(t,n){if(t&1&&(C(0,gi,4,0,"table",1)(1,Ci,15,0,"div",2),I(2,"div",3),r(3,"mat-menu",null,0),qt(5,fi,4,0,"ng-template",4),a()),t&2){let i=Xe(4);f(n.cartItems()&&n.cartItems().length>0?0:1),c(2),Jt("left",n.contextMenuPosition().x)("top",n.contextMenuPosition().y),u("matMenuTriggerFor",i)}},dependencies:[A,an,rn,on,kn,Sn,xn,hn,vn,yn,Le,z],styles:[".item-image[_ngcontent-%COMP%]{height:50px;width:56px;display:block;border:solid 1px #dddddd;border-radius:5px;object-fit:contain}.example-menu[_ngcontent-%COMP%]{display:inline-flex;flex-direction:column;min-width:180px;max-width:280px;background-color:#fff;padding:6px 0}.example-menu-item[_ngcontent-%COMP%]{background-color:transparent;cursor:pointer;border:none;-webkit-user-select:none;user-select:none;min-width:64px;line-height:36px;padding:0 16px;display:flex;align-items:center;flex-direction:row;flex:1}.example-menu-item[_ngcontent-%COMP%]:hover{background-color:#f5f5f5}.example-menu-item[_ngcontent-%COMP%]:active{background-color:#dcdcdc}.table[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:not(caption) > *[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{padding:12px 10px} .cdk-menu.cdk-menu-group.example-menu{box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.empty-cart-description[_ngcontent-%COMP%]{font-size:14px;font-weight:500;color:#c7c7c7}"],changeDetection:0})};var _i=(o,e)=>({"text-danger":o,"text-custom-warning":e});function vi(o,e){if(o&1&&(r(0,"mat-option",5)(1,"div",7)(2,"div",8)(3,"div"),s(4),a()()()()),o&2){let t=e.$implicit,n=m();u("value",t),c(2),u("ngClass",Kt(4,_i,t.StateID==n.customerState.Suspended,t.StateID==n.customerState.WaitingForApproval))("title",t.StateID==n.customerState.Suspended?"Suspended":t.StateID==n.customerState.WaitingForApproval?"Waiting for Approval":""),c(2),F(t==null?null:t.Value)}}function yi(o,e){if(o&1){let t=V();r(0,"i",9),p("click",function(){b(t);let i=m();return _(i.openCustomerDetail())}),a()}}var vt=class o{httpService=d(G);router=d(Ee);customerCtrl=new we;customerFiltered$=this.customerCtrl.valueChanges.pipe(T(e=>typeof e=="string"&&e.length>=3),Rt(300),Y(e=>this.getCustomerSuggestion(e)));customerSelected$=this.customerCtrl.valueChanges.pipe(T(e=>typeof e!="string"),w(e=>{this.onChange(e)}));createNewCustomer=B();clickInput=B();customerState=Tn;constructor(){this.customerSelected$.pipe(N()).subscribe()}getCustomerSuggestion(e){return this.httpService.get(L.GetCustomerSuggestions,[{key:"count",value:100},{key:"prefix",value:e}])}displayFn(e){return e?.Value}onCreateCustomer(){this.createNewCustomer.emit()}onClickInputValue(){this.clickInput.emit()}onChange=e=>{};onTouched=()=>{};writeValue(e){this.customerCtrl.patchValue(e,{onlySelf:!0,emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}openCustomerDetail(){let e=this.customerCtrl.value.Key;if(g.IsNotEmpty(e)){let t=this.router.serializeUrl(this.router.createUrlTree(["/menu/Contacts/Contact/Customers/Info"],{queryParams:{ID:e}}));window.open(t,"_blank")}}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["POS-customer-autocomplete"]],outputs:{createNewCustomer:"createNewCustomer",clickInput:"clickInput"},features:[Te([{provide:it,multi:!0,useExisting:o}])],decls:9,vars:6,consts:[["auto","matAutocomplete"],[1,"d-flex","align-items-center","position-relative"],["matTooltipPosition","above","matTooltip","New Customer","role","button",1,"fa-light","fa-user-plus","position-absolute","cursor-pointer",2,"font-size","12px",3,"click"],["type","text","placeholder","Assign Customer",3,"click","formControl","matAutocomplete"],[3,"displayWith"],[3,"value"],["matTooltipPosition","left","matTooltip","Open Customer Details",1,"fa-regular","fa-arrow-up-right-from-square","position-absolute"],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"ms-3","text-wrap","text-break",3,"ngClass","title"],["matTooltipPosition","left","matTooltip","Open Customer Details",1,"fa-regular","fa-arrow-up-right-from-square","position-absolute",3,"click"]],template:function(t,n){if(t&1&&(r(0,"div",1)(1,"i",2),p("click",function(){return n.onCreateCustomer()}),a(),r(2,"input",3),p("click",function(){return n.onClickInputValue()}),a(),r(3,"mat-autocomplete",4,0),ue(5,vi,5,7,"mat-option",5,pe),v(7,"async"),a(),C(8,yi,1,0,"i",6),a()),t&2){let i=Xe(4);c(2),u("formControl",n.customerCtrl)("matAutocomplete",i),c(),u("displayWith",n.displayFn),c(2),ge(h(7,4,n.customerFiltered$)),c(3),f(n.customerCtrl&&(n.customerCtrl!=null&&n.customerCtrl.value)&&(!(n.customerCtrl==null||n.customerCtrl.value==null)&&n.customerCtrl.value.Key)?8:-1)}},dependencies:[A,ee,dn,sn,tn,mn,Ne,te,J,ke,rt,ot,ct,Oe],styles:["input[_ngcontent-%COMP%]{width:100%;height:38px!important;border-radius:.375rem;border:1px solid #ced4da;padding-left:32px;padding-right:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i.fa-user-plus[_ngcontent-%COMP%]{font-size:16px;top:12px;left:11px}.text-custom-warning[_ngcontent-%COMP%]{color:#ff7a00d6}i.fa-arrow-up-right-from-square[_ngcontent-%COMP%]{position:absolute;right:13px;top:50%;transform:translateY(-50%);font-size:12px;z-index:2;cursor:pointer}"],changeDetection:0})};var Ge=class o{storeService=d(D);dialog=d(oe);httpService=d(G);createNewCustomer(){this.dialog.open(In,{data:{options:this.storeService.loadForm()?.EstimateOptions,config:this.storeService.loadForm()?.AppConfigJSON?.ModuleContact,type:"customer",title:"New Customer Form"}}).afterClosed().pipe(T(e=>g.IsNotEmpty(e))).subscribe(e=>{let t=new re;t.Key=e.CustomerID,t.Value=e.ContactName,this.storeService.updateCustomer(t)})}onSelectCustomer(e){let t=this.storeService.outlet();this.httpService.get(L.GetCustomerPrivilegeByID,[{key:"ID",value:e.Key},{key:"EntityID",value:t.ID}]).pipe(Ft(()=>{let n=new re;return this.storeService.updateCustomer(n),At})).subscribe(n=>{let i=JSON.parse(JSON.stringify(e));i.PricebookID=n.PricebookID,this.storeService.updateCustomer(i)})}onDeleteCustomer(){g.IsNotEmpty(this.storeService?.customer()?.Key)&&this.dialog.open(Pn,{data:{title:"Re-assign customer",message:"Are you sure to re-assign the customer?"}}).afterClosed().pipe(T(e=>e)).subscribe(()=>{let e=new re;this.storeService.updateCustomer(e)})}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var yt=class o{onClickEvent=B();onClick(){this.onClickEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["app-note-button"]],outputs:{onClickEvent:"onClickEvent"},decls:2,vars:0,consts:[["type","button",1,"btn","btn-gray","w-100","fs-3","px-0","py-6","headings-font-family",3,"click"],[1,"fa-regular","fa-note-sticky","fa-xl"]],template:function(t,n){t&1&&(Z(0,"button",0),Pe("click",function(){return n.onClick()}),Ht(1,"i",1),ce())},styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"],changeDetection:0})};function hi(o,e){if(o&1&&(Z(0,"div"),s(1),v(2,"number"),ce()),o&2){let t=m();c(),x(" ",h(2,1,t.totalAmount())," ")}}function xi(o,e){o&1&&s(0," - ")}var ht=class o{payEvent=B();totalItems=be(0);totalQuantity=be(0);totalAmount=be(0);rolePrice=be(!0);constructor(){}ngOnInit(){}onPay(){this.payEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["app-pay-button"]],inputs:{totalItems:[1,"totalItems"],totalQuantity:[1,"totalQuantity"],totalAmount:[1,"totalAmount"],rolePrice:[1,"rolePrice"]},outputs:{payEvent:"payEvent"},decls:10,vars:5,consts:[["type","button",1,"btn","btn-success","fs-1","py-4","w-100",3,"click"],[1,"d-flex","align-items-center","justify-content-between"],[1,"fs-6"]],template:function(t,n){t&1&&(Z(0,"button",0),Pe("click",function(){return n.onPay()}),Z(1,"div",1)(2,"div")(3,"span"),s(4,"Submit"),ce(),Z(5,"small",2),s(6),v(7,"number"),ce()(),C(8,hi,3,3,"div")(9,xi,1,0),ce()()),t&2&&(c(6),Ie(" (",h(7,3,n.totalItems())," Items & ",n.totalQuantity()," Qty) "),c(2),f(n.rolePrice()?8:9))},dependencies:[A,z],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0;position:relative;flex:1 1 auto;border-left:.1px solid #fff}"],changeDetection:0})};var xt=class o{onClickEvent=B();onClick(){this.onClickEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["app-discount-button"]],outputs:{onClickEvent:"onClickEvent"},decls:2,vars:0,consts:[["type","button","matTooltip","Discount / Tax","matTooltipPosition","above",1,"btn","btn-success","fs-5",3,"click"],[1,"fa-light","fa-percent"]],template:function(t,n){t&1&&(r(0,"button",0),p("click",function(){return n.onClick()}),I(1,"i",1),a())},dependencies:[rt,ot],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;border-top-right-radius:0;border-bottom-right-radius:0;position:relative;flex:1 1 auto}"],changeDetection:0})};var Qe=class o{store=d(D);toastr=d(nt);dialog=d(oe);_backEndService=d(un);updateState$=R(this.store.complete).pipe(T(e=>e.Success),w(()=>this.store.updateState(3)),N());constructor(){this.updateState$.subscribe()}onPay(){if(this.validatePayOrder()==!1)return;let t={Items:this.cartItemPreSubmission(),Order:O({},this.store.order())};this._backEndService.submitTransaction(t,L.SubmitEstimate).subscribe(n=>{this.store.updateComplete(n)})}cartItemPreSubmission(){let e=JSON.parse(JSON.stringify(this.store.cartItems()));return e=e.map(t=>(delete t.Variant,t)),e}validatePayOrder(){let e=!0;return g.IsEmpty(this.store.outlet().ID)&&(this.toastr.error("Please select outlet before proceeding..",De.Error),e=!1),g.IsEmpty(this.store.customer().Key)&&(this.toastr.warning("Please select a customer!",De.Warning),e=!1),this.store.cartItems().length==0&&(this.toastr.error("You must have at least one item.",De.Error),e=!1),g.IsEmpty(this.store.order().Number)&&(this.toastr.error("Number cannot be empty.",De.Error),e=!1),e}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var St=class o{constructor(e,t){this.dialogRef=t;this.discountAmount.set(e.discountAmount),this.discount.set(e.discount),this.tax=S(e.tax),this.currency=S(e.currency),this.taxes.set(e.taxes),this.initModalConfig()}dialogRef;modalConfig=S(new Ae);discountAmount=S(0);discount=S(0);tax=S(null);discounts=S([0,0,0]);currency=S(null);taxes=S([]);initModalConfig(){this.modalConfig.update(e=>le(O({},e),{title:"Discount and Tax",customWidth:"400px"}))}onClose(){this.dialogRef.close()}onSave(){this.dialogRef.close({discountAmount:this.discountAmount(),discount:this.discount(),tax:this.tax()})}onSelectTax(e){this.tax.set(e)}onDiscountCalculatorChange(e,t){let n=this.discounts();n[t]=e,this.discounts.set(n),this.calculateDiscountCalculator()}calculateDiscountCalculator(){let e=this.discounts(),t=100;e.forEach(i=>{i&&i>0&&(t=t*(100-i)/100)});let n=100-t;this.discount.set(n)}static \u0275fac=function(t){return new(t||o)(X(Re),X(Fe))};static \u0275cmp=P({type:o,selectors:[["app-dialog-discount"]],decls:48,vars:10,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],["matTooltipPosition","above","matTooltip","Discount","tabTitle","Discount"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-3"],[1,"fw-bold","d-block"],[1,"col-9"],["type","text","data-cy","discount1","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],[1,"ms-1"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],["type","text","data-cy","discountamount","autoNum","",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],["matTooltipPosition","above","matTooltip","Tax","tabTitle","Tax"],["bindLabel","Label","appendTo","body","bindValue","ID","placeholder","Tax","data-cy","Tax",2,"width","150px",3,"change","clearable","ngModel","items"],["matTooltipPosition","above","matTooltip","Calculation","tabTitle","Calculator"],[1,"row","mt-6","g-0","d-flex","align-items-center","justify-content-start"],[1,"col-4"],[1,"col-8","ps-4"],["type","text","data-cy","discountCal1","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"mx-2"],["type","text","data-cy","discountCal2","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal3","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"]],template:function(t,n){if(t&1&&(r(0,"modal-material",0),p("keydown.F2",function(){return n.onSave()})("onOk",function(){return n.onSave()})("onCancel",function(){return n.onClose()})("onClose",function(){return n.onClose()}),r(1,"content")(2,"div",1)(3,"custom-tabs"),Ce(4),r(5,"tab",2)(6,"div",3)(7,"div",4)(8,"label",5),s(9,"Discount %"),a()(),r(10,"div",6)(11,"input",7),Q("ngModelChange",function(l){return j(n.discount,l)||(n.discount=l),l}),a(),r(12,"span",8),s(13,"%"),a()()(),r(14,"div",9)(15,"div",4)(16,"label",5),s(17),a()(),r(18,"div",6)(19,"input",10),Q("ngModelChange",function(l){return j(n.discountAmount,l)||(n.discountAmount=l),l}),a()()()(),fe(),Ce(20),r(21,"tab",11)(22,"div",3)(23,"div",4)(24,"label",5),s(25,"Tax"),a()(),r(26,"div",6)(27,"ng-select",12),p("change",function(l){return n.onSelectTax(l)}),a()()()(),fe(),Ce(28),r(29,"tab",13)(30,"div",14)(31,"div",15)(32,"label",5),s(33,"Discount Calculator"),a()(),r(34,"div",16)(35,"input",17),p("ngModelChange",function(l){return n.onDiscountCalculatorChange(l,0)}),a(),r(36,"span"),s(37," %"),a(),r(38,"span",18),s(39,"+"),a(),r(40,"input",19),p("ngModelChange",function(l){return n.onDiscountCalculatorChange(l,1)}),a(),r(41,"span"),s(42," %"),a(),r(43,"span",18),s(44,"+"),a(),r(45,"input",20),p("ngModelChange",function(l){return n.onDiscountCalculatorChange(l,2)}),a(),r(46,"span"),s(47," %"),a()()()(),fe(),a()()()()),t&2){let i,l;u("config",n.modalConfig()),c(11),U("ngModel",n.discount),c(6),x(" Discount ",(i=n.currency())==null?null:i.Symbol," "),c(2),U("ngModel",n.discountAmount),c(8),u("clearable",!1)("ngModel",(l=n.tax())==null?null:l.ID)("items",n.taxes()),c(8),u("ngModel",n.discounts()[0]),c(5),u("ngModel",n.discounts()[1]),c(5),u("ngModel",n.discounts()[2])}},dependencies:[A,Ve,st,dt,mt,ie,te,J,ne,Be,ve],encapsulation:2,changeDetection:0})};var Se=class o{storeService=d(D);totalItemsQty=q(()=>this.storeService.cartItems().reduce((n,i)=>n+i.Quantity,0));totalItemsAmount=q(()=>this.storeService.cartItems().reduce((n,i)=>n+i.Total,0));taxAmount=q(()=>{let e=this.storeService.tax(),t=0;return e.Rate>0&&(e.CalculationTypeID==1?t=this.calculateTaxInclude(e):t=this.calculateTaxAdd(e)),t});totalAmount=q(()=>{let e=this.storeService.tax(),t=this.storeService.order().DiscountAmount,n=this.storeService.order().Discount,i=this.totalItemsAmount(),l=this.calculatePercentagDisc(n,i),y=i-t-l;return e.CalculationTypeID==0&&(y=y+this.taxAmount()),y});discountPercentageAmount=q(()=>{let e=this.storeService.order().Discount,t=this.totalItemsAmount();return this.calculatePercentagDisc(e,t)});calculateTaxInclude(e){let t=this.grossTotalTaxable();return e.Rate/(100+e.Rate)*t}calculateTaxAdd(e){let t=this.grossTotalTaxable();return e.Rate/100*t}grossTotalTaxable(){let e=this.taxableItems(),t=this.calculateTaxableItemsPrice(),n=this.storeService.discount();if(e.length!==0){let i=this.calculateDiscountTaxableItem();t=t*(100-n.discount)/100,t=t-i}return t}calculateDiscountTaxableItem(){let e=this.taxableItems(),t=this.totalItemsAmount(),n=this.storeService.discount().discountAmount,i=0,l=0,y=0,M=0;for(let W of e)i=W.getItemAfterDiscount/t,l=i*n,M=l*W.Quantity,y+=M;return y}calculatePercentagDisc(e,t){return e/100*t}calculateTaxableItemsPrice(){return this.taxableItems().filter(n=>n.Taxable).reduce((n,i)=>n+i.Total,0)}taxableItems(){return this.storeService.cartItems().filter(t=>t.Taxable)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Di=o=>({selected:o});function Mi(o,e){if(o&1){let t=V();r(0,"div",9)(1,"span",14),s(2,"@"),a(),r(3,"input",15),Q("ngModelChange",function(i){b(t);let l=m();return j(l.currency().ExchangeRate,i)||(l.currency().ExchangeRate=i),_(i)}),a()()}if(o&2){let t=m();c(3),U("ngModel",t.currency().ExchangeRate)}}function Pi(o,e){if(o&1){let t=V();r(0,"div",13)(1,"label",16)(2,"input",17),p("ngModelChange",function(){let i=b(t).$implicit,l=m();return _(l.onChangeTag(i.ID))}),a(),s(3),a()()}if(o&2){let t,n=e.$implicit,i=e.$index,l=m();c(),u("for",Et("potype-"+i))("ngClass",$(7,Di,((t=l.tag())==null?null:t.ID)==n.ID)),c(),u("id",Et("potype-"+i))("ngModel",l.tag().ID),c(),x(" ",n.Name," ")}}var It=class o{constructor(e,t){this.dialogRef=t;this.initModalConfig(),this.currencies.set(e.currencies),this.note.set(e.note),this.tags.set(e.tags),this.tag=S(e.tag),this.currency=S(e.currency),this.defaultCurrencyId=S(e.defaultCurrencyId)}dialogRef;modalConfig=S(new Ae);currencies=S([]);tags=S([]);tag;currency;defaultCurrencyId;note=S("");initModalConfig(){this.modalConfig.update(e=>le(O({},e),{title:"Order Note",customWidth:"700px"}))}onChangeCurrency(e){let t=this.currencies()?.find(n=>n.ID===e);this.currency.set(t)}onChangeTag(e){let t=this.tags()?.find(n=>n.ID===e);this.tag.set(t)}onClose(){this.dialogRef.close()}onSave(){this.dialogRef.close({currency:this.currency(),tag:this.tag(),note:this.note()})}static \u0275fac=function(t){return new(t||o)(X(Re),X(Fe))};static \u0275cmp=P({type:o,selectors:[["app-dialog-note"]],decls:20,vars:6,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],["matTooltipPosition","above","matTooltip","Notes","tabTitle","Notes"],[3,"ngModelChange","ngModel"],["matTooltipPosition","above","matTooltip","Currency","tabTitle","Currency"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],[1,"row","ms-4"],[1,"ps-0","col-sm-4"],["bindLabel","Name","bindValue","ID","placeholder","Currency","appendTo","body",3,"ngModelChange","items","clearable","ngModel"],[1,"col-sm-4","d-flex"],["matTooltipPosition","above","matTooltip","Tag","tabTitle","Tag"],[1,"row"],[1,"col-12"],[1,"rad-btn"],[1,"pt-4"],["type","text","autoNum","",1,"border","border-light",3,"ngModelChange","ngModel"],[3,"for","ngClass"],["type","radio",3,"ngModelChange","ngModel","id"]],template:function(t,n){if(t&1&&(r(0,"modal-material",0),p("keydown.F2",function(){return n.onSave()})("onOk",function(){return n.onSave()})("onCancel",function(){return n.onClose()})("onClose",function(){return n.onClose()}),r(1,"content")(2,"div",1)(3,"custom-tabs"),Ce(4),r(5,"tab",2)(6,"POS-tinymce-editor",3),Q("ngModelChange",function(l){return j(n.note,l)||(n.note=l),l}),a()(),fe(),Ce(7),r(8,"tab",4)(9,"div",5)(10,"div",6)(11,"div",7)(12,"ng-select",8),p("ngModelChange",function(l){return n.onChangeCurrency(l)}),a()(),C(13,Mi,4,1,"div",9),a()()(),fe(),Ce(14),r(15,"tab",10)(16,"div",11)(17,"div",12),ue(18,Pi,4,9,"div",13,pe),a()()(),fe(),a()()()()),t&2){let i;u("config",n.modalConfig()),c(6),U("ngModel",n.note),c(6),u("items",n.currencies())("clearable",!1)("ngModel",n.currency().ID),c(),f(((i=n.currency())==null?null:i.ID)!=n.defaultCurrencyId()?13:-1),c(5),ge(n.tags())}},dependencies:[A,ee,Ve,st,dt,mt,ie,te,Zt,J,ne,Be,ve,lt],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}.rad-btn[_ngcontent-%COMP%]{position:relative;display:inline-block}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #dddddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label.selected[_ngcontent-%COMP%]{background:#dcdcdc;border:1px solid #dcdcdc}"],changeDetection:0})};var Dt=class o{onClickEvent=B();constructor(){}ngOnInit(){}onClick(){this.onClickEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["app-clear-button"]],outputs:{onClickEvent:"onClickEvent"},decls:3,vars:0,consts:[["type","button",1,"btn","btn-gray","w-100","fs-3","px-0","py-6","headings-font-family",3,"click"]],template:function(t,n){t&1&&(Z(0,"button",0),Pe("click",function(){return n.onClick()}),Z(1,"span"),s(2,"Clear"),ce()())},styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"],changeDetection:0})};function Ti(o,e){if(o&1&&(r(0,"tr")(1,"th",11),s(2,"Amount"),a(),r(3,"td",12),s(4),v(5,"number"),a()()),o&2){let t=m();c(4),F(h(5,1,t.calculationService==null?null:t.calculationService.totalItemsAmount()))}}function Oi(o,e){if(o&1&&(r(0,"tr")(1,"th",11),s(2),a(),r(3,"td",13),s(4),v(5,"number"),a()()),o&2){let t=m(2);c(2),x("Discount ",t.storeService==null?null:t.storeService.discount().discount,"%"),c(2),x(" ",h(5,2,t.calculationService.discountPercentageAmount()*-1))}}function Ei(o,e){if(o&1&&(r(0,"tr")(1,"th",11),s(2),a(),r(3,"td",13),s(4),v(5,"number"),a()()),o&2){let t,n,i=m(2);c(2),x("Discount ",(t=i.storeService.currency())==null?null:t.Symbol),c(2),x(" ",h(5,2,((n=i.storeService.discount())==null?null:n.discountAmount)*-1))}}function wi(o,e){if(o&1&&(r(0,"tr")(1,"th",11),s(2),a(),r(3,"td",12),s(4),v(5,"number"),a()()),o&2){let t,n=m(2);c(2),F((t=n.storeService.tax())==null?null:t.Label),c(2),F(h(5,2,n.calculationService.taxAmount()))}}function ki(o,e){if(o&1&&(C(0,Oi,6,4,"tr"),C(1,Ei,6,4,"tr"),C(2,wi,6,4,"tr")),o&2){let t,n,i=m();f(i.storeService.discount().discount!=0?0:-1),c(),f(((t=i.storeService.discount())==null?null:t.discountAmount)!=0?1:-1),c(),f(((n=i.storeService.tax())==null?null:n.Rate)!=0?2:-1)}}var Mt=class o{storeService=d(D);orderService=d(se);roleService=d(_e);payService=d(Qe);calculationService=d(Se);cartService=d(me);dialog=d(oe);taxCalculationType=at;totalItemsQty=q(()=>this.storeService.cartItems()?.length);isShowAmount=q(()=>this.storeService?.tax()?.CalculationTypeID==0&&this.storeService?.tax()?.Rate||this.storeService.discount()?.discount!=0||this.storeService.discount()?.discountAmount!=0);onOpenDialogNote(){this.dialog.open(It,{data:{tags:this.storeService.loadForm().SalesOrderTags,currencies:this.storeService.loadForm().Currencies,currency:this.storeService.currency(),tag:this.storeService.tag(),defaultCurrencyId:this.storeService.loadForm()?.AppConfigJSON?.CoreDefaults?.CurrencyID,note:this.storeService.order().Note}}).afterClosed().pipe(T(e=>g.IsNotEmpty(e))).subscribe(e=>{this.storeService.updateCurrency(e.currency),this.storeService.updateTag(e.tag),this.storeService.updateOrder(le(O({},this.storeService.order()),{Note:e.note}))})}onOpenDialogDiscount(){this.dialog.open(St,{data:{discountAmount:this.storeService.order().DiscountAmount,discount:this.storeService.order().Discount,tax:this.storeService.tax(),currency:this.storeService.currency(),taxes:this.storeService.loadForm().Taxes}}).afterClosed().pipe(T(e=>g.IsNotEmpty(e))).subscribe(e=>{this.storeService.updateDiscount({discountAmount:e.discountAmount,discount:e.discount}),this.storeService.updateTax(e.tax)})}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["POS-cart-action"]],decls:13,vars:6,consts:[[1,"row","g-0","px-5","justify-content-end"],[1,"col-6",2,"padding-right","15px"],[1,"table","table-borderless"],[1,"row","g-0","pb-6","px-5"],[1,"col-5","d-flex","justify-content-between","pe-5",2,"column-gap","12px"],[2,"flex-grow","1",3,"onClickEvent"],[2,"flex-grow","3",3,"onClickEvent"],[1,"col-7"],[1,"btn-group","w-100"],[1,"d-inline-flex",3,"onClickEvent"],[1,"d-inline-flex","w-100",3,"payEvent","rolePrice","totalQuantity","totalItems","totalAmount"],[1,"text-start"],[1,"text-end","fs-5"],[1,"text-end","fs-5","text-danger"]],template:function(t,n){t&1&&(r(0,"div",0)(1,"div",1)(2,"table",2),C(3,Ti,6,3,"tr"),C(4,ki,3,3),a()()(),r(5,"div",3)(6,"div",4)(7,"app-note-button",5),p("onClickEvent",function(){return n.onOpenDialogNote()}),a(),r(8,"app-clear-button",6),p("onClickEvent",function(){return n.cartService.clearCart()}),a()(),r(9,"div",7)(10,"div",8)(11,"app-discount-button",9),p("onClickEvent",function(){return n.onOpenDialogDiscount()}),a(),r(12,"app-pay-button",10),p("payEvent",function(){return n.payService.onPay()}),a()()()()),t&2&&(c(3),f(n.isShowAmount()?3:-1),c(),f(n.calculationService.totalItemsQty()>0?4:-1),c(8),u("rolePrice",n.roleService.product.Price)("totalQuantity",n.calculationService.totalItemsQty())("totalItems",n.totalItemsQty())("totalAmount",n.calculationService.totalAmount()))},dependencies:[A,xt,yt,ht,Dt,z],encapsulation:2,changeDetection:0})};var Bn=o=>({ID:o}),Ni=()=>["/menu/Orders/Orders/Estimate/Info"],Ai=o=>({"border-top":o});function Vi(o,e){if(o&1&&(r(0,"div",23)(1,"div",28),s(2),a(),r(3,"div",28),s(4),v(5,"number"),a()()),o&2){let t=e.$implicit;c(2),F(t.Name),c(2),x("",h(5,2,t.Total)," ")}}function Fi(o,e){if(o&1&&(r(0,"div",24)(1,"div",29),s(2),a(),r(3,"div",29),s(4),v(5,"number"),a()()),o&2){let t,n=m();c(2),x("Amount: ",(t=n.storeService.currency())==null?null:t.Symbol),c(2),F(h(5,2,n.calculationService.totalItemsAmount()))}}function Ri(o,e){if(o&1&&(r(0,"div",25)(1,"div",29),s(2),v(3,"number"),a(),r(4,"div",30),s(5),v(6,"number"),a()()),o&2){let t,n=m();c(2),Ie("","Discount "+h(3,3,(t=n.storeService.discount())==null?null:t.discount)+" %",": ",(t=n.storeService.currency())==null?null:t.Symbol),c(3),F(h(6,5,n.calculationService.discountPercentageAmount()*-1))}}function Bi(o,e){if(o&1&&(r(0,"div",25)(1,"div",29),s(2),a(),r(3,"div",30),s(4),v(5,"number"),a()()),o&2){let t,n,i=m();c(2),x("Discount: ",(t=i.storeService.currency())==null?null:t.Symbol),c(2),x("",h(5,2,((n=i.storeService.discount())==null?null:n.discountAmount)*-1)," ")}}function Ui(o,e){if(o&1&&(r(0,"div",25)(1,"div",29),s(2),a(),r(3,"div",29),s(4),v(5,"number"),a()()),o&2){let t,n=m();c(2),Ie("",(t=n.storeService.tax())==null?null:t.Label,": ",(t=n.storeService.currency())==null?null:t.Symbol),c(2),F(h(5,3,n.calculationService.taxAmount()))}}var Pt=class o{orderService=d(se);calculationService=d(Se);storeService=d(D);isShowAmount=q(()=>this.storeService?.tax()?.CalculationTypeID==0&&this.storeService?.tax()?.Rate||this.storeService.discount()?.discount!=0||this.storeService.discount()?.discountAmount!=0);handleF8(){this.orderService.newOrder()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["POS-complete"]],hostBindings:function(t,n){t&1&&p("keydown.F8",function(){return n.handleF8()},Ye)},decls:41,vars:20,consts:[[1,"pt-7",2,"border-bottom","1px solid rgba(0, 0, 0, 0.1)"],[1,"ps-7","fw-normal","pb-9"],[1,"order-complete"],[1,"container-fluid","pt-8"],[1,"row"],[1,"col-8"],[1,"card"],[1,"card-header",2,"padding-bottom","15px"],[1,"fw-normal",2,"font-size","32px"],[1,"fa-solid","fa-check","me-3"],[1,"card-body"],[1,"row",2,"height","115px"],[1,"col","text-center","my-auto"],[1,"btn","btn-success","w-50",2,"font-size","20px",3,"click"],[1,"card-footer"],[1,"d-flex","justify-content-between","my-6"],["target","_blank","routerLink","/print/Estimate",1,"btn","bg-light-gray","btn-secondary",3,"queryParams"],[1,"fa-solid","fa-print","me-2"],[1,"col-4"],[1,"card-header","bg-light-gray",2,"padding-bottom","15px"],[1,"fst-italic"],["target","_blank",3,"routerLink","queryParams"],[1,"card-body","py-4"],[1,"row","justify-content-between","border-bottom","py-2"],[1,"row","justify-content-end","mt-2","pb-2"],[1,"row","justify-content-end","pb-2"],[1,"row","justify-content-end","pt-4",3,"ngClass"],[1,"col-4","text-end","h5"],[1,"col","text-end"],[1,"col-4","text-end"],[1,"col-4","text-end","text-danger"]],template:function(t,n){if(t&1&&(r(0,"div",0)(1,"h1",1),s(2,"Estimate"),a()(),r(3,"section",2)(4,"div",3)(5,"div",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"h1",8),I(10,"i",9),s(11,"Order Complete "),a()(),r(12,"div",10)(13,"div",11)(14,"div",12)(15,"a",13),p("click",function(){return n.orderService.newOrder()}),s(16,"New Order (F8)"),a()()()(),r(17,"div",14)(18,"div",15)(19,"a",16),I(20,"i",17),s(21,"Print Receipt"),a()()()()(),r(22,"div",18)(23,"div",6)(24,"div",19)(25,"h3",20)(26,"a",21),s(27),a()()(),r(28,"div",22),ue(29,Vi,6,4,"div",23,pe),C(31,Fi,6,4,"div",24),C(32,Ri,7,7,"div",25),C(33,Bi,6,4,"div",25),C(34,Ui,6,5,"div",25),r(35,"div",26)(36,"div",27),s(37),a(),r(38,"div",27),s(39),v(40,"number"),a()()()()()()()()),t&2){let i,l,y,M,W;c(19),u("queryParams",$(13,Bn,n.storeService.complete().OrderID)),c(7),u("routerLink",Ze(15,Ni))("queryParams",$(16,Bn,n.storeService.complete().OrderID)),c(),x("Estimate #",(i=n.storeService.complete())==null?null:i.InvoiceNumber),c(2),ge(n.storeService.cartItems()),c(2),f(n.isShowAmount()?31:-1),c(),f(((l=n.storeService.discount())==null?null:l.discount)>0?32:-1),c(),f(((y=n.storeService.discount())==null?null:y.discountAmount)>0?33:-1),c(),f(((M=n.storeService.tax())==null?null:M.Rate)>0?34:-1),c(),u("ngClass",$(18,Ai,n.isShowAmount())),c(2),x("Total: ",(W=n.storeService.currency())==null?null:W.Symbol),c(2),F(h(40,11,n.calculationService.totalAmount()))}},dependencies:[A,ee,tt,et,pn,z],styles:[".order-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%]{border-bottom:1px solid rgba(0,0,0,.125);padding-bottom:.9375rem}.order-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:2rem}.order-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%] .container[_ngcontent-%COMP%]{max-width:500px;margin-top:30px;margin-bottom:30px}"],changeDetection:0})};var Tt=class o{route=d(Ee);dialog=d(oe);addItem=new Lt;handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.onAddItem()}onAddItem(){this.addItem.emit()}redirectToPrevious(){this.route.navigate(["/menu/Estimate/V1"])}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=P({type:o,selectors:[["POS-more-action"]],hostBindings:function(t,n){t&1&&p("keydown.F4",function(){return n.handleF8()},Ye)},outputs:{addItem:"onAddItem"},decls:14,vars:0,consts:[["id","moreMenu","data-bs-toggle","dropdown",1,"d-flex","align-items-center","cursor-pointer"],[1,"me-2"],[1,"fa-solid","fa-caret-down","fa-lg"],[1,"fs-6","headings-font-family","pb-1"],[1,"h-100","d-flex","align-items-center","justify-content-between"],["aria-labelledby","moreMenu",1,"dropdown-menu","more-actions"],[1,"d-flex"],[1,"dropdown-header","text-dark","col"],[1,"h5","mb-4"],[1,"dropdown-divider","m-0"],[1,"cursor-pointer",3,"click"],["icon","fa-circle-plus fa-solid","label","Add New"]],template:function(t,n){t&1&&(r(0,"span",0)(1,"span",1),I(2,"i",2),a(),r(3,"span",3),s(4,"More Actions"),a()(),r(5,"div",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"div",8),s(10,"Item"),a(),I(11,"div",9),r(12,"li",10),p("click",function(){return n.onAddItem()}),I(13,"POS-dropdown-item-more-action",11),a()()()()())},dependencies:[Nn],encapsulation:2,changeDetection:0})};function ji(o,e){o&1&&I(0,"POS-complete")}function Qi(o,e){if(o&1){let t=V();r(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4)(4,"div",5)(5,"POS-select-outlet-form",6),v(6,"async"),p("ngModelChange",function(i){b(t);let l=m();return _(l.outletService.updateOutlet(i))}),a()(),r(7,"POS-invoice-number-form",7),v(8,"async"),p("ngModelChange",function(i){b(t);let l=m();return _(l.orderService.updateOrderNumber(i))}),a(),r(9,"POS-invoice-date",8),p("ngModelChange",function(i){b(t);let l=m();return _(l.orderService.updateOrderDate(i))}),a()()(),r(10,"div",9)(11,"div",10)(12,"div",11)(13,"POS-more-action",12),p("onAddItem",function(){b(t);let i=m();return _(i.cartItemService.onOpenAddDialog())}),a()(),r(14,"div",13)(15,"ng-select-infinite",14,0),v(17,"async"),p("selectedChange",function(i){b(t);let l=m();return _(l.orderService.updateSalesPersonId(i))}),a()()()()(),r(18,"div",15)(19,"div",16)(20,"POS-quick-key",17),v(21,"async"),p("onSelectVariant",function(i){b(t);let l=m();return _(l.cartItemService.onSelectQuickkeyItem(i))}),a()(),r(22,"div",18)(23,"div",19)(24,"div",20),I(25,"POS-variant-autocomplete",21),a(),r(26,"div",13)(27,"POS-customer-autocomplete",22),p("createNewCustomer",function(){b(t);let i=m();return _(i.customerService.createNewCustomer())})("ngModelChange",function(i){b(t);let l=m();return _(l.customerService.onSelectCustomer(i))})("clickInput",function(){b(t);let i=m();return _(i.customerService.onDeleteCustomer())}),a()()(),r(28,"POS-cart-display",23),v(29,"async"),p("onRemove",function(i){b(t);let l=m();return _(l.cartItemService.removeCartItem(i))})("onEdit",function(i){b(t);let l=m();return _(l.cartItemService.onOpenEditDialog(i))})("onDropItems",function(i){b(t);let l=m();return _(l.cartItemService.onDropItems(i))})("onPurchase",function(i){b(t);let l=m();return _(l.cartItemService.onPurchaseItem(i))})("onReturn",function(i){b(t);let l=m();return _(l.cartItemService.onReturnItem(i))}),a(),I(30,"POS-cart-action"),a()()()}if(o&2){let t,n=m();c(5),u("ngModel",n.storeService.outlet())("outlets",n.storeService.loadForm().Entities)("isOpenAfterLoad",h(6,18,n.outletService.isOpenDialog$)),c(2),u("ngModel",h(8,20,n.orderService.orderNumber$))("isEdit",n.isEditOrder()),c(2),u("ngModel",n.storeService.order().Date)("disabled",!(!(n.role==null||n.role.global==null)&&n.role.global.Date))("tooltip",!(n.role==null||n.role.global==null)&&n.role.global.Date?"":"Date role is required"),c(6),u("clearable",!0)("optionTitle",!0)("items",h(17,22,n.orderService.salesPersons$))("selected",n.storeService.order().SalesID),c(5),u("quickKey",h(21,24,n.quickkeyService.quickkeys$))("outletID",n.storeService.outlet().ID),c(5),u("formControl",n.cartItemService.variantSearchCtrl),c(2),u("ngModel",n.storeService.customer()),c(),u("cartItems",h(29,26,n.cartItemService.cartItems$))("appConfig",(t=n.storeService.loadForm())==null?null:t.AppConfigJSON)}}var Un=class o extends ln{loadFormService=d(We);storeService=d(D);role=d(_e);outletService=d($e);orderService=d(se);quickkeyService=d(qe);cartItemService=d(me);customerService=d(Ge);intercomService=d(en);destroyRef=d(Qt);isCompleteOrder=q(()=>this.storeService.state()==3);isEditOrder=q(()=>this.storeService.state()==1);constructor(e){super(e),this.menuData$.pipe(N(this.destroyRef)).subscribe(),this.intercomService.hideLauncher()}ngOnDestroy(){this.intercomService.showLauncher()}static \u0275fac=function(t){return new(t||o)(X(cn))};static \u0275cmp=P({type:o,selectors:[["POS-estimate-v2"]],features:[Te([D,We,$e,se,qe,me,Ge,Qe,Se,ye,xe]),$t],decls:2,vars:1,consts:[["ngSelectInfinite",""],[1,"container-fluid"],[1,"row","header","border-bottom"],[1,"col-5","border-end"],[1,"left-toolbar-container","h-100","d-flex","align-items-center","justify-content-between"],[1,"d-flex"],[3,"ngModelChange","ngModel","outlets","isOpenAfterLoad"],["transactionType","Estimate",3,"ngModelChange","ngModel","isEdit"],[3,"ngModelChange","ngModel","disabled","tooltip"],[1,"col-7","d-flex","align-items-center"],[1,"row","flex-grow-1"],[1,"col-lg-7","col-5","d-flex","align-items-center"],[3,"onAddItem"],[1,"col-5","ps-0"],["bindValue","ID","bindLabel","Name","placeholder","Assign Sales Person",1,"sales-person","select-max-width",3,"selectedChange","clearable","optionTitle","items","selected"],[1,"row","content"],[1,"col-5","border-end","pt-1"],[3,"onSelectVariant","quickKey","outletID"],[1,"col-7","pt-5","px-0","d-flex","flex-column"],[1,"row","w-100","ms-0"],[1,"col-7","px-0"],[3,"formControl"],[3,"createNewCustomer","ngModelChange","clickInput","ngModel"],[1,"cart-display",3,"onRemove","onEdit","onDropItems","onPurchase","onReturn","cartItems","appConfig"]],template:function(t,n){t&1&&C(0,ji,1,0,"POS-complete")(1,Qi,31,28,"div",1),t&2&&f(n.isCompleteOrder()?0:1)},dependencies:[A,On,Ne,J,ke,En,ie,ne,_n,fn,wn,_t,vt,ct,pt,Mt,Pt,Tt,Oe],styles:["ng-select-infinite.sales-person.select-max-width>ng-select{padding-right:10px;height:38px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{font-size:.75rem;border:.5px solid #d7d7d7;padding-right:6px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-arrow-wrapper{width:12px;padding-bottom:2px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-value-container{padding-left:6px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{min-height:38px!important;height:38px!important;border:none} ng-select-infinite.sales-person.select-max-width.offline>.ng-select.ng-select-single .ng-select-container{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input{padding-left:5px!important} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input>input{padding-top:5px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single>ng-dropdown-panel.ng-dropdown-panel{font-size:.75rem;width:95%!important} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-focused .ng-select-container{box-shadow:none!important;border-color:transparent!important}.left-toolbar-container[_ngcontent-%COMP%]{position:relative}.left-toolbar-container[_ngcontent-%COMP%] POS-invoice-number-form[_ngcontent-%COMP%]{position:absolute;top:34px;left:32px}.header[_ngcontent-%COMP%]{min-height:60px}.content[_ngcontent-%COMP%]{min-height:calc(100vh - 60px)}.supplier-more-menu[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.cart-display[_ngcontent-%COMP%]{flex-grow:1;height:0px;overflow-y:auto}input[_ngcontent-%COMP%]{width:100%;height:38px!important;border:0;border-bottom:1px solid #ced4da;padding-left:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i[_ngcontent-%COMP%]{font-size:16px;top:10.6px;left:13px}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]{transition:.4s}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(1){-webkit-transform:rotate(-45deg) translate(-8px,4px);transform:rotate(-45deg) translate(-8px,4px)}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(2){opacity:0}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(3){-webkit-transform:rotate(45deg) translate(-5px,0px);transform:rotate(45deg) translate(-5px)}.mobile-button[_ngcontent-%COMP%]{display:none}@media(max-width:990px){.mobile-button[_ngcontent-%COMP%]{display:block}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.more-actions[_ngcontent-%COMP%] div.d-flex[_ngcontent-%COMP%]{width:30rem}"],changeDetection:0})};export{Un as EstimateV2Component};
@@ -1 +1 @@
1
- import{a as pe}from"./chunk-RVXN6EXH.js";import{a as ce}from"./chunk-AECGWU7H.js";import{a as te,b as ne}from"./chunk-JQTAWCP7.js";import"./chunk-7IWRU5BC.js";import"./chunk-OQGBLRIB.js";import"./chunk-NLPCJ6S7.js";import"./chunk-L2JJOSI2.js";import"./chunk-UJW36IT2.js";import{a as le}from"./chunk-K4GA7MPU.js";import"./chunk-WZGLWJII.js";import"./chunk-VTZIOGOR.js";import{a as re}from"./chunk-P7IUXZRS.js";import{g as oe,h as de}from"./chunk-DLWI6JEQ.js";import"./chunk-RZ4WHN74.js";import"./chunk-H3HLCMIY.js";import"./chunk-5QQBII3Q.js";import"./chunk-6HAO7FHW.js";import"./chunk-JKKLPKQZ.js";import{a as ae}from"./chunk-5UJ5AQ7O.js";import"./chunk-XS4YRZDR.js";import"./chunk-VKEUSILH.js";import"./chunk-ZZ5VQX3U.js";import"./chunk-NRO23IIB.js";import"./chunk-FPTMOFHU.js";import"./chunk-PZ32564R.js";import{b as ee}from"./chunk-NBVEREBF.js";import"./chunk-PPMQE2JW.js";import"./chunk-SE73OGQM.js";import"./chunk-BSKB3J2G.js";import{c as ie}from"./chunk-IUUNN5TF.js";import"./chunk-E6HRLULV.js";import"./chunk-Z3W63F6G.js";import"./chunk-5QKCGJTV.js";import"./chunk-QHSP67RW.js";import"./chunk-BMSUBRBS.js";import"./chunk-C7OXYN2X.js";import{a as D}from"./chunk-JATJNKS5.js";import"./chunk-5FOSDRT2.js";import"./chunk-2QP5NONI.js";import"./chunk-KTHJFSOM.js";import"./chunk-MTUBHLOV.js";import{F as $}from"./chunk-LFSG3DBR.js";import"./chunk-MTVI7VTK.js";import"./chunk-NRAW3ITG.js";import"./chunk-G2RIVW3B.js";import{b as y}from"./chunk-LNPJ2D7B.js";import"./chunk-PPTZHIIZ.js";import"./chunk-NQ6AEJ5K.js";import{n as Y,q as Z}from"./chunk-X6Z7MJUZ.js";import{$a as p,Ba as b,Bb as O,Cb as z,D as N,Db as s,Eb as r,Fb as a,Fc as E,Gb as _,Hc as T,Kb as B,Lb as M,Nd as Q,Pb as I,Pd as U,Qd as X,Sb as S,Ua as o,Ub as c,_c as G,da as k,db as j,hc as l,ib as q,ic as h,jc as H,kc as F,mc as A,na as P,nc as w,oc as W,qd as J,r as L,ra as u,sa as f,vd as K,wb as g,xc as v,yb as C,yc as x}from"./chunk-VKQVNDWA.js";import{a as V,b as R}from"./chunk-NF7PG5F2.js";var ge=()=>["/menu/Products/Setup/Brand/Brand_Form"],se=i=>({ID:i}),Ce=()=>[5,10,25,100],_e=()=>["/menu/Products/Catalog/Products"],ve=i=>({categoryID:i}),be=()=>["/menu/Products/Catalog/Products/Info"],Ie=(i,t)=>t.ID;function Se(i,t){if(i&1&&(r(0,"a",4),_(1,"i",8),l(2," Edit"),a()),i&2){let e,d=c(2);s("routerLink",v(2,ge))("queryParams",x(3,se,(e=d.brandInfo())==null?null:e.ID))}}function he(i,t){if(i&1){let e=I();r(0,"button",9),S("click",function(){u(e);let n=c(2);return f(n.onDelete())}),_(1,"i",10),l(2," Delete "),a()}}function xe(i,t){if(i&1&&(r(0,"tr",21)(1,"td")(2,"a",27),l(3),a()(),r(4,"td")(5,"span")(6,"a",27),l(7),a()()(),r(8,"td"),l(9),a()()),i&2){let e=t.$implicit;o(2),s("routerLink",v(7,_e))("queryParams",x(8,ve,e.CategoryID)),o(),h(e.CategoryName),o(3),s("routerLink",v(10,be))("queryParams",x(11,se,e.ID)),o(),h(e.Name),o(2),h(e.Code)}}function ye(i,t){if(i&1&&(r(0,"span")(1,"b"),l(2,"Modified:"),a(),l(3),E(4,"date"),a()),i&2){let e,d=c(3);o(3),F(" ",T(4,2,(e=d.brandInfo())==null?null:e.Modified,"dd MMM yyyy HH:mm")," / ",(e=d.brandInfo())==null?null:e.Modifier," ")}}function De(i,t){if(i&1){let e=I();r(0,"div",7)(1,"div",11)(2,"div",12)(3,"div",13)(4,"div",14)(5,"div",12)(6,"h3"),l(7,"General"),a()()(),r(8,"div",15)(9,"div",12)(10,"div",11)(11,"div",16),_(12,"lib-info-page-input",17),a(),r(13,"div",16),_(14,"lib-info-page-input",18),a()()()()()(),r(15,"div",12)(16,"div",13)(17,"div",14)(18,"div",12)(19,"h3"),l(20),a()()(),r(21,"div",15)(22,"table",19)(23,"thead",20)(24,"tr")(25,"th"),l(26,"Category"),a(),r(27,"th"),l(28,"Product"),a(),r(29,"th"),l(30,"Code"),a()()(),r(31,"tbody"),O(32,xe,10,13,"tr",21,Ie),a()(),r(34,"mat-paginator",22),S("page",function(n){u(e);let m=c(2);return f(m.onPaginationChange(n))}),a()()()()(),r(35,"div",23)(36,"a",24),_(37,"i",25),r(38,"span",26)(39,"b"),l(40,"Created:"),a(),l(41),E(42,"date"),a(),g(43,ye,5,5,"span"),a()()()}if(i&2){let e,d,n=c(2);o(12),s("inputValue",n.brandInfo().Name),o(2),s("inputValue",n.brandInfo().Code),o(6),H("Products (",n.count()," Items)"),o(12),z(n.data.Data),o(2),s("length",n.data.TotalCount)("pageSize",n.pageData.Filter.RowCount)("pageIndex",n.pageData.Filter.PageNumber-1)("pageSizeOptions",v(14,Ce))("showFirstLastButtons",!0),o(7),F("\xA0",T(42,11,(e=n.brandInfo())==null?null:e.Created,"dd MMM yyyy HH:mm")," / ",(e=n.brandInfo())==null?null:e.Creator," "),o(2),C((d=n.brandInfo())!=null&&d.Modified?43:-1)}}function Pe(i,t){if(i&1){let e=I();r(0,"mainpanel-cmp",1),S("onSubmit",function(){u(e);let n=c();return f(n.searchFromPageOne())}),W("textChange",function(n){u(e);let m=c();return w(m.pageData.Filter.Text,n)||(m.pageData.Filter.Text=n),f(n)})("filterChange",function(n){u(e);let m=c();return w(m.pageData.Filter,n)||(m.pageData.Filter=n),f(n)}),B(1,2),r(2,"div",3),g(3,Se,3,5,"a",4),g(4,he,3,0,"button",5),a(),M(),B(5,6),g(6,De,44,15,"div",7),M(),a()}if(i&2){let e=c();s("pageData",e.menuData)("hideSearchBox",!1)("hideSearchDropdown",!0),A("text",e.pageData.Filter.Text)("filter",e.pageData.Filter),o(3),C(e.roleService.product.Edit?3:-1),o(),C(e.roleService.product.Delete?4:-1),o(2),C(e.brandInfo()?6:-1)}}var me=class i extends pe{router=P(U);filter=b({id:"",text:"",pagenumber:1,pagesize:20});roleService=P(y);brandInfo=b(null);count=b(0);constructor(t,e,d,n,m,Be,ue,fe){super(t,e,"ProductSetup/GetProductByBrandID",void 0,d,ue,!0,fe,"get")}ngOnInit(){this.route?.queryParamMap.pipe(N(t=>!!t&&t.has("ID")),L(t=>t.get("ID")),k(t=>{this.filter.set(R(V({},this.filter()),{id:t}))})).subscribe(),this.initBrandInfo()}initBrandInfo(){let t={ID:this.route?.snapshot.queryParamMap.get("ID")||""};this.httpService.post("/api/ProductSetup/BrandFormInitial",t).pipe(le("response from BrandFormInitial API")).subscribe(e=>{this.brandInfo.set(e.Form)})}preInitList(){super.preInitList(),console.log("preInitList called, filter:",this.filter),this.pageData.Filter={ID:this.route?.snapshot.queryParamMap.get("ID")||"",PageNumber:1,RowCount:20,Text:""}}onPaginationChange(t){this.pageData.Filter.PageNumber=t.pageIndex+1,this.pageData.Filter.RowCount=t.pageSize,this.getListData()}afterPostInit(t){super.afterPostInit(t),t&&t.Count!==-1&&(this.data.TotalCount=t.Count,this.count.set(this.data.TotalCount))}onSubmitSuccess(t){this.toastrService?.success("Success Submit Brand",D.Success),this.router.navigate(["/menu/Products/Setup/Brand"])}isLastPage(){return this.pageData.Filter.PageNumber*this.pageData.Filter.RowCount>=this.data.TotalCount}onDelete(){if(!this.brandInfo()){this.toastrService?.error("Brand not found",D.Error);return}this.httpService.delete(`api/ProductSetup/RemoveBrandByID/${this.brandInfo()?.ID}`).subscribe({next:()=>{this.toastrService?.success("Brand deleted successfully",D.Success),this.router.navigate(["/menu/Products/Setup/Brand"])}})}static \u0275fac=function(e){return new(e||i)(p(ae),p(Z),p(Y),p(re),p(ie),p(y),p(Q),p(G))};static \u0275cmp=j({type:i,selectors:[["POS-brand-info"]],features:[q],decls:1,vars:1,consts:[[3,"pageData","hideSearchBox","hideSearchDropdown","text","filter"],[3,"onSubmit","textChange","filterChange","pageData","hideSearchBox","hideSearchDropdown","text","filter"],["ngProjectAs","actions",5,["actions"]],[1,"btn-group"],[1,"btn","btn-outline-secondary",3,"routerLink","queryParams"],[1,"btn","btn-outline-secondary"],["ngProjectAs","content",5,["content"]],[1,"container-fluid","bg-light-gray","form-horizontal","pt-8"],["aria-hidden","true",1,"fa-solid","fa-pen-to-square"],[1,"btn","btn-outline-secondary",3,"click"],[1,"fa","fa-trash"],[1,"row"],[1,"col-sm-12"],[1,"card"],[1,"card-header"],[1,"card-body"],[1,"col"],["labelValue","Name","inputType","textarea",3,"inputValue"],["labelValue","Code","inputType","textarea",3,"inputValue"],["id","tableGrid",1,"table","border-bottom"],[1,"thead-light","sticky-top-thead"],[1,"border-bottom","ng-scope"],[3,"page","length","pageSize","pageIndex","pageSizeOptions","showFirstLastButtons"],[1,"alert","alert-warning"],["target","_blank",2,"color","#333333"],["aria-hidden","true",1,"fa-regular","fa-file-lines","me-2"],[1,"me-2"],["target","_blank",3,"routerLink","queryParams"]],template:function(e,d){e&1&&g(0,Pe,7,8,"mainpanel-cmp",0),e&2&&C(d.data?0:-1)},dependencies:[$,de,oe,ee,X,K,ne,te,ce,J],styles:["input[read-only][_ngcontent-%COMP%]{cursor:text!important;border-color:none!important}"],changeDetection:0})};export{me as BrandInfoComponent};
1
+ import{a as pe}from"./chunk-NR6SJE4L.js";import{a as ce}from"./chunk-AECGWU7H.js";import{a as te,b as ne}from"./chunk-JQTAWCP7.js";import"./chunk-7IWRU5BC.js";import"./chunk-OQGBLRIB.js";import"./chunk-NLPCJ6S7.js";import"./chunk-L2JJOSI2.js";import"./chunk-UJW36IT2.js";import{a as le}from"./chunk-K4GA7MPU.js";import"./chunk-Q6PQK26R.js";import"./chunk-LU5PSJWR.js";import{a as re}from"./chunk-P7IUXZRS.js";import{g as oe,h as de}from"./chunk-77WJ3EU6.js";import"./chunk-RZ4WHN74.js";import"./chunk-H3HLCMIY.js";import"./chunk-5QQBII3Q.js";import"./chunk-6HAO7FHW.js";import"./chunk-XL2ZP2VN.js";import{a as ae}from"./chunk-36USSIER.js";import"./chunk-XS4YRZDR.js";import"./chunk-VKEUSILH.js";import"./chunk-ER72CLR7.js";import"./chunk-NRO23IIB.js";import"./chunk-FPTMOFHU.js";import"./chunk-PZ32564R.js";import{b as ee}from"./chunk-NBVEREBF.js";import"./chunk-PPMQE2JW.js";import"./chunk-SE73OGQM.js";import"./chunk-DLYZMRXG.js";import{c as ie}from"./chunk-IUUNN5TF.js";import"./chunk-E6HRLULV.js";import"./chunk-Z3W63F6G.js";import"./chunk-5QKCGJTV.js";import"./chunk-QHSP67RW.js";import"./chunk-BMSUBRBS.js";import"./chunk-C7OXYN2X.js";import{a as D}from"./chunk-JATJNKS5.js";import"./chunk-5FOSDRT2.js";import"./chunk-2QP5NONI.js";import"./chunk-KTHJFSOM.js";import"./chunk-MTUBHLOV.js";import{F as $}from"./chunk-LFSG3DBR.js";import"./chunk-ZDBFO3IO.js";import"./chunk-5PA2WWSJ.js";import"./chunk-G2RIVW3B.js";import{b as y}from"./chunk-LNPJ2D7B.js";import"./chunk-PPTZHIIZ.js";import"./chunk-SHERPUSH.js";import{n as Y,q as Z}from"./chunk-X6Z7MJUZ.js";import{$a as p,Ba as b,Bb as O,Cb as z,D as N,Db as s,Eb as r,Fb as a,Fc as E,Gb as _,Hc as T,Kb as B,Lb as M,Nd as Q,Pb as I,Pd as U,Qd as X,Sb as S,Ua as o,Ub as c,_c as G,da as k,db as j,hc as l,ib as q,ic as h,jc as H,kc as F,mc as A,na as P,nc as w,oc as W,qd as J,r as L,ra as u,sa as f,vd as K,wb as g,xc as v,yb as C,yc as x}from"./chunk-VKQVNDWA.js";import{a as V,b as R}from"./chunk-NF7PG5F2.js";var ge=()=>["/menu/Products/Setup/Brand/Brand_Form"],se=i=>({ID:i}),Ce=()=>[5,10,25,100],_e=()=>["/menu/Products/Catalog/Products"],ve=i=>({categoryID:i}),be=()=>["/menu/Products/Catalog/Products/Info"],Ie=(i,t)=>t.ID;function Se(i,t){if(i&1&&(r(0,"a",4),_(1,"i",8),l(2," Edit"),a()),i&2){let e,d=c(2);s("routerLink",v(2,ge))("queryParams",x(3,se,(e=d.brandInfo())==null?null:e.ID))}}function he(i,t){if(i&1){let e=I();r(0,"button",9),S("click",function(){u(e);let n=c(2);return f(n.onDelete())}),_(1,"i",10),l(2," Delete "),a()}}function xe(i,t){if(i&1&&(r(0,"tr",21)(1,"td")(2,"a",27),l(3),a()(),r(4,"td")(5,"span")(6,"a",27),l(7),a()()(),r(8,"td"),l(9),a()()),i&2){let e=t.$implicit;o(2),s("routerLink",v(7,_e))("queryParams",x(8,ve,e.CategoryID)),o(),h(e.CategoryName),o(3),s("routerLink",v(10,be))("queryParams",x(11,se,e.ID)),o(),h(e.Name),o(2),h(e.Code)}}function ye(i,t){if(i&1&&(r(0,"span")(1,"b"),l(2,"Modified:"),a(),l(3),E(4,"date"),a()),i&2){let e,d=c(3);o(3),F(" ",T(4,2,(e=d.brandInfo())==null?null:e.Modified,"dd MMM yyyy HH:mm")," / ",(e=d.brandInfo())==null?null:e.Modifier," ")}}function De(i,t){if(i&1){let e=I();r(0,"div",7)(1,"div",11)(2,"div",12)(3,"div",13)(4,"div",14)(5,"div",12)(6,"h3"),l(7,"General"),a()()(),r(8,"div",15)(9,"div",12)(10,"div",11)(11,"div",16),_(12,"lib-info-page-input",17),a(),r(13,"div",16),_(14,"lib-info-page-input",18),a()()()()()(),r(15,"div",12)(16,"div",13)(17,"div",14)(18,"div",12)(19,"h3"),l(20),a()()(),r(21,"div",15)(22,"table",19)(23,"thead",20)(24,"tr")(25,"th"),l(26,"Category"),a(),r(27,"th"),l(28,"Product"),a(),r(29,"th"),l(30,"Code"),a()()(),r(31,"tbody"),O(32,xe,10,13,"tr",21,Ie),a()(),r(34,"mat-paginator",22),S("page",function(n){u(e);let m=c(2);return f(m.onPaginationChange(n))}),a()()()()(),r(35,"div",23)(36,"a",24),_(37,"i",25),r(38,"span",26)(39,"b"),l(40,"Created:"),a(),l(41),E(42,"date"),a(),g(43,ye,5,5,"span"),a()()()}if(i&2){let e,d,n=c(2);o(12),s("inputValue",n.brandInfo().Name),o(2),s("inputValue",n.brandInfo().Code),o(6),H("Products (",n.count()," Items)"),o(12),z(n.data.Data),o(2),s("length",n.data.TotalCount)("pageSize",n.pageData.Filter.RowCount)("pageIndex",n.pageData.Filter.PageNumber-1)("pageSizeOptions",v(14,Ce))("showFirstLastButtons",!0),o(7),F("\xA0",T(42,11,(e=n.brandInfo())==null?null:e.Created,"dd MMM yyyy HH:mm")," / ",(e=n.brandInfo())==null?null:e.Creator," "),o(2),C((d=n.brandInfo())!=null&&d.Modified?43:-1)}}function Pe(i,t){if(i&1){let e=I();r(0,"mainpanel-cmp",1),S("onSubmit",function(){u(e);let n=c();return f(n.searchFromPageOne())}),W("textChange",function(n){u(e);let m=c();return w(m.pageData.Filter.Text,n)||(m.pageData.Filter.Text=n),f(n)})("filterChange",function(n){u(e);let m=c();return w(m.pageData.Filter,n)||(m.pageData.Filter=n),f(n)}),B(1,2),r(2,"div",3),g(3,Se,3,5,"a",4),g(4,he,3,0,"button",5),a(),M(),B(5,6),g(6,De,44,15,"div",7),M(),a()}if(i&2){let e=c();s("pageData",e.menuData)("hideSearchBox",!1)("hideSearchDropdown",!0),A("text",e.pageData.Filter.Text)("filter",e.pageData.Filter),o(3),C(e.roleService.product.Edit?3:-1),o(),C(e.roleService.product.Delete?4:-1),o(2),C(e.brandInfo()?6:-1)}}var me=class i extends pe{router=P(U);filter=b({id:"",text:"",pagenumber:1,pagesize:20});roleService=P(y);brandInfo=b(null);count=b(0);constructor(t,e,d,n,m,Be,ue,fe){super(t,e,"ProductSetup/GetProductByBrandID",void 0,d,ue,!0,fe,"get")}ngOnInit(){this.route?.queryParamMap.pipe(N(t=>!!t&&t.has("ID")),L(t=>t.get("ID")),k(t=>{this.filter.set(R(V({},this.filter()),{id:t}))})).subscribe(),this.initBrandInfo()}initBrandInfo(){let t={ID:this.route?.snapshot.queryParamMap.get("ID")||""};this.httpService.post("/api/ProductSetup/BrandFormInitial",t).pipe(le("response from BrandFormInitial API")).subscribe(e=>{this.brandInfo.set(e.Form)})}preInitList(){super.preInitList(),console.log("preInitList called, filter:",this.filter),this.pageData.Filter={ID:this.route?.snapshot.queryParamMap.get("ID")||"",PageNumber:1,RowCount:20,Text:""}}onPaginationChange(t){this.pageData.Filter.PageNumber=t.pageIndex+1,this.pageData.Filter.RowCount=t.pageSize,this.getListData()}afterPostInit(t){super.afterPostInit(t),t&&t.Count!==-1&&(this.data.TotalCount=t.Count,this.count.set(this.data.TotalCount))}onSubmitSuccess(t){this.toastrService?.success("Success Submit Brand",D.Success),this.router.navigate(["/menu/Products/Setup/Brand"])}isLastPage(){return this.pageData.Filter.PageNumber*this.pageData.Filter.RowCount>=this.data.TotalCount}onDelete(){if(!this.brandInfo()){this.toastrService?.error("Brand not found",D.Error);return}this.httpService.delete(`api/ProductSetup/RemoveBrandByID/${this.brandInfo()?.ID}`).subscribe({next:()=>{this.toastrService?.success("Brand deleted successfully",D.Success),this.router.navigate(["/menu/Products/Setup/Brand"])}})}static \u0275fac=function(e){return new(e||i)(p(ae),p(Z),p(Y),p(re),p(ie),p(y),p(Q),p(G))};static \u0275cmp=j({type:i,selectors:[["POS-brand-info"]],features:[q],decls:1,vars:1,consts:[[3,"pageData","hideSearchBox","hideSearchDropdown","text","filter"],[3,"onSubmit","textChange","filterChange","pageData","hideSearchBox","hideSearchDropdown","text","filter"],["ngProjectAs","actions",5,["actions"]],[1,"btn-group"],[1,"btn","btn-outline-secondary",3,"routerLink","queryParams"],[1,"btn","btn-outline-secondary"],["ngProjectAs","content",5,["content"]],[1,"container-fluid","bg-light-gray","form-horizontal","pt-8"],["aria-hidden","true",1,"fa-solid","fa-pen-to-square"],[1,"btn","btn-outline-secondary",3,"click"],[1,"fa","fa-trash"],[1,"row"],[1,"col-sm-12"],[1,"card"],[1,"card-header"],[1,"card-body"],[1,"col"],["labelValue","Name","inputType","textarea",3,"inputValue"],["labelValue","Code","inputType","textarea",3,"inputValue"],["id","tableGrid",1,"table","border-bottom"],[1,"thead-light","sticky-top-thead"],[1,"border-bottom","ng-scope"],[3,"page","length","pageSize","pageIndex","pageSizeOptions","showFirstLastButtons"],[1,"alert","alert-warning"],["target","_blank",2,"color","#333333"],["aria-hidden","true",1,"fa-regular","fa-file-lines","me-2"],[1,"me-2"],["target","_blank",3,"routerLink","queryParams"]],template:function(e,d){e&1&&g(0,Pe,7,8,"mainpanel-cmp",0),e&2&&C(d.data?0:-1)},dependencies:[$,de,oe,ee,X,K,ne,te,ce,J],styles:["input[read-only][_ngcontent-%COMP%]{cursor:text!important;border-color:none!important}"],changeDetection:0})};export{me as BrandInfoComponent};
@@ -1 +1 @@
1
- import{a as ae}from"./chunk-ZDMAE2CW.js";import{p as ie}from"./chunk-5UX75GPD.js";import{b as K,c as U}from"./chunk-JLVFPWD5.js";import{a as te}from"./chunk-S327F6QI.js";import{b as Z}from"./chunk-YLVLI6BR.js";import{a as X}from"./chunk-RHLDVMNJ.js";import{g as ee}from"./chunk-DLWI6JEQ.js";import{a as $}from"./chunk-5UJ5AQ7O.js";import{c as Y}from"./chunk-IUUNN5TF.js";import{h as Q,p as z}from"./chunk-LFSG3DBR.js";import{b as J}from"./chunk-LNPJ2D7B.js";import{n as H,q as G}from"./chunk-X6Z7MJUZ.js";import{$a as C,Ab as M,Ac as B,Bb as V,Cb as P,Db as g,Dc as N,Eb as n,Fb as r,Fc as h,Gb as k,Hc as x,Lc as O,Nd as A,Pb as f,Qd as q,Sb as v,Ua as l,Ub as m,db as b,hc as o,ib as I,ic as T,jb as W,jc as R,mc as u,nc as y,oc as S,qd as j,ra as s,sa as d,wb as L,yb as E}from"./chunk-VKQVNDWA.js";import{a as w,b as F}from"./chunk-NF7PG5F2.js";var re=(p,c,t,a,e,i)=>({LogisticServiceID:p,EntityID:c,From:t,To:a,StartTime:e,EndTime:i}),oe=(p,c,t)=>({From:p,To:c,LogisticsServiceID:t});function pe(p,c){if(p&1){let t=f();n(0,"button",4),v("click",function(){s(t);let e=m();return d(e.openExportModal())}),k(1,"i",5),o(2," Export "),r()}}function le(p,c){if(p&1){let t=f();n(0,"div",6)(1,"h6"),o(2,"Outlet"),r(),n(3,"outlet-selector",7),S("ngModelChange",function(e){s(t);let i=m();return y(i.pageData().Filter.EntityID,e)||(i.pageData().Filter.EntityID=e),d(e)}),r(),n(4,"h6"),o(5,"From"),r(),n(6,"datepicker",8),S("dateChange",function(e){s(t);let i=m();return y(i.pageData().Filter.From,e)||(i.pageData().Filter.From=e),d(e)}),r(),n(7,"h6"),o(8,"To"),r(),n(9,"datepicker",9),S("dateChange",function(e){s(t);let i=m();return y(i.pageData().Filter.To,e)||(i.pageData().Filter.To=e),d(e)}),r(),n(10,"h6"),o(11,"Time"),r(),n(12,"div",10)(13,"div",11)(14,"app-timepicker",12),S("timeChange",function(e){s(t);let i=m();return y(i.pageData().Filter.StartTime,e)||(i.pageData().Filter.StartTime=e),d(e)}),r()(),n(15,"div",11)(16,"app-timepicker",12),S("timeChange",function(e){s(t);let i=m();return y(i.pageData().Filter.EndTime,e)||(i.pageData().Filter.EndTime=e),d(e)}),r()()()()}if(p&2){let t,a=m();l(3),g("accessType",2),u("ngModel",a.pageData().Filter.EntityID),g("outlets",(t=a.pageData().Options)==null?null:t.Entities),l(3),u("date",a.pageData().Filter.From),l(3),u("date",a.pageData().Filter.To),l(5),g("fullWidth",!0),u("time",a.pageData().Filter.StartTime),l(2),g("fullWidth",!0),u("time",a.pageData().Filter.EndTime)}}function me(p,c){if(p&1&&(n(0,"tr")(1,"td"),o(2),r(),n(3,"td"),o(4),r(),n(5,"td",21)(6,"a",22),h(7,"date"),h(8,"date"),o(9),r()(),n(10,"td",21)(11,"a",23),h(12,"date"),h(13,"date"),o(14),r()(),n(15,"td",21),o(16),r()()),p&2){let t=c.$implicit,a=c.$index,e=m(2);l(2),T(a+1),l(2),T(t.Name),l(2),g("queryParams",N(19,re,t.ID,e.pageData().Filter.EntityID,x(7,7,e.pageData().Filter.From,"yyyy-MM-dd"),x(8,10,e.pageData().Filter.To,"yyyy-MM-dd"),e.pageData().Filter.StartTime,e.pageData().Filter.EndTime)),l(3),R(" ",t.Trans," "),l(2),g("queryParams",B(26,oe,x(12,13,e.pageData().Filter.From,"yyyy-MM-dd"),x(13,16,e.pageData().Filter.To,"yyyy-MM-dd"),t.ID)),l(3),R(" ",t.Qty," "),l(2),T(t.Weight)}}function ce(p,c){if(p&1){let t=f();n(0,"content")(1,"div",13)(2,"table",14),v("matSortChange",function(e){s(t);let i=m();return d(i.sortData(e))}),n(3,"thead",15)(4,"tr")(5,"th",16),o(6,"No"),r(),n(7,"th"),o(8,"Logistics Service Name"),r(),n(9,"th",17),o(10,"Trans"),r(),n(11,"th",18),o(12,"Qty"),r(),n(13,"th",19),o(14," Weight "),n(15,"small",20),o(16,"(gram)"),r()()()(),n(17,"tbody"),V(18,me,17,30,"tr",null,M),r()()()()}if(p&2){let t=m();l(18),P(t.data().Data)}}var ne=class p extends X{constructor(t,a,e,i,D,_){super(t,a,"Report/GetLogisticsService","ReportLoader/GetLogisticsService",e,i);this.matDialog=D;this.roleService=_}matDialog;roleService;originalData=[];postInit(t){this.originalData=t.Data}sortData(t){let a=this.data().Data.slice();if(!t.active||t.direction===""){this.data.update(i=>F(w({},i),{Data:this.originalData}));return}let e=a.sort((i,D)=>this.compare(i[t.active],D[t.active],t.direction==="asc"));this.data.update(i=>F(w({},i),{Data:e}))}openExportModal(){this.matDialog.open(Z,{data:{title:"Logistic Service",exportTypes:[{ID:"ReportExport/LogisticService",Value:"Default",FileName:"Logistics Service"}],filterExport:this.pageData().Filter,getAllDataLengthAPI:"",pagination:!1}})}onChangeTime(t,a){let e=t.toTimeString().split(" ")[0].slice(0,5);this.pageData().Filter[a]=e}static \u0275fac=function(a){return new(a||p)(C($),C(G),C(H),C(A),C(Y),C(J))};static \u0275cmp=b({type:p,selectors:[["POS-logistics-service-report"]],standalone:!1,features:[I],decls:9,vars:6,consts:[["pageFilterTemplate",""],[3,"textChange","onSubmit","filterChange","pageData","text","isFilterOnDropdown","filter"],[1,"btn","btn-outline-secondary","me-3"],["routerLink","/menu/Logistics/Report/Outbound/Logistics_Service/Detail",1,"btn","btn-outline-secondary"],[1,"btn","btn-outline-secondary","me-3",3,"click"],["aria-hidden","true",1,"fa-solid","fa-upload"],[1,"dialog-filter"],["appendTo","body","bindLabel","Name","bindValue","ID","placeholder","Choose Outlet",3,"ngModelChange","accessType","ngModel","outlets"],["name","From",3,"dateChange","date"],["name","To",3,"dateChange","date"],[1,"row"],[1,"col-6"],[3,"timeChange","fullWidth","time"],[1,"container-fluid","mt-5"],["id","tableGrid","matSort","",1,"table",3,"matSortChange"],[1,"thead-light","sticky-top-thead"],[2,"width","50px"],["mat-sort-header","Trans",1,"align-right"],["mat-sort-header","Qty",1,"align-right"],["mat-sort-header","Weight",1,"align-right",2,"width","180px"],[1,"fst-italic","text-dark"],[1,"text-end"],["routerLink","/menu/Logistics/Report/Outbound/Logistics_Service/Detail",3,"queryParams"],["routerLink","/menu/Reports/Sales_Report/Standard/Products_Sold",3,"queryParams"]],template:function(a,e){if(a&1){let i=f();n(0,"mainpanel-cmp",1),S("textChange",function(_){return s(i),y(e.pageData().Filter.Name,_)||(e.pageData().Filter.Name=_),d(_)}),v("onSubmit",function(){return e.searchFromPageOne()}),S("filterChange",function(_){return s(i),y(e.pageData().Filter,_)||(e.pageData().Filter=_),d(_)}),n(1,"actions"),L(2,pe,3,0,"button",2),n(3,"a",3),o(4," View Detail "),r()(),n(5,"filters"),W(6,le,17,9,"ng-template",null,0,O),r(),L(8,ce,20,0,"content"),r()}a&2&&(g("pageData",e.menuData()),u("text",e.pageData().Filter.Name),g("isFilterOnDropdown",!1),u("filter",e.pageData().Filter),l(2),E(e.roleService.global.Export?2:-1),l(6),E(e.data()?8:-1))},dependencies:[q,Q,z,ee,ie,K,U,ae,te,j],encapsulation:2,changeDetection:0})};export{ne as a};
1
+ import{a as ae}from"./chunk-ZDMAE2CW.js";import{p as ie}from"./chunk-5UX75GPD.js";import{b as K,c as U}from"./chunk-JLVFPWD5.js";import{a as te}from"./chunk-NXENBZHM.js";import{b as Z}from"./chunk-YLVLI6BR.js";import{a as X}from"./chunk-AT3Y46MO.js";import{g as ee}from"./chunk-77WJ3EU6.js";import{a as $}from"./chunk-36USSIER.js";import{c as Y}from"./chunk-IUUNN5TF.js";import{h as Q,p as z}from"./chunk-LFSG3DBR.js";import{b as J}from"./chunk-LNPJ2D7B.js";import{n as H,q as G}from"./chunk-X6Z7MJUZ.js";import{$a as C,Ab as M,Ac as B,Bb as V,Cb as P,Db as g,Dc as N,Eb as n,Fb as r,Fc as h,Gb as k,Hc as x,Lc as O,Nd as A,Pb as f,Qd as q,Sb as v,Ua as l,Ub as m,db as b,hc as o,ib as I,ic as T,jb as W,jc as R,mc as u,nc as y,oc as S,qd as j,ra as s,sa as d,wb as L,yb as E}from"./chunk-VKQVNDWA.js";import{a as w,b as F}from"./chunk-NF7PG5F2.js";var re=(p,c,t,a,e,i)=>({LogisticServiceID:p,EntityID:c,From:t,To:a,StartTime:e,EndTime:i}),oe=(p,c,t)=>({From:p,To:c,LogisticsServiceID:t});function pe(p,c){if(p&1){let t=f();n(0,"button",4),v("click",function(){s(t);let e=m();return d(e.openExportModal())}),k(1,"i",5),o(2," Export "),r()}}function le(p,c){if(p&1){let t=f();n(0,"div",6)(1,"h6"),o(2,"Outlet"),r(),n(3,"outlet-selector",7),S("ngModelChange",function(e){s(t);let i=m();return y(i.pageData().Filter.EntityID,e)||(i.pageData().Filter.EntityID=e),d(e)}),r(),n(4,"h6"),o(5,"From"),r(),n(6,"datepicker",8),S("dateChange",function(e){s(t);let i=m();return y(i.pageData().Filter.From,e)||(i.pageData().Filter.From=e),d(e)}),r(),n(7,"h6"),o(8,"To"),r(),n(9,"datepicker",9),S("dateChange",function(e){s(t);let i=m();return y(i.pageData().Filter.To,e)||(i.pageData().Filter.To=e),d(e)}),r(),n(10,"h6"),o(11,"Time"),r(),n(12,"div",10)(13,"div",11)(14,"app-timepicker",12),S("timeChange",function(e){s(t);let i=m();return y(i.pageData().Filter.StartTime,e)||(i.pageData().Filter.StartTime=e),d(e)}),r()(),n(15,"div",11)(16,"app-timepicker",12),S("timeChange",function(e){s(t);let i=m();return y(i.pageData().Filter.EndTime,e)||(i.pageData().Filter.EndTime=e),d(e)}),r()()()()}if(p&2){let t,a=m();l(3),g("accessType",2),u("ngModel",a.pageData().Filter.EntityID),g("outlets",(t=a.pageData().Options)==null?null:t.Entities),l(3),u("date",a.pageData().Filter.From),l(3),u("date",a.pageData().Filter.To),l(5),g("fullWidth",!0),u("time",a.pageData().Filter.StartTime),l(2),g("fullWidth",!0),u("time",a.pageData().Filter.EndTime)}}function me(p,c){if(p&1&&(n(0,"tr")(1,"td"),o(2),r(),n(3,"td"),o(4),r(),n(5,"td",21)(6,"a",22),h(7,"date"),h(8,"date"),o(9),r()(),n(10,"td",21)(11,"a",23),h(12,"date"),h(13,"date"),o(14),r()(),n(15,"td",21),o(16),r()()),p&2){let t=c.$implicit,a=c.$index,e=m(2);l(2),T(a+1),l(2),T(t.Name),l(2),g("queryParams",N(19,re,t.ID,e.pageData().Filter.EntityID,x(7,7,e.pageData().Filter.From,"yyyy-MM-dd"),x(8,10,e.pageData().Filter.To,"yyyy-MM-dd"),e.pageData().Filter.StartTime,e.pageData().Filter.EndTime)),l(3),R(" ",t.Trans," "),l(2),g("queryParams",B(26,oe,x(12,13,e.pageData().Filter.From,"yyyy-MM-dd"),x(13,16,e.pageData().Filter.To,"yyyy-MM-dd"),t.ID)),l(3),R(" ",t.Qty," "),l(2),T(t.Weight)}}function ce(p,c){if(p&1){let t=f();n(0,"content")(1,"div",13)(2,"table",14),v("matSortChange",function(e){s(t);let i=m();return d(i.sortData(e))}),n(3,"thead",15)(4,"tr")(5,"th",16),o(6,"No"),r(),n(7,"th"),o(8,"Logistics Service Name"),r(),n(9,"th",17),o(10,"Trans"),r(),n(11,"th",18),o(12,"Qty"),r(),n(13,"th",19),o(14," Weight "),n(15,"small",20),o(16,"(gram)"),r()()()(),n(17,"tbody"),V(18,me,17,30,"tr",null,M),r()()()()}if(p&2){let t=m();l(18),P(t.data().Data)}}var ne=class p extends X{constructor(t,a,e,i,D,_){super(t,a,"Report/GetLogisticsService","ReportLoader/GetLogisticsService",e,i);this.matDialog=D;this.roleService=_}matDialog;roleService;originalData=[];postInit(t){this.originalData=t.Data}sortData(t){let a=this.data().Data.slice();if(!t.active||t.direction===""){this.data.update(i=>F(w({},i),{Data:this.originalData}));return}let e=a.sort((i,D)=>this.compare(i[t.active],D[t.active],t.direction==="asc"));this.data.update(i=>F(w({},i),{Data:e}))}openExportModal(){this.matDialog.open(Z,{data:{title:"Logistic Service",exportTypes:[{ID:"ReportExport/LogisticService",Value:"Default",FileName:"Logistics Service"}],filterExport:this.pageData().Filter,getAllDataLengthAPI:"",pagination:!1}})}onChangeTime(t,a){let e=t.toTimeString().split(" ")[0].slice(0,5);this.pageData().Filter[a]=e}static \u0275fac=function(a){return new(a||p)(C($),C(G),C(H),C(A),C(Y),C(J))};static \u0275cmp=b({type:p,selectors:[["POS-logistics-service-report"]],standalone:!1,features:[I],decls:9,vars:6,consts:[["pageFilterTemplate",""],[3,"textChange","onSubmit","filterChange","pageData","text","isFilterOnDropdown","filter"],[1,"btn","btn-outline-secondary","me-3"],["routerLink","/menu/Logistics/Report/Outbound/Logistics_Service/Detail",1,"btn","btn-outline-secondary"],[1,"btn","btn-outline-secondary","me-3",3,"click"],["aria-hidden","true",1,"fa-solid","fa-upload"],[1,"dialog-filter"],["appendTo","body","bindLabel","Name","bindValue","ID","placeholder","Choose Outlet",3,"ngModelChange","accessType","ngModel","outlets"],["name","From",3,"dateChange","date"],["name","To",3,"dateChange","date"],[1,"row"],[1,"col-6"],[3,"timeChange","fullWidth","time"],[1,"container-fluid","mt-5"],["id","tableGrid","matSort","",1,"table",3,"matSortChange"],[1,"thead-light","sticky-top-thead"],[2,"width","50px"],["mat-sort-header","Trans",1,"align-right"],["mat-sort-header","Qty",1,"align-right"],["mat-sort-header","Weight",1,"align-right",2,"width","180px"],[1,"fst-italic","text-dark"],[1,"text-end"],["routerLink","/menu/Logistics/Report/Outbound/Logistics_Service/Detail",3,"queryParams"],["routerLink","/menu/Reports/Sales_Report/Standard/Products_Sold",3,"queryParams"]],template:function(a,e){if(a&1){let i=f();n(0,"mainpanel-cmp",1),S("textChange",function(_){return s(i),y(e.pageData().Filter.Name,_)||(e.pageData().Filter.Name=_),d(_)}),v("onSubmit",function(){return e.searchFromPageOne()}),S("filterChange",function(_){return s(i),y(e.pageData().Filter,_)||(e.pageData().Filter=_),d(_)}),n(1,"actions"),L(2,pe,3,0,"button",2),n(3,"a",3),o(4," View Detail "),r()(),n(5,"filters"),W(6,le,17,9,"ng-template",null,0,O),r(),L(8,ce,20,0,"content"),r()}a&2&&(g("pageData",e.menuData()),u("text",e.pageData().Filter.Name),g("isFilterOnDropdown",!1),u("filter",e.pageData().Filter),l(2),E(e.roleService.global.Export?2:-1),l(6),E(e.data()?8:-1))},dependencies:[q,Q,z,ee,ie,K,U,ae,te,j],encapsulation:2,changeDetection:0})};export{ne as a};