dealpos 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/POS/3rdpartylicenses.txt +1645 -0
- package/POS/assets/icons/icon-128x128.png +0 -0
- package/POS/assets/icons/icon-144x144.png +0 -0
- package/POS/assets/icons/icon-152x152.png +0 -0
- package/POS/assets/icons/icon-192x192.png +0 -0
- package/POS/assets/icons/icon-384x384.png +0 -0
- package/POS/assets/icons/icon-512x512.png +0 -0
- package/POS/assets/icons/icon-72x72.png +0 -0
- package/POS/assets/icons/icon-96x96.png +0 -0
- package/POS/chunk-26YXEYJK.js +1 -0
- package/POS/chunk-2DNKBN6G.js +1 -0
- package/POS/chunk-2FKYC63K.js +1 -0
- package/POS/chunk-2FWFPV5I.js +1 -0
- package/POS/chunk-2OSKJOSS.js +1 -0
- package/POS/chunk-2OXMYDYT.js +1 -0
- package/POS/chunk-2OZMF5DL.js +1 -0
- package/POS/chunk-2W3MAOOP.js +1 -0
- package/POS/chunk-33XCA4ER.js +14 -0
- package/POS/chunk-35V3VL6F.js +1 -0
- package/POS/chunk-3A7KA4YN.js +1 -0
- package/POS/chunk-3BODNSIH.js +1 -0
- package/POS/chunk-3FOIEYAT.js +4 -0
- package/POS/chunk-3PFXZUB6.js +7 -0
- package/POS/chunk-3QABPVXZ.js +3 -0
- package/POS/chunk-4BDQDYVB.js +1 -0
- package/POS/chunk-4CBDK52E.js +4 -0
- package/POS/chunk-4G26RHGA.js +1 -0
- package/POS/chunk-4MX7Q77M.js +2 -0
- package/POS/chunk-4UAHOTBD.js +1 -0
- package/POS/chunk-56EQRIAH.js +1 -0
- package/POS/chunk-5KBFQLSN.js +1 -0
- package/POS/chunk-5W7F4VJH.js +1 -0
- package/POS/chunk-64PDX5ZX.js +1 -0
- package/POS/chunk-65YDOCXF.js +1 -0
- package/POS/chunk-67VBXFVT.js +6 -0
- package/POS/chunk-6BQZINLH.js +1 -0
- package/POS/chunk-6L6CIH5M.js +1 -0
- package/POS/chunk-6PXJEE4K.js +1 -0
- package/POS/chunk-6S4Q5VRA.js +1 -0
- package/POS/chunk-75STMWUR.js +6 -0
- package/POS/chunk-76C33PK5.js +1 -0
- package/POS/chunk-77D6X2SQ.js +11 -0
- package/POS/chunk-7DWKYGA4.js +1 -0
- package/POS/chunk-7M6CWVRI.js +1 -0
- package/POS/chunk-7Q3437BR.js +1 -0
- package/POS/chunk-AA32I4UN.js +1 -0
- package/POS/chunk-AJMKP7YZ.js +1 -0
- package/POS/chunk-AOJW6WJT.js +1 -0
- package/POS/chunk-AOPKPEVH.js +1 -0
- package/POS/chunk-APJK7OH2.js +2 -0
- package/POS/chunk-APYNCJ2H.js +1 -0
- package/POS/chunk-AUYYX2UQ.js +45 -0
- package/POS/chunk-AVDGNFC7.js +1 -0
- package/POS/chunk-AWGZKLLY.js +1 -0
- package/POS/chunk-AYKDALBT.js +1 -0
- package/POS/chunk-B2OT7HA4.js +4 -0
- package/POS/chunk-B36XIZVJ.js +1 -0
- package/POS/chunk-B5FODXLM.js +1 -0
- package/POS/chunk-B7RM5KKA.js +1 -0
- package/POS/chunk-BCVO66L3.js +5 -0
- package/POS/chunk-BETKNHFK.js +1 -0
- package/POS/chunk-BH2ZVZIU.js +1 -0
- package/POS/chunk-BHXS5IA6.js +1 -0
- package/POS/chunk-BLZEDUEI.js +1 -0
- package/POS/chunk-BYXBJQAS.js +0 -0
- package/POS/chunk-BZC5JINN.js +5 -0
- package/POS/chunk-C43IYFVU.js +1 -0
- package/POS/chunk-CBW7IA6S.js +1 -0
- package/POS/chunk-CCGPOEE3.js +4 -0
- package/POS/chunk-CFIFFKWA.js +1 -0
- package/POS/chunk-CI45CZMG.js +1 -0
- package/POS/chunk-CJO25BBP.js +1 -0
- package/POS/chunk-CLL3TEL5.js +1 -0
- package/POS/chunk-CPUGWH3I.js +1 -0
- package/POS/chunk-CPW6IWAB.js +1 -0
- package/POS/chunk-CRSUSQ3W.js +1 -0
- package/POS/chunk-CW27R4N3.js +2 -0
- package/POS/chunk-CWU5DTSS.js +1 -0
- package/POS/chunk-CY2FQLP4.js +1 -0
- package/POS/chunk-DRGWLGRP.js +1 -0
- package/POS/chunk-DXF4M3Z6.js +1 -0
- package/POS/chunk-E72IOARD.js +1 -0
- package/POS/chunk-EA7CLJMQ.js +18 -0
- package/POS/chunk-ECMSF3OR.js +1 -0
- package/POS/chunk-EOFWQEK7.js +1 -0
- package/POS/chunk-EQOB7536.js +156 -0
- package/POS/chunk-ESD5O3BQ.js +1 -0
- package/POS/chunk-EZCHVNC5.js +3 -0
- package/POS/chunk-F3ZYFWTM.js +1 -0
- package/POS/chunk-F6GAPEFT.js +1 -0
- package/POS/chunk-FBR7TAEJ.js +5 -0
- package/POS/chunk-FE5LZK5I.js +1 -0
- package/POS/chunk-FOEYBSQT.js +2 -0
- package/POS/chunk-FWVI7M5F.js +1 -0
- package/POS/chunk-G4DDQBH4.js +1 -0
- package/POS/chunk-GDFWXFK2.js +1 -0
- package/POS/chunk-GHQFOULJ.js +2 -0
- package/POS/chunk-GNSQPTDB.js +1 -0
- package/POS/chunk-GSLPZSSX.js +1 -0
- package/POS/chunk-GVXSG66Q.js +1 -0
- package/POS/chunk-H55AJAX5.js +8 -0
- package/POS/chunk-HIRUHGYD.js +2 -0
- package/POS/chunk-HKR2C3HA.js +1 -0
- package/POS/chunk-HSOC6U4B.js +1 -0
- package/POS/chunk-I6CGSFEU.js +1 -0
- package/POS/chunk-I6YPWC52.js +1 -0
- package/POS/chunk-IDDHFZWG.js +1 -0
- package/POS/chunk-IE5R6YWY.js +1 -0
- package/POS/chunk-IOQ3OION.js +1 -0
- package/POS/chunk-IUKSWU5B.js +1 -0
- package/POS/chunk-IY6EDHBT.js +1 -0
- package/POS/chunk-IZGPRDGN.js +2 -0
- package/POS/chunk-J3W6DQKW.js +1 -0
- package/POS/chunk-JLWKTGB2.js +1 -0
- package/POS/chunk-JM3SJLS7.js +1 -0
- package/POS/chunk-JNUC6PO5.js +1 -0
- package/POS/chunk-K5XVN3MT.js +1 -0
- package/POS/chunk-KBQ5ZM55.js +1 -0
- package/POS/chunk-KCNSCS4R.js +1 -0
- package/POS/chunk-KI2MQKDF.js +1 -0
- package/POS/chunk-KNRLGMUT.js +1 -0
- package/POS/chunk-KR4OPCRF.js +1 -0
- package/POS/chunk-KW4B7WMB.js +1 -0
- package/POS/chunk-KYX6U2UX.js +1 -0
- package/POS/chunk-KZNSGBGF.js +2 -0
- package/POS/chunk-L3UWNQXB.js +1 -0
- package/POS/chunk-LHWN2J4H.js +15 -0
- package/POS/chunk-LJUP6CCS.js +1 -0
- package/POS/chunk-LY4FOMQ6.css +1 -0
- package/POS/chunk-LZ3SKBTU.js +1 -0
- package/POS/chunk-M5ONTRWK.js +1 -0
- package/POS/chunk-MA7NEQCZ.js +1 -0
- package/POS/chunk-MDKYCLYA.js +17 -0
- package/POS/chunk-MGDA6GY6.js +1 -0
- package/POS/chunk-MWWGZRMN.js +1 -0
- package/POS/chunk-NCATMO6T.js +1 -0
- package/POS/chunk-NDAI7L23.js +1 -0
- package/POS/chunk-NHUK6IK5.js +40 -0
- package/POS/chunk-NUZ5K7GT.js +1 -0
- package/POS/chunk-O2PELRQA.js +1 -0
- package/POS/chunk-OUOP65JB.js +1 -0
- package/POS/chunk-OXSD6KML.js +1 -0
- package/POS/chunk-PEOMRJUI.js +3 -0
- package/POS/chunk-PHGK3EAU.js +1 -0
- package/POS/chunk-PLC4GZ67.js +1 -0
- package/POS/chunk-PTF6AQY6.js +1 -0
- package/POS/chunk-PTXKBWBA.js +1 -0
- package/POS/chunk-Q3SJOSAG.js +1 -0
- package/POS/chunk-QBDEGNJP.js +1 -0
- package/POS/chunk-QCTMAR3L.js +1 -0
- package/POS/chunk-QZWOQRAM.js +1 -0
- package/POS/chunk-R5VG3XDC.js +1 -0
- package/POS/chunk-R7NR3M2Q.js +1 -0
- package/POS/chunk-RBKYZOZX.js +3 -0
- package/POS/chunk-RHQGCHFI.js +1 -0
- package/POS/chunk-RL3GYZVU.js +8 -0
- package/POS/chunk-RRKCUSBB.js +1 -0
- package/POS/chunk-S4OLP2TR.js +18 -0
- package/POS/chunk-SDH32O74.js +1 -0
- package/POS/chunk-SE7OFLAL.js +1 -0
- package/POS/chunk-SEVYM4GA.js +1 -0
- package/POS/chunk-SGRJ5YG2.js +1 -0
- package/POS/chunk-SNNLFZQ3.js +3 -0
- package/POS/chunk-SVNOJVQF.js +1 -0
- package/POS/chunk-TCLYGBIP.js +1 -0
- package/POS/chunk-TIDDF777.js +1 -0
- package/POS/chunk-TJQIORGG.js +1 -0
- package/POS/chunk-TK5H65DN.js +1 -0
- package/POS/chunk-TLHNFDPP.js +1 -0
- package/POS/chunk-TVNDX4KA.js +3 -0
- package/POS/chunk-TX6G2LAN.js +1 -0
- package/POS/chunk-U3O6FO5X.js +1 -0
- package/POS/chunk-UJMXJABS.js +1 -0
- package/POS/chunk-UNGT7KQO.js +1 -0
- package/POS/chunk-UPRH3DLS.js +1 -0
- package/POS/chunk-UVFDCVT4.js +2 -0
- package/POS/chunk-V22EVF6N.js +1 -0
- package/POS/chunk-V4RKZMUB.js +11 -0
- package/POS/chunk-VBOV2ZGQ.js +1 -0
- package/POS/chunk-VGGNSOCP.js +1 -0
- package/POS/chunk-VLGOEX3D.js +24 -0
- package/POS/chunk-VPAQFQA7.js +1 -0
- package/POS/chunk-VSMYP4AC.js +1 -0
- package/POS/chunk-VXCP4DBC.js +1 -0
- package/POS/chunk-W43P2XHR.js +1 -0
- package/POS/chunk-W7PIRMKD.js +1 -0
- package/POS/chunk-WG6PV6VL.js +4 -0
- package/POS/chunk-WK4T26FX.js +2 -0
- package/POS/chunk-WKS7JIOA.js +1 -0
- package/POS/chunk-WKXE4B24.js +1 -0
- package/POS/chunk-WLRXTHLM.js +1 -0
- package/POS/chunk-WSZGVB3P.js +1 -0
- package/POS/chunk-WXHOQKTU.js +1 -0
- package/POS/chunk-X55EKFUZ.js +1 -0
- package/POS/chunk-X7QMXCEW.js +4 -0
- package/POS/chunk-XIGLLWLV.js +1 -0
- package/POS/chunk-XRKZOON6.js +4 -0
- package/POS/chunk-XW2QKXZF.js +5 -0
- package/POS/chunk-XZPCPUT7.js +1 -0
- package/POS/chunk-Y5SPDICN.js +2 -0
- package/POS/chunk-Y7XBMFXR.js +1 -0
- package/POS/chunk-YATUCULL.js +1 -0
- package/POS/chunk-YBFOOZH4.js +2 -0
- package/POS/chunk-YBINYTS7.js +1 -0
- package/POS/chunk-YE2HNBMX.js +1 -0
- package/POS/chunk-YENHZRM5.js +9 -0
- package/POS/chunk-YHCFOJEX.js +1 -0
- package/POS/chunk-YKBQYDEJ.js +2 -0
- package/POS/chunk-YPFXYXHP.js +8 -0
- package/POS/chunk-YRHYSRBM.js +1 -0
- package/POS/chunk-YRITVFOW.js +1 -0
- package/POS/chunk-YRNTUREW.js +1 -0
- package/POS/chunk-YXRRTX7W.js +1 -0
- package/POS/chunk-Z426RGUL.js +24 -0
- package/POS/chunk-ZB45Y55B.js +1 -0
- package/POS/chunk-ZGRVB4IB.js +1 -0
- package/POS/chunk-ZJ3TX62Q.js +1 -0
- package/POS/chunk-ZKWXTWYY.js +1 -0
- package/POS/index.html +33 -0
- package/POS/main-CNMNNNEI.js +4 -0
- package/POS/main-VPAR6OBK.css +1 -0
- package/POS/manifest.webmanifest +59 -0
- package/POS/media/color-727V6BA6.png +0 -0
- package/POS/media/hue-3YTJE6JS.png +0 -0
- package/POS/media/primeicons-4GST5W3O.woff2 +0 -0
- package/POS/media/primeicons-DHQU4SEP.svg +345 -0
- package/POS/media/primeicons-GEFHGEHP.ttf +0 -0
- package/POS/media/primeicons-P53SE5CV.woff +0 -0
- package/POS/media/primeicons-RSSEDYLY.eot +0 -0
- package/POS/polyfills-FHOOFFEX.js +2 -0
- package/POS/scripts-3E2G6IZ4.js +10 -0
- package/POS/styles-T7FPZRNG.css +25 -0
- package/Styles/Master/app_custom.css +18 -0
- package/Styles/Master/login_custom.css +0 -0
- package/Styles/Print/PaperSize8cm_custom.css +1 -0
- package/Styles/Print/PaperSizeA4_custom.css +1 -0
- package/StylesB/Master/app_custom.css +0 -0
- package/package.json +1 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{a as Fn}from"./chunk-TK5H65DN.js";import{b as Tt}from"./chunk-F6GAPEFT.js";import{a as ai}from"./chunk-6L6CIH5M.js";import{a as Jn}from"./chunk-PLC4GZ67.js";import{e as jn}from"./chunk-AVDGNFC7.js";import{b as Gn}from"./chunk-J3W6DQKW.js";import{d as Un}from"./chunk-NUZ5K7GT.js";import{a as Hn}from"./chunk-KYX6U2UX.js";import{a as ue,b as we,e as $n}from"./chunk-MGDA6GY6.js";import{b as Ln}from"./chunk-ECMSF3OR.js";import{a as kn,b as Wn,c as qn}from"./chunk-YENHZRM5.js";import{a as Vn}from"./chunk-LZ3SKBTU.js";import{a as Kn}from"./chunk-5W7F4VJH.js";import{b as En,d as Rn,g as Nn}from"./chunk-GVXSG66Q.js";import{d as ri}from"./chunk-XW2QKXZF.js";import{b as An}from"./chunk-IY6EDHBT.js";import{a as Qi}from"./chunk-IOQ3OION.js";import{b as wn}from"./chunk-C43IYFVU.js";import{a as ut}from"./chunk-G4DDQBH4.js";import{a as Cn}from"./chunk-ZJ3TX62Q.js";import{a as Bn}from"./chunk-CLL3TEL5.js";import{o as _n}from"./chunk-EZCHVNC5.js";import{c as vn}from"./chunk-64PDX5ZX.js";import{a as Qn}from"./chunk-AOJW6WJT.js";import{a as zn}from"./chunk-APYNCJ2H.js";import{g as yn}from"./chunk-I6YPWC52.js";import{a as Sn,b as pt}from"./chunk-FBR7TAEJ.js";import{C as In,D as Be,G as It,H as Ce,I as ne,J as U,K as Q,L as Te,O as Tn,i as he,j as bn,k as q,l as de,m as Ie,o as $,p as J,q as ii,w as xn,y as Je}from"./chunk-V4RKZMUB.js";import{Aa as ei,Ba as xt}from"./chunk-2FKYC63K.js";import{G as dt,O as oi,g as Pn,n as ni,o as On,q as Dn,u as Mn}from"./chunk-2W3MAOOP.js";import{a as $e}from"./chunk-AWGZKLLY.js";import{a as sn,c as ln}from"./chunk-DXF4M3Z6.js";import{e as ti}from"./chunk-WK4T26FX.js";import{a as te}from"./chunk-2FWFPV5I.js";import{C as hn,c as me,e as Zt,h as pe,i as cn,k as mn,l as Ue,n as Me,o as pn,r as mt,u as dn,v as un,x as gn,y as fn}from"./chunk-4G26RHGA.js";import{a as f,d as Xt}from"./chunk-26YXEYJK.js";import{a as an}from"./chunk-WG6PV6VL.js";import{a as xe}from"./chunk-RRKCUSBB.js";import{$b as O,$c as ee,Ab as s,Bb as b,Cb as G,Db as W,E as le,Eb as Wt,Fb as x,Hc as We,I as ke,Ib as S,Kb as d,L as rt,M as Ae,Nd as rn,P as Pe,Pa as Ve,Pc as De,Qa as at,Ra as ji,Rc as ae,Sb as qt,Sc as se,Sd as A,Tb as $t,Tc as Zi,Ua as l,Ub as Jt,Uc as Xi,Va as _,Vc as en,W as jt,Wc as tn,Xc as lt,Yb as j,Z as Qt,Zb as m,Zc as ct,_ as ie,_b as P,ac as zt,b as Ht,ba as ce,bb as Fe,bc as Yi,cc as F,cd as qe,d as be,da as Oe,dc as H,e as re,ec as B,gb as h,gc as Kt,ha as M,ia as Ut,ic as R,jc as Yt,k as it,ka as u,kd as nn,la as X,mb as p,n as Ji,o as Se,p as nt,pa as V,q as Bt,qa as Gt,qb as Ki,qc as y,r as Lt,rc as T,rd as on,sc as K,t as z,tc as st,u as ot,ub as E,v as zi,vb as Ot,wa as C,wc as He,xa as v,xb as Dt,yb as Mt,zb as a}from"./chunk-H55AJAX5.js";var ze=class{constructor(t){this.roleService=t;t&&this.setRole()}_Retrieve;_DateEditor;_NumberEditor;_PriceVisible;_UnitPriceEditor;_PricebookSelector;_Cost;_Return;_Discount;_SalesPerson;_PriceMinimum;_Payment;_CreditSalesLock;_CustomerInputLock;_PaymentCodeLock;_Shipping;_Tax;_DeleteItem;_BundlingPrice;_EmailRestriction;_ParkedDeletionAuthorized;_SellEditor;_ContactCreate;_PrepaidPackageCreate;_Order;_Reprint;_Contacts;_InventoryView;_DebtView;_ClearCart;_SellDelete;_DeliveryEditor;_CouponInputLock;_Park;_Commission;setRole(){this._Retrieve=this.roleService.sell.RetrieveR,this._DateEditor=this.roleService.global.Date,this._NumberEditor=this.roleService.sell.Number,this._PriceVisible=this.roleService.sell.PriceVisible,this._SalesPerson=this.roleService.sell.SalesPerson,this._UnitPriceEditor=this.roleService.sell.UnitPriceEditor,this._PricebookSelector=this.roleService.sell.PricebookSelector,this._Cost=this.roleService.product.Cost,this._Return=this.roleService.sell.Return,this._Discount=this.roleService.sell.Discount,this._PriceMinimum=this.roleService.sell.PriceMinimum,this._Payment=this.roleService.sell.Payment,this._CreditSalesLock=this.roleService.sell.CreditSalesLock,this._CustomerInputLock=this.roleService.sell.CustomerInputLock,this._PaymentCodeLock=this.roleService.sell.PaymentCodeLock,this._Shipping=this.roleService.sell.Shipping,this._Tax=this.roleService.sell.Tax,this._DeleteItem=this.roleService.sell.DeleteItem,this._BundlingPrice=this.roleService.sell.BundlingPrice,this._EmailRestriction=this.roleService.sell.Email,this._SellEditor=this.roleService.sell.Edit,this._ContactCreate=this.roleService.contact.Create,this._PrepaidPackageCreate=this.roleService.prepaidPackage.Create,this._Order=this.roleService.order.View,this._Contacts=this.roleService.contact.View,this._InventoryView=this.roleService.inventory.View,this._DebtView=this.roleService.debt.View,this._ClearCart=this.roleService.sell.DeleteItem,this._SellDelete=this.roleService.sell.Delete,this._DeliveryEditor=this.roleService.logistic.Edit,this._Reprint=this.roleService.order.Print,this._CouponInputLock=this.roleService.sell.CouponInputLock,this._Park=this.roleService.sell.Park,this._Commission=this.roleService.product.CommissionView}get Park(){return this._Park}get CouponInputLock(){return this._CouponInputLock}set CouponInputLock(t){this._CouponInputLock=t}get Retrieve(){return this._Retrieve}get DateEditor(){return this._DateEditor}set DateEditor(t){this._DateEditor=t}get NumberEditor(){return this._NumberEditor}set NumberEditor(t){this._NumberEditor=t}get PriceVisible(){return this._PriceVisible}get UnitPriceEditor(){return this._UnitPriceEditor}set UnitPriceEditor(t){this._UnitPriceEditor=t}get PricebookSelector(){return this._PricebookSelector}set PricebookSelector(t){this._PricebookSelector=t}get Cost(){return this._Cost}get Return(){return this._Return}set Return(t){this._Return=t}get Discount(){return this._Discount}set Discount(t){this._Discount=t}get SalesPerson(){return this._SalesPerson}get PriceMinimum(){return this._PriceMinimum}get Payment(){return this._Payment}get CreditSalesLock(){return this._CreditSalesLock}get CustomerInputLock(){return this._CustomerInputLock}get PaymentCodeLock(){return this._PaymentCodeLock}get Shipping(){return this._Shipping}get Tax(){return this._Tax}set Tax(t){this._Tax=t}get DeleteItem(){return this._DeleteItem}get BundlingPrice(){return this._BundlingPrice}get Email(){return this._EmailRestriction}get ParkedDeletionAuthorized(){return this._ParkedDeletionAuthorized}set ParkedDeletionAuthorized(t){this._ParkedDeletionAuthorized=t}get SellEditor(){return this._SellEditor}get ContactsCreate(){return this._ContactCreate}get PrepaidPackageCreate(){return this._PrepaidPackageCreate}get Order(){return this._Order}get Reprint(){return this._Reprint}get Contacts(){return this._Contacts}get InventoryView(){return this._InventoryView}get DebtView(){return this._DebtView}get ClearCartRestriction(){return this._ClearCart}get SellDelete(){return this._SellDelete}get DeliveryEditor(){return this._DeliveryEditor}get Commission(){return this._Commission}};var si=class{Success;Message;message;ObjectID;SalesOrderID;OutDeliveryID;Contact;LoyaltyPoint;InvoiceNumber;Creator;OrderTimeString;PrintMode;PaymentStateID;PaymentStateLabel;Final;constructor(){this.Success=!0,this.Message="",this.ObjectID="",this.SalesOrderID="",this.OutDeliveryID="",this.Contact=null,this.LoyaltyPoint="",this.InvoiceNumber="",this.Creator="",this.OrderTimeString="",this.PrintMode=0,this.PaymentStateID=0,this.PaymentStateLabel="",this.Final=0}};var gt=class o{constructor(t,e,i,n){this.httpService=t;this._localDataService=e;this._onlineStatusService=i;this._toastrService=n;this._onlineStatusService.getOnlineStatus$().subscribe(r=>{this.isOnline=r})}_Data=new re(null);Data$=this._Data.pipe(Pe(),le(t=>t!==null));isOnline;get Data(){return this._Data.value}pushNewValue(t){this._Data.next(t)}getSalesOrderPrint(t){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:t})}submitOrder(t,e){let i=this.generatePOSDataForSubmission(t,this.isOnline);if(this.isOnline)return this.submitOnline(i).pipe(this.handleTimeOutError(i));if(e.ModuleSell.EnableOfflineTransaction)return this._localDataService.syncOrder(i).pipe(z(()=>this.generateCompleteData(i)));this._toastrService.warning("Offline order is not Supported!","Info!")}uploadOfflineOrder(t){return this._localDataService.uploadSingleOrder(t).pipe(ke(e=>e?.message?.includes("objectStore does not exists")?this.submitOnline(t):nt(()=>e)))}submitOnline(t){return this.httpService.post(Q.SubmitOrder,t,an.pos.submitOrderTimeout)}handleTimeOutError(t){return Ht(ke(e=>{if(e instanceof Lt||e?.name=="TimeoutError"){let i=this.generateCompleteData(t);this.pushNewValue(i)}throw e}))}generatePOSDataForSubmission(t,e=!0){let i=Object.assign(new ne,t);i.Items=[],i.Order.CustomerID==null&&(i.Order.CustomerID=f.GuidEmpty),i.Order.SalesID==null&&(i.Order.SalesID=f.GuidEmpty);let n=1;i.Payments=i.Payments.map(c=>(c.Date=i.Order.Date,c.Index=n,n++,delete c.TypeID,c));let r=1;for(let c of i.CartItems){let g=new In;g.ID=c.ID,g.VariantID=c.VariantID,g.Quantity=c.Quantity,g.Cost=c.Cost,g.Price=c.Price,g.Discount=c.Discount,g.DiscountAmount=c.DiscountAmount,g.Note=c.Note,g.Taxable=c.Variant.Taxable,g.LoyaltyPoint=c.LoyaltyPoint,g.UnitCost=c.Cost,g.UnitPrice=c.Price,g.UnitPriceOriginal=c.UnitPriceOriginal,g.UnitExpense=c.UnitExpense,g.EntityID=c.EntityID,g.Index=r,g.UnitQuantity=c.UnitQuantity,g.PriceTypeID=c.PriceTypeID,g.PriceNote=c.PriceNote,g.Splited=c.SplitQuantity>0,g.SplitQuantity=c.SplitQuantity,g.InventoryTypeID=c.Variant.TypeID,g.SalesID="",g.Serial=c.Serial,c.SalesID&&(g.SalesID=c.SalesID),delete c.CouponDiscount,i.Items.push(g),r++}return e?(delete i.CartItems,delete i.Order.ClientTimestamp):i.Order.ClientTimestamp=new Date,i}generateCompleteData(t){let e=new si;return e.InvoiceNumber=t.Order.Number,e.OrderTimeString=new Date().toString(),e.PaymentStateID=t.Action?.Type,e.PaymentStateLabel="Offline",e.Success=!0,e.OutDeliveryID=t.Action.DeliveryEntityID,e}GetReturnInvoice(t,e){return this.httpService.get(Q.ReturInvoice,[{key:"EntityID",value:e},{key:"Number",value:t}])}GetInvoiceBySoID(t){return this.httpService.get(Q.GetPOSDataByID,[{key:"ID",value:t}])}UploadCSV(t,e){let i={CartItems:t,EntityID:e};return this.httpService.post(Q.UploadCsv,i)}sendEmail(t,e){return new Promise((i,n)=>{this._localDataService.isProductFromServer().subscribe(r=>{if(r){let c={invoiceID:e,email:t};this.httpService.post(Q.SendInvoiceEmail,c).subscribe({next:g=>{i(g)},error:g=>{n(g)}})}else n(U.wrongOfflineAction)})})}sendWhatsaap(t,e){let i={InvoiceID:t,PhoneNumber:e};return this.httpService.post(Q.SendInvoiceWhatsapp,i)}saveCommission(t,e){let i={SOID:t,commission:e};return this.httpService.POSText("/API/Transaction/SetCommission",i)}generateReceiptA4(t){let e={ID:t};return this.httpService.post(Q.InvoiceA4,e)}getVacant(t){return this.httpService.get(Q.GetVacant,[{key:"EntityID",value:t}])}static \u0275fac=function(e){return new(e||o)(u(xe),u(Te),u(ue),u(A))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var L=class o{constructor(t,e,i){this._localDataService=t;this._onlineStatusService=e;this._httpService=i;this._onlineStatusService.getOnlineStatus$().subscribe(n=>{this.isOnline=n})}_Data=new re(null);Data$=this._Data.asObservable().pipe(le(t=>t!==null),Pe());isOnline;get Data(){return this._Data.value}pushNewValue(t){this._Data.next(t)}requestObservable(){return this.isOnline?this._httpService.get(Q.GetPOSStorage).pipe(z(t=>({data:t,type:"Online"}))):this._localDataService.getPOSStorage().pipe(le(t=>t!=null),z(t=>({data:t,type:"Offline"})))}getOutletName(t){return this.Data.Entities.find(i=>i.ID==t)?.Name}static \u0275fac=function(e){return new(e||o)(u(Te),u(ue),u(xe))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ne=class o{constructor(t){this.roleService=t;this.pushNewValue(new ze(t))}_Data=new re(new ze(null));get Data(){return this._Data.value}Data$=this._Data.asObservable();pushNewValue(t){this._Data.next(t)}static \u0275fac=function(e){return new(e||o)(u(Xt))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var Nt=class{ID;Code;EntityID;Name;Description;Start;StartDisplay;State;Open;CashierID;OpeningCash;EntityName;LoginID;Active;CustomerDisplayEnabled;OvoConfigurationID;CustomerDisplayID;ListImage;Suspended};var mo=o=>({active:o}),po=o=>({gray:o});function uo(o,t){if(o&1){let e=x();a(0,"span",17),S("click",function(n){C(e);let r=d().$implicit;return d().closeRegister(r),v(n.stopPropagation())}),s()}}function go(o,t){o&1&&(a(0,"div")(1,"span",18),m(2,"VACANT"),s()())}function fo(o,t){if(o&1&&(a(0,"div")(1,"span",19),b(2,"i",20),a(3,"font"),m(4),s()(),a(5,"span",21),b(6,"i",22),a(7,"font"),m(8),s()()()),o&2){let e=d().$implicit;l(4),P(e.LoginID),l(4),O("",e.StartDisplay.split(" ")[3]," - Now")}}function ho(o,t){if(o&1){let e=x();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),S("click",function(){let n=C(e).$implicit,r=d();return v(r.select(n))}),a(4,"span"),b(5,"i",13),m(6),y(7,"limitTo"),s(),h(8,uo,1,0,"span",14),s(),a(9,"div",15),S("click",function(){let n=C(e).$implicit,r=d();return v(r.select(n))}),h(10,go,3,0,"div",16)(11,fo,9,2,"div",16),s()()()()}if(o&2){let e=t.$implicit,i=d();l(),p("ngClass",e.Active?"active":""),l(),p("ngClass",R(11,mo,(e==null?null:e.ID)==(i.selectedRegister==null?null:i.selectedRegister.ID))),l(),p("ngClass",R(13,po,e!=i.selectedRegister)),l(3),P(K(7,8,e.Name,15)),l(2),p("ngIf",e.State!="Close"),l(),p("ngSwitch",e.State),l(),p("ngSwitchCase","Close"),l(),p("ngSwitchCase","Open")}}var li=class o{constructor(t,e,i,n,r){this._dialogRef=t;this._outletService=e;this._posService=i;this._userRoleService=n;this.router=r}registers;searchInput="";selectedRegister=new Nt;modalConfig=new $;role;get AppConfigJSON(){return this._posService.Data.AppConfigJSON}destroy$=new be;ngOnInit(){this.subscribeToObsChanges(),this.initModalConfig()}subscribeToObsChanges(){this._posService.Data$.pipe(ce(this.destroy$)).subscribe(t=>{this.registers=t.Registers}),this._outletService.Data$.pipe(ce(this.destroy$)).subscribe(t=>{this.selectedRegister=this.findOutletRegisterById(t.RegisterID)}),this._userRoleService.Data$.pipe(ce(this.destroy$)).subscribe(t=>{this.role=t})}findOutletRegisterById(t){let e=this.registers.find(i=>i.ID===t);return e||new Nt}initModalConfig(){this.modalConfig.hideClose=!1,this.modalConfig.hideCancel=!1,this.modalConfig.bodyScrollable=!0,this.modalConfig.title="Choose an outlet"}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}close(){this._dialogRef.close()}onOk(){if(this.selectedRegister.ID==null){alert("Please select a register first!");return}this._outletService.pushNewRegister(this.selectedRegister),this._dialogRef.close(this.selectedRegister)}select(t){if(this.AppConfigJSON.ModuleShift.Closure.Enabled)if(this.selectedRegister.ID!=null&&this.selectedRegister.Open&&t.CashierID==null)confirm("You already have an active register with "+this.selectedRegister.Name+`!
|
|
2
|
+
Do you want to end your session?`)&&(this.close(),this.router.navigate(["menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:t.ID}}));else if(!t.Open||this.selectedRegister.ID==t.ID)this.selectedRegister=t;else{if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+t.Name+" - Unauthorized Access");return}alert("This Register has already active register, Are you sure you want to end this register?"),this.close(),this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:t.ID}})}else this.selectedRegister=t}closeRegister(t){let e=this.selectedRegister.ID;if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+t.Name+" - Unauthorized Access");return}e==t.ID?this.router.navigate(["/menu/Shift/Main/My_Shift"]):this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:t.ID}}),this.close()}static \u0275fac=function(e){return new(e||o)(_(q),_(Y),_(L),_(Ne),_(rn))};static \u0275cmp=V({type:o,selectors:[["pos-modal-register"]],decls:12,vars:7,consts:[[3,"onOk","onCancel","onClose","config"],[1,"ms-0","mb-8",2,"width","200px",3,"hidden"],[1,"input-group","mb-3"],[1,"input-group-text","txtFilter"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["data-cy","SearchOutlet","type","text","placeholder","Filter by Name","aria-label","Search",1,"txtFilter","form-control","border-start-0",3,"ngModelChange","ngModel"],[1,"container"],[1,"row",2,"width","600px"],["class","col-4","data-cy","registers",4,"ngFor","ngForOf"],["data-cy","registers",1,"col-4"],[1,"card","border-0",3,"ngClass"],[1,"card-body","p-0",3,"ngClass"],[1,"card-title","mb-0",3,"click","ngClass"],[1,"fa-solid","fa-house","pe-1","fs-6"],["class","fa fa-xmark-circle fa-lg position-absolute","style","text-shadow: 0 1px 0 #afafaf; right: 5px; top: 16px;",3,"click",4,"ngIf"],[1,"card-text","px-0","py-2",3,"click","ngSwitch"],[4,"ngSwitchCase"],[1,"fa","fa-xmark-circle","fa-lg","position-absolute",2,"text-shadow","0 1px 0 #afafaf","right","5px","top","16px",3,"click"],[1,"idle"],[1,"cashier"],["aria-hidden","true",1,"fa","fa-user","pe-2"],[1,"open"],["aria-hidden","true",1,"fa-regular","fa-clock","pe-2"]],template:function(e,i){e&1&&(a(0,"modal-material",0),S("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),a(1,"content")(2,"div",1)(3,"div",2)(4,"span",3),b(5,"i",4),s(),a(6,"input",5),B("ngModelChange",function(r){return H(i.searchInput,r)||(i.searchInput=r),r}),s()()(),a(7,"div",6)(8,"div",7),h(9,ho,12,15,"div",8),y(10,"FilterByName"),s()()(),b(11,"footer"),s()),e&2&&(p("config",i.modalConfig),l(2),p("hidden",i.registers.length<=6),l(4),F("ngModel",i.searchInput),l(3),p("ngForOf",K(10,4,i.registers,i.searchInput)))},dependencies:[De,ae,se,Zi,Xi,me,pe,Me,J,ni,Mn],styles:[".bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.col-4[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]{width:180px;min-height:95px;margin-right:17px;margin-bottom:17px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]{display:block;outline:0;border:1px solid #B1AAAA;border-radius:5px;cursor:pointer}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{height:30px;border-radius:4px;padding:5px 10px;color:#fff;background:#b1aaaa;overflow:hidden}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover, .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%]{background:#ffffe1;border:1px solid #89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%]{background:#89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{border:1px solid #c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover > h6[_ngcontent-%COMP%]{background:#c9302c!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]{border:1px solid #f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover{border:1px solid #f6a828;background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover > strong[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] div[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.75rem!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{height:80px;padding:15px 10px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;font-weight:400;font-size:.875rem;width:100%;margin-bottom:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:first-child{margin-top:-10px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:last-child{margin-bottom:0}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{text-align:center;position:absolute;bottom:0;right:0;width:auto;background-color:#b1aaaa;border-radius:3px;padding:2px 5px;color:#fff;display:none!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.idle[_ngcontent-%COMP%]{display:block;font-size:1.25rem;text-align:center}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{position:absolute;width:27px;height:28px;cursor:pointer;top:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#000}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:last-of-type{right:-5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:nth-last-of-type(2){right:15px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{bottom:20px;right:5px;position:absolute}.col-4[_ngcontent-%COMP%] .duration[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{border:1px solid!important;position:absolute;bottom:-3px;left:58px;background:#fff;border-radius:5px}"]})};var Co=["inputCash"],ci=class o{constructor(t,e){this.dialogRef=t;this.data=e;this.generateModalTitle$.subscribe()}registerService=X(Y);loadPOSService=X(L);register=this.registerService.Data;username=this.loadPOSService?.Data?.UserName;amount=Fe(0);config=new $;currentRegisterName;generateModalTitle$=this.registerService.Data$.pipe(le(t=>f.IsNotEmpty(t)),Oe(()=>{let t=this.registerService.getOutletRegister(),e=t?.Name?.length>18?`${t?.Name?.substring(0,18)}...`:t?.Name;this.config.title="Open Shift",this.currentRegisterName=e}),he());today=new Date;inputCashEl;ngOnInit(){this.config.customWidth="350px",this.config.hideCancel=!0}ngAfterViewInit(){this.inputCashEl?.nativeElement?.focus()}onOk(){this.dialogRef.close({amount:this.amount()})}static \u0275fac=function(e){return new(e||o)(_(q),_(de))};static \u0275cmp=V({type:o,selectors:[["POS-modal-opening-cash"]],viewQuery:function(e,i){if(e&1&&qt(Co,5),e&2){let n;$t(n=Jt())&&(i.inputCashEl=n.first)}},decls:25,vars:8,consts:[["inputCash",""],[3,"onOk","onCancel","onClose","config"],[1,"table","fs-5","text"],[1,"py-3"],[1,"text-end","pe-3"],[1,"py-4"],[1,"text-end"],["data-cy","InputCash","autoNum","",1,"border","form-control-lg","text-end","w-100",3,"ngModelChange","ngModel"]],template:function(e,i){if(e&1){let n=x();a(0,"modal-material",1),S("onOk",function(){return C(n),v(i.onOk())})("onCancel",function(){return C(n),v(i.dialogRef.close())})("onClose",function(){return C(n),v(i.dialogRef.close())}),a(1,"content")(2,"table",2)(3,"tr")(4,"td",3),m(5,"Outlet Register"),s(),a(6,"td",4),m(7),s()(),a(8,"tr")(9,"td",5),m(10,"Current User"),s(),a(11,"td",4),m(12),s()(),a(13,"tr")(14,"td",5),m(15,"Starting Time"),s(),a(16,"td",4),m(17),y(18,"date"),s()(),a(19,"tr")(20,"td",3),m(21,"Starting Cash"),s(),a(22,"td",6)(23,"input",7,0),B("ngModelChange",function(c){return C(n),H(i.amount,c)||(i.amount=c),v(c)}),s()()()()()()}e&2&&(p("config",i.config),l(7),P(i.currentRegisterName),l(5),P(i.username),l(5),P(K(18,5,i.today,"EEEE, HH:mm")),l(6),F("ngModel",i.amount))},dependencies:[me,pe,Me,J,pt,ct],styles:[".table-title-width[_ngcontent-%COMP%]{width:120px}"]})};var mi=class{OrderNumberElement;InvoiceNumberElement;NewOrderID};var ht=class o{constructor(t,e,i){this._httpService=t;this._onlineStatusService=e;this._localDataService=i;this._onlineStatusService.getOnlineStatus$().subscribe(n=>{this.isOnline=n})}isOnline;GenerateNumber(t,e){if(this.isOnline)return this._httpService.get(Q.GenerateNumber,[{key:"EntityID",value:t},{key:"TypeID",value:1}]);{let i=new mi;return f.IsNotEmpty(e.NumberElement)&&(e.NumberElement.Seed+=1),f.IsNotEmpty(e.InvoiceNumberElement)&&(e.InvoiceNumberElement.Seed+=1),i.InvoiceNumberElement=e.InvoiceNumberElement,i.OrderNumberElement=e.NumberElement,i.NewOrderID=f.Guid_NewGuid(),Se(i)}}findRegisterById(t){return new Promise(e=>{this._localDataService.isConfigFromServer().subscribe(i=>{i?this._httpService.get(Q.GetRegisterInfo,[{key:"RegisterID",value:t}]).subscribe(n=>{e(n)}):this._localDataService.findRegisterByID(t).subscribe(n=>{e(n)})})})}recordOpeningCash(t){return Bt(this._httpService.post("/API/POS/RecordOpeningCash",t))}static \u0275fac=function(e){return new(e||o)(u(xe),u(ue),u(Te))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var Y=class o{constructor(t,e,i,n,r){this._signalRClientService=t;this._matDialog=e;this._posHttpResponseService=i;this._CoreHttpService=n;this._toastrService=r}_Data=new re(null);Data$=this._Data.asObservable().pipe(le(t=>t!==null),Pe());get Data(){return this._Data.value}getSalesname(t){return this.Data&&this.Data.ListSales?this._Data.value.ListSales.find(e=>e.ID==t)?.Name:""}setActiveRegisterFromOptions(t,e){let n=this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled;if(t.length>1){let r=t.find(c=>c.LoginID==e);if(r)this.pushNewRegister(r);else{let c=this.Data?this.Data.RegisterID:null;f.IsEmpty(c)?this.openChooseRegisterModal():n&&this.openChooseRegisterModal()}}t.length==1&&(this.pushNewRegister(t[0]),f.IsEmpty(t[0].LoginID)&&f.IsEmpty(t[0].CashierID)&&this.openOpeningCashModal(t[0].ID)),t.length==0&&this._toastrService.warning("You do not have access to any OUTLET","Warning")}openChooseRegisterModal(){this._matDialog.open(li,{id:"registerModal",disableClose:!0}).afterClosed().pipe(le(t=>f.IsNotEmpty(t))).subscribe(t=>{t&&this.openOpeningCashModal(t.ID)})}openOpeningCashModal(t){this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled&&this._matDialog.open(ci,{disableClose:!0}).afterClosed().pipe(le(n=>f.IsNotEmpty(n))).subscribe(n=>{let r={RegisterID:t,OpAmount:n.amount};this._CoreHttpService.recordOpeningCash(r)})}pushNewRegister(t){let e=this._Data.value,i=e?e.RegisterID:null;i!=t.ID&&this._CoreHttpService.findRegisterById(t.ID).then(n=>{n.RegisterCode=t.Code,n.DefaultPrintTemplate=n.PrintTemplate,this._signalRClientService.SubscribeGroup(n.RegisterID,i),this.pushNewValue(n)})}getOutletRegister(){let t=this.Data.RegisterID;return this._posHttpResponseService.Data.Registers.find(n=>n.ID==t)}pushNewValue(t){this._Data.next(t)}findOutletRegisterById(t){return this._posHttpResponseService.Data.Registers.find(n=>n.ID===t)}static \u0275fac=function(e){return new(e||o)(u($e),u(Ie),u(L),u(ht),u(A))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var pi=class{RegisterID;Number;Amount;TransactionID};var et=class{GroupID;Method;Data};var di=class{Status;InvoiceID;LoyaltyPoint;diff};var ui=class{GopayQr};var kt=(r=>(r[r.cash=1]="cash",r[r.card=2]="card",r[r.emoney=3]="emoney",r[r.other=4]="other",r[r.ECR=99]="ECR",r))(kt||{});var N=class o{constructor(t,e,i){this._OrderHttpService=t;this._customerHttpService=e;this._toastrService=i}_Data=new re(new ne);transaction_id;Data$=this._Data.asObservable();get Data(){return this._Data.value}pushNewValue(t){if(t)this._Data.next(t);else{let e=this.Data;this._Data.next(e)}}submitOrder(t){return new Promise((e,i)=>{this.checkTransactionId(),this._OrderHttpService.submitOrder(this.Data,t).subscribe({next:n=>{e(n)},error:n=>{this.Data.Items=[],i(n)}})})}uploadOfflineOrder(){return this.checkTransactionId(),this._OrderHttpService.uploadOfflineOrder(this.Data)}checkTransactionId(){let e=this.Data.Payments.find(i=>i.TypeID==3);f.IsNotEmpty(e)&&f.IsEmpty(this.transaction_id)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure")}updateCustomerID(t){return this.Data.Order.CustomerID=t,this.pushNewValue(this.Data),new Promise((e,i)=>{this._customerHttpService.GetPrivilegeByID(t,this.Data.Order.EntityID).subscribe({next:n=>{this._customerHttpService.Data=n,this.pushNewValue(this.Data),e(n)},error:n=>{this.Data.Order.CustomerID=null,this.Data.ContactName=null,i(n)}})})}static \u0275fac=function(e){return new(e||o)(u(gt),u(we),u(A))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var gi=class{Name;Quantity;Discount;DiscountAmount;Price;UnitQuantity};var fi=class{Items;AmountSummary;GopayQr;Number;Customer;SalesName;CurrencySymbol;FinalAmount};var hi=class o{_state=Fe(this.initCustomerDisplayState());isEnabled=We(()=>this._state()?.enabled);connect(){let e={enabled:!0,timestamp:new Date().toDateString()};localStorage.setItem("customerDisplay",JSON.stringify(e)),this._state.set(e)}initCustomerDisplayState(){let t=localStorage.getItem("customerDisplay"),e={enabled:!1,timestamp:""};return f.IsNotEmpty(t)&&(e=JSON.parse(t)),e}disconnect(){let e={enabled:!1,timestamp:new Date().toDateString()};localStorage.setItem("customerDisplay",JSON.stringify(e)),this._state.set(e)}static \u0275fac=function(e){return new(e||o)};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var oe=class{Amount;CurrencySymbol;Label;Type;constructor(t,e,i,n){this.Amount=t,this.CurrencySymbol=e,this.Label=i,this.Type=n}};var Ke=class{ModuleSell;ApplicationLoyalty;ApplicationMath;CoreDefaults;ModuleDelivery;ApplicationParkAndRetrieve;ApplicationRegisterClosure;PaymentConfigGopay;PaymentConfigLink;PrintConfigInvoice;CorePrint;PaymentConfigEmpatKali;ApplicationSettings;PrintConfigGeneral;ModuleProducts;ModuleContact;ApplicationTransactionNumbering;ModuleOrders;ModuleShift;ModuleBuy;ModuleAdjustment;AddOnsKitchenDisplay;TadaCouponVisible;CouponRedemptionType};var Z=class o{constructor(t,e,i,n){this._orderDataService=t;this._posService=e;this.POSMATH=i;this.decimalPipe=n;this._orderDataService.Data$.pipe(ie(r=>this._posService.Data$.pipe(z(c=>({appConfig:c.AppConfigJSON,salesOrder:r}))))).subscribe(r=>{this.salesOrderData=r.salesOrder,this.appConfigJSON=r.appConfig,this.calculateDiscountAmount(),this.pushNewValue(this.grandTotal)})}_Data=new re(0);Data$=this._Data.asObservable().pipe(Pe());tax=new Fn;discountAfterTax=0;currencySymbol="Rp";get Data(){return this._Data.value}salesOrderData=new ne;appConfigJSON=new Ke;pushNewValue(t){this._Data.next(t)}get grandTotal(){let t=this.TotalAfterSurcharge;return isNaN(t)?0:t}setDecimalDigit(t){let e=this.decimalPipe.transform(t,"1.0-4");return t=parseFloat(e.split(",").join("")),t}get TotalAfterTax(){let t=this.TaxAmount,e=this.TotalBeforeTax+t;return e=this.POSMATH.Round(e,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm),e}get TotalBeforeTax(){let t=this.tax?.CalculationTypeID===1,e=0;return t?e=this.DiscountTotal-this.TaxAmount:e=this.DiscountTotal,e}get TotalAfterSurcharge(){let t=this.TotalAfterTax+this.SurchargeAmount;return this.POSMATH.Round(t,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm)}get TotalAfterDiscountTaxable(){return this.GrossTotalTaxable-this.DiscountTotal}get TaxAmount(){if(this.tax!=null){let t=0,e=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.DecimalPlaceValue,i=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.RoundAlgorithm,n=this.GrossTotalTaxable;return this.tax.CalculationTypeID==1?t=this.tax.Rate/(100+this.tax.Rate)*n:t=this.tax.Rate/100*n,t=this.POSMATH.Round(t,e,i),t}else return 0}get SurchargeAmount(){return this.TotalAfterTax*this.salesOrderData.Invoice.SurchargePcg/100}get Discount1Amount(){return this.GrossTotal*this.salesOrderData.Order.Discount/100}get AfterDiscount1Amount(){return this.GrossTotal-this.Discount1Amount}get Discount2Amount(){return this.AfterDiscount1Amount*this.salesOrderData.Order.Discount2/100}get AfterDiscount2Amount(){return this.AfterDiscount1Amount-this.Discount2Amount}get DiscountTotal(){return this.AfterDiscount2Amount-this.salesOrderData.Order.DiscountAmount}calculateDiscountAmount(){let t=this.salesOrderData.Order.DiscountAmount,e=0;this.AfterDiscount2Amount>=0&&t>0&&t>this.AfterDiscount2Amount&&(e=this.AfterDiscount2Amount),e!==0&&e<=t&&this.GrossTotal!==0&&(t=e),this.salesOrderData.Order.DiscountAmount=t}get GrossTotal(){return this.sum(this.salesOrderData.CartItems,"Total")}get GrossTotalTaxable(){let t=this.salesOrderData.CartItems.filter(i=>i.Taxable),e=this.sum(t,"Total");if(t.length!==0){let i=this.calculateDiscountTaxableItem(t);e=e*(100-this.salesOrderData.Order.Discount)/100,e=e*(100-this.salesOrderData.Order.Discount2)/100,e=e-i}return e}calculateDiscountTaxableItem(t){let e=this.GrossTotal,i=this.salesOrderData.Order.DiscountAmount,n=0,r=0,c=0,g=0;for(let D of t)n=D.getItemAfterDiscount/e,r=n*i,g=r*D.Quantity,c+=g;return c}get GrossTotalNonTaxable(){let t=this.salesOrderData.CartItems.filter(i=>i.Taxable==!1),e=this.sum(t,"Total");return e=e*(100-this.salesOrderData.Order.Discount)/100,e=e*(100-this.salesOrderData.Order.Discount2)/100,e=e-this.salesOrderData.Order.DiscountAmount,e}sum(t,e){let i=t.reduce((n,r)=>n+r[e],0);return i=this.setDecimalDigit(i),i}GetPointOnlyAmount(){let t=this.salesOrderData.CartItems.filter(e=>e.Variant.PaymentTypeID==2);return this.GetAmountByCart(t)}GetCashOnlyAmount(){let t=this.salesOrderData.CartItems.filter(e=>e.Variant.PaymentTypeID==1);return this.GetAmountByCart(t)}GetCashAndPointAmountCart(){let t=this.salesOrderData.CartItems.filter(e=>e.Variant.PaymentTypeID!=1);return this.GetAmountByCart(t)}GetAmountByCart(t){let e=this.sum(t,"Total");return e=e*(100-this.salesOrderData.Order.Discount)/100,e=e*(100-this.salesOrderData.Order.Discount2)/100,e}static \u0275fac=function(e){return new(e||o)(u(N),u(L),u(Hn),u(ee))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ci=class o{constructor(t,e,i,n){this._invoiceCalculatorService=t;this._decimalPipe=e;this._poshttpResponseService=i;this._orderService=n;this._poshttpResponseService.Data$.pipe(he()).subscribe(r=>{this.appConfig=r.AppConfigJSON})}appConfig=new Ke;generateAmountSummary(){let t=[];this.isUseTax()?t=this.generateSummaryTax():t=this.generateSummaryNonTax();let e=this.generateSurchargeSummary();return e&&t.push(...e),t}generateSummaryTax(){let t=this._invoiceCalculatorService.tax?.CalculationTypeID,e=[];return t==1?e=this.generateSummaryTaxInclude():e=this.generateSummaryTaxExclude(),e}generateSummaryNonTax(){let t=[],e=this.generateCartItemAmount();if(t.push(e),this.isDiscounted()){let i=this.generateDiscountSummary(),n=this.generateAmountTotal("Total");t.push(...i,n)}return t}generateSummaryTaxInclude(){let t=[];return this.isTaxReserveSequence()?t=this.generateTaxIncludeReserveSequence():t=this.generateTaxIncludeNormalSequence(),t}generateTaxIncludeReserveSequence(){let t=[];if(this.isTaxDetailVisible()==!1){let r=this._invoiceCalculatorService.TotalBeforeTax,c=this.isDiscounted()?"Amount":"Before Tax",g=this.isDiscounted()?this._invoiceCalculatorService.GrossTotal:r,D=new oe(g,this.currencySymbol,c,2);t.push(D)}if(this.isDiscounted()){let r=this.generateDiscountSummary(),c=this.generateBeforeTaxSummary();t.push(...r,c)}let i=this.generateTax(),n=this.generateAmountTotal();return t.push(...i,n),t}generateTaxIncludeNormalSequence(){let t=[],e=this.generateCartItemAmount();if(t.push(e),this.isDiscounted()){let n=this.generateDiscountSummary(),r=this.generateSummarySubTotal();t.push(...n,r)}let i=this.generateTax();if(t.push(...i),this.isTaxDetailVisible()==!1){let n=this.generateBeforeTaxSummary();t.push(n)}return t}generateSummaryTaxExclude(){let t=[],e=this.generateCartItemAmount(!0);if(t.push(e),this.isDiscounted()){let c=this.generateDiscountSummary(),g=this.generateSummarySubTotal();t.push(...c,g)}let i=this.generateTax(),n=this._invoiceCalculatorService.TotalAfterTax,r=new oe(n,this.currencySymbol,"Total",1);return t.push(...i,r),t}generateAmountTotal(t="Total Amount"){let e=this._invoiceCalculatorService.Data;return new oe(e,this.currencySymbol,t,1)}generateSummarySubTotal(){let t=this._invoiceCalculatorService.TotalAfterTax;return new oe(t,this.currencySymbol,"SubTotal",1)}generateBeforeTaxSummary(){let t=this._invoiceCalculatorService.TotalBeforeTax;return new oe(t,this.currencySymbol,"Before Tax",2)}isTaxDetailVisible(){return this.appConfig.PrintConfigInvoice?.Footer?.TaxDetailVisible}isUseTax(){let t=this._invoiceCalculatorService.tax;return t?.PrintVisible&&t?.Rate!=0}generateTax(){let t=[],e=this.isTaxDetailVisible(),i=e?2:1,n=this._invoiceCalculatorService.tax;if(e){let r=this.appConfig.PrintConfigInvoice.Footer.TaxableSales,c=this.calculateTaxableSales(),g=new oe(c,this.currencySymbol,r,i);t.push(g)}if(n.TypeID==2){let r=this.generateTaxTypeMultiple();t.push(...r)}else{let r=this.generateSingleTaxSummary(n.Label,this._invoiceCalculatorService.TaxAmount,i);t.push(r)}if(e){let r=this.appConfig.PrintConfigInvoice.Footer.TaxExemptSales,c=this._invoiceCalculatorService.GrossTotalNonTaxable,g=new oe(c,this.currencySymbol,r,i);t.push(g);let D=this.appConfig.PrintConfigInvoice.Footer.LabelWithZeroAmount;if(D){let I=new oe(0,this.currencySymbol,D,i);t.push(I)}}return t}generateCartItemAmount(t=!1){let e=this.isDiscounted()||t?this._invoiceCalculatorService.GrossTotal:this._invoiceCalculatorService.TotalAfterTax;return new oe(e,this.currencySymbol,"Amount",1)}get currencySymbol(){return this._invoiceCalculatorService.currencySymbol}generateDiscountSummary(){let t=[];if(this._invoiceCalculatorService.Discount1Amount!=0){let e=this._decimalPipe.transform(this._orderService.Data.Order.Discount),n=this.checkDiscountIgnoreDecimal(e)?"{0}":"{0} ({1}%)";t.push(new oe(this._invoiceCalculatorService.Discount1Amount*-1,this._invoiceCalculatorService.currencySymbol,f.StringFormat(n,this.appConfig.CorePrint.Alias.Discount1,e),1))}if(this._invoiceCalculatorService.Discount2Amount!=0){let e=this._decimalPipe.transform(this._orderService.Data.Order.Discount2),n=this.checkDiscountIgnoreDecimal(e)?"{0}":"{0} ({1}%)";t.push(new oe(this._invoiceCalculatorService.Discount2Amount*-1,this._invoiceCalculatorService.currencySymbol,f.StringFormat(n,this.appConfig.CorePrint.Alias.Discount2,e),1))}return this._orderService.Data.Order.DiscountAmount!=0&&this.appConfig.PrintConfigInvoice.ItemsFooter.DiscountAmountVisible&&t.push(new oe(this._orderService.Data.Order.DiscountAmount*-1,this._invoiceCalculatorService.currencySymbol,"Discount ("+this._invoiceCalculatorService.currencySymbol+")",1)),t}calculateTaxableSales(){let t=this._invoiceCalculatorService.tax,e=this._invoiceCalculatorService.TaxAmount,i=this._invoiceCalculatorService.GrossTotalTaxable;return t.Rate==0?0:t.CalculationTypeID==1?i-e:i}generateTaxTypeMultiple(){let t=this.appConfig.PrintConfigInvoice.Footer.TaxDetailVisible?2:1,e=[],i=this._invoiceCalculatorService.tax;var n=this._invoiceCalculatorService.TaxAmount;if(i.TypeID==2){let r=i?.Components?i?.Components:[],c=this._invoiceCalculatorService.GrossTotalTaxable,g=this.calculateTotalRate(r);r.forEach(D=>{if(i.CalculationTypeID==0){let I=D.Rate/100*c;e=[...e,this.generateSingleTaxSummary(D.Label,I,t)],i.MultipleTaxTypeID==1&&(c+=I)}else{let I=D.Rate/g*n;e=[...e,this.generateSingleTaxSummary(D.Label,I,t)]}})}else e=[...e,this.generateSingleTaxSummary(i.Label,n,t)];return e}calculateTotalRate(t){let e=0;return t&&t.length>0&&(e=t.map(i=>i.Rate).reduce((i,n)=>i+n)),e}generateSingleTaxSummary(t,e,i){let n=this._invoiceCalculatorService.currencySymbol;return new oe(e,n,t,i)}generateSurchargeSummary(){if(this._invoiceCalculatorService.SurchargeAmount==0)return;let t=[],e=this.appConfig.CorePrint,i=e&&e.Alias.SurchargePcg?e.Alias.SurchargePcg:"Surcharge";t.push(new oe(this._invoiceCalculatorService.SurchargeAmount,this._invoiceCalculatorService.currencySymbol,f.StringFormat("{0} ({1}%)",i,this._decimalPipe.transform(this._orderService.Data?.Invoice.SurchargePcg)),1));let n=this.generateAmountTotal();return t.push(n),t}checkDiscountIgnoreDecimal(t){let i=this.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal,n=parseFloat(t)%1,r=!1;return n!==0&&i&&(r=!0),r}isDiscounted(){let t=this._invoiceCalculatorService.Discount1Amount,e=this._invoiceCalculatorService.Discount2Amount,i=this._orderService.Data.Order.DiscountAmount,n=!1;return(t!=0||e!=0||i!=0)&&(n=!0),n}isTaxReserveSequence(){let t=this._invoiceCalculatorService.tax,e=!!t,i=e?t.CalculationTypeID:null,n=this.appConfig.PrintConfigInvoice.ItemsFooter.TaxIncludeBeforeTotalAmount;return e&&i===1&&n}static \u0275fac=function(e){return new(e||o)(u(Z),u(ee),u(L),u(N))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ye=class o{constructor(t,e,i,n){this._receiptCalculatorService=t;this._cashierCalculatorService=e;this._signal=i;this._customerHttpService=n;this.broadcastOrderUpdate$.subscribe()}_salesOrderDataModelService=X(N);_outletService=X(Y);displayService=X(hi);localdata=X(Te);orderDataModel;broadcastOrderUpdate$=ot([this._salesOrderDataModelService.Data$,this.localdata.isStoreOrderInServer(),bn(this.displayService.isEnabled)]).pipe(zi(([t,e,i])=>{let n=this._outletService?.Data?.RegisterID;if(e&&i&&n){this.orderDataModel=t;let r=this.ConstructCartModelForCustomerDisplay(),c=new et;return c.GroupID=n+"_Subscriber",c.Method="POSCartAmountUpdated",c.Data=r,this._signal.broadcast(c).pipe(ke(g=>(console.log(g),it)))}else return it}),ke(t=>(console.log(t),it)),he());ConstructCartModelForCustomerDisplay(){let t=this._customerHttpService.Data,e=new fi;e.Number=this.orderDataModel.Order.Number,e.Items=Array();for(let i of this.orderDataModel.CartItems){let n=new gi;n.Name=i.Variant.Name,n.Discount=i.Discount,n.DiscountAmount=i.DiscountAmount,n.Price=i.Price,n.Quantity=i.Quantity,n.UnitQuantity=i.UnitQuantity,e.Items.push(n)}return f.IsNotEmpty(this.orderDataModel.Order.SalesID)?e.SalesName=this._outletService.getSalesname(this.orderDataModel.Order.SalesID):e.SalesName="",f.IsNotEmpty(this.orderDataModel.Order.CustomerID)&&f.IsNotEmpty(t)&&(e.Customer=new ut,e.Customer.Email=t.Email,e.Customer.Mobile=t.Mobile,e.Customer.Name=this.orderDataModel.ContactName),e.CurrencySymbol=this._cashierCalculatorService.currencySymbol,e.FinalAmount=this._cashierCalculatorService.Data,e.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),e}BroadcastStateToCustomerDisplay(t,e="",i="",n=0){let r=new di;r.Status=t,r.InvoiceID=e,r.LoyaltyPoint=i,r.diff=n;let c=new et;return c.GroupID=this._outletService.Data.RegisterID+"_Subscriber",c.Method="POSStateUpdated",c.Data=r,this.displayService.isEnabled()?this.localdata.isStoreOrderInServer().pipe(ie(g=>g?this._signal.broadcast(c):Se(U.offlineMode))):it}BroadcastQRToCustomerDisplay(t){let e=new ui;e.GopayQr=t;let i=new et;return i.GroupID=this._outletService.Data.RegisterID+"_Subscriber",i.Method="POSQRPaymentActivated",i.Data=e,this.displayService.isEnabled()?this.localdata.isStoreOrderInServer().pipe(ie(n=>n?this._signal.broadcast(i):Se(U.offlineMode))):it}BroadcastChangeToKitchenDisplay(t){let e=new et;return e.GroupID=this._outletService.Data.EntityID+"_Subscriber",e.Method="ReceiveKitchenDisplayMessage",e.Data={state:t},this.localdata.isStoreOrderInServer().pipe(ie(i=>i?this._signal.broadcast(e):Se(U.offlineMode)))}static \u0275fac=function(e){return new(e||o)(u(Ci),u(Z),u($e),u(we))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var vi=class o{constructor(t){this.httpService=t}VerifyPayment(t,e){let i=this.getVerifyPaymentUrl(e);return this.httpService.post(i,t)}getVerifyPaymentUrl(t){let e;switch(t){case 0:e=Q.GopayVerifyPayment;break;case 1:e=Q.BcaVerifyPayment;break}return e}generateLink(t){return this.httpService.post(Q.GenerateLink,t)}generateQRCode(t,e){return this.httpService.post(t,e)}static \u0275fac=function(e){return new(e||o)(u(xe))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ct=class o{constructor(t,e,i,n,r){this._posHubService=t;this._orderDataService=e;this._PaymentHttpService=i;this._InvoicecashierCalculatorService=n;this._toastrService=r}transactionId;qrPaymentMethodID;QRCodeHttpResponse;_paymentMethod;get paymentMethod(){return this._paymentMethod}resetPaymentMethod(){this._paymentMethod=null}onQRPaymentComplete(t,e){return new Promise((i,n)=>{if(t.transaction_id!==this.transactionId){let c=`transaction_id: ${t.transaction_id} / gross_amount: ${t.gross_amount}`;n({header:"Invalid QR Payment",message:c});return}if(t.gross_amount!==this._InvoicecashierCalculatorService.Data){let c=`paid_amount: ${t.gross_amount} vs invoice_amount: ${this._InvoicecashierCalculatorService.Data}`;n({header:"Invalid QR Payment",message:c});return}let r=this._orderDataService.Data.Order.Number;if(t.order_id.includes(r)==!1){let c=`Order ID: ${t.order_id} vs Order Number: ${r}`;n({header:"Invalid QR Payment",message:c});return}if(t.transaction_status!=="settlement"){let c=`Transaction status is ${t.transaction_status}`;n({header:"Invalid QR Payment",message:c});return}this.validateEMoneyPayment(e).subscribe(c=>{i(c)})})}generateNewPayment(t,e){let i=this._orderDataService.Data;f.IsEmpty(this.qrPaymentMethodID)&&alert("QR PaymentMethod.ID is not available!");let n=new Je;return n.PaidAmount=e,n.Amount=e,n.Date=i.Order.Date,n.MethodID=this.qrPaymentMethodID,n.Code=t,f.IsEmpty(t)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure"),n}sendStateCompleteToCustomerDisplay(t){this._posHubService.BroadcastStateToCustomerDisplay(1,t.ObjectID,t.LoyaltyPoint,0).subscribe()}generateQR(t,e){this._paymentMethod=e,this.qrPaymentMethodID=e.ID;let i=this.getServiceUrl(e.EMoneyTypeID);return this._PaymentHttpService.generateQRCode(i,t).pipe(z(c=>(c=this.manipulateBCAQrisImg(c,e.EMoneyTypeID),this.transactionId=c.Transaction_id,this.QRCodeHttpResponse=c,this._orderDataService.transaction_id=c.Transaction_id,this.sendQRToCustomerDisplay(c.Url),c)))}sendQRToCustomerDisplay(t){this._posHubService.BroadcastQRToCustomerDisplay(t).subscribe()}validateEMoneyPayment(t){if(f.IsNotEmpty(this.transactionId)){let e=this._InvoicecashierCalculatorService.Data,i=this._paymentMethod?.EMoneyTypeID,n=this.generatePaymentVerificationData(e,i);return this._PaymentHttpService.VerifyPayment(n,i).pipe(ie(r=>(this.updatePosDataForSubmission(e),Ji(this._orderDataService.submitOrder(t)).pipe(Oe(c=>{this.sendStateCompleteToCustomerDisplay(c)})))))}else{let e=new Error("Transaction ID is Empty");throw nt(()=>e)}}generatePaymentVerificationData(t,e){let i=this._orderDataService.Data,n=new pi;return n.Number=i.Order.Number,n.Amount=t,n.TransactionID=this.transactionId,n.RegisterID=i.Order.RegisterID,e==1&&(n.Number=this.QRCodeHttpResponse.Number),n}updatePosDataForSubmission(t){let e=this._orderDataService.Data,i=this.generateNewPayment(this.transactionId,t),n=[];n.push(i),e.Invoice.Due=null,e.Action.Type=3,e.Order.InvoicedStateID=3,e.Payments=n,this._orderDataService.pushNewValue(e)}getServiceUrl(t){let e;switch(t){case 0:e=Q.GenerateGopayQrCode;break;case 1:e=Q.GenerateBcaQrCode;break}return e}manipulateBCAQrisImg(t,e){return e==1&&(t.Url=`data:image/png;base64, ${t.Url}`),t}clearTransactionID(){this.transactionId=null,this._orderDataService.transaction_id=null,this.QRCodeHttpResponse=null}getTransactionId(){return this.transactionId}static \u0275fac=function(e){return new(e||o)(u(Ye),u(N),u(vi),u(Z),u(A))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var vt=class{CommissionID;ReturNumber;parkTemporaryItem;posState;InputTextValue;constructor(){this.posState=0,this.CommissionID="",this.ReturNumber="",this.parkTemporaryItem=[],this.InputTextValue=""}};var _i=class o{constructor(t,e,i){this._promotionEventService=t;this._dialogRef=e;this.data=i;this.modalConfig=new $,this.modalConfig.hideCancel=!0,this.modalConfig.hideClose=!0,this.modalConfig.headerType=te.Warning,this.modalConfig.title="Promotion Requirement unfulfilled!",this.modalConfig.customWidth="350px",this.modalConfig.okText="Ok",this.selectedPromotion=t.selectedPromotion}modalConfig;selectedPromotion;onOk(){this._promotionEventService.restoreOrder(),this._dialogRef.close()}static \u0275fac=function(e){return new(e||o)(_(fe),_(q),_(de))};static \u0275cmp=V({type:o,selectors:[["POS-modal-promotion-confirm"]],decls:9,vars:4,consts:[[3,"onOk","config"],[1,"fst-italic","text-danger","mb-3"],[1,"mb-0"]],template:function(e,i){e&1&&(a(0,"modal-material",0),S("onOk",function(){return i.onOk()}),a(1,"content")(2,"div")(3,"h5"),m(4),s(),a(5,"p",1),m(6),s(),a(7,"p",2),m(8),s()()()()),e&2&&(p("config",i.modalConfig),l(4),P(i.selectedPromotion==null?null:i.selectedPromotion.Name),l(2),P(i.selectedPromotion==null?null:i.selectedPromotion.Description),l(2),P(i.data==null?null:i.data.message))},dependencies:[J]})};var yi=class extends Be{};var no=(i=>(i[i.INTERNAL=1]="INTERNAL",i[i.EKSTERNAL=2]="EKSTERNAL",i[i.EKSTERNALINTERNAL=3]="EKSTERNALINTERNAL",i))(no||{});var yt=class o{constructor(t,e,i,n,r,c){this._httpService=t;this._orderDataService=e;this._userRoleService=i;this.toastr=n;this._invoiceCalculatorService=r;this._posHttpResponseService=c;this.subscribeToObservable()}role;originalRoleData;_coupon;get coupon(){return this._coupon}subscribeToObservable(){this._userRoleService.Data$.subscribe(t=>{this.role=t,f.IsEmpty(this.originalRoleData)&&(this.originalRoleData=Ce(ze,t))})}RedeemCoupon(t,e,i,n=!0){let r=this._orderDataService.Data?.Order?.CustomerID,c=this._invoiceCalculatorService.Data,g={Code:t,EntityID:this._orderDataService.Data.Order.EntityID,CouponType:i,CustomerID:r,Amount:c,ListVariantID:this.getVariantIdsInCart()},D=this.getApiUrl();this._httpService.post(D,g).subscribe({next:I=>{switch(this._orderDataService.Data.Order.PromotionCoupon=t,this._orderDataService.Data.Order.PromotionNote=e,this._orderDataService.Data.Order.CouponType=i,this.resetAppliedCoupon(),I.Type){case 1:this.HandleDiscountPercentage(I,n);break;case 2:this.HandleDiscountAmount(I),n&&this.toastr.success(I.Notify,"Coupon Applied");break;case 3:this.HandleReturn();break;case 4:this.HandleParkedDeletion();break;case 5:this.HandleFullAccess(),n&&this.toastr.success("You now have Full Access for this Order!","Coupon Applied");break}this._coupon=I,this.orderNote(i,I)},error:I=>{this.resetAppliedCoupon(),this.removeAppliedCoupon()}})}getVariantIdsInCart(){return this._orderDataService.Data.CartItems.map(i=>i.VariantID)}getApiUrl(){let t=this._posHttpResponseService.Data?.AppConfigJSON,e=Q.Coupon;return t.CouponRedemptionType==3&&(e=Q.InternalEksternalCoupon),e}orderNote(t,e){t==2&&(f.IsNotEmpty(this._orderDataService.Data.Order.Note)?this._orderDataService.Data.Order.Note+=`
|
|
3
|
+
Coupon TADA - `+e.Notify:this._orderDataService.Data.Order.Note=" Coupon TADA - "+e.Notify)}resetAppliedCoupon(){if(f.IsNotEmpty(this.coupon))switch(this.coupon.Type){case 2:this.HandleDiscountAmount(this.coupon,!0);break;case 1:this.HandleDiscountPercentage(this.coupon,!1,!0);break;case 5:this.resetRoleAfterAppliedCoupon();break;case 4:this.HandleParkedDeletion(!0);break;case 3:this.HandleReturn(!0);break}}resetAppliedCouponDiscount(){if(this.coupon){switch(this.coupon.Type){case 1:this.HandleDiscountPercentage(this._coupon,!1,!0);break;case 2:this.HandleDiscountAmount(this._coupon,!0);break}this.removeAppliedCoupon()}}HandleDiscountPercentage(t,e,i=!1){t.amount>0?t.MaximumDiscount>0?this.applyConfigMaxDiscount(t,i):t.FullPriceProductOnly?this.applyFullPriceDisc(t,e,i):this.applyDiscountPercentage(t,e,i):(this.role.Discount=i?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyFullPriceDisc(t,e,i=!1){let n=this._orderDataService.Data,r=this.filterItemWithDisc(n.CartItems),c=this.filterItemWithCouponDisc(n.CartItems);i?c.length>0?(n.CartItems=this.resetItemsDisc(n.CartItems),this._orderDataService.pushNewValue()):this.applyDiscountPercentage(t,!1,i):r.length>0?(this.filterItemWithoutDisc(n.CartItems).length>0?n.CartItems=this.applyItemsDisc(n.CartItems,t):(this.removeAppliedCoupon(),e=!1),this._orderDataService.pushNewValue()):this.applyDiscountPercentage(t,!1,i),e&&this.toastr.success(t.Notify,"Coupon Applied")}filterItemWithDisc(t){return t.filter(i=>i.Discount>0||i.DiscountAmount>0||i.Price!=i?.Variant?.UnitPrice||f.IsNotEmpty(i.PriceBookID)||i.PriceTypeID==2)}filterItemWithoutDisc(t){return t.filter(i=>this.itemConditionFullPriceOnly(i))}filterItemWithCouponDisc(t){return t.filter(i=>i.CouponDiscount>0)}applyDiscountPercentage(t,e,i=!1){let n=this._orderDataService.Data.Order.CustomerDiscountRate,r=t.amount;i?(this._orderDataService.Data.Order.Discount=0,this._orderDataService.pushNewValue()):r>=n?t.ListVariantID?.length>0?this.applyDiscountRequiredItems(t):(this._orderDataService.Data.Order.Discount=t.amount,this._orderDataService.pushNewValue(),e&&this.toastr.success(t.Notify,"Coupon Applied")):(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.resetAppliedCouponDiscount())}applyDiscountRequiredItems(t){let e=this._orderDataService.Data.CartItems,i=t.ListVariantID,n;e=e.map(r=>(n=i.findIndex(c=>c==r.VariantID),n>-1&&(r.Discount=t.amount),r)),this._orderDataService.Data.CartItems=e,this._orderDataService.pushNewValue()}applyConfigMaxDiscount(t,e=!1){if(t.FullPriceProductOnly){let i=this.getItemsAppliedMaxDisc(e),n=this._invoiceCalculatorService.GetAmountByCart(i);this.applyMaxDiscount(t,n,e)}else{let i=this._invoiceCalculatorService.GrossTotal;this.applyMaxDiscount(t,i,e)}}getItemsAppliedMaxDisc(t){return this._orderDataService.Data.CartItems.filter((i,n)=>t?i.Discount==0&&i.DiscountAmount==0&&i.CouponDiscount==0?!0:i.CouponDiscount>0:i.Discount==0&&i.DiscountAmount==0)}applyMaxDiscount(t,e,i){let n=this._orderDataService.Data,r=e*t.amount/100,c=t.MaximumDiscount;r>=c?n.Order.DiscountAmount=i?0:c:(n.Order.DiscountAmount==c&&(n.Order.DiscountAmount=0),n.CartItems=i?this.resetItemsDisc(n.CartItems):this.applyItemsDisc(n.CartItems,t)),this._orderDataService.pushNewValue(n)}resetItemsDisc(t){return t=t.map(e=>(e.CouponDiscount>0&&(e.Discount=0,e.DiscountAmount=0,e.CouponDiscount=0),e)),t}applyItemsDisc(t,e){return e.ListVariantID?.length>0?t=this.applyDiscByVariant(t,e):t=t.map(i=>(this.itemConditionFullPriceOnly(i)&&(i.Discount=e.amount,i.CouponDiscount=e.amount),i)),t}applyDiscByVariant(t,e){return t=t.map(i=>(e.ListVariantID.find(r=>r==i.VariantID)&&this.itemConditionFullPriceOnly(i)&&(i.Discount=e.amount,i.CouponDiscount=e.amount),i)),t}itemConditionFullPriceOnly(t){return t.Discount==0&&t.DiscountAmount==0&&t.Price==t?.Variant?.UnitPrice&&f.IsEmpty(t.PriceBookID)}HandleDiscountAmount(t,e=!1){t.amount>0?(t.ListVariantID.length>0?this.applyDiscountInItem(t,e):(this._orderDataService.Data.Order.DiscountAmount=e?0:t.amount,this._orderDataService.pushNewValue()),this.resetCustomerPoint(e)):(this.role.Discount=e?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyDiscountInItem(t,e=!1){let i=this._orderDataService.Data;e?i.CartItems=this.resetItemsDisc(i.CartItems):i.CartItems=i.CartItems.map(n=>(t.ListVariantID.includes(n.VariantID)&&(n.DiscountAmount=t.amount,n.CouponDiscount=t.amount),n)),this._orderDataService.pushNewValue(i)}resetCustomerPoint(t){if(!t){let e=this._orderDataService.Data;e.Order.PointUsed=0}}HandleReturn(t=!1){this.role.Return=t?this.originalRoleData.Return:!0,this._userRoleService.pushNewValue(this.role)}HandleParkedDeletion(t=!1){this.role.ParkedDeletionAuthorized=t?this.originalRoleData.ParkedDeletionAuthorized:!0,this._userRoleService.pushNewValue(this.role),this.toastr.success("You Have Access to delete park and delete item when retrieve!","Coupon Applied")}HandleFullAccess(){this.role.UnitPriceEditor=!0,this.role.Discount=!0,this.role.Return=!0,this.role.Tax=!1,this.role.NumberEditor=!0,this.role.DateEditor=!0,this.role.PricebookSelector=!0,this._userRoleService.pushNewValue(this.role)}resetRoleAfterAppliedCoupon(){let t=Ce(ze,this.originalRoleData);this.role.UnitPriceEditor=t.UnitPriceEditor,this.role.Discount=t.Discount,this.role.Return=t.Return,this.role.Tax=t.Tax,this.role.NumberEditor=t.NumberEditor,this.role.DateEditor=t.DateEditor,this.role.PricebookSelector=t.PricebookSelector,this.role.ParkedDeletionAuthorized=t.ParkedDeletionAuthorized,this._userRoleService.pushNewValue(this.role)}removeAppliedCoupon(){let t=this._orderDataService.Data;t.Order.PromotionCoupon=null,t.Order.PromotionNote=null,this._coupon=null,this._orderDataService.pushNewValue()}static \u0275fac=function(e){return new(e||o)(u(xe),u(N),u(Ne),u(A),u(Z),u(L))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var bt=class o{constructor(t,e,i,n,r,c,g,D){this.variantService=t;this._posService=e;this._orderDataService=i;this.toastr=n;this._orderProcessorService=r;this._customerHttpService=c;this.promotionCouponService=g;this.userRoleService=D;this.subscribeToObservable()}salesOrderData;appConfigJson;entityID;audio=new Audio;subscribeToObservable(){this._posService.Data$.subscribe(t=>{this.appConfigJson=t.AppConfigJSON}),this._orderDataService.Data$.subscribe(t=>{this.salesOrderData=t,this.entityID=t.Order.EntityID})}addCartItemById(t,e,i=!0){return new Promise((n,r)=>{this.variantService.findVariantByID(t,this.entityID,i).then(c=>{this.createNewCartItem(c,e),n(c)}).catch(c=>{r(c)})})}addCartItemByCode(t){return new Promise((e,i)=>{let n=this.appConfigJson.ModuleSell.DigitalScale;n.Digit>0&&f.IsNotEmpty(n.Regex)&&t.length==n.Digit?this.parseDigitalScaleBarcodeWithRegex(t,n).then(c=>{c||(this.toastr.info("Matching Regex Rule to Barcode","Digital Scale"),this.findVariantByCode(t).then(g=>e(g)).catch(g=>i(g)))}):this.findVariantByCode(t).then(c=>e(c)).catch(c=>i(c))})}findVariantByCode(t){let e=this.appConfigJson.ModuleSell.BarcodeSerialEnabled;return new Promise((i,n)=>{this.variantService.findVariantByCode(t,this.entityID,e).then(r=>{i(r),this.createNewCartItem(r)}).catch(r=>{this.playBellRing(),n(r)})})}addItemBySerial(t){this.variantService.findVariantBySerial(t,this.entityID).subscribe(e=>{let i=this.salesOrderData.CartItems;if(i.length>0){let n,r=[],c=i.findIndex(g=>g.Variant.ID==e.ID);r=[],c!==-1?(n=i[c].Serial?.findIndex(g=>g.Number==t),r=[...i[c].Serial?i[c].Serial:[]],n==-1?(r.push({Number:t,Quantity:1}),i[c].Quantity=r.length):r.length>0?r[n].Quantity+=1:(r=[{Number:t,Quantity:1}],this.addNewSerials(e,t)),i[c].Serial=[...r],i[c].Quantity=i[c].calculateSerialQty(),this.updateCartItem(i[c],c)):this.addNewSerials(e,t)}else this.addNewSerials(e,t)})}addNewSerials(t,e){t.Serial=[{Number:e,Quantity:1}],this.createNewCartItem(t)}playBellRing(){this.audio.src="//res.cloudinary.com/pos/video/upload/v1659947782/POS/Music/bell_ring.mp3",this.audio.load(),this.audio.play()}updateCartItem(t,e){this.salesOrderData.CartItems[e]=t,this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint(),this.reApplyPromotionCoupon()}deleteCartItem(t){this.salesOrderData.CartItems=this.salesOrderData.CartItems.filter(e=>e!==t),this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint(),this.reApplyPromotionCoupon()}parseDigitalScaleBarcodeWithRegex(t,e){return new Promise(i=>{let n=this.appConfigJson.ModuleSell.BarcodeSerialEnabled,r=new RegExp(e.Regex),c=t.match(r);if(f.IsNotEmpty(c)){let g=c[1],D=parseFloat(c[2]);D=D/e.QuantityDivider,this.variantService.findVariantByCode(g,this.entityID,n).then(I=>{this.createNewCartItem(I,null,D),i(!0)}).catch(()=>{i(!1)})}else i(!1)})}createNewCartItem(t,e,i){let n=new Be,r=this.appConfigJson.ModuleSell.ProductNotes.CopyProductDescription,c=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;n.patchByVariant(t,r,c),n=this.applyReward(n,e),f.IsEmpty(e)&&(n=this.applyPriceBook(n)),this.validateCartItem(n)&&(n.Quantity=i||n.Quantity,e?.PromotionType==2?this.handlingPromotionQuantity(n):this.pushNewItemToArray(n,n.PromotionGift),this.applyCustomerPoint()),this.addAvailableComponent(n)}applyCustomerPoint(){let t=this.salesOrderData.Order.CustomerID,e=f.IsEmpty(t);this._orderProcessorService.reedemPointToDiscount(e)}handlingPromotionQuantity(t){let e=Ce(Be,this.salesOrderData.CartItems),i=e.findIndex(n=>n.VariantID==t.VariantID&&n.PromotionGift);i!==-1?e[i].Quantity+=t.Quantity?t.Quantity:1:e=[...e,t],this.salesOrderData.CartItems=e,this._orderDataService.pushNewValue(this.salesOrderData)}applyPromotionProduct(t){let e=t.Variant.DiscountAmount;return e&&(t.Price=t.UnitPriceOriginal-e),t}applyReward(t,e){if(e){let i=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;t.Discount=e.Discount,t.Price=e.OriginalPrice;let n=e.OriginalPrice-e.UnitPrice;t.Price=t.UnitPriceOriginal-n,t.UnitPrice=t.UnitPriceOriginal-n,t.PromotionGift=!0,t.PromotionID=e.PromotionID,t.Quantity=e.Quantity?e.Quantity:1,t.PriceTypeID=3,t.Cost+=e.ExtraCost,t.UnitCost+=e.ExtraCost,t.PriceNote=e.PromotionName,i&&(t.Note=e.PromotionName)}return t}addAvailableComponent(t){let e=t.Price!=0,i=this.appConfigJson.ModuleSell.SellProductComponentDefaultPrice,n=t.Variant;if(n.Component!=null&&n.Component.length>0)for(let r of n.Component){let c=new yi;c.patchByVariant(r),c.Quantity=t.Quantity*r.Quantity,e&&!i&&(r.UnitPrice=0),c.Price=r.UnitPrice,this.pushNewItemToArray(c)}}pushNewItemToArray(t,e=!1){let i=this.salesOrderData.CartItems.findIndex(n=>n.VariantID==t.VariantID);if(t=this.applyPromotionProduct(t),i==-1||e)this.salesOrderData.CartItems.push(t);else{let n=this.appConfigJson.ModuleSell.QuickKey.NewRowBehaviour;n==2?this.salesOrderData.CartItems.push(t):n==1?this._orderProcessorService.Data.posState==4?this.salesOrderData.CartItems.push(t):this.addingQuantityItem(i,t):this.addingQuantityItem(i,t)}this._orderDataService.pushNewValue(this.salesOrderData),this.reApplyPromotionCoupon()}reApplyPromotionCoupon(){let t=this.salesOrderData.Order.PromotionCoupon,e=this.salesOrderData.Order.CouponType,i=this.salesOrderData.Order.PromotionNote;f.IsNotEmpty(t)&&this.promotionCouponService.RedeemCoupon(t,i,e,!1)}addingQuantityItem(t,e){let i=this.salesOrderData.CartItems.filter(g=>g.VariantID==e.VariantID),n=i.length,r=i.find(g=>!g.PromotionGift);this.salesOrderData.CartItems[t].PromotionGift&&n==1?this.salesOrderData.CartItems.push(e):(r.Quantity+=e.Quantity,r=this.applyPromotionProduct(r)),r&&(r=this.applyPriceBook(r))}validateCartItem(t){return t.Variant.CategoryTypeID==-1?(this.toastr.info(t.Variant.Name+" cannot be sold, check Category "+t.Variant.CategoryName+" settings","info"),!1):!(!this.checkPriceMinimum(t)||!this.validateSerialItem(t))}checkPriceMinimum(t){let e=this.appConfigJson.ModuleSell.ProductDialog.PriceMinimumTypeID===1?"UnitPrice":"UnitCost",i=this.userRoleService.Data.PriceMinimum,n=!0;if(t.Price<t[e]&&i){n=!1;let r=t[e].toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");alert(`You have no right to sell this item lower than ${r}`)}return n}validateSerialItem(t){let e=!0;if(t?.Serial?.length>0&&t.Variant.TypeID==4&&t.Quantity>0){let i=0;t?.Serial?.forEach(n=>{i+=n.Quantity}),i!=t.Quantity&&(this.toastr.error("Serial must be equal with the quantity","Error"),e=!1)}return e}applyPriceBook(t){let e=t.Variant.PriceBook!=null?t.Variant.PriceBook:[],i=this.findCustomerPricebook(e);if(e&&e.length!==0){let n=e.sort(function(r,c){return c.MinimumQuantity-r.MinimumQuantity}).filter(r=>t.Quantity>=r.MinimumQuantity&&r.MinimumQuantity!=0);n.length>0||f.IsNotEmpty(i)?f.IsNotEmpty(i)?t=this.applyPricebookToItem(t,i):t=this.applyPricebookToItem(t,n[0]):t=this.resetAppliedPricebook(t)}return t}resetAppliedPricebook(t){let e=this.appConfigJson.ModuleSell.ProductNotes,n=(t?.Variant?.PriceBook).find(r=>r.ID==t.PriceBookID);return f.IsNotEmpty(n)&&(t.Discount=t.Variant.PriceDiscount,t.PriceBookID=f.GuidEmpty,t.Price=t.Variant.UnitPrice,t.UnitPrice=t.Variant.UnitPrice,t.PriceTypeID=0,t=this.applyPromotionProduct(t),e.CopyPromotionName?(t.Note=t.Variant.PriceNote,t.PriceNote=t.Variant.PriceNote):(t.Note="",t.PriceNote="")),t}applyPricebookToItem(t,e){let i=this.appConfigJson.ModuleSell.Pricebook.PricebookVisible;return t.Discount=e.PriceDiscount,t.PriceNote=e.Name,t.UnitPrice=e.UnitPrice,t.PriceBookID=e.ID,t.Price=e.UnitPrice,t.PriceTypeID=2,i?t.Note=e.Name:t.Note="",t}findCustomerPricebook(t=[]){let e=this._customerHttpService.Data,i;return e&&(i=t.find(n=>n.ID==e.PricebookID)),i}static \u0275fac=function(e){return new(e||o)(u(Vn),u(L),u(N),u(A),u(je),u(we),u(yt),u(Ne))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};function Oo(o,t){if(o&1&&(a(0,"div",9)(1,"div",4),b(2,"input",10),s()()),o&2){let e=d();l(2),p("formControl",e.searchControl)}}function Do(o,t){if(o&1){let e=x();a(0,"tr")(1,"td"),m(2),s(),a(3,"td"),m(4),s(),a(5,"td",11),m(6),y(7,"number"),s(),a(8,"td",11),m(9),y(10,"number"),s(),a(11,"td",12)(12,"button",13),S("click",function(){let n=C(e).$implicit,r=d();return v(r.onSelectReward(n))}),m(13,"Apply"),s()()()}if(o&2){let e=t.$implicit;l(2),P(e.VariantName),l(2),P(e.VariantCode),l(2),P(T(7,4,e.OriginalPrice)),l(3),P(T(10,6,e.UnitPrice))}}var Si=class o{constructor(t,e,i,n,r,c){this._dialogRef=t;this._matDialog=e;this._shoppingCartService=i;this._promotionEventService=n;this._toastr=r;this.data=c;this.selectedPromotion=this._promotionEventService.selectedPromotion}modalConfig=new $;selectedPromotion;rewards$;searchControl=new Ue;ngOnInit(){this.modalConfig.title="Select a Reward",this.modalConfig.hideFooter=!0,this.initRewards(!0)}initRewards(t){this.rewards$=this.searchControl.valueChanges.pipe(Qt(""),rt(t?0:500),Pe(),ie(e=>{let i;return i=Se(this.data.rewards).pipe(z(n=>n.filter(r=>this.findKeywordInValue(e,r?.VariantCode)||this.findKeywordInValue(e,r?.VariantName)))),t=!0,i}))}findKeywordInValue(t,e){return e?.toUpperCase()?.indexOf(t?.toUpperCase())>-1}onSelectReward(t){t.PromotionType=this.data.promotion.TypeID,this._shoppingCartService.addCartItemById(t.VariantID,t,!0).then(()=>{this._matDialog.closeAll(),this._promotionEventService.pushNewValue(this._promotionEventService.Data),this.showToastAppliedPromo()})}showToastAppliedPromo(){this._toastr.success("Applied "+this.selectedPromotion.Name+" to order!","Applied successfully!")}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||o)(_(q),_(Ie),_(bt),_(fe),_(A),_(de))};static \u0275cmp=V({type:o,selectors:[["POS-modal-select-item"]],decls:22,vars:9,consts:[[3,"onCancel","onClose","config"],[1,"container"],["class","row mb-3",4,"ngIf"],[1,"row"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[4,"ngFor","ngForOf"],[1,"row","mb-3"],["type","text","placeholder","Type to filter reward",1,"form-control",3,"formControl"],[1,"text-end"],[1,"text-center"],[1,"btn","btn-sm","btn-success",3,"click"]],template:function(e,i){e&1&&(a(0,"modal-material",0),S("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),a(1,"content")(2,"div",1),h(3,Oo,3,1,"div",2),a(4,"div",3)(5,"div",4)(6,"table",5)(7,"thead",6)(8,"tr")(9,"th",7),m(10,"Name"),s(),a(11,"th",7),m(12,"Code"),s(),a(13,"th",7),m(14,"Price"),s(),a(15,"th",7),m(16,"Promo"),s(),b(17,"th",7),s()(),a(18,"tbody"),h(19,Do,14,8,"tr",8),y(20,"async"),y(21,"sortBy"),s()()()()()()()),e&2&&(p("config",i.modalConfig),l(3),p("ngIf",(i.data==null||i.data.rewards==null?null:i.data.rewards.length)>5),l(16),p("ngForOf",st(21,5,T(20,3,i.rewards$),"desc","VariantCode")))},dependencies:[ae,se,me,pe,mt,J,lt,ee,dt],styles:[".table-scroll[_ngcontent-%COMP%]{max-height:400px;overflow-y:auto}table[_ngcontent-%COMP%]{max-width:600px!important;overflow-x:hidden}"]})};function Mo(o,t){if(o&1&&(G(0),a(1,"div",13)(2,"div",7),b(3,"input",14),s()(),W()),o&2){let e=d();l(3),p("formControl",e.searchCtrl)}}function xo(o,t){o&1&&(G(0),a(1,"th",15),m(2,"Qty"),s(),W())}function Io(o,t){o&1&&b(0,"th",10)}function To(o,t){if(o&1){let e=x();G(0),a(1,"td")(2,"input",17),B("ngModelChange",function(n){C(e);let r=d().$implicit;return H(r.Quantity,n)||(r.Quantity=n),v(n)}),s()(),W()}if(o&2){let e=d().$implicit;l(2),F("ngModel",e.Quantity)}}function wo(o,t){if(o&1){let e=x();a(0,"td",18)(1,"button",19),S("click",function(){C(e);let n=d().$implicit,r=d();return v(r.onApplyReward(n))}),m(2,"Apply"),s()()}}function Eo(o,t){if(o&1&&(a(0,"tr")(1,"td"),m(2),s(),a(3,"td"),m(4),s(),a(5,"td",16),m(6),y(7,"number"),s(),a(8,"td",16),m(9),y(10,"number"),s(),h(11,To,3,1,"ng-container",11)(12,wo,3,0,"ng-template",null,1,He),s()),o&2){let e=t.$implicit,i=j(13),n=d();l(2),P(e.VariantName),l(2),P(e.VariantCode),l(2),P(T(7,6,e.OriginalPrice)),l(3),P(T(10,8,e.UnitPrice)),l(2),p("ngIf",n.rewardQuantity>1)("ngIfElse",i)}}var Pi=class o{constructor(t,e,i,n,r,c){this.data=t;this.shoppingCartService=e;this.promotionEventService=i;this.dialogRef=n;this.matDialog=r;this.toastr=c;this.searchCtrl=new Ue,this.rewardQuantity=t.rewardQuantity,this.sourceRewards=[...t.rewards]}modalConfig;rewards$;rewardQuantity;rewards;sourceRewards=[];searchCtrl;ngOnInit(){this.initModalConfig(),this.initSearchCtrl(!0)}initModalConfig(){this.modalConfig=new $,this.modalConfig.title="Select a Reward",this.rewardQuantity<2&&(this.modalConfig.hideFooter=!0)}initSearchCtrl(t){this.rewards$=this.searchCtrl.valueChanges.pipe(Qt(""),rt(t?0:500),Pe(),ie(e=>{let i;return i=Se(this.sourceRewards).pipe(z(n=>(n.length===1&&(n[0].Quantity=this.rewardQuantity),n)),z(n=>n.filter(r=>this.findKeywordInValue(e,r?.VariantCode)||this.findKeywordInValue(e,r?.VariantName)))),t=!1,i}),Oe(e=>{this.rewards=e}))}findKeywordInValue(t,e){return e?.toUpperCase()?.indexOf(t.toUpperCase())>-1}onApplyReward(t){this.addRewardToShoppingCart(t)}onClose(){this.dialogRef.close()}onOk(){this.calculateRewardQty()>this.rewardQuantity?this.toastr.warning("Product reward exceeds the maximum amount earned","Warning"):[...this.rewards].filter(i=>i.Quantity>0).forEach(i=>{this.addRewardToShoppingCart(i)})}calculateRewardQty(){let t=0;return this.rewards.forEach(e=>{t+=e.Quantity?e.Quantity:0}),t}addRewardToShoppingCart(t){t.PromotionType=this.data.promotion.TypeID,this.shoppingCartService.addCartItemById(t.VariantID,t,!0).then(()=>{this.matDialog.closeAll(),this.promotionEventService.pushNewValue(this.promotionEventService.Data)})}static \u0275fac=function(e){return new(e||o)(_(de),_(bt),_(fe),_(q),_(Ie),_(A))};static \u0275cmp=V({type:o,selectors:[["app-modal-quantity-reward"]],decls:27,vars:12,consts:[["APPLY",""],["APPLY_BUTTON",""],[3,"onCancel","onOk","onClose","config"],[1,"ms-3"],[1,"container"],[4,"ngIf"],[1,"row","table-scroll"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[4,"ngIf","ngIfElse"],[4,"ngFor","ngForOf"],[1,"row","mb-3"],["type","text","placeholder","Type to filter reward",1,"form-control",3,"formControl"],["scope","col",2,"width","66px"],[1,"text-end"],["type","text","autoNum","","min","0",1,"form-control",3,"ngModelChange","ngModel"],[1,"text-center"],[1,"btn","btn-sm","btn-success",3,"click"]],template:function(e,i){if(e&1){let n=x();a(0,"modal-material",2),S("onCancel",function(){return C(n),v(i.onClose())})("onOk",function(){return C(n),v(i.onOk())})("onClose",function(){return C(n),v(i.onClose())}),a(1,"header")(2,"small",3),m(3),s()(),a(4,"content")(5,"div",4),h(6,Mo,4,1,"ng-container",5),a(7,"div",6)(8,"div",7)(9,"table",8)(10,"thead",9)(11,"tr")(12,"th",10),m(13,"Name"),s(),a(14,"th",10),m(15,"Code"),s(),a(16,"th",10),m(17,"Price"),s(),a(18,"th",10),m(19,"Promo"),s(),h(20,xo,3,0,"ng-container",11)(21,Io,1,0,"ng-template",null,0,He),s()(),a(23,"tbody"),h(24,Eo,14,10,"tr",12),y(25,"async"),y(26,"sortBy"),s()()()()()()()}if(e&2){let n=j(22);p("config",i.modalConfig),l(3),O(" ( ",i.rewardQuantity," products reward ) "),l(3),p("ngIf",(i.sourceRewards==null?null:i.sourceRewards.length)>5),l(14),p("ngIf",i.rewardQuantity>1)("ngIfElse",n),l(4),p("ngForOf",st(26,8,T(25,6,i.rewards$),"desc","VariantCode"))}},dependencies:[ae,se,me,pe,Me,mt,J,pt,lt,ee,dt]})};var fe=class o{constructor(t,e,i,n,r,c,g,D,I){this._orderDataService=t;this._outletService=e;this._invoiceCalculatorService=i;this._dialog=n;this._httpService=r;this._posService=c;this._toastr=g;this._signalrService=D;this.decimalPipe=I;this.previousQuantity=0,this.previousTotalEligible=0,this.subscribeNotification(),this._posService.Data$.subscribe(k=>{this.taxes=k.Taxes}),this._outletService.Data$.subscribe(k=>{this.loadPromotions(k.Promotion)}),this._orderDataService.Data$.pipe(le(k=>{this.salesOrderData=k;let Qe=this.calculateOrderReward(k.getRewards()),Hi=this.calculateOrderReward(this.previousRewards);return this.previousQuantity!=k.TotalQuantity||Hi<Qe||this.isRestroreOrder}),rt(100)).subscribe(k=>{this.isRestroreOrder=!1,this.checkQtyPromotion(),this.applyQuantityPromotion(),this.previousRewards=[...k.getRewards()]}),this._invoiceCalculatorService.Data$.subscribe(k=>{this.checkEligiblePromotionWithMinSpend()})}_Data=new re([]);get Data(){return this._Data.getValue()}Data$=this._Data.asObservable();selectedPromotion=null;onClickToastPromo=new be;previousQuantity;salesOrderData;orderDataBeforePromotion;taxes=[];previousTotalEligible;previousRewards=[];isRestroreOrder=!1;calculateOrderReward(t){let e=0;return t.length>0&&(e=t.map(i=>i.Quantity).reduce((i,n)=>i+n)),e}checkQtyPromotion(){let t=this._orderDataService.Data;this.checkEligibleQtyPromotion(t.CartItems),this.checkEligibleTierPromotion(t.CartItems),this.previousQuantity=t.TotalQuantity}subscribeNotification(){this._signalrService.OnPromotionEventChange.pipe(he(),ie(()=>{let t=this._outletService.Data?.RegisterID;return this.getPromotions(t)})).subscribe(()=>{this._toastr.info("Promotion Event Updated","Promotion Update")})}getPromotions(t){return this._httpService.get(Q.GetListPromotion,[{key:"RegisterID",value:t}]).pipe(Oe(e=>{this.loadPromotions(e)}))}loadPromotions(t){let e=this.getPromotionDesc(t);this.pushNewValue(e),this.checkQtyPromotion(),this.checkEligiblePromotionWithMinSpend()}pushNewValue(t){this.showToastEligiblePromotion(),this._Data.next(t)}checkSelectedPromotionRequirement(t){this.selectedPromotion!=null&&this.selectedPromotion.TypeID==t&&this.Data.find(i=>i.ID===this.selectedPromotion.ID)?.Eligible===!1&&(this._dialog.open(_i,{id:"modal-promotion-confirm",data:{message:"Order will be restored to before the promotion is applied"},disableClose:!0}),this.isRestroreOrder=!0)}restoreOrder(){this._orderDataService.pushNewValue(this.orderDataBeforePromotion),this.selectedPromotion=null}getPromotionDesc(t=[]){return t?.map(i=>(i.Description=this.generatePromotionDesc(i),i))}checkEligiblePromotionWithMinSpend(){let t=this._invoiceCalculatorService.Data,e=this.Data?.filter(n=>(n.TypeID===1||n.TypeID==3)&&!this.checkExpiredPromotion(n)).map(n=>(t>=n.MinimumAmount?n.Eligible=!0:n.Eligible=!1,n)),i=this.mappingEligiblePromotion(e);this.pushNewValue(i),this.checkSelectedPromotionRequirement(1),this.checkSelectedPromotionRequirement(3)}checkEligibleQtyPromotion(t){let e=0,i=this.Data?.filter(r=>r.TypeID===2&&!this.checkExpiredPromotion(r)).map(r=>(r.Eligible=!1,r.ListVariant.length>0?(e=this.getQuantityByRequirementType(t,"variant",r.ListVariant),e>=r.MinimumAmount&&(r.Eligible=!0)):r.ListCategory.length>0?(e=this.getQuantityByRequirementType(t,"category",r.ListCategory),e>=r.MinimumAmount&&(r.Eligible=!0)):this.salesOrderData.TotalQuantity>=r.MinimumAmount&&(r.Eligible=!0),r)),n=this.mappingEligiblePromotion(i);this.pushNewValue(n)}checkEligibleTierPromotion(t){let e,i=this.Data?.filter(r=>r.TypeID===5&&!this.checkExpiredPromotion(r)).map(r=>(r.Eligible=!1,r.ListVariant.length>0?e=this.getQuantityByRequirementType(t,"variant",r.ListVariant):r.ListCategory.length>0?e=this.getQuantityByRequirementType(t,"category",r.ListCategory):e=this.salesOrderData.TotalQuantity,r.PromotionTieredQuantity.forEach(c=>{e>=c.Quantity&&(r.Eligible=!0)}),r)),n=this.mappingEligiblePromotion(i);this.pushNewValue(n)}getQuantityByRequirementType(t,e,i){let n=0,r;return e=="variant"?t.forEach(c=>{r=i.findIndex(g=>g.ID===c.VariantID),r!==-1&&(n+=c.Quantity)}):t.forEach(c=>{c.Variant&&(r=i.findIndex(g=>g.ID===c.Variant.CategoryID),r!==-1&&(n+=c.Quantity))}),n}mappingEligiblePromotion(t=[]){let e=this.Data;if(t?.length>0){let i;e=this.Data?.map(n=>(i=t.findIndex(r=>r.ID==n.ID),i!==-1&&(n=t[i]),n))}return e}checkExpiredPromotion(t){let e=new Date,i=new Date(t.StartDate),r=(f.IsEmpty(t.StartTime)?"00:00:00":t.StartTime).split(":").map(I=>parseInt(I));i.setHours(r[0],r[1],r[2]);let c=new Date(t.ExpirationDate),D=(f.IsEmpty(t.EndTime)?"23:59:59":t.EndTime).split(":").map(I=>parseInt(I));return c.setHours(D[0],D[1],D[2]),!(e.getTime()>=i.getTime()&&e.getTime()<=c.getTime())}showToastEligiblePromotion(){let t=this.getTotalEligiblePromotion(),e=f.IsNotEmpty(this.salesOrderData.Order.ID);this.previousTotalEligible!==t&&t>0&&!e&&this._toastr.info(t+" promotion(s) can be applied!","Promo available!",{timeOut:2e4}).onTap.pipe(Ae(1)).subscribe(()=>{this.onClickToastPromo.next(!0)}),this.previousTotalEligible=t}getTotalEligiblePromotion(){return this.Data?.filter(e=>e.Eligible).length}generatePromotionDesc(t){let e="";switch(t.TypeID){case 2:e+="Minimum "+this.decimalPipe.transform(t.MinimumAmount)+" ",t.ListVariant.length>0?(e=e+" piece of ",e+=this.generateItemListDescription(t.ListVariant)):t.ListCategory.length>0?(e+="from category ",e+=this.generateItemListDescription(t.ListCategory)):e+="items";break;case 1:e+="Minimum spend Rp. "+this.decimalPipe.transform(t.MinimumAmount);break;case 3:e+=`Apply
|
|
4
|
+
${t.Discount1!==0?"discount1 = "+t.Discount1+"%":""}
|
|
5
|
+
${t.Discount1!==0&&t.Discount2!==0?" and ":""}
|
|
6
|
+
${t.Discount2!==0?"discount2 = "+t.Discount2+"%":""}`}return e}generateItemListDescription(t){let e="";for(let i of t)e+=e==""?"":" or ",e+=`[${i.Name}]`;return e=this.slicePromotionDesc(e),e}slicePromotionDesc(t){return t.length>200&&(t=t.slice(0,200),t+="..."),t}applyPromotion(t){switch(this.orderDataBeforePromotion=It(ne,this.salesOrderData),this.selectedPromotion,this.selectedPromotion=t,t.TypeID){case 1:this.applyProductReward(t);break;case 2:switch(t.RewardTypeID){case 1:this.applyQuantityPromotion();break;case 2:this.applyCheapestReward(t);break}break;case 3:this.applyDiscountReward(t);break;case 4:break;case 5:this.applyTierReward(t);break}}applyProductReward(t){this.getRewards$(t).subscribe(e=>{this.openDialogSelectReward(e)})}openDialogSelectReward(t){this._dialog.open(Si,{data:{rewards:t.rewards,promotion:t.promotion}})}applyCheapestReward(t){let e=this.salesOrderData.CartItems;if(e.length>0){let n=e.sort((c,g)=>c.Price-g.Price)[0],r=n.Total;n.Quantity>1&&(r=n.Total/n.Quantity,r=r/n.Quantity),n.DiscountAmount=r,n.Note=t.Name,e=e.map(c=>(c.VariantID==n.VariantID&&(c=n,c.PromotionGift=!0),c)),this.salesOrderData.CartItems=e,this._orderDataService.pushNewValue(this.salesOrderData),this.showToastAppliedPromo(this.selectedPromotion)}}applyDiscountReward(t){let i=this._posService.Data.AppConfigJSON.ModuleSell.ProductNotes.CopyPromotionName;if(this.salesOrderData.Order.Discount+=t.Discount1,this.salesOrderData.Order.Discount2+=t.Discount2,this.salesOrderData.Order.Discount>100&&(this.salesOrderData.Order.Discount=100),i==!0&&(this.salesOrderData.Order.Note=t.Name),f.IsNotEmpty(t.TaxTypeID)){let n=this.taxes.find(r=>r.ID==t.TaxTypeID);this._invoiceCalculatorService.tax=n,this.salesOrderData.Order.TaxTypeID=t.TaxTypeID}this._orderDataService.pushNewValue(this.salesOrderData),this.pushNewValue(this.Data),this.showToastAppliedPromo(this.selectedPromotion)}applyTierReward(t){let e=this.salesOrderData.CartItems,i=[];t.ListVariant.length>0?i=e.filter(n=>t.ListVariant.findIndex(r=>r.ID==n.VariantID)!==-1):i=e.filter(n=>t.ListCategory.findIndex(r=>r.ID==n.Variant.CategoryID)!==-1),i.length==0?e=this.tierPromotionBlankRequirement(t):e=this.tierPromotionWithRequirement(t,i),this.salesOrderData.CartItems=e,this._orderDataService.pushNewValue(this.salesOrderData)}tierPromotionBlankRequirement(t){let e=this.salesOrderData.CartItems,i=this.salesOrderData.TotalQuantity;return t.PromotionTieredQuantity.sort((n,r)=>n.Quantity-r.Quantity).forEach(n=>{i>=n.Quantity&&(e=e.map(r=>(r.Discount=n.Discount,r=this.copyPromotionNameToItem(t,r),r)))}),e}tierPromotionWithRequirement(t,e){let i=0,n=this.salesOrderData.CartItems;e.forEach(c=>{i+=c.Quantity}),t.PromotionTieredQuantity.sort((c,g)=>c.Quantity-g.Quantity).forEach(c=>{i>=c.Quantity&&(e=e.map(g=>(g.Discount=c.Discount,g)))});let r;return n=n.map(c=>(r=e.find(g=>g==c),r&&(c=r,c=this.copyPromotionNameToItem(t,c)),c)),n}copyPromotionNameToItem(t,e){return this._posService.Data.AppConfigJSON.ModuleSell.ProductNotes.CopyPromotionName==!0&&(e.Note=t.Name),e}removePromotion(){this._orderDataService.pushNewValue(this.orderDataBeforePromotion),this.showToastRemovePromo(this.selectedPromotion),this.selectedPromotion=null}showToastAppliedPromo(t){this._toastr.success("Applied "+t.Name+" to order!","Applied successfully!")}showToastRemovePromo(t){this._toastr.info("Removed "+t.Name+" from order!","Removed successfully!")}applyQuantityPromotion(){if(this.selectedPromotion){let t=this.salesOrderData.getRewards();switch(this.selectedPromotion.TypeID){case 2:this.selectedPromotion.MultipleApply?this.calculateQtyMultiplyPromotion([this.selectedPromotion],t):(t.length==0&&this.applyQuantityReward(this.selectedPromotion,1),this.checkSelectedPromotionRequirement(2));break;case 5:this.applyTierReward(this.selectedPromotion),this.checkSelectedPromotionRequirement(5);break}}}calculateQtyMultiplyPromotion(t,e){let i=Ce(Be,this.salesOrderData.CartItems),n,r=[],c=0,g;t.forEach(D=>{r=i.filter(I=>(D.RequirementTypeID==0?n=D.ListVariant.findIndex(k=>k.ID==I.VariantID):n=D.ListCategory.findIndex(k=>k.ID==I.Variant.CategoryID),n!==-1)),g=e.filter(I=>I.PromotionID==D.ID),c=this.calculateQtyMultiply(r,D.MinimumAmount),this.showModalSelectReward(g,c,D)})}showModalSelectReward(t,e,i){let n=0;if(t.forEach(r=>n+=r.Quantity),e>n){let r=e-n;this.applyQuantityReward(i,r)}else if(e<n){this.selectedPromotion.Eligible=!1;let r=this.mappingEligiblePromotion([this.selectedPromotion]);this.pushNewValue(r),this.checkSelectedPromotionRequirement(2)}}applyQuantityReward(t,e){e>0&&this.getRewards$(t).subscribe(i=>{this._dialog.open(Pi,{data:{promotion:t,rewardQuantity:e,rewards:i.rewards}})})}calculateQtyMultiply(t,e){if(t.length>0){let n=t.filter(r=>r.PromotionGift==!1).map(r=>r.Quantity).reduce((r,c)=>r+c)/e;return this.getFirstNumber(n)}else return 0}getFirstNumber(t){let e=t.toString().split(".");return Number(e[0])}getRewards$(t){return this._httpService.get(Q.GetRewardByPromotionID,[{key:"ID",value:t.ID}]).pipe(z(e=>({rewards:e.Rewards,promotion:t})))}static \u0275fac=function(e){return new(e||o)(u(N),u(Y),u(Z),u(Ie),u(xe),u(L),u(A),u($e),u(ee))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var je=class o{constructor(t,e,i,n,r,c,g,D,I,k,Qe,Hi,qi){this._orderDataService=t;this._posHttpResponseService=e;this._CoreHttpService=i;this._outletService=n;this._orderHttpService=r;this._signal=c;this._promotionEventService=g;this._promotionCouponService=D;this._customerHttpService=I;this._invoiceCalculatorService=k;this._dialog=Qe;this._toastr=Hi;this._paymentGatewayService=qi;this.subscribeObservableChanges(),this._signal.OnContactReceive.subscribe(Bi=>{if(!f.IsEmpty(Bi)){let Li=JSON.parse(Bi);this._orderDataService.updateCustomerID(Li.ID).then($i=>{this.posData.ContactName=Li.Name,this._customerHttpService.Data=$i,this.pushNewValue(this.Data)})}})}_Data=new re(new vt);_clearOrder=new be;get clearOrder$(){return this._clearOrder.asObservable()}get Data(){return this._Data.value}Data$=this._Data.asObservable();posData=new ne;activeRegister=new An;subscribeObservableChanges(){this._orderDataService.Data$.pipe(he()).subscribe(t=>{this.posData=t}),this._outletService.Data$.pipe(le(t=>t?.RegisterID!==this.activeRegister?.RegisterID),he()).subscribe(t=>{this.activeRegister=t,this.Data.posState!=2?this.createNewSalesOrderDataModel():this.setPrintTemplateToDefault(this.posData.Order.TypeID)})}pushNewValue(t){this._Data.next(t)}createNewTransactionInSameOutletRegister(t=!0){if(t){let e=this._orderDataService.Data.Order.EntityID;this._CoreHttpService.GenerateNumber(e,this.activeRegister).subscribe(i=>{this.activeRegister.NumberElement=i.OrderNumberElement,this.activeRegister.InvoiceNumberElement=i.InvoiceNumberElement,this.activeRegister.NewOrderID=i.NewOrderID,this.refreshLoader(),this._promotionCouponService.resetRoleAfterAppliedCoupon(),this.pushNewValue(new vt),this.createNewSalesOrderDataModel()})}else this.pushNewValue(new vt),this.createNewSalesOrderDataModel()}refreshLoader(){if(this._posHttpResponseService.Data.AppConfigJSON.ModuleShift?.Closure?.Enabled){let i=this._posHttpResponseService.Data.Registers.find(n=>n.ID==this.activeRegister?.RegisterID);i&&f.IsEmpty(i.LoginID)&&this._posHttpResponseService.requestObservable().subscribe()}}updatePosState(t,e){e&&this._orderHttpService.pushNewValue(e),this.Data.posState=t,this.pushNewValue(this.Data)}ReturnOrder(t){t&&(this.posData.CartItems=Ce(Be,t.CartItems),this.posData.CartItems=this.posData.CartItems.map(e=>(e.Quantity=e.Quantity*-1,e.Variant.TypeID==4&&(e.Serial=e.Serial.map(i=>(i.Quantity=i.Quantity*-1,i))),e)),this.posData.Invoice.ReferenceInvoiceID=t.Invoice.ID,this.posData.Order.Discount=t.Order.Discount,this.posData.Order.Discount2=t.Order.Discount2,this.posData.Order.DiscountAmount=t.Order.DiscountAmount*-1,this.posData.Order.TaxTypeID=t.Order.TaxTypeID,this.posData.Order.SalesID=t.Order.SalesID,this.posData.Order.CustomerID=t.Order.CustomerID,this.posData.ContactName=t.ContactName,this.posData.Order.PointUsed=t.Order.PointUsed*-1,this.initSelectedTax(),this._orderDataService.pushNewValue(this.posData))}plainToClass(t,e){this.posData=It(ne,t),this.assignInvoice(t),this.assignCustomerData(t),this.initSelectedRegister(t,e),this.assignParkTemporaryItem(t),this.assignOrderCurrency(this.posData.Order.CurrencyID),this.initPromotionGift(),e==4&&(this.posData.Order.Date=new Date,this.posData.Action.DeliveryEntityID=this.getDeliveryEntityID(this.activeRegister)),this.initSelectedTax(),this._orderDataService.pushNewValue(this.posData)}initPromotionGift(){let t=this.posData.CartItems;t=t.map(e=>(e.PromotionGift=e.PriceTypeID==3,e))}initSelectedTax(){let t=this.posData.Order.TaxTypeID;this._invoiceCalculatorService.tax=this.getTaxObjectByID(t);let e=this._invoiceCalculatorService.tax;f.IsEmpty(e)&&this.showModalSuspendedDefaultTax()}assignInvoice(t){if(t.Invoice){let e=t.Invoice.Due!=f.MinDate?new Date(t.Invoice.Due):null,i=f.IsNotEmpty(t.Invoice.Date)?new Date(t.Invoice.Date):new Date;t.Invoice.Due=e,t.Invoice.Date=i,this.posData.Invoice=t.Invoice,this.posData.Action.Type=3}else{let e=this.activeRegister;this.posData.Invoice=new xn,f.IsNotEmpty(e.InvoiceNumberElement)&&(this.posData.Invoice.Number=Qi.Generate(e.InvoiceNumberElement))}}assignCustomerData(t){let e=t.Order.CustomerID,i=t.Order.EntityID;f.IsNotEmpty(e)&&f.IsNotEmpty(i)?Bt(this._customerHttpService.GetPrivilegeByID(e,i)).then(n=>{let c=this._posHttpResponseService.Data.AppConfigJSON.ApplicationLoyalty.Label;this._customerHttpService.Data=n,this._customerHttpService.Data.Label=c,this.pushNewValue(this.Data)}):this.Data.InputTextValue=null}initSelectedRegister(t,e){if(e!==4){let i=this._posHttpResponseService.Data.Registers;i.length>0?this.checkAccessOutletUser(t,i):this._toastr.warning("You do not have access to edit in this outlet","Warning")}else{let i=this.activeRegister.RegisterID;i!==t.Order.RegisterID&&(this.posData.Order.RegisterID=i,this._toastr.warning("You are processing order from different Register","Different Register"))}}checkAccessOutletUser(t,e){let i=t.Order.RegisterID,n=e.find(r=>r.ID==i);n?this._outletService.pushNewRegister(n):this._toastr.warning(`There is no Register with ID [${i}]`,"Warning")}assignParkTemporaryItem(t){this.Data.parkTemporaryItem=It(Be,t.CartItems),this.pushNewValue(this.Data)}getDefaultOrderType(t){if(f.IsNotEmpty(t.DefaultCustomerPOType))return t.DefaultCustomerPOType;{let e=this._posHttpResponseService.Data.PoTypes;return e.length>0?e[0].ID:null}}createNewSalesOrderDataModel(){let t=this._posHttpResponseService.Data.AppConfigJSON;this._promotionEventService.selectedPromotion=null,this._paymentGatewayService.clearTransactionID(),this._invoiceCalculatorService.discountAfterTax=0,this._customerHttpService.Data=new ut;let e=this._posHttpResponseService.Data,i=this.activeRegister,n=new ne;!f.IsEmpty(e.SalesID)&&i.ListSales!=null&&i.ListSales.find(c=>c.ID==e.SalesID)&&(n.Order.SalesID=e.SalesID),n.Action.NewOrderID=i.NewOrderID,f.IsNotEmpty(i.NumberElement)&&(n.Order.Number=Qi.Generate(i.NumberElement)),n.Order.CurrencyID=e.AppConfigJSON.CoreDefaults.CurrencyID,this.assignOrderCurrency(n.Order.CurrencyID),n=this.initDefaultTaxType(n),this._posHttpResponseService.Data.AppConfigJSON.ModuleSell.RememberOrderTypeFromPreviousTransaction?f.IsEmpty(this._orderHttpService.Data)?(n.Order.TypeID=this.getDefaultOrderType(i),this.setPrintTemplateToDefault(n.Order.TypeID)):n.Order.TypeID=this.posData.Order.TypeID:(n.Order.TypeID=this.getDefaultOrderType(i),this.setPrintTemplateToDefault(n.Order.TypeID)),f.IsNotEmpty(i.EntityID)&&(n.Order.EntityID=i.EntityID,n.Order.RegisterID=i.RegisterID),n.Order.CouponType=t.TadaCouponVisible?2:1,n.Action.DeliveryEntityID=this.getDeliveryEntityID(i),this.Data.posState=0,this._orderDataService.pushNewValue(n)}initDefaultTaxType(t){let e=this._posHttpResponseService.Data;if(f.IsNotEmpty(this.activeRegister.DefaultTaxType)){let i=this.getTaxObjectByID(this.activeRegister.DefaultTaxType);f.IsNotEmpty(i)?(t.Order.TaxTypeID=this.activeRegister.DefaultTaxType,this._invoiceCalculatorService.tax=i):(this.showModalSuspendedDefaultTax(),t.Order.TaxTypeID=e.Taxes[0].ID,this._invoiceCalculatorService.tax=e.Taxes[0])}else t.Order.TaxTypeID=e.Taxes[0].ID,this._invoiceCalculatorService.tax=e.Taxes[0];return t}assignOrderCurrency(t){let e=this.findCurrencyById(t);this._invoiceCalculatorService.currencySymbol=e?.Symbol,this.posData.Order.CurrencyRate=e?.ExchangeRate}setPrintTemplateToDefault(t){let i=(this._posHttpResponseService?.Data?.PoTypes).find(n=>n.ID==t);i?.PrintTemplateID==0?(this.activeRegister.PrintTemplate=this.activeRegister.DefaultPrintTemplate,this._outletService.pushNewValue(this.activeRegister)):this.activeRegister?.PrintTemplate?.ID!==i?.PrintTemplateID&&this._orderHttpService.getSalesOrderPrint(i?.PrintTemplateID).subscribe(n=>{this.activeRegister.PrintTemplate=n.Template,this._outletService.pushNewValue(this.activeRegister)})}findCurrencyById(t=1){return this._posHttpResponseService.Data.Currencies.find(n=>n.ID==t)}getTaxObjectByID(t){return this._posHttpResponseService.Data.Taxes.find(i=>i.ID==t)}getDeliveryEntityID(t){if(this._posHttpResponseService.Data.AppConfigJSON.ModuleSell.Shipping.DefaultOrderDelivery==0){let i=this._posHttpResponseService.Data.Entities.find(n=>n.ID==this._outletService.getOutletRegister().EntityID);return f.IsNotEmpty(i.ID)&&i.FulfillmentOption==2?f.GuidEmpty:f.IsEmpty(t.DefaultWarehouse)?t.EntityID:t.DefaultWarehouse}else return f.GuidEmpty}reedemPointToDiscount(t=!1){let e=this._posHttpResponseService.Data.AppConfigJSON,i=e.ApplicationLoyalty.Rules.PrefferedPayment,n=e.ApplicationLoyalty.Enabled,r=this._customerHttpService.Data,c=this.Data.posState==2,g=r.Point?r.Point:0;if(i&&g>0&&n){if(f.IsNotEmpty(this.posData.Order.CustomerID)&&!c){let D=e.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,I=this._invoiceCalculatorService.GetCashAndPointAmountCart(),k=g*D,Qe=g;k>I&&(k=I),k>0&&D>0?Qe=Math.ceil(k/D):Qe=0,r.PointUsed=Qe,this.posData.Order.PointUsed=Qe,this.posData.Order.DiscountAmount=k,this.resetCouponDiscountAmount()}else t&&(r.PointUsed=0,this.posData.Order.PointUsed=0,this.posData.Order.DiscountAmount=0);this._orderDataService.pushNewValue()}}resetCouponDiscountAmount(){let t=this._promotionCouponService.coupon;t&&(t.Type==2||t.Type==1&&t.MaximumDiscount>0&&!t.FullPriceProductOnly)&&(this._promotionCouponService.removeAppliedCoupon(),this._toastr.warning("Loyalty point is used, coupon will be cancelled","Coupon Cancelled"))}showModalSuspendedDefaultTax(){this._dialog.open(kn,{id:"ModalInfo",data:{title:"Default Tax Discontinued",message:`
|
|
7
|
+
<div class="d-flex justify-content-center my-4">
|
|
8
|
+
<img class="img-2x" src="https://res.cloudinary.com/pos/image/upload/v1705387550/POS/Images/Cashier/globalerror.svg"
|
|
9
|
+
alt="Empty Sales Order Tag" />
|
|
10
|
+
</div>
|
|
11
|
+
<h4 class="text-center mb-4">
|
|
12
|
+
Your Default Tax for this outlet has been discontinued!
|
|
13
|
+
</h4>
|
|
14
|
+
<p class="text-center">
|
|
15
|
+
Please change the default tax or re-activate the tax <a href="/menu/Setup/Payment/Tax">here</a>.
|
|
16
|
+
</p>
|
|
17
|
+
`,headerType:te.Error},width:"31rem"})}emitClearOrder(){this._clearOrder.next(!0)}static \u0275fac=function(e){return new(e||o)(u(N),u(L),u(ht),u(Y),u(gt),u($e),u(fe),u(yt),u(we),u(Z),u(Ie),u(A),u(Ct))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};function Ro(o,t){if(o&1&&b(0,"img",40),o&2){let e=d(2);p("src",e.printTemplate.Logo,at)}}function No(o,t){if(o&1&&(a(0,"span"),m(1),s()),o&2){let e=d(3);l(),O("(",e.data.Contact.MemberIdentification,")")}}function Ao(o,t){if(o&1&&(a(0,"div",41)(1,"h3")(2,"span"),m(3),s()(),a(4,"div",42)(5,"strong"),m(6),s(),h(7,No,2,1,"span",0),a(8,"div",43)(9,"div")(10,"span"),m(11),s()(),a(12,"div")(13,"span"),m(14),s()(),a(15,"div"),b(16,"span",12),s(),a(17,"div")(18,"span"),m(19),s()()()()()),o&2){let e=d(2);l(3),P(e.appConfigJson.PrintConfigInvoice.DocumentLabel.Customer),l(3),P(e.data.ContactDisplay),l(),p("ngIf",e.data.Contact.MemberIdentification),l(4),P(e.data.Contact.Email),l(3),P(e.data.Contact.Phone?e.data.Contact.Phone:e.data.Contact.Mobile),l(2),p("innerHTML",e.data.Contact.Address,Ve),l(3),P(e.data.City)}}function ko(o,t){if(o&1&&(a(0,"span"),m(1),s()),o&2){let e=d(3);l(),O(", ",e.data.Shipping.Phone,"")}}function Vo(o,t){if(o&1&&(a(0,"div",44)(1,"h3"),m(2),s(),a(3,"div",42)(4,"div"),m(5),h(6,ko,2,1,"span",0),s(),b(7,"div",12),a(8,"div"),m(9),s()()()),o&2){let e=d(2);l(2),O(" ",e.appConfigJson.PrintConfigInvoice.DocumentLabel.ShippingAddress," "),l(3),O(" ",e.data.Shipping.Name,""),l(),p("ngIf",e.data.Shipping.Phone),l(),p("innerHTML",e.data.Shipping.Street,Ve),l(2),O(" ",e.data.Shipping.City," ")}}function Fo(o,t){if(o&1&&b(0,"i",47),o&2){let e=d().$implicit;p("innerHTML",e.Note,Ve)}}function Ho(o,t){if(o&1&&(a(0,"div"),m(1),s()),o&2){let e=d().$implicit;l(),O("-",e.Discount,"%")}}function Bo(o,t){if(o&1&&(a(0,"div"),m(1),s()),o&2){let e=d().$implicit;l(),O("-",e.DiscountAmount,"")}}function Lo(o,t){if(o&1&&(a(0,"tr")(1,"td",13),m(2),s(),a(3,"td"),m(4),a(5,"div"),h(6,Fo,1,1,"i",45),s()(),a(7,"td"),m(8),s(),a(9,"td",13),m(10),y(11,"number"),s(),a(12,"td"),m(13),s(),a(14,"td",13),m(15),y(16,"number"),s(),a(17,"td",46),h(18,Ho,2,1,"div",0)(19,Bo,2,1,"div",0),s(),a(20,"td",13),m(21),y(22,"TrailingZero"),s()()),o&2){let e=t.$implicit,i=t.index,n=d(2);l(2),O("",i+1,"."),l(2),O(" ",e.Name," "),l(2),p("ngIf",e.Note!=null),l(2),P(e.Code),l(2),P(T(11,10,e.Quantity)),l(3),P(e.UOMName),l(2),P(T(16,12,e.UnitPrice)),l(3),p("ngIf",e.Discount!=0),l(),p("ngIf",e.DiscountAmount!=0),l(2),P(K(22,14,e.Total,n.appConfigJson.PrintConfigGeneral.TrailingZero))}}function jo(o,t){if(o&1&&(a(0,"span"),m(1),y(2,"sum"),s()),o&2){let e=d().index,i=d(2);l(),O(" ",e==0&&(i.data==null?null:i.data.Items.length)>1?"Qty: "+K(2,1,i.data.Items,"Quantity"):"","")}}function Qo(o,t){if(o&1&&(a(0,"tr")(1,"th",48),h(2,jo,3,4,"span",0),m(3),s(),a(4,"th"),m(5,":"),s(),a(6,"th",49),m(7),s(),a(8,"th",50),m(9),y(10,"TrailingZero"),s()()),o&2){let e=t.$implicit,i=t.index,n=d(2);l(2),p("ngIf",n.appConfigJson.PrintConfigInvoice.ItemsFooter.TotalQuantityVisible),l(),O(" ",(n.data==null?null:n.data.Payments.length)>1&&i==(n.data==null?null:n.data.AmountSummary.length)-2?"Payment":e.Label," "),l(4),P(e.CurrencySymbol),l(2),O(" ",K(10,4,e.Amount,n.appConfigJson.PrintConfigGeneral.TrailingZero),"")}}function Uo(o,t){if(o&1&&(a(0,"tr")(1,"th"),m(2),s(),a(3,"td"),m(4,":"),s(),a(5,"td",49),m(6),s(),a(7,"td",24),m(8),y(9,"TrailingZero"),s()()),o&2){let e=t.$implicit,i=d(2);l(2),P(e.Label),l(4),P(e.CurrencySymbol),l(2),O("",K(9,3,e.Amount,i.appConfigJson.PrintConfigGeneral.TrailingZero)," ")}}function Go(o,t){if(o&1&&(a(0,"span")(1,"span",51),m(2),y(3,"date"),s(),m(4),y(5,"number"),b(6,"br"),s()),o&2){let e=t.$implicit,i=d(3);l(),p("hidden",i.data.Payments),l(),P(K(3,5,e.Date,"dd MMM yy")),l(2),Yi(" ",e.MethodName," ",e.Note?e.Note:""," ",T(5,8,e.Amount)," ")}}function Wo(o,t){if(o&1&&(a(0,"tr"),b(1,"th",12),a(2,"td"),m(3," : "),s(),a(4,"td"),h(5,Go,7,10,"span",27),s()()),o&2){let e=d(2);l(),p("innerHTML",e.data.Invoice.PaymentStateID==2?"Down Payment":"Payment",Ve),l(4),p("ngForOf",e.data.Payments)}}function qo(o,t){if(o&1&&(a(0,"tr")(1,"th"),m(2," Delivery "),s(),a(3,"td"),m(4," : "),s(),a(5,"td")(6,"ul",52)(7,"li"),m(8),s()()()()),o&2){let e=d(2);l(8),O(" ",e.data.CustomerTransaction==null?null:e.data.CustomerTransaction.SO.DeliveryStateString," ")}}function $o(o,t){if(o&1&&(a(0,"tr")(1,"th",53),m(2,"Remaining"),s(),a(3,"td"),m(4," :"),s(),b(5,"td",54),y(6,"sum"),y(7,"number"),s()),o&2){let e=d(2);l(5),p("innerHtml",T(7,4,(e.data==null?null:e.data.FinalAmount)-K(6,1,e.data==null?null:e.data.Payments,"Amount")),Ve)}}function Jo(o,t){if(o&1&&(a(0,"tr")(1,"th"),m(2," Note "),s(),a(3,"td"),m(4," : "),s(),a(5,"td")(6,"ul",52)(7,"li"),m(8),s()()()()),o&2){let e=d(2);l(8),O(" ",e.data.Invoice==null?null:e.data.Invoice.Note," ")}}function zo(o,t){if(o&1&&(a(0,"div",55)(1,"h5"),m(2),s(),a(3,"div",33),m(4," \xA0 "),s()()),o&2){let e=d(2);l(2),O(" ",e.appConfigJson.PrintConfigInvoice==null?null:e.appConfigJson.PrintConfigInvoice.FooterLabel.ApprovedBy," ")}}function Ko(o,t){if(o&1&&(a(0,"div",56)(1,"h5"),m(2),s(),a(3,"div",33),m(4," \xA0 "),s()()),o&2){let e=d(2);l(2),O(" ",e.appConfigJson.PrintConfigDelivery==null?null:e.appConfigJson.PrintConfigDelivery.FooterLabel.DeliveredBy," ")}}function Yo(o,t){if(o&1&&b(0,"div",57),o&2){let e=d(2);p("innerHTML",e.printTemplate.FooterRight,Ve)}}function Zo(o,t){if(o&1&&(a(0,"div"),b(1,"link",1)(2,"link",2),a(3,"div",3)(4,"div",4)(5,"div",5)(6,"div",6)(7,"div",7),h(8,Ro,1,1,"img",8),a(9,"div",9)(10,"h2"),m(11),s(),a(12,"small"),m(13),s(),a(14,"div",10)(15,"div",11),b(16,"span",12),y(17,"newlines"),s(),a(18,"div",13),b(19,"span",12),y(20,"newlines"),s()()()(),h(21,Ao,20,7,"div",14),s(),a(22,"div",15)(23,"h1")(24,"strong"),m(25),s(),a(26,"span"),m(27),s()(),a(28,"div")(29,"table")(30,"thead")(31,"tr")(32,"th"),m(33,"Date"),s()()(),a(34,"tbody")(35,"tr")(36,"td"),m(37),y(38,"date"),s()()()()(),h(39,Vo,10,5,"div",16),s()()(),a(40,"section",17)(41,"div",18)(42,"table",19)(43,"thead",20)(44,"tr")(45,"th",21),m(46,"No"),s(),a(47,"th"),m(48,"Name"),s(),a(49,"th",22),m(50,"Code"),s(),a(51,"th",23),m(52,"Qty"),s(),a(53,"th",24),m(54,"UOM"),s(),a(55,"th",25),m(56),s(),a(57,"th",26),m(58," Disc"),s(),a(59,"th",25),m(60),s()()(),a(61,"tbody"),h(62,Lo,23,17,"tr",27),s()(),a(63,"div",28)(64,"table",29)(65,"tbody"),h(66,Qo,11,7,"tr",27),s(),a(67,"tbody"),h(68,Uo,10,6,"tr",27),s()()()()(),a(69,"table",30),h(70,Wo,6,2,"tr",0)(71,qo,9,1,"tr",0)(72,$o,8,6,"tr",0)(73,Jo,9,1,"tr",0),s(),a(74,"div")(75,"div")(76,"div",31)(77,"div",32)(78,"h5"),m(79),s(),a(80,"div",33),m(81," \xA0 "),s()(),h(82,zo,5,1,"div",34)(83,Ko,5,1,"div",35),a(84,"div",36)(85,"h5"),m(86),s(),a(87,"div",33),m(88),s()()()()(),a(89,"div",37),b(90,"div",38),h(91,Yo,1,1,"div",39),s()()()),o&2){let e=d();l(8),p("ngIf",e.printTemplate.Logo),l(3),P(e.printTemplate.Title),l(2),P(e.printTemplate.Field),l(3),p("innerHTML",T(17,27,e.printTemplate.Address),Ve),l(3),p("innerHTML",T(20,29,e.printTemplate.ContactInfo),Ve),l(2),p("ngIf",e.data.ContactDisplay),l(4),P(e.data.Prefixed),l(2),O(" ",e.data.Invoice==null?null:e.data.Invoice.Number," "),l(10),P(K(38,31,e.data.Invoice==null?null:e.data.Invoice.Date,"dd MMM yyyy")),l(2),p("ngIf",e.data.Shipping),l(17),O("Price(",e.data.CurrencySymbol,")"),l(4),O("Total(",e.data.CurrencySymbol,")"),l(2),p("ngForOf",e.data.Items),l(4),p("ngForOf",e.data==null?null:e.data.AmountSummary),l(2),p("ngForOf",e.data==null?null:e.data.PaidAmountSummary),l(2),p("ngIf",(e.appConfigJson.PrintConfigInvoice==null?null:e.appConfigJson.PrintConfigInvoice.Footer.PaymentMethodVisible)&&e.data.Payments.length>0),l(),p("ngIf",(e.data.CustomerTransaction==null?null:e.data.CustomerTransaction.SO)!=null&&(e.data.CustomerTransaction==null?null:e.data.CustomerTransaction.SO.DeliveryStateID)!=3&&(e.appConfigJson.PrintConfigInvoice==null?null:e.appConfigJson.PrintConfigInvoice.Footer.DeliveryInfoVisible)),l(),p("ngIf",(e.data==null||e.data.Invoice==null?null:e.data.Invoice.PaymentStateID)&&(e.data==null||e.data.Invoice==null?null:e.data.Invoice.PaymentStateID)<3),l(),p("ngIf",e.data.Invoice==null?null:e.data.Invoice.Note),l(6),O(" ",e.appConfigJson.PrintConfigInvoice==null?null:e.appConfigJson.PrintConfigInvoice.FooterLabel.ReceivedBy," "),l(3),p("ngIf",(e.appConfigJson.PrintConfigDelivery==null?null:e.appConfigJson.PrintConfigDelivery.Footer.SignatureCountType)==1||(e.appConfigJson.PrintConfigDelivery==null?null:e.appConfigJson.PrintConfigDelivery.Footer.SignatureCountType)==2),l(),p("ngIf",(e.appConfigJson.PrintConfigDelivery==null?null:e.appConfigJson.PrintConfigDelivery.Footer.SignatureCountType)==2),l(3),O(" ",e.appConfigJson.PrintConfigInvoice==null?null:e.appConfigJson.PrintConfigInvoice.FooterLabel.SignedBy," "),l(2),O(" ",e.data.ItemTransfer==null?null:e.data.ItemTransfer.Courier," "),l(2),p("ngClass",!e.printTemplate.FooterRight&&"single")("innerHTML",e.printTemplate.FooterLeft,Ve),l(),p("ngIf",e.printTemplate.FooterRight)}}var so=class o{data;outletInfo;appConfigJson;printTemplate;constructor(){}ngOnInit(){}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=V({type:o,selectors:[["POS-bill-receipt-A4"]],inputs:{data:"data",outletInfo:"outletInfo",appConfigJson:[0,"config","appConfigJson"],printTemplate:"printTemplate"},decls:1,vars:1,consts:[[4,"ngIf"],["rel","stylesheet","href",ji`/Styles/Master/app_custom.css`,"type","text/css"],["rel","stylesheet","href",ji`/Styles/Print/PaperSizeA4_custom.css`,"type","text/css"],[1,"print_container"],[1,"sales_order_A4"],[1,"header","clearfix"],[1,"header_left"],[1,"company"],["class","float",3,"src",4,"ngIf"],[1,"companyBody"],[1,"contact_info","clearfix"],[1,"address"],[3,"innerHTML"],[1,"number"],["class","contact","style","min-width: 400px",4,"ngIf"],[1,"header_right"],["class","contact shippingAddress mt-3",4,"ngIf"],[1,"cart-mini-items"],[1,"cartItems"],[1,"w-100","table","table-sm","table-bordered","plain"],[2,"background","#FDF3C6"],[1,"number",2,"width","20px"],[2,"width","100px"],[1,"number",2,"width","50px"],[2,"width","50px"],[1,"number",2,"width","100px"],[1,"number","text-end",2,"width","20px"],[4,"ngFor","ngForOf"],[1,"col-12"],[1,"table","table-sm","table-borderless","d-flex","justify-content-end"],[1,"info"],[1,"signature"],[1,"left"],[1,"name"],["class","left leftSmall",4,"ngIf"],["class","left rightSmall",4,"ngIf"],[1,"right"],[1,"note"],[1,"left",3,"ngClass","innerHTML"],["class","right",3,"innerHTML",4,"ngIf"],[1,"float",3,"src"],[1,"contact",2,"min-width","400px"],[1,"box"],[1,"customer_info"],[1,"contact","shippingAddress","mt-3"],["class","special-TinyMCE","style","word-break:break-all",3,"innerHTML",4,"ngIf"],[1,"number","red","text-end"],[1,"special-TinyMCE",2,"word-break","break-all",3,"innerHTML"],["colspan","3"],[1,"currency"],[1,"text-end",2,"width","50px"],[3,"hidden"],[1,"float"],[1,"bg-light-gray"],[3,"innerHtml"],[1,"left","leftSmall"],[1,"left","rightSmall"],[1,"right",3,"innerHTML"]],template:function(e,i){e&1&&h(0,Zo,92,34,"div",0),e&2&&p("ngIf",i.data)},dependencies:[De,ae,se,ee,ct,Pn,On,Dn],styles:['.UOMWidth[_ngcontent-%COMP%]{width:40px!important;font-size:10px;font-style:italic}.sellPayment[_ngcontent-%COMP%] input.txtPrice[_ngcontent-%COMP%]{font-size:55px}div.print_container[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{font-size:10px!important}a.linkMini[_ngcontent-%COMP%]{left:130px;position:absolute;top:.5px;text-decoration:none;color:#3b5998}div.print_container[_ngcontent-%COMP%]{margin:0 auto;width:900px;text-align:left;color:#000;position:relative}div.print_container[_ngcontent-%COMP%], div.print_container[_ngcontent-%COMP%] h1[_ngcontent-%COMP%], div.print_container[_ngcontent-%COMP%] h2[_ngcontent-%COMP%], div.print_container[_ngcontent-%COMP%] h3[_ngcontent-%COMP%], div.print_container[_ngcontent-%COMP%] h4[_ngcontent-%COMP%], div.print_container[_ngcontent-%COMP%] h5[_ngcontent-%COMP%], div.print_container[_ngcontent-%COMP%] h6[_ngcontent-%COMP%]{font-family:Arial!important;background-color:#fff}div.mode[_ngcontent-%COMP%]{color:gray;font-size:11px;text-align:right;height:20px;padding-top:2px}div.mode[_ngcontent-%COMP%] span[_ngcontent-%COMP%], div.mode[_ngcontent-%COMP%] ul[_ngcontent-%COMP%], div.mode[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{float:left;display:block;margin:0;padding:0}div.mode[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:first-child{padding-right:5px;margin-right:5px;border-right:solid 1px gray}div.mode[_ngcontent-%COMP%] div.printer[_ngcontent-%COMP%]{float:left}div.mode[_ngcontent-%COMP%] div.template[_ngcontent-%COMP%]{float:right}div.mode[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{margin:0 5px}div.header[_ngcontent-%COMP%] div.contact[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-size:12px;margin:0 5px 0 0;padding:0;font-weight:700;float:left}div.copy[_ngcontent-%COMP%]{background-image:url(/Images/Print/copy_bg.png);background-repeat:no-repeat;background-position:50% 70px}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%]{float:left;margin-left:5px;width:440px}div.note-info[_ngcontent-%COMP%]{margin:auto;width:23%}table.info[_ngcontent-%COMP%]{border-collapse:collapse;margin-top:5px;margin-left:5px}table.info[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table.info[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:5px 7px;border:solid 1px #d8d8d8}table.info[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#f6f6f6}div.fullContainer[_ngcontent-%COMP%] div.print_container[_ngcontent-%COMP%]{min-height:970px;position:relative}.clearfix[_ngcontent-%COMP%]{zoom:1}div.reportMargin[_ngcontent-%COMP%]{margin:20px 0 0}@media print{div.mode[_ngcontent-%COMP%], .linkMini[_ngcontent-%COMP%]{display:none;visibility:hidden;height:0px}thead[_ngcontent-%COMP%]{display:table-header-group}}small.creator[_ngcontent-%COMP%]{padding:2px 0 20px;font-style:normal}span.titleJB[_ngcontent-%COMP%]{font-weight:700;padding:10px 0 7px 8px;display:block}.topHolder[_ngcontent-%COMP%]{margin-top:15px!important}h1.jobOrderHeader[_ngcontent-%COMP%]{text-align:center}body[_ngcontent-%COMP%]{padding:0;font-size:12px}div.print_container[_ngcontent-%COMP%]{margin:0 auto!important;text-align:left;color:#000;position:relative}div.mode[_ngcontent-%COMP%]{color:gray;text-align:right;height:20px;padding-top:2px;font-size:10px}div.mode[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{float:left;display:block;margin:0 5px 0 0;padding:0}div.mode[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{float:left;display:block;margin:0;padding:0}div.mode[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{float:left;display:block;margin:0 5px 0 0;padding:0 5px 0 0;border-right:solid 1px gray}div.mode[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:last-child{border-right:none}div.mode[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:#3b5998;text-decoration:none}div.mode[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}div.mode[_ngcontent-%COMP%] a.active[_ngcontent-%COMP%]{color:gray}div.mode[_ngcontent-%COMP%] a.active[_ngcontent-%COMP%]:hover{text-decoration:none}div.header[_ngcontent-%COMP%]{width:100%;overflow:auto}div.header_left[_ngcontent-%COMP%]{float:left;padding:5px 0 0 5px}div.header_left[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:5px 0 0;padding:0;font-size:18px}div.header_right[_ngcontent-%COMP%]{float:right;padding:0 5px 0 0;max-width:425px}div.header_right[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:0;padding:0;text-align:right}div.header_right[_ngcontent-%COMP%] h1[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{font-size:16px;font-weight:700;margin:0 5px 0 0;text-transform:uppercase}div.header_right[_ngcontent-%COMP%] h1[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:18px;font-weight:400}div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{float:right;border-collapse:collapse}div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border:solid 1px #9E9E9E;padding:4px}div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background:#f6f6f6}div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding-bottom:6px}div.header[_ngcontent-%COMP%] img.float[_ngcontent-%COMP%]{margin:5px 0 0 5px;float:left}div.header[_ngcontent-%COMP%] div.company[_ngcontent-%COMP%]{width:100%;overflow:auto;margin:0 0 8px}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%]{float:left}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:18px;font-weight:700;margin:0;padding:0}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{font-size:11px;text-align:left;font-weight:400}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] div.contact_info[_ngcontent-%COMP%]{margin-top:3px}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] div.contact_info[_ngcontent-%COMP%] div.address[_ngcontent-%COMP%]{float:left;min-width:125px}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] div.contact_info[_ngcontent-%COMP%] div.number[_ngcontent-%COMP%]{margin-right:5px;min-width:160px}div.header[_ngcontent-%COMP%] div.contact[_ngcontent-%COMP%]{width:max-content;overflow:auto;border:solid 1px #9E9E9E;padding:5px}div.header[_ngcontent-%COMP%] div.contact[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-size:12px;margin:0 5px 0 0;padding:0;font-weight:700}div.cartItems[_ngcontent-%COMP%]{padding:10px 3px 2px 5px}div.copy[_ngcontent-%COMP%]{background-image:url(/Images/Print/copy_bg.png);background-repeat:no-repeat;background-position:50% 70px}div.topNote[_ngcontent-%COMP%]{clear:both;text-align:right}div.invoiceNote[_ngcontent-%COMP%]{padding:10px 0 0 7px}div.note[_ngcontent-%COMP%]{position:relative}div.note[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-weight:700;font-size:12px;margin:0 0 3px;padding:0}div.note[_ngcontent-%COMP%] div.single[_ngcontent-%COMP%]{width:895px!important}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%]{float:left;margin-left:5px;width:440px;text-align:left}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] ol[_ngcontent-%COMP%]{margin:5px 0 0;padding:0 0 0 20px}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] ol[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin:0 0 2px}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin:2px 0 5px;padding:0 0 0 20px}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin:0 0 2px}div.note[_ngcontent-%COMP%] div.right[_ngcontent-%COMP%]{float:right;width:440px;border-left:solid 1px #CACACA;padding-left:8px;margin-right:5px}div.note[_ngcontent-%COMP%] div.right[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin:0;padding:0;list-style:none}div.note[_ngcontent-%COMP%] div.right[_ngcontent-%COMP%] h3.closing[_ngcontent-%COMP%]{margin-top:10px;text-align:right}.clearfix[_ngcontent-%COMP%]:before, .clearfix[_ngcontent-%COMP%]:after{content:"";display:table}.clearfix[_ngcontent-%COMP%]:after{clear:both}small.timestamp[_ngcontent-%COMP%], small.creator[_ngcontent-%COMP%], small.printed[_ngcontent-%COMP%]{font-size:12px;text-align:center;display:block;font-style:italic;padding:2px 0}.shippingAddress[_ngcontent-%COMP%]{text-align:right;min-width:240px;clear:both}.shippingAddress[_ngcontent-%COMP%] div.box[_ngcontent-%COMP%] div[_ngcontent-%COMP%]:first-child{text-align:left;font-weight:700}.packingSlip[_ngcontent-%COMP%]{min-width:150px}.customer_info[_ngcontent-%COMP%]{min-width:310px}.special-TinyMCE[_ngcontent-%COMP%]{padding-top:10px!important}@media print{body[_ngcontent-%COMP%]{font-family:Arial;color:#000}}@-moz-document url-prefix(){}div.signature[_ngcontent-%COMP%], div.signature-b[_ngcontent-%COMP%]{clear:both;height:111px;margin-top:25px}div.signature[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{margin:0 0 80px;padding:0;font-size:12px;font-weight:700}div.signature[_ngcontent-%COMP%] div.name[_ngcontent-%COMP%]{border-top:solid 1px Gray;height:15px;text-align:center}div.signature[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%]{float:left;margin-left:70px;width:150px}div.signature[_ngcontent-%COMP%] div.center[_ngcontent-%COMP%]{float:left;margin-left:155px;width:150px}div.signature[_ngcontent-%COMP%] div.noLeftMargin[_ngcontent-%COMP%]{margin-left:0!important}div.signature[_ngcontent-%COMP%] div.leftSmall[_ngcontent-%COMP%]{margin-left:120px!important}div.signature[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] h5[_ngcontent-%COMP%], div.signature[_ngcontent-%COMP%] div.center[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{text-align:center}div.signature[_ngcontent-%COMP%] div.right[_ngcontent-%COMP%]{float:right;width:150px;margin-right:5px}div.print_container[_ngcontent-%COMP%] div.footerNote[_ngcontent-%COMP%]{padding-left:5px;width:150px}div.signature[_ngcontent-%COMP%] div.right[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{text-align:center}div.fullSignatureNote[_ngcontent-%COMP%]{position:absolute;bottom:0;width:100%}table[_ngcontent-%COMP%] tfoot[_ngcontent-%COMP%]{display:table-row-group}table.plain[_ngcontent-%COMP%]{border-collapse:collapse}table.plain[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{text-shadow:0 -1px 0 rgba(0,0,0,.4);height:28px;line-height:16px;padding:2px 7px;color:#fff;font-weight:700}table.plain[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]{background-color:#fceca3!important;background-image:none!important}table.plain[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{color:#000;text-shadow:none}table.plain[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:5px 7px}table.plain[_ngcontent-%COMP%] tr.thick[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] tr.thick[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-bottom:3px solid black}table.plain[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(2n){background-color:#f6f6f6}table.plain[_ngcontent-%COMP%] a.thumb[_ngcontent-%COMP%]{margin:0 5px 0 0;padding:0;float:left;display:block}table.plain[_ngcontent-%COMP%] a.thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;background-color:#fff;display:block;background-color:#d8dfea;border:1px solid #bbb;-webkit-border-radius:3px;border-radius:3px}table.plain[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{color:#2b4e75;font-style:italic;margin:0;padding:0}table.plain[_ngcontent-%COMP%] div.text[_ngcontent-%COMP%]{padding:2px 0 0}table.plain[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%] a[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:visited{display:block;color:#00f;text-decoration:none}table.plain[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(-n+3) a[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(-n+3) a[_ngcontent-%COMP%]:visited{font-weight:700}table.plain[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}table.plain[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{margin:0;padding:0;display:block}table.plain[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] input.txtPrice[_ngcontent-%COMP%]{border:solid 1px #C8D3DF;padding:3px;text-align:right}table.plain[_ngcontent-%COMP%] tr.group[_ngcontent-%COMP%]{background-color:#fdf3c6!important}table.plain[_ngcontent-%COMP%] tr.group[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:#000!important}table.plain[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:#fff}table.plain[_ngcontent-%COMP%] th.borderLRB0[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] td.borderLRB0[_ngcontent-%COMP%]{border-left-width:0px!important;border-right-width:0px!important;border-bottom-width:0px!important;background-color:#fff!important}table.plain[_ngcontent-%COMP%] th.number[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] td.number[_ngcontent-%COMP%]{text-align:right}table.plain[_ngcontent-%COMP%] th.numberCenter[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] td.numberCenter[_ngcontent-%COMP%]{text-align:center}table.plain[_ngcontent-%COMP%] th.red[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] td.red[_ngcontent-%COMP%]{color:red;text-align:right}table.plain[_ngcontent-%COMP%] td.top[_ngcontent-%COMP%]{vertical-align:top}table.plain[_ngcontent-%COMP%] td.noTopPad[_ngcontent-%COMP%]{padding-top:0}table.plain[_ngcontent-%COMP%] td.small[_ngcontent-%COMP%]{font-size:11px}table.plain[_ngcontent-%COMP%] tr.grid_footer[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] tr.grid_footer[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-width:0px;background-color:#fff}table.plain[_ngcontent-%COMP%] span.serial[_ngcontent-%COMP%]{display:inline-block;margin-left:10px}table.plain[_ngcontent-%COMP%] tr.grid_footer[_ngcontent-%COMP%] table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] tr.grid_footer[_ngcontent-%COMP%] table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:5px 0 5px 5px;background-color:#fff}table.plain[_ngcontent-%COMP%] td[_ngcontent-%COMP%] .inlineMarginLeft[_ngcontent-%COMP%]{display:inline-block;margin-left:10px}table.rightAuto[_ngcontent-%COMP%]{margin:0 0 0 auto}table[_ngcontent-%COMP%] ul.float[_ngcontent-%COMP%]{margin:0;padding:0;list-style-type:circle;list-style-position:inside}table[_ngcontent-%COMP%] ul.float[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin:0 20px 0 0;padding:0;float:left;display:block}table[_ngcontent-%COMP%] ul.float[_ngcontent-%COMP%] li[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{text-decoration:none}table[_ngcontent-%COMP%] ul.float[_ngcontent-%COMP%] li[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}div.scroll[_ngcontent-%COMP%]{width:100%;overflow:auto;padding:0 0 2px}table.fixed[_ngcontent-%COMP%]{table-layout:fixed}table.footer_row[_ngcontent-%COMP%]{margin:5px 8px 0 auto}table.footer_row[_ngcontent-%COMP%] td.currency[_ngcontent-%COMP%], table.footer_row[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:last-child{padding:5px 0 5px 5px;text-align:right}table.footer_row[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:5px;text-align:right;float:left}table.footer_adjust[_ngcontent-%COMP%]{margin:-10px 18px 0 auto}table.footer_adjust[_ngcontent-%COMP%] td.currency[_ngcontent-%COMP%], table.footer_adjust[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:last-child{padding:5px 0 5px 5px;text-align:right}table.footer_adjust[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:5px 23px 5px 5px;text-align:right;float:left}table.total-all-grid[_ngcontent-%COMP%]{width:100%!important;border-collapse:collapse;margin-top:10px}table.manufacture[_ngcontent-%COMP%]{width:100%;border-collapse:collapse}table.manufacture[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#fceca3!important}table.manufacture[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border:1px solid #BBBBBB!important}table.accounting[_ngcontent-%COMP%]{max-width:1000px;border-collapse:collapse}table.accounting[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{border-top:1px solid #999;border-bottom:1px solid #999;height:28px;line-height:16px;color:#444;background-color:#fceca3!important}table.accounting[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(2n){background-color:#f6f6f6}table.accounting[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table.accounting[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid black}table.accounting[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%] a[_ngcontent-%COMP%], table.accounting[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:visited{color:#00f;text-decoration:none}table.accounting[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}table.accounting[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] input.txtPrice[_ngcontent-%COMP%]{border:solid 1px #C8D3DF;padding:3px;text-align:right}table.accounting[_ngcontent-%COMP%] th.number[_ngcontent-%COMP%], table.accounting[_ngcontent-%COMP%] td.number[_ngcontent-%COMP%]{text-align:right}table.accounting[_ngcontent-%COMP%] th.red[_ngcontent-%COMP%], table.accounting[_ngcontent-%COMP%] td.red[_ngcontent-%COMP%]{color:red;text-align:right}table.accounting[_ngcontent-%COMP%] th.bordertop[_ngcontent-%COMP%], table.accounting[_ngcontent-%COMP%] td.bordertop[_ngcontent-%COMP%]{border-top:1px #999 solid}table.accounting[_ngcontent-%COMP%] tfoot[_ngcontent-%COMP%] td[_ngcontent-%COMP%], table.accounting[_ngcontent-%COMP%] tfoot[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding-bottom:20px}table.main[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr.main[_ngcontent-%COMP%]:nth-child(2n){background-color:#fff}table.main[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr.main[_ngcontent-%COMP%]:nth-child(4n-1){background-color:#f6f6f6}table.main[_ngcontent-%COMP%] table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]{background-color:#fceca3!important;background-image:none!important}table.main[_ngcontent-%COMP%] table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{border:1px solid #9e9e9e;color:#000;text-shadow:none}.cartItems[_ngcontent-%COMP%] .flow[_ngcontent-%COMP%]{width:100%;padding:0;margin:0}.cartItems[_ngcontent-%COMP%] .flow[_ngcontent-%COMP%] > li[_ngcontent-%COMP%]{width:calc(33% - 17px);float:left;list-style:none;padding:5px 7px;border:solid 1px #d8d8d8}.cartItems[_ngcontent-%COMP%] .flow[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{width:calc(33% - 17px);float:left;list-style:none;padding:5px 7px;border:solid 1px #d8d8d8;display:table-cell}.cartItems[_ngcontent-%COMP%] .flow[_ngcontent-%COMP%] td[_ngcontent-%COMP%] > p[_ngcontent-%COMP%]{color:#2b4e75;font-style:italic;margin:0;padding:0}.listReturn[_ngcontent-%COMP%] tr.item[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(2){width:10%!important}.listReturn[_ngcontent-%COMP%] tr.item[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(3){width:10%!important}.listReturn[_ngcontent-%COMP%] tr.item[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(5){width:10%!important}.listReturn[_ngcontent-%COMP%] tr.item[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(6){width:5%!important}.listReturn[_ngcontent-%COMP%] tr.item[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(7){width:10%!important}.listReturn[_ngcontent-%COMP%] a.head[_ngcontent-%COMP%]{padding:10px 0 10px 10px;display:block;width:50%}.listReturn[_ngcontent-%COMP%] td.numberCenter[_ngcontent-%COMP%]{text-align:right!important}.listReturn[_ngcontent-%COMP%] table.summary[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{padding-top:20px!important;display:block}table.paidAmount[_ngcontent-%COMP%]{float:right;margin-top:-10px;text-align:right;padding-right:7px}table.paidAmount[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:0 0 1px}table.paidAmount[_ngcontent-%COMP%] td.currency[_ngcontent-%COMP%]{width:20px;text-align:left}table.paidAmount[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(2){padding:0 5px}div.zebra[_ngcontent-%COMP%]{display:table;border-collapse:collapse}div.zebra[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{display:table-cell}div.zebra[_ngcontent-%COMP%] > div[_ngcontent-%COMP%] > strong[_ngcontent-%COMP%]{display:block;border:1px solid #525252;background-color:#545454;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(0%,#888),color-stop(100%,#545454));background-image:-webkit-linear-gradient(#888,#545454);background-image:-moz-linear-gradient(#888,#545454);background-image:-o-linear-gradient(#888,#545454);background-image:linear-gradient(#888,#545454);-webkit-box-shadow:inset 0 2px 0 -1px rgba(255,255,255,.2);-moz-box-shadow:inset 0 2px 0 -1px rgba(255,255,255,.2);box-shadow:inset 0 2px 0 -1px #fff3;text-shadow:0 -1px 0 rgba(0,0,0,.4);height:28px;line-height:24px;border-bottom:1px solid #333;padding:2px 7px;color:#fff;font-weight:700}div.zebra[_ngcontent-%COMP%] > div[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{display:block;padding:5px 7px;border:solid 1px #d8d8d8;font-weight:700}div.zebra[_ngcontent-%COMP%] > div[_ngcontent-%COMP%] > span.number[_ngcontent-%COMP%]{text-align:right}']})},Oi=class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=Gt({type:o});static \u0275inj=Ut({imports:[qe,oi]})};var St=class o{_state=Fe(this.getEcrConfig());isEnabled=We(()=>this._state()?.enabled);ecrUrl=We(()=>this._state()?.url);getEcrConfig(){let t=localStorage.getItem("ecrConfig"),e={enabled:!1,url:null,timestamp:""};return f.IsNotEmpty(t)&&(e=JSON.parse(t)),e}url=We(()=>{let t=this._state()?.url;if(t){let e=t.split("/");e.pop(),t=e.join("/")}return t});connect(t){let i={enabled:!0,url:t,timestamp:new Date().toDateString()};localStorage.setItem("ecrConfig",JSON.stringify(i)),this._state.set(i)}disconnect(){let e={enabled:!1,timestamp:new Date().toDateString(),url:null};localStorage.setItem("ecrConfig",JSON.stringify(e)),this._state.set(e)}static \u0275fac=function(e){return new(e||o)};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var Pt=class o{ecrStorage=X(St);socketConnection;_ecrEvent=new be;ecrEvent$=this._ecrEvent.asObservable();_isSignalRConnected=Fe(!1);isConnected=We(()=>this.ecrStorage.isEnabled()&&this._isSignalRConnected());toastr=X(A);initConnection(t){this.socketConnection=new ln().withUrl(t).withAutomaticReconnect().configureLogging(sn.Information).build(),this.ecrStorage.connect(t),this.listenToConnectionEvents(),this.listenToEvents(),this.startConnection()}startConnection(){this.socketConnection.start().then(()=>{this._isSignalRConnected.set(!0),this.toastr.success("Successfully connected to ECR","Success")}).catch(t=>{this.toastr.error(t,"Failed connecting to ECR"),console.log(t)})}listenToEvents(){this.socketConnection.on("EcrEvent",t=>{this._ecrEvent.next(t)})}stopConnection(){this.socketConnection.stop().then(()=>{console.info("SignalR for ECR is Disconnected")})}listenToConnectionEvents(){this.socketConnection.onreconnecting(()=>{console.info("SignalR for ECR is Reconnecting")}),this.socketConnection.onreconnected(()=>{console.info("SignalR for ECR is Reconnected"),this._isSignalRConnected.set(!0)}),this.socketConnection.onclose(()=>{console.info("SignalR for ECR is Closed"),this._isSignalRConnected.set(!1)})}static \u0275fac=function(e){return new(e||o)};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var tr=(o,t)=>({active:o,unactive:t}),ir=o=>({data:o,type:"unsent"}),nr=o=>({data:o,type:"success"}),or=o=>({data:o,type:"fail"});function rr(o,t){if(o&1&&(a(0,"span"),m(1),y(2,"async"),s()),o&2){let e,i=d(3);l(),O("(",(e=T(2,1,i.unsentOrders$))==null?null:e.length,")")}}function ar(o,t){if(o&1&&(h(0,rr,3,3,"span"),y(1,"async")),o&2){let e,i=d(2);E(((e=T(1,1,i.unsentOrders$))==null?null:e.length)>0?0:-1)}}function sr(o,t){if(o&1&&(a(0,"span"),m(1),y(2,"async"),s()),o&2){let e,i=d(3);l(),O("(",(e=T(2,1,i.successUploadedOrders$))==null?null:e.length,")")}}function lr(o,t){if(o&1&&(h(0,sr,3,3,"span"),y(1,"async")),o&2){let e,i=d(2);E(((e=T(1,1,i.successUploadedOrders$))==null?null:e.length)>0?0:-1)}}function cr(o,t){if(o&1&&(a(0,"span"),m(1),y(2,"async"),s()),o&2){let e,i=d(3);l(),O("(",(e=T(2,1,i.failedOrders$))==null?null:e.length,")")}}function mr(o,t){if(o&1&&(h(0,cr,3,3,"span"),y(1,"async")),o&2){let e,i=d(2);E(((e=T(1,1,i.failedOrders$))==null?null:e.length)>0?0:-1)}}function pr(o,t){if(o&1){let e=x();a(0,"mat-chip",4),S("click",function(){let n=C(e).$implicit,r=d();return v(r.activeFilter.set(n.value))}),m(1),h(2,ar,2,3)(3,lr,2,3)(4,mr,2,3),s()}if(o&2){let e,i=t.$implicit,n=d();p("ngClass",Yt(3,tr,i.value===n.activeFilter(),i.value!==n.activeFilter())),l(),O("",i.label," "),l(),E((e=i.label)==="Unsent"?2:e==="Success"?3:e==="Fail"?4:-1)}}function dr(o,t){o&1&&Wt(0)}function ur(o,t){if(o&1){let e=x();a(0,"div",6)(1,"button",7),y(2,"async"),S("click",function(){C(e);let n=d(2);return v(n.uploadUnsentOrders())}),b(3,"i",8),a(4,"span"),m(5,"Upload"),s()()()}if(o&2){let e=d(2);l(),p("disabled",T(2,1,e.isOnline$)==!1)}}function gr(o,t){if(o&1&&(h(0,dr,1,0,"ng-container",5),y(1,"async"),h(2,ur,6,3,"div",6),y(3,"async")),o&2){let e,i=d(),n=j(10);p("ngTemplateOutlet",n)("ngTemplateOutletContext",R(7,ir,T(1,3,i.unsentOrders$))),l(2),E(((e=T(3,5,i.unsentOrders$))==null?null:e.length)>0?2:-1)}}function fr(o,t){o&1&&Wt(0)}function hr(o,t){if(o&1){let e=x();a(0,"div",6)(1,"button",9),S("click",function(){C(e);let n=d(2);return v(n.clearSuccessUploadedOrders())}),b(2,"i",10),a(3,"span"),m(4,"Clear"),s()()()}}function Cr(o,t){if(o&1&&(h(0,fr,1,0,"ng-container",5),y(1,"async"),h(2,hr,5,0,"div",6),y(3,"async")),o&2){let e,i=d(),n=j(10);p("ngTemplateOutlet",n)("ngTemplateOutletContext",R(7,nr,T(1,3,i.successUploadedOrders$))),l(2),E(((e=T(3,5,i.successUploadedOrders$))==null?null:e.length)>0&&(i.role.sell!=null&&i.role.sell.Delete)?2:-1)}}function vr(o,t){o&1&&Wt(0)}function _r(o,t){if(o&1){let e=x();a(0,"div",6)(1,"button",11),S("click",function(){C(e);let n=d(2);return v(n.clearFailedOrders())}),b(2,"i",10),a(3,"span"),m(4,"Clear"),s()()()}}function yr(o,t){if(o&1&&(h(0,vr,1,0,"ng-container",5),y(1,"async"),h(2,_r,5,0,"div",6),y(3,"async")),o&2){let e,i=d(),n=j(10);p("ngTemplateOutlet",n)("ngTemplateOutletContext",R(7,or,T(1,3,i.failedOrders$))),l(2),E(((e=T(3,5,i.failedOrders$))==null?null:e.length)>0&&(i.role.sell!=null&&i.role.sell.Delete)?2:-1)}}function br(o,t){o&1&&b(0,"th")}function Sr(o,t){if(o&1&&(a(0,"span",21),m(1),y(2,"limitText"),s()),o&2){let e=d().$implicit;p("matTooltip",(e==null||e.Variant==null?null:e.Variant.Name.length)>=30?e==null||e.Variant==null?null:e.Variant.Name:""),l(),P(K(2,2,e==null||e.Variant==null?null:e.Variant.Name,30))}}function Pr(o,t){if(o&1&&(a(0,"div",19),h(1,Sr,3,5,"span",21),s()),o&2){let e=t.$implicit;l(),E(e?1:-1)}}function Or(o,t){if(o&1&&(a(0,"span"),m(1),y(2,"number"),s(),a(3,"span",22),m(4,"x"),s(),a(5,"span"),m(6),y(7,"number"),s()),o&2){let e=d().$implicit;l(),P(T(2,2,e==null?null:e.Quantity)),l(5),P(T(7,4,e==null?null:e.Price))}}function Dr(o,t){if(o&1&&(a(0,"div",20),h(1,Or,8,6),s()),o&2){let e=t.$implicit;l(),E(e?1:-1)}}function Mr(o,t){if(o&1&&(a(0,"span"),m(1),y(2,"number"),s()),o&2){let e=d().$implicit;l(),P(T(2,1,(e==null?null:e.Price)*(e==null?null:e.Quantity)))}}function xr(o,t){if(o&1&&(a(0,"div",20),h(1,Mr,3,3,"span"),s()),o&2){let e=t.$implicit;l(),E(e?1:-1)}}function Ir(o,t){if(o&1){let e=x();a(0,"a",26),S("click",function(){C(e);let n=d(2).$implicit,r=d(3);return v(r.uploadFailedOrder(n))}),b(1,"i",27),s()}}function Tr(o,t){if(o&1){let e=x();a(0,"a",28),S("click",function(){C(e);let n=d(2).$implicit,r=d(2).type,c=d();return v(r=="fail"?c.removeFailedOrder(n):c.removeUnsentOrder(n))}),b(1,"i",29),s()}}function wr(o,t){if(o&1&&(a(0,"td")(1,"div",23),h(2,Ir,2,0,"a",24),y(3,"async"),h(4,Tr,2,0,"a",25),s()()),o&2){let e=d(3).type,i=d();l(2),E(e=="fail"&&T(3,2,i.isOnline$)?2:-1),l(2),E(i.role.sell.Delete&&e!="success"?4:-1)}}function Er(o,t){if(o&1&&(a(0,"tr")(1,"td"),m(2),s(),a(3,"td")(4,"div"),m(5),y(6,"date"),s(),a(7,"div"),m(8),y(9,"date"),s()(),a(10,"td"),Dt(11,Pr,2,1,"div",19,Ot),s(),a(13,"td"),Dt(14,Dr,2,1,"div",20,Ot),s(),a(16,"td"),Dt(17,xr,2,1,"div",20,Ot),s(),h(19,wr,5,4,"td"),s()),o&2){let e=t.$implicit,i=d(2).data;l(2),P(e.Order.Number),l(3),O(" ",K(6,4,e==null||e.Order==null?null:e.Order.ClientTimestamp,"dd MMM yyyy")," "),l(3),O(" ",K(9,7,e==null||e.Order==null?null:e.Order.ClientTimestamp,"HH:mm")," "),l(3),Mt(e.CartItems),l(3),Mt(e.CartItems),l(3),Mt(e.CartItems),l(2),E((i==null?null:i.length)>0?19:-1)}}function Rr(o,t){if(o&1&&h(0,Er,20,10,"tr",18),o&2){let e=d().data;p("ngForOf",e)}}function Nr(o,t){o&1&&(a(0,"tr",17)(1,"td",30),b(2,"empty-state-table"),s()())}function Ar(o,t){if(o&1&&(a(0,"div",12)(1,"table",13)(2,"thead",14)(3,"tr")(4,"th"),m(5,"Number"),s(),a(6,"th"),m(7,"Date"),s(),a(8,"th",15),m(9,"Product"),s(),a(10,"th",16),m(11,"Price"),s(),a(12,"th",16),m(13,"Total"),s(),h(14,br,1,0,"th"),s()(),a(15,"tbody"),h(16,Rr,1,1,"tr")(17,Nr,3,0,"tr",17),s()()()),o&2){let e=t.data;l(14),E((e==null?null:e.length)>0?14:-1),l(2),E((e==null?null:e.length)>0?16:17)}}var Di=class o{config=new $;dialogRef=X(q);localDataService=X(Te);onlineService=X(ue);role=X(Xt);toastr=X(A);isOnline$=this.onlineService.getOnlineStatus$();unsentOrders$;failedOrders$;successUploadedOrders$;activeFilter=Fe(0);filters=[{label:"Unsent",value:0},{label:"Success",value:1},{label:"Fail",value:2}];constructor(){this.initModalConfig(),this.initFailedOrders(),this.initUnsentOrders(),this.initSuccessUploadedOrders()}initFailedOrders(){this.failedOrders$=this.localDataService.failedOrders$.pipe(this.pipeMap(),jt(1))}initSuccessUploadedOrders(){this.successUploadedOrders$=this.localDataService.successUploadedOrders$.pipe(this.pipeMap(),jt(1))}initUnsentOrders(){this.unsentOrders$=ot([this.localDataService.unsentOrders$,this.onlineService.getOnlineStatus$()]).pipe(Oe(([t,e])=>{t.length>0&&e?this.config.hideClose=!0:this.config.hideClose=!1}),z(([t,e])=>t),this.pipeMap(),jt(1))}pipeMap(){return Ht(z(t=>t.map(e=>Ce(ne,e))))}initModalConfig(){this.config.hideFooter=!0,this.config.title="Sync Offline Orders",this.config.customWidth="700px",this.config.bodyScrollable=!0}uploadUnsentOrders(){this.localDataService.uploadOrders().pipe(Ae(1)).subscribe()}removeUnsentOrder(t){this.localDataService.removeOrder(t.id).pipe(Ae(1)).subscribe({next:()=>{this.toastr.success("Success to remove unsent offline order","Error!")},error:e=>{this.toastr.error("Failed to remove unsent offline order","Error!")}})}uploadFailedOrder(t){this.localDataService.uploadFailedOrder(t).pipe(Ae(1)).subscribe()}removeFailedOrder(t){this.localDataService.removeFailedOrder(t.id).pipe(Ae(1)).subscribe({next:()=>{this.toastr.success("Success to remove failed offline order","Error!")},error:e=>{this.toastr.error("Failed to remove failed offline order","Error!")}})}clearFailedOrders(){this.localDataService.clearFailedOrders().pipe(Ae(1)).subscribe({next:()=>{this.toastr.success("Success to clear failed offline order","Error!")},error:t=>{this.toastr.error("Failed to clear failed offline order","Error!")}})}clearSuccessUploadedOrders(){this.localDataService.clearSuccessUploadedOrder().pipe(Ae(1)).subscribe({next:()=>{this.toastr.success("Success to clear success uploaded offline order","Error!")},error:t=>{this.toastr.error("Failed to clear success uploaded offline order","Error!")}})}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=V({type:o,selectors:[["app-modal-offline-order"]],standalone:!0,features:[Kt],decls:11,vars:2,consts:[["ORDERS_TABLE",""],[3,"onClose","config"],["aria-label","Fish selection",1,"offline","mx-8"],[3,"ngClass"],[3,"click","ngClass"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"d-flex","justify-content-center","mb-3"],["matTooltip","Upload all unsent orders to server",1,"btn","btn-success","btn-sm",3,"click","disabled"],["aria-hidden","true",1,"fa-solid","fa-upload","me-2"],["matTooltip","Clear success uploaded orders",1,"btn","btn-danger","btn-sm",3,"click"],["aria-hidden","true",1,"fa-solid","fa-trash","me-2"],["matTooltip","Clear failed uploaded orders",1,"btn","btn-danger","btn-sm",3,"click"],[1,"table-responsive","m-8"],[1,"table"],[1,"thead-light"],[1,"text-start"],[1,"text-end"],[1,"table-border-bottom-0"],[4,"ngFor","ngForOf"],[1,"list-unstyled","text-start"],[1,"list-unstyled","text-end"],[3,"matTooltip"],[1,"mx-3"],[1,"d-flex","justify-content-center"],["matTooltipPosition","above","matTooltip","Sync failed order to server",1,"ms-2","me-2","cursor-pointer"],["matTooltipPosition","above","matTooltip","Remove order from local browser",1,"ms-5","cursor-pointer"],["matTooltipPosition","above","matTooltip","Sync failed order to server",1,"ms-2","me-2","cursor-pointer",3,"click"],["aria-hidden","true",1,"fa-solid","fa-cloud-arrow-up","text-primary","fa-2x"],["matTooltipPosition","above","matTooltip","Remove order from local browser",1,"ms-5","cursor-pointer",3,"click"],["aria-hidden","true",1,"fa-regular","fa-xmark-circle","text-danger","fa-2x"],["colspan","5"]],template:function(e,i){if(e&1){let n=x();a(0,"modal-material",1),S("onClose",function(){return C(n),v(i.onClose())}),a(1,"content")(2,"div")(3,"mat-chip-set",2),Dt(4,pr,5,6,"mat-chip",3,Ot),s(),h(6,gr,4,9)(7,Cr,4,9)(8,yr,4,9),s()()(),h(9,Ar,18,2,"ng-template",null,0,He)}if(e&2){let n;p("config",i.config),l(4),Mt(i.filters),l(2),E((n=i.activeFilter())===0?6:n===1?7:n===2?8:-1)}},dependencies:[qe,De,ae,tn,lt,ee,ct,ii,J,Nn,En,Rn,zn,Cn,xt,ei],styles:["mat-chip-set.offline mat-chip.active .mat-mdc-chip-action-label{color:#008069!important}mat-chip.active[_ngcontent-%COMP%]{background-color:#e7fce3} mat-chip-set.offline mat-chip.unactive .mat-mdc-chip-action-label{color:#54656f!important} mat-chip-set.offline mat-chip{height:34px}"]})};var Mi=class{RegisterID;InvoiceNumber;Amount};var xi=class{modalConfig=new $;viewState=4;paymentSuggestion;payLaterEnabled=!1;payNowEnabled=!1;payNowNLaterEnabled=!1;toleranceAmount=0;merchantName;payLaterDueDate;payLaterDueDays;numpadVisible=!1;config;uniquePaymentMethodOnSplit;isCancelEcrTransaction=!1;emoneyType=ai;constructor(){this.modalConfig.title="Amount to Pay: ",this.modalConfig.disableKeyup=!0,this.modalConfig.customWidth="650px",this.modalConfig.bodyScrollable=!0}mapAppConfigJson(t){this.merchantName=t.PaymentConfigGopay.MerchantName,this.toleranceAmount=t.ModuleSell.ToleranceAmount,this.numpadVisible=t.ModuleSell.NumPadVisible;let e=t.ModuleSell.PaymentDialog;switch(this.config=e,this.uniquePaymentMethodOnSplit=e.UniquePaymentMethodOnSplit,e.EnabledOptions){case 0:this.viewState=0,this.payNowEnabled=!0;break;case 1:this.viewState=1,this.payLaterEnabled=!0;break;case 2:switch(e.DefaultOption){case 0:this.viewState=0;break;case 1:this.viewState=1;break}this.payNowNLaterEnabled=!0;break}}enableEMoneyModal(t){this.modalConfig.backButton=t,this.modalConfig.hideCancel=t,this.modalConfig.hideClose=t,this.modalConfig.hideOk=t}enableEmoneyConfirmModal(t){this.modalConfig.backButton=t,this.modalConfig.hideCancel=t,this.modalConfig.hideClose=t,this.modalConfig.hideOk=t,t?(this.modalConfig.headerType=te.Warning,this.modalConfig.title="Warning! This is QRIS for Testing"):(this.modalConfig.headerType=te.Success,this.modalConfig.title="Amount to Pay: ")}enableModalWaitingEcr(t){this.modalConfig.hideCancel=t,this.modalConfig.hideClose=t,this.modalConfig.hideOk=t,this.isCancelEcrTransaction=!1,t?this.modalConfig.customWidth="550px":(this.modalConfig.customWidth="650px",this.modalConfig.headerType=te.Success,this.modalConfig.title="Amount to Pay: ")}cancelEcrTransaction(){this.modalConfig.title="Waiting Cancel from EDC Machine",this.modalConfig.headerType=te.Warning,this.isCancelEcrTransaction=!0}get isStateNow(){return this.viewState==0}get isStateLater(){return this.viewState==1}get isStateSplit(){return this.viewState==3}get isStateQR(){return this.viewState==2}get isQrisConfirm(){return this.viewState==4}get isWaitingPaymentEcr(){return this.viewState==5}};var Ii=class o{constructor(t,e,i,n,r,c,g,D){this._invoiceCalculatorService=t;this._posService=e;this._orderDataService=i;this._orderProcessorService=n;this._onlineStatusService=r;this._signalBroadCast=c;this.decimalPipe=g;this._registerService=D;this.subscribeToObservableChanges(),this.defaultCashPaymentMethodID=this.paymentList[0].ID}defaultCashPaymentMethodID=0;isOnline=!0;salesOrderData=new ne;_State;get State(){return this._State}set State(t){this._State=t}get denomination(){return this._posService.Data.Denomination}get appConfigJSON(){return this._posService.Data.AppConfigJSON}get toleranceAmount(){return this.appConfigJSON.ModuleSell.ToleranceAmount}get paymentList(){return f.IsNotEmpty(this._registerService.Data)?this._registerService.Data.Payments:Array()}subscribeToObservableChanges(){this._onlineStatusService.getOnlineStatus$().subscribe(t=>{this.isOnline=t}),this._orderDataService.Data$.subscribe(t=>{this.salesOrderData=t})}getPaymentList(){return this.paymentList}submitOrder(t){this.salesOrderData.Payments=Ce(Je,t),this.salesOrderData.Payments=this.removePayment(this.salesOrderData),this._orderDataService.pushNewValue(this.salesOrderData),this._orderDataService.submitOrder(this.appConfigJSON).then(e=>{this.updateBroadcastState(e),e=this.setFinalAmountOfflineOrder(e),this._orderProcessorService.updatePosState(1,e)},e=>{(e instanceof Lt||e?.name=="TimeoutError")&&(this._orderDataService.pushNewValue(this.salesOrderData),this._orderProcessorService.updatePosState(9))})}updateBroadcastState(t){let e=this.salesOrderData.TotalPaidAmount-this._invoiceCalculatorService.Data;this._signalBroadCast.BroadcastStateToCustomerDisplay(1,t.ObjectID,t.LoyaltyPoint,e).pipe(ie(i=>this.appConfigJSON?.AddOnsKitchenDisplay?.Order?.Type==1?this._signalBroadCast.BroadcastChangeToKitchenDisplay("COMPLETE_ORDER"):Se(i))).subscribe()}removePayment(t){return t.Payments.filter(i=>i.Amount!==0)}setFinalAmountOfflineOrder(t){return this.isOnline==!1&&(t.Final=this._invoiceCalculatorService.Data),t}generateCashSuggestion(){let t=this.paymentList.filter(i=>i.TypeID==1),e=[];return t.length>0&&(e.push(this._invoiceCalculatorService.Data),this.defaultCashPaymentMethodID=t[0].ID,this.denomination.forEach(i=>{let n=this._invoiceCalculatorService.Data/i;n=Math.ceil(n);let r=n*i;r!=this._invoiceCalculatorService.Data&&e.indexOf(r)===-1&&e.length<3&&e.push(r)})),e}static \u0275fac=function(e){return new(e||o)(u(Z),u(L),u(N),u(je),u(ue),u(Ye),u(ee),u(Y))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ti=class o{constructor(t,e,i,n,r){this.httpService=t;this.orderDataService=e;this.ecrLocalstorageService=i;this.ecrSignalR=n;this.toastr=r}onPay(t){let e=this.orderDataService.Data?.Order?.Number,i={Transaction_Type:"01",Transaction_Amount:t,Invoice_Number:e,Expire_Date:2406},n=this.ecrLocalstorageService.url();return ot([this.httpService.post(`${n}/api/Payment/Send`,i),this.ecrSignalR.ecrEvent$]).pipe(z(([r,c])=>c),ke(r=>{let c=r?.message?r?.message:r?.Message;return this.toastr.error(c,"Error"),nt(()=>r)}))}static \u0275fac=function(e){return new(e||o)(u(nn),u(N),u(St),u(Pt),u(A))};static \u0275prov=M({token:o,factory:o.\u0275fac,providedIn:"root"})};function Hr(o,t){o&1&&(G(0),a(1,"div",2)(2,"div",3),b(3,"img",4),s()(),a(4,"div",2)(5,"div",5)(6,"p",6),m(7," Please insert or swipe Debit/Credit Card for complete this transaction "),s()()(),W())}function Br(o,t){o&1&&(a(0,"div",2)(1,"div",7),b(2,"i",8),s(),a(3,"div",9)(4,"p",10),m(5," Please cancel the order at EDC machine by pressing the Cancel button "),a(6,"span",11),m(7,"(RED)"),s(),m(8," for clear currently amount "),s()()())}var wi=class o{isCancel=!1;constructor(){}ngOnInit(){}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=V({type:o,selectors:[["app-modal-ecr-info"]],inputs:{isCancel:"isCancel"},decls:3,vars:2,consts:[["CANCEL",""],[4,"ngIf","ngIfElse"],[1,"row"],[1,"col-12","d-flex","align-items-center","justify-content-center","pe-12","ps-0"],["src","https://res.cloudinary.com/pos/image/upload/w_180/v1672972793/POS/Images/Payment/EDC-Biru.png","alt",""],[1,"col-12","ps-0","d-flex","align-items-center","justify-content-center"],[1,"mb-2","fs-5","text-body-secondary"],[1,"col-2","d-flex","align-items-center","justify-content-center","pe-0"],[1,"fa-regular","fa-circle-xmark","text-danger",2,"font-size","40px"],[1,"col-10","d-flex","align-items-center","justify-content-center"],[1,"mb-2","px-3","fs-5","text-body-secondary"],[1,"text-danger","fw-bold"]],template:function(e,i){if(e&1&&h(0,Hr,8,0,"ng-container",1)(1,Br,9,0,"ng-template",null,0,He),e&2){let n=j(2);p("ngIf",!i.isCancel)("ngIfElse",n)}},dependencies:[se]})};var Ei=class o{constructor(){}ngOnInit(){}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=V({type:o,selectors:[["app-confirm-demo-qris"]],decls:22,vars:0,consts:[[1,"row"],[1,"col-4","d-flex","align-items-center","justify-content-center","pe-0"],["src","//res.cloudinary.com/pos/image/upload/v1666064858/POS/Images/Payment/QR_Test.png","width","115px","alt",""],[1,"col-8","ps-0"],[1,"mt-10"],["href","https://www.dealpos.co.id/tour/mobile-payment","target","_blank"],[1,"fw-bold"]],template:function(e,i){e&1&&(a(0,"div",0)(1,"div",1),b(2,"img",2),s(),a(3,"div",3)(4,"h4"),m(5,"WARNING"),s(),a(6,"p",4),m(7," You need to complete "),a(8,"a",5),m(9,"Regristration"),s(),m(10," with our payment Partner - "),a(11,"span",6),m(12,"Midtrans"),s(),m(13," before you can start accpeting "),a(14,"span",6),m(15,"QRIS Payment"),s(),m(16," and receive Pay Out at your Bank Account. "),s(),a(17,"p"),m(18," If you wish to test how this functionality works, we have provided a Sandbox account for "),a(19,"span",6),m(20,"Testing"),s(),m(21," purpose. "),s()()())}})};var Wi=o=>({selected:o}),Gr=(o,t)=>({active:o,"font-12":t}),Wr=o=>({"border-top py-5":o}),qr=o=>({"d-print-none":o}),$r=o=>({"qris-barcode":o}),Jr=o=>({bottom:o});function zr(o,t){if(o&1&&(a(0,"span"),m(1),s()),o&2){let e=d(2);l(),O(" (+",e.posData==null?null:e.posData.Invoice.SurchargePcg,"%) ")}}function Kr(o,t){if(o&1&&(a(0,"header")(1,"div",5),h(2,zr,2,1,"span",1),m(3),y(4,"number"),s()()),o&2){let e=d();l(2),p("ngIf",(e.posData==null?null:e.posData.Invoice.SurchargePcg)>0),l(),O(" ",e.userRole.PriceVisible?T(4,2,e.cashierCalculatorService.Data):"-"," ")}}function Yr(o,t){if(o&1){let e=x();a(0,"a",13),S("click",function(){C(e);let n=d(4);return v(n.onSplitClick())}),m(1," Split "),a(2,"span",14),m(3,"Payment"),s()()}if(o&2){let e=d(4);p("ngClass",R(1,Wi,e.modalFields.isStateSplit))}}function Zr(o,t){if(o&1){let e=x();a(0,"a",15),S("click",function(){C(e);let n=d(4);return v(n.onLaterClick())}),m(1," Later "),a(2,"span",14),m(3,"Take Credit"),s()()}if(o&2){let e=d(4);p("ngClass",R(1,Wi,e.modalFields.isStateLater))}}function Xr(o,t){if(o&1){let e=x();a(0,"div")(1,"a",10),S("click",function(){C(e);let n=d(3);return v(n.onNowClick())}),m(2," Now "),s(),h(3,Yr,4,3,"a",11)(4,Zr,4,3,"a",12),s()}if(o&2){let e=d(3);l(),p("ngClass",R(3,Wi,e.modalFields.isStateNow)),l(2),p("ngIf",((e.modalFields==null||e.modalFields.paymentSuggestion==null?null:e.modalFields.paymentSuggestion.length)==0||e.cashPaymentChange<0)&&e.modalFields.config.SplitPaymentMethodEnabled),l(),p("ngIf",e.modalFields.payNowEnabled==!1&&!e.userRole.CreditSalesLock)}}function ea(o,t){if(o&1&&(a(0,"div",9),h(1,Xr,5,5,"div",1),s()),o&2){let e=d(2);l(),p("ngIf",e.modalFields.payNowNLaterEnabled||e.modalFields.payNowEnabled)}}function ta(o,t){if(o&1){let e=x();a(0,"div",29)(1,"a",30),S("click",function(){let n=C(e).$implicit,r=d(4);return v(r.updateCashPayment(n))}),m(2),y(3,"number"),s()()}if(o&2){let e=t.$implicit,i=d(4);l(),p("ngClass",Yt(5,Gr,(i.Payments[0]==null?null:i.Payments[0].MethodID)==i.defaultCashPaymentMethodID&&(i.Payments[0]==null?null:i.Payments[0].PaidAmount)==e,i.modalFields.paymentSuggestion[0].toString().length>8)),l(),zt("",i.cashierCalculatorService==null?null:i.cashierCalculatorService.currencySymbol," ",T(3,3,e),"")}}function ia(o,t){if(o&1&&(a(0,"div",31),m(1),y(2,"number"),s()),o&2){let e=d(4);p("ngClass",e.cashPaymentChange>0?"success":"danger"),l(),zt(" ",e.cashierCalculatorService==null?null:e.cashierCalculatorService.currencySymbol," ",T(2,3,e.cashPaymentChange)," ")}}function na(o,t){if(o&1){let e=x();G(0),a(1,"div",19)(2,"div",20),b(3,"i",21),m(4," Cash "),s(),a(5,"div",22)(6,"div",23),h(7,ta,4,8,"div",24),s(),a(8,"div",25)(9,"div",26)(10,"input",27),B("ngModelChange",function(n){C(e);let r=d(3);return H(r.inputAmountString,n)||(r.inputAmountString=n),v(n)}),S("ngModelChange",function(){C(e);let n=d(3);return v(n.updateCashPayment(n.inputAmountString))}),s(),h(11,ia,3,5,"div",28),s()()()(),W()}if(o&2){let e=d(3);l(7),p("ngForOf",e.modalFields.paymentSuggestion),l(3),p("simpleKeyboard",e.keyboard),F("ngModel",e.inputAmountString),l(),p("ngIf",e.cashPaymentChange!=0)}}function oa(o,t){if(o&1){let e=x();a(0,"div",35)(1,"button",36),S("click",function(){let n=C(e).$implicit,r=d(4);return r.onPaymentMethodChanged(n),v(r.payWithEmoney(n))}),a(2,"span",37),b(3,"img",38),s(),a(4,"span",37),m(5),y(6,"limitTo"),s()()()}if(o&2){let e=t.$implicit;l(2),p("hidden",e.ImageUrl==null),l(),p("src",e.ImageUrl,at),l(),p("hidden",e.ImageUrl!=null),l(),O(" ",K(6,4,e.Name,20)," ")}}function ra(o,t){if(o&1&&(a(0,"div",19)(1,"div",20),b(2,"i",32),m(3," QRIS "),s(),a(4,"div",22)(5,"div",33),h(6,oa,7,7,"div",34),s()()()),o&2){let e=d(3);l(6),p("ngForOf",e.getTypePaymentList(3))}}function aa(o,t){if(o&1&&(a(0,"span"),b(1,"img",38),s()),o&2){let e=d().$implicit;l(),p("src",e.ImageUrl,at)}}function sa(o,t){if(o&1&&(a(0,"span"),m(1),y(2,"limitTo"),s()),o&2){let e=d().$implicit;l(),O(" ",K(2,1,e.Name,20)," ")}}function la(o,t){if(o&1){let e=x();a(0,"div",35)(1,"button",36),S("click",function(){let n=C(e).$implicit,r=d(4);return v(r.handlingSubmitOrderWithEcr(n))}),h(2,aa,2,1,"span",1)(3,sa,3,4,"span",1),s()()}if(o&2){let e=t.$implicit;l(2),p("ngIf",e.ImageUrl!=null),l(),p("ngIf",e.ImageUrl==null)}}function ca(o,t){if(o&1&&(a(0,"div",39)(1,"div",20),b(2,"i",40),m(3," ECR / EDC "),s(),a(4,"div",22)(5,"div",25),h(6,la,4,2,"div",34),s()()()),o&2){let e=d(3);l(6),p("ngForOf",e.getTypePaymentList(99))}}function ma(o,t){if(o&1&&(a(0,"div",20),b(1,"i"),m(2),s()),o&2){let e=d().$implicit;l(),Ki(e.Icon),l(),O(" ",e.Name," ")}}function pa(o,t){if(o&1){let e=x();a(0,"div",35)(1,"a",45),S("click",function(){let n=C(e).$implicit,r=d(5);return v(r.onPaymentMethodChanged(n))}),m(2),y(3,"limitTo"),s()()}if(o&2){let e=t.$implicit,i=d(5);l(),p("ngClass",i.Payments[0].MethodID===e.ID?"active":""),l(),O(" ",K(3,2,e.Name,20)," ")}}function da(o,t){o&1&&(a(0,"small",50),m(1," Payment Note is required "),s())}function ua(o,t){o&1&&(a(0,"small",50),m(1," Payment Code is required "),s())}function ga(o,t){o&1&&(a(0,"small",50),m(1," Please input maximum 1 characters "),s())}function fa(o,t){if(o&1&&h(0,ua,2,0,"small",50)(1,ga,2,0,"small",50),o&2){let e=d(6);E(e.paymentCodeCtrl.hasError("required")?0:-1),l(),E(e.paymentCodeCtrl.hasError("maxlength")?1:-1)}}function ha(o,t){if(o&1&&(a(0,"div",46)(1,"div",47)(2,"div",48),b(3,"input",49),h(4,da,2,0,"small",50),s(),a(5,"div",48),b(6,"input",51),h(7,fa,2,2),s()()()),o&2){let e=d(5);l(3),p("formControl",e.paymentNoteCtrl),l(),E(e.paymentNoteCtrl.invalid&&(e.paymentNoteCtrl.dirty||e.paymentNoteCtrl.touched)?4:-1),l(2),p("formControl",e.paymentCodeCtrl),l(),E(e.paymentCodeCtrl.dirty||e.paymentCodeCtrl.touched?7:-1)}}function Ca(o,t){if(o&1&&(a(0,"div",22)(1,"div",25),h(2,pa,4,5,"div",34),s(),h(3,ha,8,4,"div",44),s()),o&2){let e=d().$implicit,i=d(3);l(2),p("ngForOf",i.getTypePaymentList(e.ID)),l(),p("ngIf",i.isOtherPayment(e.ID))}}function va(o,t){if(o&1&&(a(0,"div",41),h(1,ma,3,3,"div",42)(2,Ca,4,2,"div",43),s()),o&2){let e=t.$implicit,i=d(3);p("ngClass",R(3,Wr,i.getTypePaymentList(e.ID).length>0)),l(),p("ngIf",i.getTypePaymentList(e.ID).length>0),l(),p("ngIf",i.getTypePaymentList(e.ID).length>0)}}function _a(o,t){if(o&1&&(a(0,"div"),h(1,na,12,4,"ng-container",1)(2,ra,7,1,"div",16)(3,ca,7,1,"div",17)(4,va,3,5,"div",18),s()),o&2){let e=d(2);l(),p("ngIf",(e.modalFields==null||e.modalFields.paymentSuggestion==null?null:e.modalFields.paymentSuggestion.length)>0),l(),p("ngIf",e.getTypePaymentList(3).length>0&&e.isOnline),l(),p("ngIf",e.getTypePaymentList(99).length>0&&e.isOnline),l(),p("ngForOf",e.paymentTypes)}}function ya(o,t){if(o&1){let e=x();a(0,"div")(1,"div",52)(2,"strong",53),m(3,"Due"),s(),a(4,"datepicker",54),B("dateChange",function(n){C(e);let r=d(2);return H(r.modalFields.payLaterDueDate,n)||(r.modalFields.payLaterDueDate=n),v(n)}),S("dateChange",function(){C(e);let n=d(2);return v(n.dueDateChange())}),s()(),a(5,"div",55)(6,"strong",56),m(7,"Days Due"),s(),a(8,"input",57),B("ngModelChange",function(n){C(e);let r=d(2);return H(r.modalFields.payLaterDueDays,n)||(r.modalFields.payLaterDueDays=n),v(n)}),S("ngModelChange",function(){C(e);let n=d(2);return v(n.dueDayChange())}),s()()()}if(o&2){let e=d(2);l(4),F("date",e.modalFields.payLaterDueDate),p("displayToggle",!1),l(4),p("simpleKeyboard",e.keyboard),F("ngModel",e.modalFields.payLaterDueDays)}}function ba(o,t){if(o&1){let e=x();G(0),a(1,"div",25)(2,"div",59)(3,"div",60)(4,"strong",61),m(5,"Payment 1:"),s()(),a(6,"div")(7,"ng-select",62),S("change",function(n){C(e);let r=d(3);return v(r.onPaymentMethodChanged(n))}),s()()(),a(8,"div",63)(9,"div",60)(10,"strong",64),m(11,"Amount 1:"),s()(),a(12,"div")(13,"input",65),S("ngModelChange",function(n){C(e);let r=d(3);return v(r.onFirstPaymentSplitChange(n))}),s()()()(),W()}if(o&2){let e=d(3);l(7),p("items",e.firstPaymentSplitOptions)("ngModel",e.firstPayment==null?null:e.firstPayment.MethodID)("clearable",!1),l(6),p("ngModel",e.firstPayment.PaidAmount)}}function Sa(o,t){o&1&&(a(0,"small",50),m(1," Payment Note is required "),s())}function Pa(o,t){o&1&&(a(0,"small",50),m(1," Payment Code is required "),s())}function Oa(o,t){o&1&&(a(0,"small",50),m(1," Please input maximum 1 characters "),s())}function Da(o,t){if(o&1&&h(0,Pa,2,0,"small",50)(1,Oa,2,0,"small",50),o&2){let e=d(5);E(e.paymentCodeCtrl2.hasError("required")?0:-1),l(),E(e.paymentCodeCtrl2.hasError("maxlength")?1:-1)}}function Ma(o,t){if(o&1&&(a(0,"div",72)(1,"div",47)(2,"div",48),b(3,"input",49),h(4,Sa,2,0,"small",50),s(),a(5,"div",48),b(6,"input",51),h(7,Da,2,2),s()()()),o&2){let e=d(4);l(3),p("formControl",e.paymentNoteCtrl2),l(),E(e.paymentNoteCtrl2.invalid&&(e.paymentNoteCtrl2.dirty||e.paymentNoteCtrl2.touched)?4:-1),l(2),p("formControl",e.paymentCodeCtrl2),l(),E(e.paymentCodeCtrl2.dirty||e.paymentCodeCtrl2.touched?7:-1)}}function xa(o,t){if(o&1){let e=x();G(0),a(1,"div",66)(2,"div",67)(3,"div",68)(4,"div",60)(5,"strong",61),m(6,"Payment 2:"),s()(),a(7,"div")(8,"ng-select",69),S("change",function(n){C(e);let r=d(3);return v(r.onSplitPaymentMethodAssigned(n))}),s()()(),a(9,"div",70)(10,"strong",64),m(11,"Amount 2:"),s(),a(12,"span",71),m(13),y(14,"number"),s()()()(),h(15,Ma,8,4,"div",72),W()}if(o&2){let e=d(3);l(8),p("items",e.splitPaymentMethodList)("ngModel",e.Payments[1]==null?null:e.Payments[1].MethodID),l(5),P(T(14,4,e.paymentSplitDefaultVal)),l(2),E((e.Payments[1]==null?null:e.Payments[1].TypeID)!==e.paymentType.ECR&&(e.Payments[1]==null?null:e.Payments[1].TypeID)!==e.paymentType.emoney&&(e.Payments[1]==null?null:e.Payments[1].TypeID)!==e.paymentType.cash&&e.Payments[1]?15:-1)}}function Ia(o,t){if(o&1&&(a(0,"div",58),h(1,ba,14,4,"ng-container",1)(2,xa,16,6,"ng-container",1),s()),o&2){let e=d(2);l(),p("ngIf",(e.modalFields==null||e.modalFields.paymentSuggestion==null?null:e.modalFields.paymentSuggestion.length)==0),l(),p("ngIf",e.cashPaymentChange<0)}}function Ta(o,t){if(o&1&&(a(0,"div",6),h(1,ea,2,1,"div",7)(2,_a,5,4,"div",1)(3,ya,9,4,"div",1)(4,Ia,3,2,"div",8),s()),o&2){let e=d();l(),p("ngIf",e.modalFields.payLaterEnabled==!1),l(),p("ngIf",e.modalFields.isStateNow),l(),p("ngIf",e.modalFields.isStateLater&&!e.userRole.CreditSalesLock),l(),p("ngIf",e.modalFields.isStateSplit)}}function wa(o,t){if(o&1&&(G(0),a(1,"div",84),b(2,"img",85),s(),W()),o&2){let e=d(2);l(),p("ngStyle",R(1,Jr,e.modalFields.merchantName?"0px":"-25px"))}}function Ea(o,t){if(o&1&&(a(0,"h2",86),m(1),s()),o&2){let e=d(2);l(),O(" ",e.modalFields.merchantName," ")}}function Ra(o,t){if(o&1&&(a(0,"div",73)(1,"div",74)(2,"span",75),m(3),s(),a(4,"div",76)(5,"div",77)(6,"span",78),m(7,"Invoice"),s(),a(8,"span"),m(9,":"),s()(),a(10,"div",79)(11,"span",80),m(12),s()()(),a(13,"div",76)(14,"div",77)(15,"span"),m(16,"Amount"),s(),a(17,"span"),m(18,":"),s()(),a(19,"div",79)(20,"span",80),m(21),y(22,"number"),s()()()(),h(23,wa,3,3,"ng-container",1)(24,Ea,2,1,"h2",81),a(25,"div",82),b(26,"img",83),s()()),o&2){let e=d();l(2),p("ngClass",R(11,qr,(e.selectedPaymentMethod==null?null:e.selectedPaymentMethod.EMoneyTypeID)!=(e.modalFields==null?null:e.modalFields.emoneyType.Gopay))),l(),P(e.modalFields==null?null:e.modalFields.merchantName),l(9),P(e.posData==null||e.posData.Order==null?null:e.posData.Order.Number),l(9),zt("",e.cashierCalculatorService.currencySymbol," ",T(22,9,e.cashierCalculatorService.Data),""),l(2),p("ngIf",(e.selectedPaymentMethod==null?null:e.selectedPaymentMethod.EMoneyTypeID)==(e.modalFields==null?null:e.modalFields.emoneyType.Gopay)),l(),p("ngIf",e.modalFields.merchantName&&(e.selectedPaymentMethod==null?null:e.selectedPaymentMethod.EMoneyTypeID)==(e.modalFields==null?null:e.modalFields.emoneyType.Gopay)),l(2),p("src",e.qrImage,at)("ngClass",R(13,$r,(e.selectedPaymentMethod==null?null:e.selectedPaymentMethod.EMoneyTypeID)==(e.modalFields==null?null:e.modalFields.emoneyType.Gopay)))}}function Na(o,t){o&1&&(G(0),b(1,"app-confirm-demo-qris"),W())}function Aa(o,t){if(o&1&&(G(0),b(1,"app-modal-ecr-info",87),W()),o&2){let e=d();l(),p("isCancel",e.modalFields.isCancelEcrTransaction)}}function ka(o,t){if(o&1){let e=x();a(0,"a",88),S("click",function(){C(e);let n=d();return v(n.onPrintQR())}),b(1,"i",89),m(2,"Print QR "),s()}}function Va(o,t){if(o&1){let e=x();a(0,"a",88),S("click",function(){C(e);let n=d();return v(n.validateEMoneyPayment())}),m(1," Verify Payment Settlement "),s()}}function Fa(o,t){if(o&1){let e=x();a(0,"a",88),S("click",function(){C(e);let n=d();return v(n.onCancelWaitingEcr())}),m(1),s()}if(o&2){let e=d();l(),O(" ",e.modalFields.isCancelEcrTransaction?"Close":"Cancel"," ")}}function Ha(o,t){if(o&1){let e=x();a(0,"a",88),S("click",function(){C(e);let n=d();return v(n.onBack())}),m(1," Back "),s()}}function Ba(o,t){if(o&1){let e=x();a(0,"a",88),S("click",function(){C(e);let n=d();return v(n.onContinueDemoQr())}),m(1," Continue "),s()}}var Ri=class o{constructor(t,e,i,n,r,c,g,D,I,k,Qe,Hi,qi,Bi,Li,$i,ms,ps){this.dialogRef=t;this._orderDataService=e;this.cashierCalculatorService=i;this._paymentService=n;this._posHubService=r;this._posService=c;this._toastr=g;this._paymentGatewayService=D;this.decimalPipe=I;this.sanitizer=k;this._orderProcessorService=Qe;this._numpadService=Hi;this._userRoleService=qi;this._customerHttpService=Bi;this._onlineStatusService=Li;this._ecrService=$i;this.outletService=ms;this.ecrSignalService=ps;this.paymentSplitDefaultVal=0,this.defaultCashPaymentMethodID=0,this.destroy$=new be,this.AppConfigJSON=this._posService.Data.AppConfigJSON,this.modalFields.mapAppConfigJson(this.AppConfigJSON),this.initializeDefaultValues(),this.subscribeToObservableChanges()}modalFields=new xi;userRole;posData=new ne;AppConfigJSON=new Ke;keyboard;paymentType=kt;Payments=[];defaultCashPaymentMethodID;inputAmountString=null;qrImage;paymentMethodList;paymentTypes;paymentSplitDefaultVal;posState;splitPaymentMethodList;isOnline=!0;get firstPayment(){return this.Payments[0]}set firstPayment(t){this.Payments[0]=t}selectedPaymentMethod;get cashPaymentChange(){let t=this.cashierCalculatorService.Data;return(this.firstPayment?this.firstPayment.PaidAmount:0)-t}firstPaymentSplitOptions;destroy$;paymentNoteCtrl;paymentCodeCtrl;paymentNoteCtrl2;paymentCodeCtrl2;subscribeToObservableChanges(){this._orderDataService.Data$.pipe(ce(this.destroy$)).subscribe(t=>{this.posData=t}),this._orderProcessorService.Data$.pipe(ce(this.destroy$)).subscribe(t=>{this.posState=t.posState,this.initializeInvoicePaymentsValue(this.posState),this.initTabState()}),this._onlineStatusService.getOnlineStatus$().pipe(ce(this.destroy$)).subscribe(t=>{this.isOnline=t})}initTabState(){if(this.posState==2)switch(this.posData.Invoice.PaymentStateID){case 3:this.modalFields.viewState=0;break;case 1:this.modalFields.viewState=1;break}}initializeInvoicePaymentsValue(t){t!==2?(this.firstPayment=new Je,this.firstPayment.Amount=this.cashierCalculatorService.Data,this.firstPayment.PaidAmount=this.cashierCalculatorService.Data,this.firstPayment.MethodID=this.defaultCashPaymentMethodID,this.firstPayment.TypeID=1):(this.Payments=this.posData.Payments,this.initFirstPayment()),this.initPaymentNoteAndCode(this.firstPayment)}initFirstPayment(){if(!this.firstPayment)this.firstPayment=new Je,this.firstPayment.Amount=this.cashierCalculatorService.Data,this.firstPayment.PaidAmount=this.cashierCalculatorService.Data,this.firstPayment.MethodID=this.defaultCashPaymentMethodID,this.modalFields.viewState=1;else if(this.posData.Invoice.PaymentStateID==3)if(this.Payments.length>1)this.initSplitPayment(),this.initPaymentNoteAndCodeSplit(this.Payments[1]);else{let e=this.findPaymentMethodByID(this.firstPayment.MethodID);this.firstPayment.PaidAmount=this.cashierCalculatorService.Data,this.firstPayment.Amount=this.cashierCalculatorService.Data,this.firstPayment.MethodID=this.Payments[0].MethodID,this.firstPayment.TypeID=e?.TypeID}let t=this.firstPayment.PaidAmount;this.inputAmountString=t?t.toString():null}findPaymentMethodByID(t){return this._paymentService.getPaymentList()?.find(n=>n.ID==t)}initPaymentNoteAndCode(t){let e=this.getPaymentNoteAndCodeValidators(t);this.paymentCodeCtrl?(this.paymentCodeCtrl.setValue(t?.Code),this.paymentNoteCtrl.setValue(t?.Note),this.paymentCodeCtrl.setValidators(e.paymentCodeValidators),this.paymentNoteCtrl.setValidators(e.paymentNoteValidators),this.paymentCodeCtrl.updateValueAndValidity(),this.paymentNoteCtrl.updateValueAndValidity()):(this.paymentCodeCtrl=new Ue(t?.Code,e.paymentCodeValidators),this.paymentNoteCtrl=new Ue(t?.Note,e.paymentNoteValidators))}getPaymentNoteAndCodeValidators(t){let e=this.AppConfigJSON?.ModuleSell?.PaymentDialog,i=this.userRole.PaymentCodeLock,n=[],r=[];if(t&&t?.TypeID!=1&&t?.TypeID!=99&&t?.TypeID!=3){let c=i?[Zt.maxLength(1)]:[],g=e.PaymentCodeRequired?[Zt.required]:[];n=[...c,...g],r=e.PaymentNoteRequired?[Zt.required]:[]}return{paymentCodeValidators:n,paymentNoteValidators:r}}initSplitPayment(){let t=this.cashierCalculatorService.Data,e=this.Payments[1].PaidAmount,i=t-e;this.firstPayment.PaidAmount=i,this.firstPayment.Amount=i,this.paymentSplitDefaultVal=e,this.filterSplitPaymentList()}initializeDefaultValues(){this.modalFields.paymentSuggestion=this._paymentService.generateCashSuggestion(),this.paymentMethodList=this.outletService.Data.Payments,this.paymentTypes=this._posService.Data.PaymentTypes,this.defaultCashPaymentMethodID=this._paymentService.defaultCashPaymentMethodID,this._userRoleService.Data$.pipe(ce(this.destroy$)).subscribe(t=>{this.userRole=t,this.initPaylaterTab()}),this.initFirstPaymentSplitOptions()}initPaylaterTab(){this.userRole.CreditSalesLock&&(this.modalFields.viewState=0)}ngOnInit(){this.modalFields.numpadVisible&&(this.keyboard=this._numpadService.keyboard),this.initDefaultDueDays()}initDefaultDueDays(){let t=this._customerHttpService.Data,e=t?t.DueDays:null,i=t?t.DueMonths:null,n=new Date;n.setHours(0,0,0,0);let r=new Date;r.setHours(0,0,0,0),f.IsNotEmpty(this.posData.Invoice.Due)?n=new Date(this.posData.Invoice.Due):(i&&n.setMonth(n.getMonth()+i),!e&&!i&&(e=this.modalFields.config.DefaultDueDays),n.setDate(n.getDate()+e)),this.modalFields.payLaterDueDate=n,this.modalFields.payLaterDueDays=f.differentInDays(r,n),this.posData.Invoice.Due=this.modalFields.payLaterDueDate}onBack(){this.modalFields.viewState=0,this.changeModalForEmoney(!1),this.modalFields.enableEmoneyConfirmModal(!1),this.setToCashPayment(),this._paymentGatewayService.clearTransactionID()}onCancelWaitingEcr(){this.modalFields.isCancelEcrTransaction?(this.modalFields.viewState=0,this.modalFields.enableModalWaitingEcr(!1),this.setToCashPayment()):this.modalFields.cancelEcrTransaction()}onOk(){this.validateSerialItem()&&this.onSubmitOrder()}onSubmitOrder(){if(this.posData.Action.Type=3,this.posData.Order.InvoicedStateID=3,this.isPaymentLater())this.validatePaymentLater(this.userRole)&&(this.Payments=this.modalFields.viewState==1?[]:this.Payments,this._paymentService.submitOrder(this.Payments),this.close());else if(this.posData.Invoice.Due=null,this.validatePay()){if(this.validatePaymentSplit(),this.isCustomerLimitDebt())return;this.setPaymentNoteAndCode(this.firstPayment,this.paymentNoteCtrl.value,this.paymentCodeCtrl.value),this._paymentService.submitOrder(this.Payments),this.close()}}setPaymentNoteAndCode(t,e,i){t&&t.TypeID!=1&&t.TypeID!=99&&t.TypeID!=3&&(t.Code=i,t.Note=e)}isPaymentLater(){let t=this.modalFields.viewState==1,e=this.cashPaymentChange<0&&this.Payments.length==1;return t||e}handlingSubmitOrderWithEcr(t){if(this.ecrSignalService.isConnected()==!1){this._toastr.error("ECR is not connected","Error");return}this.onPaymentMethodChanged(t),this.posData.Invoice.Due=null;let e=this.firstPayment.PaidAmount;this.modalFields.viewState=5,this.modalFields.enableModalWaitingEcr(!0),this._ecrService.onPay(e).pipe(ce(this.destroy$)).subscribe({next:i=>{i.IsSuccess?(this.firstPayment.Code=i.Trace_No,this.firstPayment.Note=`${i.CardType} ${i.CardNumer}`,this._paymentService.submitOrder(this.Payments),this.close()):this.handlingEcrOnError()},error:i=>{this.handlingEcrOnError(),console.error(i)}})}handlingEcrOnError(){this._toastr.error("Transaction Canceled. Try Again","Error"),this.modalFields.viewState=0,this.modalFields.enableModalWaitingEcr(!1),this.setToCashPayment()}isCustomerLimitDebt(){if(this.paymentSplitDefaultVal>0&&this.Payments.length==1){let t=this._customerHttpService.Data;if(t.DebtLimit>0){let e=t.Debt==0&&this.paymentSplitDefaultVal>t.DebtLimit,i=t.Debt+this.paymentSplitDefaultVal>t.DebtLimit;if(e||i)return this._toastr.warning(U.debtLimit,"Warning!"),!0}}return!1}validateSerialItem(){let t=this.findItemWithoutSerial();return t.length>0?f.IsEmpty(this.posData.Action.DeliveryEntityID)?!0:(this._toastr.warning(`Serial can not Empty in ${t[0]?.Variant?.Name}`,"Warning"),!1):!0}findItemWithoutSerial(){let t;return this.posData.CartItems.filter(i=>(t=!1,i.Variant&&i.Variant.TypeID===4&&(t=i?.Serial?i?.Serial?.length===0:!0),t))}validatePaymentLater(t){if(this.IsCreditSales()&&t.CreditSalesLock)return alert(U.creditLock),!1;let e=f.IsEmpty(this.posData.Order.CustomerID);return this.modalFields.viewState==1&&e?(alert(U.emptyCustomerCredit),!1):this.IsCreditSales()&&e?(alert(U.emptyCustomerCredit),!1):!!this.debtLimitValidation()}debtLimitValidation(){let t=this._customerHttpService.Data,e=!1,i=t.Debt==0&&this.cashierCalculatorService.Data>t.DebtLimit;return this.posData.Invoice.PaymentStateID==1?this.posData.Invoice.Sales==this.cashierCalculatorService.Data?e=!1:e=this.cashierCalculatorService.Data>t.DebtLimit:e=t.Debt+this.cashierCalculatorService.Data>t.DebtLimit,t.DebtLimit!==0&&(i||e)?(this._toastr.warning(U.debtLimit,"Warning!"),!1):!0}validatePaymentSplit(){let t=this.firstPayment.PaidAmount,e=this.Payments[1]?this.Payments[1].PaidAmount:0,i=this.cashierCalculatorService.Data,n=[];t+this.modalFields.toleranceAmount>=i?(n=this.Payments.slice(0,1),this.modalFields.toleranceAmount!==0&&t<i&&(this.firstPayment.Amount=i),this.Payments=n):(e+t===i?n=this.Payments.slice(0,2):n=this.Payments,this.setPaymentNoteAndCode(this.Payments[1],this.paymentNoteCtrl2.value,this.paymentCodeCtrl2.value)),this.Payments=n}validatePay(){let t=this.firstPayment.Amount+(this.Payments[1]?this.Payments[1].Amount:0);if(this.AppConfigJSON.ModuleSell.PaymentDialog.MinusPaymentAllowed==!1&&t<0)return this._toastr.warning("You are not allowed to process this transaction because the total amount is less than zero","Warning!"),!1;if(this.modalFields.payNowEnabled&&this.paymentSplitDefaultVal>0&&this.firstPayment.Amount==0)return this._toastr.warning(U.payNowOnly,te.Warning),!1;if(this.IsDepositPayment()&&this.userRole.CreditSalesLock)return this._toastr.warning(U.creditLock,te.Warning),!1;if(!this.AppConfigJSON.ApplicationLoyalty.Rules.MixCashAndPoint&&this.posData.Order.PointUsed>0&&this.cashierCalculatorService.Data>0)return this._toastr.info(U.partialLoyaltyPointUnable,te.Info),!1;let e=this.posData.Order.PointUsed*this.AppConfigJSON.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue;if(this.cashierCalculatorService.GetPointOnlyAmount()>0&&this.cashierCalculatorService.GetPointOnlyAmount()>e){let n=f.StringFormat(U.pointOnly,this.decimalPipe.transform(this.posData.PointOnlyAmount));return this._toastr.info(n,te.Info),!1}let i=this.cashierCalculatorService.Data+this.posData.Order.DiscountAmount-e;if(this.cashierCalculatorService.GetCashOnlyAmount()>0&&this.cashierCalculatorService.GetCashOnlyAmount()>i&&Math.abs(this.cashierCalculatorService.GetCashOnlyAmount()-i)>this.modalFields.toleranceAmount){let n=f.StringFormat(U.cashOnly,this.decimalPipe.transform(this.posData.CashOnlyAmount));return this._toastr.info(n,te.Info),!1}return this.IsDepositPayment()&&f.IsEmpty(this.posData.Order.CustomerID)?(alert(U.emptyCustomerDeposit),!1):this.posData.PrepaidPackageItem.length>0&&f.IsEmpty(this.posData.Order.CustomerID)?(this._toastr.info("Products with prepaid package type must use the customer",te.Info),!1):!(this.validatePaymentNoteAndCode(this.firstPayment,this.paymentCodeCtrl,this.paymentNoteCtrl)==!1||this.Payments[1]&&this.validatePaymentNoteAndCode(this.Payments[1],this.paymentCodeCtrl2,this.paymentNoteCtrl2)==!1)}validatePaymentNoteAndCode(t,e,i){if(t?.TypeID!=1&&t?.TypeID!=99&&t?.TypeID!=3){if(e.markAsDirty(),i.markAsDirty(),e.hasError("required"))return this._toastr.warning("Payment Code is required","Warning"),!1;if(i.hasError("required"))return this._toastr.warning("Payment Note is required","Warning"),!1;if(e.hasError("maxlength"))return this._toastr.warning("Payment Code must be 1 character","Warning"),!1}else return!0}onNowClick(){this.modalFields.viewState=0}onLaterClick(){this.modalFields.viewState=1}onSplitClick(){this.modalFields.viewState=3,this.initPaymentNoteAndCodeSplit(this.Payments[1])}IsCreditSales(){return this.modalFields.viewState!=1||this.IsDepositPayment()}IsDepositPayment(){let t=!1,e=this.Payments.map(c=>c.PaidAmount).reduce((c,g)=>c+g),i=this.cashierCalculatorService.Data;return this.modalFields.toleranceAmount+e<i&&(t=!0),t}close(){this.initializeDefaultValues(),this.dialogRef.close()}updateCashPayment(t){let e=this.cashierCalculatorService.Data;this.paymentSplitDefaultVal=0,this.firstPayment.MethodID=this.defaultCashPaymentMethodID,this.firstPayment.Amount=e,this.firstPayment.PaidAmount=t,this.firstPayment.TypeID=1,this.posData.Invoice.SurchargePcg!==0&&this.updateSurcharge(0),this.calculateSplitPayment(t)}calculateSplitPayment(t){let e=this.cashierCalculatorService.Data;t<e?(this.firstPayment.Amount=t,this.paymentSplitDefaultVal=e-t,this.filterSplitPaymentList(),this.changePaymentSplitValue()):(this.paymentSplitDefaultVal=0,this.changePaymentSplitValue())}changePaymentSplitValue(){this.Payments[1]&&(this.Payments[1].Amount=this.paymentSplitDefaultVal,this.Payments[1].PaidAmount=this.paymentSplitDefaultVal)}onPaymentMethodChanged(t){this.selectedPaymentMethod=t,this.updateSurcharge(t.ExtraCharge);let e=this.cashierCalculatorService.Data;this.firstPayment.Amount=e,this.firstPayment.PaidAmount=e,this.firstPayment.MethodID=t.ID,this.firstPayment.TypeID=t.TypeID,t.ExtraCharge>0&&this.paymentSplitDefaultVal>0?this._toastr.warning("Cannot apply Split Payment for Payment Method with Surcharge","Warning"):this.paymentSplitDefaultVal>0&&(this.firstPayment.Amount=e-this.paymentSplitDefaultVal,this.firstPayment.PaidAmount=e-this.paymentSplitDefaultVal),this.initPaymentNoteAndCode(this.firstPayment),this.filterSplitPaymentList()}filterSplitPaymentList(){this.modalFields.uniquePaymentMethodOnSplit?this.splitPaymentMethodList=this.paymentMethodList.filter(t=>t.ID!==this.firstPayment.MethodID):this.splitPaymentMethodList=this.paymentMethodList}updateSurcharge(t){this.posData.Invoice.SurchargePcg=t,this.posData.Invoice.TempSurchargePcg=t,this._orderDataService.pushNewValue(this.posData)}onSplitPaymentMethodAssigned(t){t?(this.Payments[1]=this.Payments[1]?this.Payments[1]:new Je,this.Payments[1].MethodID=t.ID,this.Payments[1].MethodName=t.Name,this.Payments[1].Amount=this.paymentSplitDefaultVal,this.Payments[1].PaidAmount=this.paymentSplitDefaultVal,this.Payments[1].TypeID=t.TypeID):(this.Payments[1].Amount=0,this.Payments[1].PaidAmount=0),this.initPaymentNoteAndCodeSplit(this.Payments[1])}initPaymentNoteAndCodeSplit(t){let e=this.getPaymentNoteAndCodeValidators(t);this.paymentCodeCtrl2?(this.paymentCodeCtrl2.setValidators(e.paymentCodeValidators),this.paymentNoteCtrl2.setValidators(e.paymentNoteValidators),this.paymentCodeCtrl2.updateValueAndValidity(),this.paymentNoteCtrl2.updateValueAndValidity()):(this.paymentCodeCtrl2=new Ue(t?.Code,e.paymentCodeValidators),this.paymentNoteCtrl2=new Ue(t?.Note,e.paymentNoteValidators))}onFirstPaymentSplitChange(t){let e=this.cashierCalculatorService.Data;this.firstPayment.Amount=e,this.firstPayment.PaidAmount=t,this.calculateSplitPayment(t)}initFirstPaymentSplitOptions(){this.firstPaymentSplitOptions=[...this.getTypePaymentList(2),...this.getTypePaymentList(4)]}isCardPayment(){return this.getTypePaymentList(2).findIndex(e=>e.ID==this.firstPayment.MethodID)>=0}isOtherPayment(t){return this.getTypePaymentList(t).findIndex(e=>e.ID==this.firstPayment.MethodID)>=0}getTypePaymentList(t){return this._paymentService.getPaymentList().filter(i=>i.TypeID==t)}payWithEmoney(t){let e=this.generateQrisRequest();this._paymentGatewayService.generateQR(e,t).pipe(ce(this.destroy$)).subscribe({next:i=>{this.qrImage=i.Url,i.IsDemoKey?this.showModalConfirmDemoQris():this.showModalQRIS()},error:i=>{this.setToCashPayment(),this.onErrorGenerateQR(i)}})}generateQrisRequest(){let t=new Mi;return t.InvoiceNumber=this.posData.Order.Number,t.Amount=this.cashierCalculatorService.Data,t.RegisterID=this.posData.Order.RegisterID,t}setToCashPayment(){this.firstPayment.MethodID=this.defaultCashPaymentMethodID,this.firstPayment.TypeID=1}showModalConfirmDemoQris(){this.modalFields.viewState=4,this.modalFields.enableEmoneyConfirmModal(!0)}onContinueDemoQr(){this.modalFields.enableEmoneyConfirmModal(!1),this.modalFields.viewState=2,this.changeModalForEmoney(!0)}showModalQRIS(){this.modalFields.viewState=2,this.changeModalForEmoney(!0)}onErrorGenerateQR(t){t.status==400?this.validateEMoneyPayment():this._toastr.error(U.failGenerateQR,te.Error)}validateEMoneyPayment(){this._paymentGatewayService.validateEMoneyPayment(this.AppConfigJSON).pipe(ce(this.destroy$)).subscribe({next:t=>{this.dialogRef.close();let i=`IDR ${this.decimalPipe.transform(t.Final)} received. Please verify in customer mobile app!`;this._toastr.success(i," QR Settlement"),this._orderProcessorService.updatePosState(1,t)}})}changeModalForEmoney(t){this.modalFields.enableEMoneyModal(t),t||this._posHubService.BroadcastQRToCustomerDisplay("").subscribe()}dueDateChange(){let t=new Date(this.posData.Order.Date),e=this.modalFields.payLaterDueDate?this.modalFields.payLaterDueDate:new Date;t.setHours(0,0,0,0),this.modalFields.payLaterDueDays=f.differentInDays(t,e),this.posData.Invoice.Due=e}dueDayChange(){let t=new Date(this.posData.Order.Date);t.setDate(t.getDate()+this.modalFields.payLaterDueDays),t.setHours(0,0,0,0),this.modalFields.payLaterDueDate=t,this.posData.Invoice.Due=t}sanitize(t){return this.sanitizer.bypassSecurityTrustUrl(t)}onPrintQR(){window.print()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||o)(_(q),_(N),_(Z),_(Ii),_(Ye),_(L),_(A),_(Ct),_(ee),_(on),_(je),_(Wn),_(Ne),_(we),_(ue),_(Ti),_(Y),_(Pt))};static \u0275cmp=V({type:o,selectors:[["POS-modal-payment"]],decls:13,vars:11,consts:[[3,"keydown.NumpedEnter","keydown.Enter","keydown.F2","onOk","onCancel","onClose","onBack","keydown.Escape","config"],[4,"ngIf"],["class","container w-100 h-100",4,"ngIf"],["class","text-center position-relative w-100",4,"ngIf"],["class","btn btn-light-blue text-primary btn-lg fw-bold me-5 py-8",3,"click",4,"ngIf"],[1,"ms-3","fs-4"],[1,"container","w-100","h-100"],["class","row border-bottom",4,"ngIf"],["style","margin-bottom: 80px;","class","py-5",4,"ngIf"],[1,"row","border-bottom"],["data-cy","tab-now",1,"btn","btn-link",3,"click","ngClass"],["class","btn btn-link","data-cy","tab-split",3,"ngClass","click",4,"ngIf"],["data-cy","tab-later","class","btn btn-link",3,"ngClass","click",4,"ngIf"],["data-cy","tab-split",1,"btn","btn-link",3,"click","ngClass"],[1,"fst-italic",2,"font-size","10px"],["data-cy","tab-later",1,"btn","btn-link",3,"click","ngClass"],["class","row py-5 border-bottom",4,"ngIf"],["class","row py-5",4,"ngIf"],["class","row",3,"ngClass",4,"ngFor","ngForOf"],[1,"row","py-5","border-bottom"],[1,"col-3","h5","pt-5"],[1,"fa-solid","fa-money-bill-wave"],[1,"col-9"],[1,"row","mb-5"],["class","col-4 pe-0 ps-4",4,"ngFor","ngForOf"],[1,"row"],[1,"col","pe-0","ps-4"],["id","cashInput","type","text","keyboardType","number","placeholder","Custom Cash Amount","data-cy","txt-amount","autoNum","",1,"form-control","form-control-lg","py-3",3,"ngModelChange","simpleKeyboard","ngModel"],["class","change",3,"ngClass",4,"ngIf"],[1,"col-4","pe-0","ps-4"],[1,"btn","btn-outline-info","px-1","py-6","w-100",3,"click","ngClass"],[1,"change",3,"ngClass"],[1,"fa-solid","fa-qrcode"],[1,"row","d-flex","align-items-center"],["class","col-auto pb-3 ps-4 pe-0",4,"ngFor","ngForOf"],[1,"col-auto","pb-3","ps-4","pe-0"],[1,"btn","btn-outline-info",3,"click"],[3,"hidden"],[1,"emoney-logo",3,"src"],[1,"row","py-5"],[1,"fa-credit-card","fas"],[1,"row",3,"ngClass"],["class","col-3 h5 pt-5",4,"ngIf"],["class","col-9",4,"ngIf"],["class","position-relative row",4,"ngIf"],[1,"btn","btn-outline-info",3,"click","ngClass"],[1,"position-relative","row"],[1,"paymentNote","col","row","g-0","pt-2","ms-4"],[1,"col-6"],["type","text","placeholder","Payment Note",1,"form-control","border-end-0","py-6",3,"formControl"],[1,"text-danger","d-inline"],["type","text","placeholder","Payment Code",1,"form-control","border-start-0","py-6","paymentCode",3,"formControl"],[1,"row","d-flex","align-items-center","g-0","later-payment","date-picker","mt-4"],[1,"col-3"],["appearance","fill","name","orderDate",1,"col-9",3,"dateChange","date","displayToggle"],[1,"row","d-flex","align-items-center","g-0","later-payment","mt-10"],["id","daysInput",1,"col-3"],["id","day","type","text","keyboardType","number","autoNum","",1,"col-9","form-control",2,"width","75%",3,"ngModelChange","simpleKeyboard","ngModel"],[1,"py-5",2,"margin-bottom","80px"],[1,"col-6","d-flex","align-items-center"],[1,"px-0"],[1,"me-2"],["bindLabel","Name","bindValue","ID","placeholder","Payment","appendTo","body","data-cy","Payment1",1,"ng-select-width","category-select",3,"change","items","ngModel","clearable"],[1,"col-6","col-6","d-flex","justify-content-start","align-items-center"],[1,"me-3"],["type","text","autoNum","",1,"form-control",3,"ngModelChange","ngModel"],[1,"row","mt-6"],[1,"col-12","d-flex","justify-content-start"],[1,"d-flex","align-items-center"],["bindLabel","Name","bindValue","ID","placeholder","Payment","appendTo","body","data-cy","Payment2",1,"ng-select-width","category-select",3,"change","items","ngModel"],[1,"d-flex","justify-content-start","align-items-center","ms-8"],[1,"fs-6"],[1,"position-relative","row","mt-6","px-2"],[1,"text-center","position-relative","w-100"],[1,"d-none","d-print-flex","flex-column","justify-content-center","title-pay","position-relative","mb-3"],[1,"fw-bold","fs-3",3,"ngClass"],[1,"row","d-flex","justify-content-center","me-5","fs-6"],[1,"col-3","text-end","pe-3","ms-13"],[1,"me-1"],[1,"col-6","text-start","ps-0"],[1,"fw-normal"],["class","position-relative d-print-none","style","top: 8px",4,"ngIf"],[1,"d-flex","justify-content-center","qris-container"],["alt","Gopay QR",1,"d-block","border-0",3,"src","ngClass"],[1,"position-relative",3,"ngStyle"],["src","https://res.cloudinary.com/pos/image/upload/w_270/v1693469906/POS/Images/Payment/gpn.png","alt",""],[1,"position-relative","d-print-none",2,"top","8px"],[3,"isCancel"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","me-5","py-8",3,"click"],[1,"fa-solid","fa-print","me-2"]],template:function(e,i){e&1&&(a(0,"modal-material",0),S("keydown.NumpedEnter",function(){return i.onOk()})("keydown.Enter",function(){return i.onOk()})("keydown.F2",function(){return i.onOk()})("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()})("onBack",function(){return i.onBack()})("keydown.Escape",function(){return i.close()}),h(1,Kr,5,4,"header",1),a(2,"content"),h(3,Ta,5,4,"div",2)(4,Ra,27,15,"div",3)(5,Na,2,0,"ng-container",1)(6,Aa,2,1,"ng-container",1),s(),a(7,"footer"),h(8,ka,3,0,"a",4)(9,Va,2,0,"a",4)(10,Fa,2,1,"a",4)(11,Ha,2,0,"a",4)(12,Ba,2,0,"a",4),s()()),e&2&&(p("config",i.modalFields.modalConfig),l(),p("ngIf",!i.modalFields.isQrisConfirm&&!i.modalFields.isCancelEcrTransaction),l(2),p("ngIf",!i.modalFields.isStateQR&&!i.modalFields.isQrisConfirm&&!i.modalFields.isWaitingPaymentEcr),l(),p("ngIf",i.modalFields.isStateQR),l(),p("ngIf",i.modalFields.isQrisConfirm),l(),p("ngIf",i.modalFields.isWaitingPaymentEcr),l(2),p("ngIf",i.modalFields.isStateQR),l(),p("ngIf",i.modalFields.isStateQR),l(),p("ngIf",i.modalFields.isWaitingPaymentEcr),l(),p("ngIf",i.modalFields.isQrisConfirm),l(),p("ngIf",i.modalFields.isQrisConfirm))},dependencies:[De,ae,se,en,me,pe,Me,mt,J,ti,pt,ri,qn,wi,Ei,ee,ni],styles:['.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}.margin-note[_ngcontent-%COMP%]{margin-left:-7px!important}.quickKeyTabs[_ngcontent-%COMP%]{margin-right:-15px;margin-left:-7px}.change[_ngcontent-%COMP%]{position:absolute;top:119px;height:40px;background:#89b03e;color:#fff;right:17px;padding:0 10px;line-height:40px;font-size:16px}.change[_ngcontent-%COMP%]:before{content:"\\a";border-style:solid;border-width:40px 24px 0 0;border-color:transparent #89b03e transparent transparent;position:absolute;left:-24px}.change.danger[_ngcontent-%COMP%]{background:#c9302c}.change.danger[_ngcontent-%COMP%]:before{border-color:transparent #c9302c transparent transparent}.paymentNote[_ngcontent-%COMP%]:before{z-index:10;content:"";position:absolute;top:4px;left:calc(50% - 10px);height:43px;width:10px;background-color:inherit;border-right:1px solid lightgray;-webkit-transform:skewX(-10deg);-moz-transform:skewX(-10deg);-ms-transform:skewX(-10deg);transform:skew(-10deg)}.height-input[_ngcontent-%COMP%]{height:37px}.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}.later-payment[_ngcontent-%COMP%] strong{font-size:20px}.later-payment[_ngcontent-%COMP%] input{font-size:20px;padding:20px 10px!important}.later-payment[_ngcontent-%COMP%] .mat-mdc-form-field{width:100%;font-size:20px;border:1px solid #c8d3df;padding-left:10px}.later-payment[_ngcontent-%COMP%] .mat-mdc-form-field .mat-mdc-icon-button, .later-payment[_ngcontent-%COMP%] .mat-mdc-form-field .mat-mdc-button-persistent-ripple, .later-payment[_ngcontent-%COMP%] .mat-mdc-form-field .mat-mdc-form-field-icon-suffix{outline:none!important} .later-payment.date-picker .mat-mdc-form-field{font-size:4px}.phone[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{height:50px;width:50px;padding-top:11px;background-color:#f5f5f5;border:1px solid gray!important}.phone[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{padding-left:65px!important;border:1px solid gray!important;font-size:25px;height:50px}.phone[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:focus{border-color:#8bb8df!important}.qris[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{font-size:.75rem}.ng-select.ng-select-width[_ngcontent-%COMP%] .ng-select-container{width:160px;max-width:160px}.qrDemo[_ngcontent-%COMP%]{position:relative;top:-10px}.qrDemo[_ngcontent-%COMP%] > p[_ngcontent-%COMP%]{margin-bottom:0}input[type=text][_ngcontent-%COMP%]:disabled{background:#e5e5e5} ng-dropdown-panel.category-select{z-index:1100}.row[_ngcontent-%COMP%] > div.tab-button[_ngcontent-%COMP%]{padding-left:0}.qris-barcode[_ngcontent-%COMP%]{height:300px;line-height:50px}@media print{.qris-barcode[_ngcontent-%COMP%]{height:200px;margin-bottom:20px}.title-pay[_ngcontent-%COMP%]{font-size:10px;font-weight:400;top:10px}.title-pay[_ngcontent-%COMP%] div.ms-13[_ngcontent-%COMP%]{margin-left:1.7rem}.qris-container[_ngcontent-%COMP%]{margin-bottom:20px}}.emoney-logo[_ngcontent-%COMP%]{max-width:180px;max-height:40px;height:30px}']})};var La=o=>({"bg-light":o});function ja(o,t){if(o&1){let e=x();G(0),a(1,"button",11),S("click",function(){C(e);let n=d(2).$implicit,r=d(2);return v(r.onApplyPromotion(n))}),m(2," APPLY "),s(),W()}if(o&2){let e=d(4);l(),p("disabled",e.selectedPromotion)}}function Qa(o,t){if(o&1){let e=x();G(0),a(1,"button",12),S("click",function(){C(e);let n=d(2).$implicit,r=d(2);return v(r.onRemovePromotion(n))}),m(2," REMOVE "),s(),W()}}function Ua(o,t){if(o&1&&(G(0),h(1,ja,3,1,"ng-container",10)(2,Qa,3,0,"ng-container",10),W()),o&2){let e=d().$implicit,i=d(2);l(),p("ngIf",(i.selectedPromotion==null?null:i.selectedPromotion.ID)!=e.ID),l(),p("ngIf",(i.selectedPromotion==null?null:i.selectedPromotion.ID)==e.ID)}}function Ga(o,t){o&1&&(a(0,"p",13),m(1,"Not Eligible"),s())}function Wa(o,t){if(o&1&&(a(0,"div",6)(1,"div",7)(2,"h5"),m(3),s(),a(4,"p",8),m(5),s()(),a(6,"div",9),h(7,Ua,3,2,"ng-container",4)(8,Ga,2,0,"ng-template",null,1,He),s()()),o&2){let e=t.$implicit,i=j(9);p("ngClass",R(5,La,!e.Eligible)),l(3),P(e.Name),l(2),P(e.Description),l(2),p("ngIf",e.Eligible)("ngIfElse",i)}}function qa(o,t){if(o&1&&(G(0),h(1,Wa,10,7,"div",5),y(2,"sortBy"),W()),o&2){let e=d();l(),p("ngForOf",st(2,1,e.promotions,"desc","Eligible"))}}function $a(o,t){o&1&&(a(0,"div",14)(1,"p",15)(2,"span"),m(3,"There is no active promotion right now"),s()()())}var Ni=class o{constructor(t,e,i,n){this._dialogRef=t;this._promotionEventService=e;this._outletRegisterService=i;this._salesOrderService=n;this.destroy$=new be}modalConfig=new $;promotions=[];destroy$;promotionType=Tt;selectedPromotion;ngOnInit(){this.subscribePromotionService(),this.initModalConfig()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}subscribePromotionService(){this._promotionEventService.Data$.pipe(ce(this.destroy$)).subscribe(t=>{this.promotions=t,this.checkValidSelectedPromotion()})}checkValidSelectedPromotion(){this.selectedPromotion=this._promotionEventService.selectedPromotion,this.selectedPromotion&&this.promotions.findIndex(e=>e.ID==this.selectedPromotion.ID&&e.Eligible)===-1&&(this.selectedPromotion=null,this._promotionEventService.selectedPromotion=null)}initModalConfig(){this.modalConfig.title="Promotions",this.modalConfig.customWidth="500px",this.modalConfig.bodyScrollable=!0,this.modalConfig.hideCancel=!0,this.modalConfig.okText='<i class="fas fa-rotate fs-6 me-1"></i>Refresh'}onApplyPromotion(t){this._promotionEventService.applyPromotion(t),t.TypeID!=4&&this.close()}onRemovePromotion(t){this._promotionEventService.removePromotion(),this.selectedPromotion=null}onRefreshPromotion(){let t=this._outletRegisterService.Data.RegisterID;this._promotionEventService.getPromotions(t).subscribe(e=>{this._promotionEventService.loadPromotions(e),this._salesOrderService.Data.CartItems=[],this._salesOrderService.pushNewValue()})}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||o)(_(q),_(fe),_(Y),_(N))};static \u0275cmp=V({type:o,selectors:[["POS-modal-promotion"]],decls:6,vars:3,consts:[["EMPTY",""],["notEligible",""],[3,"onCancel","onOk","onClose","config"],[1,"container"],[4,"ngIf","ngIfElse"],["class","row border mt-3 py-2 justify-content-between",3,"ngClass",4,"ngFor","ngForOf"],[1,"row","border","mt-3","py-2","justify-content-between",3,"ngClass"],[1,"col","mt-3"],[1,"description"],[1,"col-auto","my-auto"],[4,"ngIf"],[1,"btn","btn-success","my-auto",3,"click","disabled"],[1,"btn","btn-danger","my-auto",3,"click"],[1,"text-danger","my-auto"],[1,"d-flex","align-items-center","justify-content-center"],[1,"mb-0","fs-3","text-body-secondary"]],template:function(e,i){if(e&1){let n=x();a(0,"modal-material",2),S("onCancel",function(){return C(n),v(i.close())})("onOk",function(){return C(n),v(i.onRefreshPromotion())})("onClose",function(){return C(n),v(i.close())}),a(1,"content")(2,"div",3),h(3,qa,3,5,"ng-container",4)(4,$a,4,0,"ng-template",null,0,He),s()()()}if(e&2){let n=j(5);p("config",i.modalConfig),l(3),p("ngIf",i.promotions.length>0)("ngIfElse",n)}},dependencies:[De,ae,se,J,dt],styles:[".description[_ngcontent-%COMP%]{word-wrap:break-word}"]})};var Ja=["firstNameAutoFocus"],Ze=o=>({selected:o}),tt=o=>({"is-invalid":o}),za=o=>({"invalid-feedback":o});function Ka(o,t){if(o&1&&b(0,"option",62),o&2){let e=t.$implicit;p("value",e.Name)}}function Ya(o,t){if(o&1&&(a(0,"div",63),m(1," Name is mandatory "),s()),o&2){d();let e=j(26);p("ngClass",R(1,za,e.touched&&e.invalid))}}function Za(o,t){o&1&&(G(0),a(1,"div",43),m(2," Mobile Phone is mandatory "),s(),W())}function Xa(o,t){if(o&1&&(G(0),a(1,"div",43),m(2),s(),W()),o&2){d(2);let e=j(38);l(2),O(" ",e.errors==null||e.errors.minLength==null?null:e.errors.minLength.message," ")}}function es(o,t){if(o&1&&(G(0),h(1,Za,3,0,"ng-container",29)(2,Xa,3,1,"ng-container",29),W()),o&2){d();let e=j(38);l(),p("ngIf",e.getError("required")&&!e.getError("minLength")),l(),p("ngIf",e.getError("minLength"))}}function ts(o,t){o&1&&(a(0,"div",43),m(1," Email must be a valid email address "),s())}function is(o,t){o&1&&(a(0,"div",43),m(1," Email is mandatory "),s())}function ns(o,t){if(o&1&&h(0,ts,2,0,"div",64)(1,is,2,0,"div",43),o&2){d();let e=j(45);p("ngIf",e.errors==null?null:e.errors.email),l(),E(e.errors!=null&&e.errors.required?1:-1)}}function os(o,t){o&1&&(a(0,"div",43),m(1," Birthdate is mandatory "),s())}function rs(o,t){if(o&1&&h(0,os,2,0,"div",43),o&2){d();let e=j(52);E(e.errors!=null&&e.errors.required?0:-1)}}function as(o,t){if(o&1&&b(0,"i",65),o&2){let e=d();p("matTooltip",e.estimatedCodeMessage)}}function ss(o,t){o&1&&(a(0,"div",43),m(1," Customer code is mandatory. "),s())}function ls(o,t){o&1&&(a(0,"div",43),m(1," Address is mandatory. "),s())}function cs(o,t){if(o&1&&(G(0),a(1,"div",43),m(2),s(),W()),o&2){d();let e=j(89);l(2),O(" ",e.errors==null||e.errors.minLength==null?null:e.errors.minLength.message," ")}}var Ai=class o{constructor(t,e,i,n,r){this._dialogRef=t;this._posService=e;this._orderDataService=i;this._CustomerHttpService=n;this.data=r;this.initCustomer(),this.initRequiredConfig()}estimatedCodeMessage="Customer code below is just an estimation, it could change in the final result";fieldRequiredConfig={Mobile:!1,Email:!1,Birthdate:!1,Code:!1,Address:!1};firstNameRef;modalConfig=new $;customer;get options(){return this._posService.Data.CustomerOptions}get config(){return this._posService.Data.AppConfigJSON}customerData;tabState="general";guidEmpty=f.GuidEmpty;ngOnInit(){this.modalConfig.customWidth="650px",this.modalConfig.title="New Customer",this.modalConfig.bodyScrollable=!0,this.modalConfig.hideScrollbar=!0}initRequiredConfig(){console.log(this.config?.ModuleContact?.Advance.RequiredFields),this.config?.ModuleContact?.Advance.RequiredFields?.forEach(e=>{this.fieldRequiredConfig[e]===!1&&(this.fieldRequiredConfig[e]=!0)})}initCustomer(){let t=this._posService.Data.AppConfigJSON,e=t.ModuleContact?.DefaultContactGroup?.ContactGroup;this.customer=new $n,f.IsNotEmpty(this.data)&&(this.customer.FirstName=this.data.name),f.IsNotEmpty(e)&&(this.customer.Group=e),this.initCustomerCode(t?.ModuleContact?.CodeGenerator?.AutoGenerateEnabled),this.setEntityID()}initCustomerCode(t=!1){t?this._CustomerHttpService.getCustomerSuggestionCode().pipe(he()).subscribe(e=>{this.customer.Code=e}):this.estimatedCodeMessage=""}ngAfterViewInit(){this.setAutoFocus()}setEntityID(){let t=this._orderDataService.Data;this.customer.CreatorEntityID=t.Order.EntityID}setAutoFocus(){this.firstNameRef.nativeElement.focus()}onKeyUpFirstName(){this.customer.FirstName?this.modalConfig.validated=!0:this.modalConfig.validated=!1}chooiceDetail(t){this.tabState=t}onOk(t){if(t.form.markAllAsTouched(),t.form.invalid)return;let e=this._orderDataService.Data;this.customer.Name=this.getCustomerName(),this._CustomerHttpService.addCustomer(this.customer).then(i=>{e.ContactName=this.customer.Name,this._orderDataService.pushNewValue(e),this.getCustomerData(i.ID)})}getCustomerData(t){this._orderDataService.updateCustomerID(t).then(e=>{this.customerData=e,this.close("ok")}).catch(e=>{this.customerData=new ut,this.close("ok")})}getCustomerName(){let t="";return t+=" "+(this.customer.FirstName?this.customer.FirstName:""),t+=" "+(this.customer.LastName?this.customer.LastName:""),t=t.trim(),t}close(t){t==="ok"?this._dialogRef.close(this.customerData):this._dialogRef.close(null)}isNotEmpty(t){return f.IsNotEmpty(t)||t==0}static \u0275fac=function(e){return new(e||o)(_(q),_(L),_(N),_(we),_(de))};static \u0275cmp=V({type:o,selectors:[["POS-modal-customer"]],viewQuery:function(e,i){if(e&1&&qt(Ja,5),e&2){let n;$t(n=Jt())&&(i.firstNameRef=n.first)}},decls:108,vars:85,consts:[["customerForm","ngForm"],["firstNameAutoFocus","","FirstName","ngModel"],["phoneNumber","ngModel"],["Email","ngModel"],["birthdateCtrl","ngModel"],["customerCode","ngModel"],["address","ngModel"],["nationalId","ngModel"],[3,"onOk","onCancel","onClose","config"],[1,"container",2,"height","270px"],["name","form"],[1,"row","align-items-center","border-bottom"],[1,"btn","btn-link",3,"click","ngClass"],[1,"mt-6"],[1,"row",3,"hidden"],[1,"col-2","mt-3"],[1,"form-floating-outline"],["list","cust-title","id","Title","name","Title","placeholder","Title",1,"form-control",3,"ngModelChange","ngModel"],["for","Title"],["id","cust-title"],[3,"value",4,"ngFor","ngForOf"],[1,"col-5","mt-3"],["type","text","data-cy","FirstName","id","FirstName","name","FirstName","placeholder","First Name",1,"form-control",3,"keyup","ngModelChange","ngClass","ngModel","required"],[3,"ngClass",4,"ngIf"],["for","FirstName"],["type","text","data-cy","LastName","id","LastName","name","LastName","placeholder","Last Name",1,"form-control",3,"ngModelChange","ngModel"],["for","LastName"],[1,"col-6","mt-4"],["type","text","numericInputOnly","phone","id","Phone","name","Phone","placeholder","Mobile Phone",1,"form-control",3,"ngModelChange","ngClass","ngModel","required"],[4,"ngIf"],["for","Phone"],["type","email","id","email","name","Email","placeholder","Email","email","",1,"form-control",3,"ngModelChange","ngClass","ngModel","required"],["for","email"],["placeholder","Birthdate","appearance","outline","name","orderDate",3,"ngModelChange","ngModel","required","ngClass"],[1,"col-md-6","mt-4"],[1,"form-floating-outline","flexRow",3,"ngClass"],["id","customerGender","bindLabel","Value","bindValue","Key","name","customerGender","appendTo","body",1,"productform","tall",3,"ngModelChange","ngModel","items"],["for","customerGender",1,"ng-select"],[1,"row","mt-2",3,"hidden"],[1,"col-md-4","mt-4"],[1,"form-floating-outline","position-relative"],["type","text","name","code","id","code","placeholder","Customer Code",1,"form-control",2,"padding-right","30px !important",3,"ngModelChange","ngClass","ngModel","required"],["class","fa-solid fa-circle-info text-secondary position-absolute","matTooltipPosition","above","style","top: 21px; right: 9px; font-size: 16px;",3,"matTooltip",4,"ngIf"],[1,"invalid-feedback"],["for","code"],[1,"col-4","mt-4"],["id","customerGroup","bindLabel","Name","bindValue","ID","name","customerGroup","appendTo","body",1,"productform","tall",3,"ngModelChange","ngModel","items"],["for","customerGroup",1,"ng-select"],["id","city","bindLabel","Name","bindValue","ID","name","city","appendTo","body",1,"productform","tall",3,"ngModelChange","ngModel","items"],["for","city",1,"ng-select"],[1,"col-md-12","mt-4"],["id","address","name","address","placeholder","Address",1,"form-control",3,"ngModelChange","rows","ngClass","ngModel","required"],["for","address"],[1,"col-md-6","mt-3"],["type","text","id","Identification","name","Identification","placeholder","NationalID","numericInputOnly","nationalId",1,"form-control",3,"ngModelChange","ngModel","ngClass"],["for","Identification"],["type","text","id","TaxId","name","TaxId","placeholder","TaxID",1,"form-control",3,"ngModelChange","ngModel"],["for","TaxId"],["id","nationality","bindLabel","Name","bindValue","ID","name","nationality","appendTo","body",1,"productform","tall",3,"ngModelChange","ngModel","items"],["for","nationality",1,"ng-select"],["id","customerRace","bindLabel","Name","bindValue","ID","name","customerRace","appendTo","body",1,"productform","tall",3,"ngModelChange","ngModel","items"],["for","customerRace",1,"ng-select"],[3,"value"],[3,"ngClass"],["class","invalid-feedback",4,"ngIf"],["matTooltipPosition","above",1,"fa-solid","fa-circle-info","text-secondary","position-absolute",2,"top","21px","right","9px","font-size","16px",3,"matTooltip"]],template:function(e,i){if(e&1){let n=x();a(0,"modal-material",8),S("onOk",function(){C(n);let c=j(4);return v(i.onOk(c))})("onCancel",function(){return C(n),v(i.close("cancel"))})("onClose",function(){return C(n),v(i.close("close"))}),a(1,"content")(2,"div",9)(3,"form",10,0)(5,"div",11)(6,"div")(7,"a",12),S("click",function(){return C(n),v(i.chooiceDetail("general"))}),m(8," General "),s(),a(9,"a",12),S("click",function(){return C(n),v(i.chooiceDetail("detail"))}),m(10," Detail "),s(),a(11,"a",12),S("click",function(){return C(n),v(i.chooiceDetail("id"))}),m(12," ID "),s()()(),a(13,"div",13)(14,"div",14)(15,"div",15)(16,"div",16)(17,"input",17),B("ngModelChange",function(c){return C(n),H(i.customer.Title,c)||(i.customer.Title=c),v(c)}),s(),a(18,"label",18),m(19,"Title"),s(),a(20,"datalist",19),h(21,Ka,1,1,"option",20),s()()(),a(22,"div",21)(23,"div",16)(24,"input",22,1),S("keyup",function(){return C(n),v(i.onKeyUpFirstName())}),B("ngModelChange",function(c){return C(n),H(i.customer.FirstName,c)||(i.customer.FirstName=c),v(c)}),s(),h(27,Ya,2,3,"div",23),a(28,"label",24),m(29,"First Name"),s()()(),a(30,"div",21)(31,"div",16)(32,"input",25),B("ngModelChange",function(c){return C(n),H(i.customer.LastName,c)||(i.customer.LastName=c),v(c)}),s(),a(33,"label",26),m(34,"Last Name"),s()()(),a(35,"div",27)(36,"div",16)(37,"input",28,2),B("ngModelChange",function(c){return C(n),H(i.customer.Mobile,c)||(i.customer.Mobile=c),v(c)}),s(),h(39,es,3,2,"ng-container",29),a(40,"label",30),m(41,"Mobile"),s()()(),a(42,"div",27)(43,"div",16)(44,"input",31,3),B("ngModelChange",function(c){return C(n),H(i.customer.Email,c)||(i.customer.Email=c),v(c)}),s(),a(46,"label",32),m(47,"Email"),s(),h(48,ns,2,2),s()(),a(49,"div",27)(50,"div",16)(51,"datepicker",33,4),B("ngModelChange",function(c){return C(n),H(i.customer.Birthdate,c)||(i.customer.Birthdate=c),v(c)}),s(),h(53,rs,1,1),s()(),a(54,"div",34)(55,"div",35)(56,"ng-select",36),B("ngModelChange",function(c){return C(n),H(i.customer.Gender,c)||(i.customer.Gender=c),v(c)}),s(),a(57,"label",37),m(58,"Gender"),s()()()(),a(59,"div",38)(60,"div",39)(61,"div",40)(62,"input",41,5),B("ngModelChange",function(c){return C(n),H(i.customer.Code,c)||(i.customer.Code=c),v(c)}),s(),h(64,as,1,1,"i",42)(65,ss,2,0,"div",43),a(66,"label",44),m(67,"Customer Code"),s()()(),a(68,"div",45)(69,"div",35)(70,"ng-select",46),B("ngModelChange",function(c){return C(n),H(i.customer.Group,c)||(i.customer.Group=c),v(c)}),s(),a(71,"label",47),m(72,"Group"),s()()(),a(73,"div",39)(74,"div",35)(75,"ng-select",48),B("ngModelChange",function(c){return C(n),H(i.customer.City,c)||(i.customer.City=c),v(c)}),s(),a(76,"label",49),m(77,"City"),s()()(),a(78,"div",50)(79,"div",16)(80,"textarea",51,6),B("ngModelChange",function(c){return C(n),H(i.customer.Address,c)||(i.customer.Address=c),v(c)}),s(),a(82,"label",52),m(83,"Address"),s(),h(84,ls,2,0,"div",43),s()()(),a(85,"div",38)(86,"div",53)(87,"div",16)(88,"input",54,7),B("ngModelChange",function(c){return C(n),H(i.customer.NationalIDNumber,c)||(i.customer.NationalIDNumber=c),v(c)}),s(),h(90,cs,3,1,"ng-container",29),a(91,"label",55),m(92,"National ID"),s()()(),a(93,"div",53)(94,"div",16)(95,"input",56),B("ngModelChange",function(c){return C(n),H(i.customer.TaxIDNumber,c)||(i.customer.TaxIDNumber=c),v(c)}),s(),a(96,"label",57),m(97,"Tax ID"),s()()(),a(98,"div",34)(99,"div",35)(100,"ng-select",58),B("ngModelChange",function(c){return C(n),H(i.customer.NationalityID,c)||(i.customer.NationalityID=c),v(c)}),s(),a(101,"label",59),m(102,"Nationality"),s()()(),a(103,"div",27)(104,"div",35)(105,"ng-select",60),B("ngModelChange",function(c){return C(n),H(i.customer.RaceID,c)||(i.customer.RaceID=c),v(c)}),s(),a(106,"label",61),m(107,"Customer Racesas"),s()()()()()()()()()}if(e&2){let n=j(26),r=j(38),c=j(45),g=j(52),D=j(63),I=j(81),k=j(89);p("config",i.modalConfig),l(7),p("ngClass",R(55,Ze,i.tabState=="general")),l(2),p("ngClass",R(57,Ze,i.tabState=="detail")),l(2),p("ngClass",R(59,Ze,i.tabState=="id")),l(3),p("hidden",i.tabState!="general"),l(3),F("ngModel",i.customer.Title),l(4),p("ngForOf",i.options==null?null:i.options.Titles),l(3),p("ngClass",R(61,tt,n.touched&&n.invalid)),F("ngModel",i.customer.FirstName),p("required",!0),l(3),p("ngIf",n.touched&&n.invalid),l(5),F("ngModel",i.customer.LastName),l(5),p("ngClass",R(63,tt,r.invalid&&(r.dirty||r.touched))),F("ngModel",i.customer.Mobile),p("required",i.fieldRequiredConfig.Mobile),l(2),p("ngIf",r.invalid&&(r.dirty||r.touched)),l(5),p("ngClass",R(65,tt,c.invalid&&(c.dirty||c.touched))),F("ngModel",i.customer.Email),p("required",i.fieldRequiredConfig.Email),l(4),E(c.invalid&&(c.dirty||c.touched)?48:-1),l(3),F("ngModel",i.customer.Birthdate),p("required",i.fieldRequiredConfig.Birthdate)("ngClass",R(67,tt,g.invalid&&(g.dirty||g.touched))),l(2),E(g.invalid&&(g.dirty||g.touched)?53:-1),l(2),p("ngClass",R(69,Ze,i.isNotEmpty(i.customer.Gender))),l(),F("ngModel",i.customer.Gender),p("items",i.options==null?null:i.options.Genders),l(3),p("hidden",i.tabState!="detail"),l(3),p("ngClass",R(71,tt,D.invalid&&(D.dirty||D.touched))),F("ngModel",i.customer.Code),p("required",i.fieldRequiredConfig.Code),l(2),p("ngIf",i.estimatedCodeMessage),l(),E(D.invalid&&(D.dirty||D.touched)?65:-1),l(4),p("ngClass",R(73,Ze,i.isNotEmpty(i.customer.Group))),l(),F("ngModel",i.customer.Group),p("items",i.options==null?null:i.options.Groups),l(4),p("ngClass",R(75,Ze,i.isNotEmpty(i.customer.City))),l(),F("ngModel",i.customer.City),p("items",i.options==null?null:i.options.Cities),l(5),p("rows",6)("ngClass",R(77,tt,I.invalid&&(I.dirty||I.touched))),F("ngModel",i.customer.Address),p("required",i.fieldRequiredConfig.Address),l(4),E(I.invalid&&(I.dirty||I.touched)?84:-1),l(),p("hidden",i.tabState!="id"),l(3),F("ngModel",i.customer.NationalIDNumber),p("ngClass",R(79,tt,k.invalid&&(k.dirty||k.touched))),l(2),p("ngIf",k.getError("minLength")),l(5),F("ngModel",i.customer.TaxIDNumber),l(4),p("ngClass",R(81,Ze,i.isNotEmpty(i.customer.NationalityID))),l(),F("ngModel",i.customer.NationalityID),p("items",i.options==null?null:i.options.Nationalities),l(4),p("ngClass",R(83,Ze,i.isNotEmpty(i.customer.RaceID))),l(),F("ngModel",i.customer.RaceID),p("items",i.options==null?null:i.options.Races)}},dependencies:[De,ae,se,pn,dn,un,me,pe,cn,gn,fn,Me,mn,J,ti,ei,ri,Jn],styles:[".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-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:2px solid #07a519}.form-floating-outline[_ngcontent-%COMP%]{margin-bottom:.2rem!important}"]})};var ki=class o{constructor(t,e,i){this.data=t;this.dialogRef=e;this.salesOrderService=i;this.initModalConfig();let n=f.cloneObject(i.Data);this.orderNumber=n.Order.Number}config;orderNumber;initModalConfig(){this.config=new $,this.config.hideClose=!0,this.config.title="Edit Number"}onOk(){this.updateSalesOrderNumber(),this.dialogRef.close()}updateSalesOrderNumber(){let t=this.salesOrderService.Data;t.Order.Number=this.orderNumber,this.salesOrderService.pushNewValue(t)}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||o)(_(de),_(q),_(N))};static \u0275cmp=V({type:o,selectors:[["POS-modal-number-editor"]],decls:6,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"form-floating-outline","mb-0"],["type","text","data-cy","orderNumber","id","orderNumber","name","orderNumber",1,"form-control",3,"ngModelChange","ngModel"],["for","orderNumber"]],template:function(e,i){e&1&&(a(0,"modal-material",0),S("onOk",function(){return i.onOk()})("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),a(1,"content")(2,"div",1)(3,"input",2),B("ngModelChange",function(r){return H(i.orderNumber,r)||(i.orderNumber=r),r}),s(),a(4,"label",3),m(5,"Order Number"),s()()()()),e&2&&(p("config",i.config),l(3),F("ngModel",i.orderNumber))},dependencies:[me,pe,Me,J]})};var Vi=class o{constructor(t,e){this.data=t;this.dialogRef=e;this.modalConfig=new $,this.modalConfig.title=t.title,this.modalConfig.headerType=t.headerType,this.modalConfig.hideFooter=!0}modalConfig;onClose(t){this.dialogRef.close(t)}static \u0275fac=function(e){return new(e||o)(_(de),_(q))};static \u0275cmp=V({type:o,selectors:[["POS-modal-customer-reminder"]],standalone:!0,features:[Kt],decls:13,vars:1,consts:[[3,"onClose","config"],[1,"container-fluid","modal-info"],[1,"text-center","mb-4"],[1,"d-flex","justify-content-center","gap-3","mt-8"],[1,"btn","btn-success",3,"click"],[1,"btn","btn-danger",3,"click"]],template:function(e,i){e&1&&(a(0,"modal-material",0),S("onClose",function(){return i.onClose()}),a(1,"content")(2,"div",1)(3,"div")(4,"h4",2),m(5," No customer has been assigned for this Order. "),b(6,"br"),m(7," Do you want to input customer data? "),s(),a(8,"div",3)(9,"button",4),S("click",function(){return i.onClose("yes")}),m(10,"Yes"),s(),a(11,"button",5),S("click",function(){return i.onClose("no")}),m(12,"No"),s()()()()()()),e&2&&p("config",i.modalConfig)},dependencies:[qe,ii,J],styles:[".modal-info[_ngcontent-%COMP%] .empty-state-img[_ngcontent-%COMP%]{width:100px}.modal-info[_ngcontent-%COMP%] .img-1x[_ngcontent-%COMP%]{width:12rem}.modal-info[_ngcontent-%COMP%] .img-2x[_ngcontent-%COMP%]{width:10rem}.modal-info[_ngcontent-%COMP%] .img-3x[_ngcontent-%COMP%]{width:8rem}"]})};var Fi=class o{constructor(t,e,i,n,r,c,g,D,I,k,Qe){this.salesOrderService=t;this.toastrService=e;this.pageInitialService=i;this.orderProcessorService=n;this.dialog=r;this.onlineStatusService=c;this.promotionEventService=g;this.outletService=D;this.invoiceCalculatorService=I;this.userRole=k;this.sf=Qe;this.initSubscribeObservable()}appConfig;salesOrder;isOnline;localDataService=X(Te);initSubscribeObservable(){this.salesOrderService.Data$.subscribe(t=>{this.salesOrder=t}),this.pageInitialService.Data$.subscribe(t=>{this.appConfig=t.AppConfigJSON}),this.onlineStatusService.getOnlineStatus$().subscribe(t=>{this.isOnline=t})}payOrder(){if(this.isCartNotEmpty()&&this.validateEmptyOrderNumber()&&this.validateNegativePayment()&&this.isSalesPersonValid()&&this.isCustomerRequired()&&this.validateCustomerID()&&this.validatePromotionDiscount())if(this.appConfig.ModuleSell.Header.CustomerNotAssignedReminder&&f.IsEmpty(this.salesOrder.Order.CustomerID)){this.dialog.open(Vi,{id:"ModalInfo",data:{title:"Customer Assign Reminder",headerType:te.Warning},width:"31rem"}).afterClosed().pipe(Oe(t=>{t=="yes"?this.sf.searchFilterNativeEl.focus():t=="no"&&this.onOpenPaymentModal()})).subscribe();return}else this.onOpenPaymentModal()}validateNegativePayment(){let t=!0,e=this.invoiceCalculatorService.Data;return this.appConfig.ModuleSell.PaymentDialog.MinusPaymentAllowed==!1&&e<0&&(t=!1,this.toastrService.warning("You are not allowed to process this transaction because the total amount is less than zero","Warning!")),t}validateEmptyOrderNumber(){return f.IsEmpty(this.salesOrder.Order.Number)?(this.toastrService.warning(U.emptyOrderNumber,"Warning!"),this.openModalEditOrderNumber(),!1):!0}openModalEditOrderNumber(){this.userRole.Data.NumberEditor&&this.dialog.open(ki,{width:"20%"})}isCartNotEmpty(){return this.salesOrderService.Data.CartItems.length<1?(this.toastrService.warning(U.emptyPOItem,"Warning!"),!1):!0}isSalesPersonValid(){let t=this.pageInitialService.Data.AppConfigJSON,e=this.salesOrderService.Data;if(t.ModuleSell.Header.SalesPersonRequired){if(this.salesOrder.CartItems.every(i=>f.IsNotEmpty(i.SalesID)))return!0;if(e.Order.SalesID==f.GuidEmpty||e.Order.SalesID==null)return this.toastrService.warning(U.emptySalesPerson,"Warning!"),!1}return!0}validateCustomerID(){let t=this.salesOrderService.Data.Order.CustomerID;if(f.IsEmpty(t)){let e=this.orderProcessorService.Data.InputTextValue;if(f.IsNotEmpty(e)&&(this.toastrService.warning("Customer is not Saved","Warning"),this.appConfig.ModuleSell.Customer.QuickAddEnabled))return this.openCustomerModal(e),!1}return!0}isCustomerRequired(){let t=this.appConfig.ModuleSell.Header.CustomerRequired,e=this.salesOrder.Order.CustomerID;return t&&this.isOnline&&f.IsEmpty(e)?(this.toastrService.warning(U.emptyCustomer,"Warning!"),!1):!0}openCustomerModal(t){this.dialog.open(Ai,{data:{name:t},autoFocus:!1}).afterClosed().subscribe(e=>{e&&this.onOpenPaymentModal()})}validatePromotionDiscount(){let e=(this.outletService?.Data?.Promotion?this.outletService?.Data?.Promotion:[]).find(c=>c.TypeID===3),i=this.appConfig.ModuleSell.MandatoryActiveDiscount,n=this.promotionEventService.selectedPromotion,r=!0;return i&&e&&(n?n.TypeID!=3&&(r=!1):r=!1),r==!1&&(this.dialog.open(Ni,{id:"promotion-event"}),this.toastrService.warning("You need to apply Discount promotion","Required Promotion")),r}onOpenPaymentModal(){this.localDataService.unsentOrders$.pipe(Ae(1),ie(t=>t.length>0&&this.isOnline?this.offlineModal():this.paymentModal()),ke(()=>this.paymentModal())).subscribe()}paymentModal(){return this.dialog.open(Ri,{id:"ModalPayment"}).afterClosed()}offlineModal(){return this.dialog.open(Di,{disableClose:!0,id:"ModalOfflineOrder"}).afterClosed()}static \u0275fac=function(e){return new(e||o)(u(N),u(A),u(L),u(je),u(Ie),u(ue),u(fe),u(Y),u(Z),u(Ne),u(Kn))};static \u0275prov=M({token:o,factory:o.\u0275fac})};var co=class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=Gt({type:o});static \u0275inj=Ut({providers:[Fi],imports:[qe,wn,Bn,hn,_n,Tn,Ln,vn,yn,jn,Un,Oi,Gn,Sn,xt,Qn,oi,xt]})};export{ze as a,si as b,gt as c,N as d,L as e,ht as f,Ne as g,li as h,ci as i,Y as j,_i as k,no as l,Ke as m,Z as n,yt as o,bt as p,fe as q,hi as r,oe as s,Ci as t,Ye as u,vi as v,Ct as w,je as x,so as y,Oi as z,St as A,Pt as B,Ni as C,Ai as D,ki as E,Di as F,Fi as G,co as H};
|