dealpos 25.41.0 → 25.42.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/browser/{chunk-CMQAUCAH.js → chunk-23PJKOTU.js} +1 -1
- package/browser/{chunk-T7SZQ5ER.js → chunk-2H4V4O4E.js} +1 -1
- package/browser/{chunk-G6C75N4Q.js → chunk-2OWHEMAL.js} +1 -1
- package/browser/chunk-2QVRE7LQ.js +1 -0
- package/browser/{chunk-D3RDKDIY.js → chunk-2YDEXJE5.js} +1 -1
- package/browser/{chunk-GGJKYPV4.js → chunk-3AW2HE63.js} +1 -1
- package/browser/{chunk-OI2RWAOV.js → chunk-3GOO5E5D.js} +1 -1
- package/browser/{chunk-SK5RQIZA.js → chunk-3GRGFP66.js} +2 -2
- package/browser/{chunk-3NJFM55L.js → chunk-3LBZDIW2.js} +1 -1
- package/browser/{chunk-6BL2JKZG.js → chunk-3YKVLHZG.js} +1 -1
- package/browser/{chunk-ATYFAKRP.js → chunk-42T2PR4J.js} +1 -1
- package/browser/{chunk-4SOJX57D.js → chunk-46DETXA6.js} +1 -1
- package/browser/{chunk-JXJUXV43.js → chunk-4HEESH5A.js} +1 -1
- package/browser/{chunk-7EM2LL7R.js → chunk-4I4MCBI3.js} +1 -1
- package/browser/{chunk-K24FIZWW.js → chunk-4N6FRENU.js} +1 -1
- package/browser/{chunk-T6MTT57B.js → chunk-4QQTEPQT.js} +1 -1
- package/browser/{chunk-ZCQOFB7U.js → chunk-4SKJU2FQ.js} +1 -1
- package/browser/chunk-55KT4HTM.js +5 -0
- package/browser/{chunk-UQKBA274.js → chunk-57Q3ENW2.js} +1 -1
- package/browser/{chunk-IKWOYHRW.js → chunk-5AVAHDHN.js} +1 -1
- package/browser/{chunk-YYR3XEAQ.js → chunk-5BE43QU3.js} +1 -1
- package/browser/chunk-5C4DEWEB.js +14 -0
- package/browser/{chunk-FS3WBME7.js → chunk-5DSWFJVI.js} +1 -1
- package/browser/chunk-5G267UZX.js +1 -0
- package/browser/{chunk-LKFDM7AC.js → chunk-5HX73JZ3.js} +1 -1
- package/browser/{chunk-OMVUFMMZ.js → chunk-5JJSLRVS.js} +1 -1
- package/browser/{chunk-I2O3VGCS.js → chunk-5M3JINH2.js} +1 -1
- package/browser/{chunk-4E2C3JC6.js → chunk-5MPRE3II.js} +1 -1
- package/browser/{chunk-BAORXMVG.js → chunk-5NDP4IKK.js} +1 -1
- package/browser/{chunk-KAIC6JKI.js → chunk-5SOJKVR7.js} +1 -1
- package/browser/chunk-5UGZ6SP2.js +127 -0
- package/browser/{chunk-IJ7U2UFN.js → chunk-6774R2EL.js} +1 -1
- package/browser/{chunk-E25FM2KY.js → chunk-6AMPRFEN.js} +1 -1
- package/browser/chunk-6IF4NVBV.js +1 -0
- package/browser/{chunk-NW73SHIZ.js → chunk-6JAL37Y4.js} +1 -1
- package/browser/{chunk-R7MOZHCP.js → chunk-6PGUQ3CR.js} +1 -1
- package/browser/{chunk-GXZ2EIQO.js → chunk-6RA3MVUV.js} +2 -2
- package/browser/{chunk-GHC4BCCW.js → chunk-6ZN7JR6K.js} +1 -1
- package/browser/chunk-7BNQDGUO.js +1 -0
- package/browser/{chunk-ZY3EJSWW.js → chunk-7ENDP7TZ.js} +1 -1
- package/browser/{chunk-G5HGRNM6.js → chunk-7IDMO3VZ.js} +1 -1
- package/browser/{chunk-PWFFXKPT.js → chunk-7OYSGU2F.js} +1 -1
- package/browser/{chunk-T2PXIPKB.js → chunk-7QWJJPNG.js} +1 -1
- package/browser/{chunk-VYFU4BSG.js → chunk-7WKHBXTJ.js} +1 -1
- package/browser/{chunk-CHSEYRJF.js → chunk-AEHOR4RJ.js} +1 -1
- package/browser/{chunk-2HPAHDH3.js → chunk-AF2E7NTE.js} +1 -1
- package/browser/{chunk-UKTKBEVE.js → chunk-AGTR6PKD.js} +1 -1
- package/browser/{chunk-6CLFZ6DE.js → chunk-APF7PDRI.js} +1 -1
- package/browser/{chunk-R5IO2SN4.js → chunk-AZO64X7U.js} +1 -1
- package/browser/{chunk-KVJTNXOJ.js → chunk-B5SDXVDR.js} +1 -1
- package/browser/{chunk-SOM7CDGS.js → chunk-B5VF422M.js} +1 -1
- package/browser/{chunk-DPKYMDVN.js → chunk-BKUC3UED.js} +1 -1
- package/browser/{chunk-7YKJZAV2.js → chunk-BM2UYASI.js} +1 -1
- package/browser/{chunk-F6SLXCNW.js → chunk-BSVPJNZE.js} +1 -1
- package/browser/{chunk-QGNOVY53.js → chunk-BXQFYW4R.js} +1 -1
- package/browser/{chunk-B56YVUVP.js → chunk-C2CGBWBH.js} +1 -1
- package/browser/{chunk-FBOZUHXS.js → chunk-C2KD7R6L.js} +1 -1
- package/browser/chunk-C3DQRSEL.js +1 -0
- package/browser/{chunk-7C4FPJKC.js → chunk-C6DVD3VG.js} +1 -1
- package/browser/{chunk-6LF24U22.js → chunk-CICNZFRR.js} +1 -1
- package/browser/chunk-CKXIMJSM.js +1 -0
- package/browser/{chunk-ZPQXV57H.js → chunk-CQZUC4YF.js} +1 -1
- package/browser/chunk-CS3PYDFF.js +1 -0
- package/browser/{chunk-BYNEFOC3.js → chunk-CSQD5JSK.js} +1 -1
- package/browser/{chunk-INKPSHU5.js → chunk-CUNZPCNX.js} +1 -1
- package/browser/{chunk-4L5G4WC4.js → chunk-CWITQVZH.js} +1 -1
- package/browser/{chunk-WOZLNXGI.js → chunk-DAIHPIA2.js} +1 -1
- package/browser/chunk-DBZKSONS.js +1 -0
- package/browser/{chunk-INZNIUUT.js → chunk-DDZ3I4LH.js} +1 -1
- package/browser/{chunk-SXVT4ARO.js → chunk-DHH4PIYF.js} +1 -1
- package/browser/{chunk-2F5STFEV.js → chunk-DLONNLPI.js} +1 -1
- package/browser/{chunk-EWKPKHEM.js → chunk-DSXPDWMW.js} +1 -1
- package/browser/{chunk-32VED5SX.js → chunk-E2BNDPLE.js} +1 -1
- package/browser/chunk-E4EPR65A.js +1 -0
- package/browser/{chunk-BIRF2ABZ.js → chunk-EAFPSXNJ.js} +1 -1
- package/browser/{chunk-IRAEKG7Q.js → chunk-ECOW7JD7.js} +1 -1
- package/browser/{chunk-5BMWUUZC.js → chunk-ED6FLVEK.js} +1 -1
- package/browser/{chunk-KLIM7HC4.js → chunk-EDCFG3LH.js} +1 -1
- package/browser/{chunk-OE7PM4Y4.js → chunk-EEEAUYZ6.js} +1 -1
- package/browser/{chunk-45BASVRZ.js → chunk-EFDAS2KA.js} +1 -1
- package/browser/{chunk-24OZA3GF.js → chunk-EGIDHMPA.js} +1 -1
- package/browser/{chunk-7QDLYX4Z.js → chunk-ENVG4BZI.js} +1 -1
- package/browser/{chunk-FO3DCWRP.js → chunk-EWZ63XSS.js} +1 -1
- package/browser/{chunk-MWZWI55C.js → chunk-F4L5OA5I.js} +2 -2
- package/browser/chunk-FKDZ5OWB.js +297 -0
- package/browser/{chunk-3XMWVJ2L.js → chunk-FLCAZ4FS.js} +1 -1
- package/browser/{chunk-MZQRC3WK.js → chunk-FMHXEKSH.js} +1 -1
- package/browser/{chunk-7UFQPOGN.js → chunk-FP4HFB5J.js} +1 -1
- package/browser/{chunk-MO72TCM3.js → chunk-FTK6YP6X.js} +1 -1
- package/browser/{chunk-XBKHQX2Z.js → chunk-G75TUOW6.js} +1 -1
- package/browser/{chunk-3VQLYVVB.js → chunk-GHA3WIJU.js} +1 -1
- package/browser/{chunk-WEAIMPRM.js → chunk-H3ARLDNZ.js} +1 -1
- package/browser/{chunk-KC52V6JH.js → chunk-HDBFIDGA.js} +1 -1
- package/browser/{chunk-7KXMZBQB.js → chunk-HG3CFH36.js} +1 -1
- package/browser/{chunk-NHTMJTLV.js → chunk-HMER2IC5.js} +1 -1
- package/browser/{chunk-WYAOC74R.js → chunk-HTU7TNUP.js} +1 -1
- package/browser/chunk-HTVJTXND.js +112 -0
- package/browser/{chunk-XJD4HFEN.js → chunk-HWEYOOFD.js} +1 -1
- package/browser/{chunk-UBCZUCAI.js → chunk-I3N5TRBQ.js} +1 -1
- package/browser/{chunk-XUVY2IO6.js → chunk-I3ZGST4N.js} +1 -1
- package/browser/{chunk-Z7LRKY4R.js → chunk-IC3DZAMU.js} +1 -1
- package/browser/{chunk-J5G2T7JL.js → chunk-IGHZ4V7Y.js} +2 -2
- package/browser/{chunk-IXEK3QVA.js → chunk-IQHU4MKW.js} +1 -1
- package/browser/{chunk-VNDXYRE3.js → chunk-IWZCWLYG.js} +1 -1
- package/browser/chunk-J4ZUV7IH.js +3 -0
- package/browser/{chunk-HLB5LHMM.js → chunk-JDOZFN63.js} +1 -1
- package/browser/{chunk-XOQ4SW2R.js → chunk-JOXTERIM.js} +1 -1
- package/browser/{chunk-GZAARWM2.js → chunk-JPXXXD26.js} +1 -1
- package/browser/{chunk-ILF7FISN.js → chunk-JUT3PXG2.js} +1 -1
- package/browser/{chunk-NQTQPZ6C.js → chunk-K7KRPIN7.js} +1 -1
- package/browser/{chunk-JZGPSRHE.js → chunk-KFFIMVTO.js} +1 -1
- package/browser/{chunk-KVCJJEYJ.js → chunk-KHILQH3P.js} +1 -1
- package/browser/{chunk-FVV3OZGL.js → chunk-KKWXZLT5.js} +1 -1
- package/browser/{chunk-2LFFOWKW.js → chunk-KTCV3KOE.js} +1 -1
- package/browser/{chunk-3CGMC22M.js → chunk-KWD4ATP5.js} +1 -1
- package/browser/{chunk-OQCGVZVB.js → chunk-KZDE63UL.js} +1 -1
- package/browser/chunk-L7RHCBKX.js +1 -0
- package/browser/{chunk-2GQKEX5I.js → chunk-L7YSVT7G.js} +1 -1
- package/browser/{chunk-T2PMKO3M.js → chunk-LE3BKIDY.js} +1 -1
- package/browser/{chunk-SPCOCDB5.js → chunk-LFGQMERN.js} +1 -1
- package/browser/{chunk-QGSVNOUM.js → chunk-LJXYWJZW.js} +1 -1
- package/browser/{chunk-HPLAMF75.js → chunk-LMJVRREP.js} +1 -1
- package/browser/{chunk-4CRQAT4Y.js → chunk-LO3FAFDO.js} +1 -1
- package/browser/{chunk-S7PUQN3L.js → chunk-M34MZTRY.js} +1 -1
- package/browser/{chunk-KS37A3HL.js → chunk-M3HHWYKD.js} +1 -1
- package/browser/{chunk-3M5M2T4L.js → chunk-MFCXEITE.js} +1 -1
- package/browser/chunk-MH6ADXRE.js +1 -0
- package/browser/{chunk-3CCOX4FN.js → chunk-MPSML3FA.js} +1 -1
- package/browser/{chunk-T57FXNTH.js → chunk-MRF4FND7.js} +3 -3
- package/browser/{chunk-CN5SHMHF.js → chunk-MUJ6277G.js} +1 -1
- package/browser/{chunk-FNC65DTW.js → chunk-MUWBVOJI.js} +1 -1
- package/browser/{chunk-PJHIUSNN.js → chunk-N23TC7B4.js} +1 -1
- package/browser/{chunk-EPYFG6SH.js → chunk-N47VNTBG.js} +1 -1
- package/browser/{chunk-W2NHEKCW.js → chunk-N5UW2RHA.js} +1 -1
- package/browser/{chunk-DOTR5PYR.js → chunk-N6QITTR2.js} +1 -1
- package/browser/{chunk-26Z4OH2A.js → chunk-NDANDUNF.js} +2 -2
- package/browser/{chunk-2Q63FHAZ.js → chunk-NIZYEBIJ.js} +1 -1
- package/browser/{chunk-DINWVJP7.js → chunk-NJS6IQX6.js} +1 -1
- package/browser/{chunk-ZBYQ3WOC.js → chunk-NMR7EZWC.js} +1 -1
- package/browser/{chunk-Z76AR3IW.js → chunk-NVWJ6HZD.js} +1 -1
- package/browser/{chunk-M7EO4UVO.js → chunk-O2QTP22K.js} +1 -1
- package/browser/{chunk-ZEZ2K35X.js → chunk-OISKO6QJ.js} +1 -1
- package/browser/{chunk-3AIABMW2.js → chunk-OKIBXXRJ.js} +1 -1
- package/browser/{chunk-YQNCI5SR.js → chunk-OOXHLUNH.js} +1 -1
- package/browser/chunk-OXQJYOVG.js +1 -0
- package/browser/{chunk-ZFYF7PEH.js → chunk-OYSMMJMB.js} +1 -1
- package/browser/chunk-PGWC5FQQ.js +1 -0
- package/browser/{chunk-MMBFUP5P.js → chunk-PIPVFOET.js} +1 -1
- package/browser/{chunk-OPCIBNIJ.js → chunk-PIYM2FOP.js} +1 -1
- package/browser/{chunk-OID2F56F.js → chunk-PKRNU4IK.js} +3 -3
- package/browser/{chunk-BADUP5JT.js → chunk-Q4CKRRGM.js} +1 -1
- package/browser/{chunk-4DC2TBLV.js → chunk-QDFPKARQ.js} +1 -1
- package/browser/{chunk-EGYLYR4R.js → chunk-QGDUBOY6.js} +2 -2
- package/browser/{chunk-UAI7BPPY.js → chunk-QHRP323Q.js} +1 -1
- package/browser/{chunk-ISWF7KQF.js → chunk-QUHI6RHC.js} +1 -1
- package/browser/{chunk-BT6BH634.js → chunk-QYWAJKFK.js} +1 -1
- package/browser/{chunk-5DDIIEIO.js → chunk-RDXTLLRW.js} +1 -1
- package/browser/{chunk-UIFA2SDY.js → chunk-RETQC5XM.js} +1 -1
- package/browser/{chunk-2335JJ7I.js → chunk-RFT3FEVW.js} +4 -4
- package/browser/{chunk-WIB47ZGF.js → chunk-ROQHG6JX.js} +1 -1
- package/browser/{chunk-CB33ZMNF.js → chunk-RVXZOIFQ.js} +1 -1
- package/browser/{chunk-XZQMVGBQ.js → chunk-RX7JS4CO.js} +1 -1
- package/browser/{chunk-MYMQ5FSS.js → chunk-S4Z6ZYZ4.js} +1 -1
- package/browser/{chunk-WUDGY4TW.js → chunk-SEFALU4U.js} +1 -1
- package/browser/{chunk-XU5SOTZS.js → chunk-SIRUW7U2.js} +1 -1
- package/browser/chunk-STIS4QW6.js +1 -0
- package/browser/chunk-SXFCBAG6.js +1 -0
- package/browser/{chunk-CSAGSFL3.js → chunk-SZPU2EUQ.js} +1 -1
- package/browser/{chunk-6CJCT6YT.js → chunk-T26KVRGE.js} +1 -1
- package/browser/{chunk-Y3CUYCSX.js → chunk-T2IJ4MCB.js} +1 -1
- package/browser/{chunk-WA5AGHFF.js → chunk-TBHZV7EF.js} +1 -1
- package/browser/{chunk-A5S5YAD4.js → chunk-TGGLJVDI.js} +1 -1
- package/browser/{chunk-2PLZSFZT.js → chunk-TLWPWXDM.js} +1 -1
- package/browser/{chunk-3CCLSY4U.js → chunk-TLXGEI76.js} +1 -1
- package/browser/{chunk-52NDCK4A.js → chunk-TSEZZNO5.js} +1 -1
- package/browser/{chunk-HV6ZFQAQ.js → chunk-TVEGYRXE.js} +1 -1
- package/browser/{chunk-JJK4XCMN.js → chunk-U4U76CXH.js} +1 -1
- package/browser/{chunk-ROG4PCGU.js → chunk-UBWKI2NL.js} +1 -1
- package/browser/{chunk-AZG6NVGX.js → chunk-UDRNMFT2.js} +2 -2
- package/browser/{chunk-VF4OMJUM.js → chunk-UHAOZI7V.js} +1 -1
- package/browser/{chunk-E32TPBTM.js → chunk-UIWSGP55.js} +1 -1
- package/browser/{chunk-DNLMIUJF.js → chunk-UMT5IJRJ.js} +1 -1
- package/browser/{chunk-7USMFPWJ.js → chunk-UU55EO4X.js} +1 -1
- package/browser/{chunk-OHZN3Z7O.js → chunk-UWGTJ4UH.js} +1 -1
- package/browser/{chunk-DJOHANFC.js → chunk-UXRO4UFY.js} +3 -3
- package/browser/{chunk-QCBXPOJL.js → chunk-VFTGIP5A.js} +1 -1
- package/browser/{chunk-QMCAG2HX.js → chunk-VHAM2DWK.js} +1 -1
- package/browser/{chunk-HPOSI4EB.js → chunk-VRQTOJAL.js} +1 -1
- package/browser/{chunk-MRV7ZBNN.js → chunk-VX6ZWRY5.js} +4 -4
- package/browser/{chunk-B73NC3X2.js → chunk-W4UISTRM.js} +1 -1
- package/browser/{chunk-RM6J5M7M.js → chunk-W5GCPYXR.js} +1 -1
- package/browser/{chunk-BAL3IIDS.js → chunk-W7I2T4SZ.js} +1 -1
- package/browser/{chunk-6IW4MVP2.js → chunk-WDQ4UKKY.js} +1 -1
- package/browser/{chunk-5TV4QYNO.js → chunk-WM2AITL6.js} +1 -1
- package/browser/{chunk-GOLWWX2Q.js → chunk-WO3LDDSF.js} +1 -1
- package/browser/{chunk-EPBMDUPY.js → chunk-WPFMJVWU.js} +1 -1
- package/browser/{chunk-3R5GV4J5.js → chunk-XA6BOS45.js} +1 -1
- package/browser/{chunk-CHVYE7JV.js → chunk-XEQB57SN.js} +1 -1
- package/browser/{chunk-I6E6PXQU.js → chunk-XKUQPHUA.js} +1 -1
- package/browser/{chunk-7LXPGNYF.js → chunk-XMYLHF4C.js} +1 -1
- package/browser/chunk-XPZUZ5XJ.js +1 -0
- package/browser/chunk-XSM7RMIF.js +1 -0
- package/browser/{chunk-3GV7FUAX.js → chunk-XYB3YDKL.js} +1 -1
- package/browser/{chunk-UZFW2WNI.js → chunk-XYZNPGYI.js} +1 -1
- package/browser/{chunk-PRKAXHSJ.js → chunk-XZELBTQR.js} +1 -1
- package/browser/{chunk-NDM2ODJP.js → chunk-XZR3IMWZ.js} +1 -1
- package/browser/chunk-YEDKRNXU.js +1 -0
- package/browser/{chunk-HUMRIGHZ.js → chunk-YIKW3UR6.js} +1 -1
- package/browser/{chunk-J3C5CJEH.js → chunk-YN74XRON.js} +1 -1
- package/browser/{chunk-QWZ5AM3L.js → chunk-YNDNTAII.js} +1 -1
- package/browser/{chunk-SN3DTCGO.js → chunk-YPFMEFOD.js} +1 -1
- package/browser/{chunk-L2PLXSAS.js → chunk-YPOODN5H.js} +1 -1
- package/browser/{chunk-O5PHF6GW.js → chunk-YRGGDRUH.js} +1 -1
- package/browser/chunk-YTK6Z533.js +1 -0
- package/browser/{chunk-BSVRNBBT.js → chunk-YTN2MAGY.js} +1 -1
- package/browser/{chunk-NPTTEU4B.js → chunk-YWGXM2C3.js} +1 -1
- package/browser/{chunk-D66QGFWL.js → chunk-YXEHR27Y.js} +1 -1
- package/browser/{chunk-RWRT75NX.js → chunk-Z2LCSWV4.js} +1 -1
- package/browser/{chunk-UESUOHI6.js → chunk-Z56AQWHN.js} +1 -1
- package/browser/{chunk-WWMFBTW6.js → chunk-ZACGGWOQ.js} +1 -1
- package/browser/{chunk-ICZOEWBT.js → chunk-ZHQEEPCW.js} +1 -1
- package/browser/{chunk-REQUYIUO.js → chunk-ZHY3BUQJ.js} +1 -1
- package/browser/{chunk-KZTKYVZF.js → chunk-ZJ23VRN3.js} +1 -1
- package/browser/chunk-ZRCTLVL4.js +1 -0
- package/browser/{chunk-N5QWMN2M.js → chunk-ZTHPT62A.js} +1 -1
- package/browser/chunk-ZVEJWL4V.js +1 -0
- package/browser/{chunk-7AKAJDA6.js → chunk-ZXXXSUM7.js} +1 -1
- package/browser/{chunk-TYBAV5LT.js → chunk-ZZGSAFGO.js} +1 -1
- package/browser/index.html +3 -3
- package/browser/{main-D4SWIXO5.js → main-EFBZ6Z35.js} +2 -2
- package/browser/{styles-2TXD27TS.css → styles-EM6OTRT2.css} +1 -1
- package/package.json +1 -1
- package/browser/chunk-2F5C3IAG.js +0 -1
- package/browser/chunk-2PYNUKOZ.js +0 -297
- package/browser/chunk-6ZEEVCRE.js +0 -1
- package/browser/chunk-7LAIQ66I.js +0 -1
- package/browser/chunk-AD5C5J25.js +0 -1
- package/browser/chunk-AZMKFBK2.js +0 -3
- package/browser/chunk-B7NI6C35.js +0 -1
- package/browser/chunk-DWOLAWQN.js +0 -1
- package/browser/chunk-GBCEUME2.js +0 -5
- package/browser/chunk-HHL6JGRR.js +0 -1
- package/browser/chunk-HOODBZSK.js +0 -112
- package/browser/chunk-JXWFGUDB.js +0 -1
- package/browser/chunk-LOMNHHBV.js +0 -1
- package/browser/chunk-MG5VMZYP.js +0 -1
- package/browser/chunk-NTYGQQVE.js +0 -127
- package/browser/chunk-P4D3ZFU6.js +0 -1
- package/browser/chunk-PKXXNSOA.js +0 -1
- package/browser/chunk-S4FLFLTR.js +0 -1
- package/browser/chunk-TBLF6HGT.js +0 -14
- package/browser/chunk-TLANLIUC.js +0 -1
- package/browser/chunk-U2PLVLVX.js +0 -1
- package/browser/chunk-YQEL63SF.js +0 -1
- package/browser/chunk-ZHDKGVTO.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as Vr}from"./chunk-6CLFZ6DE.js";import{a as lo}from"./chunk-E25FM2KY.js";import{b as sa,c as ca}from"./chunk-ZFYF7PEH.js";import{a as ea}from"./chunk-2F5C3IAG.js";import{b as ta,e as ia,f as na,g as oa}from"./chunk-XUVY2IO6.js";import{a as fa}from"./chunk-HBAQBI6Z.js";import{A as Ur,B as zi,C as $t,D as Ki,E as Jr,F as Gr,G as Xi,H as Xr,I as Zr,a as Mr,b as ct,c as wr,d as Pe,e as N,f as L,g as kr,h as de,i as Tr,j as Er,k as Y,l as Rr,m as Nr,n as Me,o as Xe,p as xt,q as De,r as Qt,s as ji,t as Hi,u as Ui,v as Wi,w as ao,x as Qi,y as W,z as Hr}from"./chunk-T57FXNTH.js";import"./chunk-YXCPHYC5.js";import"./chunk-JFLT7NX3.js";import"./chunk-ISWF7KQF.js";import"./chunk-YTGZYBEI.js";import"./chunk-KS37A3HL.js";import{b as da}from"./chunk-N5QWMN2M.js";import{a as ma,b as ua}from"./chunk-WIB47ZGF.js";import{a as aa,b as la}from"./chunk-CSAGSFL3.js";import{a as Lr,b as Br,c as Fr,d as $i}from"./chunk-EPBMDUPY.js";import{a as Or}from"./chunk-4USQPLEW.js";import"./chunk-J6U6UYNI.js";import{b as Vi,c as nt}from"./chunk-HT35KHLT.js";import{b as Be}from"./chunk-CHSEYRJF.js";import"./chunk-Z3E24JZW.js";import{a as Pr}from"./chunk-QGNOVY53.js";import{a as Ri}from"./chunk-I6E6PXQU.js";import{a as pa,b as en}from"./chunk-S4FLFLTR.js";import{a as Wr,b as Qr}from"./chunk-YYR3XEAQ.js";import{c as Ji,d as Gi}from"./chunk-LOMNHHBV.js";import"./chunk-IJ7U2UFN.js";import"./chunk-JXJUXV43.js";import{a as kt}from"./chunk-IRAEKG7Q.js";import"./chunk-3AIABMW2.js";import{a as qe,b as pt}from"./chunk-4E2C3JC6.js";import"./chunk-M7EO4UVO.js";import{a as ra}from"./chunk-R7MOZHCP.js";import{a as Zi}from"./chunk-WA5AGHFF.js";import"./chunk-D3RDKDIY.js";import"./chunk-NQX7EX5A.js";import"./chunk-FO3DCWRP.js";import"./chunk-P3KIIKY4.js";import{a as Dr,b as qr,c as $r}from"./chunk-WEAIMPRM.js";import{a as Fi}from"./chunk-DINWVJP7.js";import{a as Yr}from"./chunk-I2O3VGCS.js";import"./chunk-O5PHF6GW.js";import"./chunk-BYXBJQAS.js";import"./chunk-BYXBJQAS.js";import"./chunk-R5IO2SN4.js";import{a as xr,b as Ir}from"./chunk-BADUP5JT.js";import"./chunk-OPCIBNIJ.js";import"./chunk-G6C75N4Q.js";import"./chunk-PRKAXHSJ.js";import"./chunk-BYXBJQAS.js";import{a as gi}from"./chunk-HUMRIGHZ.js";import{a as Ie,c as Bi}from"./chunk-FBOZUHXS.js";import{a as ro}from"./chunk-PF33HK6M.js";import"./chunk-5UDUWK67.js";import{c as fi}from"./chunk-G5HGRNM6.js";import{a as Ni}from"./chunk-NQKVYQ6V.js";import{a as Ai,b as Li}from"./chunk-WOZLNXGI.js";import{a as oo}from"./chunk-ZCQOFB7U.js";import"./chunk-QWZ5AM3L.js";import{a as Yi,b as zr,c as Kr}from"./chunk-DPKYMDVN.js";import{a as Ar,b as qi}from"./chunk-UZFW2WNI.js";import{a as dt,b as qt}from"./chunk-ZEZ2K35X.js";import{b as wi,c as vt,d as St,e as Ht}from"./chunk-6CJCT6YT.js";import{a as jr}from"./chunk-3CCOX4FN.js";import{d as Ti,e as Ei}from"./chunk-HV6ZFQAQ.js";import{a as ar}from"./chunk-GOLWWX2Q.js";import{e as yr}from"./chunk-Z7LRKY4R.js";import"./chunk-SN3DTCGO.js";import"./chunk-3RK6DDJD.js";import"./chunk-7UFQPOGN.js";import"./chunk-2F5STFEV.js";import"./chunk-DWOLAWQN.js";import"./chunk-Y3CUYCSX.js";import"./chunk-T2PXIPKB.js";import"./chunk-QMCAG2HX.js";import{b as vr,c as Sr}from"./chunk-KAIC6JKI.js";import{a as hr,b as br}from"./chunk-OMVUFMMZ.js";import"./chunk-HPLAMF75.js";import{a as gr,d as _r,e as Cr}from"./chunk-HLB5LHMM.js";import{c as tr}from"./chunk-4CRQAT4Y.js";import"./chunk-4L5G4WC4.js";import"./chunk-3NJFM55L.js";import"./chunk-2LFFOWKW.js";import"./chunk-OQCGVZVB.js";import"./chunk-UAI7BPPY.js";import"./chunk-6IW4MVP2.js";import{a as rr,b as lr}from"./chunk-7LAIQ66I.js";import"./chunk-OI2RWAOV.js";import{a as Yo}from"./chunk-7LXPGNYF.js";import{a as ut,c as st}from"./chunk-CN5SHMHF.js";import{a as ir,d as nr,f as or}from"./chunk-3M5M2T4L.js";import{C as fr,D as Ye,F as Wt,G as yt,u as H,v as U,w as ve}from"./chunk-45BASVRZ.js";import{b as ce,c as Ke}from"./chunk-XOQ4SW2R.js";import{F as ur,N as Ut,O as _e,a as sr,b as cr,n as ki,t as pr,u as dr,x as mr}from"./chunk-4SOJX57D.js";import{a as Uo}from"./chunk-GHC4BCCW.js";import"./chunk-GIKR6Y2K.js";import{d as mt}from"./chunk-3GV7FUAX.js";import{e as j,f as Ae,g as re}from"./chunk-6BL2JKZG.js";import{M as Xo,Z as Zo,_ as er}from"./chunk-REQUYIUO.js";import"./chunk-QCBXPOJL.js";import"./chunk-T2PMKO3M.js";import{a as Le}from"./chunk-2FWFPV5I.js";import"./chunk-OE7PM4Y4.js";import{A as Bt,D as zo,F as fe,G as ze,a as Wo,b as Lt,c as te,d as Qo,e as ui,g as qo,h as K,j as $o,l as ht,m as Jo,o as oe,r as Go,s as bt}from"./chunk-CB33ZMNF.js";import{a as At,c as jt}from"./chunk-INKPSHU5.js";import{a as Ko}from"./chunk-FNC65DTW.js";import{a as S,d as Ft}from"./chunk-TYBAV5LT.js";import"./chunk-QGSVNOUM.js";import{$a as s,$b as xe,Ab as io,Ac as x,Ba as Oo,Bc as ne,Cc as Ge,Db as E,E as se,Eb as li,Fa as He,Fc as J,Gb as si,Hb as ci,I as ai,Ib as r,Ja as Ii,Jb as a,Ka as Po,Kb as C,Kc as No,Lb as I,M as yo,Ma as V,Mb as O,Md as jo,N as Et,Nb as pi,Ob as v,Od as Ho,Pc as Vo,Qb as g,Qd as Ct,Rb as c,Rd as Nt,Sc as Ao,Td as Vt,Ub as di,Va as Oi,Vb as To,Vd as ee,Wa as tt,Wc as q,Y as Rt,Yc as be,Yd as Qe,Za as it,Zb as Se,Zc as z,_b as ye,aa as Re,ad as Lo,bc as Eo,bd as Di,c as bo,cb as Mo,cc as Ro,cd as Ve,d as G,da as k,db as m,dc as Q,e as Zn,ec as d,ed as We,fa as Ne,fc as T,gb as Do,gc as y,gd as Z,hc as Ue,ia as xo,id as Bo,ja as rt,jc as P,jd as X,k as vo,ka as gt,kb as w,kc as M,lb as _t,lc as D,ma as B,mb as Pi,mc as no,md as Fo,na as ie,o as eo,ob as Mi,pc as at,qb as _,qc as lt,rc as R,sc as me,t as et,tc as mi,u as xi,ua as Io,ub as wo,va as u,vb as p,wa as f,wb as to,xb as ko,z as So,zb as he,zc as b}from"./chunk-DJOHANFC.js";import{j as ho}from"./chunk-7DCB7DB2.js";var tn=class{ID;Code;Name;Title;Field;Address;ContactInfo;Logo;FooterLeft;FooterRight;FooterNote;PrintMode;PrintLX300;DeliveryNote;AppendQR;ItemRenderMode;CssClass;RemoveImage;DisplayName;DisplayNameCode};var Jt=class{ParkLabel;Note;NumberOfPerson;ID;Alias;Created;CustomerDisplay;Number;Duration};var nn=class o{constructor(t,e,i,n,l,h){this.dialogRef=t;this._orderProcessorService=e;this._posService=i;this.salesOrderService=n;this.parkService=l;this.data=h;this.initModalDialog(),this.initConfig(),this.parkLabel=h.ParkLabel,this.form.ParkLabel=h.ParkLabel,this.form.Note=n.Data.Order.Note}modalConfig=new H;labelPlaceholder;form=new Jt;parkLabel;initConfig(){let t=this._posService.Data.AppConfigJSON;this.labelPlaceholder=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkLabelPlaceholder}initModalDialog(){this.modalConfig.title=this.data.title,this.modalConfig.customWidth="600px"}onOk(){this.setParkTitle(),this.parkService.park(this.form).subscribe(t=>{this.dialogRef.close(!0)})}setParkTitle(){let t=this._orderProcessorService.Data.posState,e=this.salesOrderService.Data.Order.Number;t==5?this.salesOrderService.Data.SplitParkLabel=S.IsEmpty(this.parkLabel)?e:this.parkLabel:S.IsEmpty(this.parkLabel)?this.form.ParkLabel=e:this.form.ParkLabel=this.parkLabel}static \u0275fac=function(e){return new(e||o)(m(j),m(W),m(L),m(N),m(ke),m(Ae))};static \u0275cmp=w({type:o,selectors:[["POS-modal-park-input"]],standalone:!1,decls:17,vars:3,consts:[[3,"onCancel","onOk","onClose","config"],[1,"ods-info-box"],[1,"fas","fa-info-circle",2,"font-size","1.2rem","margin-top","2px"],["href","https://ods.dealpos.app","target","_blank",2,"color","#0d6efd","font-weight","600","text-decoration","underline"],[1,"w-100","mt-4"],[1,"mb-3"],["type","text","required","","placeholder","E.g. Mr. John Doe","matTooltip","Same as Order Number when blank",1,"form-control","w-100","height-input",3,"ngModelChange","ngModel"],["placeholder","ex: Customer will return tommorow",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onCancel",function(){return i.dialogRef.close()})("onOk",function(){return i.onOk()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1),C(3,"i",2),r(4,"div"),d(5," Use our "),r(6,"a",3),d(7," Order Display Fulfillment System "),a(),d(8," to view the Parked Orders from your warehouse area. "),a()(),r(9,"div",4)(10,"strong",5),d(11,"Label"),a(),r(12,"input",6),D("ngModelChange",function(l){return M(i.parkLabel,l)||(i.parkLabel=l),l}),a()(),r(13,"div",4)(14,"strong",5),d(15,"Note"),a(),r(16,"POS-tinymce-editor",7),D("ngModelChange",function(l){return M(i.form.Note,l)||(i.form.Note=l),l}),a()()()()),e&2&&(p("config",i.modalConfig),s(12),P("ngModel",i.parkLabel),s(4),P("ngModel",i.form.Note))},dependencies:[te,K,Bt,oe,U,ce,dt],styles:[".height-input[_ngcontent-%COMP%]{height:36px} ng-select.park-detail>div.ng-select-container{border-radius:0!important}.deposit[_ngcontent-%COMP%] .ng-select{width:auto!important}.ods-info-box[_ngcontent-%COMP%]{background-color:#e8f4fd;border-left:4px solid #0dcaf0;padding:16px 20px;border-radius:8px;font-family:Roboto Slab,sans-serif;color:#055160;display:flex;align-items:flex-start;gap:10px;font-size:14px;max-width:600px;margin:0 auto}"]})};var rn=class o{constructor(t){this._dialogRef=t;this.modalConfig=new H,this.modalConfig.title="Select Print Type",this.modalConfig.hideFooter=!0}modalConfig;onPrintOrder(){this._dialogRef.close("ORDER")}onPrintBill(){this._dialogRef.close("BILL")}static \u0275fac=function(e){return new(e||o)(m(j))};static \u0275cmp=w({type:o,selectors:[["POS-modal-print"]],standalone:!1,decls:17,vars:1,consts:[[3,"onCancel","onClose","config"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg","me-1",3,"click"],["src","//res.cloudinary.com/pos/image/upload/v1650423915/icons/order.png"],[1,"mt-1"],[1,"mt-0"],[1,"btn","btn-gray","btn-lg","ms-1",3,"click"],["src","//res.cloudinary.com/pos/image/upload/v1650423915/icons/bill.png",2,"width","23px"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onCancel",function(){return i._dialogRef.close()})("onClose",function(){return i._dialogRef.close()}),r(1,"content")(2,"div",1)(3,"a",2),g("click",function(){return i.onPrintOrder()}),C(4,"img",3),r(5,"h4",4),d(6,"Order"),a(),r(7,"div",5),d(8,"For order for the kitchen"),a()(),r(9,"a",6),g("click",function(){return i.onPrintBill()}),C(10,"img",7),r(11,"h4",4),d(12,"Bill"),a(),r(13,"div",5),d(14,"To see amount of the bill"),a(),r(15,"div",5),d(16,"(Pre-settlement bill)"),a()()()()()),e&2&&p("config",i.modalConfig)},dependencies:[U],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.btn-gray[_ngcontent-%COMP%]{background-color:#f4f4f4;border:1px solid #D6D6D6;font-weight:700;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}.btn[_ngcontent-%COMP%]{padding:8px 0;width:190px;margin-right:10px}.btn[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{font-weight:700;text-transform:uppercase}.btn[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{font-size:.75rem;font-style:italic;color:#868686;margin-top:10px}"]})};var Ha=o=>({"mat-tab-group-height":o});function Ua(o,t){if(o&1){let e=v();r(0,"div",2)(1,"div",6)(2,"span",7),C(3,"i",8),a(),r(4,"input",9),D("ngModelChange",function(n){u(e);let l=c();return M(l.filter,n)||(l.filter=n),f(n)}),a()()()}if(o&2){let e=c();s(4),P("ngModel",e.filter)}}function Wa(o,t){if(o&1&&(r(0,"h5",14),C(1,"i"),r(2,"span"),d(3),a()()),o&2){let e=c().$implicit;s(),he(e.Icon),s(2),T(e.Name)}}function Qa(o,t){if(o&1){let e=v();r(0,"div",13)(1,"park-card",15),g("onSelect",function(){let n=u(e).$implicit,l=c(2);return f(l.onSelect(n))}),a()()}if(o&2){let e,i=t.$implicit,n=c().$implicit,l=c();s(),p("title",l.replaceWithAlias()&&i.Alias?i.Alias:i.Name)("alias",i.Alias)("isOccupied",i.IsOccupied)("icon",n.Icon)("selected",((e=l.parkOptionSelected())==null?null:e.Name)===i.Name)}}function qa(o,t){if(o&1&&(r(0,"mat-tab",4),_(1,Wa,4,3,"ng-template",10),r(2,"div",11)(3,"div",12),si(4,Qa,2,5,"div",13,li),b(6,"Filter"),a()()()),o&2){let e=t.$implicit,i=c();p("label",e.Name),s(4),ci(Ge(6,1,e.Options,i.filter(),"Name"))}}function $a(o,t){if(o&1){let e=v();r(0,"div",5)(1,"POS-tinymce-editor",16),D("ngModelChange",function(n){u(e);let l=c();return M(l.parkNote,n)||(l.parkNote=n),f(n)}),a()()}if(o&2){let e=c();s(),P("ngModel",e.parkNote)}}var zt=class o{constructor(t){this.data=t;this.parkLayout.set(t.parkLayoutPack),this.replaceWithAlias.set(t.replaceWithAlias),this.initModalConfig(),this.showInputNote.set(this.posService.Data?.AppConfigJSON?.ApplicationParkAndRetrieve?.NumberOfPerson)}dialog=ie(re);dialogRef=ie(j);orderProcessorService=ie(W);salesOrderService=ie(N);posService=ie(L);modalConfig=new H;filter=V("");parkLayout=V(null);parkOptionSelected=V(null);replaceWithAlias=V(!1);showInputNote=V(!1);parkNote=V("");initModalConfig(){this.modalConfig.title=this.data.title||"Park Order",this.modalConfig.customWidth="700px",this.modalConfig.bodyScrollable=!0,this.modalConfig.okText=" Park "}onSelect(t){this.parkOptionSelected.set(t)}onOk(){this.showInputNote()&&(this.parkOptionSelected().Note=this.parkNote()),this.dialogRef.close(this.parkOptionSelected())}onCancel(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||o)(m(Ae))};static \u0275cmp=w({type:o,selectors:[["app-modal-park"]],decls:8,vars:6,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container",2,"max-height","395px","min-height","395px"],[1,"search-container"],["mat-stretch-tabs","false",1,"mt-2",3,"ngClass"],[3,"label"],[1,"mt-4"],[1,"input-group","w-100"],[1,"input-group-text","txtFilter","rounded-start-1"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["type","text","placeholder","Search by number or note","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded","rounded-start-0",3,"ngModelChange","ngModel"],["mat-tab-label",""],[1,"container","mt-5"],[1,"row"],[1,"col-3","mb-4","px-2"],[1,"d-flex","align-items-center","gap-3"],[3,"onSelect","title","alias","isOccupied","icon","selected"],["height","180px","placeholder","Input the park note (E.g. this is for Mr. John)",3,"ngModelChange","ngModel"]],template:function(e,i){if(e&1&&(r(0,"modal-material",0),g("keydown.F2",function(){return i.onOk()})("onOk",function(){return i.onOk()})("onCancel",function(){return i.onCancel()})("onClose",function(){return i.onCancel()}),r(1,"content")(2,"div",1),_(3,Ua,5,1,"div",2),r(4,"mat-tab-group",3),si(5,qa,7,5,"mat-tab",4,li),a(),_(7,$a,2,1,"div",5),a()()()),e&2){let n,l,h;p("config",i.modalConfig),s(3),E(((n=i.parkLayout().Layout)==null?null:n.length)>0?3:-1),s(),p("ngClass",R(4,Ha,i.showInputNote()&&((l=i.parkOptionSelected())==null?null:l.Name))),s(),ci(i.parkLayout().Layout),s(2),E(i.showInputNote()&&((h=i.parkOptionSelected())!=null&&h.Name)?7:-1)}},dependencies:[X,q,ve,U,Vr,Ut,dr,fe,te,K,oe,Ht,wi,vt,St,qt,dt],styles:["[_nghost-%COMP%] .mat-mdc-tab-group[_ngcontent-%COMP%]{--mdc-tab-indicator-active-indicator-color: #89b03e;--mat-tab-header-focus-indicator-color: #89b03e;--mat-tab-header-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-hover-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-indicator-color: #89b03e;--mat-tab-header-active-hover-indicator-color: #89b03e}[_nghost-%COMP%] .mat-mdc-tab-header{border-bottom:1px solid var(--bs-border-color)}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%]{transition:all .3s ease}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]{position:relative;transition:all .3s ease;height:2.3rem}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover, [_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e4d,0 0 8px 4px #89b03e33;border-radius:4px}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]{transition:all .3s ease;border-left:none!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]:focus{box-shadow:none!important;border-color:#ced4da!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .input-group-text[_ngcontent-%COMP%]{transition:all .3s ease;background-color:#fff;border-right:none!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .input-group-text[_ngcontent-%COMP%], [_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .input-group-text[_ngcontent-%COMP%]{background-color:#89b03e1a;border-color:#84cc16!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .fa-magnifying-glass[_ngcontent-%COMP%]{transition:all .3s ease}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .fa-magnifying-glass[_ngcontent-%COMP%], [_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .fa-magnifying-glass[_ngcontent-%COMP%]{color:#84cc16!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e66,0 0 12px 6px #89b03e40!important}[_nghost-%COMP%] .mat-tab-group-height[_ngcontent-%COMP%]{height:165px}"]})};var an=class o{constructor(t,e,i,n,l,h,A,le,Te){this.dialogRef=t;this.parkOrderRetrieve=e;this._orderDataService=i;this._posHttpResponseService=n;this._orderProcessorService=l;this._orderHttpService=h;this._dialog=A;this._outletRegisterService=le;this.parkService=Te;this.salesOrderData=this._orderDataService.Data,this.appConfig=this._posHttpResponseService.Data.AppConfigJSON,this.parkLayoutPack=this._outletRegisterService.Data.ParkLayoutPack}modalConfig=new H;salesOrderData;appConfig;parkLayoutPack;ngOnInit(){this.modalConfig.title="Re-Park Order?",this.modalConfig.hideFooter=!0}onRepark(){this.parkService.park(this.parkOrderRetrieve).subscribe(t=>{this.dialogRef.close()})}onMove(){this.dialogRef.close(),this.showParkSelectModal()}showParkSelectModal(){this._orderHttpService.getVacant(this.salesOrderData.Order.EntityID).subscribe(t=>{this._dialog.open(zt,{data:{title:this.title,parkLayoutPack:this.parkLayoutPack,replaceWithAlias:this.appConfig.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias}})})}get title(){return this._orderProcessorService.Data.posState==5?"Split Order":this.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle}static \u0275fac=function(e){return new(e||o)(m(j),m(Ae),m(N),m(L),m(W),m(Pe),m(re),m(Y),m(ke))};static \u0275cmp=w({type:o,selectors:[["POS-modal-repark"]],standalone:!1,decls:13,vars:2,consts:[[3,"onClose","onCancel","title","config"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg",3,"click"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onClose",function(){return i.dialogRef.close()})("onCancel",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"a",2),g("click",function(){return i.onRepark()}),r(4,"h4"),d(5,"Re-Park"),a(),r(6,"span"),d(7,"Store order to same location"),a()(),r(8,"a",2),g("click",function(){return i.onMove()}),r(9,"h4"),d(10,"Move"),a(),r(11,"span"),d(12,"Shift order to Different location"),a()()()()()),e&2&&p("title","Re-Park Order?")("config",i.modalConfig)},dependencies:[U],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.btn-gray[_ngcontent-%COMP%]{background-color:#f4f4f4;border:1px solid #D6D6D6;font-weight:700;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}.btn[_ngcontent-%COMP%]{padding:25px 0;width:190px;margin-right:10px}.btn[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{font-weight:700;text-transform:uppercase}.btn[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.75rem;font-style:italic;color:#868686;margin-top:10px}"]})};var Kt=class{Name;Alias;IsOccupied;Note};var ln=class{_point;get point(){return this._point}set point(t){this._point=t}_pricebookID;get pricebookID(){return this._pricebookID}set pricebookID(t){this._pricebookID=t}_discountRate;get discountRate(){return this._discountRate}set discountRate(t){this._discountRate=t}_groups;get groups(){return this._groups}set groups(t){this._groups=t}_salesID;get salesID(){return this._salesID}set salesID(t){this._salesID=t}_dueDays;get dueDays(){return this._dueDays}set dueDays(t){this._dueDays=t}_expiryDate;get expiryDate(){return this._expiryDate}set expiryDate(t){this._expiryDate=t}_debt;get debt(){return this._debt}set debt(t){this._debt=t}_expirtedString;get expirtedString(){return this._expirtedString}set expirtedString(t){this._expirtedString=t}_loyaltyDisabled;get loyaltyDisabled(){return this._loyaltyDisabled}set loyaltyDisabled(t){this._loyaltyDisabled=t}_taxTypeID;get taxTypeID(){return this._taxTypeID}set taxTypeID(t){this._taxTypeID=t}_entityID;get entityID(){return this._entityID}set entityID(t){this._entityID=t}_mobile;get mobile(){return this._mobile}set mobile(t){this._mobile=t}_email;get email(){return this._email}set email(t){this._email=t}_dueMonths;get dueMonths(){return this._dueMonths}set dueMonths(t){this._dueMonths=t}_memberIdentification;get memberIdentification(){return this._memberIdentification}set memberIdentification(t){this._memberIdentification=t}};var Ci=class{OutletName;Status;AmountSummary;Coupon;Creator;CurrencySymbol;Customer;Date;Delivery;ExtraNote;FinalAmount;InvoiceNote;Items;LoyaltyPoint;Payments;PrintDate;RegisterCode;SalesOrderItemCommission;Shipping;Title;TypeName;PaymentState;ToP;Due;InvoiceID;Gopay;Number;Created;SalesName;ParkLabel;HeaderTitle;QRContent;Retur;AfterSell;constructor(){this.OutletName="",this.Status=1,this.AmountSummary=[],this.Coupon="",this.Creator="",this.CurrencySymbol="",this.Customer=new ln,this.Date="",this.Delivery={Number:""},this.ExtraNote="",this.FinalAmount=0,this.InvoiceNote="",this.Items=[],this.LoyaltyPoint="",this.Payments=[],this.PrintDate="",this.RegisterCode="",this.SalesOrderItemCommission={SalesName:""},this.Shipping=new fi,this.Title="",this.TypeName="",this.PaymentState=0,this.InvoiceID="",this.Number="",this.Created="",this.AfterSell=!0}};var Yt=class{LayoutPack;constructor(t){this.LayoutPack=t,this.GenerateLayoutOption()}GenerateLayoutOption(){this.LayoutPack!=null&&this.LayoutPack.Layout&&this.LayoutPack.Layout.forEach(t=>{t.Options=[];for(let e=1;e<=t.Size;e++){let i=new Kt;i.Name=t.Name+e,i.Alias=this.GetAlias(i.Name),t.Options.push(i)}})}GetAlias(t){if(this.LayoutPack!=null&&this.LayoutPack.Alias){let e=this.LayoutPack.Alias.filter(i=>i.Name==t);return e.length>0?e[0].Alias:t}return""}};var sn=class{ExtraNote;Title;Customer;SalesName;InvoiceNote;Date;Items;AmountSummary;Creator;NumberOfPerson;CurrencySymbol;constructor(){this.ExtraNote="",this.Title="",this.Customer="",this.SalesName="",this.InvoiceNote="",this.Date="",this.Items=[],this.AmountSummary=[],this.Creator="",this.NumberOfPerson=0,this.CurrencySymbol="Rp"}};var cn=class{AmountSummary;Contact;ContactDisplay;CurrencySymbol;FinalAmount;HeaderTitle;Invoice;IsPrice;Items;LoyaltyPoint;Order;Payments;PriceVisible;PrintPerson;PrintTime;SalesName;Shipping;TotalInWord};var Ot=class o{constructor(t,e,i,n,l,h,A,le){this._posService=t;this._orderDataService=e;this._cashierCalculatorService=i;this._outletService=n;this._OrderHttpService=l;this._receiptCalculatorService=h;this._orderProcessorService=A;this._customerHttpService=le;this.subscribeToObservableChanges()}posData;completeData;park=new Yt(null);outletInfo=new Bi;datePipe=new We("en-US");ParkTemp=Array();CartItems=[];get posStorage(){return this._posService.Data}get AppConfigJSON(){return this._posService.Data.AppConfigJSON}subscribeToObservableChanges(){this._orderDataService.Data$.subscribe(t=>{this.posData=t}),this._OrderHttpService.Data$.subscribe(t=>{this.completeData=t}),this._outletService.Data$.subscribe(t=>{this.outletInfo=t}),this._orderProcessorService.Data$.subscribe(t=>{this.ParkTemp=t.parkTemporaryItem})}generateReceiptMini(){let t=new Ci;t.HeaderTitle=this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,t.OutletName=this.outletInfo.EntityName,t.ExtraNote=this.getParkLabel(),t.Customer=this.getSubmitedCustomer(),t.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),t.SalesOrderItemCommission={SalesName:this._outletService.getSalesname(this.posData.Order.SalesID)},t.Number=this.completeData?.InvoiceNumber,t.FinalAmount=this.completeData?.Final,t.InvoiceNote=this.posData.Order.Note,t.RegisterCode=this.outletInfo.RegisterCode==null?"":this.outletInfo.RegisterCode,t.QRContent=this.generateQrContent(),t.InvoiceID=this.completeData?.ObjectID,t.Retur=S.IsNotEmpty(this.posData?.Invoice?.ReferenceInvoiceID),t.Date=this.getSubmitedOrderDate(),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoiceCreatedTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy")),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.OrderTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm:ss")),this.posData.CartItems.forEach(i=>{i.SalesID&&(i.SalesName=this._outletService.getSalesname(i.SalesID))}),t.Items=this.posData.CartItems,t.Customer!=null&&t.Customer.Display!=null&&t.Customer.Display!=null&&t.Customer.Display!=null&&(t.Customer={ID:this.posData.Order.CustomerID,Display:this.posData.ContactName,Email:t.Customer.Email,CityName:null,Address:t.Customer.Address,Code:t.Customer.Code,Name:t.Customer.Name,Phone:t.Customer.Phone,Mobile:t.Customer.Mobile,NationalIDNumber:t.Customer.NationalIDNumber,Title:t.Customer.Title}),t.Delivery={Number:this.posData.Order.Number};let e=S.FilterByID(this.posStorage.PoTypes,this.posData.Order.TypeID);if(e!==null&&(t.TypeName=e.Name),t.Shipping=this.generateShippingData(),this.AppConfigJSON.PrintConfigInvoice.ItemsTable.ItemWithoutPriceVisible||(t.Items=t.Items.filter(i=>i.Price!=0)),t.Coupon=this.posData.Order.PromotionCoupon,t.LoyaltyPoint=this.completeData?this.completeData.LoyaltyPoint:"",t.FinalAmount=this._cashierCalculatorService.Data,t.CurrencySymbol=this._cashierCalculatorService.currencySymbol,t.PaymentState=this.getPaymentState(),t.Payments=this.posData.Payments,t.Payments.forEach(i=>{i.MethodName=this.findPaymentName(i.MethodID)}),t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t.Creator=this.completeData?.Creator?this.completeData?.Creator:this.posStorage?.UserName,this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoicePaymentTermsVisible&&this.posData.Payments.length==0){let i=this.posData.Invoice.Due?new Date(this.posData.Invoice.Due):null,n=new Date(this.posData.Order.Date);n.setHours(0,0,0,0),t.ToP=this.generateTop(n,i),this.posData.Invoice.Due!==void 0&&(t.Due=this.datePipe.transform(new Date(this.posData.Invoice.Due),"dd MMMM yyyy"))}return t}generateQrContent(){let t="";if(this.AppConfigJSON?.PrintConfigInvoice?.InvoiceQR?.TransformTo==3){let i=this.AppConfigJSON?.PrintConfigInvoice?.InvoiceQR?.Content,n=this.posData?.Order?.Number,l=this.completeData.ObjectID,h=window?.location?.host;switch(i){case 2:t=l;break;case 1:t=n;break;case 3:t=`receipt.dealpos.app?Data=${btoa(`${l}_${h}`)}`;break}}return t}generateShippingData(){return{City:this.posData.Shipping!==null?this.posData.Shipping.City:null,Description:this.posData.Shipping!==null?this.posData.Shipping.Address:null,ID:null,Phone:this.posData.Shipping!==null?this.posData.Shipping.Phone:null,Recipient:this.posData.Shipping!==null?this.posData.Shipping.Name:null,SalesOrderID:null,Sender:null,SenderAddress:null,SenderCity:null,SenderPhone:null,Street:null}}generateParkReceipt(t=!0,e=!1){let i=new sn;if(i.ExtraNote=S.StringFormat("{0} #{1}",this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.NumberPrefix,this.GetSubmittedNumber()),i.Title=this.getParkLabel(),i.Customer=this.getSubmitedCustomer(),i.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),i.InvoiceNote=this.posData.Order.Note,i.Date=this.getSubmitedOrderDate(),i.CurrencySymbol=this._cashierCalculatorService.currencySymbol,this.getItemsParkReceipt(t,e),i.Items=this.CartItems,i.Creator=this.posStorage.UserName,i.NumberOfPerson=this.posData.Order.NumberOfPerson,this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.AmountVisible){let n=JSON.parse(JSON.stringify(this._receiptCalculatorService.generateAmountSummary()));i.AmountSummary=n}return i}getItemsParkReceipt(t,e){let i=nt(Be,this.posData.CartItems);if(e){let n=this.posData.CartItems.filter(l=>S.IsNotEmpty(l.SplitQuantity)&&l.SplitQuantity>0);this.CartItems=n.map(l=>(l.Quantity=l.SplitQuantity,l))}else if(t&&this.AppConfigJSON.ApplicationParkAndRetrieve.PrintBehaviour.PrintAdditionalItemsOnlyOnRePark)if(this.CartItems=Array(),this.ParkTemp.length>0)for(let n of i){let l=this.ParkTemp.find(h=>h.ID==n.ID);l==null?this.CartItems.push(n):n.Quantity!=l.Quantity&&(n.Quantity=n.Quantity-l.Quantity,this.CartItems.push(n))}else this.CartItems=i;else this.CartItems=i}generateBillInvoice(){let t=new cn;return t.ContactDisplay=this.posData.ContactName,t.Invoice=this.posData.Invoice,t.Order=this.posData.Order,t.Payments=this.posData.Payments,t.Shipping=this.posData.Shipping,t.CurrencySymbol=this._cashierCalculatorService.currencySymbol,t.FinalAmount=this._cashierCalculatorService.Data,t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t.Contact=this.getSubmitedCustomer(),t.Items=this.getItemsBillInvoice(),t.PrintTime=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm"),t.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),t.HeaderTitle=this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,t.Invoice.Number=`#${this.posData.Order.Number}`,t.Invoice.Date=new Date,t.Invoice.PaymentStateID=1,t.Invoice.Note=this.posData.Order.Note,t.PrintPerson="",t.IsPrice=!0,t.PriceVisible=!0,t}getItemsBillInvoice(){return this.posData.CartItems.map(e=>({Name:e.Variant.Name,Quantity:e.Quantity,Code:e.Variant.Code,UnitPrice:e.Price,Discount:e.Discount,UOMName:e.Variant.UOMName,Total:e.Total,Note:e.Note}))}generateBillReceipt(){let t=new Ci;t.HeaderTitle=this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,t.ParkLabel=this.posData.Order.ParkLabel,t.OutletName=this.outletInfo.EntityName,t.ExtraNote=this.getParkLabel(),t.Customer=this._customerHttpService.Data,t.SalesOrderItemCommission.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),t.Number=this.posData.Order.Number,t.FinalAmount=this._cashierCalculatorService.Data,t.InvoiceNote=this.posData.Order.Note,t.Date=this.datePipe.transform(this.posData.Order.Date,"dd MMM yyyy"),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoiceCreatedTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy")),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.OrderTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm:ss")),t.Items=this.posData.CartItems,t.Customer.ID=this.posData.Order.CustomerID,t.Customer.Name=this.posData.ContactName,t.Customer.Display=this.posData.ContactName,t.Customer.Mobile&&t.Customer.Mobile.length==1&&(t.Customer.Mobile=null),t.Delivery={Number:this.posData.Order.Number};let e=S.FilterByID(this.posStorage.PoTypes,this.posData.Order.TypeID);return e!==null&&(t.TypeName=e.Name),t.Shipping=this.generateShippingData(),this.AppConfigJSON.PrintConfigInvoice.ItemsTable.ItemWithoutPriceVisible||(t.Items=t.Items.filter(i=>i.Price!=0)),t.Coupon=this.posData.Order.PromotionCoupon,t.PaymentState=this.getPaymentState(),t.Payments=this.posData.Payments,t.Payments=t.Payments.map(i=>(i.MethodName=this.findPaymentName(i.MethodID),i)),t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t}getPaymentState(){let t=this.AppConfigJSON?.ModuleSell?.ToleranceAmount,e=this.posData.Payments,i=this.posData.TotalPaidAmount,n=this._cashierCalculatorService.Data,l=1;e?.length>0&&i<n&&(l=2);let h=i-n;return(Math.abs(h)<=t||h>=0)&&(l=3),l}generateTop(t,e){let i=new Date(e),n=new Date(t),l=i.getTime()-n.getTime();return Math.floor(l/(1e3*3600*24))}getSubmitedOrderDate(){let t=this.posData.Order?.Date,e=this.AppConfigJSON.PrintConfigInvoice?.DocumentVisibility?.OrderTimeVisible,i="",n=new Date;if(e){let l=new Date(t);l.setHours(n.getHours()),l.setMinutes(n.getMinutes()),i=this.datePipe.transform(l,"dd MMM yyyy HH:mm")}else i=this.datePipe.transform(t,"dd MMM yyyy");return i}getSubmitedCustomer(){return S.IsEmpty(this.completeData)?{}:this.completeData.Contact}getParkLabel(){let t=this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.LabelPrefix,e=this.AppConfigJSON.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,i=this.posData.Order.ParkLabel;if(S.IsNotEmpty(this.posData.SplitParkLabel)&&(i=this.posData.SplitParkLabel),e&&S.IsNotEmpty(i)){let n=this.park.GetAlias(i);i=n||i}return i?S.IsEmpty(t)?i:S.StringFormat("{0} # {1}",t,i):""}GetSubmittedNumber(){return S.IsNotEmpty(this.completeData)?this.completeData.InvoiceNumber:this.posData.Invoice.Number?this.posData.Invoice.Number:this.posData.Order.Number}generateCartItemSummary(){let t=[];for(let e of this.posData.CartItems)t.push(new Hi(e.Total,this._cashierCalculatorService.currencySymbol,e.Variant.Name,1));return t}generatePaymentSummary(){let t=[],e;for(let n=0;n<this.posData.Payments.length;n++){let l="Payment"+(n+1);this.AppConfigJSON.PrintConfigInvoice.Footer.PaymentMethodVisible&&(l=this.findPaymentName(Number(this.posData.Payments[n].MethodID))),e=new Hi(this.posData.Payments[n].PaidAmount,this._cashierCalculatorService.currencySymbol,l,1),t.push(e)}let i=this.generateChangeSummary();return i!==null&&t.push(i),t}generateChangeSummary(){let t=this._cashierCalculatorService.currencySymbol,e=this._cashierCalculatorService.Data,i=this.posData.TotalPaidAmount,n=0,l=null;return n=i-e,n>0&&(l=new Hi(n,t,"Change",1)),l}findPaymentName(t){return this._outletService.Data.Payments.find(e=>e.ID==t).Name}printWindow(){return ho(this,null,function*(){return new Promise(t=>{setTimeout(()=>{window.print(),t()},500)})})}static \u0275fac=function(e){return new(e||o)(B(L),B(N),B(Me),B(Y),B(Pe),B(Ui),B(W),B(pt))};static \u0275prov=rt({token:o,factory:o.\u0275fac,providedIn:"root"})};var ke=class o{constructor(t,e,i,n,l,h,A,le,Te,Fe){this.httpService=t;this.receiptService=e;this.orderProcessorService=i;this.pageInitialService=n;this.salesOrderService=l;this.toastrService=h;this.promotionEventService=A;this.outletService=le;this.orderHttpService=Te;this.dialog=Fe;this._onPrint=new G,this.onPrint$=this._onPrint.asObservable(),this.subscribeToObservable()}_onPrint;onPrint$;parkOrderRetrieve;subscribeToObservable(){this.orderProcessorService.Data$.subscribe(t=>{(t.posState==3||t.posState==5)&&this.emitParkReceipt(!0,t.posState==5)})}getParkedOrder(t,e){return this.httpService.get(_e.GetPark,[{key:"EntityID",value:t},{key:"RegisterID",value:e}])}removeOrder(t,e){let i={OrderID:t};return e?this.httpService.post(_e.VoidPark,i):this.httpService.post(_e.RemovePark,i)}mergePark(t){return this.httpService.post(_e.MergePark,t)}getOutstanding(t){let e={EntityID:t};return this.httpService.post(_e.GetOutStanding,e)}splitOrder(t){return this.httpService.post(_e.SplitOrder,t)}park(t){let e=nt(ct,this.salesOrderService.Data);if(this.promotionEventService.selectedPromotion){this.clearPromotionAppliedInPark();return}e.Action.DeliveryEntityID=S.GuidEmpty,e.Action.Type=1,t.ParkLabel!=null&&(e.Order.ParkLabel=t.ParkLabel),e.Order.Note=t.Note,e.Order.InvoicedStateID=1,S.IsNotEmpty(t.ID)&&(e.Order.ID=t.ID),this.salesOrderService.pushNewValue(e);let i=this.orderHttpService.generatePOSDataForSubmission(e);return this.httpService.post(_e.ParkOrder,i).pipe(Ne(n=>{this.orderProcessorService.updatePosState(3,n),this.orderProcessorService.createNewTransactionInSameOutletRegister()}))}clearPromotionAppliedInPark(){this.dialog.open(Rr,{id:"modal-promotion-confirm",data:{message:`
|
|
1
|
+
import{a as Vr}from"./chunk-APF7PDRI.js";import{a as lo}from"./chunk-6AMPRFEN.js";import{b as sa,c as ca}from"./chunk-OYSMMJMB.js";import{a as ma,b as ua}from"./chunk-ROQHG6JX.js";import{a as aa,b as la}from"./chunk-SZPU2EUQ.js";import{a as kt}from"./chunk-ECOW7JD7.js";import{a as ra}from"./chunk-6PGUQ3CR.js";import{a as Zi}from"./chunk-TBHZV7EF.js";import"./chunk-2YDEXJE5.js";import"./chunk-NQX7EX5A.js";import"./chunk-BYXBJQAS.js";import{a as gi}from"./chunk-YIKW3UR6.js";import{a as ea}from"./chunk-XPZUZ5XJ.js";import{b as ta,e as ia,f as na,g as oa}from"./chunk-I3ZGST4N.js";import"./chunk-EWZ63XSS.js";import"./chunk-P3KIIKY4.js";import{a as fa}from"./chunk-HBAQBI6Z.js";import{A as Ur,B as zi,C as $t,D as Ki,E as Jr,F as Gr,G as Xi,H as Xr,I as Zr,a as Mr,b as ct,c as wr,d as Pe,e as N,f as L,g as kr,h as de,i as Tr,j as Er,k as Y,l as Rr,m as Nr,n as Me,o as Xe,p as xt,q as De,r as Qt,s as ji,t as Hi,u as Ui,v as Wi,w as ao,x as Qi,y as W,z as Hr}from"./chunk-MRF4FND7.js";import"./chunk-YXCPHYC5.js";import"./chunk-JFLT7NX3.js";import"./chunk-QUHI6RHC.js";import{a as Lr,b as Br,c as Fr,d as $i}from"./chunk-WPFMJVWU.js";import"./chunk-YTGZYBEI.js";import"./chunk-OKIBXXRJ.js";import{a as qe,b as pt}from"./chunk-5MPRE3II.js";import{a as Dr,b as qr,c as $r}from"./chunk-H3ARLDNZ.js";import{a as Fi}from"./chunk-NJS6IQX6.js";import{a as Yr}from"./chunk-5M3JINH2.js";import{a as Ie,c as Bi}from"./chunk-C2KD7R6L.js";import{a as ro}from"./chunk-PF33HK6M.js";import"./chunk-YNDNTAII.js";import{a as oo}from"./chunk-4SKJU2FQ.js";import{a as Ar,b as qi}from"./chunk-XYZNPGYI.js";import{a as Yi,b as zr,c as Kr}from"./chunk-BKUC3UED.js";import"./chunk-O2QTP22K.js";import"./chunk-YRGGDRUH.js";import"./chunk-5UDUWK67.js";import{a as dt,b as qt}from"./chunk-OISKO6QJ.js";import"./chunk-M3HHWYKD.js";import{b as da}from"./chunk-ZTHPT62A.js";import{a as Or}from"./chunk-4USQPLEW.js";import"./chunk-J6U6UYNI.js";import{b as Be}from"./chunk-AEHOR4RJ.js";import"./chunk-Z3E24JZW.js";import"./chunk-BYXBJQAS.js";import{c as fi}from"./chunk-7IDMO3VZ.js";import{a as Ni}from"./chunk-NQKVYQ6V.js";import{b as Vi,c as nt}from"./chunk-HT35KHLT.js";import{a as Ai,b as Li}from"./chunk-DAIHPIA2.js";import{a as Pr}from"./chunk-BXQFYW4R.js";import"./chunk-AZO64X7U.js";import"./chunk-BYXBJQAS.js";import{a as Ri}from"./chunk-XKUQPHUA.js";import{a as xr,b as Ir}from"./chunk-Q4CKRRGM.js";import"./chunk-PIYM2FOP.js";import"./chunk-2OWHEMAL.js";import"./chunk-XZELBTQR.js";import{b as wi,c as vt,d as St,e as Ht}from"./chunk-T26KVRGE.js";import{a as pa,b as en}from"./chunk-MH6ADXRE.js";import{a as Wr,b as Qr}from"./chunk-5BE43QU3.js";import{c as Ji,d as Gi}from"./chunk-7BNQDGUO.js";import"./chunk-4HEESH5A.js";import"./chunk-6774R2EL.js";import{a as jr}from"./chunk-MPSML3FA.js";import{e as yr}from"./chunk-IC3DZAMU.js";import"./chunk-YPFMEFOD.js";import"./chunk-3RK6DDJD.js";import"./chunk-FP4HFB5J.js";import"./chunk-DLONNLPI.js";import"./chunk-YEDKRNXU.js";import"./chunk-T2IJ4MCB.js";import"./chunk-7QWJJPNG.js";import{d as Ti,e as Ei}from"./chunk-TVEGYRXE.js";import"./chunk-VHAM2DWK.js";import{a as ar}from"./chunk-WO3LDDSF.js";import{b as vr,c as Sr}from"./chunk-5SOJKVR7.js";import{a as hr,b as br}from"./chunk-5JJSLRVS.js";import{c as tr}from"./chunk-LO3FAFDO.js";import"./chunk-CWITQVZH.js";import"./chunk-QHRP323Q.js";import"./chunk-WDQ4UKKY.js";import{a as ir,d as nr,f as or}from"./chunk-MFCXEITE.js";import{a as ut,c as st}from"./chunk-MUJ6277G.js";import"./chunk-LMJVRREP.js";import"./chunk-3LBZDIW2.js";import"./chunk-KTCV3KOE.js";import"./chunk-KZDE63UL.js";import{a as gr,d as _r,e as Cr}from"./chunk-JDOZFN63.js";import{a as rr,b as lr}from"./chunk-2QVRE7LQ.js";import"./chunk-3GOO5E5D.js";import{a as Yo}from"./chunk-XMYLHF4C.js";import{C as fr,D as Ye,F as Wt,G as yt,u as H,v as U,w as ve}from"./chunk-EFDAS2KA.js";import{b as ce,c as Ke}from"./chunk-JOXTERIM.js";import{F as ur,N as Ut,O as _e,a as sr,b as cr,n as ki,t as pr,u as dr,x as mr}from"./chunk-46DETXA6.js";import{d as mt}from"./chunk-XYB3YDKL.js";import{a as Uo}from"./chunk-6ZN7JR6K.js";import"./chunk-GIKR6Y2K.js";import{e as j,f as Ae,g as re}from"./chunk-3YKVLHZG.js";import{M as Xo,Z as Zo,_ as er}from"./chunk-ZHY3BUQJ.js";import"./chunk-VFTGIP5A.js";import"./chunk-LE3BKIDY.js";import{a as Le}from"./chunk-2FWFPV5I.js";import"./chunk-EEEAUYZ6.js";import{A as Bt,D as zo,F as fe,G as ze,a as Wo,b as Lt,c as te,d as Qo,e as ui,g as qo,h as K,j as $o,l as ht,m as Jo,o as oe,r as Go,s as bt}from"./chunk-RVXZOIFQ.js";import{a as At,c as jt}from"./chunk-CUNZPCNX.js";import{a as Ko}from"./chunk-MUWBVOJI.js";import{a as S,d as Ft}from"./chunk-ZZGSAFGO.js";import"./chunk-LJXYWJZW.js";import{$a as s,$b as xe,Ab as io,Ac as x,Ba as Oo,Bc as ne,Cc as Ge,Db as E,E as se,Eb as li,Fa as He,Fc as J,Gb as si,Hb as ci,I as ai,Ib as r,Ja as Ii,Jb as a,Ka as Po,Kb as C,Kc as No,Lb as I,M as yo,Ma as V,Mb as O,Md as jo,N as Et,Nb as pi,Ob as v,Od as Ho,Pc as Vo,Qb as g,Qd as Ct,Rb as c,Rd as Nt,Sc as Ao,Td as Vt,Ub as di,Va as Oi,Vb as To,Vd as ee,Wa as tt,Wc as q,Y as Rt,Yc as be,Yd as Qe,Za as it,Zb as Se,Zc as z,_b as ye,aa as Re,ad as Lo,bc as Eo,bd as Di,c as bo,cb as Mo,cc as Ro,cd as Ve,d as G,da as k,db as m,dc as Q,e as Zn,ec as d,ed as We,fa as Ne,fc as T,gb as Do,gc as y,gd as Z,hc as Ue,ia as xo,id as Bo,ja as rt,jc as P,jd as X,k as vo,ka as gt,kb as w,kc as M,lb as _t,lc as D,ma as B,mb as Pi,mc as no,md as Fo,na as ie,o as eo,ob as Mi,pc as at,qb as _,qc as lt,rc as R,sc as me,t as et,tc as mi,u as xi,ua as Io,ub as wo,va as u,vb as p,wa as f,wb as to,xb as ko,z as So,zb as he,zc as b}from"./chunk-UXRO4UFY.js";import{j as ho}from"./chunk-7DCB7DB2.js";var tn=class{ID;Code;Name;Title;Field;Address;ContactInfo;Logo;FooterLeft;FooterRight;FooterNote;PrintMode;PrintLX300;DeliveryNote;AppendQR;ItemRenderMode;CssClass;RemoveImage;DisplayName;DisplayNameCode};var Jt=class{ParkLabel;Note;NumberOfPerson;ID;Alias;Created;CustomerDisplay;Number;Duration};var nn=class o{constructor(t,e,i,n,l,h){this.dialogRef=t;this._orderProcessorService=e;this._posService=i;this.salesOrderService=n;this.parkService=l;this.data=h;this.initModalDialog(),this.initConfig(),this.parkLabel=h.ParkLabel,this.form.ParkLabel=h.ParkLabel,this.form.Note=n.Data.Order.Note}modalConfig=new H;labelPlaceholder;form=new Jt;parkLabel;initConfig(){let t=this._posService.Data.AppConfigJSON;this.labelPlaceholder=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkLabelPlaceholder}initModalDialog(){this.modalConfig.title=this.data.title,this.modalConfig.customWidth="600px"}onOk(){this.setParkTitle(),this.parkService.park(this.form).subscribe(t=>{this.dialogRef.close(!0)})}setParkTitle(){let t=this._orderProcessorService.Data.posState,e=this.salesOrderService.Data.Order.Number;t==5?this.salesOrderService.Data.SplitParkLabel=S.IsEmpty(this.parkLabel)?e:this.parkLabel:S.IsEmpty(this.parkLabel)?this.form.ParkLabel=e:this.form.ParkLabel=this.parkLabel}static \u0275fac=function(e){return new(e||o)(m(j),m(W),m(L),m(N),m(ke),m(Ae))};static \u0275cmp=w({type:o,selectors:[["POS-modal-park-input"]],standalone:!1,decls:17,vars:3,consts:[[3,"onCancel","onOk","onClose","config"],[1,"ods-info-box"],[1,"fas","fa-info-circle",2,"font-size","1.2rem","margin-top","2px"],["href","https://ods.dealpos.app","target","_blank",2,"color","#0d6efd","font-weight","600","text-decoration","underline"],[1,"w-100","mt-4"],[1,"mb-3"],["type","text","required","","placeholder","E.g. Mr. John Doe","matTooltip","Same as Order Number when blank",1,"form-control","w-100","height-input",3,"ngModelChange","ngModel"],["placeholder","ex: Customer will return tommorow",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onCancel",function(){return i.dialogRef.close()})("onOk",function(){return i.onOk()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1),C(3,"i",2),r(4,"div"),d(5," Use our "),r(6,"a",3),d(7," Order Display Fulfillment System "),a(),d(8," to view the Parked Orders from your warehouse area. "),a()(),r(9,"div",4)(10,"strong",5),d(11,"Label"),a(),r(12,"input",6),D("ngModelChange",function(l){return M(i.parkLabel,l)||(i.parkLabel=l),l}),a()(),r(13,"div",4)(14,"strong",5),d(15,"Note"),a(),r(16,"POS-tinymce-editor",7),D("ngModelChange",function(l){return M(i.form.Note,l)||(i.form.Note=l),l}),a()()()()),e&2&&(p("config",i.modalConfig),s(12),P("ngModel",i.parkLabel),s(4),P("ngModel",i.form.Note))},dependencies:[te,K,Bt,oe,U,ce,dt],styles:[".height-input[_ngcontent-%COMP%]{height:36px} ng-select.park-detail>div.ng-select-container{border-radius:0!important}.deposit[_ngcontent-%COMP%] .ng-select{width:auto!important}.ods-info-box[_ngcontent-%COMP%]{background-color:#e8f4fd;border-left:4px solid #0dcaf0;padding:16px 20px;border-radius:8px;font-family:Roboto Slab,sans-serif;color:#055160;display:flex;align-items:flex-start;gap:10px;font-size:14px;max-width:600px;margin:0 auto}"]})};var rn=class o{constructor(t){this._dialogRef=t;this.modalConfig=new H,this.modalConfig.title="Select Print Type",this.modalConfig.hideFooter=!0}modalConfig;onPrintOrder(){this._dialogRef.close("ORDER")}onPrintBill(){this._dialogRef.close("BILL")}static \u0275fac=function(e){return new(e||o)(m(j))};static \u0275cmp=w({type:o,selectors:[["POS-modal-print"]],standalone:!1,decls:17,vars:1,consts:[[3,"onCancel","onClose","config"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg","me-1",3,"click"],["src","//res.cloudinary.com/pos/image/upload/v1650423915/icons/order.png"],[1,"mt-1"],[1,"mt-0"],[1,"btn","btn-gray","btn-lg","ms-1",3,"click"],["src","//res.cloudinary.com/pos/image/upload/v1650423915/icons/bill.png",2,"width","23px"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onCancel",function(){return i._dialogRef.close()})("onClose",function(){return i._dialogRef.close()}),r(1,"content")(2,"div",1)(3,"a",2),g("click",function(){return i.onPrintOrder()}),C(4,"img",3),r(5,"h4",4),d(6,"Order"),a(),r(7,"div",5),d(8,"For order for the kitchen"),a()(),r(9,"a",6),g("click",function(){return i.onPrintBill()}),C(10,"img",7),r(11,"h4",4),d(12,"Bill"),a(),r(13,"div",5),d(14,"To see amount of the bill"),a(),r(15,"div",5),d(16,"(Pre-settlement bill)"),a()()()()()),e&2&&p("config",i.modalConfig)},dependencies:[U],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.btn-gray[_ngcontent-%COMP%]{background-color:#f4f4f4;border:1px solid #D6D6D6;font-weight:700;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}.btn[_ngcontent-%COMP%]{padding:8px 0;width:190px;margin-right:10px}.btn[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{font-weight:700;text-transform:uppercase}.btn[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{font-size:.75rem;font-style:italic;color:#868686;margin-top:10px}"]})};var Ha=o=>({"mat-tab-group-height":o});function Ua(o,t){if(o&1){let e=v();r(0,"div",2)(1,"div",6)(2,"span",7),C(3,"i",8),a(),r(4,"input",9),D("ngModelChange",function(n){u(e);let l=c();return M(l.filter,n)||(l.filter=n),f(n)}),a()()()}if(o&2){let e=c();s(4),P("ngModel",e.filter)}}function Wa(o,t){if(o&1&&(r(0,"h5",14),C(1,"i"),r(2,"span"),d(3),a()()),o&2){let e=c().$implicit;s(),he(e.Icon),s(2),T(e.Name)}}function Qa(o,t){if(o&1){let e=v();r(0,"div",13)(1,"park-card",15),g("onSelect",function(){let n=u(e).$implicit,l=c(2);return f(l.onSelect(n))}),a()()}if(o&2){let e,i=t.$implicit,n=c().$implicit,l=c();s(),p("title",l.replaceWithAlias()&&i.Alias?i.Alias:i.Name)("alias",i.Alias)("isOccupied",i.IsOccupied)("icon",n.Icon)("selected",((e=l.parkOptionSelected())==null?null:e.Name)===i.Name)}}function qa(o,t){if(o&1&&(r(0,"mat-tab",4),_(1,Wa,4,3,"ng-template",10),r(2,"div",11)(3,"div",12),si(4,Qa,2,5,"div",13,li),b(6,"Filter"),a()()()),o&2){let e=t.$implicit,i=c();p("label",e.Name),s(4),ci(Ge(6,1,e.Options,i.filter(),"Name"))}}function $a(o,t){if(o&1){let e=v();r(0,"div",5)(1,"POS-tinymce-editor",16),D("ngModelChange",function(n){u(e);let l=c();return M(l.parkNote,n)||(l.parkNote=n),f(n)}),a()()}if(o&2){let e=c();s(),P("ngModel",e.parkNote)}}var zt=class o{constructor(t){this.data=t;this.parkLayout.set(t.parkLayoutPack),this.replaceWithAlias.set(t.replaceWithAlias),this.initModalConfig(),this.showInputNote.set(this.posService.Data?.AppConfigJSON?.ApplicationParkAndRetrieve?.NumberOfPerson)}dialog=ie(re);dialogRef=ie(j);orderProcessorService=ie(W);salesOrderService=ie(N);posService=ie(L);modalConfig=new H;filter=V("");parkLayout=V(null);parkOptionSelected=V(null);replaceWithAlias=V(!1);showInputNote=V(!1);parkNote=V("");initModalConfig(){this.modalConfig.title=this.data.title||"Park Order",this.modalConfig.customWidth="700px",this.modalConfig.bodyScrollable=!0,this.modalConfig.okText=" Park "}onSelect(t){this.parkOptionSelected.set(t)}onOk(){this.showInputNote()&&(this.parkOptionSelected().Note=this.parkNote()),this.dialogRef.close(this.parkOptionSelected())}onCancel(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||o)(m(Ae))};static \u0275cmp=w({type:o,selectors:[["app-modal-park"]],decls:8,vars:6,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container",2,"max-height","395px","min-height","395px"],[1,"search-container"],["mat-stretch-tabs","false",1,"mt-2",3,"ngClass"],[3,"label"],[1,"mt-4"],[1,"input-group","w-100"],[1,"input-group-text","txtFilter","rounded-start-1"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["type","text","placeholder","Search by number or note","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded","rounded-start-0",3,"ngModelChange","ngModel"],["mat-tab-label",""],[1,"container","mt-5"],[1,"row"],[1,"col-3","mb-4","px-2"],[1,"d-flex","align-items-center","gap-3"],[3,"onSelect","title","alias","isOccupied","icon","selected"],["height","180px","placeholder","Input the park note (E.g. this is for Mr. John)",3,"ngModelChange","ngModel"]],template:function(e,i){if(e&1&&(r(0,"modal-material",0),g("keydown.F2",function(){return i.onOk()})("onOk",function(){return i.onOk()})("onCancel",function(){return i.onCancel()})("onClose",function(){return i.onCancel()}),r(1,"content")(2,"div",1),_(3,Ua,5,1,"div",2),r(4,"mat-tab-group",3),si(5,qa,7,5,"mat-tab",4,li),a(),_(7,$a,2,1,"div",5),a()()()),e&2){let n,l,h;p("config",i.modalConfig),s(3),E(((n=i.parkLayout().Layout)==null?null:n.length)>0?3:-1),s(),p("ngClass",R(4,Ha,i.showInputNote()&&((l=i.parkOptionSelected())==null?null:l.Name))),s(),ci(i.parkLayout().Layout),s(2),E(i.showInputNote()&&((h=i.parkOptionSelected())!=null&&h.Name)?7:-1)}},dependencies:[X,q,ve,U,Vr,Ut,dr,fe,te,K,oe,Ht,wi,vt,St,qt,dt],styles:["[_nghost-%COMP%] .mat-mdc-tab-group[_ngcontent-%COMP%]{--mdc-tab-indicator-active-indicator-color: #89b03e;--mat-tab-header-focus-indicator-color: #89b03e;--mat-tab-header-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-hover-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-indicator-color: #89b03e;--mat-tab-header-active-hover-indicator-color: #89b03e}[_nghost-%COMP%] .mat-mdc-tab-header{border-bottom:1px solid var(--bs-border-color)}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%]{transition:all .3s ease}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]{position:relative;transition:all .3s ease;height:2.3rem}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover, [_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e4d,0 0 8px 4px #89b03e33;border-radius:4px}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]{transition:all .3s ease;border-left:none!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]:focus{box-shadow:none!important;border-color:#ced4da!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .input-group-text[_ngcontent-%COMP%]{transition:all .3s ease;background-color:#fff;border-right:none!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .input-group-text[_ngcontent-%COMP%], [_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .input-group-text[_ngcontent-%COMP%]{background-color:#89b03e1a;border-color:#84cc16!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .fa-magnifying-glass[_ngcontent-%COMP%]{transition:all .3s ease}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .fa-magnifying-glass[_ngcontent-%COMP%], [_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .fa-magnifying-glass[_ngcontent-%COMP%]{color:#84cc16!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e66,0 0 12px 6px #89b03e40!important}[_nghost-%COMP%] .mat-tab-group-height[_ngcontent-%COMP%]{height:165px}"]})};var an=class o{constructor(t,e,i,n,l,h,A,le,Te){this.dialogRef=t;this.parkOrderRetrieve=e;this._orderDataService=i;this._posHttpResponseService=n;this._orderProcessorService=l;this._orderHttpService=h;this._dialog=A;this._outletRegisterService=le;this.parkService=Te;this.salesOrderData=this._orderDataService.Data,this.appConfig=this._posHttpResponseService.Data.AppConfigJSON,this.parkLayoutPack=this._outletRegisterService.Data.ParkLayoutPack}modalConfig=new H;salesOrderData;appConfig;parkLayoutPack;ngOnInit(){this.modalConfig.title="Re-Park Order?",this.modalConfig.hideFooter=!0}onRepark(){this.parkService.park(this.parkOrderRetrieve).subscribe(t=>{this.dialogRef.close()})}onMove(){this.dialogRef.close(),this.showParkSelectModal()}showParkSelectModal(){this._orderHttpService.getVacant(this.salesOrderData.Order.EntityID).subscribe(t=>{this._dialog.open(zt,{data:{title:this.title,parkLayoutPack:this.parkLayoutPack,replaceWithAlias:this.appConfig.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias}})})}get title(){return this._orderProcessorService.Data.posState==5?"Split Order":this.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle}static \u0275fac=function(e){return new(e||o)(m(j),m(Ae),m(N),m(L),m(W),m(Pe),m(re),m(Y),m(ke))};static \u0275cmp=w({type:o,selectors:[["POS-modal-repark"]],standalone:!1,decls:13,vars:2,consts:[[3,"onClose","onCancel","title","config"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg",3,"click"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onClose",function(){return i.dialogRef.close()})("onCancel",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"a",2),g("click",function(){return i.onRepark()}),r(4,"h4"),d(5,"Re-Park"),a(),r(6,"span"),d(7,"Store order to same location"),a()(),r(8,"a",2),g("click",function(){return i.onMove()}),r(9,"h4"),d(10,"Move"),a(),r(11,"span"),d(12,"Shift order to Different location"),a()()()()()),e&2&&p("title","Re-Park Order?")("config",i.modalConfig)},dependencies:[U],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.btn-gray[_ngcontent-%COMP%]{background-color:#f4f4f4;border:1px solid #D6D6D6;font-weight:700;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}.btn[_ngcontent-%COMP%]{padding:25px 0;width:190px;margin-right:10px}.btn[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{font-weight:700;text-transform:uppercase}.btn[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.75rem;font-style:italic;color:#868686;margin-top:10px}"]})};var Kt=class{Name;Alias;IsOccupied;Note};var ln=class{_point;get point(){return this._point}set point(t){this._point=t}_pricebookID;get pricebookID(){return this._pricebookID}set pricebookID(t){this._pricebookID=t}_discountRate;get discountRate(){return this._discountRate}set discountRate(t){this._discountRate=t}_groups;get groups(){return this._groups}set groups(t){this._groups=t}_salesID;get salesID(){return this._salesID}set salesID(t){this._salesID=t}_dueDays;get dueDays(){return this._dueDays}set dueDays(t){this._dueDays=t}_expiryDate;get expiryDate(){return this._expiryDate}set expiryDate(t){this._expiryDate=t}_debt;get debt(){return this._debt}set debt(t){this._debt=t}_expirtedString;get expirtedString(){return this._expirtedString}set expirtedString(t){this._expirtedString=t}_loyaltyDisabled;get loyaltyDisabled(){return this._loyaltyDisabled}set loyaltyDisabled(t){this._loyaltyDisabled=t}_taxTypeID;get taxTypeID(){return this._taxTypeID}set taxTypeID(t){this._taxTypeID=t}_entityID;get entityID(){return this._entityID}set entityID(t){this._entityID=t}_mobile;get mobile(){return this._mobile}set mobile(t){this._mobile=t}_email;get email(){return this._email}set email(t){this._email=t}_dueMonths;get dueMonths(){return this._dueMonths}set dueMonths(t){this._dueMonths=t}_memberIdentification;get memberIdentification(){return this._memberIdentification}set memberIdentification(t){this._memberIdentification=t}};var Ci=class{OutletName;Status;AmountSummary;Coupon;Creator;CurrencySymbol;Customer;Date;Delivery;ExtraNote;FinalAmount;InvoiceNote;Items;LoyaltyPoint;Payments;PrintDate;RegisterCode;SalesOrderItemCommission;Shipping;Title;TypeName;PaymentState;ToP;Due;Gopay;Number;Created;SalesName;ParkLabel;HeaderTitle;QRContent;Retur;ID;AfterSell;constructor(){this.OutletName="",this.Status=1,this.AmountSummary=[],this.Coupon="",this.Creator="",this.CurrencySymbol="",this.Customer=new ln,this.Date="",this.Delivery={Number:""},this.ExtraNote="",this.FinalAmount=0,this.InvoiceNote="",this.Items=[],this.LoyaltyPoint="",this.Payments=[],this.PrintDate="",this.RegisterCode="",this.SalesOrderItemCommission={SalesName:""},this.Shipping=new fi,this.Title="",this.TypeName="",this.PaymentState=0,this.Number="",this.Created="",this.AfterSell=!0}};var Yt=class{LayoutPack;constructor(t){this.LayoutPack=t,this.GenerateLayoutOption()}GenerateLayoutOption(){this.LayoutPack!=null&&this.LayoutPack.Layout&&this.LayoutPack.Layout.forEach(t=>{t.Options=[];for(let e=1;e<=t.Size;e++){let i=new Kt;i.Name=t.Name+e,i.Alias=this.GetAlias(i.Name),t.Options.push(i)}})}GetAlias(t){if(this.LayoutPack!=null&&this.LayoutPack.Alias){let e=this.LayoutPack.Alias.filter(i=>i.Name==t);return e.length>0?e[0].Alias:t}return""}};var sn=class{ExtraNote;Title;Customer;SalesName;InvoiceNote;Date;Items;AmountSummary;Creator;NumberOfPerson;CurrencySymbol;constructor(){this.ExtraNote="",this.Title="",this.Customer="",this.SalesName="",this.InvoiceNote="",this.Date="",this.Items=[],this.AmountSummary=[],this.Creator="",this.NumberOfPerson=0,this.CurrencySymbol="Rp"}};var cn=class{AmountSummary;Contact;ContactDisplay;CurrencySymbol;FinalAmount;HeaderTitle;Invoice;IsPrice;Items;LoyaltyPoint;Order;Payments;PriceVisible;PrintPerson;PrintTime;SalesName;Shipping;TotalInWord};var Ot=class o{constructor(t,e,i,n,l,h,A,le){this._posService=t;this._orderDataService=e;this._cashierCalculatorService=i;this._outletService=n;this._OrderHttpService=l;this._receiptCalculatorService=h;this._orderProcessorService=A;this._customerHttpService=le;this.subscribeToObservableChanges()}posData;completeData;park=new Yt(null);outletInfo=new Bi;datePipe=new We("en-US");ParkTemp=Array();CartItems=[];get posStorage(){return this._posService.Data}get AppConfigJSON(){return this._posService.Data.AppConfigJSON}subscribeToObservableChanges(){this._orderDataService.Data$.subscribe(t=>{this.posData=t}),this._OrderHttpService.Data$.subscribe(t=>{this.completeData=t}),this._outletService.Data$.subscribe(t=>{this.outletInfo=t}),this._orderProcessorService.Data$.subscribe(t=>{this.ParkTemp=t.parkTemporaryItem})}generateReceiptMini(){let t=new Ci;t.HeaderTitle=this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,t.OutletName=this.outletInfo.EntityName,t.ExtraNote=this.getParkLabel(),t.Customer=this.getSubmitedCustomer(),t.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),t.SalesOrderItemCommission={SalesName:this._outletService.getSalesname(this.posData.Order.SalesID)},t.Number=this.completeData?.InvoiceNumber,t.FinalAmount=this.completeData?.Final,t.InvoiceNote=this.posData.Order.Note,t.RegisterCode=this.outletInfo.RegisterCode==null?"":this.outletInfo.RegisterCode,t.QRContent=this.generateQrContent(),t.ID=this.completeData?.ObjectID,t.Retur=S.IsNotEmpty(this.posData?.Invoice?.ReferenceInvoiceID),t.Date=this.getSubmitedOrderDate(),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoiceCreatedTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy")),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.OrderTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm:ss")),this.posData.CartItems.forEach(i=>{i.SalesID&&(i.SalesName=this._outletService.getSalesname(i.SalesID))}),t.Items=this.posData.CartItems,t.Customer!=null&&t.Customer.Display!=null&&t.Customer.Display!=null&&t.Customer.Display!=null&&(t.Customer={ID:this.posData.Order.CustomerID,Display:this.posData.ContactName,Email:t.Customer.Email,CityName:null,Address:t.Customer.Address,Code:t.Customer.Code,Name:t.Customer.Name,Phone:t.Customer.Phone,Mobile:t.Customer.Mobile,NationalIDNumber:t.Customer.NationalIDNumber,Title:t.Customer.Title}),t.Delivery={Number:this.posData.Order.Number};let e=S.FilterByID(this.posStorage.PoTypes,this.posData.Order.TypeID);if(e!==null&&(t.TypeName=e.Name),t.Shipping=this.generateShippingData(),this.AppConfigJSON.PrintConfigInvoice.ItemsTable.ItemWithoutPriceVisible||(t.Items=t.Items.filter(i=>i.Price!=0)),t.Coupon=this.posData.Order.PromotionCoupon,t.LoyaltyPoint=this.completeData?this.completeData.LoyaltyPoint:"",t.FinalAmount=this._cashierCalculatorService.Data,t.CurrencySymbol=this._cashierCalculatorService.currencySymbol,t.PaymentState=this.getPaymentState(),t.Payments=this.posData.Payments,t.Payments.forEach(i=>{i.MethodName=this.findPaymentName(i.MethodID)}),t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t.Creator=this.completeData?.Creator?this.completeData?.Creator:this.posStorage?.UserName,this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoicePaymentTermsVisible&&this.posData.Payments.length==0){let i=this.posData.Invoice.Due?new Date(this.posData.Invoice.Due):null,n=new Date(this.posData.Order.Date);n.setHours(0,0,0,0),t.ToP=this.generateTop(n,i),this.posData.Invoice.Due!==void 0&&(t.Due=this.datePipe.transform(new Date(this.posData.Invoice.Due),"dd MMMM yyyy"))}return t}generateQrContent(){let t="";if(this.AppConfigJSON?.PrintConfigInvoice?.InvoiceQR?.TransformTo==3){let i=this.AppConfigJSON?.PrintConfigInvoice?.InvoiceQR?.Content,n=this.posData?.Order?.Number,l=this.completeData.ObjectID,h=window?.location?.host;switch(i){case 2:t=l;break;case 1:t=n;break;case 3:t=`receipt.dealpos.app?Data=${btoa(`${l}_${h}`)}`;break}}return t}generateShippingData(){return{City:this.posData.Shipping!==null?this.posData.Shipping.City:null,Description:this.posData.Shipping!==null?this.posData.Shipping.Address:null,ID:null,Phone:this.posData.Shipping!==null?this.posData.Shipping.Phone:null,Recipient:this.posData.Shipping!==null?this.posData.Shipping.Name:null,SalesOrderID:null,Sender:null,SenderAddress:null,SenderCity:null,SenderPhone:null,Street:null}}generateParkReceipt(t=!0,e=!1){let i=new sn;if(i.ExtraNote=S.StringFormat("{0} #{1}",this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.NumberPrefix,this.GetSubmittedNumber()),i.Title=this.getParkLabel(),i.Customer=this.getSubmitedCustomer(),i.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),i.InvoiceNote=this.posData.Order.Note,i.Date=this.getSubmitedOrderDate(),i.CurrencySymbol=this._cashierCalculatorService.currencySymbol,this.getItemsParkReceipt(t,e),i.Items=this.CartItems,i.Creator=this.posStorage.UserName,i.NumberOfPerson=this.posData.Order.NumberOfPerson,this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.AmountVisible){let n=JSON.parse(JSON.stringify(this._receiptCalculatorService.generateAmountSummary()));i.AmountSummary=n}return i}getItemsParkReceipt(t,e){let i=nt(Be,this.posData.CartItems);if(e){let n=this.posData.CartItems.filter(l=>S.IsNotEmpty(l.SplitQuantity)&&l.SplitQuantity>0);this.CartItems=n.map(l=>(l.Quantity=l.SplitQuantity,l))}else if(t&&this.AppConfigJSON.ApplicationParkAndRetrieve.PrintBehaviour.PrintAdditionalItemsOnlyOnRePark)if(this.CartItems=Array(),this.ParkTemp.length>0)for(let n of i){let l=this.ParkTemp.find(h=>h.ID==n.ID);l==null?this.CartItems.push(n):n.Quantity!=l.Quantity&&(n.Quantity=n.Quantity-l.Quantity,this.CartItems.push(n))}else this.CartItems=i;else this.CartItems=i}generateBillInvoice(){let t=new cn;return t.ContactDisplay=this.posData.ContactName,t.Invoice=this.posData.Invoice,t.Order=this.posData.Order,t.Payments=this.posData.Payments,t.Shipping=this.posData.Shipping,t.CurrencySymbol=this._cashierCalculatorService.currencySymbol,t.FinalAmount=this._cashierCalculatorService.Data,t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t.Contact=this.getSubmitedCustomer(),t.Items=this.getItemsBillInvoice(),t.PrintTime=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm"),t.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),t.HeaderTitle=this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,t.Invoice.Number=`#${this.posData.Order.Number}`,t.Invoice.Date=new Date,t.Invoice.PaymentStateID=1,t.Invoice.Note=this.posData.Order.Note,t.PrintPerson="",t.IsPrice=!0,t.PriceVisible=!0,t}getItemsBillInvoice(){return this.posData.CartItems.map(e=>({Name:e.Variant.Name,Quantity:e.Quantity,Code:e.Variant.Code,UnitPrice:e.Price,Discount:e.Discount,UOMName:e.Variant.UOMName,Total:e.Total,Note:e.Note}))}generateBillReceipt(){let t=new Ci;t.HeaderTitle=this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,t.ParkLabel=this.posData.Order.ParkLabel,t.OutletName=this.outletInfo.EntityName,t.ExtraNote=this.getParkLabel(),t.Customer=this._customerHttpService.Data,t.SalesOrderItemCommission.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),t.Number=this.posData.Order.Number,t.FinalAmount=this._cashierCalculatorService.Data,t.InvoiceNote=this.posData.Order.Note,t.Date=this.datePipe.transform(this.posData.Order.Date,"dd MMM yyyy"),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoiceCreatedTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy")),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.OrderTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm:ss")),t.Items=this.posData.CartItems,t.Customer.ID=this.posData.Order.CustomerID,t.Customer.Name=this.posData.ContactName,t.Customer.Display=this.posData.ContactName,t.Customer.Mobile&&t.Customer.Mobile.length==1&&(t.Customer.Mobile=null),t.Delivery={Number:this.posData.Order.Number};let e=S.FilterByID(this.posStorage.PoTypes,this.posData.Order.TypeID);return e!==null&&(t.TypeName=e.Name),t.Shipping=this.generateShippingData(),this.AppConfigJSON.PrintConfigInvoice.ItemsTable.ItemWithoutPriceVisible||(t.Items=t.Items.filter(i=>i.Price!=0)),t.Coupon=this.posData.Order.PromotionCoupon,t.PaymentState=this.getPaymentState(),t.Payments=this.posData.Payments,t.Payments=t.Payments.map(i=>(i.MethodName=this.findPaymentName(i.MethodID),i)),t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t}getPaymentState(){let t=this.AppConfigJSON?.ModuleSell?.ToleranceAmount,e=this.posData.Payments,i=this.posData.TotalPaidAmount,n=this._cashierCalculatorService.Data,l=1;e?.length>0&&i<n&&(l=2);let h=i-n;return(Math.abs(h)<=t||h>=0)&&(l=3),l}generateTop(t,e){let i=new Date(e),n=new Date(t),l=i.getTime()-n.getTime();return Math.floor(l/(1e3*3600*24))}getSubmitedOrderDate(){let t=this.posData.Order?.Date,e=this.AppConfigJSON.PrintConfigInvoice?.DocumentVisibility?.OrderTimeVisible,i="",n=new Date;if(e){let l=new Date(t);l.setHours(n.getHours()),l.setMinutes(n.getMinutes()),i=this.datePipe.transform(l,"dd MMM yyyy HH:mm")}else i=this.datePipe.transform(t,"dd MMM yyyy");return i}getSubmitedCustomer(){return S.IsEmpty(this.completeData)?{}:this.completeData.Contact}getParkLabel(){let t=this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.LabelPrefix,e=this.AppConfigJSON.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,i=this.posData.Order.ParkLabel;if(S.IsNotEmpty(this.posData.SplitParkLabel)&&(i=this.posData.SplitParkLabel),e&&S.IsNotEmpty(i)){let n=this.park.GetAlias(i);i=n||i}return i?S.IsEmpty(t)?i:S.StringFormat("{0} # {1}",t,i):""}GetSubmittedNumber(){return S.IsNotEmpty(this.completeData)?this.completeData.InvoiceNumber:this.posData.Invoice.Number?this.posData.Invoice.Number:this.posData.Order.Number}generateCartItemSummary(){let t=[];for(let e of this.posData.CartItems)t.push(new Hi(e.Total,this._cashierCalculatorService.currencySymbol,e.Variant.Name,1));return t}generatePaymentSummary(){let t=[],e;for(let n=0;n<this.posData.Payments.length;n++){let l="Payment"+(n+1);this.AppConfigJSON.PrintConfigInvoice.Footer.PaymentMethodVisible&&(l=this.findPaymentName(Number(this.posData.Payments[n].MethodID))),e=new Hi(this.posData.Payments[n].PaidAmount,this._cashierCalculatorService.currencySymbol,l,1),t.push(e)}let i=this.generateChangeSummary();return i!==null&&t.push(i),t}generateChangeSummary(){let t=this._cashierCalculatorService.currencySymbol,e=this._cashierCalculatorService.Data,i=this.posData.TotalPaidAmount,n=0,l=null;return n=i-e,n>0&&(l=new Hi(n,t,"Change",1)),l}findPaymentName(t){return this._outletService.Data.Payments.find(e=>e.ID==t).Name}printWindow(){return ho(this,null,function*(){return new Promise(t=>{setTimeout(()=>{window.print(),t()},500)})})}static \u0275fac=function(e){return new(e||o)(B(L),B(N),B(Me),B(Y),B(Pe),B(Ui),B(W),B(pt))};static \u0275prov=rt({token:o,factory:o.\u0275fac,providedIn:"root"})};var ke=class o{constructor(t,e,i,n,l,h,A,le,Te,Fe){this.httpService=t;this.receiptService=e;this.orderProcessorService=i;this.pageInitialService=n;this.salesOrderService=l;this.toastrService=h;this.promotionEventService=A;this.outletService=le;this.orderHttpService=Te;this.dialog=Fe;this._onPrint=new G,this.onPrint$=this._onPrint.asObservable(),this.subscribeToObservable()}_onPrint;onPrint$;parkOrderRetrieve;subscribeToObservable(){this.orderProcessorService.Data$.subscribe(t=>{(t.posState==3||t.posState==5)&&this.emitParkReceipt(!0,t.posState==5)})}getParkedOrder(t,e){return this.httpService.get(_e.GetPark,[{key:"EntityID",value:t},{key:"RegisterID",value:e}])}removeOrder(t,e){let i={OrderID:t};return e?this.httpService.post(_e.VoidPark,i):this.httpService.post(_e.RemovePark,i)}mergePark(t){return this.httpService.post(_e.MergePark,t)}getOutstanding(t){let e={EntityID:t};return this.httpService.post(_e.GetOutStanding,e)}splitOrder(t){return this.httpService.post(_e.SplitOrder,t)}park(t){let e=nt(ct,this.salesOrderService.Data);if(this.promotionEventService.selectedPromotion){this.clearPromotionAppliedInPark();return}e.Action.DeliveryEntityID=S.GuidEmpty,e.Action.Type=1,t.ParkLabel!=null&&(e.Order.ParkLabel=t.ParkLabel),e.Order.Note=t.Note,e.Order.InvoicedStateID=1,S.IsNotEmpty(t.ID)&&(e.Order.ID=t.ID),this.salesOrderService.pushNewValue(e);let i=this.orderHttpService.generatePOSDataForSubmission(e);return this.httpService.post(_e.ParkOrder,i).pipe(Ne(n=>{this.orderProcessorService.updatePosState(3,n),this.orderProcessorService.createNewTransactionInSameOutletRegister()}))}clearPromotionAppliedInPark(){this.dialog.open(Rr,{id:"modal-promotion-confirm",data:{message:`
|
|
2
2
|
Promotion cannot be applied when Park,
|
|
3
3
|
Order will be restored to before the promotion is applied
|
|
4
|
-
`},disableClose:!0})}parkOrder(){let t=this.salesOrderService.Data,e=this.pageInitialService.Data.AppConfigJSON;if(t.CartItems.length==0){this.toastrService.warning("You must have at least one item","No Item in Cart!");return}if(!(!this.validateCustomerRequired(e,t)||!this.validateUsedPromotion(t))){if(S.IsEmpty(t.Order.RegisterID)){this.toastrService.warning(fr.emptyEntity,Le.Warning);return}this.validateShowParkModal()}}validateCustomerRequired(t,e){return t.ModuleSell.Header.CustomerRequired&&e.Order.CustomerID==null?(this.toastrService.warning("Customer is needed before parking orders!","Missing customer!"),!1):!0}validateUsedPromotion(t){let e=this.promotionEventService.selectedPromotion;return S.IsNotEmpty(e)||S.IsNotEmpty(t.Order.PromotionCoupon)?(this.toastrService.warning("Orders with applied promotions or coupons cannot be parked!","Park Not Allowed!"),!1):!0}validateShowParkModal(){let t=this.outletService.Data.ParkLayoutPack,e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data;if(t&&S.IsNotEmpty(t.ID))this.orderProcessorService.Data.posState==4?this.showReparkModal():this.showParkSelectModal(e,i);else{if(!this.validateRetrieveMode(e))return;this.setDefaultParkNote(e),this.showParkInputModal()}}showParkSelectModal(t,e){let i=this.orderProcessorService.Data,n=this.outletService.Data.ParkLayoutPack;this.orderHttpService.getVacant(e.Order.EntityID).subscribe(l=>{let h=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle,A=i.posState==5,le=t.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,Te=A?"Split Order":h;this.dialog.open(zt,{data:{title:Te,parkLayoutPack:this.generateParkLayoutOptions(n,l.Orders),replaceWithAlias:le}}).afterClosed().pipe(se(Fe=>S.IsNotEmpty(Fe)),Re(Fe=>{let je=new Jt;return je.ParkLabel=Fe.Name,je.Note=Fe.Note,this.park(je)})).subscribe()})}showReparkModal(){this.dialog.open(an,{data:this.parkOrderRetrieve})}validateRetrieveMode(t){return t.ApplicationParkAndRetrieve.Advance.retreiveMode==1?(this.toastrService.error("Your retrieve config is in Group mode, to enable park please setting your Park layout at Outlet page","Error!"),!1):!0}setDefaultParkNote(t){let e=t.ApplicationParkAndRetrieve.UserInterfaceLabel.DefaultParkNoteValue,i=this.orderProcessorService.Data.posState==2,n=this.salesOrderService.Data;!i&&S.IsNotEmpty(e)&&S.IsEmpty(n.Order.Note)&&(this.salesOrderService.Data.Order.Note=e)}showParkInputModal(){let t="Park this order?",e=this.orderProcessorService.Data.posState==5,i=this.outletService.Data?.ParkLayoutPack;e&&(t="Split Detail"),this.dialog.open(nn,{id:"park-form-modal",data:{title:t,labelDisable:i&&S.IsNotEmpty(i?.ID)||this.orderProcessorService.Data.posState==5,ParkLabel:this.salesOrderService.Data.Order.ParkLabel}})}onPrintRetrieve(){this.dialog.open(rn).afterClosed().pipe(se(t=>S.IsNotEmpty(t))).subscribe(t=>{t=="ORDER"?this.emitParkReceipt(!1,!1,!0):this.emitBillReceipt()})}emitParkReceipt(t,e=!1,i=!1){let n=this.receiptService.generateParkReceipt(t,e);(this.pageInitialService.Data.AppConfigJSON.ApplicationParkAndRetrieve?.PrintBehaviour?.PrintAfterPark||i)&&this._onPrint.next({type:"PARK",template:n})}emitBillReceipt(){let t=this.outletService.Data,e;1==t.PrintTemplate.PrintMode?(e=this.receiptService.generateBillInvoice(),this._onPrint.next({type:"BILL_A4",template:e})):(e=this.receiptService.generateBillReceipt(),this._onPrint.next({type:"BILL_MINI",template:e}))}generateParkLayoutOptions(t,e=[]){return t.Layout=t.Layout.map(i=>{i.Options=[];for(let n=1;n<=i.Size;n++){let l=new Kt;l.Name=i.Name+n,l.Alias=this.generateAlias(t,l.Name),l.IsOccupied=this.IsOccupied(l.Name,e),i.Options.push(l)}return i}),t}generateAlias(t,e){let i="";if(t.Alias){let n=t.Alias.filter(l=>l.Name==e);n.length>0&&(i=`${n[0]?.Alias}`)}return i}IsOccupied(t,e){let i=e.filter(l=>l.ParkLabel==t),n=!1;return i.length>0&&(n=!0),n}static \u0275fac=function(e){return new(e||o)(B(Qe),B(Ot),B(W),B(L),B(N),B(ee),B(Qt),B(Y),B(Pe),B(re))};static \u0275prov=rt({token:o,factory:o.\u0275fac,providedIn:"root"})};var pn=class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=_t({type:o});static \u0275inj=gt({imports:[X,fe,Li,yt,Ar,Ht,Vt,Ut,Ke,qi]})};var _a=o=>({"opacity-50":o});function za(o,t){if(o&1){let e=v();r(0,"div",5)(1,"h6",6),d(2,"Verify Via"),a(),r(3,"div",7)(4,"button",8),g("click",function(){u(e);let n=c();return f(n.onChooseVerifyType("phone"))}),r(5,"div",9)(6,"div"),C(7,"i",10),a(),r(8,"div",11),d(9),a()()()(),r(10,"div",12)(11,"button",8),g("click",function(){u(e);let n=c();return f(n.onChooseVerifyType("email"))}),r(12,"div",9),C(13,"i",13),r(14,"div",11),d(15),a()()()(),r(16,"div",12)(17,"button",14),g("click",function(n){return u(e),c().onChooseVerifyType("pin"),f(n.preventDefault())}),r(18,"div",9),C(19,"i",15),r(20,"div",16),d(21,"Use PIN"),a()()()()()}if(o&2){let e=c();s(4),p("disabled",!e.phone||(e.phone==null?null:e.phone.length)<6),s(4),p("ngClass",R(6,_a,!e.phone||(e.phone==null?null:e.phone.length)<6)),s(),y(" ",e.phone&&(e.phone==null?null:e.phone.length)>6?e.phone:"Mobile Phone is not registered"," "),s(2),p("disabled",!e.email),s(3),p("ngClass",R(8,_a,!e.email)),s(),y(" ",e.email?e.email:"Email is not registered"," ")}}function Ka(o,t){if(o&1){let e=v();r(0,"div",17)(1,"div",18)(2,"div"),d(3,"OTP Verification is turned "),r(4,"span",19),d(5,"OFF"),a(),d(6,","),a(),r(7,"div"),d(8," Please read this "),r(9,"a",20),d(10,"article"),a(),d(11," to turn on "),a()()(),r(12,"div")(13,"div",21)(14,"button",22),g("click",function(){u(e);let n=c();return f(n.onRedeem())}),d(15,"Redeem"),a()()()}}var dn=class o{toastrService=ie(ee);onVerify=new He;pointUsedChange=new He;redeemEvent=new He;isVerifyEnabled=!1;phone;email;pointUsed;pointBalance;onPointUsedChange(){this.pointUsedChange.emit(this.pointUsed)}ngAfterViewInit(){this.setFocusInput()}setFocusInput(){setTimeout(()=>{document.getElementById("pointInput")?.focus()},300)}onChooseVerifyType(t){this.checkPointUsed()&&this.onVerify.emit(t)}onRedeem(){this.checkPointUsed()&&this.redeemEvent.emit()}checkPointUsed(){return S.IsEmpty(this.pointUsed)||this.pointUsed<=0?(this.toastrService.warning("Please enter the points before redeeming!","Field Input Required!"),this.setFocusInput(),!1):!0}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=w({type:o,selectors:[["point-step"]],inputs:{isVerifyEnabled:"isVerifyEnabled",phone:"phone",email:"email",pointUsed:"pointUsed",pointBalance:"pointBalance"},outputs:{onVerify:"onVerify",pointUsedChange:"pointUsedChange",redeemEvent:"onRedeem"},decls:13,vars:6,consts:[[1,"d-flex","align-items-center","justify-content-center"],[1,"me-3"],["type","text","autoNum","","id","pointInput",1,"form-control","input-point",3,"ngModelChange","ngModel","max"],[1,"me-3","d-flex","align-items-center","justify-content-center"],[1,"fs-1"],[1,"mt-8"],[1,"mb-6","text-center"],[1,"text-center"],["type","button",1,"btn","btn-light","btn-sm","p-3","w-75",3,"click","disabled"],[1,"d-flex","align-items-center"],[1,"fa-brands","fa-whatsapp","fs-2","ps-2",2,"color","#25d366"],[1,"fs-5","w-100",3,"ngClass"],[1,"mt-4","text-center"],[1,"ps-2","fa-solid","fa-envelope","fs-3",2,"color","#c71610"],["type","button","matTooltip","Inform the customer to download the Brand Loyalty App and setup PIN in Profile Menu to authorize Point Redemption","matTooltipPosition","right","matTooltipClass","primary-tooltip",1,"btn","btn-light","btn-sm","p-3","w-75",3,"click"],[1,"ps-2","fa-solid","fa-key","fs-3"],[1,"fs-5","w-100"],[1,"mt-8","d-flex","justify-content-center"],[1,"text-center","alert","alert-warning","py-4","px-8","mb-0"],[1,"fw-bold","text-danger",2,"font-size","13px"],["href","https://support.dealpos.com/en/articles/9158486-redeem-loyalty-point-authorization-using-otp","target","_blank"],[1,"d-flex","justify-content-center","mt-12"],[1,"btn","btn-success",3,"click"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"input",2),D("ngModelChange",function(l){return M(i.pointUsed,l)||(i.pointUsed=l),l}),g("ngModelChange",function(){return i.onPointUsedChange()}),a()(),r(3,"div",3)(4,"span",1),d(5,"Of"),a(),r(6,"span",4),d(7),b(8,"number"),a()(),r(9,"div"),d(10,"Points"),a()(),_(11,za,22,10,"div",5)(12,Ka,16,0)),e&2&&(s(2),P("ngModel",i.pointUsed),p("max",i.pointBalance),s(5),T(x(8,4,i.pointBalance)),s(4),E(i.isVerifyEnabled?11:12))},dependencies:[X,q,Z,ut,st,fe,te,K,oe,Ke,ce],styles:[".input-point[_ngcontent-%COMP%]{width:120px;height:44px;font-size:1.375rem;text-align:center}"]})};var Ya=o=>({"error-input":o});function Xa(o,t){if(o&1&&(r(0,"span"),d(1),a()),o&2){let e=c(3);s(),y(" ",e.config.separator," ")}}function Za(o,t){if(o&1){let e=v();I(0),r(1,"input",5,0),g("paste",function(n){u(e);let l=c(2);return f(l.handlePaste(n))})("keyup",function(n){let l=u(e).index,h=c(2);return f(h.onKeyUp(n,l))})("input",function(n){let l=u(e).index,h=c(2);return f(h.onInput(n,l))})("keydown",function(n){let l=u(e).index,h=c(2);return f(h.onKeyDown(n,l))}),a(),_(3,Xa,2,1,"span",6),O()}if(o&2){let e=t.$implicit,i=t.index,n=t.last,l=c(2);s(),io("otp-input ",l.config.inputClass,""),p("pattern",l.config.allowNumbersOnly?"\\d*":"")("type",l.inputType)("placeholder",(l.config==null?null:l.config.placeholder)||"")("ngStyle",l.config.inputStyles)("formControl",l.otpForm.controls[e])("id",l.getBoxId(i))("ngClass",R(11,Ya,(l.config==null?null:l.config.showError)&&(l.formControl==null?null:l.formControl.invalid)&&((l.formControl==null?null:l.formControl.dirty)||(l.formControl==null?null:l.formControl.touched)))),s(2),p("ngIf",l.config.separator&&!n)}}function el(o,t){if(o&1){let e=v();r(0,"div",2),g("focusin",function(){u(e);let n=c();return f(n.onFocusIn())})("focusout",function(){u(e);let n=c();return f(n.onFocusOut())}),r(1,"div",3),_(2,Za,4,13,"ng-container",4),a()()}if(o&2){let e=c();io("ng-otp-input-wrapper wrapper ",e.config.containerClass,""),To("id","c_",e.componentKey,""),p("ngStyle",e.config.containerStyles),s(2),p("ngForOf",e.controlKeys)}}var ft=class{static ifTab(t){return this.ifKey(t,"Tab")}static ifDelete(t){return this.ifKey(t,"Delete;Del")}static ifBackspace(t){return this.ifKey(t,"Backspace")}static ifRightArrow(t){return this.ifKey(t,"ArrowRight;Right")}static ifLeftArrow(t){return this.ifKey(t,"ArrowLeft;Left")}static ifSpacebar(t){return this.ifKey(t,"Spacebar; ")}static ifKey(t,e){return e.split(";").some(n=>n===t.key)}},hi=class{static keys(t){return t?Object.keys(t):[]}},mo=(()=>{class o{set disabled(e){this.setDisabledState(e)}get inputType(){return this.config?.isPasswordInput?"password":this.config?.allowNumbersOnly?"tel":"text"}get controlKeys(){return hi.keys(this.otpForm?.controls)}get formControl(){return this.formCtrl??this.inj?.get(qo)}constructor(e,i){this.document=e,this.inj=i,this.config={length:4},this.onBlur=new G,this.onInputChange=new G,this.inputControls=new Array(this.config.length),this.componentKey=Math.random().toString(36).substring(2)+new Date().getTime().toString(36),this.destroy$=new G,this.activeFocusCount=0,this.onChange=()=>{},this.onTouched=()=>{},this._isDisabled=!1}ngOnInit(){this.otpForm=new $o({});for(let e=0;e<this.config.length;e++)this.otpForm.addControl(this.getControlName(e),new ht);this.otpForm.valueChanges.pipe(k(this.destroy$)).subscribe(e=>{hi.keys(this.otpForm.controls).forEach(i=>{var n=this.otpForm.controls[i].value;n&&n.length>1&&(n.length>=this.config.length?this.setValue(n):this.rebuildValue())})})}setDisabledState(e){this._isDisabled=e,this.otpForm&&(e?this.otpForm.disable({emitEvent:!1}):this.otpForm.enable({emitEvent:!1}))}writeValue(e){this.currentVal=this.hasVal(e)?e:null,this.setValue(this.currentVal)}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}onFocusIn(){this.onTouched(),this.activeFocusCount++}onFocusOut(){setTimeout(()=>{this.activeFocusCount--,this.activeFocusCount===0&&(this.onTouched(),this.onBlur.next())},0)}ngAfterViewInit(){if(!this.config.disableAutoFocus){let e=this.document.getElementById(`c_${this.componentKey}`);if(e){let i=e.getElementsByClassName("otp-input")[0];i&&i.focus&&i.focus()}}}getControlName(e){return`ctrl_${e}`}onKeyDown(e,i){let n=this.getBoxId(i-1),l=this.getBoxId(i);if(ft.ifKey(e,"Enter")){let A=this.document.getElementById(l)?.closest("form");if(A){e.preventDefault(),A.dispatchEvent(new Event("submit"));return}}if(ft.ifSpacebar(e))return e.preventDefault(),!1;if(ft.ifBackspace(e)){e.target.value?this.clearInput(l,i):(this.clearInput(n,i-1),this.setSelected(n)),this.rebuildValue();return}if(ft.ifDelete(e)){e.target.value?this.clearInput(l,i):(this.clearInput(n,i-1),this.setSelected(n)),this.rebuildValue();return}}hasVal(e){return e!=null&&e!=null&&(!e?.trim||e.trim()!="")}onInput(e,i){let n=this.hasVal(this.currentVal)?`${this.currentVal}${e.target.value}`:e.target.value;if(this.config.allowNumbersOnly&&!this.validateNumber(n)){e.target.value=null,e.stopPropagation(),e.preventDefault(),this.clearInput(null,i);return}if(this.ifValidKeyCode(null,e.target.value)){let l=this.getBoxId(i+1);this.setSelected(l),this.rebuildValue()}else{e.target.value=null;let l=this.getControlName(i);this.otpForm.controls[l]?.setValue(null),this.rebuildValue()}}onKeyUp(e,i){ft.ifTab(e)&&(i-=1);let n=this.getBoxId(i+1),l=this.getBoxId(i-1);if(ft.ifRightArrow(e)){e.preventDefault(),this.setSelected(n);return}if(ft.ifLeftArrow(e)){e.preventDefault(),this.setSelected(l);return}}validateNumber(e){return e&&/^[0-9]+$/.test(e)}getBoxId(e){return`otp_${e}_${this.componentKey}`}clearInput(e,i){let n=this.getControlName(i);if(this.otpForm.controls[n]?.setValue(null),e){let l=this.document.getElementById(e);l&&l instanceof HTMLInputElement&&(l.value=null)}}setSelected(e){this.focusTo(e);let i=this.document.getElementById(e);i&&i.setSelectionRange&&setTimeout(()=>{i.setSelectionRange(0,1)},0)}ifValidKeyCode(e,i){let n=i??e.key;return this.config?.allowNumbersOnly?this.validateNumber(n):/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)||/^[a-zA-Z0-9%*_\-@#$!]$/.test(n)&&n.length==1}focusTo(e){let i=this.document.getElementById(e);i&&i.focus()}setValue(e){if(!(this.config.allowNumbersOnly&&isNaN(e))){if(this.otpForm?.reset(),!this.hasVal(e)){this.rebuildValue();return}e=e.toString().replace(/\s/g,""),Array.from(e).forEach((i,n)=>{this.otpForm.get(this.getControlName(n))&&this.otpForm.get(this.getControlName(n)).setValue(i)}),this.config.disableAutoFocus||setTimeout(()=>{let i=this.document.getElementById(`c_${this.componentKey}`);var n=e.length<this.config.length?e.length:this.config.length-1;let l=i.getElementsByClassName("otp-input")[n];l&&l.focus&&setTimeout(()=>{l.focus()},1)},0),this.rebuildValue()}}rebuildValue(){let e=null;hi.keys(this.otpForm.controls).forEach(i=>{let n=this.otpForm.controls[i].value;if(n){let l=n.length>1,h=!this.config.allowNumbersOnly&&this.config.letterCase&&(this.config.letterCase.toLocaleLowerCase()=="upper"||this.config.letterCase.toLocaleLowerCase()=="lower");n=n[0];let A=h?this.config.letterCase.toLocaleLowerCase()=="upper"?n.toUpperCase():n.toLowerCase():n;h&&A==n?h=!1:n=A,e==null?e=n:e+=n,(l||h)&&this.otpForm.controls[i].setValue(n)}}),this.currentVal!=e&&(this.currentVal=e,this.onChange(e),this.formCtrl?.setValue&&this.formCtrl.setValue(e),this.onInputChange.next(e))}handlePaste(e){let i=e.clipboardData||window.clipboardData;if(i)var n=i.getData("Text");e.stopPropagation(),e.preventDefault(),!(!n||this.config.allowNumbersOnly&&!this.validateNumber(n))&&this.setValue(n)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static{this.\u0275fac=function(i){return new(i||o)(m(Ao),m(Oo))}}static{this.\u0275cmp=w({type:o,selectors:[["ng-otp-input"],["ngx-otp-input"]],inputs:{config:"config",formCtrl:"formCtrl",disabled:"disabled"},outputs:{onBlur:"onBlur",onInputChange:"onInputChange"},features:[at([{provide:Wo,useExisting:xo(()=>o),multi:!0}])],decls:1,vars:1,consts:[["inp",""],["tabindex","0",3,"class","id","ngStyle","focusin","focusout",4,"ngIf"],["tabindex","0",3,"focusin","focusout","id","ngStyle"],[1,"n-o-c"],[4,"ngFor","ngForOf"],["autocomplete","one-time-code",3,"paste","keyup","input","keydown","pattern","type","placeholder","ngStyle","formControl","id","ngClass"],[4,"ngIf"]],template:function(i,n){i&1&&_(0,el,3,7,"div",1),i&2&&p("ngIf",n.otpForm==null?null:n.otpForm.controls)},dependencies:[ze,te,K,zo,bt,z,be,Lo,q],styles:[".otp-input[_ngcontent-%COMP%]{width:50px;height:50px;border-radius:4px;border:solid 1px #c5c5c5;text-align:center;font-size:32px}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]{margin:0 .51rem}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]:first-child{margin-left:0}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]:last-child{margin-right:0}.n-o-c[_ngcontent-%COMP%]{display:flex;align-items:center}.error-input[_ngcontent-%COMP%]{border-color:red}@media screen and (max-width: 767px){.otp-input[_ngcontent-%COMP%]{width:40px;font-size:24px;height:40px}}@media screen and (max-width: 420px){.otp-input[_ngcontent-%COMP%]{width:30px;font-size:18px;height:30px}}"]})}}return o})(),un=(()=>{class o{static{this.\u0275fac=function(i){return new(i||o)}}static{this.\u0275mod=_t({type:o})}static{this.\u0275inj=gt({imports:[mo]})}}return o})();function il(o,t){if(o&1&&(r(0,"div"),d(1," OTP has been sent to "),r(2,"span",5),d(3),a()()),o&2){let e=c();s(3),T(e.contact)}}function nl(o,t){if(o&1&&C(0,"ng-otp-input",3),o&2){let e=c(2);p("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function ol(o,t){if(o&1&&_(0,nl,1,2,"ng-otp-input",3),o&2){let e=c();E(e.showPinInput()?0:-1)}}function rl(o,t){if(o&1&&C(0,"ng-otp-input",3),o&2){let e=c();p("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function al(o,t){if(o&1){let e=v();r(0,"div",4)(1,"span"),d(2,"Didn`t get a code? "),a(),r(3,"a",6),g("click",function(){u(e);let n=c();return f(n.onResendCode())}),d(4,"Click to resend"),a()()}}var fn=class o{type;contact;clearPin=!1;onVerify=new He;resendCode=new He;showPinInput=V(!0);otpCtrl=new ht;otpConfig={length:6,inputStyles:{width:"3rem",height:"3rem"},isPasswordInput:!1,placeholder:"-"};constructor(){this.listenOtpChange()}ngOnChanges(t){let{clearPin:e}=t;e?.currentValue&&(this.showPinInput.set(!1),setTimeout(()=>{this.showPinInput.set(!0)},0)),this.type&&(this.otpConfig.isPasswordInput=this.type==="pin")}onResendCode(){this.resendCode.emit()}listenOtpChange(){this.otpCtrl.valueChanges.pipe(yo(300),se(t=>t.length===6)).subscribe(t=>{this.onVerify.emit(t)})}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=w({type:o,selectors:[["verify-step"]],inputs:{type:"type",contact:"contact",clearPin:"clearPin"},outputs:{onVerify:"onVerify",resendCode:"resendCode"},features:[Io],decls:8,vars:4,consts:[[1,"text-center","mb-10"],[1,"mb-3","fw-normal"],[1,"d-flex","justify-content-center"],[3,"formCtrl","config"],[1,"mt-4","text-start"],[1,"fw-bold"],[1,"link-primary","cursor-pointer",3,"click"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"h4",1),d(2),a(),_(3,il,4,1,"div"),a(),r(4,"div",2),_(5,ol,1,1)(6,rl,1,2,"ng-otp-input",3),a(),_(7,al,5,0,"div",4)),e&2&&(s(2),y(" Confirm Your ",i.type=="pin"?"PIN":"OTP"," "),s(),E(i.type!="pin"?3:-1),s(2),E(i.type=="pin"?5:6),s(2),E(i.type!="pin"?7:-1))},dependencies:[X,un,mo,ze],encapsulation:2})};function ll(o,t){if(o&1){let e=v();r(0,"button",7),g("click",function(){u(e);let n=c();return f(n.onCancel())}),d(1,"Cancel"),a()}}function sl(o,t){if(o&1){let e=v();r(0,"button",8),g("click",function(){u(e);let n=c();return f(n.onConfirm())}),d(1,"Confirm"),a()}}var gn=class o{pointUsed=Ii(0);redeemPointValue=Ii(0);showCancelBtn=Ii(!1);confirmEvent=new He;cancelEvent=new He;onConfirm(){this.confirmEvent.emit()}onCancel(){this.cancelEvent.emit()}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=w({type:o,selectors:[["confirm-step"]],inputs:{pointUsed:[1,"pointUsed"],redeemPointValue:[1,"redeemPointValue"],showCancelBtn:[1,"showCancelBtn"]},outputs:{confirmEvent:"onConfirm",cancelEvent:"onCancel"},decls:19,vars:7,consts:[[1,"text-center"],[1,"fs-5"],[1,"d-flex","justify-content-center","text-success","align-items-center"],[1,"me-3",2,"font-size","1.5rem"],[1,"d-flex","justify-content-center","text-danger","align-items-center"],[1,"btn","btn-danger","mt-12"],[1,"btn","btn-success","mt-12"],[1,"btn","btn-danger","mt-12",3,"click"],[1,"btn","btn-success","mt-12",3,"click"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1),d(2,"Redeem"),a(),r(3,"div",2)(4,"span",3),d(5),b(6,"number"),a(),r(7,"small"),d(8,"Point"),a()(),r(9,"div",1),d(10,"~"),a(),r(11,"div",4)(12,"span",3),d(13),b(14,"number"),a(),r(15,"small"),d(16,"Discount"),a()(),_(17,ll,2,0,"button",5)(18,sl,2,0,"button",6),a()),e&2&&(s(5),T(x(6,3,i.pointUsed())),s(8),T(x(14,5,i.pointUsed()*i.redeemPointValue())),s(4),E(i.showCancelBtn()?17:18))},dependencies:[X,Z],encapsulation:2})};var Zt=class o{constructor(t,e,i,n,l,h,A,le,Te,Fe){this.customerHttpService=t;this.salesOrderService=e;this.pageInitialService=i;this.shoppingCartService=n;this.invoiceCalculatorService=l;this.orderProcessorService=h;this.toastr=A;this.promotionCouponService=le;this.httpService=Te;this.registerService=Fe}customerId;customerData;_isCustomerVerfiedOtp=!1;get isCustomerVerfiedOtp(){return this._isCustomerVerfiedOtp}addCustomerById(t){return new bo(e=>{this.customerId=JSON.parse(JSON.stringify(this.salesOrderService.Data.Order.CustomerID)),this.resetCartOnChangeCustomer(t),S.IsNotEmpty(t)&&this.salesOrderService.updateCustomerID(t).then(i=>{this.applyCustomerPricebook(i),this.updateTaxCustomer(i.TaxTypeId),this.setSalesOrderCustomerId(i),this.setCustomerData(i),this.customerData.DiscountRate==null&&(this.customerData.DiscountRate=0),this._isCustomerVerfiedOtp=!1,this.applyConfigFullPriceOnly(),this.salesOrderService.pushNewValue();let n=this.checkResetRedeemPoint();this.orderProcessorService.reedemPointToDiscount(n),e.next(i)})})}addCustomerByCode(t){return this.salesOrderService.Data.ContactName=null,this.customerHttpService.findCustomerByCode(t).pipe(Re(e=>(this.salesOrderService.Data.ContactName=e.Display,this.addCustomerById(e.ID))))}setSalesOrderCustomerId(t){let e=this.salesOrderService.Data,i=this.registerService.Data.ListSales,n=t.SalesID,l=i.find(h=>h.ID===n);S.IsNotEmpty(t.SalesID)&&l&&(e.Order.SalesID=t.SalesID)}setCustomerData(t){let e=this.salesOrderService.Data;if(t.EntityID==S.GuidEmpty)this.customerData=t;else if(t.EntityID!=e.Order.EntityID){e.Order.CustomerID=null,e.ContactName=null;let i=`${t?.Name} is exclusive to ${t?.EntityName} Outlet and cannot be used in other outlets!`;alert(i)}else this.customerData=t}checkResetRedeemPoint(){let t=!1;return S.IsNotEmpty(this.customerId)&&(t=!0),t}applyCustomerPricebook(t){let e=this.salesOrderService.Data;if(S.IsNotEmpty(t.PricebookID)){let i=e.CartItems.map(n=>(n.Variant.PriceBook&&n.Variant.PriceBook.length!==0&&n.Variant.PriceBook.forEach(l=>{l.ID===t.PricebookID&&n.Quantity>=l.MinimumQuantity&&(n=this.shoppingCartService.applyPricebookToItem(n,l))}),n));e.CartItems=i}}updateTaxCustomer(t){let i=this.pageInitialService.Data.Taxes.find(n=>n.ID==t);i&&(this.salesOrderService.Data.Order.TaxTypeID=i.ID,this.invoiceCalculatorService.tax=i)}resetCartOnChangeCustomer(t){let e=this.pageInitialService.Data.AppConfigJSON;this.customerId!=t&&e.ModuleSell.Customer.ClearCartOnChange&&(this.salesOrderService.Data.CartItems=[]),this.customerId=t}updateDiscountRate(t=0){if(t>0){let e=this.promotionCouponService.coupon,i=this.salesOrderService.Data.Order.Discount;e&&e.Requirement?.Type==1?i==e.Amount?t>e.Amount&&(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.promotionCouponService.removeAppliedDiscountOnCustomerChange(),this.salesOrderService.Data.Order.Discount=t):(this.salesOrderService.Data.Order.Discount=t,this.salesOrderService.Data.Order.CustomerDiscountRate=t):(this.salesOrderService.Data.Order.Discount=t,this.salesOrderService.Data.Order.CustomerDiscountRate=t)}}applyConfigFullPriceOnly(){let t=this.filterGroupByDiscountRate(),e=this.salesOrderService.Data.CartItems;t?.OrderDiscountFullPriceProductOnly?this.filterItemWithDisc(e).length>0?e=this.applyItemsDisc(e,this.customerData.DiscountRate):this.updateDiscountRate(this.customerData.DiscountRate):this.updateDiscountRate(this.customerData.DiscountRate)}filterGroupByDiscountRate(){let e=(this.customerData?.Groups?this.customerData?.Groups:[]).filter(n=>n.OrderDiscountPercentage==this.customerData.DiscountRate),i;return e.length>1?(i=e.find(n=>n.OrderDiscountFullPriceProductOnly==!0),i||(i=e[0])):i=e[0],i}applyItemsDisc(t,e){return t=t.map(i=>(i.Discount==0&&i.DiscountAmount==0&&i.PriceTypeID!=3&&i.Price==i.UnitPrice&&S.IsEmpty(i.PriceBookID)&&(i.Discount=e,i.HasCustomerDiscount=!0),i)),t}filterItemWithDisc(t){return t.filter(i=>i.Discount>0||i.DiscountAmount>0||i.PriceTypeID==3||i.Price!=i.UnitPrice||S.IsNotEmpty(i.PriceBookID))}onEmptyInputCustomer(){S.IsNotEmpty(this.customerId)&&(this.promotionCouponService.removeAppliedDiscountOnCustomerChange(),this.resetAppliedPoint(),this.resetCustomerPricebook(),this.removeCustomerDiscountRate()),this.orderProcessorService.Data.InputTextValue="",this.customerId=JSON.parse(JSON.stringify(this.salesOrderService.Data.Order.CustomerID)),this._isCustomerVerfiedOtp=!1,this.customerData=null,this.salesOrderService.Data.ContactName=null,this.salesOrderService.Data.Order.CustomerID=null,this.customerHttpService.Data=new oo,this.customerData=new oo,this.salesOrderService.pushNewValue()}removeCustomerDiscountRate(){let t=this.filterGroupByDiscountRate(),e=this.salesOrderService.Data.CartItems;t?.OrderDiscountFullPriceProductOnly?this.filterItemWithDisc(e).length>0?this.salesOrderService.Data.CartItems=e.map(n=>(n.HasCustomerDiscount&&(n.Discount=0,n.HasCustomerDiscount=!1),n)):(this.salesOrderService.Data.Order.Discount=0,this.salesOrderService.Data.Order.CustomerDiscountRate=0):(this.salesOrderService.Data.Order.Discount=0,this.salesOrderService.Data.Order.CustomerDiscountRate=0)}resetCustomerPricebook(){if(this.customerData){let t=this.customerData.PricebookID;if(S.IsNotEmpty(t)){let e=this.salesOrderService.Data.CartItems;this.salesOrderService.Data.CartItems=e.map(i=>(i.PriceBookID==t&&(i.Discount=i.Variant.PriceDiscount,i.Note=i.Variant.PriceNote,i.PriceNote=i.Variant.PriceNote,i.PriceBookID=S.GuidEmpty,i.Price=i.Variant.UnitPrice,i.UnitPrice=i.Variant.UnitPrice),i))}}}resetAppliedPoint(){let t=this.salesOrderService.Data;t.Order.PointUsed>0&&(t.Order.PointUsed=0,t.Order.DiscountAmount=0)}redeemPoint(t){let e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data,n=e.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,l=t*n,h=i.RedeemableAmount;l>h&&(n>0?(t=Math.ceil(h/n),l=h):(t=0,l=0),this.toastr.warning("You enter the number of points more than the total amount","Points Adjusted")),i.Order.PointUsed=t||0,i.Order.DiscountAmount=l,this.salesOrderService.pushNewValue(i)}sendOtpViaEmail(t){return this.httpService.post("/API/otp/email",{Email:t})}sendOtpViaWhatsApp(t){return this.httpService.post("/API/otp/WhatsApp",{Number:t})}verifyEmailOtp(t,e){return this.httpService.post("/API/otp/verifyemail",{Email:t,OTP:e}).pipe(Ne(()=>this._isCustomerVerfiedOtp=!0))}verifyPin(t,e){return this.httpService.post("/API/pos/VerifyPin",{PIN:t,CustomerID:e}).pipe(Ne(()=>this._isCustomerVerfiedOtp=!0))}verifyWhatsAppOtp(t,e){return this.httpService.post("/API/otp/verifywhatsapp",{Number:t,OTP:e}).pipe(Ne(()=>this._isCustomerVerfiedOtp=!0))}get pointBalanced(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed;return(t||0)-(e||0)}static \u0275fac=function(e){return new(e||o)(B(pt),B(N),B(L),B(De),B(Me),B(W),B(ee),B(Xe),B(Qe),B(Y))};static \u0275prov=rt({token:o,factory:o.\u0275fac,providedIn:"root"})};var dl=["stepper"];function ml(o,t){o&1&&d(0,"Points")}function ul(o,t){o&1&&d(0,"Verify")}function fl(o,t){o&1&&d(0,"Confirm")}var ei=class o{dialogRef=ie(j);outletRegisterService=ie(Y);pageInitialService=ie(L);customerHttpService=ie(pt);customerService=ie(Zt);orderService=ie(N);toastr=ie(ee);modalConfig;enabledLoyaltyPoint=V(!1);stepper;pointUsed=0;pointBalance=V(0);redeemPointValue=V(0);email=V(null);phone=V(null);contactToResend=V(null);verifyType=V(null);clearPin=V(!1);selectedTab=V(0);constructor(){this.initModalConfig();let t=this.pageInitialService.Data.AppConfigJSON;this.redeemPointValue.set(t?.ApplicationLoyalty?.LoyaltyPoint?.RedeemPointValue),this.email.set(this.customerHttpService.Data?.Email),this.phone.set(this.customerHttpService.Data?.Mobile),this.initAvailablePoint(),this.initConfigEnabledVerify(),this.initPointUsed()}initModalConfig(){this.modalConfig=new H,this.modalConfig.title="Redeem Point",this.modalConfig.customWidth="500px",this.modalConfig.hideFooter=!0}initConfigEnabledVerify(){let t=this.pageInitialService.Data.AppConfigJSON,e=t?.ApplicationLoyalty?.VerifyRedemption,i=t?.ApplicationLoyalty?.Enabled,n=this.outletRegisterService.Data?.MemberPoint;this.enabledLoyaltyPoint.set(e&&i&&n)}initPointUsed(){let t=this.orderService.Data?.Order?.PointUsed;this.pointUsed=t||0,this.pointUsed>0&&this.selectedTab.set(2)}initAvailablePoint(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed,i=(t||0)-(e||0);this.pointBalance.set(i)}onClose(){this.dialogRef.close()}onCancelRedeem(){let t=this.orderService.Data;t.Order.PointUsed=0,t.Order.DiscountAmount=0,this.orderService.pushNewValue(t),this.toastr.info("Redeem point has been canceled","Canceled"),this.onClose()}onRedeem(){this.stepper.next(),this.stepper.next()}onVerify(t){switch(t){case"phone":this.contactToResend.set(this.phone()),this.handlingSentOtpViaPhone();break;case"email":this.contactToResend.set(this.email()),this.handlingSentOtpViaEmail();break;case"pin":this.stepper.next();break}this.verifyType.set(t)}handlingSentOtpViaPhone(){this.customerService.sendOtpViaWhatsApp(this.phone()).subscribe(t=>{this.stepper.selectedIndex==0&&this.stepper.next(),this.toastr.success(`OTP has been sent to ${this.phone()}`,"OTP Sent")})}handlingSentOtpViaEmail(){this.customerService.sendOtpViaEmail(this.email()).subscribe(t=>{this.stepper.selectedIndex==0&&this.stepper.next(),this.toastr.success(`OTP has been sent to ${this.email()}`,"Email Sent")})}onVerifyCode(t){switch(this.verifyType()){case"phone":this.verifyPhoneOtp(t);break;case"email":this.verifyEmailOtp(t);break;case"pin":this.verifyCustomerPin(t);break}}verifyEmailOtp(t){this.customerService.verifyEmailOtp(this.email(),t).subscribe(e=>{this.toastr.success(e.Message,"Successfully verified"),this.stepper.next()})}verifyPhoneOtp(t){this.customerService.verifyWhatsAppOtp(this.phone(),t).subscribe(e=>{this.toastr.success(e.Message,"Successfully verified"),this.stepper.next()})}verifyCustomerPin(t){let e=this.orderService.Data?.Order?.CustomerID;this.clearPin.set(!1),this.customerService.verifyPin(t,e).subscribe({next:i=>{this.toastr.success(i.Message,"Successfully verified"),this.stepper.next()},error:i=>{this.clearPin.set(!0)}})}onResendCode(){this.onVerify(this.verifyType())}onConfirm(){this.calculatePointToDiscount()}calculatePointToDiscount(){let t=this.pageInitialService.Data.AppConfigJSON,e=this.orderService.Data,i=e.RedeemableAmount,n=this.pointUsed,l=t.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,h=this.pointUsed*l;h>i&&(n=Math.ceil(i/l),h=i),(S.IsNotEmpty(e.Order.PointUsed)?e.Order.PointUsed:0)!=n&&(e.Order.PointUsed=n||0,e.Order.DiscountAmount=h,this.orderService.pushNewValue(e),this.toastr.success("Point has been redeemed","Success")),this.dialogRef.close()}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=w({type:o,selectors:[["modal-redeem-point"]],viewQuery:function(e,i){if(e&1&&Se(dl,5),e&2){let n;ye(n=xe())&&(i.stepper=n.first)}},decls:18,vars:18,consts:[["stepper",""],[3,"onClose","preventEnterEvent","config"],[1,"container"],[1,"d-flex","justify-content-center"],[1,"sell-stepper-redeem",3,"linear","selectedIndex"],[3,"editable","aria-labelledby"],["matStepLabel",""],[1,"mt-10"],[3,"onVerify","pointUsedChange","onRedeem","isVerifyEnabled","pointUsed","pointBalance","email","phone"],["aria-labelledby","stepDisabled",3,"editable"],[3,"resendCode","onVerify","type","contact","clearPin"],["aria-labelledby","stepDisabled"],[3,"onConfirm","onCancel","pointUsed","redeemPointValue","showCancelBtn"]],template:function(e,i){if(e&1){let n=v();r(0,"modal-material",1),g("onClose",function(){return u(n),f(i.onClose())}),r(1,"content")(2,"div",2)(3,"div",3)(4,"mat-stepper",4,0)(6,"mat-step",5),_(7,ml,1,0,"ng-template",6),r(8,"div",7)(9,"point-step",8),g("onVerify",function(h){return u(n),f(i.onVerify(h))}),D("pointUsedChange",function(h){return u(n),M(i.pointUsed,h)||(i.pointUsed=h),f(h)}),g("onRedeem",function(){return u(n),f(i.onRedeem())}),a()()(),r(10,"mat-step",9),_(11,ul,1,0,"ng-template",6),r(12,"div",7)(13,"verify-step",10),g("resendCode",function(){return u(n),f(i.onResendCode())})("onVerify",function(h){return u(n),f(i.onVerifyCode(h))}),a()()(),r(14,"mat-step",11),_(15,fl,1,0,"ng-template",6),r(16,"div",7)(17,"confirm-step",12),g("onConfirm",function(){return u(n),f(i.onConfirm())})("onCancel",function(){return u(n),f(i.onCancelRedeem())}),a()()()()()()()()}e&2&&(p("preventEnterEvent",!0)("config",i.modalConfig),s(4),p("linear",!0)("selectedIndex",i.selectedTab()),s(2),p("editable",!0)("aria-labelledby",i.selectedTab()==2?"stepDisabled":""),s(3),p("isVerifyEnabled",i.enabledLoyaltyPoint()),P("pointUsed",i.pointUsed),p("pointBalance",i.pointBalance())("email",i.email())("phone",i.phone()),s(),p("editable",!1),s(3),p("type",i.verifyType())("contact",i.contactToResend())("clearPin",i.clearPin()),s(4),p("pointUsed",i.pointUsed)("redeemPointValue",i.redeemPointValue())("showCancelBtn",i.selectedTab()==2))},dependencies:[X,ve,U,fe,oa,ia,ta,na,dn,fn,gn],styles:['@import"https://fonts.googleapis.com/icon?family=Material+Icons"; mat-stepper.sell-stepper-redeem .mat-horizontal-stepper-header{height:50px!important} mat-stepper.sell-stepper-redeem .mat-horizontal-stepper-header .mat-step-label{min-width:0px!important} mat-stepper.sell-stepper-redeem .mat-horizontal-stepper-header[aria-labelledby=stepDisabled]{pointer-events:none!important}']})};function gl(o,t){if(o&1){let e=v();I(0),r(1,"div",16),g("click",function(){u(e);let n=c(2);return f(n.onShowModalRedeem())}),r(2,"span"),C(3,"i",17),a(),r(4,"span"),d(5),b(6,"number"),a()(),O()}if(o&2){let e=c(2);s(5),y(" ",x(6,1,e.pointUsed)," Points redeemed ")}}function _l(o,t){if(o&1){let e=v();I(0),r(1,"tab",4)(2,"div",5)(3,"div",6)(4,"label",7),d(5,"Discount %"),a()(),r(6,"div",8)(7,"input",9),D("ngModelChange",function(n){u(e);let l=c();return M(l.discount1,n)||(l.discount1=n),f(n)}),a(),r(8,"span",10),d(9,"%"),a(),r(10,"span",11),d(11,"+"),a(),r(12,"input",12),D("ngModelChange",function(n){u(e);let l=c();return M(l.discount2,n)||(l.discount2=n),f(n)}),a(),r(13,"span",10),d(14,"%"),a()()(),r(15,"div",13)(16,"div",6)(17,"label",7),d(18),a()(),r(19,"div",14)(20,"input",15),D("ngModelChange",function(n){u(e);let l=c();return M(l.discountAmount,n)||(l.discountAmount=n),f(n)}),a(),_(21,gl,7,3,"ng-container",3),a()()(),O()}if(o&2){let e=c();s(),p("active",e.tabActive=="Discount"),s(6),P("ngModel",e.discount1),s(5),P("ngModel",e.discount2),s(6),y("Discount ",e.currencySymbol,""),s(2),p("disabled",e.pointUsed&&e.pointUsed>0),P("ngModel",e.discountAmount),s(),p("ngIf",e.pointUsed&&e.pointUsed>0)}}function Cl(o,t){if(o&1){let e=v();I(0),r(1,"tab",18)(2,"div",5)(3,"div",6)(4,"label",7),d(5,"Tax"),a()(),r(6,"div",8)(7,"ng-select",19),g("change",function(n){u(e);let l=c();return f(l.updateTax(n))}),a()()(),r(8,"div",13)(9,"div",6)(10,"label",7),d(11,"Surcharge"),a()(),r(12,"div",8)(13,"input",20),D("ngModelChange",function(n){u(e);let l=c();return M(l.surcharge,n)||(l.surcharge=n),f(n)}),a(),r(14,"span",10),d(15,"%"),a()()()(),O()}if(o&2){let e=c();s(7),p("clearable",!1)("ngModel",e.salesOrder.Order.TaxTypeID)("items",e.taxes),s(6),P("ngModel",e.surcharge),p("max",100)("min",-100)}}function hl(o,t){if(o&1){let e=v();I(0),r(1,"tab",21)(2,"div",5)(3,"div",22)(4,"strong"),d(5,"Discount After Tax"),a()(),r(6,"div",23)(7,"input",24),D("ngModelChange",function(n){u(e);let l=c();return M(l.discountAfterTax,n)||(l.discountAfterTax=n),f(n)}),g("ngModelChange",function(){u(e);let n=c();return f(n.onDiscountAfterTaxChange())}),a()()(),r(8,"div",25)(9,"div",22)(10,"label",7),d(11,"Discount Calculator"),a()(),r(12,"div",26)(13,"input",27),D("ngModelChange",function(n){u(e);let l=c();return M(l.discounts[0],n)||(l.discounts[0]=n),f(n)}),g("ngModelChange",function(){u(e);let n=c();return f(n.calculateDiscountCalculator())}),a(),r(14,"span"),d(15," %"),a(),r(16,"span",11),d(17,"+"),a(),r(18,"input",28),D("ngModelChange",function(n){u(e);let l=c();return M(l.discounts[1],n)||(l.discounts[1]=n),f(n)}),g("ngModelChange",function(){u(e);let n=c();return f(n.calculateDiscountCalculator())}),a(),r(19,"span"),d(20," %"),a(),r(21,"span",11),d(22,"+"),a(),r(23,"input",29),D("ngModelChange",function(n){u(e);let l=c();return M(l.discounts[2],n)||(l.discounts[2]=n),f(n)}),g("ngModelChange",function(){u(e);let n=c();return f(n.calculateDiscountCalculator())}),a(),r(24,"span"),d(25," %"),a()()()(),O()}if(o&2){let e=c();s(7),P("ngModel",e.discountAfterTax),s(6),P("ngModel",e.discounts[0]),s(5),P("ngModel",e.discounts[1]),s(5),P("ngModel",e.discounts[2])}}var ti=class o{constructor(t,e,i,n,l,h,A,le,Te,Fe){this.dialogRef=t;this.orderService=e;this.invoiceCalculatorService=i;this.pageInitialService=n;this.roleService=l;this.customerHttpService=h;this.orderProcessorService=A;this.promotionCouponService=le;this.dialog=Te;this.data=Fe;let je=this.pageInitialService?.Data?.AppConfigJSON;this.modalConfig.title="Discount and Tax",this.modalConfig.customWidth="480px",this.salesOrder=this.orderService.Data,this.userRole=this.roleService.Data,this.isPreferedPayment=je?.ApplicationLoyalty?.PreferedPayment,this.tabActive=this.data?.tabIndexActive,this.isEditOrder=this.orderProcessorService.Data.posState==2,this.customer=h.Data,this.initDiscountAndTax(),this.initAvailablePoint(),this.initTabLoyaltyTitle()}modalConfig=new H;discount1;discount2;discountAmount;surcharge;discountAfterTax;currencySymbol;salesOrder;discounts=[];taxes;selectedTax;userRole;tabActive;isEditOrder;isPreferedPayment;customerPoint;customer;tabLoyaltyTitle;pointUsed;availablePoint;initAvailablePoint(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed;this.customerPoint=t,this.availablePoint=(t||0)-(e||0)}initTabLoyaltyTitle(){let e=this.pageInitialService?.Data?.AppConfigJSON?.ApplicationLoyalty?.Label;this.tabLoyaltyTitle=S.IsNotEmpty(e)?e:"Loyalty"}initDiscountAndTax(){this.discount1=this.salesOrder.Order.Discount,this.discount2=this.salesOrder.Order.Discount2,this.discountAmount=this.salesOrder.Order.DiscountAmount,this.surcharge=this.salesOrder.Invoice.SurchargePcg,this.discountAfterTax=this.invoiceCalculatorService.discountAfterTax,this.currencySymbol=this.invoiceCalculatorService.currencySymbol,this.taxes=this.pageInitialService.Data.Taxes,this.selectedTax=this.invoiceCalculatorService.tax,this.pointUsed=this.salesOrder.Order.PointUsed}updateTax(t){this.selectedTax=t}onOk(){this.resetAppliedCoupon(),this.applyChangesDiscountAmount(),this.salesOrder.Order.Discount=this.discount1,this.salesOrder.Order.Discount2=this.discount2,this.salesOrder.Invoice.SurchargePcg=this.surcharge,this.salesOrder.Invoice.TempSurchargePcg=this.surcharge,this.invoiceCalculatorService.discountAfterTax=this.discountAfterTax,this.salesOrder.Order.TaxTypeID=this.selectedTax.ID,this.invoiceCalculatorService.tax=this.selectedTax,this.orderService.pushNewValue(this.salesOrder),this.onClose()}onClose(){this.dialogRef.close()}calculateDiscountCalculator(){var t=100;this.discounts.forEach(e=>{t=t*(100-e)/100}),this.discount1=100-t}onDiscountAfterTaxChange(){this.discountAmount=this.discountAfterTax;let e=this.invoiceCalculatorService.TotalBeforeTax-this.discountAmount,i=this.orderService.Data.Order.TaxTypeID,n=this.pageInitialService.Data.Taxes,l=S.FilterByID(n,i);if(S.IsNotEmpty(l)&&l.CalculationTypeID==0){let h=1+l.Rate/100,A=e*h;this.discountAmount=(A-(A-this.discountAfterTax))/h}}applyChangesDiscountAmount(){let t=this.salesOrder.Order.DiscountAmount;this.discountAmount!=t&&(this.salesOrder.Order.DiscountAmount=this.discountAmount)}onTabChange(t){this.tabActive=t}resetAppliedCoupon(){let t=this.promotionCouponService.coupon,e=this.salesOrder.Order.DiscountAmount;t&&t.Requirement?.Type==2&&e!=this.discountAmount&&(this.salesOrder.Order.PromotionCoupon=null,this.salesOrder.Order.PromotionNote=null)}onShowModalRedeem(){this.onClose(),this.dialog.open(ei)}static \u0275fac=function(e){return new(e||o)(m(j),m(N),m(Me),m(L),m(de),m(pt),m(W),m(Xe),m(re),m(Ae))};static \u0275cmp=w({type:o,selectors:[["POS-modal-discount"]],decls:7,vars:4,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],[3,"onTabChange"],[4,"ngIf"],["tabTitle","Discount",3,"active"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-3"],[1,"fw-bold","d-block"],[1,"col-9"],["type","text","data-cy","discount1","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"ms-1"],[1,"mx-2"],["type","text","data-cy","discount2","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],[1,"col-9","d-flex","align-items-center"],["type","text","data-cy","discountamount","autoNum","","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","disabled","ngModel"],["role","button",3,"click"],[1,"fa-solid","fa-info-circle","ms-2"],["matTooltipPosition","above","tabTitle","Tax"],["bindLabel","Label","appendTo","body","bindValue","ID","placeholder","Tax","data-cy","select-tax",2,"width","150px",3,"change","clearable","ngModel","items"],["type","text","data-cy","surcharge","autoNum","","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","85px",3,"ngModelChange","ngModel","max","min"],["tabTitle","Calculator"],[1,"col-4"],[1,"col-8","ps-6"],["type","text","num-neg","false","autoNum","","emptyInputBehavior","zero",1,"txtPrice","form-control",2,"width","100px",3,"ngModelChange","ngModel"],[1,"row","mt-6","g-0","d-flex","align-items-center","justify-content-start"],[1,"col-8","ps-4"],["type","text","data-cy","discountCal1","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal2","autoNum","","decimalPlaces","2","percentage","","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal3","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("keydown.F2",function(){return i.onOk()})("onOk",function(){return i.onOk()})("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),r(1,"content")(2,"div",1)(3,"custom-tabs",2),g("onTabChange",function(l){return i.onTabChange(l)}),_(4,_l,22,7,"ng-container",3)(5,Cl,16,6,"ng-container",3)(6,hl,26,4,"ng-container",3),a()()()()),e&2&&(p("config",i.modalConfig),s(4),p("ngIf",i.userRole.Discount),s(),p("ngIf",i.userRole.Tax),s(),p("ngIf",i.userRole.Discount))},dependencies:[X,z,Z,fe,te,K,oe,Yi,Kr,zr,ve,U,mt,ut,st,Ke],encapsulation:2})};var Cn=class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=_t({type:o});static \u0275inj=gt({imports:[X,fe]})};var hn=class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=_t({type:o});static \u0275inj=gt({imports:[X,fe,ze,ve,Ut,mt,ea,ut,Yi,Ke,un,qt,yr,Ht,ut,Vt,ra,tr,Ri,Cn,la,yt,Li,ca,Zi,mt,ti,kt,Ei]})};var bn=class o{constructor(t,e,i,n,l,h,A){this.orderProcessorService=t;this.posDataService=e;this.signalBroadCast=i;this.calculatorService=n;this.OrderHttpService=l;this.localDataService=h;this.posService=A;this.newSale=new He}newSale;retrySubmit(){let t=this.posService.Data.AppConfigJSON,e=this.posDataService.Data;this.posDataService.submitOrder(t).then(i=>{i.Success?(this.broadcastToCustomerDisplay(i),this.posDataService.pushNewValue(e),this.orderProcessorService.updatePosState(1,i)):(this.posDataService.pushNewValue(e),this.orderProcessorService.updatePosState(1,i))}).catch(i=>{console.log(i)})}broadcastToCustomerDisplay(t){let i=this.posDataService.Data.TotalPaidAmount-this.calculatorService.Data;this.signalBroadCast.BroadcastStateToCustomerDisplay(1,t.ObjectID,t.LoyaltyPoint,i).subscribe()}saveOffline(){let t=this.posDataService.Data,e=this.OrderHttpService.generatePOSDataForSubmission(t,!1);this.localDataService.syncOrder(e).subscribe(()=>{this.newSale.next()})}static \u0275fac=function(e){return new(e||o)(m(W),m(N),m(Wi),m(Me),m(Pe),m(Ye),m(L))};static \u0275cmp=w({type:o,selectors:[["app-retry"]],outputs:{newSale:"newSale"},decls:21,vars:0,consts:[[1,"card"],[1,"card-header","bg-gradient-danger"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-times-circle","me-1","text-danger"],[1,"card-body"],[1,"row","justify-content-center","g-0","mt-8"],[1,"col-8","text-center"],[1,"text-danger","fs-5"],[1,"row","mt-4","justify-content-center","g-0","mb-9"],[1,"col-5","text-center"],["type","button","matTooltipPosition","above","matTooltip","Upload your local / offline order to the cloud",1,"btn","btn-success","btn-lg","fs-3",3,"click"],[1,"card-footer","bg-light-gray"],[1,"row","justify-content-between","py-6"],[1,"col-auto"],["type","button","matTooltipPosition","above","matTooltip","Temporarily save data locally until connection to the server is restored",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-save","me-2",2,"font-size","14px"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"div",2)(3,"h2"),C(4,"i",3),d(5," Order Upload Fail! "),a()()(),r(6,"div",4)(7,"div",5)(8,"div",6)(9,"p",7),d(10," Slow Connection Detected, Check the customer invoice list first. If the transaction isn't there, click the 'Retry' button. "),a()()(),r(11,"div",8)(12,"div",9)(13,"button",10),g("click",function(){return i.retrySubmit()}),d(14," Retry Upload "),a()()()(),r(15,"div",11)(16,"div",12)(17,"div",13)(18,"button",14),g("click",function(){return i.saveOffline()}),C(19,"i",15),d(20,"Save Offline "),a()()()()())},dependencies:[X,Ke,ce],encapsulation:2})};var ha=(()=>{class o{constructor(){this.emailRegex=S.emailRegex,this.phoneNumberRegex=S.phoneNumberRegex}validate(e){let i=this.emailRegex,n=this.phoneNumberRegex,l=i.test(e.value),h=n.test(e.value);if(l||h||e.value=="")return null;{let A="Please input a valid email or phone number";return h?A="Please input a valid email":l&&(A="Please input a valid phone number"),{invalidEmailOrPhoneNumber:{value:e.value,errMessage:A}}}}static{this.\u0275fac=function(i){return new(i||o)}}static{this.\u0275dir=Pi({type:o,selectors:[["","pOSIsInvalidEmailOrPhoneNumber",""]],features:[at([{provide:Qo,useExisting:o,multi:!0}])]})}}return o})();function vl(o,t){o&1&&(I(0),r(1,"div",3)(2,"h4",4),d(3," For use this feature you must register first!"),C(4,"br"),d(5," Click the link below "),a()(),r(6,"a",5),d(7,"more information"),a(),d(8," > "),O())}function Sl(o,t){if(o&1){let e=v();r(0,"div",6)(1,"div",7)(2,"span",8),C(3,"i",9),a(),C(4,"input",10),r(5,"button",11),d(6,"Copy to Clipboard"),a()()(),r(7,"div",12)(8,"div",13)(9,"span",14),C(10,"i",15),a(),C(11,"input",16),r(12,"button",17),g("click",function(){u(e);let n=c();return f(n.onSendViaWhatsApp())}),d(13,"Send via WhatsApp"),a()()()}if(o&2){let e=c();s(4),p("value",e.data.link),s(),p("cdkCopyToClipboard",e.data.link),s(6),p("formControl",e.whatsAppNumberCtrl),s(),p("disabled",e.whatsAppNumberCtrl.invalid)}}var vi=class o{constructor(t,e,i){this._dialogRef=t;this._toast=e;this.data=i}modalConfig=new H;whatsAppNumberCtrl;ngOnInit(){this.modalConfig.title="Midtrans Payment Link",this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="500px",this.initWaNumberCtrl()}initWaNumberCtrl(){this.whatsAppNumberCtrl=new Jo(null,[ui.pattern("^[0-9]*$"),ui.required])}close(){this._dialogRef.close()}onSendViaWhatsApp(){let t=this.whatsAppNumberCtrl.value;if(t){let e="https://wa.me/"+t+"?text="+this.data.link;window.open(e,"_blank")}else this._toast.error("Phone Number must be insert")}static \u0275fac=function(e){return new(e||o)(m(j),m(ee),m(Ae))};static \u0275cmp=w({type:o,selectors:[["POS-modal-generate-link"]],standalone:!1,decls:5,vars:3,consts:[["hasLink",""],[3,"onOk","onCancel","onClose","config"],[4,"ngIf","ngIfElse"],[1,"input-group","mb-2",2,"width","350px"],[1,"fw-normal","d-block"],["href","https://midtrans.com/id/product/payment-link","target","_blank"],[1,"col-sm-12"],[1,"input-group"],["id","inputGroup-sizing-lg p-6",1,"input-group-text"],[1,"fa-solid","fa-link","fs-5"],["readonly","","type","text","aria-label","Link href",1,"form-control",3,"value"],["id","btnCopyLink","type","button",1,"btn","btn-outline-secondary",2,"width","150px",3,"cdkCopyToClipboard"],[1,"col-sm-12","mt-6"],[1,"input-group",2,"width","29.4rem"],["id","inputGroup-sizing-lg",1,"input-group-text","p-7"],[1,"fa-solid","fa-mobile-screen-button","fs-3"],["type","text","placeholder","Mobile Number (e.g. 6281500000000)","aria-label","Mobile Number (e.g. 6281500000000)",1,"form-control",3,"formControl"],["id","btnSend","type","button",1,"btn","btn-outline-secondary",3,"click","disabled"]],template:function(e,i){if(e&1){let n=v();r(0,"modal-material",1),g("onOk",function(){return u(n),f(i.close())})("onCancel",function(){return u(n),f(i.close())})("onClose",function(){return u(n),f(i.close())}),r(1,"content"),_(2,vl,9,0,"ng-container",2)(3,Sl,14,4,"ng-template",null,0,J),a()()}if(e&2){let n=Q(4);p("config",i.modalConfig),s(2),p("ngIf",i.data.link==null||i.data.link=="")("ngIfElse",n)}},dependencies:[z,te,K,bt,U,sa],encapsulation:2})};var Il=o=>({"rounded-0 rounded-start-2":o}),Ol=(o,t)=>({"bg-gradient-warning":o,"bg-gradient-danger":t}),Pl=o=>({offline:o}),Ml=o=>({"ms-2":o}),Dl=(o,t)=>({ID:o,Template:t}),wl=(o,t,e)=>({InvoiceID:o,OutID:t,Template:e}),kl=o=>({ID:o,Print:1,Printer:"Normal"}),Tl=o=>({ID:o});function El(o,t){if(o&1&&(r(0,"a",47),d(1,"Delivery Order"),a()),o&2){let e=c(3);p("queryParams",me(1,Dl,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function Rl(o,t){if(o&1&&(r(0,"a",48),d(1,"Invoice & Delivery Order"),a()),o&2){let e=c(3);p("queryParams",mi(1,wl,e.completeData.ObjectID,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function Nl(o,t){if(o&1&&(r(0,"a",49),d(1,"Invoice (No Price)"),a()),o&2){let e=c(3);p("href",e.getInvoicePrintURL(!0),tt)}}function Vl(o,t){if(o&1&&(r(0,"a",50),d(1,"Packing Slip"),a()),o&2){let e=c(3);p("queryParams",R(1,kl,e.completeData.OutDeliveryID))}}function Al(o,t){if(o&1&&(r(0,"div",30),C(1,"button",41),r(2,"div",42),_(3,El,2,4,"a",43)(4,Rl,2,5,"a",44)(5,Nl,2,1,"a",45)(6,Vl,2,3,"a",46),a()()),o&2){let e=c(2);s(3),p("ngIf",e.completeData.OutDeliveryID),s(),p("ngIf",e.completeData.OutDeliveryID),s(),p("ngIf",e.completeData),s(),p("ngIf",e.completeData.OutDeliveryID)}}function Ll(o,t){o&1&&(r(0,"div",32)(1,"div",36)(2,"p",51),d(3," Transaction saved to your browser's local storage. Please upload when connection is restored! "),a()()())}function Bl(o,t){if(o&1){let e=v();r(0,"div",33)(1,"div",52)(2,"div",53),g("click",function(){u(e);let n=c(2);return f(n.changeReceiptContact())}),C(3,"i"),a(),r(4,"input",54),g("ngModelChange",function(n){u(e);let l=c(2);return f(l.isPhoneOrEmail(n))}),a()(),r(5,"div",55)(6,"button",56),g("click",function(){u(e);let n=c(2);return f(n.sendReceiptToContact())}),d(7," Send Receipt "),a()()()}if(o&2){let e=c(2);s(3),he(e.receiptIcon+" fs-4"),s(),p("formControl",e.customerContact),s(2),p("disabled",e.customerContact.invalid)}}function Fl(o,t){if(o&1&&(r(0,"small",34),d(1),a()),o&2){let e=c(2);s(),y(" ",e.customerContact.errors==null||e.customerContact.errors.invalidEmailOrPhoneNumber==null?null:e.customerContact.errors.invalidEmailOrPhoneNumber.errMessage," ")}}function jl(o,t){if(o&1){let e=v();r(0,"button",57),g("click",function(){u(e);let n=c(2);return f(n.onRetry())}),d(1," Retry Upload "),a()}}function Hl(o,t){if(o&1){let e=v();r(0,"div",60)(1,"button",61),g("click",function(){u(e);let n=c(3);return f(n.generateLink())}),C(2,"i",62),d(3,"Generate Payment Link "),a()()}}function Ul(o,t){if(o&1){let e=v();r(0,"div",60)(1,"button",63),g("click",function(){u(e);let n=c(3);return f(n.verifyPaymentSettlement())}),C(2,"i",64),d(3,"Verify Payment Settlement "),a()()}}function Wl(o,t){if(o&1&&(r(0,"div",40)(1,"div",58),_(2,Hl,4,0,"div",59)(3,Ul,4,0,"div",59),a()()),o&2){let e=c(2);s(2),p("ngIf",e.completeData.PaymentStateID==1),s(),p("ngIf",e.isNotEmpty(e.paymentGatewayService.getTransactionId()))}}function Ql(o,t){if(o&1){let e=v();r(0,"div",9)(1,"div",26)(2,"div",27)(3,"h2"),C(4,"i",28),d(5," Sell Complete "),r(6,"small",29),d(7),a()(),r(8,"div"),_(9,Al,7,4,"div",30),a()()(),r(10,"div",14)(11,"div",31),_(12,Ll,4,0,"div",32)(13,Bl,8,5,"div",33)(14,Fl,2,1,"small",34),r(15,"div",35)(16,"div",36)(17,"div",37),_(18,jl,2,0,"button",38),r(19,"button",39),g("click",function(){u(e);let n=c();return f(n.newSale())}),d(20," New Sale (F8) "),a()()()()()(),_(21,Wl,4,2,"div",40),a()}if(o&2){let e=c();s(),p("ngClass",me(9,Ol,(!e.isOrderDateNow||e.completeData.PaymentStateID<3)&&e.completeData.PaymentStateLabel!="Offline",e.completeData.PaymentStateLabel=="Offline")),s(6),y(" (",e.completeData.PaymentStateLabel,")"),s(2),E(e.completeData.PaymentStateLabel=="Offline"?9:-1),s(2),p("ngClass",R(12,Pl,e.completeData.PaymentStateLabel=="Offline")),s(),E(e.completeData.PaymentStateLabel=="Offline"?12:13),s(2),E(e.customerContact!=null&&e.customerContact.invalid&&(e.customerContact!=null&&e.customerContact.dirty||e.customerContact!=null&&e.customerContact.touched)?14:-1),s(4),E(e.completeData.PaymentStateLabel=="Offline"&&!e.isSuccessRetrySubmit()?18:-1),s(),p("ngClass",R(14,Ml,e.completeData.PaymentStateLabel=="Offline")),s(2),E(e.isOnline&&(e.completeData==null?null:e.completeData.PaymentStateID)==1||e.isNotEmpty(e.paymentGatewayService.getTransactionId())?21:-1)}}function ql(o,t){if(o&1){let e=v();r(0,"app-retry",65),g("newSale",function(){u(e);let n=c();return f(n.newSale())}),a()}}function $l(o,t){if(o&1&&(I(0),r(1,"a",66),d(2),a(),O()),o&2){let e=c();s(),p("queryParams",R(2,Tl,e.completeData.ObjectID)),s(),y(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function Jl(o,t){if(o&1&&(r(0,"span",67),d(1),a()),o&2){let e=c();s(),y(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function Gl(o,t){if(o&1&&(I(0),d(1),b(2,"number"),O()),o&2){let e=c().$implicit;s(),Ue(" ",e.CurrencySymbol," ",x(2,2,e.Amount)," ")}}function zl(o,t){o&1&&d(0," - ")}function Kl(o,t){if(o&1&&(r(0,"div",69)(1,"div",70),d(2),a(),r(3,"div",71),_(4,Gl,3,4,"ng-container",13)(5,zl,1,0,"ng-template",null,1,J),a()()),o&2){let e=t.$implicit,i=Q(6),n=c(2);s(2),T(e.Label),s(2),p("ngIf",n.role.PriceVisible)("ngIfElse",i)}}function Yl(o,t){if(o&1&&(r(0,"div",14),_(1,Kl,7,3,"div",68),a()),o&2){let e=c();s(),p("ngForOf",e.itemSummary)}}function Xl(o,t){if(o&1&&(r(0,"div",75)(1,"div",76),d(2),a(),r(3,"div",77),d(4),b(5,"number"),a()()),o&2){let e=t.$implicit,i=t.index,n=c(2);s(),p("hidden",!n.role.PriceVisible),s(),Ue(" ",e.Label,": ",e.CurrencySymbol," "),s(),p("hidden",!n.role.PriceVisible)("ngClass",i+1===n.amountSummary.length?"amount":""),s(),y(" ",x(5,6,e.Amount)," ")}}function Zl(o,t){if(o&1&&(r(0,"div",75)(1,"div",76),d(2),a(),r(3,"div",79),d(4),b(5,"number"),a()()),o&2){let e=t.$implicit,i=c(3);s(),p("hidden",!i.role.PriceVisible),s(),Ue(" ",e.Label,": ",e.CurrencySymbol," "),s(),p("hidden",!i.role.PriceVisible),s(),y(" ",x(5,5,e.Amount)," ")}}function es(o,t){if(o&1&&(I(0),r(1,"div",78),_(2,Zl,6,7,"div",73),a(),O()),o&2){let e=c(2);s(2),p("ngForOf",e.paymentSummary)}}function ts(o,t){if(o&1&&(r(0,"div",72),_(1,Xl,6,8,"div",73)(2,es,3,1,"ng-container",74),a()),o&2){let e=c();s(),p("ngForOf",e.amountSummary),s(),p("ngIf",(e.paymentSummary==null?null:e.paymentSummary.length)>0)}}function is(o,t){if(o&1&&(r(0,"div",16)(1,"div",80)(2,"p",81),d(3,"INVALID AMOUNT CHARGE, CORRECT AMOUNT"),a(),r(4,"P",82),d(5),b(6,"number"),a()()()),o&2){let e=c();s(5),y("",x(6,1,e.completeData==null?null:e.completeData.Final)," ")}}function ns(o,t){if(o&1&&(r(0,"a",22),C(1,"i",83),a()),o&2){let e=c();p("href",e.getInvoicePrintURL(!1),tt)}}function os(o,t){if(o&1&&(r(0,"div",9)(1,"div",11)(2,"h3",12),d(3,"Point Balance"),a()(),C(4,"div",84),a()),o&2){let e=c();s(4),p("innerHtml",e.completeData.LoyaltyPoint,Oi)}}function rs(o,t){if(o&1&&C(0,"pos-receipt",85),o&2){let e=c(2);p("data",e.receiptTemplate)("printTemplate",e.outletRegister.PrintTemplate)("config",e.posStorage.AppConfigJSON)("priceVisibleRestriction",!e.role.PriceVisible)("outletInfo",e.outletRegister)("isUnknownError",e.currentSellState==e.sellState.UploadOrderFail)("isOffline",e.isOnline==!1)("stylesheet",e.posStorage.StylesSheet)}}function as(o,t){if(o&1&&C(0,"pos-receipt-a4",86),o&2){let e=c(3);p("data",t)("printTemplate",e.outletRegister.PrintTemplate)("config",e.posStorage.AppConfigJSON)("workOrderMode",!1)("stylesheet",e.posStorage.StylesSheet)}}function ls(o,t){if(o&1&&(_(0,as,1,5,"pos-receipt-a4",86),b(1,"async")),o&2){let e,i=c(2);E((e=x(1,1,i.receiptTemplateA4$))?0:-1,e)}}function ss(o,t){if(o&1&&_(0,rs,1,8,"pos-receipt",85)(1,ls,2,3),o&2){let e=c();E(e.receiptTemplate&&e.printMode==2?0:-1),s(),E(e.printMode==1?1:-1)}}function cs(o,t){o&1&&(r(0,"div",25)(1,"h1"),d(2," Cannot generate print preview because of client-server amount Mismatch "),a()())}var vn=class o{constructor(t,e,i,n,l,h,A,le,Te,Fe,je,oi,wt,Yn,Xn,ri,Fa,_o,Co,ja){this._posDataService=t;this._posService=e;this._orderProcessorService=i;this._OrderHttpService=n;this._PaymentHttpService=l;this._receiptService=h;this._outletService=A;this._toastr=le;this._onlineStatusService=Te;this._matDialog=Fe;this._signalBroadCast=je;this._calculatorService=oi;this._userRoleService=wt;this._router=Yn;this._receiptCalculatorService=Xn;this.datePipe=ri;this.decimalPipe=Fa;this.paymentGatewayService=_o;this.paymentHttpService=Co;this.shoppingCartService=ja}whatsappSendReceiptService=ie(lo);handleF8(){this.newSale()}salesOrder=new ct;receiptTemplate=null;receiptTemplateA4$;completeData=new wr;printMode=2;outletRegister=new Bi;role;finalAmountDifferent=!1;amountSummary=[];itemSummary=[];paymentSummary=[];isOnline=!1;destroy$=new G;get posStorage(){return this._posService.Data}currentSellState;isOrderDateNow;sellState=Ie;receiptIcon="fa-brands fa-whatsapp";customerContact=new ht;printOnPayment=V(!0);isSuccessRetrySubmit=V(!1);ngOnInit(){this.resetUrlAfterRedirect(),this.subscribeToObservableChanges()}subscribeToObservableChanges(){this._onlineStatusService.getOnlineStatus$().pipe(k(this.destroy$)).subscribe(t=>{this.isOnline=t}),this._userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.role=t}),this._posDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.salesOrder=t}),this._outletService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.outletRegister=t;let e=this.outletRegister?.PrintTemplate?.PrintMode;this.initPrintMode(e)}),this._orderProcessorService.Data$.pipe(se(t=>t.posState===1||t.posState===9),k(this.destroy$)).subscribe(t=>{if(this.currentSellState=t.posState,this.generateCompleteSummary(),this._OrderHttpService.Data){let e=this.posStorage?.AppConfigJSON?.ModuleSell?.OrderComplete?.PrintOnPayment;this.printOnPayment.set(e),this.completeData=this._OrderHttpService.Data,this.checkFinalAmountDifferent(),this.setLoyaltyLabelConfig(),this.InitPrintInvoice(),this.initCustomerContact(),this.sendEmailOnComplete(),this.checkOrderDateIsNow(),this.clearShoppingCartInLocalStorage()}})}clearShoppingCartInLocalStorage(){this.shoppingCartService.clearCartItemsInLocalStorage()}generateCompleteSummary(){this.itemSummary=this._receiptService.generateCartItemSummary(),this.amountSummary=this._receiptCalculatorService.generateAmountSummary(),this.paymentSummary=this._receiptService.generatePaymentSummary()}initPrintMode(t){this.isOnline?this.printMode=t:this.printMode=2}sendEmailOnComplete(){let t=this.posStorage?.AppConfigJSON?.ModuleSell?.OrderComplete?.EmailReceipt,e=this.completeData?.Contact?.Email;t&&S.IsNotEmpty(e)&&this.sendEmail()}resetUrlAfterRedirect(){this._router.events.pipe(k(this.destroy$)).subscribe(t=>{t instanceof jo&&(t?.url?.includes("Sell")||(this._orderProcessorService.createNewTransactionInSameOutletRegister(),this._signalBroadCast.BroadcastStateToCustomerDisplay(0).subscribe()))})}InitPrintInvoice(){this.currentSellState==1&&(this.checkOrderNumber(),this.print())}initCustomerContact(){if(this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.DefaultReceiptChannel==0){this.receiptIcon="fa-solid fa-envelope";let t=this.completeData?.Contact?.Email;this.customerContact.setValue(t)}else if(this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.DefaultReceiptChannel==1){this.receiptIcon="fa-brands fa-whatsapp";let t=this.completeData?.Contact?.Mobile;this.customerContact.setValue(t)}}isPhoneOrEmail(t){let e=S.emailRegex,i=S.phoneNumberRegex,n=e,l=i,h=n.test(t),A=l.test(t);if(h)return this.receiptIcon="fa-solid fa-envelope","Email";if(A)return this.receiptIcon="fa-brands fa-whatsapp","Mobile"}changeReceiptContact(){this.receiptIcon=="fa-solid fa-envelope"?(this.receiptIcon="fa-brands fa-whatsapp",this.customerContact.setValue(this.completeData?.Contact?.Mobile)):(this.receiptIcon="fa-solid fa-envelope",this.customerContact.setValue(this.completeData?.Contact?.Email))}checkOrderDateIsNow(){let t=this.completeData.OrderTimeString,e=this.datePipe.transform(this.salesOrder.Order.Date,"dd MMM yyyy");this.isOrderDateNow=t.includes(e)}checkFinalAmountDifferent(){if(this.currentSellState==1){let t=this.posStorage.AppConfigJSON,e=this.completeData.Final,i=this._calculatorService.Data,n=t.ModuleSell.ToleranceAmount,l=e-i;if(l!=n&&l!=0){this.finalAmountDifferent=!0;let h=this.decimalPipe.transform(e);setTimeout(()=>{this._toastr.warning(`Final Amount should be ${h}! Use Print Receipt to print the correct Receipt!`,"Invalid Amount charged",{timeOut:1e4})},500)}else this.finalAmountDifferent=!1}}checkOrderNumber(){this.completeData.InvoiceNumber!=this.salesOrder.Order.Number&&(this._toastr.warning("Your transaction number is changed to "+this.completeData.InvoiceNumber,"Transaction Number Changed!"),this.salesOrder.Order.Number=this.completeData.InvoiceNumber)}generateLink(){this.posStorage.AppConfigJSON.PaymentConfigLink==!0&&this._matDialog.open(vi);let t={InvoiceID:this.completeData.ObjectID};this._PaymentHttpService.generateLink(t).subscribe({next:e=>{this._matDialog.open(vi,{data:{link:e.token.redirect_url}})},error:e=>{this._toastr.error(e.Message,"Couldn't generate link!")}})}newSale(){try{this._orderProcessorService.createNewTransactionInSameOutletRegister(),this._signalBroadCast.BroadcastStateToCustomerDisplay(0).subscribe(),this.paymentGatewayService.resetPaymentMethod(),this._router.navigate([],{queryParams:{ID:null}})}catch(t){console.error(t),this._toastr.error(t,"Error redirecting to NEW mode")}}onRetry(){this._onlineStatusService.isOnline?this._posDataService.uploadOfflineOrder().subscribe(e=>{e.Success?(this.isSuccessRetrySubmit.set(!0),this.broadcastToCustomerDisplay(e),this._orderProcessorService.updatePosState(1,e)):this._orderProcessorService.updatePosState(1,e)}):this._toastr.error("Please check your internet connection and try again.","Connection Required")}broadcastToCustomerDisplay(t){let i=this._posDataService.Data.TotalPaidAmount-this._calculatorService.Data;this._signalBroadCast.BroadcastStateToCustomerDisplay(1,t.ObjectID,t.LoyaltyPoint,i).subscribe()}getInvoicePrintURL(t){let e="/print/Invoice"+(this.outletRegister.PrintTemplate.PrintMode===2?"Mini":""),i="";return t&&(i="&Print=1&Price=0"),S.StringFormat("{0}?ID={1}&Template={2}{3}",e,this.completeData.ObjectID,this.outletRegister?.PrintTemplate?.ID?.toString(),i)}sendEmail(){if(!this.role.Email){this._toastr.info("You do not have required Role",Le.Info);return}this._OrderHttpService.sendEmail(this.customerContact.value,this.completeData.ObjectID).then(t=>{this._toastr.success(t.Message,"Email sent!")})}sendReceiptByWhatsaap(){let t=this.customerContact.value;this.whatsappSendReceiptService.createCustomerFromNewNumberAndSendReceipt(t,this._calculatorService.currencySymbol,this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.WhatsappReceipt,{Final:this.completeData.Final,InvoiceNumber:this.completeData.InvoiceNumber,ObjectID:this.completeData.ObjectID},this._posService.Data?.WhatsAppConfigJSON?.TextReceipt)}print(){this.printMode==2?(this.printReceiptMini(),this.printOnPayment()&&this.printWindow()):this.printMode==1&&this.printReceiptA4()}printReceiptMini(){this.receiptTemplate=this._receiptService.generateReceiptMini()}setLoyaltyLabelConfig(){let t=this.posStorage?.AppConfigJSON;t.LoyaltyLabel=t.ApplicationLoyalty.Label,this.posStorage.AppConfigJSON=t}printReceiptA4(){this.receiptTemplateA4$==null?this.receiptTemplateA4$=this._OrderHttpService.generateReceiptA4(this.completeData.ObjectID).pipe(k(this.destroy$),et(t=>(t.Data.AfterSell=!0,t.Data)),ai(t=>{throw this._toastr.error(`Could not print in A4 format!
|
|
5
|
-
Printing in 8mm format instead!`,"Error!"),this.printReceiptMini(),t}),Ne(()=>{this.printOnPayment()&&this.printWindow()}),Rt(1)):this.printWindow()}printWindow(){let t=document.title;document.title=this.getCustomPrintFileName(),setTimeout(()=>{window.print(),document.title=t},500)}getCustomPrintFileName(){return`Invoice_${this.completeData?.InvoiceNumber}`}isNotEmpty(t){return S.IsNotEmpty(t)}verifyPaymentSettlement(){let t=this._calculatorService.Data,e=this.paymentGatewayService.paymentMethod,i=this.paymentGatewayService.generatePaymentVerificationData(t,e.EMoneyTypeID);this.paymentHttpService.VerifyPayment(i,e.EMoneyTypeID).pipe(k(this.destroy$)).subscribe({next:n=>{this._toastr.success(n.Message,"QR Settlement")}})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}sendReceiptToContact(){let t=S.emailRegex,e=S.phoneNumberRegex,i=this.customerContact.value,n=t.test(i),l=e.test(i);n?this.sendEmail():l&&this.sendReceiptByWhatsaap()}static \u0275fac=function(e){return new(e||o)(m(N),m(L),m(W),m(Pe),m(ao),m(Ot),m(Y),m(ee),m(qe),m(re),m(Wi),m(Me),m(de),m(Ct),m(Ui),m(We),m(Z),m(Qi),m(ao),m(De))};static \u0275cmp=w({type:o,selectors:[["sell-complete"]],hostBindings:function(e,i){e&1&&g("keydown.F8",function(l){return i.handleF8(l)},!1,it)},features:[at([lo])],decls:31,vars:14,consts:[["OFFLINE",""],["PRICE_HIDE",""],[1,"sell-complete"],[1,"container-fluid","pt-8"],[1,"row","pb-8","border-bottom"],[1,"col-auto","pe-0","order-0","ps-7"],[1,"me-5","float-start","fw-normal"],[1,"row","mt-8","px-6"],[1,"col-md-8"],[1,"card"],[1,"col-md-4"],[1,"card-header","bg-light-gray"],[1,"text-dark"],[4,"ngIf","ngIfElse"],[1,"card-body"],["class","card-footer bg-white",4,"ngIf"],[1,"card-footer","bg-gradient-warning"],[1,"card-footer","py-8","d-flex","justify-content-center"],[1,"btn-group","d-flex","justify-content-center",2,"width","26rem"],["matTooltipPosition","above",1,"w-100",3,"matTooltip"],["role","button",1,"btn","btn-outline-secondary","w-100",3,"click","ngClass","disabled"],[1,"fa-solid","fa-print","me-2"],["target","_blank","matTooltipPosition","above","matTooltip","Print in New Tab",1,"btn","btn-outline-secondary","d-flex","align-items-center","justify-content-center","fs-5","border-start-0",2,"width","3rem",3,"href"],["class","card",4,"ngIf"],[1,"print_containers"],[1,"print-error-message"],[1,"card-header",3,"ngClass"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-check","me-1"],[1,"fst-italic"],[1,"dropdown"],[1,"container",3,"ngClass"],[1,"row"],[1,"d-flex","align-items-center","g-0","mt-5","w-100"],[1,"text-danger"],[1,"row","mt-12","justify-content-center","g-0","mb-9"],[1,"col-12","text-center"],[1,"d-flex","justify-content-between","w-100"],["type","button","matTooltip","Upload your local / offline order to the cloud","matTooltipPosition","above",1,"btn","btn-success","btn-lg","w-100","text-white","me-2"],["type","button",1,"btn","btn-success","btn-lg","w-100",3,"click","ngClass"],[1,"card-footer","bg-light-gray"],["type","button","id","dropdownMenuButton","data-bs-toggle","dropdown","aria-haspopup","true","aria-expanded","false",1,"btn","dropdown-toggle"],["aria-labelledby","dropdownMenuButton",1,"dropdown-menu","dropdown-menu-end"],["class","dropdown-item","routerLink","/print/OutDelivery","target","_blank",3,"queryParams",4,"ngIf"],["class","dropdown-item","routerLink","/print/InvoiceNOutD","target","_blank",3,"queryParams",4,"ngIf"],["class","dropdown-item","target","_blank",3,"href",4,"ngIf"],["class","dropdown-item","routerLink","/print/PackingSlip","target","_blank",3,"queryParams",4,"ngIf"],["routerLink","/print/OutDelivery","target","_blank",1,"dropdown-item",3,"queryParams"],["routerLink","/print/InvoiceNOutD","target","_blank",1,"dropdown-item",3,"queryParams"],["target","_blank",1,"dropdown-item",3,"href"],["routerLink","/print/PackingSlip","target","_blank",1,"dropdown-item",3,"queryParams"],[1,"text-danger","fs-5"],[1,"d-flex","align-items-center","border-bottom","me-2",2,"width","65%"],[1,"px-2","cursor","hover-color",3,"click"],["type","text","placeholder","Email / Whatsapp","id","customerContact","required","","pOSIsInvalidEmailOrPhoneNumber","",1,"form-control","border-0","fs-4",3,"ngModelChange","formControl"],[1,"pb-2",2,"width","35%"],["type","button",1,"btn","btn-light-gray","border","w-100",3,"click","disabled"],["type","button","matTooltip","Upload your local / offline order to the cloud","matTooltipPosition","above",1,"btn","btn-success","btn-lg","w-100","text-white","me-2",3,"click"],[1,"row","justify-content-between"],["class","col-auto my-6",4,"ngIf"],[1,"col-auto","my-6"],["type","button","data-cy","payment-link",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-money-bill-wave","me-2"],["type","button","data-cy","verify-payment-settelment",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-circle-check","me-2"],[3,"newSale"],["target","_blank","routerLink","/menu/Orders/Orders/Customer_Invoice/Info",1,"text-dark","fst-italic",3,"queryParams"],[1,"text-dark","fst-italic"],["class","row my-1",4,"ngFor","ngForOf"],[1,"row","my-1"],[1,"col-8"],[1,"col-4","text-end"],[1,"card-footer","bg-white"],["class","d-flex justify-content-end","style","line-height: 30px",4,"ngFor","ngForOf"],[4,"ngIf"],[1,"d-flex","justify-content-end",2,"line-height","30px"],[1,"text-end",3,"hidden"],[1,"text-end","w-50",3,"hidden","ngClass"],[1,"border-top"],[1,"text-end","w-50",3,"hidden"],[1,"text-end"],[1,"fw-bold"],[1,"text-danger",2,"font-size","38px"],[1,"fa-regular","fa-arrow-up-right-from-square"],[1,"card-body","pb-0","text-center",3,"innerHtml"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo","isUnknownError","isOffline","stylesheet"],[3,"data","printTemplate","config","workOrderMode","stylesheet"]],template:function(e,i){if(e&1){let n=v();r(0,"section",2)(1,"div",3)(2,"div",4)(3,"div",5)(4,"h1",6),d(5,"Order Complete"),a()()(),r(6,"div",7)(7,"div",8),_(8,Ql,22,16,"div",9)(9,ql,1,0,"app-retry"),a(),r(10,"div",10)(11,"div",9)(12,"div",11)(13,"h3",12),_(14,$l,3,4,"ng-container",13)(15,Jl,2,1,"ng-template",null,0,J),a()(),_(17,Yl,2,1,"div",14)(18,ts,3,2,"div",15)(19,is,7,3,"div",16),r(20,"div",17)(21,"div",18)(22,"div",19)(23,"button",20),g("click",function(){return u(n),f(i.print())}),C(24,"i",21),d(25,"Print Receipt "),a()(),_(26,ns,2,1,"a",22),a()()(),_(27,os,5,1,"div",23),a()()()(),r(28,"div",24),_(29,ss,2,2)(30,cs,3,0,"div",25),a()}if(e&2){let n=Q(16);s(8),E(i.currentSellState==i.sellState.IsComplete?8:9),s(6),p("ngIf",i.isOnline&&i.completeData.ObjectID)("ngIfElse",n),s(3),E(i.itemSummary?17:-1),s(),p("ngIf",!i.finalAmountDifferent&&i.role.PriceVisible),s(),E(i.finalAmountDifferent?19:-1),s(3),p("matTooltip",i.printOnPayment()?"Print in Current Window":"You must enable print on payment config to use this button"),s(),p("ngClass",R(12,Il,i.completeData.PaymentStateLabel!="Offline"))("disabled",i.printOnPayment()==!1),s(3),E(i.completeData.PaymentStateLabel!="Offline"?26:-1),s(),p("ngIf",i.completeData==null?null:i.completeData.LoyaltyPoint),s(2),E(i.finalAmountDifferent==!1?29:30)}},dependencies:[X,q,be,z,Ve,Z,fe,te,K,Bt,yt,en,pa,Gi,Ji,Vt,Nt,bn,ze,bt,Ke,ce,ha],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.print_containers[_ngcontent-%COMP%]{display:none}@media print{.print_containers[_ngcontent-%COMP%]{display:block;text-align:left}.sell-complete[_ngcontent-%COMP%]{display:none}}.sell-complete[_ngcontent-%COMP%] .card .card-header{border-bottom:1px solid rgba(0,0,0,.125);padding-bottom:.9375rem}.sell-complete[_ngcontent-%COMP%] .card .card-header h2{font-size:2rem}.sell-complete[_ngcontent-%COMP%] .card .card-body .container{max-width:390px;margin-top:30px;margin-bottom:30px}.sell-complete[_ngcontent-%COMP%] .card .card-body .container.offline{margin-top:12px}.sell-complete[_ngcontent-%COMP%] .card .card-body mat-form-field input.form-control{border:none;font-size:16px;padding-left:2px}.sell-complete[_ngcontent-%COMP%] .card .card-body mat-form-field input.form-control:focus{border:none}.sell-complete[_ngcontent-%COMP%] .card .card-body [type=button]{-webkit-appearance:initial}.sell-complete[_ngcontent-%COMP%] .card .card-body input{font-size:1rem}.sell-complete[_ngcontent-%COMP%] .card .card-body .btn-success{padding:.5rem 1rem;font-size:1.25rem}.sell-complete[_ngcontent-%COMP%] .amount[_ngcontent-%COMP%]{font-size:16px}.hover-color[_ngcontent-%COMP%]:hover{color:#d1d1d1}.print-error-message[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;min-height:100vh;text-align:center}.print-error-message[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{color:#dc3545;font-weight:500}"]})};var Sn=class o{constructor(t,e){this._dialogRef=t;this._orderProcessorService=e;this.modalConfig.title="Clear Order?",this.modalConfig.headerType=Le.Success}modalConfig=new H;ngOnInit(){}onOk(){this._orderProcessorService.createNewTransactionInSameOutletRegister(!1),this._orderProcessorService.emitClearOrder(),this.close()}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||o)(m(j),m(W))};static \u0275cmp=w({type:o,selectors:[["POS-modal-clear"]],standalone:!1,decls:4,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"fw-normal"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"h4",1),d(3),a()()()),e&2&&(p("config",i.modalConfig),s(3),T("This will replace current order's item(s) with blank order."))},dependencies:[U],encapsulation:2})};var uo=(i=>(i[i.INTERNAL=1]="INTERNAL",i[i.EKSTERNAL=2]="EKSTERNAL",i[i.EKSTERNALINTERNAL=3]="EKSTERNALINTERNAL",i))(uo||{});function ds(o,t){if(o&1){let e=v();r(0,"div",1)(1,"radio-options",12),D("modelChange",function(n){u(e);let l=c();return M(l.selectedProvider,n)||(l.selectedProvider=n),f(n)}),a(),r(2,"label",13),d(3,"Choose Provider"),a()()}if(o&2){let e=c();s(),p("options",e.couponProviders()),P("model",e.selectedProvider),p("disabled",e.hasSelectedCoupon)}}function ms(o,t){if(o&1){let e=v();r(0,"button",14),g("click",function(){u(e);let n=c();return f(n.onRemoveCoupon())}),d(1," Remove "),a()}}function us(o,t){if(o&1){let e=v();r(0,"button",15),g("click",function(n){u(e);let l=c();return f(l.onOk(n))})("keyup.F2",function(n){u(e);let l=c();return f(l.onOk(n))}),d(1," Ok (F2) "),a()}}var yn=class o{constructor(t,e,i,n,l,h,A){this.promotionService=t;this._orderDataService=e;this._posService=i;this.dialogRef=n;this.roleService=l;this.toastr=h;this.promotionCouponProvider=A;this.destroy$=new G,this.modeType=!1,this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash",this.couponInputLock=l.Data.CouponInputLock,this.initProviders(),this.subscribeToObservable(),this.initModalConfig(),this.initSelectedProvider()}modalConfig=new H;modeType;typeText;typeIcon;PromotionCoupon;PromotionNote;couponType;destroy$;onInputCouponCode=!1;selectedProvider="Internal";couponInputLock=!1;startInput;couponredemptionType=uo;couponProviders=V([]);initModalConfig(){this.modalConfig.title="Redeem Coupon",this.modalConfig.customWidth="400px",this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}subscribeToObservable(){this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.PromotionCoupon=t.Order.PromotionCoupon,this.PromotionNote=t.Order.PromotionNote})}initProviders(){this.couponProviders.update(t=>{let e=this._posService.Data.AppConfigJSON.ProviderOption,i=e.map(n=>({Key:n,Value:n}));return e?.length>0?[{Key:"Internal",Value:"DealPOS"},...i]:[]})}initSelectedProvider(){let t=this.promotionCouponProvider.coupon,e=this.promotionCouponProvider.couponProvider;S.IsNotEmpty(t)?this.selectedProvider=e:this.selectedProvider="Internal"}get hasSelectedCoupon(){let t=this._orderDataService.Data.Order;return S.IsNotEmpty(t.PromotionCoupon)}onOk(t){(t!="Enter"||t=="Enter"&&this.onInputCouponCode)&&this.onSubmitCoupon()}onSubmitCoupon(){S.IsNotEmpty(this.PromotionCoupon)?(this.applyCouponCode(),this.dialogRef.close()):this.toastr.warning("Coupon can't be empty","Warning")}onRemoveCoupon(){let t=this.promotionCouponProvider.coupon;S.IsNotEmpty(t)?this.promotionCouponProvider.removeCoupon():this.promotionService.removeAppliedCoupon(),this.dialogRef.close()}applyCouponCode(){if(this.selectedProvider==="Internal")this.promotionService.RedeemCoupon(this.PromotionCoupon,this.PromotionNote);else{let t=`(${this.selectedProvider}) ${this.PromotionNote?this.PromotionNote:""}`;this.promotionCouponProvider.redeemCoupon(this.PromotionCoupon,this.selectedProvider,t)}}onClose(){this.dialogRef.close()}showPassword(){this.modeType?(this.typeText="text",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye"):(this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash")}onKeyDown(t){let e=t.target.value;this.couponInputLock&&(t.key=="Enter"?this.PromotionCoupon=e:this.validateInputLock())}validateInputLock(){if(typeof this.PromotionCoupon=="string")if(this.PromotionCoupon==""||this.PromotionCoupon.length==0)this.startInput=new Date;else{let t=new Date;this.startInput=this.startInput?this.startInput:new Date,t.getTime()-this.startInput.getTime()>500&&(this.PromotionCoupon=null)}else this.startInput=new Date}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||o)(m(Xe),m(N),m(L),m(j),m(de),m(ee),m(xt))};static \u0275cmp=w({type:o,selectors:[["pos-modal-coupon-code"]],standalone:!1,decls:17,vars:11,consts:[[3,"onClose","config"],[1,"form-floating-outline","radio","border","rounded","pt-7",2,"height","auto !important"],[1,"form-floating-outline","mb-0"],["data-cy","CouponInput","id","cpn","name","PromotionCoupon","autocomplete","new-password","placeholder","Coupon",1,"form-control",3,"ngModelChange","paste","keydown","focus","blur","type","ngModel","disabled"],[3,"click"],["for","cpn"],[1,"form-floating-outline"],["name","note","id","note","data-cy","CouponNote","name","PromotionNote","placeholder","Note","rows","5",1,"form-control",3,"ngModelChange","ngModel","disabled"],["for","note"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3","p-8",3,"click"],[1,"btn","btn-light-danger","text-danger","btn-lg","fw-bold","mx-3","p-8","me-6"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3","p-8","me-6"],["id","providerOptions",3,"modelChange","options","model","disabled"],["for","providerOptions"],[1,"btn","btn-light-danger","text-danger","btn-lg","fw-bold","mx-3","p-8","me-6",3,"click"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3","p-8","me-6",3,"click","keyup.F2"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onClose",function(){return i.dialogRef.close()}),r(1,"content"),_(2,ds,4,3,"div",1),r(3,"div",2)(4,"input",3),D("ngModelChange",function(l){return M(i.PromotionCoupon,l)||(i.PromotionCoupon=l),l}),g("paste",function(l){return i.couponInputLock?l.preventDefault():""})("keydown",function(l){return i.onKeyDown(l)})("focus",function(){return i.onInputCouponCode=!0})("blur",function(){return i.onInputCouponCode=!1}),a(),r(5,"i",4),g("click",function(){return i.modeType=!i.modeType,i.showPassword()}),a(),r(6,"label",5),d(7,"Coupon"),a()(),r(8,"div",6)(9,"textarea",7),D("ngModelChange",function(l){return M(i.PromotionNote,l)||(i.PromotionNote=l),l}),a(),r(10,"label",8),d(11,"Note"),a()()(),r(12,"footer")(13,"button",9),g("click",function(){return i.onClose()}),d(14," Cancel "),a(),_(15,ms,2,0,"button",10)(16,us,2,0,"button",11),a()()),e&2&&(p("config",i.modalConfig),s(2),E(i.couponProviders().length>0?2:-1),s(2),p("type",i.typeText),P("ngModel",i.PromotionCoupon),p("disabled",i.hasSelectedCoupon),s(),he(i.typeIcon),s(4),P("ngModel",i.PromotionNote),p("disabled",i.hasSelectedCoupon),s(6),E(i.hasSelectedCoupon?15:16))},dependencies:[te,K,oe,U,Ti],styles:[".passwordIcon[_ngcontent-%COMP%]{position:relative;margin:0 auto!important;cursor:pointer;left:20.5rem;top:-2.3rem;z-index:999}"]})};var xn=class o{constructor(t,e,i,n){this.dialogRef=t;this._orderDataService=e;this._orderProcessorService=i;this._OrderHttpService=n;this.modalConfig.title="Return",this.modalConfig.customWidth="284px",this.destroy$=new G}modalConfig=new H;ReturNumber;destroy$;ngOnInit(){this.initInvoiceRetur()}initInvoiceRetur(){this.ReturNumber=null,this._orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{t.posState===7&&(this.ReturNumber=t.ReturNumber)})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}onOk(){let t=this._orderDataService.Data.Order.EntityID;this._OrderHttpService.GetReturnInvoice(this.ReturNumber,t).pipe(k(this.destroy$)).subscribe(e=>{let i=this._orderProcessorService.Data;i.ReturNumber=this.ReturNumber,this._orderProcessorService.ReturnOrder(e),this._orderProcessorService.updatePosState(7),this.dialogRef.close()})}static \u0275fac=function(e){return new(e||o)(m(j),m(N),m(W),m(Pe))};static \u0275cmp=w({type:o,selectors:[["pos-modal-return"]],standalone:!1,decls:6,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"form-floating-outline"],["type","text","data-cy","ReturnNumber","id","ReturNumber","name","ReturNumber",1,"form-control",3,"ngModelChange","ngModel"],["for","ReturNumber"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onOk",function(){return i.onOk()})("onCancel",function(){return i.dialogRef.close()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"input",2),D("ngModelChange",function(l){return M(i.ReturNumber,l)||(i.ReturNumber=l),l}),a(),r(4,"label",3),d(5,"Number Invoice"),a()()()()),e&2&&(p("config",i.modalConfig),s(3),P("ngModel",i.ReturNumber))},dependencies:[te,K,oe,U],encapsulation:2})};var fs=["serialInput"],In=class o{constructor(t,e,i){this.dialogRef=t;this.shoppingCartService=e;this.toastr=i;this.modalConfig.title="Scan Serial",this.modalConfig.customWidth="350px",this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}serialInputEl;modalConfig=new H;serial;onKeyDown(t){t.key=="Enter"&&(S.IsNotEmpty(this.serial)?(this.shoppingCartService.addItemBySerial(this.serial),this.serial=null):this.toastr.warning("Serial Can`t be empty","Warning!"),this.setFocusInput())}setFocusInput(){this.serialInputEl&&setTimeout(()=>{this.serialInputEl?.nativeElement?.focus()},500)}static \u0275fac=function(e){return new(e||o)(m(j),m(De),m(ee))};static \u0275cmp=w({type:o,selectors:[["POS-modal-serial"]],viewQuery:function(e,i){if(e&1&&Se(fs,5),e&2){let n;ye(n=xe())&&(i.serialInputEl=n.first)}},standalone:!1,decls:7,vars:2,consts:[["serialInput",""],[3,"onClose","config"],[1,"input-group","mt-3"],["type","text","placeholder","Input Product By Serial","aria-label","Serial",1,"form-control",3,"ngModelChange","keydown","ngModel"],[1,"input-group-text"],[1,"fa-solid","fa-barcode","fs-4"]],template:function(e,i){if(e&1){let n=v();r(0,"modal-material",1),g("onClose",function(){return u(n),f(i.dialogRef.close())}),r(1,"content")(2,"div",2)(3,"input",3,0),D("ngModelChange",function(h){return u(n),M(i.serial,h)||(i.serial=h),f(h)}),g("keydown",function(h){return u(n),f(i.onKeyDown(h))}),a(),r(5,"span",4),C(6,"i",5),a()()()()}e&2&&(p("config",i.modalConfig),s(3),P("ngModel",i.serial))},dependencies:[te,K,oe,U],styles:["input[_ngcontent-%COMP%]{height:55px;border-bottom-left-radius:4px;border-top-left-radius:4px}span.input-group-text[_ngcontent-%COMP%]{border-bottom-right-radius:4px;border-top-right-radius:4px}"]})};function gs(o,t){if(o&1&&(r(0,"tr")(1,"td"),d(2),a(),r(3,"td"),d(4),b(5,"date"),a(),r(6,"td"),d(7),b(8,"date"),a(),r(9,"td",5),d(10),a(),r(11,"td",5),d(12),b(13,"number"),a()()),o&2){let e=t.$implicit;s(2),T(e.Order.Number),s(2),T(ne(5,5,e.Order.ClientTimestamp,"dd MMM yyyy")),s(3),T(ne(8,8,e.Order.ClientTimestamp,"HH:mm")),s(3),T(e.Items.length),s(2),T(x(13,11,e.TotalPaidAmount))}}function _s(o,t){if(o&1&&(I(0),r(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr")(5,"th"),d(6,"Number"),a(),r(7,"th"),d(8,"Date"),a(),r(9,"th"),d(10,"Time"),a(),r(11,"th",5),d(12,"Qty"),a(),r(13,"th",5),d(14,"Total"),a()()(),r(15,"tbody"),_(16,gs,14,13,"tr",6),a()()(),O()),o&2){let e=c();s(16),p("ngForOf",e.offlineOrders)}}function Cs(o,t){o&1&&(r(0,"h1",7),d(1,"There is no offline orders!"),a())}var On=class o{constructor(t){this._localDataService=t;this.destroy$=new G}offlineOrders=[];destroy$;ngOnInit(){this.getOfflineOrders()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}getOfflineOrders(){this._localDataService.findAllOrders().pipe(k(this.destroy$)).subscribe(t=>{this.offlineOrders=t.map(e=>nt(ct,e))})}static \u0275fac=function(e){return new(e||o)(m(Ye))};static \u0275cmp=w({type:o,selectors:[["sync-orders"]],standalone:!1,decls:3,vars:2,consts:[["noOrders",""],[4,"ngIf","ngIfElse"],[1,"table-responsive","p-8"],[1,"table"],[1,"thead-light"],[1,"text-end"],[4,"ngFor","ngForOf"],[1,"text-center","p-8"]],template:function(e,i){if(e&1&&_(0,_s,17,1,"ng-container",1)(1,Cs,2,0,"ng-template",null,0,J),e&2){let n=Q(2);p("ngIf",i.offlineOrders!=null&&i.offlineOrders.length>0)("ngIfElse",n)}},dependencies:[be,z,Z,We],encapsulation:2})};var bs=o=>({"bg-gradient-danger":o});function vs(o,t){if(o&1&&(I(0),d(1),b(2,"number"),O()),o&2){let e=c();s(),y(" ",x(2,1,e.onlineProducts)," ")}}function Ss(o,t){o&1&&(r(0,"small",13),d(1," Failed to get Online Products "),a())}function ys(o,t){if(o&1&&(I(0),d(1),b(2,"date"),O()),o&2){let e=c();s(),y(" ",ne(2,1,e.syncDate,"dd MMM yyyy HH:mm")," ")}}function xs(o,t){o&1&&d(0," Never been synced ")}function Is(o,t){if(o&1&&(r(0,"p"),d(1),a()),o&2){let e=c();s(),y("You last synced ",e.dayDiff," days ago!")}}var Pn=class o{constructor(t,e,i,n){this.indexDbService=t;this.toastr=e;this.httpService=i;this.dialogRef=n;this.destroy$=new G}dayDiff;syncDate;offlineProduct=0;onlineProducts=0;destroy$;ngOnInit(){this.initOfflineProducts()}initOfflineProducts(){this.indexDbService.findAllVariant().pipe(se(t=>t.length>0),Re(t=>{let e=Array.from(new Set(t.map(i=>i.ProductID))).map(i=>t.find(n=>n.ProductID===i));return this.offlineProduct=e.length,this.httpService.POSText("/api/catalog/product/ProductRowsCount",'{"ProductDiscontinued":false,"VariantDiscontinued":false,"CategoryDiscontinued":false,"From":"0001-01-01T00:00:00","To":"0001-01-01T00:00:00"}')}),et(t=>JSON.parse(t))).subscribe({next:t=>{this.onlineProducts=t.Count,this.getSyncTime()},error:t=>{console.error(t)}})}syncToLocalDatabase(){xi([this.syncOutlets(),this.syncProducts(),this.syncOutletPrices()]).pipe(k(this.destroy$),Re(()=>this.indexDbService.updateSyncTime())).subscribe({next:()=>{this.initOfflineProducts(),this.toastr.success("Sync Product Offline Successfully","Success!"),this.dialogRef.close()},error:t=>{console.error(t)}})}getSyncTime(){this.indexDbService.getSyncTime().pipe(k(this.destroy$),se(t=>t!=null)).subscribe({next:t=>{this.syncDate=new Date(t.time),this.calculateSyncDiff()},error:t=>{console.error(t)}})}calculateSyncDiff(){this.syncDate?this.dayDiff=Math.floor((new Date().getTime()-this.syncDate.getTime())/1e3/60/60/24):this.dayDiff=0}syncOutlets(){return this.httpService.get(_e.SynOutlet).pipe(k(this.destroy$),Re(t=>this.indexDbService.syncRegisters(t)))}syncProducts(){return this.httpService.get(_e.SyncProducts).pipe(k(this.destroy$),Re(t=>this.indexDbService.syncVariants(t)))}syncOutletPrices(){return this.httpService.get(_e.SynOutletPrice).pipe(k(this.destroy$),Re(t=>this.indexDbService.syncOutletPrice(t)))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||o)(m(Ye),m(ee),m(Qe),m(j))};static \u0275cmp=w({type:o,selectors:[["sync-products"]],standalone:!1,decls:30,vars:11,consts:[["EMPTY_PRODUCTS",""],["neverSync",""],[1,"table-responsive","p-8"],[1,"table","table-bordered","table-sm","fs-5"],[1,"fw-bold",2,"width","125px"],[2,"width","175px",3,"ngClass"],[4,"ngIf","ngIfElse"],["rowspan","3"],[1,"d-flex","align-items-center","justify-content-center"],[1,"btn","btn-success","fs-4",3,"click"],[1,"fa-solid","fa-sync-alt","me-2","pe-2"],[1,"fw-bold"],[4,"ngIf"],[1,"fst-italic"]],template:function(e,i){if(e&1){let n=v();r(0,"div",2)(1,"table",3)(2,"tbody")(3,"tr")(4,"td",4),d(5,"Online Products"),a(),r(6,"td",5),_(7,vs,3,3,"ng-container",6)(8,Ss,2,0,"ng-template",null,0,J),a(),r(10,"td",7)(11,"div",8)(12,"button",9),g("click",function(){return u(n),f(i.syncToLocalDatabase())}),C(13,"i",10),r(14,"span"),d(15,"Sync"),a()()()()(),r(16,"tr")(17,"td",11),d(18,"Offline Products"),a(),r(19,"td"),d(20),b(21,"number"),a()(),r(22,"tr")(23,"td",11),d(24,"Last Sync"),a(),r(25,"td"),_(26,ys,3,4,"ng-container",6)(27,xs,1,0,"ng-template",null,1,J)(29,Is,2,1,"p",12),a()()()()()}if(e&2){let n=Q(9),l=Q(28);s(6),p("ngClass",R(9,bs,!i.onlineProducts)),s(),p("ngIf",i.onlineProducts)("ngIfElse",n),s(13),y(" ",x(21,7,i.offlineProduct)," "),s(6),p("ngIf",i.syncDate)("ngIfElse",l),s(3),p("ngIf",i.dayDiff>14)}},dependencies:[q,z,Z,We],encapsulation:2})};var Ps=["navTabs"],Mn=class o{constructor(t,e){this._router=t;this.dialogRef=e}tabs;modalConfig=new H;ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig.headerType=Le.Success,this.modalConfig.title="Add all offline products",this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="550px",this.modalConfig.noPadding=!0}goToOfflinePage(){this.tabs.selectedIndex==0?this._router.navigate(["/menu","Sell","Offline","Products"]):this.tabs.selectedIndex==1&&this._router.navigate(["/menu","Sell","Offline","Orders"]),this.close()}close(){this.dialogRef.close()}onChangeTab(t){t.index==0?this.modalConfig.title="Add all offline product":this.modalConfig.title="Add all offline order"}static \u0275fac=function(e){return new(e||o)(m(Ct),m(j))};static \u0275cmp=w({type:o,selectors:[["pos-modal-sync"]],viewQuery:function(e,i){if(e&1&&Se(Ps,5),e&2){let n;ye(n=xe())&&(i.tabs=n.first)}},standalone:!1,decls:12,vars:2,consts:[["navTabs",""],[3,"onOk","onCancel","onClose","config"],["mat-align-tabs","start",1,"sync",3,"selectedTabChange","dynamicHeight"],["label","Products"],["label","Orders"],[1,"d-flex","justify-content-center","mb-8"],[1,"btn","btn-primary","btn-lg",3,"click"],[1,"fa-solid","fa-paper-plane"]],template:function(e,i){if(e&1){let n=v();r(0,"modal-material",1),g("onOk",function(){return u(n),f(i.close())})("onCancel",function(){return u(n),f(i.close())})("onClose",function(){return u(n),f(i.close())}),r(1,"content")(2,"mat-tab-group",2,0),g("selectedTabChange",function(h){return u(n),f(i.onChangeTab(h))}),r(4,"mat-tab",3),C(5,"sync-products"),a(),r(6,"mat-tab",4),C(7,"sync-orders"),a()(),r(8,"div",5)(9,"button",6),g("click",function(){return u(n),f(i.goToOfflinePage())}),C(10,"i",7),d(11," Go to Details "),a()()()()}e&2&&(p("config",i.modalConfig),s(2),p("dynamicHeight",!1))},dependencies:[U,vt,St,On,Pn],styles:[".mat-ink-bar{background-color:#93bd45!important} .sync mat-mdc-tab-body{height:200px} .mat-mdc-tab-body-content{overflow-x:hidden!important}"]})};var Ds=(o,t)=>({"btn-secondary":o,"btn-outline-secondary":t}),ws=(o,t)=>({"btn-outline-secondary":o,"btn-secondary":t});function ks(o,t){if(o&1){let e=v();r(0,"div")(1,"label",12),C(2,"i",13),r(3,"span"),d(4,"Deduct Inventory from Outlet :"),a()(),r(5,"p-select",14),D("ngModelChange",function(n){u(e);let l=c();return M(l.deliveryEntityID,n)||(l.deliveryEntityID=n),f(n)}),a()()}if(o&2){let e=c();s(5),p("options",e.entities),P("ngModel",e.deliveryEntityID),p("filter",!0)("showClear",!0)("showClear",!1)("disabled",e.isDisabledNgSelectOutlet)}}function Ts(o,t){if(o&1){let e=v();r(0,"div",10)(1,"div",29)(2,"label",30),C(3,"i",31),r(4,"span"),d(5,"Recipient"),a()(),r(6,"input",32),D("ngModelChange",function(n){u(e);let l=c(2);return M(l.shipping.Name,n)||(l.shipping.Name=n),f(n)}),a()(),r(7,"div",29)(8,"label",33),C(9,"i",34),r(10,"span"),d(11,"Phone"),a()(),r(12,"input",35),D("ngModelChange",function(n){u(e);let l=c(2);return M(l.shipping.Phone,n)||(l.shipping.Phone=n),f(n)}),a()(),r(13,"div",36)(14,"label",37),C(15,"i",38),r(16,"span"),d(17,"City"),a()(),r(18,"input",39),D("ngModelChange",function(n){u(e);let l=c(2);return M(l.shipping.City,n)||(l.shipping.City=n),f(n)}),a()(),r(19,"div",40)(20,"label",41),C(21,"i",42),r(22,"span"),d(23,"Delivery Address"),a()(),r(24,"POS-tinymce-editor",43),D("ngModelChange",function(n){u(e);let l=c(2);return M(l.shipping.Address,n)||(l.shipping.Address=n),f(n)}),a()()()}if(o&2){let e=c(2);s(6),P("ngModel",e.shipping.Name),s(6),P("ngModel",e.shipping.Phone),s(6),P("ngModel",e.shipping.City),s(6),P("ngModel",e.shipping.Address)}}function Es(o,t){if(o&1){let e=v();r(0,"div",15)(1,"div",16)(2,"label",12),C(3,"i",17),r(4,"span"),d(5),a()(),r(6,"div",16)(7,"p-datepicker",18),D("ngModelChange",function(n){u(e);let l=c();return M(l.posData.Invoice.DateCustom,n)||(l.posData.Invoice.DateCustom=n),f(n)}),a()()(),r(8,"div",16)(9,"label",19),C(10,"i",20),r(11,"span"),d(12,"Time"),a()(),r(13,"div",16)(14,"app-timepicker",21),D("timeChange",function(n){u(e);let l=c();return M(l.posData.Invoice.TimeCustom,n)||(l.posData.Invoice.TimeCustom=n),f(n)}),a()()()(),r(15,"div",22)(16,"div",23)(17,"div")(18,"p-checkbox",24),D("ngModelChange",function(n){u(e);let l=c();return M(l.recipientNotBuyer,n)||(l.recipientNotBuyer=n),f(n)}),a()(),r(19,"div",25)(20,"span"),C(21,"i",26),a(),r(22,"h6",23)(23,"span"),d(24,"Recipient \u2260 Buyer"),a(),r(25,"span",27),C(26,"i",28),a()()()()(),_(27,Ts,25,4,"div",10)}if(o&2){let e=c();s(5),y(" ",e.dateLabel," "),s(2),P("ngModel",e.posData.Invoice.DateCustom),p("baseZIndex",1e4)("showClear",!0),s(7),P("time",e.posData.Invoice.TimeCustom),p("showIcon",!0)("showCloseBtn",!1)("fullWidth",!0)("showClear",!0),s(4),P("ngModel",e.recipientNotBuyer),p("binary",!0),s(9),E(e.recipientNotBuyer?27:-1)}}var ni=class o{constructor(t,e,i,n,l,h,A){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._orderProcessorService=n;this._productHttpService=l;this._outletService=h;this.datePipe=A;this.destroy$=new G,this.initStartTime(),this.subscribePosData(),this.initModal()}modalConfig=new H;isDisabledNgSelectOutlet=!1;isDelivery=V(!1);customDate=null;shipping=new fi;deliveryEntityID="";posData=new ct;startTime;get entities(){return this._posService.Data.Entities}shippingFormVisible;destroy$;disableShippingNow=!1;disableShippingLater=!1;recipientNotBuyer;dateLabel="Fulfillment Date";ngOnInit(){this.initShipingFormVisible(),this.initDefaultOrderDelivery(),this.checkRecepientIsBuyer(),this.initDateLabel(),this.initDisabledOutletOption()}initDisabledOutletOption(){this._orderProcessorService.Data.posState==2&&(this.isDisabledNgSelectOutlet=!0)}checkRecepientIsBuyer(){S.IsNotEmpty(this.shipping.Name)?this.recipientNotBuyer=!0:this.recipientNotBuyer=!1}initDateLabel(){let t=this._posService.Data.AppConfigJSON;t.ModuleSell.Shipping.DateLabel&&(this.dateLabel=t.ModuleSell.Shipping.DateLabel)}initStartTime(){var t=new Date;this.startTime=t.getHours()+":"+t.getMinutes()}subscribePosData(){this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.posData=t,this.posData.Invoice.DateCustom=this.posData.Invoice.DateCustom?this.posData.Invoice.DateCustom:null,this.deliveryEntityID=t.Action.DeliveryEntityID,this.shipping=t.Shipping?t.Shipping:new fi})}initModal(){this.modalConfig.title="Order Fullfillment",this.modalConfig.customWidth="650px"}initShipingFormVisible(){let t=this._posService.Data.AppConfigJSON;this.shippingFormVisible=t.ModuleSell.Shipping.DeliveryAddressAlwaysVisible}initDefaultOrderDelivery(){this.deliveryEntityID==S.GuidEmpty?this.isDelivery.set(!0):this.isDelivery.set(!1);let t=this.entities.find(e=>e.ID==this._outletService?.getOutletRegister()?.EntityID);if(S.IsNotEmpty(t.ID)){let e=t.FulfillmentOption;e==1?(this.isDelivery.set(!1),this.disableShippingLater=!0):e==2&&(this.isDelivery.set(!0),this.disableShippingNow=!0),this.changeDelivery()}}changeDelivery(){if(this.isDelivery())this.deliveryEntityID=S.GuidEmpty;else{let t=this._outletService.Data,e=this.posData.Action.DeliveryEntityID;S.IsNotEmpty(e)?this.deliveryEntityID=e:S.IsNotEmpty(t.DefaultWarehouse)?this.deliveryEntityID=t.DefaultWarehouse:this.deliveryEntityID=t.EntityID}}onOk(){this.getSerialByVariantIds(),this.setCustomDateField(),this.clearShippingData(),this.posData.Shipping=this.shipping,this.posData.Action.DeliveryEntityID=this.deliveryEntityID,this._orderDataService.pushNewValue(this.posData),this.close()}clearShippingData(){if(!this.recipientNotBuyer)for(let t of Object.getOwnPropertyNames(this.shipping))this.shipping[t]=""}setCustomDateField(){let t=this.posData.Invoice.DateCustom?this.posData.Invoice.DateCustom:null,e=this.posData.Invoice.TimeCustom?this.posData.Invoice.TimeCustom:"00:00";if((this.isDelivery()||this.shippingFormVisible)&&t){let i=this.datePipe.transform(this.posData.Invoice.DateCustom,"d MMM y");this.posData.Invoice.CustomDateField=`${i} ${e}`}}getSerialByVariantIds(){let t=this.posData.CartItems;if(S.IsNotEmpty(this.deliveryEntityID)&&t.length>0){let e=t.map(i=>i.VariantID);this._productHttpService.getSerialByVarianIds(this.deliveryEntityID,e).subscribe(i=>{this.updateCartItemSerial(i)})}}updateCartItemSerial(t){let e=nt(Be,this.posData.CartItems),i;this.posData.CartItems=e.map(n=>(n.isSerialType()&&(i=t.findIndex(l=>l.VariantID==n.VariantID),i!==-1&&(n.Serial=this.filterSerialBySelectedSerial(n.Serial,t[i].Serial))),n)),this._orderDataService.pushNewValue(this.posData)}filterSerialBySelectedSerial(t=[],e){let i;return e.filter(l=>(i=t.findIndex(h=>h.Number==l.Number),i!==-1))}close(){this._dialogRef.close()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||o)(m(j),m(N),m(L),m(W),m(Fi),m(Y),m(We))};static \u0275cmp=w({type:o,selectors:[["POS-modal-shipping"]],decls:23,vars:14,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container"],[1,"row"],[1,"btn-group","col-12"],["type","button",1,"btn","btn-secondary","position-relative","btn-custom-size","col-5",3,"click","disabled"],[1,"fa-solid","fa-bolt"],[1,"ms-2"],[1,"ms-1"],["type","button",1,"btn","position-relative","btn-custom-size","col-7",3,"click","disabled"],[1,"fa-solid","fa-clock"],[1,"row","mt-12"],[1,"col-12"],["for","shippingDate",1,"mb-2"],[1,"fa","fa-store","me-1"],["optionLabel","Name","optionValue","ID","filterBy","Name","placeholder","Select a Outlet","appendTo","body",1,"w-100",2,"--p-select-padding-y","0.8rem",3,"ngModelChange","options","ngModel","filter","showClear","disabled"],[1,"d-flex","align-items-center","gap-3"],[1,"w-100"],[1,"fa-solid","fa-calendar","me-1"],["placeholder","Select Date","showIcon","","iconDisplay","input","appendTo","body","dateFormat","dd M yy",1,"w-100","date-custom",3,"ngModelChange","ngModel","baseZIndex","showClear"],["for","shippingTime",1,"mb-2"],[1,"fa","fa-clock","me-1"],["placeholder","Select Time",1,"date-custom",3,"timeChange","time","showIcon","showCloseBtn","fullWidth","showClear"],[1,"mt-12"],[1,"d-flex","align-items-center","gap-2"],[1,"custom-checkbox-style",3,"ngModelChange","ngModel","binary"],[1,"d-flex","align-items-center","gap-1"],[1,"fa-solid","fa-user","fs-5"],["pTooltip",`Enable this option when the person receiving the order is different from customer who made the purchase.
|
|
4
|
+
`},disableClose:!0})}parkOrder(){let t=this.salesOrderService.Data,e=this.pageInitialService.Data.AppConfigJSON;if(t.CartItems.length==0){this.toastrService.warning("You must have at least one item","No Item in Cart!");return}if(!(!this.validateCustomerRequired(e,t)||!this.validateUsedPromotion(t))){if(S.IsEmpty(t.Order.RegisterID)){this.toastrService.warning(fr.emptyEntity,Le.Warning);return}this.validateShowParkModal()}}validateCustomerRequired(t,e){return t.ModuleSell.Header.CustomerRequired&&e.Order.CustomerID==null?(this.toastrService.warning("Customer is needed before parking orders!","Missing customer!"),!1):!0}validateUsedPromotion(t){let e=this.promotionEventService.selectedPromotion;return S.IsNotEmpty(e)||S.IsNotEmpty(t.Order.PromotionCoupon)?(this.toastrService.warning("Orders with applied promotions or coupons cannot be parked!","Park Not Allowed!"),!1):!0}validateShowParkModal(){let t=this.outletService.Data.ParkLayoutPack,e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data;if(t&&S.IsNotEmpty(t.ID))this.orderProcessorService.Data.posState==4?this.showReparkModal():this.showParkSelectModal(e,i);else{if(!this.validateRetrieveMode(e))return;this.setDefaultParkNote(e),this.showParkInputModal()}}showParkSelectModal(t,e){let i=this.orderProcessorService.Data,n=this.outletService.Data.ParkLayoutPack;this.orderHttpService.getVacant(e.Order.EntityID).subscribe(l=>{let h=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle,A=i.posState==5,le=t.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,Te=A?"Split Order":h;this.dialog.open(zt,{data:{title:Te,parkLayoutPack:this.generateParkLayoutOptions(n,l.Orders),replaceWithAlias:le}}).afterClosed().pipe(se(Fe=>S.IsNotEmpty(Fe)),Re(Fe=>{let je=new Jt;return je.ParkLabel=Fe.Name,je.Note=Fe.Note,this.park(je)})).subscribe()})}showReparkModal(){this.dialog.open(an,{data:this.parkOrderRetrieve})}validateRetrieveMode(t){return t.ApplicationParkAndRetrieve.Advance.retreiveMode==1?(this.toastrService.error("Your retrieve config is in Group mode, to enable park please setting your Park layout at Outlet page","Error!"),!1):!0}setDefaultParkNote(t){let e=t.ApplicationParkAndRetrieve.UserInterfaceLabel.DefaultParkNoteValue,i=this.orderProcessorService.Data.posState==2,n=this.salesOrderService.Data;!i&&S.IsNotEmpty(e)&&S.IsEmpty(n.Order.Note)&&(this.salesOrderService.Data.Order.Note=e)}showParkInputModal(){let t="Park this order?",e=this.orderProcessorService.Data.posState==5,i=this.outletService.Data?.ParkLayoutPack;e&&(t="Split Detail"),this.dialog.open(nn,{id:"park-form-modal",data:{title:t,labelDisable:i&&S.IsNotEmpty(i?.ID)||this.orderProcessorService.Data.posState==5,ParkLabel:this.salesOrderService.Data.Order.ParkLabel}})}onPrintRetrieve(){this.dialog.open(rn).afterClosed().pipe(se(t=>S.IsNotEmpty(t))).subscribe(t=>{t=="ORDER"?this.emitParkReceipt(!1,!1,!0):this.emitBillReceipt()})}emitParkReceipt(t,e=!1,i=!1){let n=this.receiptService.generateParkReceipt(t,e);(this.pageInitialService.Data.AppConfigJSON.ApplicationParkAndRetrieve?.PrintBehaviour?.PrintAfterPark||i)&&this._onPrint.next({type:"PARK",template:n})}emitBillReceipt(){let t=this.outletService.Data,e;1==t.PrintTemplate.PrintMode?(e=this.receiptService.generateBillInvoice(),this._onPrint.next({type:"BILL_A4",template:e})):(e=this.receiptService.generateBillReceipt(),this._onPrint.next({type:"BILL_MINI",template:e}))}generateParkLayoutOptions(t,e=[]){return t.Layout=t.Layout.map(i=>{i.Options=[];for(let n=1;n<=i.Size;n++){let l=new Kt;l.Name=i.Name+n,l.Alias=this.generateAlias(t,l.Name),l.IsOccupied=this.IsOccupied(l.Name,e),i.Options.push(l)}return i}),t}generateAlias(t,e){let i="";if(t.Alias){let n=t.Alias.filter(l=>l.Name==e);n.length>0&&(i=`${n[0]?.Alias}`)}return i}IsOccupied(t,e){let i=e.filter(l=>l.ParkLabel==t),n=!1;return i.length>0&&(n=!0),n}static \u0275fac=function(e){return new(e||o)(B(Qe),B(Ot),B(W),B(L),B(N),B(ee),B(Qt),B(Y),B(Pe),B(re))};static \u0275prov=rt({token:o,factory:o.\u0275fac,providedIn:"root"})};var pn=class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=_t({type:o});static \u0275inj=gt({imports:[X,fe,Li,yt,Ar,Ht,Vt,Ut,Ke,qi]})};var _a=o=>({"opacity-50":o});function za(o,t){if(o&1){let e=v();r(0,"div",5)(1,"h6",6),d(2,"Verify Via"),a(),r(3,"div",7)(4,"button",8),g("click",function(){u(e);let n=c();return f(n.onChooseVerifyType("phone"))}),r(5,"div",9)(6,"div"),C(7,"i",10),a(),r(8,"div",11),d(9),a()()()(),r(10,"div",12)(11,"button",8),g("click",function(){u(e);let n=c();return f(n.onChooseVerifyType("email"))}),r(12,"div",9),C(13,"i",13),r(14,"div",11),d(15),a()()()(),r(16,"div",12)(17,"button",14),g("click",function(n){return u(e),c().onChooseVerifyType("pin"),f(n.preventDefault())}),r(18,"div",9),C(19,"i",15),r(20,"div",16),d(21,"Use PIN"),a()()()()()}if(o&2){let e=c();s(4),p("disabled",!e.phone||(e.phone==null?null:e.phone.length)<6),s(4),p("ngClass",R(6,_a,!e.phone||(e.phone==null?null:e.phone.length)<6)),s(),y(" ",e.phone&&(e.phone==null?null:e.phone.length)>6?e.phone:"Mobile Phone is not registered"," "),s(2),p("disabled",!e.email),s(3),p("ngClass",R(8,_a,!e.email)),s(),y(" ",e.email?e.email:"Email is not registered"," ")}}function Ka(o,t){if(o&1){let e=v();r(0,"div",17)(1,"div",18)(2,"div"),d(3,"OTP Verification is turned "),r(4,"span",19),d(5,"OFF"),a(),d(6,","),a(),r(7,"div"),d(8," Please read this "),r(9,"a",20),d(10,"article"),a(),d(11," to turn on "),a()()(),r(12,"div")(13,"div",21)(14,"button",22),g("click",function(){u(e);let n=c();return f(n.onRedeem())}),d(15,"Redeem"),a()()()}}var dn=class o{toastrService=ie(ee);onVerify=new He;pointUsedChange=new He;redeemEvent=new He;isVerifyEnabled=!1;phone;email;pointUsed;pointBalance;onPointUsedChange(){this.pointUsedChange.emit(this.pointUsed)}ngAfterViewInit(){this.setFocusInput()}setFocusInput(){setTimeout(()=>{document.getElementById("pointInput")?.focus()},300)}onChooseVerifyType(t){this.checkPointUsed()&&this.onVerify.emit(t)}onRedeem(){this.checkPointUsed()&&this.redeemEvent.emit()}checkPointUsed(){return S.IsEmpty(this.pointUsed)||this.pointUsed<=0?(this.toastrService.warning("Please enter the points before redeeming!","Field Input Required!"),this.setFocusInput(),!1):!0}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=w({type:o,selectors:[["point-step"]],inputs:{isVerifyEnabled:"isVerifyEnabled",phone:"phone",email:"email",pointUsed:"pointUsed",pointBalance:"pointBalance"},outputs:{onVerify:"onVerify",pointUsedChange:"pointUsedChange",redeemEvent:"onRedeem"},decls:13,vars:6,consts:[[1,"d-flex","align-items-center","justify-content-center"],[1,"me-3"],["type","text","autoNum","","id","pointInput",1,"form-control","input-point",3,"ngModelChange","ngModel","max"],[1,"me-3","d-flex","align-items-center","justify-content-center"],[1,"fs-1"],[1,"mt-8"],[1,"mb-6","text-center"],[1,"text-center"],["type","button",1,"btn","btn-light","btn-sm","p-3","w-75",3,"click","disabled"],[1,"d-flex","align-items-center"],[1,"fa-brands","fa-whatsapp","fs-2","ps-2",2,"color","#25d366"],[1,"fs-5","w-100",3,"ngClass"],[1,"mt-4","text-center"],[1,"ps-2","fa-solid","fa-envelope","fs-3",2,"color","#c71610"],["type","button","matTooltip","Inform the customer to download the Brand Loyalty App and setup PIN in Profile Menu to authorize Point Redemption","matTooltipPosition","right","matTooltipClass","primary-tooltip",1,"btn","btn-light","btn-sm","p-3","w-75",3,"click"],[1,"ps-2","fa-solid","fa-key","fs-3"],[1,"fs-5","w-100"],[1,"mt-8","d-flex","justify-content-center"],[1,"text-center","alert","alert-warning","py-4","px-8","mb-0"],[1,"fw-bold","text-danger",2,"font-size","13px"],["href","https://support.dealpos.com/en/articles/9158486-redeem-loyalty-point-authorization-using-otp","target","_blank"],[1,"d-flex","justify-content-center","mt-12"],[1,"btn","btn-success",3,"click"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"input",2),D("ngModelChange",function(l){return M(i.pointUsed,l)||(i.pointUsed=l),l}),g("ngModelChange",function(){return i.onPointUsedChange()}),a()(),r(3,"div",3)(4,"span",1),d(5,"Of"),a(),r(6,"span",4),d(7),b(8,"number"),a()(),r(9,"div"),d(10,"Points"),a()(),_(11,za,22,10,"div",5)(12,Ka,16,0)),e&2&&(s(2),P("ngModel",i.pointUsed),p("max",i.pointBalance),s(5),T(x(8,4,i.pointBalance)),s(4),E(i.isVerifyEnabled?11:12))},dependencies:[X,q,Z,ut,st,fe,te,K,oe,Ke,ce],styles:[".input-point[_ngcontent-%COMP%]{width:120px;height:44px;font-size:1.375rem;text-align:center}"]})};var Ya=o=>({"error-input":o});function Xa(o,t){if(o&1&&(r(0,"span"),d(1),a()),o&2){let e=c(3);s(),y(" ",e.config.separator," ")}}function Za(o,t){if(o&1){let e=v();I(0),r(1,"input",5,0),g("paste",function(n){u(e);let l=c(2);return f(l.handlePaste(n))})("keyup",function(n){let l=u(e).index,h=c(2);return f(h.onKeyUp(n,l))})("input",function(n){let l=u(e).index,h=c(2);return f(h.onInput(n,l))})("keydown",function(n){let l=u(e).index,h=c(2);return f(h.onKeyDown(n,l))}),a(),_(3,Xa,2,1,"span",6),O()}if(o&2){let e=t.$implicit,i=t.index,n=t.last,l=c(2);s(),io("otp-input ",l.config.inputClass,""),p("pattern",l.config.allowNumbersOnly?"\\d*":"")("type",l.inputType)("placeholder",(l.config==null?null:l.config.placeholder)||"")("ngStyle",l.config.inputStyles)("formControl",l.otpForm.controls[e])("id",l.getBoxId(i))("ngClass",R(11,Ya,(l.config==null?null:l.config.showError)&&(l.formControl==null?null:l.formControl.invalid)&&((l.formControl==null?null:l.formControl.dirty)||(l.formControl==null?null:l.formControl.touched)))),s(2),p("ngIf",l.config.separator&&!n)}}function el(o,t){if(o&1){let e=v();r(0,"div",2),g("focusin",function(){u(e);let n=c();return f(n.onFocusIn())})("focusout",function(){u(e);let n=c();return f(n.onFocusOut())}),r(1,"div",3),_(2,Za,4,13,"ng-container",4),a()()}if(o&2){let e=c();io("ng-otp-input-wrapper wrapper ",e.config.containerClass,""),To("id","c_",e.componentKey,""),p("ngStyle",e.config.containerStyles),s(2),p("ngForOf",e.controlKeys)}}var ft=class{static ifTab(t){return this.ifKey(t,"Tab")}static ifDelete(t){return this.ifKey(t,"Delete;Del")}static ifBackspace(t){return this.ifKey(t,"Backspace")}static ifRightArrow(t){return this.ifKey(t,"ArrowRight;Right")}static ifLeftArrow(t){return this.ifKey(t,"ArrowLeft;Left")}static ifSpacebar(t){return this.ifKey(t,"Spacebar; ")}static ifKey(t,e){return e.split(";").some(n=>n===t.key)}},hi=class{static keys(t){return t?Object.keys(t):[]}},mo=(()=>{class o{set disabled(e){this.setDisabledState(e)}get inputType(){return this.config?.isPasswordInput?"password":this.config?.allowNumbersOnly?"tel":"text"}get controlKeys(){return hi.keys(this.otpForm?.controls)}get formControl(){return this.formCtrl??this.inj?.get(qo)}constructor(e,i){this.document=e,this.inj=i,this.config={length:4},this.onBlur=new G,this.onInputChange=new G,this.inputControls=new Array(this.config.length),this.componentKey=Math.random().toString(36).substring(2)+new Date().getTime().toString(36),this.destroy$=new G,this.activeFocusCount=0,this.onChange=()=>{},this.onTouched=()=>{},this._isDisabled=!1}ngOnInit(){this.otpForm=new $o({});for(let e=0;e<this.config.length;e++)this.otpForm.addControl(this.getControlName(e),new ht);this.otpForm.valueChanges.pipe(k(this.destroy$)).subscribe(e=>{hi.keys(this.otpForm.controls).forEach(i=>{var n=this.otpForm.controls[i].value;n&&n.length>1&&(n.length>=this.config.length?this.setValue(n):this.rebuildValue())})})}setDisabledState(e){this._isDisabled=e,this.otpForm&&(e?this.otpForm.disable({emitEvent:!1}):this.otpForm.enable({emitEvent:!1}))}writeValue(e){this.currentVal=this.hasVal(e)?e:null,this.setValue(this.currentVal)}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}onFocusIn(){this.onTouched(),this.activeFocusCount++}onFocusOut(){setTimeout(()=>{this.activeFocusCount--,this.activeFocusCount===0&&(this.onTouched(),this.onBlur.next())},0)}ngAfterViewInit(){if(!this.config.disableAutoFocus){let e=this.document.getElementById(`c_${this.componentKey}`);if(e){let i=e.getElementsByClassName("otp-input")[0];i&&i.focus&&i.focus()}}}getControlName(e){return`ctrl_${e}`}onKeyDown(e,i){let n=this.getBoxId(i-1),l=this.getBoxId(i);if(ft.ifKey(e,"Enter")){let A=this.document.getElementById(l)?.closest("form");if(A){e.preventDefault(),A.dispatchEvent(new Event("submit"));return}}if(ft.ifSpacebar(e))return e.preventDefault(),!1;if(ft.ifBackspace(e)){e.target.value?this.clearInput(l,i):(this.clearInput(n,i-1),this.setSelected(n)),this.rebuildValue();return}if(ft.ifDelete(e)){e.target.value?this.clearInput(l,i):(this.clearInput(n,i-1),this.setSelected(n)),this.rebuildValue();return}}hasVal(e){return e!=null&&e!=null&&(!e?.trim||e.trim()!="")}onInput(e,i){let n=this.hasVal(this.currentVal)?`${this.currentVal}${e.target.value}`:e.target.value;if(this.config.allowNumbersOnly&&!this.validateNumber(n)){e.target.value=null,e.stopPropagation(),e.preventDefault(),this.clearInput(null,i);return}if(this.ifValidKeyCode(null,e.target.value)){let l=this.getBoxId(i+1);this.setSelected(l),this.rebuildValue()}else{e.target.value=null;let l=this.getControlName(i);this.otpForm.controls[l]?.setValue(null),this.rebuildValue()}}onKeyUp(e,i){ft.ifTab(e)&&(i-=1);let n=this.getBoxId(i+1),l=this.getBoxId(i-1);if(ft.ifRightArrow(e)){e.preventDefault(),this.setSelected(n);return}if(ft.ifLeftArrow(e)){e.preventDefault(),this.setSelected(l);return}}validateNumber(e){return e&&/^[0-9]+$/.test(e)}getBoxId(e){return`otp_${e}_${this.componentKey}`}clearInput(e,i){let n=this.getControlName(i);if(this.otpForm.controls[n]?.setValue(null),e){let l=this.document.getElementById(e);l&&l instanceof HTMLInputElement&&(l.value=null)}}setSelected(e){this.focusTo(e);let i=this.document.getElementById(e);i&&i.setSelectionRange&&setTimeout(()=>{i.setSelectionRange(0,1)},0)}ifValidKeyCode(e,i){let n=i??e.key;return this.config?.allowNumbersOnly?this.validateNumber(n):/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)||/^[a-zA-Z0-9%*_\-@#$!]$/.test(n)&&n.length==1}focusTo(e){let i=this.document.getElementById(e);i&&i.focus()}setValue(e){if(!(this.config.allowNumbersOnly&&isNaN(e))){if(this.otpForm?.reset(),!this.hasVal(e)){this.rebuildValue();return}e=e.toString().replace(/\s/g,""),Array.from(e).forEach((i,n)=>{this.otpForm.get(this.getControlName(n))&&this.otpForm.get(this.getControlName(n)).setValue(i)}),this.config.disableAutoFocus||setTimeout(()=>{let i=this.document.getElementById(`c_${this.componentKey}`);var n=e.length<this.config.length?e.length:this.config.length-1;let l=i.getElementsByClassName("otp-input")[n];l&&l.focus&&setTimeout(()=>{l.focus()},1)},0),this.rebuildValue()}}rebuildValue(){let e=null;hi.keys(this.otpForm.controls).forEach(i=>{let n=this.otpForm.controls[i].value;if(n){let l=n.length>1,h=!this.config.allowNumbersOnly&&this.config.letterCase&&(this.config.letterCase.toLocaleLowerCase()=="upper"||this.config.letterCase.toLocaleLowerCase()=="lower");n=n[0];let A=h?this.config.letterCase.toLocaleLowerCase()=="upper"?n.toUpperCase():n.toLowerCase():n;h&&A==n?h=!1:n=A,e==null?e=n:e+=n,(l||h)&&this.otpForm.controls[i].setValue(n)}}),this.currentVal!=e&&(this.currentVal=e,this.onChange(e),this.formCtrl?.setValue&&this.formCtrl.setValue(e),this.onInputChange.next(e))}handlePaste(e){let i=e.clipboardData||window.clipboardData;if(i)var n=i.getData("Text");e.stopPropagation(),e.preventDefault(),!(!n||this.config.allowNumbersOnly&&!this.validateNumber(n))&&this.setValue(n)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static{this.\u0275fac=function(i){return new(i||o)(m(Ao),m(Oo))}}static{this.\u0275cmp=w({type:o,selectors:[["ng-otp-input"],["ngx-otp-input"]],inputs:{config:"config",formCtrl:"formCtrl",disabled:"disabled"},outputs:{onBlur:"onBlur",onInputChange:"onInputChange"},features:[at([{provide:Wo,useExisting:xo(()=>o),multi:!0}])],decls:1,vars:1,consts:[["inp",""],["tabindex","0",3,"class","id","ngStyle","focusin","focusout",4,"ngIf"],["tabindex","0",3,"focusin","focusout","id","ngStyle"],[1,"n-o-c"],[4,"ngFor","ngForOf"],["autocomplete","one-time-code",3,"paste","keyup","input","keydown","pattern","type","placeholder","ngStyle","formControl","id","ngClass"],[4,"ngIf"]],template:function(i,n){i&1&&_(0,el,3,7,"div",1),i&2&&p("ngIf",n.otpForm==null?null:n.otpForm.controls)},dependencies:[ze,te,K,zo,bt,z,be,Lo,q],styles:[".otp-input[_ngcontent-%COMP%]{width:50px;height:50px;border-radius:4px;border:solid 1px #c5c5c5;text-align:center;font-size:32px}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]{margin:0 .51rem}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]:first-child{margin-left:0}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]:last-child{margin-right:0}.n-o-c[_ngcontent-%COMP%]{display:flex;align-items:center}.error-input[_ngcontent-%COMP%]{border-color:red}@media screen and (max-width: 767px){.otp-input[_ngcontent-%COMP%]{width:40px;font-size:24px;height:40px}}@media screen and (max-width: 420px){.otp-input[_ngcontent-%COMP%]{width:30px;font-size:18px;height:30px}}"]})}}return o})(),un=(()=>{class o{static{this.\u0275fac=function(i){return new(i||o)}}static{this.\u0275mod=_t({type:o})}static{this.\u0275inj=gt({imports:[mo]})}}return o})();function il(o,t){if(o&1&&(r(0,"div"),d(1," OTP has been sent to "),r(2,"span",5),d(3),a()()),o&2){let e=c();s(3),T(e.contact)}}function nl(o,t){if(o&1&&C(0,"ng-otp-input",3),o&2){let e=c(2);p("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function ol(o,t){if(o&1&&_(0,nl,1,2,"ng-otp-input",3),o&2){let e=c();E(e.showPinInput()?0:-1)}}function rl(o,t){if(o&1&&C(0,"ng-otp-input",3),o&2){let e=c();p("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function al(o,t){if(o&1){let e=v();r(0,"div",4)(1,"span"),d(2,"Didn`t get a code? "),a(),r(3,"a",6),g("click",function(){u(e);let n=c();return f(n.onResendCode())}),d(4,"Click to resend"),a()()}}var fn=class o{type;contact;clearPin=!1;onVerify=new He;resendCode=new He;showPinInput=V(!0);otpCtrl=new ht;otpConfig={length:6,inputStyles:{width:"3rem",height:"3rem"},isPasswordInput:!1,placeholder:"-"};constructor(){this.listenOtpChange()}ngOnChanges(t){let{clearPin:e}=t;e?.currentValue&&(this.showPinInput.set(!1),setTimeout(()=>{this.showPinInput.set(!0)},0)),this.type&&(this.otpConfig.isPasswordInput=this.type==="pin")}onResendCode(){this.resendCode.emit()}listenOtpChange(){this.otpCtrl.valueChanges.pipe(yo(300),se(t=>t.length===6)).subscribe(t=>{this.onVerify.emit(t)})}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=w({type:o,selectors:[["verify-step"]],inputs:{type:"type",contact:"contact",clearPin:"clearPin"},outputs:{onVerify:"onVerify",resendCode:"resendCode"},features:[Io],decls:8,vars:4,consts:[[1,"text-center","mb-10"],[1,"mb-3","fw-normal"],[1,"d-flex","justify-content-center"],[3,"formCtrl","config"],[1,"mt-4","text-start"],[1,"fw-bold"],[1,"link-primary","cursor-pointer",3,"click"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"h4",1),d(2),a(),_(3,il,4,1,"div"),a(),r(4,"div",2),_(5,ol,1,1)(6,rl,1,2,"ng-otp-input",3),a(),_(7,al,5,0,"div",4)),e&2&&(s(2),y(" Confirm Your ",i.type=="pin"?"PIN":"OTP"," "),s(),E(i.type!="pin"?3:-1),s(2),E(i.type=="pin"?5:6),s(2),E(i.type!="pin"?7:-1))},dependencies:[X,un,mo,ze],encapsulation:2})};function ll(o,t){if(o&1){let e=v();r(0,"button",7),g("click",function(){u(e);let n=c();return f(n.onCancel())}),d(1,"Cancel"),a()}}function sl(o,t){if(o&1){let e=v();r(0,"button",8),g("click",function(){u(e);let n=c();return f(n.onConfirm())}),d(1,"Confirm"),a()}}var gn=class o{pointUsed=Ii(0);redeemPointValue=Ii(0);showCancelBtn=Ii(!1);confirmEvent=new He;cancelEvent=new He;onConfirm(){this.confirmEvent.emit()}onCancel(){this.cancelEvent.emit()}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=w({type:o,selectors:[["confirm-step"]],inputs:{pointUsed:[1,"pointUsed"],redeemPointValue:[1,"redeemPointValue"],showCancelBtn:[1,"showCancelBtn"]},outputs:{confirmEvent:"onConfirm",cancelEvent:"onCancel"},decls:19,vars:7,consts:[[1,"text-center"],[1,"fs-5"],[1,"d-flex","justify-content-center","text-success","align-items-center"],[1,"me-3",2,"font-size","1.5rem"],[1,"d-flex","justify-content-center","text-danger","align-items-center"],[1,"btn","btn-danger","mt-12"],[1,"btn","btn-success","mt-12"],[1,"btn","btn-danger","mt-12",3,"click"],[1,"btn","btn-success","mt-12",3,"click"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1),d(2,"Redeem"),a(),r(3,"div",2)(4,"span",3),d(5),b(6,"number"),a(),r(7,"small"),d(8,"Point"),a()(),r(9,"div",1),d(10,"~"),a(),r(11,"div",4)(12,"span",3),d(13),b(14,"number"),a(),r(15,"small"),d(16,"Discount"),a()(),_(17,ll,2,0,"button",5)(18,sl,2,0,"button",6),a()),e&2&&(s(5),T(x(6,3,i.pointUsed())),s(8),T(x(14,5,i.pointUsed()*i.redeemPointValue())),s(4),E(i.showCancelBtn()?17:18))},dependencies:[X,Z],encapsulation:2})};var Zt=class o{constructor(t,e,i,n,l,h,A,le,Te,Fe){this.customerHttpService=t;this.salesOrderService=e;this.pageInitialService=i;this.shoppingCartService=n;this.invoiceCalculatorService=l;this.orderProcessorService=h;this.toastr=A;this.promotionCouponService=le;this.httpService=Te;this.registerService=Fe}customerId;customerData;_isCustomerVerfiedOtp=!1;get isCustomerVerfiedOtp(){return this._isCustomerVerfiedOtp}addCustomerById(t){return new bo(e=>{this.customerId=JSON.parse(JSON.stringify(this.salesOrderService.Data.Order.CustomerID)),this.resetCartOnChangeCustomer(t),S.IsNotEmpty(t)&&this.salesOrderService.updateCustomerID(t).then(i=>{this.applyCustomerPricebook(i),this.updateTaxCustomer(i.TaxTypeId),this.setSalesOrderCustomerId(i),this.setCustomerData(i),this.customerData.DiscountRate==null&&(this.customerData.DiscountRate=0),this._isCustomerVerfiedOtp=!1,this.applyConfigFullPriceOnly(),this.salesOrderService.pushNewValue();let n=this.checkResetRedeemPoint();this.orderProcessorService.reedemPointToDiscount(n),e.next(i)})})}addCustomerByCode(t){return this.salesOrderService.Data.ContactName=null,this.customerHttpService.findCustomerByCode(t).pipe(Re(e=>(this.salesOrderService.Data.ContactName=e.Display,this.addCustomerById(e.ID))))}setSalesOrderCustomerId(t){let e=this.salesOrderService.Data,i=this.registerService.Data.ListSales,n=t.SalesID,l=i.find(h=>h.ID===n);S.IsNotEmpty(t.SalesID)&&l&&(e.Order.SalesID=t.SalesID)}setCustomerData(t){let e=this.salesOrderService.Data;if(t.EntityID==S.GuidEmpty)this.customerData=t;else if(t.EntityID!=e.Order.EntityID){e.Order.CustomerID=null,e.ContactName=null;let i=`${t?.Name} is exclusive to ${t?.EntityName} Outlet and cannot be used in other outlets!`;alert(i)}else this.customerData=t}checkResetRedeemPoint(){let t=!1;return S.IsNotEmpty(this.customerId)&&(t=!0),t}applyCustomerPricebook(t){let e=this.salesOrderService.Data;if(S.IsNotEmpty(t.PricebookID)){let i=e.CartItems.map(n=>(n.Variant.PriceBook&&n.Variant.PriceBook.length!==0&&n.Variant.PriceBook.forEach(l=>{l.ID===t.PricebookID&&n.Quantity>=l.MinimumQuantity&&(n=this.shoppingCartService.applyPricebookToItem(n,l))}),n));e.CartItems=i}}updateTaxCustomer(t){let i=this.pageInitialService.Data.Taxes.find(n=>n.ID==t);i&&(this.salesOrderService.Data.Order.TaxTypeID=i.ID,this.invoiceCalculatorService.tax=i)}resetCartOnChangeCustomer(t){let e=this.pageInitialService.Data.AppConfigJSON;this.customerId!=t&&e.ModuleSell.Customer.ClearCartOnChange&&(this.salesOrderService.Data.CartItems=[]),this.customerId=t}updateDiscountRate(t=0){if(t>0){let e=this.promotionCouponService.coupon,i=this.salesOrderService.Data.Order.Discount;e&&e.Requirement?.Type==1?i==e.Amount?t>e.Amount&&(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.promotionCouponService.removeAppliedDiscountOnCustomerChange(),this.salesOrderService.Data.Order.Discount=t):(this.salesOrderService.Data.Order.Discount=t,this.salesOrderService.Data.Order.CustomerDiscountRate=t):(this.salesOrderService.Data.Order.Discount=t,this.salesOrderService.Data.Order.CustomerDiscountRate=t)}}applyConfigFullPriceOnly(){let t=this.filterGroupByDiscountRate(),e=this.salesOrderService.Data.CartItems;t?.OrderDiscountFullPriceProductOnly?this.filterItemWithDisc(e).length>0?e=this.applyItemsDisc(e,this.customerData.DiscountRate):this.updateDiscountRate(this.customerData.DiscountRate):this.updateDiscountRate(this.customerData.DiscountRate)}filterGroupByDiscountRate(){let e=(this.customerData?.Groups?this.customerData?.Groups:[]).filter(n=>n.OrderDiscountPercentage==this.customerData.DiscountRate),i;return e.length>1?(i=e.find(n=>n.OrderDiscountFullPriceProductOnly==!0),i||(i=e[0])):i=e[0],i}applyItemsDisc(t,e){return t=t.map(i=>(i.Discount==0&&i.DiscountAmount==0&&i.PriceTypeID!=3&&i.Price==i.UnitPrice&&S.IsEmpty(i.PriceBookID)&&(i.Discount=e,i.HasCustomerDiscount=!0),i)),t}filterItemWithDisc(t){return t.filter(i=>i.Discount>0||i.DiscountAmount>0||i.PriceTypeID==3||i.Price!=i.UnitPrice||S.IsNotEmpty(i.PriceBookID))}onEmptyInputCustomer(){S.IsNotEmpty(this.customerId)&&(this.promotionCouponService.removeAppliedDiscountOnCustomerChange(),this.resetAppliedPoint(),this.resetCustomerPricebook(),this.removeCustomerDiscountRate()),this.orderProcessorService.Data.InputTextValue="",this.customerId=JSON.parse(JSON.stringify(this.salesOrderService.Data.Order.CustomerID)),this._isCustomerVerfiedOtp=!1,this.customerData=null,this.salesOrderService.Data.ContactName=null,this.salesOrderService.Data.Order.CustomerID=null,this.customerHttpService.Data=new oo,this.customerData=new oo,this.salesOrderService.pushNewValue()}removeCustomerDiscountRate(){let t=this.filterGroupByDiscountRate(),e=this.salesOrderService.Data.CartItems;t?.OrderDiscountFullPriceProductOnly?this.filterItemWithDisc(e).length>0?this.salesOrderService.Data.CartItems=e.map(n=>(n.HasCustomerDiscount&&(n.Discount=0,n.HasCustomerDiscount=!1),n)):(this.salesOrderService.Data.Order.Discount=0,this.salesOrderService.Data.Order.CustomerDiscountRate=0):(this.salesOrderService.Data.Order.Discount=0,this.salesOrderService.Data.Order.CustomerDiscountRate=0)}resetCustomerPricebook(){if(this.customerData){let t=this.customerData.PricebookID;if(S.IsNotEmpty(t)){let e=this.salesOrderService.Data.CartItems;this.salesOrderService.Data.CartItems=e.map(i=>(i.PriceBookID==t&&(i.Discount=i.Variant.PriceDiscount,i.Note=i.Variant.PriceNote,i.PriceNote=i.Variant.PriceNote,i.PriceBookID=S.GuidEmpty,i.Price=i.Variant.UnitPrice,i.UnitPrice=i.Variant.UnitPrice),i))}}}resetAppliedPoint(){let t=this.salesOrderService.Data;t.Order.PointUsed>0&&(t.Order.PointUsed=0,t.Order.DiscountAmount=0)}redeemPoint(t){let e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data,n=e.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,l=t*n,h=i.RedeemableAmount;l>h&&(n>0?(t=Math.ceil(h/n),l=h):(t=0,l=0),this.toastr.warning("You enter the number of points more than the total amount","Points Adjusted")),i.Order.PointUsed=t||0,i.Order.DiscountAmount=l,this.salesOrderService.pushNewValue(i)}sendOtpViaEmail(t){return this.httpService.post("/API/otp/email",{Email:t})}sendOtpViaWhatsApp(t){return this.httpService.post("/API/otp/WhatsApp",{Number:t})}verifyEmailOtp(t,e){return this.httpService.post("/API/otp/verifyemail",{Email:t,OTP:e}).pipe(Ne(()=>this._isCustomerVerfiedOtp=!0))}verifyPin(t,e){return this.httpService.post("/API/pos/VerifyPin",{PIN:t,CustomerID:e}).pipe(Ne(()=>this._isCustomerVerfiedOtp=!0))}verifyWhatsAppOtp(t,e){return this.httpService.post("/API/otp/verifywhatsapp",{Number:t,OTP:e}).pipe(Ne(()=>this._isCustomerVerfiedOtp=!0))}get pointBalanced(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed;return(t||0)-(e||0)}static \u0275fac=function(e){return new(e||o)(B(pt),B(N),B(L),B(De),B(Me),B(W),B(ee),B(Xe),B(Qe),B(Y))};static \u0275prov=rt({token:o,factory:o.\u0275fac,providedIn:"root"})};var dl=["stepper"];function ml(o,t){o&1&&d(0,"Points")}function ul(o,t){o&1&&d(0,"Verify")}function fl(o,t){o&1&&d(0,"Confirm")}var ei=class o{dialogRef=ie(j);outletRegisterService=ie(Y);pageInitialService=ie(L);customerHttpService=ie(pt);customerService=ie(Zt);orderService=ie(N);toastr=ie(ee);modalConfig;enabledLoyaltyPoint=V(!1);stepper;pointUsed=0;pointBalance=V(0);redeemPointValue=V(0);email=V(null);phone=V(null);contactToResend=V(null);verifyType=V(null);clearPin=V(!1);selectedTab=V(0);constructor(){this.initModalConfig();let t=this.pageInitialService.Data.AppConfigJSON;this.redeemPointValue.set(t?.ApplicationLoyalty?.LoyaltyPoint?.RedeemPointValue),this.email.set(this.customerHttpService.Data?.Email),this.phone.set(this.customerHttpService.Data?.Mobile),this.initAvailablePoint(),this.initConfigEnabledVerify(),this.initPointUsed()}initModalConfig(){this.modalConfig=new H,this.modalConfig.title="Redeem Point",this.modalConfig.customWidth="500px",this.modalConfig.hideFooter=!0}initConfigEnabledVerify(){let t=this.pageInitialService.Data.AppConfigJSON,e=t?.ApplicationLoyalty?.VerifyRedemption,i=t?.ApplicationLoyalty?.Enabled,n=this.outletRegisterService.Data?.MemberPoint;this.enabledLoyaltyPoint.set(e&&i&&n)}initPointUsed(){let t=this.orderService.Data?.Order?.PointUsed;this.pointUsed=t||0,this.pointUsed>0&&this.selectedTab.set(2)}initAvailablePoint(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed,i=(t||0)-(e||0);this.pointBalance.set(i)}onClose(){this.dialogRef.close()}onCancelRedeem(){let t=this.orderService.Data;t.Order.PointUsed=0,t.Order.DiscountAmount=0,this.orderService.pushNewValue(t),this.toastr.info("Redeem point has been canceled","Canceled"),this.onClose()}onRedeem(){this.stepper.next(),this.stepper.next()}onVerify(t){switch(t){case"phone":this.contactToResend.set(this.phone()),this.handlingSentOtpViaPhone();break;case"email":this.contactToResend.set(this.email()),this.handlingSentOtpViaEmail();break;case"pin":this.stepper.next();break}this.verifyType.set(t)}handlingSentOtpViaPhone(){this.customerService.sendOtpViaWhatsApp(this.phone()).subscribe(t=>{this.stepper.selectedIndex==0&&this.stepper.next(),this.toastr.success(`OTP has been sent to ${this.phone()}`,"OTP Sent")})}handlingSentOtpViaEmail(){this.customerService.sendOtpViaEmail(this.email()).subscribe(t=>{this.stepper.selectedIndex==0&&this.stepper.next(),this.toastr.success(`OTP has been sent to ${this.email()}`,"Email Sent")})}onVerifyCode(t){switch(this.verifyType()){case"phone":this.verifyPhoneOtp(t);break;case"email":this.verifyEmailOtp(t);break;case"pin":this.verifyCustomerPin(t);break}}verifyEmailOtp(t){this.customerService.verifyEmailOtp(this.email(),t).subscribe(e=>{this.toastr.success(e.Message,"Successfully verified"),this.stepper.next()})}verifyPhoneOtp(t){this.customerService.verifyWhatsAppOtp(this.phone(),t).subscribe(e=>{this.toastr.success(e.Message,"Successfully verified"),this.stepper.next()})}verifyCustomerPin(t){let e=this.orderService.Data?.Order?.CustomerID;this.clearPin.set(!1),this.customerService.verifyPin(t,e).subscribe({next:i=>{this.toastr.success(i.Message,"Successfully verified"),this.stepper.next()},error:i=>{this.clearPin.set(!0)}})}onResendCode(){this.onVerify(this.verifyType())}onConfirm(){this.calculatePointToDiscount()}calculatePointToDiscount(){let t=this.pageInitialService.Data.AppConfigJSON,e=this.orderService.Data,i=e.RedeemableAmount,n=this.pointUsed,l=t.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,h=this.pointUsed*l;h>i&&(n=Math.ceil(i/l),h=i),(S.IsNotEmpty(e.Order.PointUsed)?e.Order.PointUsed:0)!=n&&(e.Order.PointUsed=n||0,e.Order.DiscountAmount=h,this.orderService.pushNewValue(e),this.toastr.success("Point has been redeemed","Success")),this.dialogRef.close()}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=w({type:o,selectors:[["modal-redeem-point"]],viewQuery:function(e,i){if(e&1&&Se(dl,5),e&2){let n;ye(n=xe())&&(i.stepper=n.first)}},decls:18,vars:18,consts:[["stepper",""],[3,"onClose","preventEnterEvent","config"],[1,"container"],[1,"d-flex","justify-content-center"],[1,"sell-stepper-redeem",3,"linear","selectedIndex"],[3,"editable","aria-labelledby"],["matStepLabel",""],[1,"mt-10"],[3,"onVerify","pointUsedChange","onRedeem","isVerifyEnabled","pointUsed","pointBalance","email","phone"],["aria-labelledby","stepDisabled",3,"editable"],[3,"resendCode","onVerify","type","contact","clearPin"],["aria-labelledby","stepDisabled"],[3,"onConfirm","onCancel","pointUsed","redeemPointValue","showCancelBtn"]],template:function(e,i){if(e&1){let n=v();r(0,"modal-material",1),g("onClose",function(){return u(n),f(i.onClose())}),r(1,"content")(2,"div",2)(3,"div",3)(4,"mat-stepper",4,0)(6,"mat-step",5),_(7,ml,1,0,"ng-template",6),r(8,"div",7)(9,"point-step",8),g("onVerify",function(h){return u(n),f(i.onVerify(h))}),D("pointUsedChange",function(h){return u(n),M(i.pointUsed,h)||(i.pointUsed=h),f(h)}),g("onRedeem",function(){return u(n),f(i.onRedeem())}),a()()(),r(10,"mat-step",9),_(11,ul,1,0,"ng-template",6),r(12,"div",7)(13,"verify-step",10),g("resendCode",function(){return u(n),f(i.onResendCode())})("onVerify",function(h){return u(n),f(i.onVerifyCode(h))}),a()()(),r(14,"mat-step",11),_(15,fl,1,0,"ng-template",6),r(16,"div",7)(17,"confirm-step",12),g("onConfirm",function(){return u(n),f(i.onConfirm())})("onCancel",function(){return u(n),f(i.onCancelRedeem())}),a()()()()()()()()}e&2&&(p("preventEnterEvent",!0)("config",i.modalConfig),s(4),p("linear",!0)("selectedIndex",i.selectedTab()),s(2),p("editable",!0)("aria-labelledby",i.selectedTab()==2?"stepDisabled":""),s(3),p("isVerifyEnabled",i.enabledLoyaltyPoint()),P("pointUsed",i.pointUsed),p("pointBalance",i.pointBalance())("email",i.email())("phone",i.phone()),s(),p("editable",!1),s(3),p("type",i.verifyType())("contact",i.contactToResend())("clearPin",i.clearPin()),s(4),p("pointUsed",i.pointUsed)("redeemPointValue",i.redeemPointValue())("showCancelBtn",i.selectedTab()==2))},dependencies:[X,ve,U,fe,oa,ia,ta,na,dn,fn,gn],styles:['@import"https://fonts.googleapis.com/icon?family=Material+Icons"; mat-stepper.sell-stepper-redeem .mat-horizontal-stepper-header{height:50px!important} mat-stepper.sell-stepper-redeem .mat-horizontal-stepper-header .mat-step-label{min-width:0px!important} mat-stepper.sell-stepper-redeem .mat-horizontal-stepper-header[aria-labelledby=stepDisabled]{pointer-events:none!important}']})};function gl(o,t){if(o&1){let e=v();I(0),r(1,"div",16),g("click",function(){u(e);let n=c(2);return f(n.onShowModalRedeem())}),r(2,"span"),C(3,"i",17),a(),r(4,"span"),d(5),b(6,"number"),a()(),O()}if(o&2){let e=c(2);s(5),y(" ",x(6,1,e.pointUsed)," Points redeemed ")}}function _l(o,t){if(o&1){let e=v();I(0),r(1,"tab",4)(2,"div",5)(3,"div",6)(4,"label",7),d(5,"Discount %"),a()(),r(6,"div",8)(7,"input",9),D("ngModelChange",function(n){u(e);let l=c();return M(l.discount1,n)||(l.discount1=n),f(n)}),a(),r(8,"span",10),d(9,"%"),a(),r(10,"span",11),d(11,"+"),a(),r(12,"input",12),D("ngModelChange",function(n){u(e);let l=c();return M(l.discount2,n)||(l.discount2=n),f(n)}),a(),r(13,"span",10),d(14,"%"),a()()(),r(15,"div",13)(16,"div",6)(17,"label",7),d(18),a()(),r(19,"div",14)(20,"input",15),D("ngModelChange",function(n){u(e);let l=c();return M(l.discountAmount,n)||(l.discountAmount=n),f(n)}),a(),_(21,gl,7,3,"ng-container",3),a()()(),O()}if(o&2){let e=c();s(),p("active",e.tabActive=="Discount"),s(6),P("ngModel",e.discount1),s(5),P("ngModel",e.discount2),s(6),y("Discount ",e.currencySymbol,""),s(2),p("disabled",e.pointUsed&&e.pointUsed>0),P("ngModel",e.discountAmount),s(),p("ngIf",e.pointUsed&&e.pointUsed>0)}}function Cl(o,t){if(o&1){let e=v();I(0),r(1,"tab",18)(2,"div",5)(3,"div",6)(4,"label",7),d(5,"Tax"),a()(),r(6,"div",8)(7,"ng-select",19),g("change",function(n){u(e);let l=c();return f(l.updateTax(n))}),a()()(),r(8,"div",13)(9,"div",6)(10,"label",7),d(11,"Surcharge"),a()(),r(12,"div",8)(13,"input",20),D("ngModelChange",function(n){u(e);let l=c();return M(l.surcharge,n)||(l.surcharge=n),f(n)}),a(),r(14,"span",10),d(15,"%"),a()()()(),O()}if(o&2){let e=c();s(7),p("clearable",!1)("ngModel",e.salesOrder.Order.TaxTypeID)("items",e.taxes),s(6),P("ngModel",e.surcharge),p("max",100)("min",-100)}}function hl(o,t){if(o&1){let e=v();I(0),r(1,"tab",21)(2,"div",5)(3,"div",22)(4,"strong"),d(5,"Discount After Tax"),a()(),r(6,"div",23)(7,"input",24),D("ngModelChange",function(n){u(e);let l=c();return M(l.discountAfterTax,n)||(l.discountAfterTax=n),f(n)}),g("ngModelChange",function(){u(e);let n=c();return f(n.onDiscountAfterTaxChange())}),a()()(),r(8,"div",25)(9,"div",22)(10,"label",7),d(11,"Discount Calculator"),a()(),r(12,"div",26)(13,"input",27),D("ngModelChange",function(n){u(e);let l=c();return M(l.discounts[0],n)||(l.discounts[0]=n),f(n)}),g("ngModelChange",function(){u(e);let n=c();return f(n.calculateDiscountCalculator())}),a(),r(14,"span"),d(15," %"),a(),r(16,"span",11),d(17,"+"),a(),r(18,"input",28),D("ngModelChange",function(n){u(e);let l=c();return M(l.discounts[1],n)||(l.discounts[1]=n),f(n)}),g("ngModelChange",function(){u(e);let n=c();return f(n.calculateDiscountCalculator())}),a(),r(19,"span"),d(20," %"),a(),r(21,"span",11),d(22,"+"),a(),r(23,"input",29),D("ngModelChange",function(n){u(e);let l=c();return M(l.discounts[2],n)||(l.discounts[2]=n),f(n)}),g("ngModelChange",function(){u(e);let n=c();return f(n.calculateDiscountCalculator())}),a(),r(24,"span"),d(25," %"),a()()()(),O()}if(o&2){let e=c();s(7),P("ngModel",e.discountAfterTax),s(6),P("ngModel",e.discounts[0]),s(5),P("ngModel",e.discounts[1]),s(5),P("ngModel",e.discounts[2])}}var ti=class o{constructor(t,e,i,n,l,h,A,le,Te,Fe){this.dialogRef=t;this.orderService=e;this.invoiceCalculatorService=i;this.pageInitialService=n;this.roleService=l;this.customerHttpService=h;this.orderProcessorService=A;this.promotionCouponService=le;this.dialog=Te;this.data=Fe;let je=this.pageInitialService?.Data?.AppConfigJSON;this.modalConfig.title="Discount and Tax",this.modalConfig.customWidth="480px",this.salesOrder=this.orderService.Data,this.userRole=this.roleService.Data,this.isPreferedPayment=je?.ApplicationLoyalty?.PreferedPayment,this.tabActive=this.data?.tabIndexActive,this.isEditOrder=this.orderProcessorService.Data.posState==2,this.customer=h.Data,this.initDiscountAndTax(),this.initAvailablePoint(),this.initTabLoyaltyTitle()}modalConfig=new H;discount1;discount2;discountAmount;surcharge;discountAfterTax;currencySymbol;salesOrder;discounts=[];taxes;selectedTax;userRole;tabActive;isEditOrder;isPreferedPayment;customerPoint;customer;tabLoyaltyTitle;pointUsed;availablePoint;initAvailablePoint(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed;this.customerPoint=t,this.availablePoint=(t||0)-(e||0)}initTabLoyaltyTitle(){let e=this.pageInitialService?.Data?.AppConfigJSON?.ApplicationLoyalty?.Label;this.tabLoyaltyTitle=S.IsNotEmpty(e)?e:"Loyalty"}initDiscountAndTax(){this.discount1=this.salesOrder.Order.Discount,this.discount2=this.salesOrder.Order.Discount2,this.discountAmount=this.salesOrder.Order.DiscountAmount,this.surcharge=this.salesOrder.Invoice.SurchargePcg,this.discountAfterTax=this.invoiceCalculatorService.discountAfterTax,this.currencySymbol=this.invoiceCalculatorService.currencySymbol,this.taxes=this.pageInitialService.Data.Taxes,this.selectedTax=this.invoiceCalculatorService.tax,this.pointUsed=this.salesOrder.Order.PointUsed}updateTax(t){this.selectedTax=t}onOk(){this.resetAppliedCoupon(),this.applyChangesDiscountAmount(),this.salesOrder.Order.Discount=this.discount1,this.salesOrder.Order.Discount2=this.discount2,this.salesOrder.Invoice.SurchargePcg=this.surcharge,this.salesOrder.Invoice.TempSurchargePcg=this.surcharge,this.invoiceCalculatorService.discountAfterTax=this.discountAfterTax,this.salesOrder.Order.TaxTypeID=this.selectedTax.ID,this.invoiceCalculatorService.tax=this.selectedTax,this.orderService.pushNewValue(this.salesOrder),this.onClose()}onClose(){this.dialogRef.close()}calculateDiscountCalculator(){var t=100;this.discounts.forEach(e=>{t=t*(100-e)/100}),this.discount1=100-t}onDiscountAfterTaxChange(){this.discountAmount=this.discountAfterTax;let e=this.invoiceCalculatorService.TotalBeforeTax-this.discountAmount,i=this.orderService.Data.Order.TaxTypeID,n=this.pageInitialService.Data.Taxes,l=S.FilterByID(n,i);if(S.IsNotEmpty(l)&&l.CalculationTypeID==0){let h=1+l.Rate/100,A=e*h;this.discountAmount=(A-(A-this.discountAfterTax))/h}}applyChangesDiscountAmount(){let t=this.salesOrder.Order.DiscountAmount;this.discountAmount!=t&&(this.salesOrder.Order.DiscountAmount=this.discountAmount)}onTabChange(t){this.tabActive=t}resetAppliedCoupon(){let t=this.promotionCouponService.coupon,e=this.salesOrder.Order.DiscountAmount;t&&t.Requirement?.Type==2&&e!=this.discountAmount&&(this.salesOrder.Order.PromotionCoupon=null,this.salesOrder.Order.PromotionNote=null)}onShowModalRedeem(){this.onClose(),this.dialog.open(ei)}static \u0275fac=function(e){return new(e||o)(m(j),m(N),m(Me),m(L),m(de),m(pt),m(W),m(Xe),m(re),m(Ae))};static \u0275cmp=w({type:o,selectors:[["POS-modal-discount"]],decls:7,vars:4,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],[3,"onTabChange"],[4,"ngIf"],["tabTitle","Discount",3,"active"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-3"],[1,"fw-bold","d-block"],[1,"col-9"],["type","text","data-cy","discount1","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"ms-1"],[1,"mx-2"],["type","text","data-cy","discount2","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],[1,"col-9","d-flex","align-items-center"],["type","text","data-cy","discountamount","autoNum","","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","disabled","ngModel"],["role","button",3,"click"],[1,"fa-solid","fa-info-circle","ms-2"],["matTooltipPosition","above","tabTitle","Tax"],["bindLabel","Label","appendTo","body","bindValue","ID","placeholder","Tax","data-cy","select-tax",2,"width","150px",3,"change","clearable","ngModel","items"],["type","text","data-cy","surcharge","autoNum","","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","85px",3,"ngModelChange","ngModel","max","min"],["tabTitle","Calculator"],[1,"col-4"],[1,"col-8","ps-6"],["type","text","num-neg","false","autoNum","","emptyInputBehavior","zero",1,"txtPrice","form-control",2,"width","100px",3,"ngModelChange","ngModel"],[1,"row","mt-6","g-0","d-flex","align-items-center","justify-content-start"],[1,"col-8","ps-4"],["type","text","data-cy","discountCal1","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal2","autoNum","","decimalPlaces","2","percentage","","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal3","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("keydown.F2",function(){return i.onOk()})("onOk",function(){return i.onOk()})("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),r(1,"content")(2,"div",1)(3,"custom-tabs",2),g("onTabChange",function(l){return i.onTabChange(l)}),_(4,_l,22,7,"ng-container",3)(5,Cl,16,6,"ng-container",3)(6,hl,26,4,"ng-container",3),a()()()()),e&2&&(p("config",i.modalConfig),s(4),p("ngIf",i.userRole.Discount),s(),p("ngIf",i.userRole.Tax),s(),p("ngIf",i.userRole.Discount))},dependencies:[X,z,Z,fe,te,K,oe,Yi,Kr,zr,ve,U,mt,ut,st,Ke],encapsulation:2})};var Cn=class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=_t({type:o});static \u0275inj=gt({imports:[X,fe]})};var hn=class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=_t({type:o});static \u0275inj=gt({imports:[X,fe,ze,ve,Ut,mt,ea,ut,Yi,Ke,un,qt,yr,Ht,ut,Vt,ra,tr,Ri,Cn,la,yt,Li,ca,Zi,mt,ti,kt,Ei]})};var bn=class o{constructor(t,e,i,n,l,h,A){this.orderProcessorService=t;this.posDataService=e;this.signalBroadCast=i;this.calculatorService=n;this.OrderHttpService=l;this.localDataService=h;this.posService=A;this.newSale=new He}newSale;retrySubmit(){let t=this.posService.Data.AppConfigJSON,e=this.posDataService.Data;this.posDataService.submitOrder(t).then(i=>{i.Success?(this.broadcastToCustomerDisplay(i),this.posDataService.pushNewValue(e),this.orderProcessorService.updatePosState(1,i)):(this.posDataService.pushNewValue(e),this.orderProcessorService.updatePosState(1,i))}).catch(i=>{console.log(i)})}broadcastToCustomerDisplay(t){let i=this.posDataService.Data.TotalPaidAmount-this.calculatorService.Data;this.signalBroadCast.BroadcastStateToCustomerDisplay(1,t.ObjectID,t.LoyaltyPoint,i).subscribe()}saveOffline(){let t=this.posDataService.Data,e=this.OrderHttpService.generatePOSDataForSubmission(t,!1);this.localDataService.syncOrder(e).subscribe(()=>{this.newSale.next()})}static \u0275fac=function(e){return new(e||o)(m(W),m(N),m(Wi),m(Me),m(Pe),m(Ye),m(L))};static \u0275cmp=w({type:o,selectors:[["app-retry"]],outputs:{newSale:"newSale"},decls:21,vars:0,consts:[[1,"card"],[1,"card-header","bg-gradient-danger"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-times-circle","me-1","text-danger"],[1,"card-body"],[1,"row","justify-content-center","g-0","mt-8"],[1,"col-8","text-center"],[1,"text-danger","fs-5"],[1,"row","mt-4","justify-content-center","g-0","mb-9"],[1,"col-5","text-center"],["type","button","matTooltipPosition","above","matTooltip","Upload your local / offline order to the cloud",1,"btn","btn-success","btn-lg","fs-3",3,"click"],[1,"card-footer","bg-light-gray"],[1,"row","justify-content-between","py-6"],[1,"col-auto"],["type","button","matTooltipPosition","above","matTooltip","Temporarily save data locally until connection to the server is restored",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-save","me-2",2,"font-size","14px"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"div",2)(3,"h2"),C(4,"i",3),d(5," Order Upload Fail! "),a()()(),r(6,"div",4)(7,"div",5)(8,"div",6)(9,"p",7),d(10," Slow Connection Detected, Check the customer invoice list first. If the transaction isn't there, click the 'Retry' button. "),a()()(),r(11,"div",8)(12,"div",9)(13,"button",10),g("click",function(){return i.retrySubmit()}),d(14," Retry Upload "),a()()()(),r(15,"div",11)(16,"div",12)(17,"div",13)(18,"button",14),g("click",function(){return i.saveOffline()}),C(19,"i",15),d(20,"Save Offline "),a()()()()())},dependencies:[X,Ke,ce],encapsulation:2})};var ha=(()=>{class o{constructor(){this.emailRegex=S.emailRegex,this.phoneNumberRegex=S.phoneNumberRegex}validate(e){let i=this.emailRegex,n=this.phoneNumberRegex,l=i.test(e.value),h=n.test(e.value);if(l||h||e.value=="")return null;{let A="Please input a valid email or phone number";return h?A="Please input a valid email":l&&(A="Please input a valid phone number"),{invalidEmailOrPhoneNumber:{value:e.value,errMessage:A}}}}static{this.\u0275fac=function(i){return new(i||o)}}static{this.\u0275dir=Pi({type:o,selectors:[["","pOSIsInvalidEmailOrPhoneNumber",""]],features:[at([{provide:Qo,useExisting:o,multi:!0}])]})}}return o})();function vl(o,t){o&1&&(I(0),r(1,"div",3)(2,"h4",4),d(3," For use this feature you must register first!"),C(4,"br"),d(5," Click the link below "),a()(),r(6,"a",5),d(7,"more information"),a(),d(8," > "),O())}function Sl(o,t){if(o&1){let e=v();r(0,"div",6)(1,"div",7)(2,"span",8),C(3,"i",9),a(),C(4,"input",10),r(5,"button",11),d(6,"Copy to Clipboard"),a()()(),r(7,"div",12)(8,"div",13)(9,"span",14),C(10,"i",15),a(),C(11,"input",16),r(12,"button",17),g("click",function(){u(e);let n=c();return f(n.onSendViaWhatsApp())}),d(13,"Send via WhatsApp"),a()()()}if(o&2){let e=c();s(4),p("value",e.data.link),s(),p("cdkCopyToClipboard",e.data.link),s(6),p("formControl",e.whatsAppNumberCtrl),s(),p("disabled",e.whatsAppNumberCtrl.invalid)}}var vi=class o{constructor(t,e,i){this._dialogRef=t;this._toast=e;this.data=i}modalConfig=new H;whatsAppNumberCtrl;ngOnInit(){this.modalConfig.title="Midtrans Payment Link",this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="500px",this.initWaNumberCtrl()}initWaNumberCtrl(){this.whatsAppNumberCtrl=new Jo(null,[ui.pattern("^[0-9]*$"),ui.required])}close(){this._dialogRef.close()}onSendViaWhatsApp(){let t=this.whatsAppNumberCtrl.value;if(t){let e="https://wa.me/"+t+"?text="+this.data.link;window.open(e,"_blank")}else this._toast.error("Phone Number must be insert")}static \u0275fac=function(e){return new(e||o)(m(j),m(ee),m(Ae))};static \u0275cmp=w({type:o,selectors:[["POS-modal-generate-link"]],standalone:!1,decls:5,vars:3,consts:[["hasLink",""],[3,"onOk","onCancel","onClose","config"],[4,"ngIf","ngIfElse"],[1,"input-group","mb-2",2,"width","350px"],[1,"fw-normal","d-block"],["href","https://midtrans.com/id/product/payment-link","target","_blank"],[1,"col-sm-12"],[1,"input-group"],["id","inputGroup-sizing-lg p-6",1,"input-group-text"],[1,"fa-solid","fa-link","fs-5"],["readonly","","type","text","aria-label","Link href",1,"form-control",3,"value"],["id","btnCopyLink","type","button",1,"btn","btn-outline-secondary",2,"width","150px",3,"cdkCopyToClipboard"],[1,"col-sm-12","mt-6"],[1,"input-group",2,"width","29.4rem"],["id","inputGroup-sizing-lg",1,"input-group-text","p-7"],[1,"fa-solid","fa-mobile-screen-button","fs-3"],["type","text","placeholder","Mobile Number (e.g. 6281500000000)","aria-label","Mobile Number (e.g. 6281500000000)",1,"form-control",3,"formControl"],["id","btnSend","type","button",1,"btn","btn-outline-secondary",3,"click","disabled"]],template:function(e,i){if(e&1){let n=v();r(0,"modal-material",1),g("onOk",function(){return u(n),f(i.close())})("onCancel",function(){return u(n),f(i.close())})("onClose",function(){return u(n),f(i.close())}),r(1,"content"),_(2,vl,9,0,"ng-container",2)(3,Sl,14,4,"ng-template",null,0,J),a()()}if(e&2){let n=Q(4);p("config",i.modalConfig),s(2),p("ngIf",i.data.link==null||i.data.link=="")("ngIfElse",n)}},dependencies:[z,te,K,bt,U,sa],encapsulation:2})};var Il=o=>({"rounded-0 rounded-start-2":o}),Ol=(o,t)=>({"bg-gradient-warning":o,"bg-gradient-danger":t}),Pl=o=>({offline:o}),Ml=o=>({"ms-2":o}),Dl=(o,t)=>({ID:o,Template:t}),wl=(o,t,e)=>({InvoiceID:o,OutID:t,Template:e}),kl=o=>({ID:o,Print:1,Printer:"Normal"}),Tl=o=>({ID:o});function El(o,t){if(o&1&&(r(0,"a",47),d(1,"Delivery Order"),a()),o&2){let e=c(3);p("queryParams",me(1,Dl,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function Rl(o,t){if(o&1&&(r(0,"a",48),d(1,"Invoice & Delivery Order"),a()),o&2){let e=c(3);p("queryParams",mi(1,wl,e.completeData.ObjectID,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function Nl(o,t){if(o&1&&(r(0,"a",49),d(1,"Invoice (No Price)"),a()),o&2){let e=c(3);p("href",e.getInvoicePrintURL(!0),tt)}}function Vl(o,t){if(o&1&&(r(0,"a",50),d(1,"Packing Slip"),a()),o&2){let e=c(3);p("queryParams",R(1,kl,e.completeData.OutDeliveryID))}}function Al(o,t){if(o&1&&(r(0,"div",30),C(1,"button",41),r(2,"div",42),_(3,El,2,4,"a",43)(4,Rl,2,5,"a",44)(5,Nl,2,1,"a",45)(6,Vl,2,3,"a",46),a()()),o&2){let e=c(2);s(3),p("ngIf",e.completeData.OutDeliveryID),s(),p("ngIf",e.completeData.OutDeliveryID),s(),p("ngIf",e.completeData),s(),p("ngIf",e.completeData.OutDeliveryID)}}function Ll(o,t){o&1&&(r(0,"div",32)(1,"div",36)(2,"p",51),d(3," Transaction saved to your browser's local storage. Please upload when connection is restored! "),a()()())}function Bl(o,t){if(o&1){let e=v();r(0,"div",33)(1,"div",52)(2,"div",53),g("click",function(){u(e);let n=c(2);return f(n.changeReceiptContact())}),C(3,"i"),a(),r(4,"input",54),g("ngModelChange",function(n){u(e);let l=c(2);return f(l.isPhoneOrEmail(n))}),a()(),r(5,"div",55)(6,"button",56),g("click",function(){u(e);let n=c(2);return f(n.sendReceiptToContact())}),d(7," Send Receipt "),a()()()}if(o&2){let e=c(2);s(3),he(e.receiptIcon+" fs-4"),s(),p("formControl",e.customerContact),s(2),p("disabled",e.customerContact.invalid)}}function Fl(o,t){if(o&1&&(r(0,"small",34),d(1),a()),o&2){let e=c(2);s(),y(" ",e.customerContact.errors==null||e.customerContact.errors.invalidEmailOrPhoneNumber==null?null:e.customerContact.errors.invalidEmailOrPhoneNumber.errMessage," ")}}function jl(o,t){if(o&1){let e=v();r(0,"button",57),g("click",function(){u(e);let n=c(2);return f(n.onRetry())}),d(1," Retry Upload "),a()}}function Hl(o,t){if(o&1){let e=v();r(0,"div",60)(1,"button",61),g("click",function(){u(e);let n=c(3);return f(n.generateLink())}),C(2,"i",62),d(3,"Generate Payment Link "),a()()}}function Ul(o,t){if(o&1){let e=v();r(0,"div",60)(1,"button",63),g("click",function(){u(e);let n=c(3);return f(n.verifyPaymentSettlement())}),C(2,"i",64),d(3,"Verify Payment Settlement "),a()()}}function Wl(o,t){if(o&1&&(r(0,"div",40)(1,"div",58),_(2,Hl,4,0,"div",59)(3,Ul,4,0,"div",59),a()()),o&2){let e=c(2);s(2),p("ngIf",e.completeData.PaymentStateID==1),s(),p("ngIf",e.isNotEmpty(e.paymentGatewayService.getTransactionId()))}}function Ql(o,t){if(o&1){let e=v();r(0,"div",9)(1,"div",26)(2,"div",27)(3,"h2"),C(4,"i",28),d(5," Sell Complete "),r(6,"small",29),d(7),a()(),r(8,"div"),_(9,Al,7,4,"div",30),a()()(),r(10,"div",14)(11,"div",31),_(12,Ll,4,0,"div",32)(13,Bl,8,5,"div",33)(14,Fl,2,1,"small",34),r(15,"div",35)(16,"div",36)(17,"div",37),_(18,jl,2,0,"button",38),r(19,"button",39),g("click",function(){u(e);let n=c();return f(n.newSale())}),d(20," New Sale (F8) "),a()()()()()(),_(21,Wl,4,2,"div",40),a()}if(o&2){let e=c();s(),p("ngClass",me(9,Ol,(!e.isOrderDateNow||e.completeData.PaymentStateID<3)&&e.completeData.PaymentStateLabel!="Offline",e.completeData.PaymentStateLabel=="Offline")),s(6),y(" (",e.completeData.PaymentStateLabel,")"),s(2),E(e.completeData.PaymentStateLabel=="Offline"?9:-1),s(2),p("ngClass",R(12,Pl,e.completeData.PaymentStateLabel=="Offline")),s(),E(e.completeData.PaymentStateLabel=="Offline"?12:13),s(2),E(e.customerContact!=null&&e.customerContact.invalid&&(e.customerContact!=null&&e.customerContact.dirty||e.customerContact!=null&&e.customerContact.touched)?14:-1),s(4),E(e.completeData.PaymentStateLabel=="Offline"&&!e.isSuccessRetrySubmit()?18:-1),s(),p("ngClass",R(14,Ml,e.completeData.PaymentStateLabel=="Offline")),s(2),E(e.isOnline&&(e.completeData==null?null:e.completeData.PaymentStateID)==1||e.isNotEmpty(e.paymentGatewayService.getTransactionId())?21:-1)}}function ql(o,t){if(o&1){let e=v();r(0,"app-retry",65),g("newSale",function(){u(e);let n=c();return f(n.newSale())}),a()}}function $l(o,t){if(o&1&&(I(0),r(1,"a",66),d(2),a(),O()),o&2){let e=c();s(),p("queryParams",R(2,Tl,e.completeData.ObjectID)),s(),y(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function Jl(o,t){if(o&1&&(r(0,"span",67),d(1),a()),o&2){let e=c();s(),y(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function Gl(o,t){if(o&1&&(I(0),d(1),b(2,"number"),O()),o&2){let e=c().$implicit;s(),Ue(" ",e.CurrencySymbol," ",x(2,2,e.Amount)," ")}}function zl(o,t){o&1&&d(0," - ")}function Kl(o,t){if(o&1&&(r(0,"div",69)(1,"div",70),d(2),a(),r(3,"div",71),_(4,Gl,3,4,"ng-container",13)(5,zl,1,0,"ng-template",null,1,J),a()()),o&2){let e=t.$implicit,i=Q(6),n=c(2);s(2),T(e.Label),s(2),p("ngIf",n.role.PriceVisible)("ngIfElse",i)}}function Yl(o,t){if(o&1&&(r(0,"div",14),_(1,Kl,7,3,"div",68),a()),o&2){let e=c();s(),p("ngForOf",e.itemSummary)}}function Xl(o,t){if(o&1&&(r(0,"div",75)(1,"div",76),d(2),a(),r(3,"div",77),d(4),b(5,"number"),a()()),o&2){let e=t.$implicit,i=t.index,n=c(2);s(),p("hidden",!n.role.PriceVisible),s(),Ue(" ",e.Label,": ",e.CurrencySymbol," "),s(),p("hidden",!n.role.PriceVisible)("ngClass",i+1===n.amountSummary.length?"amount":""),s(),y(" ",x(5,6,e.Amount)," ")}}function Zl(o,t){if(o&1&&(r(0,"div",75)(1,"div",76),d(2),a(),r(3,"div",79),d(4),b(5,"number"),a()()),o&2){let e=t.$implicit,i=c(3);s(),p("hidden",!i.role.PriceVisible),s(),Ue(" ",e.Label,": ",e.CurrencySymbol," "),s(),p("hidden",!i.role.PriceVisible),s(),y(" ",x(5,5,e.Amount)," ")}}function es(o,t){if(o&1&&(I(0),r(1,"div",78),_(2,Zl,6,7,"div",73),a(),O()),o&2){let e=c(2);s(2),p("ngForOf",e.paymentSummary)}}function ts(o,t){if(o&1&&(r(0,"div",72),_(1,Xl,6,8,"div",73)(2,es,3,1,"ng-container",74),a()),o&2){let e=c();s(),p("ngForOf",e.amountSummary),s(),p("ngIf",(e.paymentSummary==null?null:e.paymentSummary.length)>0)}}function is(o,t){if(o&1&&(r(0,"div",16)(1,"div",80)(2,"p",81),d(3,"INVALID AMOUNT CHARGE, CORRECT AMOUNT"),a(),r(4,"P",82),d(5),b(6,"number"),a()()()),o&2){let e=c();s(5),y("",x(6,1,e.completeData==null?null:e.completeData.Final)," ")}}function ns(o,t){if(o&1&&(r(0,"a",22),C(1,"i",83),a()),o&2){let e=c();p("href",e.getInvoicePrintURL(!1),tt)}}function os(o,t){if(o&1&&(r(0,"div",9)(1,"div",11)(2,"h3",12),d(3,"Point Balance"),a()(),C(4,"div",84),a()),o&2){let e=c();s(4),p("innerHtml",e.completeData.LoyaltyPoint,Oi)}}function rs(o,t){if(o&1&&C(0,"pos-receipt",85),o&2){let e=c(2);p("data",e.receiptTemplate)("printTemplate",e.outletRegister.PrintTemplate)("config",e.posStorage.AppConfigJSON)("priceVisibleRestriction",!e.role.PriceVisible)("outletInfo",e.outletRegister)("isUnknownError",e.currentSellState==e.sellState.UploadOrderFail)("isOffline",e.isOnline==!1)("stylesheet",e.posStorage.StylesSheet)("saveLastPrintDate",!0)}}function as(o,t){if(o&1&&C(0,"pos-receipt-a4",86),o&2){let e=c(3);p("data",t)("printTemplate",e.outletRegister.PrintTemplate)("config",e.posStorage.AppConfigJSON)("workOrderMode",!1)("stylesheet",e.posStorage.StylesSheet)("saveLastPrintDate",!0)}}function ls(o,t){if(o&1&&(_(0,as,1,6,"pos-receipt-a4",86),b(1,"async")),o&2){let e,i=c(2);E((e=x(1,1,i.receiptTemplateA4$))?0:-1,e)}}function ss(o,t){if(o&1&&_(0,rs,1,9,"pos-receipt",85)(1,ls,2,3),o&2){let e=c();E(e.receiptTemplate&&e.printMode==2?0:-1),s(),E(e.printMode==1?1:-1)}}function cs(o,t){o&1&&(r(0,"div",25)(1,"h1"),d(2," Cannot generate print preview because of client-server amount Mismatch "),a()())}var vn=class o{constructor(t,e,i,n,l,h,A,le,Te,Fe,je,oi,wt,Yn,Xn,ri,Fa,_o,Co,ja){this._posDataService=t;this._posService=e;this._orderProcessorService=i;this._OrderHttpService=n;this._PaymentHttpService=l;this._receiptService=h;this._outletService=A;this._toastr=le;this._onlineStatusService=Te;this._matDialog=Fe;this._signalBroadCast=je;this._calculatorService=oi;this._userRoleService=wt;this._router=Yn;this._receiptCalculatorService=Xn;this.datePipe=ri;this.decimalPipe=Fa;this.paymentGatewayService=_o;this.paymentHttpService=Co;this.shoppingCartService=ja}whatsappSendReceiptService=ie(lo);handleF8(){this.newSale()}salesOrder=new ct;receiptTemplate=null;receiptTemplateA4$;completeData=new wr;printMode=2;outletRegister=new Bi;role;finalAmountDifferent=!1;amountSummary=[];itemSummary=[];paymentSummary=[];isOnline=!1;destroy$=new G;get posStorage(){return this._posService.Data}currentSellState;isOrderDateNow;sellState=Ie;receiptIcon="fa-brands fa-whatsapp";customerContact=new ht;printOnPayment=V(!0);isSuccessRetrySubmit=V(!1);ngOnInit(){this.resetUrlAfterRedirect(),this.subscribeToObservableChanges()}subscribeToObservableChanges(){this._onlineStatusService.getOnlineStatus$().pipe(k(this.destroy$)).subscribe(t=>{this.isOnline=t}),this._userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.role=t}),this._posDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.salesOrder=t}),this._outletService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.outletRegister=t;let e=this.outletRegister?.PrintTemplate?.PrintMode;this.initPrintMode(e)}),this._orderProcessorService.Data$.pipe(se(t=>t.posState===1||t.posState===9),k(this.destroy$)).subscribe(t=>{if(this.currentSellState=t.posState,this.generateCompleteSummary(),this._OrderHttpService.Data){let e=this.posStorage?.AppConfigJSON?.ModuleSell?.OrderComplete?.PrintOnPayment;this.printOnPayment.set(e),this.completeData=this._OrderHttpService.Data,this.checkFinalAmountDifferent(),this.setLoyaltyLabelConfig(),this.InitPrintInvoice(),this.initCustomerContact(),this.sendEmailOnComplete(),this.checkOrderDateIsNow(),this.clearShoppingCartInLocalStorage()}})}clearShoppingCartInLocalStorage(){this.shoppingCartService.clearCartItemsInLocalStorage()}generateCompleteSummary(){this.itemSummary=this._receiptService.generateCartItemSummary(),this.amountSummary=this._receiptCalculatorService.generateAmountSummary(),this.paymentSummary=this._receiptService.generatePaymentSummary()}initPrintMode(t){this.isOnline?this.printMode=t:this.printMode=2}sendEmailOnComplete(){let t=this.posStorage?.AppConfigJSON?.ModuleSell?.OrderComplete?.EmailReceipt,e=this.completeData?.Contact?.Email;t&&S.IsNotEmpty(e)&&this.sendEmail()}resetUrlAfterRedirect(){this._router.events.pipe(k(this.destroy$)).subscribe(t=>{t instanceof jo&&(t?.url?.includes("Sell")||(this._orderProcessorService.createNewTransactionInSameOutletRegister(),this._signalBroadCast.BroadcastStateToCustomerDisplay(0).subscribe()))})}InitPrintInvoice(){this.currentSellState==1&&(this.checkOrderNumber(),this.print())}initCustomerContact(){if(this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.DefaultReceiptChannel==0){this.receiptIcon="fa-solid fa-envelope";let t=this.completeData?.Contact?.Email;this.customerContact.setValue(t)}else if(this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.DefaultReceiptChannel==1){this.receiptIcon="fa-brands fa-whatsapp";let t=this.completeData?.Contact?.Mobile;this.customerContact.setValue(t)}}isPhoneOrEmail(t){let e=S.emailRegex,i=S.phoneNumberRegex,n=e,l=i,h=n.test(t),A=l.test(t);if(h)return this.receiptIcon="fa-solid fa-envelope","Email";if(A)return this.receiptIcon="fa-brands fa-whatsapp","Mobile"}changeReceiptContact(){this.receiptIcon=="fa-solid fa-envelope"?(this.receiptIcon="fa-brands fa-whatsapp",this.customerContact.setValue(this.completeData?.Contact?.Mobile)):(this.receiptIcon="fa-solid fa-envelope",this.customerContact.setValue(this.completeData?.Contact?.Email))}checkOrderDateIsNow(){let t=this.completeData.OrderTimeString,e=this.datePipe.transform(this.salesOrder.Order.Date,"dd MMM yyyy");this.isOrderDateNow=t.includes(e)}checkFinalAmountDifferent(){if(this.currentSellState==1){let t=this.posStorage.AppConfigJSON,e=this.completeData.Final,i=this._calculatorService.Data,n=t.ModuleSell.ToleranceAmount,l=e-i;if(l!=n&&l!=0){this.finalAmountDifferent=!0;let h=this.decimalPipe.transform(e);setTimeout(()=>{this._toastr.warning(`Final Amount should be ${h}! Use Print Receipt to print the correct Receipt!`,"Invalid Amount charged",{timeOut:1e4})},500)}else this.finalAmountDifferent=!1}}checkOrderNumber(){this.completeData.InvoiceNumber!=this.salesOrder.Order.Number&&(this._toastr.warning("Your transaction number is changed to "+this.completeData.InvoiceNumber,"Transaction Number Changed!"),this.salesOrder.Order.Number=this.completeData.InvoiceNumber)}generateLink(){this.posStorage.AppConfigJSON.PaymentConfigLink==!0&&this._matDialog.open(vi);let t={InvoiceID:this.completeData.ObjectID};this._PaymentHttpService.generateLink(t).subscribe({next:e=>{this._matDialog.open(vi,{data:{link:e.token.redirect_url}})},error:e=>{this._toastr.error(e.Message,"Couldn't generate link!")}})}newSale(){try{this._orderProcessorService.createNewTransactionInSameOutletRegister(),this._signalBroadCast.BroadcastStateToCustomerDisplay(0).subscribe(),this.paymentGatewayService.resetPaymentMethod(),this._router.navigate([],{queryParams:{ID:null}})}catch(t){console.error(t),this._toastr.error(t,"Error redirecting to NEW mode")}}onRetry(){this._onlineStatusService.isOnline?this._posDataService.uploadOfflineOrder().subscribe(e=>{e.Success?(this.isSuccessRetrySubmit.set(!0),this.broadcastToCustomerDisplay(e),this._orderProcessorService.updatePosState(1,e)):this._orderProcessorService.updatePosState(1,e)}):this._toastr.error("Please check your internet connection and try again.","Connection Required")}broadcastToCustomerDisplay(t){let i=this._posDataService.Data.TotalPaidAmount-this._calculatorService.Data;this._signalBroadCast.BroadcastStateToCustomerDisplay(1,t.ObjectID,t.LoyaltyPoint,i).subscribe()}getInvoicePrintURL(t){let e="/print/Invoice"+(this.outletRegister.PrintTemplate.PrintMode===2?"Mini":""),i="";return t&&(i="&Print=1&Price=0"),S.StringFormat("{0}?ID={1}&Template={2}{3}",e,this.completeData.ObjectID,this.outletRegister?.PrintTemplate?.ID?.toString(),i)}sendEmail(){if(!this.role.Email){this._toastr.info("You do not have required Role",Le.Info);return}this._OrderHttpService.sendEmail(this.customerContact.value,this.completeData.ObjectID).then(t=>{this._toastr.success(t.Message,"Email sent!")})}sendReceiptByWhatsaap(){let t=this.customerContact.value;this.whatsappSendReceiptService.createCustomerFromNewNumberAndSendReceipt(t,this._calculatorService.currencySymbol,this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.WhatsappReceipt,{Final:this.completeData.Final,InvoiceNumber:this.completeData.InvoiceNumber,ObjectID:this.completeData.ObjectID},this._posService.Data?.WhatsAppConfigJSON?.TextReceipt)}print(){this.printMode==2?(this.printReceiptMini(),this.printOnPayment()&&this.printWindow()):this.printMode==1&&this.printReceiptA4()}printReceiptMini(){this.receiptTemplate=this._receiptService.generateReceiptMini()}setLoyaltyLabelConfig(){let t=this.posStorage?.AppConfigJSON;t.LoyaltyLabel=t.ApplicationLoyalty.Label,this.posStorage.AppConfigJSON=t}printReceiptA4(){this.receiptTemplateA4$==null?this.receiptTemplateA4$=this._OrderHttpService.generateReceiptA4(this.completeData.ObjectID).pipe(k(this.destroy$),et(t=>(t.Data.AfterSell=!0,t.Data)),ai(t=>{throw this._toastr.error(`Could not print in A4 format!
|
|
5
|
+
Printing in 8mm format instead!`,"Error!"),this.printReceiptMini(),t}),Ne(()=>{this.printOnPayment()&&this.printWindow()}),Rt(1)):this.printWindow()}printWindow(){let t=document.title;document.title=this.getCustomPrintFileName(),setTimeout(()=>{window.print(),document.title=t},500)}getCustomPrintFileName(){return`Invoice_${this.completeData?.InvoiceNumber}`}isNotEmpty(t){return S.IsNotEmpty(t)}verifyPaymentSettlement(){let t=this._calculatorService.Data,e=this.paymentGatewayService.paymentMethod,i=this.paymentGatewayService.generatePaymentVerificationData(t,e.EMoneyTypeID);this.paymentHttpService.VerifyPayment(i,e.EMoneyTypeID).pipe(k(this.destroy$)).subscribe({next:n=>{this._toastr.success(n.Message,"QR Settlement")}})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}sendReceiptToContact(){let t=S.emailRegex,e=S.phoneNumberRegex,i=this.customerContact.value,n=t.test(i),l=e.test(i);n?this.sendEmail():l&&this.sendReceiptByWhatsaap()}static \u0275fac=function(e){return new(e||o)(m(N),m(L),m(W),m(Pe),m(ao),m(Ot),m(Y),m(ee),m(qe),m(re),m(Wi),m(Me),m(de),m(Ct),m(Ui),m(We),m(Z),m(Qi),m(ao),m(De))};static \u0275cmp=w({type:o,selectors:[["sell-complete"]],hostBindings:function(e,i){e&1&&g("keydown.F8",function(l){return i.handleF8(l)},!1,it)},features:[at([lo])],decls:31,vars:14,consts:[["OFFLINE",""],["PRICE_HIDE",""],[1,"sell-complete"],[1,"container-fluid","pt-8"],[1,"row","pb-8","border-bottom"],[1,"col-auto","pe-0","order-0","ps-7"],[1,"me-5","float-start","fw-normal"],[1,"row","mt-8","px-6"],[1,"col-md-8"],[1,"card"],[1,"col-md-4"],[1,"card-header","bg-light-gray"],[1,"text-dark"],[4,"ngIf","ngIfElse"],[1,"card-body"],["class","card-footer bg-white",4,"ngIf"],[1,"card-footer","bg-gradient-warning"],[1,"card-footer","py-8","d-flex","justify-content-center"],[1,"btn-group","d-flex","justify-content-center",2,"width","26rem"],["matTooltipPosition","above",1,"w-100",3,"matTooltip"],["role","button",1,"btn","btn-outline-secondary","w-100",3,"click","ngClass","disabled"],[1,"fa-solid","fa-print","me-2"],["target","_blank","matTooltipPosition","above","matTooltip","Print in New Tab",1,"btn","btn-outline-secondary","d-flex","align-items-center","justify-content-center","fs-5","border-start-0",2,"width","3rem",3,"href"],["class","card",4,"ngIf"],[1,"print_containers"],[1,"print-error-message"],[1,"card-header",3,"ngClass"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-check","me-1"],[1,"fst-italic"],[1,"dropdown"],[1,"container",3,"ngClass"],[1,"row"],[1,"d-flex","align-items-center","g-0","mt-5","w-100"],[1,"text-danger"],[1,"row","mt-12","justify-content-center","g-0","mb-9"],[1,"col-12","text-center"],[1,"d-flex","justify-content-between","w-100"],["type","button","matTooltip","Upload your local / offline order to the cloud","matTooltipPosition","above",1,"btn","btn-success","btn-lg","w-100","text-white","me-2"],["type","button",1,"btn","btn-success","btn-lg","w-100",3,"click","ngClass"],[1,"card-footer","bg-light-gray"],["type","button","id","dropdownMenuButton","data-bs-toggle","dropdown","aria-haspopup","true","aria-expanded","false",1,"btn","dropdown-toggle"],["aria-labelledby","dropdownMenuButton",1,"dropdown-menu","dropdown-menu-end"],["class","dropdown-item","routerLink","/print/OutDelivery","target","_blank",3,"queryParams",4,"ngIf"],["class","dropdown-item","routerLink","/print/InvoiceNOutD","target","_blank",3,"queryParams",4,"ngIf"],["class","dropdown-item","target","_blank",3,"href",4,"ngIf"],["class","dropdown-item","routerLink","/print/PackingSlip","target","_blank",3,"queryParams",4,"ngIf"],["routerLink","/print/OutDelivery","target","_blank",1,"dropdown-item",3,"queryParams"],["routerLink","/print/InvoiceNOutD","target","_blank",1,"dropdown-item",3,"queryParams"],["target","_blank",1,"dropdown-item",3,"href"],["routerLink","/print/PackingSlip","target","_blank",1,"dropdown-item",3,"queryParams"],[1,"text-danger","fs-5"],[1,"d-flex","align-items-center","border-bottom","me-2",2,"width","65%"],[1,"px-2","cursor","hover-color",3,"click"],["type","text","placeholder","Email / Whatsapp","id","customerContact","required","","pOSIsInvalidEmailOrPhoneNumber","",1,"form-control","border-0","fs-4",3,"ngModelChange","formControl"],[1,"pb-2",2,"width","35%"],["type","button",1,"btn","btn-light-gray","border","w-100",3,"click","disabled"],["type","button","matTooltip","Upload your local / offline order to the cloud","matTooltipPosition","above",1,"btn","btn-success","btn-lg","w-100","text-white","me-2",3,"click"],[1,"row","justify-content-between"],["class","col-auto my-6",4,"ngIf"],[1,"col-auto","my-6"],["type","button","data-cy","payment-link",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-money-bill-wave","me-2"],["type","button","data-cy","verify-payment-settelment",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-circle-check","me-2"],[3,"newSale"],["target","_blank","routerLink","/menu/Orders/Orders/Customer_Invoice/Info",1,"text-dark","fst-italic",3,"queryParams"],[1,"text-dark","fst-italic"],["class","row my-1",4,"ngFor","ngForOf"],[1,"row","my-1"],[1,"col-8"],[1,"col-4","text-end"],[1,"card-footer","bg-white"],["class","d-flex justify-content-end","style","line-height: 30px",4,"ngFor","ngForOf"],[4,"ngIf"],[1,"d-flex","justify-content-end",2,"line-height","30px"],[1,"text-end",3,"hidden"],[1,"text-end","w-50",3,"hidden","ngClass"],[1,"border-top"],[1,"text-end","w-50",3,"hidden"],[1,"text-end"],[1,"fw-bold"],[1,"text-danger",2,"font-size","38px"],[1,"fa-regular","fa-arrow-up-right-from-square"],[1,"card-body","pb-0","text-center",3,"innerHtml"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo","isUnknownError","isOffline","stylesheet","saveLastPrintDate"],[3,"data","printTemplate","config","workOrderMode","stylesheet","saveLastPrintDate"]],template:function(e,i){if(e&1){let n=v();r(0,"section",2)(1,"div",3)(2,"div",4)(3,"div",5)(4,"h1",6),d(5,"Order Complete"),a()()(),r(6,"div",7)(7,"div",8),_(8,Ql,22,16,"div",9)(9,ql,1,0,"app-retry"),a(),r(10,"div",10)(11,"div",9)(12,"div",11)(13,"h3",12),_(14,$l,3,4,"ng-container",13)(15,Jl,2,1,"ng-template",null,0,J),a()(),_(17,Yl,2,1,"div",14)(18,ts,3,2,"div",15)(19,is,7,3,"div",16),r(20,"div",17)(21,"div",18)(22,"div",19)(23,"button",20),g("click",function(){return u(n),f(i.print())}),C(24,"i",21),d(25,"Print Receipt "),a()(),_(26,ns,2,1,"a",22),a()()(),_(27,os,5,1,"div",23),a()()()(),r(28,"div",24),_(29,ss,2,2)(30,cs,3,0,"div",25),a()}if(e&2){let n=Q(16);s(8),E(i.currentSellState==i.sellState.IsComplete?8:9),s(6),p("ngIf",i.isOnline&&i.completeData.ObjectID)("ngIfElse",n),s(3),E(i.itemSummary?17:-1),s(),p("ngIf",!i.finalAmountDifferent&&i.role.PriceVisible),s(),E(i.finalAmountDifferent?19:-1),s(3),p("matTooltip",i.printOnPayment()?"Print in Current Window":"You must enable print on payment config to use this button"),s(),p("ngClass",R(12,Il,i.completeData.PaymentStateLabel!="Offline"))("disabled",i.printOnPayment()==!1),s(3),E(i.completeData.PaymentStateLabel!="Offline"?26:-1),s(),p("ngIf",i.completeData==null?null:i.completeData.LoyaltyPoint),s(2),E(i.finalAmountDifferent==!1?29:30)}},dependencies:[X,q,be,z,Ve,Z,fe,te,K,Bt,yt,en,pa,Gi,Ji,Vt,Nt,bn,ze,bt,Ke,ce,ha],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.print_containers[_ngcontent-%COMP%]{display:none}@media print{.print_containers[_ngcontent-%COMP%]{display:block;text-align:left}.sell-complete[_ngcontent-%COMP%]{display:none}}.sell-complete[_ngcontent-%COMP%] .card .card-header{border-bottom:1px solid rgba(0,0,0,.125);padding-bottom:.9375rem}.sell-complete[_ngcontent-%COMP%] .card .card-header h2{font-size:2rem}.sell-complete[_ngcontent-%COMP%] .card .card-body .container{max-width:390px;margin-top:30px;margin-bottom:30px}.sell-complete[_ngcontent-%COMP%] .card .card-body .container.offline{margin-top:12px}.sell-complete[_ngcontent-%COMP%] .card .card-body mat-form-field input.form-control{border:none;font-size:16px;padding-left:2px}.sell-complete[_ngcontent-%COMP%] .card .card-body mat-form-field input.form-control:focus{border:none}.sell-complete[_ngcontent-%COMP%] .card .card-body [type=button]{-webkit-appearance:initial}.sell-complete[_ngcontent-%COMP%] .card .card-body input{font-size:1rem}.sell-complete[_ngcontent-%COMP%] .card .card-body .btn-success{padding:.5rem 1rem;font-size:1.25rem}.sell-complete[_ngcontent-%COMP%] .amount[_ngcontent-%COMP%]{font-size:16px}.hover-color[_ngcontent-%COMP%]:hover{color:#d1d1d1}.print-error-message[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;min-height:100vh;text-align:center}.print-error-message[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{color:#dc3545;font-weight:500}"]})};var Sn=class o{constructor(t,e){this._dialogRef=t;this._orderProcessorService=e;this.modalConfig.title="Clear Order?",this.modalConfig.headerType=Le.Success}modalConfig=new H;ngOnInit(){}onOk(){this._orderProcessorService.createNewTransactionInSameOutletRegister(!1),this._orderProcessorService.emitClearOrder(),this.close()}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||o)(m(j),m(W))};static \u0275cmp=w({type:o,selectors:[["POS-modal-clear"]],standalone:!1,decls:4,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"fw-normal"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"h4",1),d(3),a()()()),e&2&&(p("config",i.modalConfig),s(3),T("This will replace current order's item(s) with blank order."))},dependencies:[U],encapsulation:2})};var uo=(i=>(i[i.INTERNAL=1]="INTERNAL",i[i.EKSTERNAL=2]="EKSTERNAL",i[i.EKSTERNALINTERNAL=3]="EKSTERNALINTERNAL",i))(uo||{});function ds(o,t){if(o&1){let e=v();r(0,"div",1)(1,"radio-options",12),D("modelChange",function(n){u(e);let l=c();return M(l.selectedProvider,n)||(l.selectedProvider=n),f(n)}),a(),r(2,"label",13),d(3,"Choose Provider"),a()()}if(o&2){let e=c();s(),p("options",e.couponProviders()),P("model",e.selectedProvider),p("disabled",e.hasSelectedCoupon)}}function ms(o,t){if(o&1){let e=v();r(0,"button",14),g("click",function(){u(e);let n=c();return f(n.onRemoveCoupon())}),d(1," Remove "),a()}}function us(o,t){if(o&1){let e=v();r(0,"button",15),g("click",function(n){u(e);let l=c();return f(l.onOk(n))})("keyup.F2",function(n){u(e);let l=c();return f(l.onOk(n))}),d(1," Ok (F2) "),a()}}var yn=class o{constructor(t,e,i,n,l,h,A){this.promotionService=t;this._orderDataService=e;this._posService=i;this.dialogRef=n;this.roleService=l;this.toastr=h;this.promotionCouponProvider=A;this.destroy$=new G,this.modeType=!1,this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash",this.couponInputLock=l.Data.CouponInputLock,this.initProviders(),this.subscribeToObservable(),this.initModalConfig(),this.initSelectedProvider()}modalConfig=new H;modeType;typeText;typeIcon;PromotionCoupon;PromotionNote;couponType;destroy$;onInputCouponCode=!1;selectedProvider="Internal";couponInputLock=!1;startInput;couponredemptionType=uo;couponProviders=V([]);initModalConfig(){this.modalConfig.title="Redeem Coupon",this.modalConfig.customWidth="400px",this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}subscribeToObservable(){this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.PromotionCoupon=t.Order.PromotionCoupon,this.PromotionNote=t.Order.PromotionNote})}initProviders(){this.couponProviders.update(t=>{let e=this._posService.Data.AppConfigJSON.ProviderOption,i=e.map(n=>({Key:n,Value:n}));return e?.length>0?[{Key:"Internal",Value:"DealPOS"},...i]:[]})}initSelectedProvider(){let t=this.promotionCouponProvider.coupon,e=this.promotionCouponProvider.couponProvider;S.IsNotEmpty(t)?this.selectedProvider=e:this.selectedProvider="Internal"}get hasSelectedCoupon(){let t=this._orderDataService.Data.Order;return S.IsNotEmpty(t.PromotionCoupon)}onOk(t){(t!="Enter"||t=="Enter"&&this.onInputCouponCode)&&this.onSubmitCoupon()}onSubmitCoupon(){S.IsNotEmpty(this.PromotionCoupon)?(this.applyCouponCode(),this.dialogRef.close()):this.toastr.warning("Coupon can't be empty","Warning")}onRemoveCoupon(){let t=this.promotionCouponProvider.coupon;S.IsNotEmpty(t)?this.promotionCouponProvider.removeCoupon():this.promotionService.removeAppliedCoupon(),this.dialogRef.close()}applyCouponCode(){if(this.selectedProvider==="Internal")this.promotionService.RedeemCoupon(this.PromotionCoupon,this.PromotionNote);else{let t=`(${this.selectedProvider}) ${this.PromotionNote?this.PromotionNote:""}`;this.promotionCouponProvider.redeemCoupon(this.PromotionCoupon,this.selectedProvider,t)}}onClose(){this.dialogRef.close()}showPassword(){this.modeType?(this.typeText="text",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye"):(this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash")}onKeyDown(t){let e=t.target.value;this.couponInputLock&&(t.key=="Enter"?this.PromotionCoupon=e:this.validateInputLock())}validateInputLock(){if(typeof this.PromotionCoupon=="string")if(this.PromotionCoupon==""||this.PromotionCoupon.length==0)this.startInput=new Date;else{let t=new Date;this.startInput=this.startInput?this.startInput:new Date,t.getTime()-this.startInput.getTime()>500&&(this.PromotionCoupon=null)}else this.startInput=new Date}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||o)(m(Xe),m(N),m(L),m(j),m(de),m(ee),m(xt))};static \u0275cmp=w({type:o,selectors:[["pos-modal-coupon-code"]],standalone:!1,decls:17,vars:11,consts:[[3,"onClose","config"],[1,"form-floating-outline","radio","border","rounded","pt-7",2,"height","auto !important"],[1,"form-floating-outline","mb-0"],["data-cy","CouponInput","id","cpn","name","PromotionCoupon","autocomplete","new-password","placeholder","Coupon",1,"form-control",3,"ngModelChange","paste","keydown","focus","blur","type","ngModel","disabled"],[3,"click"],["for","cpn"],[1,"form-floating-outline"],["name","note","id","note","data-cy","CouponNote","name","PromotionNote","placeholder","Note","rows","5",1,"form-control",3,"ngModelChange","ngModel","disabled"],["for","note"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3","p-8",3,"click"],[1,"btn","btn-light-danger","text-danger","btn-lg","fw-bold","mx-3","p-8","me-6"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3","p-8","me-6"],["id","providerOptions",3,"modelChange","options","model","disabled"],["for","providerOptions"],[1,"btn","btn-light-danger","text-danger","btn-lg","fw-bold","mx-3","p-8","me-6",3,"click"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3","p-8","me-6",3,"click","keyup.F2"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onClose",function(){return i.dialogRef.close()}),r(1,"content"),_(2,ds,4,3,"div",1),r(3,"div",2)(4,"input",3),D("ngModelChange",function(l){return M(i.PromotionCoupon,l)||(i.PromotionCoupon=l),l}),g("paste",function(l){return i.couponInputLock?l.preventDefault():""})("keydown",function(l){return i.onKeyDown(l)})("focus",function(){return i.onInputCouponCode=!0})("blur",function(){return i.onInputCouponCode=!1}),a(),r(5,"i",4),g("click",function(){return i.modeType=!i.modeType,i.showPassword()}),a(),r(6,"label",5),d(7,"Coupon"),a()(),r(8,"div",6)(9,"textarea",7),D("ngModelChange",function(l){return M(i.PromotionNote,l)||(i.PromotionNote=l),l}),a(),r(10,"label",8),d(11,"Note"),a()()(),r(12,"footer")(13,"button",9),g("click",function(){return i.onClose()}),d(14," Cancel "),a(),_(15,ms,2,0,"button",10)(16,us,2,0,"button",11),a()()),e&2&&(p("config",i.modalConfig),s(2),E(i.couponProviders().length>0?2:-1),s(2),p("type",i.typeText),P("ngModel",i.PromotionCoupon),p("disabled",i.hasSelectedCoupon),s(),he(i.typeIcon),s(4),P("ngModel",i.PromotionNote),p("disabled",i.hasSelectedCoupon),s(6),E(i.hasSelectedCoupon?15:16))},dependencies:[te,K,oe,U,Ti],styles:[".passwordIcon[_ngcontent-%COMP%]{position:relative;margin:0 auto!important;cursor:pointer;left:20.5rem;top:-2.3rem;z-index:999}"]})};var xn=class o{constructor(t,e,i,n){this.dialogRef=t;this._orderDataService=e;this._orderProcessorService=i;this._OrderHttpService=n;this.modalConfig.title="Return",this.modalConfig.customWidth="284px",this.destroy$=new G}modalConfig=new H;ReturNumber;destroy$;ngOnInit(){this.initInvoiceRetur()}initInvoiceRetur(){this.ReturNumber=null,this._orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{t.posState===7&&(this.ReturNumber=t.ReturNumber)})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}onOk(){let t=this._orderDataService.Data.Order.EntityID;this._OrderHttpService.GetReturnInvoice(this.ReturNumber,t).pipe(k(this.destroy$)).subscribe(e=>{let i=this._orderProcessorService.Data;i.ReturNumber=this.ReturNumber,this._orderProcessorService.ReturnOrder(e),this._orderProcessorService.updatePosState(7),this.dialogRef.close()})}static \u0275fac=function(e){return new(e||o)(m(j),m(N),m(W),m(Pe))};static \u0275cmp=w({type:o,selectors:[["pos-modal-return"]],standalone:!1,decls:6,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"form-floating-outline"],["type","text","data-cy","ReturnNumber","id","ReturNumber","name","ReturNumber",1,"form-control",3,"ngModelChange","ngModel"],["for","ReturNumber"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onOk",function(){return i.onOk()})("onCancel",function(){return i.dialogRef.close()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"input",2),D("ngModelChange",function(l){return M(i.ReturNumber,l)||(i.ReturNumber=l),l}),a(),r(4,"label",3),d(5,"Number Invoice"),a()()()()),e&2&&(p("config",i.modalConfig),s(3),P("ngModel",i.ReturNumber))},dependencies:[te,K,oe,U],encapsulation:2})};var fs=["serialInput"],In=class o{constructor(t,e,i){this.dialogRef=t;this.shoppingCartService=e;this.toastr=i;this.modalConfig.title="Scan Serial",this.modalConfig.customWidth="350px",this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}serialInputEl;modalConfig=new H;serial;onKeyDown(t){t.key=="Enter"&&(S.IsNotEmpty(this.serial)?(this.shoppingCartService.addItemBySerial(this.serial),this.serial=null):this.toastr.warning("Serial Can`t be empty","Warning!"),this.setFocusInput())}setFocusInput(){this.serialInputEl&&setTimeout(()=>{this.serialInputEl?.nativeElement?.focus()},500)}static \u0275fac=function(e){return new(e||o)(m(j),m(De),m(ee))};static \u0275cmp=w({type:o,selectors:[["POS-modal-serial"]],viewQuery:function(e,i){if(e&1&&Se(fs,5),e&2){let n;ye(n=xe())&&(i.serialInputEl=n.first)}},standalone:!1,decls:7,vars:2,consts:[["serialInput",""],[3,"onClose","config"],[1,"input-group","mt-3"],["type","text","placeholder","Input Product By Serial","aria-label","Serial",1,"form-control",3,"ngModelChange","keydown","ngModel"],[1,"input-group-text"],[1,"fa-solid","fa-barcode","fs-4"]],template:function(e,i){if(e&1){let n=v();r(0,"modal-material",1),g("onClose",function(){return u(n),f(i.dialogRef.close())}),r(1,"content")(2,"div",2)(3,"input",3,0),D("ngModelChange",function(h){return u(n),M(i.serial,h)||(i.serial=h),f(h)}),g("keydown",function(h){return u(n),f(i.onKeyDown(h))}),a(),r(5,"span",4),C(6,"i",5),a()()()()}e&2&&(p("config",i.modalConfig),s(3),P("ngModel",i.serial))},dependencies:[te,K,oe,U],styles:["input[_ngcontent-%COMP%]{height:55px;border-bottom-left-radius:4px;border-top-left-radius:4px}span.input-group-text[_ngcontent-%COMP%]{border-bottom-right-radius:4px;border-top-right-radius:4px}"]})};function gs(o,t){if(o&1&&(r(0,"tr")(1,"td"),d(2),a(),r(3,"td"),d(4),b(5,"date"),a(),r(6,"td"),d(7),b(8,"date"),a(),r(9,"td",5),d(10),a(),r(11,"td",5),d(12),b(13,"number"),a()()),o&2){let e=t.$implicit;s(2),T(e.Order.Number),s(2),T(ne(5,5,e.Order.ClientTimestamp,"dd MMM yyyy")),s(3),T(ne(8,8,e.Order.ClientTimestamp,"HH:mm")),s(3),T(e.Items.length),s(2),T(x(13,11,e.TotalPaidAmount))}}function _s(o,t){if(o&1&&(I(0),r(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr")(5,"th"),d(6,"Number"),a(),r(7,"th"),d(8,"Date"),a(),r(9,"th"),d(10,"Time"),a(),r(11,"th",5),d(12,"Qty"),a(),r(13,"th",5),d(14,"Total"),a()()(),r(15,"tbody"),_(16,gs,14,13,"tr",6),a()()(),O()),o&2){let e=c();s(16),p("ngForOf",e.offlineOrders)}}function Cs(o,t){o&1&&(r(0,"h1",7),d(1,"There is no offline orders!"),a())}var On=class o{constructor(t){this._localDataService=t;this.destroy$=new G}offlineOrders=[];destroy$;ngOnInit(){this.getOfflineOrders()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}getOfflineOrders(){this._localDataService.findAllOrders().pipe(k(this.destroy$)).subscribe(t=>{this.offlineOrders=t.map(e=>nt(ct,e))})}static \u0275fac=function(e){return new(e||o)(m(Ye))};static \u0275cmp=w({type:o,selectors:[["sync-orders"]],standalone:!1,decls:3,vars:2,consts:[["noOrders",""],[4,"ngIf","ngIfElse"],[1,"table-responsive","p-8"],[1,"table"],[1,"thead-light"],[1,"text-end"],[4,"ngFor","ngForOf"],[1,"text-center","p-8"]],template:function(e,i){if(e&1&&_(0,_s,17,1,"ng-container",1)(1,Cs,2,0,"ng-template",null,0,J),e&2){let n=Q(2);p("ngIf",i.offlineOrders!=null&&i.offlineOrders.length>0)("ngIfElse",n)}},dependencies:[be,z,Z,We],encapsulation:2})};var bs=o=>({"bg-gradient-danger":o});function vs(o,t){if(o&1&&(I(0),d(1),b(2,"number"),O()),o&2){let e=c();s(),y(" ",x(2,1,e.onlineProducts)," ")}}function Ss(o,t){o&1&&(r(0,"small",13),d(1," Failed to get Online Products "),a())}function ys(o,t){if(o&1&&(I(0),d(1),b(2,"date"),O()),o&2){let e=c();s(),y(" ",ne(2,1,e.syncDate,"dd MMM yyyy HH:mm")," ")}}function xs(o,t){o&1&&d(0," Never been synced ")}function Is(o,t){if(o&1&&(r(0,"p"),d(1),a()),o&2){let e=c();s(),y("You last synced ",e.dayDiff," days ago!")}}var Pn=class o{constructor(t,e,i,n){this.indexDbService=t;this.toastr=e;this.httpService=i;this.dialogRef=n;this.destroy$=new G}dayDiff;syncDate;offlineProduct=0;onlineProducts=0;destroy$;ngOnInit(){this.initOfflineProducts()}initOfflineProducts(){this.indexDbService.findAllVariant().pipe(se(t=>t.length>0),Re(t=>{let e=Array.from(new Set(t.map(i=>i.ProductID))).map(i=>t.find(n=>n.ProductID===i));return this.offlineProduct=e.length,this.httpService.POSText("/api/catalog/product/ProductRowsCount",'{"ProductDiscontinued":false,"VariantDiscontinued":false,"CategoryDiscontinued":false,"From":"0001-01-01T00:00:00","To":"0001-01-01T00:00:00"}')}),et(t=>JSON.parse(t))).subscribe({next:t=>{this.onlineProducts=t.Count,this.getSyncTime()},error:t=>{console.error(t)}})}syncToLocalDatabase(){xi([this.syncOutlets(),this.syncProducts(),this.syncOutletPrices()]).pipe(k(this.destroy$),Re(()=>this.indexDbService.updateSyncTime())).subscribe({next:()=>{this.initOfflineProducts(),this.toastr.success("Sync Product Offline Successfully","Success!"),this.dialogRef.close()},error:t=>{console.error(t)}})}getSyncTime(){this.indexDbService.getSyncTime().pipe(k(this.destroy$),se(t=>t!=null)).subscribe({next:t=>{this.syncDate=new Date(t.time),this.calculateSyncDiff()},error:t=>{console.error(t)}})}calculateSyncDiff(){this.syncDate?this.dayDiff=Math.floor((new Date().getTime()-this.syncDate.getTime())/1e3/60/60/24):this.dayDiff=0}syncOutlets(){return this.httpService.get(_e.SynOutlet).pipe(k(this.destroy$),Re(t=>this.indexDbService.syncRegisters(t)))}syncProducts(){return this.httpService.get(_e.SyncProducts).pipe(k(this.destroy$),Re(t=>this.indexDbService.syncVariants(t)))}syncOutletPrices(){return this.httpService.get(_e.SynOutletPrice).pipe(k(this.destroy$),Re(t=>this.indexDbService.syncOutletPrice(t)))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||o)(m(Ye),m(ee),m(Qe),m(j))};static \u0275cmp=w({type:o,selectors:[["sync-products"]],standalone:!1,decls:30,vars:11,consts:[["EMPTY_PRODUCTS",""],["neverSync",""],[1,"table-responsive","p-8"],[1,"table","table-bordered","table-sm","fs-5"],[1,"fw-bold",2,"width","125px"],[2,"width","175px",3,"ngClass"],[4,"ngIf","ngIfElse"],["rowspan","3"],[1,"d-flex","align-items-center","justify-content-center"],[1,"btn","btn-success","fs-4",3,"click"],[1,"fa-solid","fa-sync-alt","me-2","pe-2"],[1,"fw-bold"],[4,"ngIf"],[1,"fst-italic"]],template:function(e,i){if(e&1){let n=v();r(0,"div",2)(1,"table",3)(2,"tbody")(3,"tr")(4,"td",4),d(5,"Online Products"),a(),r(6,"td",5),_(7,vs,3,3,"ng-container",6)(8,Ss,2,0,"ng-template",null,0,J),a(),r(10,"td",7)(11,"div",8)(12,"button",9),g("click",function(){return u(n),f(i.syncToLocalDatabase())}),C(13,"i",10),r(14,"span"),d(15,"Sync"),a()()()()(),r(16,"tr")(17,"td",11),d(18,"Offline Products"),a(),r(19,"td"),d(20),b(21,"number"),a()(),r(22,"tr")(23,"td",11),d(24,"Last Sync"),a(),r(25,"td"),_(26,ys,3,4,"ng-container",6)(27,xs,1,0,"ng-template",null,1,J)(29,Is,2,1,"p",12),a()()()()()}if(e&2){let n=Q(9),l=Q(28);s(6),p("ngClass",R(9,bs,!i.onlineProducts)),s(),p("ngIf",i.onlineProducts)("ngIfElse",n),s(13),y(" ",x(21,7,i.offlineProduct)," "),s(6),p("ngIf",i.syncDate)("ngIfElse",l),s(3),p("ngIf",i.dayDiff>14)}},dependencies:[q,z,Z,We],encapsulation:2})};var Ps=["navTabs"],Mn=class o{constructor(t,e){this._router=t;this.dialogRef=e}tabs;modalConfig=new H;ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig.headerType=Le.Success,this.modalConfig.title="Add all offline products",this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="550px",this.modalConfig.noPadding=!0}goToOfflinePage(){this.tabs.selectedIndex==0?this._router.navigate(["/menu","Sell","Offline","Products"]):this.tabs.selectedIndex==1&&this._router.navigate(["/menu","Sell","Offline","Orders"]),this.close()}close(){this.dialogRef.close()}onChangeTab(t){t.index==0?this.modalConfig.title="Add all offline product":this.modalConfig.title="Add all offline order"}static \u0275fac=function(e){return new(e||o)(m(Ct),m(j))};static \u0275cmp=w({type:o,selectors:[["pos-modal-sync"]],viewQuery:function(e,i){if(e&1&&Se(Ps,5),e&2){let n;ye(n=xe())&&(i.tabs=n.first)}},standalone:!1,decls:12,vars:2,consts:[["navTabs",""],[3,"onOk","onCancel","onClose","config"],["mat-align-tabs","start",1,"sync",3,"selectedTabChange","dynamicHeight"],["label","Products"],["label","Orders"],[1,"d-flex","justify-content-center","mb-8"],[1,"btn","btn-primary","btn-lg",3,"click"],[1,"fa-solid","fa-paper-plane"]],template:function(e,i){if(e&1){let n=v();r(0,"modal-material",1),g("onOk",function(){return u(n),f(i.close())})("onCancel",function(){return u(n),f(i.close())})("onClose",function(){return u(n),f(i.close())}),r(1,"content")(2,"mat-tab-group",2,0),g("selectedTabChange",function(h){return u(n),f(i.onChangeTab(h))}),r(4,"mat-tab",3),C(5,"sync-products"),a(),r(6,"mat-tab",4),C(7,"sync-orders"),a()(),r(8,"div",5)(9,"button",6),g("click",function(){return u(n),f(i.goToOfflinePage())}),C(10,"i",7),d(11," Go to Details "),a()()()()}e&2&&(p("config",i.modalConfig),s(2),p("dynamicHeight",!1))},dependencies:[U,vt,St,On,Pn],styles:[".mat-ink-bar{background-color:#93bd45!important} .sync mat-mdc-tab-body{height:200px} .mat-mdc-tab-body-content{overflow-x:hidden!important}"]})};var Ds=(o,t)=>({"btn-secondary":o,"btn-outline-secondary":t}),ws=(o,t)=>({"btn-outline-secondary":o,"btn-secondary":t});function ks(o,t){if(o&1){let e=v();r(0,"div")(1,"label",12),C(2,"i",13),r(3,"span"),d(4,"Deduct Inventory from Outlet :"),a()(),r(5,"p-select",14),D("ngModelChange",function(n){u(e);let l=c();return M(l.deliveryEntityID,n)||(l.deliveryEntityID=n),f(n)}),a()()}if(o&2){let e=c();s(5),p("options",e.entities),P("ngModel",e.deliveryEntityID),p("filter",!0)("showClear",!0)("showClear",!1)("disabled",e.isDisabledNgSelectOutlet)}}function Ts(o,t){if(o&1){let e=v();r(0,"div",10)(1,"div",29)(2,"label",30),C(3,"i",31),r(4,"span"),d(5,"Recipient"),a()(),r(6,"input",32),D("ngModelChange",function(n){u(e);let l=c(2);return M(l.shipping.Name,n)||(l.shipping.Name=n),f(n)}),a()(),r(7,"div",29)(8,"label",33),C(9,"i",34),r(10,"span"),d(11,"Phone"),a()(),r(12,"input",35),D("ngModelChange",function(n){u(e);let l=c(2);return M(l.shipping.Phone,n)||(l.shipping.Phone=n),f(n)}),a()(),r(13,"div",36)(14,"label",37),C(15,"i",38),r(16,"span"),d(17,"City"),a()(),r(18,"input",39),D("ngModelChange",function(n){u(e);let l=c(2);return M(l.shipping.City,n)||(l.shipping.City=n),f(n)}),a()(),r(19,"div",40)(20,"label",41),C(21,"i",42),r(22,"span"),d(23,"Delivery Address"),a()(),r(24,"POS-tinymce-editor",43),D("ngModelChange",function(n){u(e);let l=c(2);return M(l.shipping.Address,n)||(l.shipping.Address=n),f(n)}),a()()()}if(o&2){let e=c(2);s(6),P("ngModel",e.shipping.Name),s(6),P("ngModel",e.shipping.Phone),s(6),P("ngModel",e.shipping.City),s(6),P("ngModel",e.shipping.Address)}}function Es(o,t){if(o&1){let e=v();r(0,"div",15)(1,"div",16)(2,"label",12),C(3,"i",17),r(4,"span"),d(5),a()(),r(6,"div",16)(7,"p-datepicker",18),D("ngModelChange",function(n){u(e);let l=c();return M(l.posData.Invoice.DateCustom,n)||(l.posData.Invoice.DateCustom=n),f(n)}),a()()(),r(8,"div",16)(9,"label",19),C(10,"i",20),r(11,"span"),d(12,"Time"),a()(),r(13,"div",16)(14,"app-timepicker",21),D("timeChange",function(n){u(e);let l=c();return M(l.posData.Invoice.TimeCustom,n)||(l.posData.Invoice.TimeCustom=n),f(n)}),a()()()(),r(15,"div",22)(16,"div",23)(17,"div")(18,"p-checkbox",24),D("ngModelChange",function(n){u(e);let l=c();return M(l.recipientNotBuyer,n)||(l.recipientNotBuyer=n),f(n)}),a()(),r(19,"div",25)(20,"span"),C(21,"i",26),a(),r(22,"h6",23)(23,"span"),d(24,"Recipient \u2260 Buyer"),a(),r(25,"span",27),C(26,"i",28),a()()()()(),_(27,Ts,25,4,"div",10)}if(o&2){let e=c();s(5),y(" ",e.dateLabel," "),s(2),P("ngModel",e.posData.Invoice.DateCustom),p("baseZIndex",1e4)("showClear",!0),s(7),P("time",e.posData.Invoice.TimeCustom),p("showIcon",!0)("showCloseBtn",!1)("fullWidth",!0)("showClear",!0),s(4),P("ngModel",e.recipientNotBuyer),p("binary",!0),s(9),E(e.recipientNotBuyer?27:-1)}}var ni=class o{constructor(t,e,i,n,l,h,A){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._orderProcessorService=n;this._productHttpService=l;this._outletService=h;this.datePipe=A;this.destroy$=new G,this.initStartTime(),this.subscribePosData(),this.initModal()}modalConfig=new H;isDisabledNgSelectOutlet=!1;isDelivery=V(!1);customDate=null;shipping=new fi;deliveryEntityID="";posData=new ct;startTime;get entities(){return this._posService.Data.Entities}shippingFormVisible;destroy$;disableShippingNow=!1;disableShippingLater=!1;recipientNotBuyer;dateLabel="Fulfillment Date";ngOnInit(){this.initShipingFormVisible(),this.initDefaultOrderDelivery(),this.checkRecepientIsBuyer(),this.initDateLabel(),this.initDisabledOutletOption()}initDisabledOutletOption(){this._orderProcessorService.Data.posState==2&&(this.isDisabledNgSelectOutlet=!0)}checkRecepientIsBuyer(){S.IsNotEmpty(this.shipping.Name)?this.recipientNotBuyer=!0:this.recipientNotBuyer=!1}initDateLabel(){let t=this._posService.Data.AppConfigJSON;t.ModuleSell.Shipping.DateLabel&&(this.dateLabel=t.ModuleSell.Shipping.DateLabel)}initStartTime(){var t=new Date;this.startTime=t.getHours()+":"+t.getMinutes()}subscribePosData(){this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.posData=t,this.posData.Invoice.DateCustom=this.posData.Invoice.DateCustom?this.posData.Invoice.DateCustom:null,this.deliveryEntityID=t.Action.DeliveryEntityID,this.shipping=t.Shipping?t.Shipping:new fi})}initModal(){this.modalConfig.title="Order Fullfillment",this.modalConfig.customWidth="650px"}initShipingFormVisible(){let t=this._posService.Data.AppConfigJSON;this.shippingFormVisible=t.ModuleSell.Shipping.DeliveryAddressAlwaysVisible}initDefaultOrderDelivery(){this.deliveryEntityID==S.GuidEmpty?this.isDelivery.set(!0):this.isDelivery.set(!1);let t=this.entities.find(e=>e.ID==this._outletService?.getOutletRegister()?.EntityID);if(S.IsNotEmpty(t.ID)){let e=t.FulfillmentOption;e==1?(this.isDelivery.set(!1),this.disableShippingLater=!0):e==2&&(this.isDelivery.set(!0),this.disableShippingNow=!0),this.changeDelivery()}}changeDelivery(){if(this.isDelivery())this.deliveryEntityID=S.GuidEmpty;else{let t=this._outletService.Data,e=this.posData.Action.DeliveryEntityID;S.IsNotEmpty(e)?this.deliveryEntityID=e:S.IsNotEmpty(t.DefaultWarehouse)?this.deliveryEntityID=t.DefaultWarehouse:this.deliveryEntityID=t.EntityID}}onOk(){this.getSerialByVariantIds(),this.setCustomDateField(),this.clearShippingData(),this.posData.Shipping=this.shipping,this.posData.Action.DeliveryEntityID=this.deliveryEntityID,this._orderDataService.pushNewValue(this.posData),this.close()}clearShippingData(){if(!this.recipientNotBuyer)for(let t of Object.getOwnPropertyNames(this.shipping))this.shipping[t]=""}setCustomDateField(){let t=this.posData.Invoice.DateCustom?this.posData.Invoice.DateCustom:null,e=this.posData.Invoice.TimeCustom?this.posData.Invoice.TimeCustom:"00:00";if((this.isDelivery()||this.shippingFormVisible)&&t){let i=this.datePipe.transform(this.posData.Invoice.DateCustom,"d MMM y");this.posData.Invoice.CustomDateField=`${i} ${e}`}}getSerialByVariantIds(){let t=this.posData.CartItems;if(S.IsNotEmpty(this.deliveryEntityID)&&t.length>0){let e=t.map(i=>i.VariantID);this._productHttpService.getSerialByVarianIds(this.deliveryEntityID,e).subscribe(i=>{this.updateCartItemSerial(i)})}}updateCartItemSerial(t){let e=nt(Be,this.posData.CartItems),i;this.posData.CartItems=e.map(n=>(n.isSerialType()&&(i=t.findIndex(l=>l.VariantID==n.VariantID),i!==-1&&(n.Serial=this.filterSerialBySelectedSerial(n.Serial,t[i].Serial))),n)),this._orderDataService.pushNewValue(this.posData)}filterSerialBySelectedSerial(t=[],e){let i;return e.filter(l=>(i=t.findIndex(h=>h.Number==l.Number),i!==-1))}close(){this._dialogRef.close()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||o)(m(j),m(N),m(L),m(W),m(Fi),m(Y),m(We))};static \u0275cmp=w({type:o,selectors:[["POS-modal-shipping"]],decls:23,vars:14,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container"],[1,"row"],[1,"btn-group","col-12"],["type","button",1,"btn","btn-secondary","position-relative","btn-custom-size","col-5",3,"click","disabled"],[1,"fa-solid","fa-bolt"],[1,"ms-2"],[1,"ms-1"],["type","button",1,"btn","position-relative","btn-custom-size","col-7",3,"click","disabled"],[1,"fa-solid","fa-clock"],[1,"row","mt-12"],[1,"col-12"],["for","shippingDate",1,"mb-2"],[1,"fa","fa-store","me-1"],["optionLabel","Name","optionValue","ID","filterBy","Name","placeholder","Select a Outlet","appendTo","body",1,"w-100",2,"--p-select-padding-y","0.8rem",3,"ngModelChange","options","ngModel","filter","showClear","disabled"],[1,"d-flex","align-items-center","gap-3"],[1,"w-100"],[1,"fa-solid","fa-calendar","me-1"],["placeholder","Select Date","showIcon","","iconDisplay","input","appendTo","body","dateFormat","dd M yy",1,"w-100","date-custom",3,"ngModelChange","ngModel","baseZIndex","showClear"],["for","shippingTime",1,"mb-2"],[1,"fa","fa-clock","me-1"],["placeholder","Select Time",1,"date-custom",3,"timeChange","time","showIcon","showCloseBtn","fullWidth","showClear"],[1,"mt-12"],[1,"d-flex","align-items-center","gap-2"],[1,"custom-checkbox-style",3,"ngModelChange","ngModel","binary"],[1,"d-flex","align-items-center","gap-1"],[1,"fa-solid","fa-user","fs-5"],["pTooltip",`Enable this option when the person receiving the order is different from customer who made the purchase.
|
|
6
6
|
This is commonly used for gift deliveries, corporate orders, or when someone is buying on behalf of another person. When enabled, you'll need to provide the recipient's contact details and delivery address.`,"tooltipPosition","top","tooltipZIndex","10000"],[1,"fa","fa-info-circle"],[1,"col-4","pe-0"],["for","recipient"],[1,"fa-solid","fa-user","me-1","mb-2"],["id","recipient","placeholder","Enter recipient name","type","text",1,"w-100","form-control","rounded-1","custom-input-size",3,"ngModelChange","ngModel"],["for","phone"],[1,"fa-solid","fa-phone","me-1","mb-2"],["id","phone","placeholder","Enter recipent phone number","type","text",1,"w-100","form-control","rounded-1","custom-input-size",3,"ngModelChange","ngModel"],[1,"col-4"],["for","city"],[1,"fa-solid","fa-location-dot","me-1","mb-2"],["id","city","placeholder","Enter the recipient city","type","text",1,"w-100","form-control","rounded-1","custom-input-size",3,"ngModelChange","ngModel"],[1,"col-12","mt-8"],["for","address",1,"mb-3"],[1,"fa-solid","fa-address-book","me-1"],["id","address","placeholder","Enter the recipient address here ...",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"button",4),g("click",function(){return i.isDelivery.set(!1),i.changeDelivery()}),C(6,"i",5),r(7,"span",6),d(8," Now "),r(9,"small",7)(10,"em"),d(11,"(in store purchase)"),a()()()(),r(12,"button",8),g("click",function(){return i.isDelivery.set(!0),i.changeDelivery()}),C(13,"i",9),r(14,"span",6),d(15," Later "),r(16,"small",7)(17,"em"),d(18,"(shipped to customer address)"),a()()()()()(),r(19,"div",10)(20,"div",11),_(21,ks,6,6,"div")(22,Es,28,12),a()()()()()),e&2&&(p("config",i.modalConfig),s(5),he(me(8,Ds,!i.isDelivery(),i.isDelivery())),p("disabled",i.disableShippingNow),s(7),he(me(11,ws,!i.isDelivery(),i.isDelivery())),p("disabled",i.disableShippingLater),s(9),E(i.isDelivery()?22:21))},dependencies:[X,ve,U,Sr,vr,fe,te,K,oe,Ir,xr,Ri,Cr,_r,qt,dt,br,hr],styles:[".container[_ngcontent-%COMP%]{min-height:185px} p-datepicker.date-custom>span>input{padding-top:10px;padding-bottom:10px} app-timepicker.date-custom p-datepicker>span>input{padding-top:10px;padding-bottom:10px}.btn-custom-size[_ngcontent-%COMP%]{--bs-btn-padding-y: 1rem;--bs-btn-padding-x: 1rem;--bs-btn-font-size: 3.5rem;font-family:Roboto Slab,serif}.btn-custom-size[_ngcontent-%COMP%]:hover{background-color:var(--bs-light)!important;border-color:var(--bs-light)!important;color:#000!important}.custom-checkbox-style[_ngcontent-%COMP%]{--p-checkbox-checked-background: #89b03e;--p-checkbox-hover-border-color: #89b03e;--p-checkbox-checked-border-color: #89b03e;--p-checkbox-checked-hover-border-color: #89b03e;--p-checkbox-hover-border-color-background: #7c9b44;--p-checkbox-checked-hover-background: #89b03e}.custom-input-size[_ngcontent-%COMP%]{height:2.625rem;padding:.75rem!important;color:#343434;font-size:.75rem;border-radius:.25rem!important}"]})};var Dn=class o{constructor(t){this.httpService=t}getParkedOrder(t,e){return this.httpService.get(_e.GetPark,[{key:"EntityID",value:t},{key:"RegisterID",value:e}])}removeOrder(t,e){let i={OrderID:t};return e?this.httpService.post(_e.VoidPark,i):this.httpService.post(_e.RemovePark,i)}mergePark(t){return this.httpService.post(_e.MergePark,t)}getOutstanding(t){let e={EntityID:t};return this.httpService.post(_e.GetOutStanding,e)}static \u0275fac=function(e){return new(e||o)(B(Qe))};static \u0275prov=rt({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ns=(o,t)=>({"d-flex align-items-center justify-content-center":o,"custom-container-height":t}),va=()=>["ParkLabel","Number"],Sa=o=>({"no-hover":o}),ya=o=>({"bg-danger":o}),xa=o=>({"text-white":o}),Ia=(o,t,e)=>({"duration-green":o,"duration-yellow":t,"duration-red":e});function Vs(o,t){if(o&1&&(r(0,"span",16),d(1),a()),o&2){let e=t.$implicit,i=t.index;p("hidden",i==0),s(),y(" ",e.ParkLabel," ")}}function As(o,t){if(o&1&&(r(0,"div",13),_(1,Vs,2,2,"span",14),d(2," will be merged to"),r(3,"span",15),d(4),a()()),o&2){let e=c(2);s(),p("ngForOf",e.listMerge),s(3),T(e.listMerge[0].ParkLabel)}}function Ls(o,t){if(o&1){let e=v();r(0,"div",7),_(1,As,5,2,"div",8),r(2,"div",9)(3,"span",10),C(4,"i",11),a(),r(5,"input",12),D("ngModelChange",function(n){u(e);let l=c();return M(l.filter,n)||(l.filter=n),f(n)}),a()()()}if(o&2){let e=c();s(),p("ngIf",e.listMerge.length>1),s(4),P("ngModel",e.filter)}}function Bs(o,t){if(o&1&&C(0,"i"),o&2){let e=c(2).$implicit;he(e.Icon)}}function Fs(o,t){if(o&1&&(r(0,"h5",26),_(1,Bs,1,2,"i",27),r(2,"span"),d(3),b(4,"limitTo"),a()()),o&2){let e=c().$implicit,i=c(4);s(),E(e.Icon?1:-1),s(2),y(" ",i.parkedOrders.length<5?e.Name:ne(4,2,e.Name,5)," ")}}function js(o,t){if(o&1&&(r(0,"div",40),C(1,"i",47),d(2),a()),o&2){let e=c().$implicit;s(2),y(" ",e.CustomerDisplay," ")}}function Hs(o,t){if(o&1&&(r(0,"div",48),d(1),a()),o&2){let e=c().$implicit;s(),y(" ",e.alias," ")}}function Us(o,t){if(o&1){let e=v();r(0,"div",29),no(1),r(2,"div",30)(3,"div",31),g("click",function(n){let l=u(e).$implicit;return c(6).onOrderClicked(l),f(n.preventDefault())}),r(4,"h5",32)(5,"div",33),d(6),a(),r(7,"span",34),g("click",function(n){let l=u(e).$implicit;return c(6).remove(l),f(n.stopPropagation())}),C(8,"i",35),a()(),r(9,"div",36)(10,"div",37)(11,"div",38),C(12,"i",39),d(13),a(),r(14,"div",40),C(15,"i",41),d(16),b(17,"date"),a(),_(18,js,3,1,"div",42)(19,Hs,2,1,"div",43),a(),r(20,"div",44)(21,"div",45),d(22),a(),r(23,"input",46),D("ngModelChange",function(n){let l=u(e).$implicit;return M(l.selected,n)||(l.selected=n),f(n)}),g("change",function(){let n=u(e).$implicit,l=c(6);return f(l.chooseMerge(n))})("click",function(n){return u(e),f(n.stopPropagation())}),a()()()()()()}if(o&2){let e=t.$implicit,i=c(6),n=(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve();s(2),p("ngClass",R(17,Sa,n))("matTooltip",n?"You\u2019re currently retrieving this order and cannot retrieve it again!":""),s(2),p("ngClass",R(19,ya,n)),s(),p("ngClass",R(21,xa,n)),s(),y(" ",i.replaceAlias&&e.Alias?e.Alias:e.ParkLabel," "),s(),p("hidden",(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve()||i.AuthorizeParkOrderDeletion),s(6),y(" ",e.Number," "),s(3),y(" ",ne(17,14,e.Created,"dd-MMM HH:mm")," "),s(2),p("ngIf",e.CustomerDisplay),s(),p("ngIf",!i.replaceAlias),s(2),p("ngClass",mi(23,Ia,e.Duration<=60,e.Duration>60&&e.Duration<=120,e.Duration>120)),s(),y(" ",e.Duration," minutes ago "),s(),p("hidden",(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve()||!i.parkEnableMerge),P("ngModel",e.selected)}}function Ws(o,t){if(o&1&&(r(0,"div",24),_(1,Us,24,27,"div",28),b(2,"FilterByArray"),a()),o&2){let e=c().$implicit,i=c(4);s(),p("ngForOf",Ge(2,1,e.List,lt(5,va),i.filter))}}function Qs(o,t){o&1&&(r(0,"div",25),C(1,"app-empty-state"),a())}function qs(o,t){if(o&1&&(r(0,"mat-tab"),_(1,Fs,5,5,"ng-template",22),r(2,"div",23),_(3,Ws,3,6,"div",24)(4,Qs,2,0,"div",25),a()()),o&2){let e=t.$implicit;s(3),E(e.List.length>0?3:4)}}function $s(o,t){if(o&1&&(r(0,"mat-tab-group",20),_(1,qs,5,1,"mat-tab",21),a()),o&2){let e=c(3);s(),p("ngForOf",e.Layout)}}function Js(o,t){if(o&1&&(r(0,"div",17),_(1,$s,2,1,"mat-tab-group",19),a()),o&2){let e=c(2);s(),p("ngIf",e.parkedOrders.length!=0)}}function Gs(o,t){if(o&1&&(r(0,"div",40),C(1,"i",47),d(2),a()),o&2){let e=c().$implicit;s(2),y(" ",e.CustomerDisplay," ")}}function zs(o,t){if(o&1&&(r(0,"div",48),d(1),a()),o&2){let e=c().$implicit;s(),y(" ",e.alias," ")}}function Ks(o,t){if(o&1){let e=v();r(0,"div",29),no(1),r(2,"div",50)(3,"div",31),g("click",function(n){let l=u(e).$implicit;return c(3).onOrderClicked(l),f(n.preventDefault())}),r(4,"h5",32)(5,"div",33),d(6),a(),r(7,"span",34),g("click",function(n){let l=u(e).$implicit;return c(3).remove(l),f(n.stopPropagation())}),C(8,"i",51),a()(),r(9,"div",36)(10,"div",37)(11,"div",38),C(12,"i",39),d(13),a(),r(14,"div",40),C(15,"i",41),d(16),b(17,"date"),a(),_(18,Gs,3,1,"div",42)(19,zs,2,1,"div",43),a(),r(20,"div",44)(21,"div",45),d(22),a(),r(23,"input",46),D("ngModelChange",function(n){let l=u(e).$implicit;return M(l.selected,n)||(l.selected=n),f(n)}),g("change",function(){let n=u(e).$implicit,l=c(3);return f(l.chooseMerge(n))})("click",function(n){return u(e),f(n.stopPropagation())}),a()()()()()()}if(o&2){let e=t.$implicit,i=c(3),n=(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve();s(2),p("ngClass",R(17,Sa,n))("matTooltip",n?"You\u2019re currently retrieving this order and cannot retrieve it again!":""),s(2),p("ngClass",R(19,ya,n)),s(),p("ngClass",R(21,xa,n)),s(),y(" ",e.Alias?e.Alias:e.ParkLabel," "),s(),p("hidden",(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve()||i.AuthorizeParkOrderDeletion),s(6),y(" ",e.Number," "),s(3),y(" ",ne(17,14,e.Created,"dd-MMM HH:mm")," "),s(2),p("ngIf",e.CustomerDisplay),s(),p("ngIf",!i.replaceAlias),s(2),p("ngClass",mi(23,Ia,e.Duration<=60,e.Duration>60&&e.Duration<=120,e.Duration>120)),s(),y(" ",e.Duration," minutes ago "),s(),p("hidden",(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve()||!i.parkEnableMerge),P("ngModel",e.selected)}}function Ys(o,t){if(o&1&&(r(0,"div",18)(1,"div",49),_(2,Ks,24,27,"div",28),b(3,"FilterByArray"),a()()),o&2){let e=c(2);s(2),p("ngForOf",Ge(3,1,e.parkedOrders,lt(5,va),e.filter))}}function Xs(o,t){if(o&1&&_(0,Js,2,1,"div",17)(1,Ys,4,6,"div",18),o&2){let e=c();E(e.retreiveMode==1?0:e.retreiveMode==0?1:-1)}}function Zs(o,t){o&1&&C(0,"app-empty-state",3)}function ec(o,t){if(o&1){let e=v();r(0,"a",52),g("click",function(){u(e);let n=c();return f(n.clearSelection())}),d(1,"Clear All"),a()}}function tc(o,t){if(o&1){let e=v();r(0,"a",52),g("click",function(){u(e);let n=c();return f(n.merge())}),d(1,"Merge"),a()}}var wn=class o{constructor(t,e,i,n,l,h,A,le,Te,Fe){this._dialogRef=t;this._parkedOrderService=e;this._localData=i;this._OrderHttpService=n;this._orderProcessorService=l;this._posHttpResponseService=h;this._salesOrderDataService=A;this.outletService=le;this._toastr=Te;this.roleService=Fe;let je=this._salesOrderDataService.Data;this.entityId=je.Order.EntityID,this.templateID=le.Data.PrintTemplate.ID,this.RegisterID=je.Order.RegisterID,this.park=new Yt(this.outletService.Data.ParkLayoutPack),this.Layout=le.Data?.ParkLayoutPack?.Layout,this.initModalDialog(),this.initConfig(),this.initSelectedRetrieve(),this.getData()}modalConfig=new H;filter;entityId;parkedOrders=[];filterAlwaysVisible;replaceAlias;parkDeletionRestriction;parkEnableMerge;AuthorizeParkOrderDeletion;listMerge=[];park;templateID;RegisterID;voidEnabled;retreiveMode;Layout;isRetrieve=V(!1);parkLabel=V(null);initConfig(){let t=this._posHttpResponseService.Data.AppConfigJSON;this.filterAlwaysVisible=t.ApplicationParkAndRetrieve.Advance.RetreiveFilterBoxAlwaysVisible,this.replaceAlias=t.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,this.voidEnabled=t.ModuleOrders.VoidEnabled,this.retreiveMode=t.ApplicationParkAndRetrieve.Advance.retreiveMode,this.parkEnableMerge=t.ApplicationParkAndRetrieve.Basic.EnableMergeServeralTables,this.AuthorizeParkOrderDeletion=t.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkOrderDeletion,this.roleService.Data.ParkedDeletionAuthorized&&(this.AuthorizeParkOrderDeletion=!1)}initSelectedRetrieve(){let t=this._orderProcessorService.Data.posState;this.isRetrieve.update(()=>t===4),this.parkLabel.update(()=>this._salesOrderDataService.Data?.Order?.ParkLabel)}initModalDialog(){let e=this._posHttpResponseService.Data.AppConfigJSON.ApplicationParkAndRetrieve.UserInterfaceLabel.RetreiveDialogTitle;this.modalConfig.title=e,this.modalConfig.customWidth="850px",this.modalConfig.bodyScrollable=!0,this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}getData(){this._localData.isConfigFromServer().subscribe(t=>{t&&this._parkedOrderService.getParkedOrder(this.entityId,this.RegisterID).subscribe({next:e=>{this.parkedOrders=e,this.parkedOrders.length>0&&this.parkedOrders.forEach(i=>{if(this.retreiveMode==1)i.Orders.forEach(n=>{n.Alias=this.park.GetAlias(n.ParkLabel),n.MemberIdentification=n.MemberIdentification?n.MemberIdentification:"";let l=new Date(n.Created),A=Math.abs(new Date().getTime()-l.getTime()),le=Math.floor(A%864e5/36e5),Te=Math.round(A%864e5%36e5/6e4);n.Duration=le>0?Te+le*60:Te});else{i.Alias=this.park.GetAlias(i.ParkLabel),i.MemberIdentification=i.MemberIdentification?i.MemberIdentification:"";let n=new Date(i.Created),h=Math.abs(new Date().getTime()-n.getTime()),A=Math.floor(h%864e5/36e5),le=Math.round(h%864e5%36e5/6e4);i.Duration=A>0?le+A*60:le}}),this.groupingLayout()},error:()=>{this._dialogRef.close()}})})}groupingLayout(){this.retreiveMode==1&&(this.Layout=this.Layout.map(t=>{t.List=[];let e=this.parkedOrders.find(i=>i.Group==t.Name);return S.IsNotEmpty(e)?t.List=e.Orders:t.List=[],t}))}remove(t){confirm(`Are you sure you want to ${this.voidEnabled?"void":"delete"} park ${t?.ParkLabel?t?.ParkLabel:""}?`)&&this.delete(t)}delete(t){this._parkedOrderService.removeOrder(t.ID,this.voidEnabled).subscribe({next:e=>{this._toastr.info(this.voidEnabled?"Order "+t.Number+" has been voided":"Order "+t.Number+" has been deleted","Park "+t.ParkLabel+" removed!"),this.getData()},error:e=>{this._toastr.error(e,"Failed to remove "+t.ParkLabel+" !"),this._dialogRef.close({Error:e})}})}clearSelection(){this.retreiveMode==1?this.Layout=this.Layout.map(t=>(t.List=t.List.map(e=>(e.selected=!1,e)),t)):this.parkedOrders=this.parkedOrders.map(t=>(t.selected=!1,t)),this.listMerge=[]}merge(){let t=[];this.listMerge.forEach(e=>{t.push(e.ID)}),this._parkedOrderService.mergePark(t).subscribe({next:e=>{let i=this.listMerge.find(n=>n.ID==e.ID);this.onOrderClicked(i)},error:e=>{this._dialogRef.close({Error:e})}})}onOrderClicked(t){(this.parkLabel()!=t.ParkLabel||this.parkLabel()!=t.Alias)&&this._OrderHttpService.GetInvoiceBySoID(t.ID).subscribe(e=>{this._orderProcessorService.updatePosState(4),this._orderProcessorService.plainToClass(e,4),this._dialogRef.close(t)})}chooseMerge(t){if(this.listMerge.find(i=>i.Number==t.Number)===void 0)this.listMerge.push(t);else{let i=[];this.listMerge.forEach(n=>{n.Number!=t.Number&&i.push(n)}),this.listMerge=i,this.listMerge[0]===void 0&&(this.listMerge=[])}}static \u0275fac=function(e){return new(e||o)(m(j),m(Dn),m(Ye),m(Pe),m(W),m(L),m(N),m(Y),m(ee),m(de))};static \u0275cmp=w({type:o,selectors:[["POS-modal-retrieve"]],standalone:!1,decls:10,vars:9,consts:[[3,"onCancel","onClose","config"],[1,"container","px-4",3,"ngClass"],["class","search-container mb-6 px-0",4,"ngIf"],[1,"w-100"],[1,"d-flex","justify-content-between","mt-3"],[1,"d-flex","justify-content-end"],["class","btn btn-light-blue text-primary fw-bold me-3",3,"click",4,"ngIf"],[1,"search-container","mb-6","px-0"],["class","merge-indicator",4,"ngIf"],[1,"input-group","mb-3","w-100"],[1,"input-group-text","txtFilter","rounded-start-1"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["type","text","placeholder","Search by number or note","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded-1","rounded-start-0",3,"ngModelChange","ngModel"],[1,"merge-indicator"],["class","merge-label",3,"hidden",4,"ngFor","ngForOf"],[1,"merge-label","merge-target"],[1,"merge-label",3,"hidden"],["mat-stretch-tabs","false",1,"mt-6"],[1,"container","mt-6"],["mat-stretch-tabs","false",4,"ngIf"],["mat-stretch-tabs","false"],[4,"ngFor","ngForOf"],["mat-tab-label",""],[1,"container","px-0","mt-5"],[1,"row","dialogPicker","mx-0","mt-2"],[1,"d-flex","flex-column","justify-content-center",2,"height","230px"],[1,"d-flex","align-items-center","gap-3"],[3,"class"],["class","col-3",4,"ngFor","ngForOf"],[1,"col-3"],[1,"card","border-1","position-relative",3,"ngClass","matTooltip"],[1,"card-body","p-0",3,"click"],[1,"card-title","d-flex","justify-content-between","align-items-center","px-3","pt-3",3,"ngClass"],[1,"label-title","text-truncate","px-2",3,"ngClass"],[3,"click","hidden"],[1,"fa","fa-xmark-circle","text-danger-soft"],[1,"card-text","card-details","px-4","py-3","d-flex","flex-column"],[1,"flex-grow-1"],[1,"mb-1"],[1,"fa","fa-hashtag","pe-2"],[1,"mb-1","text-muted","small"],[1,"fa-regular","fa-calendar-check","pe-2"],["class","mb-1 text-muted small",4,"ngIf"],["class","text-muted small",4,"ngIf"],[1,"duration-wrapper","d-flex","align-items-center"],[1,"badge","duration-badge",3,"ngClass"],["type","checkbox",1,"retrieve_checkbox","mb-1",3,"ngModelChange","change","click","hidden","ngModel"],[1,"fa","fa-user","pe-2"],[1,"text-muted","small"],[1,"row"],["matTooltipPosition","above",1,"card","border-0","position-relative",3,"ngClass","matTooltip"],[1,"fa","fa-xmark-circle","text-dark"],[1,"btn","btn-light-blue","text-primary","fw-bold","me-3",3,"click"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onCancel",function(){return i._dialogRef.close()})("onClose",function(){return i._dialogRef.close()}),r(1,"content")(2,"div",1),_(3,Ls,6,2,"div",2)(4,Xs,2,1)(5,Zs,1,0,"app-empty-state",3),a()(),r(6,"footer",4)(7,"div",5),_(8,ec,2,0,"a",6)(9,tc,2,0,"a",6),a()()()),e&2&&(p("config",i.modalConfig),s(2),p("ngClass",me(6,Ns,i.parkedOrders.length==0,i.parkedOrders.length>0)),s(),p("ngIf",i.parkedOrders.length>0||i.retreiveMode==1||i.filterAlwaysVisible),s(),E(i.parkedOrders.length>0?4:5),s(4),p("ngIf",i.listMerge.length>1),s(),p("ngIf",i.listMerge.length>1))},dependencies:[q,be,z,te,Lt,K,oe,U,ce,wi,vt,St,Pr,We,ki,mr],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.search-container[_ngcontent-%COMP%]{transition:all .3s ease;width:97%}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]{position:relative;transition:all .3s ease;height:2.3rem}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover, .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e4d,0 0 8px 4px #89b03e33;border-radius:4px}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]{transition:all .3s ease;border-left:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]:focus{box-shadow:none!important;border-color:#ced4da!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .input-group-text[_ngcontent-%COMP%]{transition:all .3s ease;background-color:#fff;border-right:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .input-group-text[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .input-group-text[_ngcontent-%COMP%]{background-color:#89b03e1a;border-color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .fa-magnifying-glass[_ngcontent-%COMP%]{transition:all .3s ease}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .fa-magnifying-glass[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .fa-magnifying-glass[_ngcontent-%COMP%]{color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e66,0 0 12px 6px #89b03e40!important}.custom-container-height[_ngcontent-%COMP%]{max-height:390px;min-height:390px}.nofocus[_ngcontent-%COMP%]:focus{outline:none!important}.merge-indicator[_ngcontent-%COMP%] .merge-label[_ngcontent-%COMP%]{background-color:#d6e9c6;color:#3c763d;padding:.35rem .75rem;border-radius:999px;font-size:.75rem;font-weight:500}.merge-indicator[_ngcontent-%COMP%] .merge-target[_ngcontent-%COMP%]{font-weight:700;color:#4a4f00;font-size:.75rem}.col-3[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap!important}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]{width:180px;height:160px;margin-right:17px;margin-bottom:17px;position:relative;cursor:pointer;transition:all .3s cubic-bezier(.25,.8,.25,1);border-radius:8px;overflow:hidden;background:#fff;box-shadow:0 2px 10px #0000001a;border-left:4px solid #f0f0f0;display:flex;flex-direction:column}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]{display:flex;outline:1px solid transparent;border-radius:5px;flex:1 1 auto;flex-direction:column;justify-content:space-between}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{height:30px;border-radius:4px 4px 0 0;padding:5px 10px;color:#000;background:#e0e4dc;overflow:hidden;transition:all .3s ease;border-bottom:1px solid #e9ecef}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:5px;transition:color .3s ease}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] .card-details[_ngcontent-%COMP%]{font-size:.875rem;line-height:2;color:#333;padding:8px 12px;flex-grow:1;display:flex;flex-direction:column}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover:not(.no-hover){transform:translateY(-3px);box-shadow:0 5px 15px #00000026;border-left:6px solid #84cc16}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover:not(.no-hover) h5.card-title[_ngcontent-%COMP%]{background:#84cc16}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover:not(.no-hover) .label-title[_ngcontent-%COMP%]{color:#fff!important}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover:not(.no-hover) .fa-xmark-circle[_ngcontent-%COMP%]{color:#c0392b!important}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]{cursor:default}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]:hover{transform:none;box-shadow:0 2px 10px #0000001a;border-left:4px solid #f0f0f0}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]:hover h5.card-title[_ngcontent-%COMP%]{background:#e0e4dc}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]:hover .label-title[_ngcontent-%COMP%]{color:#fff!important}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]:hover .fa-xmark-circle[_ngcontent-%COMP%]{color:#e74c3c!important}.col-3[_ngcontent-%COMP%] .card.selected[_ngcontent-%COMP%]{background-color:#f8fff0;box-shadow:0 0 0 1px #89b03e4d;border-left:6px solid #84cc16;border-right:1px solid #e0f0d0;border-top:1px solid #e0f0d0;border-bottom:1px solid #e0f0d0}.col-3[_ngcontent-%COMP%] .card.selected[_ngcontent-%COMP%] h5.card-title[_ngcontent-%COMP%]{background:#84cc16}.col-3[_ngcontent-%COMP%] .card.selected[_ngcontent-%COMP%] .label-title[_ngcontent-%COMP%]{color:#fff!important;font-weight:500}.col-3[_ngcontent-%COMP%] .card.selected[_ngcontent-%COMP%] .fa-xmark-circle[_ngcontent-%COMP%]{color:#e74c3c!important;border-radius:50%}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .fa-xmark-circle[_ngcontent-%COMP%]{color:#e74c3c!important;transition:all .3s ease;font-size:1.2em;padding:2px}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .fa-xmark-circle[_ngcontent-%COMP%]:hover{color:#c0392b!important;background:#e74c3c1a;border-radius:50%;transform:scale(1.1)}.duration-badge[_ngcontent-%COMP%]{padding:.35rem .75rem;border-radius:1rem;font-weight:500;font-size:.65rem;display:inline-block;border-left:5px solid transparent}.duration-green[_ngcontent-%COMP%]{border-left-color:#4caf50;background-color:#d4edda;color:#155724}.duration-yellow[_ngcontent-%COMP%]{border-left-color:#ffc107;background-color:#fff3cd;color:#856404}.duration-red[_ngcontent-%COMP%]{border-left-color:#c82333;background-color:#f8d7da;color:#721c24}.duration-wrapper[_ngcontent-%COMP%]{margin-top:auto;margin-bottom:.25rem}.label-title[_ngcontent-%COMP%]{color:#000;transition:color .3s ease;font-weight:650!important;font-size:.75rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.card[_ngcontent-%COMP%]:hover .label-title[_ngcontent-%COMP%], .card.selected[_ngcontent-%COMP%] .label-title[_ngcontent-%COMP%]{color:#fff!important} .mat-tab-group .mat-tab-label-active{background-color:#84cc16!important;color:#fff!important;border-radius:.25rem .25rem 0 0;font-weight:700}.modal-footer-custom[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:1rem;padding-top:1rem}.modal-footer-custom[_ngcontent-%COMP%] .btn-retrieve[_ngcontent-%COMP%], .modal-footer-custom[_ngcontent-%COMP%] .btn-cancel[_ngcontent-%COMP%]{background-color:#c5dcff;color:#0b5ed7;font-weight:600;border:none;border-radius:.3rem;padding:.5rem 1.25rem;transition:background-color .2s ease-in-out}.modal-footer-custom[_ngcontent-%COMP%] .btn-retrieve[_ngcontent-%COMP%]:hover, .modal-footer-custom[_ngcontent-%COMP%] .btn-cancel[_ngcontent-%COMP%]:hover{background-color:#b5cfee}[_nghost-%COMP%] .mat-mdc-tab-group[_ngcontent-%COMP%]{--mdc-tab-indicator-active-indicator-color: #89b03e;--mat-tab-header-focus-indicator-color: #89b03e;--mat-tab-header-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-hover-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-indicator-color: #89b03e;--mat-tab-header-active-hover-indicator-color: #89b03e}[_nghost-%COMP%] .mat-mdc-tab-header{border-bottom:1px solid var(--bs-border-color)}.retrieve_checkbox[_ngcontent-%COMP%]{position:absolute;bottom:8px;right:8px;z-index:10;width:20px;height:20px;cursor:pointer;accent-color:#84cc16}.retrieve_checkbox[_ngcontent-%COMP%]:checked{animation:pulse .3s ease}"]})};var Oa=[{name:"Order",menus:[{label:"Retrieve",class:"fa-solid fa-box fs-2",action:"RETRIEVE",cy:"retrieve-act",description:"You need \u2018Retrieve\u2019 role to access this function"},{label:"Return",class:"fa-regular fa-cart-arrow-up fs-3",action:"RETURN",cy:"return-act",description:"You need \u2018Return\u2019 role to access this function"},{label:"Fulfillment",class:"fa-solid fa-truck fs-2",action:"FULFILLMENT",cy:"fulfillment-act",description:"You need \u2018Fulfillment\u2019 role to access this function"}],children:[{name:"Promotion",menus:[{label:"Event",class:"fa-solid fa-gift fs-2",action:"PROMOTION"},{label:"Coupon",class:"fa-regular fa-ticket fs-2",action:"COUPON",cy:"coupon-act"}]}]},{name:"Item",menus:[{label:"Add",class:"fa-circle-plus fa-solid fs-2",action:"ADD_ITEM"},{label:"Serial",class:"fa-barcode-read fa-solid fs-2",action:"SERIAL"},{label:"Upload",class:"fa-solid fa-upload fs-2",action:"UPLOAD"},{label:"Clear",class:"fa-solid fa-trash fs-3",action:"CLEAR"}]},{name:"Bill",menus:[{label:"Print",class:"fa-print fa-solid fs-2",action:"PRINT"},{label:"Split",class:"fa-solid fa-split fs-2",action:"SPLIT"},{label:"Cancel Split",class:"fa-solid fa-xmark fs-2",action:"CANCEL"}]},{name:"Advanced",menus:[{label:"Customer Display",class:"fa-display fa-regular fs-3",action:"CUSTOMER_DISPLAY"},{label:"Order Display",class:"fa-solid fa-clipboard-list fs-3",action:"ODS_CONFIG"},{label:"Validate Inventory",class:"fa-archive fa-solid fs-3",action:"INVENTORY"},{label:"Disable Sort",class:"fa-sort fa-solid fs-3",action:"SORT"},{label:"ECR",class:"fa-solid fa-mobile-signal-out fs-3",action:"ECR"}]}];var kn=class{OrderID;ParkLabel;Items};var ic=o=>({"no-border":o});function nc(o,t){if(o&1){let e=v();r(0,"tr",14)(1,"td"),d(2),a(),r(3,"td"),d(4),b(5,"number"),a(),r(6,"td")(7,"div",15)(8,"button",16),g("click",function(){let n=u(e).index,l=c();return f(l.onRemoveQuantity(n))}),d(9,"-"),a(),r(10,"input",17),D("ngModelChange",function(n){let l=u(e).$implicit;return M(l.SplitQuantity,n)||(l.SplitQuantity=n),f(n)}),g("ngModelChange",function(){u(e);let n=c();return f(n.onSplitedQuantityChange())}),a(),r(11,"button",18),g("click",function(){let n=u(e).index,l=c();return f(l.onAddQuantity(n))}),d(12,"+"),a()()(),r(13,"td",19),d(14),b(15,"number"),a()()}if(o&2){let e=t.$implicit,i=t.index,n=c();p("ngClass",R(11,ic,i==(n.cartItems==null?null:n.cartItems.length)-1)),s(2),T(e==null||e.Variant==null?null:e.Variant.Name),s(2),T(x(5,7,e==null?null:e.Price)),s(6),P("ngModel",e.SplitQuantity),p("max",e.Quantity)("min",0),s(4),T(x(15,9,e==null?null:e.Quantity))}}var Tn=class o{constructor(t,e,i,n,l,h){this.dialogRef=t;this.salesOrderDataService=e;this.parkService=i;this.orderProcessorService=n;this.toastr=l;this.calculatorService=h;let A=this.salesOrderDataService?.Data?.CartItems;this.cartItems=nt(Be,A),this.salesOrderData=nt(ct,this.salesOrderDataService.Data),this.currencySymbol=this.calculatorService.currencySymbol}modalConfig=new H;splitData;cartItems;parkLabel;splitPriceTotal;currencySymbol;salesOrderData;ngOnInit(){this.initModalConfig(),this.initItemsSplitQty()}initModalConfig(){this.modalConfig.title="Split Order",this.modalConfig.okText="Split",this.modalConfig.cancelText="Cancel",this.modalConfig.customWidth="725px"}initItemsSplitQty(){this.cartItems=this.cartItems.map(t=>(t.SplitQuantity=0,t))}onOk(){this.generateSplitData(),this.parkService.splitOrder(this.splitData).subscribe(t=>{this.salesOrderData.CartItems=this.cartItems,this.salesOrderData.Order.ParkLabel=this.parkLabel,this.salesOrderDataService.pushNewValue(this.salesOrderData),this.toastr.success("Split order successfully","Success"),this.orderProcessorService.updatePosState(5),this.orderProcessorService.createNewTransactionInSameOutletRegister(),this.onClose()})}generateSplitData(){this.splitData=new kn,this.splitData.OrderID=this.salesOrderDataService?.Data?.Order?.ID,this.splitData.ParkLabel=this.parkLabel,this.splitData.Items=this.cartItems.map(t=>({ID:t.ID,Quantity:t.SplitQuantity}))}onSplitedQuantityChange(){this.splitPriceTotal=this.cartItems.map(t=>t.SplitQuantity?t.SplitQuantity:0).reduce((t,e,i)=>t+e*this.cartItems[i]?.Price,0)}onAddQuantity(t){this.cartItems=this.cartItems.map((e,i)=>(i==t&&e.SplitQuantity<e.Quantity&&(e.SplitQuantity+=1),e)),this.onSplitedQuantityChange()}onRemoveQuantity(t){this.cartItems=this.cartItems.map((e,i)=>(i==t&&e.SplitQuantity>0&&(e.SplitQuantity-=1),e)),this.onSplitedQuantityChange()}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||o)(m(j),m(N),m(ke),m(W),m(ee),m(Me))};static \u0275cmp=w({type:o,selectors:[["app-modal-split"]],features:[at([ke])],decls:26,vars:7,consts:[[3,"onOk","onClose","onCancel","config"],[1,"container","py-4"],[1,"row"],[1,"col-12"],[1,"mb-8"],["type","text","placeholder","Type park label (Optional)",1,"form-control","rounded-1","p-4","fs-5",3,"ngModelChange","ngModel"],[1,"d-flex","align-items-center","justify-content-between","border","p-4","rounded-1",2,"background","whitesmoke"],[1,"fs-5","fw-bold"],[1,"fs-5"],[1,"table","table-secondary","mt-10"],[1,"table-light"],[1,"text-center",2,"width","116px"],[1,"text-end",2,"width","65px"],[3,"ngClass",4,"ngFor","ngForOf"],[3,"ngClass"],[1,"input-group","mb-3"],["type","button",1,"btn","btn-danger","btn-sm","border-end-0",3,"click"],["type","text","autoNum","",1,"form-control","text-center",3,"ngModelChange","ngModel","max","min"],["type","button",1,"btn","btn-success","btn-sm","border-start-0",3,"click"],[1,"text-end"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onOk",function(){return i.onOk()})("onClose",function(){return i.onClose()})("onCancel",function(){return i.onClose()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"div",4)(6,"input",5),D("ngModelChange",function(l){return M(i.parkLabel,l)||(i.parkLabel=l),l}),a()(),r(7,"div",6)(8,"div",7),d(9,"Splitted Amount"),a(),r(10,"div",8),d(11),b(12,"number"),a()(),r(13,"table",9)(14,"thead",10)(15,"tr")(16,"th"),d(17,"Name"),a(),r(18,"th"),d(19,"Price"),a(),r(20,"th",11),d(21,"Qty Split"),a(),r(22,"th",12),d(23,"Qty"),a()()(),r(24,"tbody"),_(25,nc,16,13,"tr",13),a()()()()()()()),e&2&&(p("config",i.modalConfig),s(6),P("ngModel",i.parkLabel),s(5),Ue("",i.currencySymbol," ",i.splitPriceTotal?x(12,5,i.splitPriceTotal):0,""),s(14),p("ngForOf",i.cartItems))},dependencies:[X,q,be,Z,ve,U,ut,st,fe,te,K,oe,da],styles:["table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{line-height:10px}td[_ngcontent-%COMP%] > .item-image[_ngcontent-%COMP%]{height:50px;width:56px;display:block;margin:0 auto;border:solid 1px #dddddd;border-radius:5px}img.item-image[_ngcontent-%COMP%]{object-fit:contain}table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr.no-border[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-bottom:0px!important}"]})};var En=class o{constructor(t,e){this.data=t;this._dialogRef=e;this.message=t.message,this.initModal()}modalConfig=new H;message;initModal(){this.modalConfig.title=this.data.title,this.modalConfig.headerType=Le.Success,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0,this.modalConfig.hideFooter=!0}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||o)(m(Ae),m(j))};static \u0275cmp=w({type:o,selectors:[["POS-modal-info"]],standalone:!1,decls:4,vars:2,consts:[[3,"onCancel","onClose","config"],[1,"fw-normal","d-flex","justify-content-center"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"h4",1),d(3),a()()()),e&2&&(p("config",i.modalConfig),s(3),T(i.message))},dependencies:[U],encapsulation:2})};var Rn=class{constructor(){this.modalConfig.title="Adding new items to order",this.modalConfig.bodyScrollable=!0,this.modalConfig.customWidth="700px",this.modalConfig.noPadding=!0,this.onHand=0,this.allocated=0,this.pricebookDisabled=!0}modalConfig=new H;cartItem=new Be;role;isSerialItem=!1;priceVisible;unitPriceEditor;pricebookSelector;pricebookCopyDesc;calculatorQtyDisabled;calculatorPriceDisabled;productCalculator=V(!0);serials=[];numpadVisible;editingItemPromotionVisible;keyboard;statusModal;isEmptySalesID;pricebookDisabled;queryInventoryOnOpen;pricebookId;oriUnitPrice;oriDiscount;entities;onHand;allocated;costVisible=!1;unitQtyLabel="Unit Quantity";sales;initialSerial;quantityToOneInDialog;splitDeliveryOutletEnabled;hasInventoryView;enabledEditCost=V(!1);mapAppConfigJson(t){this.numpadVisible=t.ModuleSell.NumPadVisible,this.pricebookCopyDesc=t.ModuleSell.Pricebook?.PricebookVisible,this.queryInventoryOnOpen=!1,this.quantityToOneInDialog=t.ModuleSell.ProductDialog?.QuantityToOneInDialog,this.unitQtyLabel=t.ModuleSell.ProductDialog?.UnitQtyLabel,this.splitDeliveryOutletEnabled=t.ModuleSell.ProductDialog?.SplitDeliveryOutletEnabled,this.editingItemPromotionVisible=t.ModuleSell.Promotion?.EditingItemPromotionVisible,this.productCalculator.set(t.ModuleSell?.ProductDialog?.ProductCalculator)}isSerial(){return this.cartItem.Variant!=null?this.cartItem.Variant.TypeID==4:!1}setUserRole(t){this.role=t,this.unitPriceEditor=this.role.UnitPriceEditor,this.priceVisible=this.role.PriceVisible,this.pricebookSelector=this.role.PricebookSelector,this.hasInventoryView=this.role.InventoryView}};var fo=(l=>(l[l.SELL_INPUT=0]="SELL_INPUT",l[l.DISCOUNT=1]="DISCOUNT",l[l.PRODUCT=2]="PRODUCT",l[l.SERIAL=3]="SERIAL",l[l.CALCULATOR=4]="CALCULATOR",l))(fo||{});var oc=(o,t)=>({"tooltip-container-bottom":o,"tooltip-container-top":t});function rc(o,t){o&1&&pi(0)}var Nn=class o{text;position;content;static \u0275fac=function(e){return new(e||o)};static \u0275cmp=w({type:o,selectors:[["POS-tooltip"]],inputs:{text:"text",position:"position",content:"content"},standalone:!1,decls:3,vars:6,consts:[[3,"ngClass"],[4,"ngTemplateOutlet"]],template:function(e,i){e&1&&(r(0,"div",0),d(1),_(2,rc,1,0,"ng-container",1),a()),e&2&&(p("ngClass",me(3,oc,i.position=="top"||!i.position,i.position=="bottom")),s(),y(" ",i.text," "),s(),p("ngTemplateOutlet",i.content))},dependencies:[q,Di],styles:['.tooltip-container-top[_ngcontent-%COMP%]{box-shadow:0 0 5px #0003;margin:.7rem 1rem 1rem;min-width:50px;max-width:400px;background:#fff;border:1px solid #ccc;pointer-events:none;position:relative;min-height:1rem;padding:.5rem;border-radius:4px}.tooltip-container-top[_ngcontent-%COMP%]:after, .tooltip-container-top[_ngcontent-%COMP%]:before{content:"";display:block;position:absolute;bottom:100%;width:0;height:0;border-style:solid}.tooltip-container-top[_ngcontent-%COMP%]:after{left:calc(49% + 2px);border-color:transparent transparent #fff transparent;border-width:6px}.tooltip-container-top[_ngcontent-%COMP%]:before{left:49%;border-color:transparent transparent #ccc transparent;border-width:8px}.tooltip-container-bottom[_ngcontent-%COMP%]{box-shadow:0 0 5px #0003;margin:.7rem 1rem 1rem;min-width:50px;max-width:400px;background:#fff;border:1px solid #ccc;pointer-events:none;position:relative;min-height:1rem;padding:.5rem;border-radius:4px}.tooltip-container-bottom[_ngcontent-%COMP%]:after, .tooltip-container-bottom[_ngcontent-%COMP%]:before{content:"";display:block;position:absolute;bottom:100%;width:0;height:0;border-style:solid}.tooltip-container-bottom[_ngcontent-%COMP%]:after{left:calc(40% + 2px);border-color:#fff transparent transparent transparent;border-width:6px;top:100%}.tooltip-container-bottom[_ngcontent-%COMP%]:before{left:40%;border-color:#ccc transparent transparent transparent;border-width:8px;top:100%}']})};var Vn=class o{constructor(t,e,i){this.overlayPositionBuilder=t;this.elementRef=e;this.overlay=i}content;position;overlayRef;ngOnInit(){let t=this.initPosition(),e=this.overlayPositionBuilder.flexibleConnectedTo(this.elementRef).withPositions([t]);this.overlayRef=this.overlay.create({positionStrategy:e})}initPosition(){let t={originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"};switch(this.position){case"top":t={originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"};break}return t}show(){if(this.content){this.overlayRef.detach();let t=new Xo(Nn),e=this.overlayRef.attach(t);typeof this.content=="string"?e.instance.text=this.content:e.instance.content=this.content,e.instance.position=this.position}}hide(){this.overlayRef.detach()}static \u0275fac=function(e){return new(e||o)(m(Zo),m(Po),m(er))};static \u0275dir=Pi({type:o,selectors:[["","customTooltip",""]],hostBindings:function(e,i){e&1&&g("mouseenter",function(){return i.show()})("mouseleave",function(){return i.hide()})},inputs:{content:[0,"customTooltip","content"],position:"position"},standalone:!1})};var cc=["quantity"],pc=["price"],dc=["discount"],mc=["unitCost"],yi=o=>({selected:o}),wa=o=>({"mt-8":o}),Pa=o=>({"qtyBtn-disabled":o}),uc=()=>["/menu/Products/Catalog/Variants/Info"],fc=o=>({ID:o}),Ma=(o,t)=>({"d-none":o,"d-block":t});function gc(o,t){if(o&1){let e=v();r(0,"a",15),g("click",function(){u(e);let n=c();return f(n.onTabChange(n.modalItemState.PRODUCT))}),d(1," Product "),a()}if(o&2){let e=c();p("ngClass",R(1,yi,e.modalItemState.PRODUCT==e.currentState))}}function _c(o,t){if(o&1){let e=v();r(0,"a",22),g("click",function(){u(e);let n=c();return f(n.onTabChange(n.modalItemState.SERIAL))}),d(1," Serial "),a()}if(o&2){let e=c();p("ngClass",R(1,yi,e.modalItemState.SERIAL==e.currentState))}}function Cc(o,t){if(o&1){let e=v();r(0,"a",22),g("click",function(){u(e);let n=c();return f(n.onTabChange(n.modalItemState.CALCULATOR))}),d(1," Calculator "),a()}if(o&2){let e=c();p("ngClass",R(1,yi,e.modalItemState.CALCULATOR==e.currentState))}}function hc(o,t){if(o&1&&(r(0,"div",34)(1,"div",35)(2,"div"),d(3),a(),r(4,"small",36),d(5),a()()()),o&2){let e=t.data;s(3),T(e==null?null:e.Value),s(2),T(e==null?null:e.Code)}}function bc(o,t){if(o&1){let e=v();I(0),r(1,"div",31)(2,"div",32)(3,"autocompleteV2",33,0),g("onSelect",function(n){u(e);let l=c(2);return f(l.onAddItem(n))})("onInputEnter",function(n){u(e);let l=c(2);return f(l.onEnterProductCode(n))}),a(),_(5,hc,6,2,"ng-template",null,1,J),a()(),O()}if(o&2){let e=Q(6),i=c(2);s(3),p("localStorage","products")("renderThumbnail",!0)("inputTextValue",i.cartItem==null||i.cartItem.Variant==null?null:i.cartItem.Variant.Name)("clearOnSelect",!1)("useCustomTemplate",!0)("itemTemplate",e)}}function vc(o,t){o&1&&(r(0,"div",24)(1,"div",37),d(2," Edit Prepaid Package Quantity is disabled during EDIT MODE "),a(),r(3,"div"),d(4," If you make a mistake, please delete the item and then add again "),a()())}function Sc(o,t){if(o&1&&(r(0,"span"),d(1),a()),o&2){let e=c(3);s(),y("(",e.cartItem.Variant==null?null:e.cartItem.Variant.UOMName,")")}}function yc(o,t){if(o&1){let e=v();r(0,"div",48)(1,"strong")(2,"span"),d(3),a()(),r(4,"input",49),D("ngModelChange",function(n){u(e);let l=c(3);return M(l.cartItem.UnitQuantity,n)||(l.cartItem.UnitQuantity=n),f(n)}),a()()}if(o&2){let e=c(3);s(3),T(e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel),s(),p("preventNegative",!0)("readOnly",(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)("decimalPlaces",e.isSerialItem?0:e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.DecimalPlaceDigit),P("ngModel",e.cartItem.UnitQuantity)}}function xc(o,t){if(o&1&&(C(0,"input",50,4),b(2,"number")),o&2){let e=c(3);p("value",x(2,1,e.cartItem.Price))}}function Ic(o,t){if(o&1){let e=v();r(0,"input",51,4),D("ngModelChange",function(n){u(e);let l=c(3);return M(l.cartItem.Price,n)||(l.cartItem.Price=n),f(n)}),a()}if(o&2){let e=c(3);p("simpleKeyboard",e.keyboard)("readonly",!e.unitPriceEditor||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible),P("ngModel",e.cartItem.Price)}}function Oc(o,t){if(o&1&&(r(0,"div",47)(1,"span",52),d(2),a()()),o&2){let e,i=c(3);s(2),y("Pricebook ",(e=i.selectedPriceBook())==null?null:e.Name," is applied")}}function Pc(o,t){if(o&1){let e=v();r(0,"div",38)(1,"div",39)(2,"strong"),d(3," Qty "),_(4,Sc,2,1,"span",20),a(),r(5,"div",40)(6,"button",41),g("click",function(){u(e);let n=c(2);return f(n.updateItemQuantity(n.cartItem.Quantity!=null?n.cartItem.Quantity-1:0))}),d(7," - "),a(),r(8,"input",42,2),g("ngModelChange",function(n){u(e);let l=c(2);return f(l.updateItemQuantity(n))}),a(),r(10,"button",43),g("click",function(){u(e);let n=c(2);return f(n.updateItemQuantity(n.cartItem.Quantity!=null?n.cartItem.Quantity+1:1))}),d(11," + "),a()()(),_(12,yc,5,5,"div",44),r(13,"div",45)(14,"strong"),d(15,"Price"),a(),_(16,xc,3,3,"input",46)(17,Ic,2,3,"ng-template",null,3,J),a(),_(19,Oc,3,1,"div",47),a()}if(o&2){let e=Q(18),i=c(2);p("ngClass",R(16,wa,i.statusModal=="create")),s(4),p("ngIf",(i.cartItem.Variant==null?null:i.cartItem.Variant.UOM)&&(i.cartItem.Variant==null?null:i.cartItem.Variant.UOMName)),s(2),p("ngClass",R(18,Pa,(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()))("disabled",(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()||i.isSellEdit()&&i.isPrepaidPackage()),s(2),p("simpleKeyboard",i.keyboard)("preventNegative",!i.role.Return)("decimalPlaces",i.isSerialItem?0:i.AppConfigJSON==null||i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.ProductDialog==null?null:i.AppConfigJSON.ModuleSell.ProductDialog.DecimalPlaceDigit)("ngModel",i.cartItem.Quantity)("disabled",(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()||i.isSellEdit()&&i.isPrepaidPackage()),s(2),p("ngClass",R(20,Pa,(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()))("disabled",(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()||i.isSellEdit()&&i.isPrepaidPackage()),s(2),p("ngIf",i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.ProductDialog==null?null:i.AppConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel),s(),p("hidden",!i.priceVisible),s(3),p("ngIf",!i.unitPriceEditor||(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible)("ngIfElse",e),s(3),E(i.selectedPriceBook()?19:-1)}}function Mc(o,t){if(o&1){let e=v();I(0),r(1,"div",53)(2,"strong"),d(3,"Sales Person"),a(),r(4,"ng-select-infinite",54),g("selectedChange",function(n){u(e);let l=c(2);return f(l.updateSales(n))}),D("selectedChange",function(n){u(e);let l=c(2);return M(l.cartItem.SalesID,n)||(l.cartItem.SalesID=n),f(n)}),a()(),O()}if(o&2){let e=c(2);s(4),p("customTooltip",e.salesPersonName)("items",e.sales),P("selected",e.cartItem.SalesID)}}function Dc(o,t){if(o&1){let e=v();r(0,"div",53)(1,"strong"),d(2,"Fulfillment From"),a(),r(3,"ng-select",55),g("ngModelChange",function(){u(e);let n=c(2);return f(n.onDeliveryEntityChange())}),D("ngModelChange",function(n){u(e);let l=c(2);return M(l.cartItem.EntityID,n)||(l.cartItem.EntityID=n),f(n)}),a()()}if(o&2){let e=c(2);s(3),p("items",e.entities),P("ngModel",e.cartItem.EntityID)}}function wc(o,t){if(o&1){let e=v();I(0),r(1,"div",23),_(2,bc,7,6,"ng-container",20)(3,vc,5,0,"div",24)(4,Pc,20,22,"div",25),r(5,"div",26),_(6,Mc,5,3,"ng-container",20)(7,Dc,4,2,"div",27),a(),r(8,"div",28)(9,"div",29)(10,"POS-tinymce-editor",30),D("ngModelChange",function(n){u(e);let l=c();return M(l.cartItem.Note,n)||(l.cartItem.Note=n),f(n)}),a()()()(),O()}if(o&2){let e=c();s(2),p("ngIf",e.statusModal==="create"),s(),E(e.isSellEdit()&&e.isPrepaidPackage()?3:-1),s(),p("ngIf",e.cartItem),s(2),p("ngIf",e.isEmptySalesID&&(e.sales==null?null:e.sales.length)>0&&e.role.SalesPerson),s(),p("ngIf",(e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.SplitDeliveryOutletEnabled)&&e.salesOrderData.Order.DeliveryStateID==1),s(3),P("ngModel",e.cartItem.Note)}}function kc(o,t){if(o&1&&(C(0,"input",50),b(1,"number")),o&2){let e=c(2);p("value",x(1,1,e.cartItem.Discount))}}function Tc(o,t){if(o&1){let e=v();r(0,"input",76,7),g("ngModelChange",function(n){u(e);let l=c(2);return f(l.updateDiscountPercentage(n))}),a()}if(o&2){let e=c(2);p("simpleKeyboard",e.keyboard)("ngModel",e.cartItem.Discount)("preventNegative",!0)("readonly",!e.role.Discount||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}function Ec(o,t){if(o&1&&(C(0,"input",50),b(1,"number")),o&2){let e=c(2);p("value",x(1,1,e.inputedDiscountAmount))}}function Rc(o,t){if(o&1){let e=v();r(0,"input",77,6),D("ngModelChange",function(n){u(e);let l=c(2);return M(l.inputedDiscountAmount,n)||(l.inputedDiscountAmount=n),f(n)}),g("ngModelChange",function(n){u(e);let l=c(2);return f(l.onDiscountAmountChange(n))}),a()}if(o&2){let e=c(2);p("max",e.cartItem==null?null:e.cartItem.GrossTotal)("simpleKeyboard",e.keyboard),P("ngModel",e.inputedDiscountAmount),p("preventNegative",!0)("readonly",!e.role.Discount||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}function Nc(o,t){if(o&1&&(I(0),r(1,"div",61)(2,"div",58)(3,"strong"),d(4,"Discount Amount / Qty"),a()(),r(5,"div",59)(6,"div",78)(7,"p"),d(8),b(9,"number"),a()()()(),O()),o&2){let e=c(2);s(8),T(x(9,1,e.cartItem.DiscountAmount))}}function Vc(o,t){if(o&1){let e=v();I(0),r(1,"div",61)(2,"div",58)(3,"strong"),d(4,"Pricebook"),a()(),r(5,"div",59)(6,"ng-select",79),D("ngModelChange",function(n){u(e);let l=c(2);return M(l.pricebookId,n)||(l.pricebookId=n),f(n)}),g("ngModelChange",function(){u(e);let n=c(2);return f(n.pricebookChange())})("clear",function(){u(e);let n=c(2);return f(n.onClearPricebook())}),a()()(),O()}if(o&2){let e=c(2);s(6),p("items",e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook),P("ngModel",e.pricebookId),p("disabled",e.pricebookDisabled)}}function Ac(o,t){if(o&1&&(I(0),r(1,"div",80)(2,"h5",81),d(3),b(4,"number"),a()(),O()),o&2){let e=c(2);s(3),y(" ",x(4,1,e.cartItem.Discount),"% ")}}function Lc(o,t){if(o&1&&(I(0),r(1,"div",82)(2,"h5"),d(3),b(4,"number"),a(),r(5,"span",73),d(6,"x"),a(),r(7,"h5"),d(8),b(9,"number"),a()(),O()),o&2){let e=c(2);s(3),T(x(4,2,e.cartItem.Quantity)),s(5),T(x(9,4,e.cartItem.DiscountAmount))}}function Bc(o,t){if(o&1&&(I(0),r(1,"h5",83),d(2),b(3,"number"),a(),O()),o&2){let e=c(2);s(2),y(" -",x(3,1,(e.cartItem==null?null:e.cartItem.GrossTotal)*(e.cartItem.Discount/100))," ")}}function Fc(o,t){if(o&1&&(I(0),r(1,"div",75)(2,"h5",83),d(3),b(4,"number"),a()(),O()),o&2){let e=c(2);s(3),y(" -",x(4,1,e.cartItem.Quantity*e.cartItem.DiscountAmount)," ")}}function jc(o,t){if(o&1&&(I(0),r(1,"div",84)(2,"div",85)(3,"h5"),d(4,"Grand Total"),a()(),r(5,"div",85)(6,"h5"),d(7),b(8,"number"),a()()(),O()),o&2){let e=c(2);s(7),T(x(8,1,e.cartItem.Total))}}function Hc(o,t){if(o&1){let e=v();I(0),r(1,"div",31)(2,"div",56)(3,"div",57)(4,"div",58)(5,"strong"),d(6,"Discount %"),a()(),r(7,"div",59)(8,"div",60),_(9,kc,2,3,"input",46)(10,Tc,2,4,"ng-template",null,5,J),a()()(),r(12,"div",61)(13,"div",58)(14,"strong"),d(15,"Discount Amount"),a()(),r(16,"div",59)(17,"div",60),_(18,Ec,2,3,"input",46)(19,Rc,2,5,"ng-template",null,6,J),a()()(),r(21,"div",62)(22,"div",63)(23,"input",64),D("ngModelChange",function(n){u(e);let l=c();return M(l.isDiscMultipliciedQty,n)||(l.isDiscMultipliciedQty=n),f(n)}),g("ngModelChange",function(){u(e);let n=c();return f(n.onSwitchToggleDiscount())}),a()(),r(24,"div",65)(25,"strong"),d(26,"*Quantity"),a(),r(27,"span",66),C(28,"i",67),a()()(),_(29,Nc,10,3,"ng-container",20)(30,Vc,7,3,"ng-container",20),a(),r(31,"div",68)(32,"div",69)(33,"h4"),d(34,"Discount Simulation"),a(),r(35,"h4",70),d(36),a()(),r(37,"div",71)(38,"div",58)(39,"div",72)(40,"h5"),d(41),b(42,"number"),a(),r(43,"span",73),d(44,"x"),a(),r(45,"h5"),d(46),b(47,"number"),a()(),_(48,Ac,5,3,"ng-container",20)(49,Lc,10,6,"ng-container",20),a(),r(50,"div",58)(51,"div",74)(52,"h5"),d(53),b(54,"number"),a()(),r(55,"div",75),_(56,Bc,4,3,"ng-container",20),a(),_(57,Fc,5,3,"ng-container",20),a(),_(58,jc,9,3,"ng-container",20),a()()(),O()}if(o&2){let e=Q(11),i=Q(20),n=c();s(9),p("ngIf",!n.role.Discount||(n.cartItem==null?null:n.cartItem.PromotionGift)&&!n.editingItemPromotionVisible)("ngIfElse",e),s(9),p("ngIf",!n.role.Discount||(n.cartItem==null?null:n.cartItem.PromotionGift)&&!n.editingItemPromotionVisible)("ngIfElse",i),s(5),P("ngModel",n.isDiscMultipliciedQty),s(6),p("ngIf",!n.isDiscMultipliciedQty),s(),p("ngIf",n.cartItem.Variant!=null&&(n.cartItem==null||n.cartItem.Variant==null?null:n.cartItem.Variant.PriceBook)&&(n.cartItem==null||n.cartItem.Variant==null?null:n.cartItem.Variant.PriceBook.length)>0),s(6),y(" ",n.cartItem==null||n.cartItem.Variant==null?null:n.cartItem.Variant.Name," "),s(5),T(x(42,16,n.cartItem.Quantity)),s(5),T(x(47,18,n.cartItem.Price)),s(2),p("ngIf",n.cartItem.Discount),s(),p("ngIf",n.cartItem.DiscountAmount>0),s(4),T(x(54,20,n.cartItem==null?null:n.cartItem.GrossTotal)),s(3),p("ngIf",n.cartItem.Discount),s(),p("ngIf",n.cartItem.DiscountAmount>0),s(),p("ngIf",n.cartItem.DiscountAmount>0||n.cartItem.Discount>0)}}function Uc(o,t){o&1&&(I(0),r(1,"div",100),C(2,"i",101),r(3,"h6"),d(4,"No Image"),a()(),O())}function Wc(o,t){if(o&1&&C(0,"img",102),o&2){let e=c(2);p("src",e.cartItem.Variant.ThumbnailUrl,tt)}}function Qc(o,t){if(o&1){let e=v();r(0,"div")(1,"a",109),g("click",function(){u(e);let n=c(3);return f(n.onEditCost())}),C(2,"i",110),a()()}}function qc(o,t){if(o&1){let e=v();r(0,"tr")(1,"th",103),d(2," Cost "),a(),r(3,"td",104)(4,"div",105)(5,"div",106)(6,"input",107,9),D("ngModelChange",function(n){u(e);let l=c(2);return M(l.cartItem.Cost,n)||(l.cartItem.Cost=n),f(n)}),a()(),r(8,"div",108),d(9),b(10,"number"),a(),_(11,Qc,3,0,"div"),a()()()}if(o&2){let e=c(2);s(5),p("ngClass",me(8,Ma,!e.enabledEditCost(),e.enabledEditCost())),s(),P("ngModel",e.cartItem.Cost),s(2),p("ngClass",me(11,Ma,e.enabledEditCost(),!e.enabledEditCost())),s(),y(" ",ne(10,5,e.cartItem.Cost,"1.0-4")," "),s(2),E(!(e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.Cost==null)&&e.AppConfigJSON.ModuleSell.Cost.Enabled?11:-1)}}function $c(o,t){if(o&1&&(r(0,"tr")(1,"th",111),d(2," Price "),a(),r(3,"td",112),d(4),b(5,"number"),a()()),o&2){let e=c(2);s(4),y(" ",x(5,1,e.cartItem.Variant.UnitPrice)," ")}}function Jc(o,t){if(o&1&&(r(0,"tr")(1,"th",111),d(2," Content "),a(),r(3,"td",113)(4,"div",114),d(5),b(6,"number"),a()()()),o&2){let e=c(2);s(5),Ue(" ",e.cartItem==null?null:e.cartItem.VariantUnitQuantity," (@",x(6,2,e.cartItem.Price/(e.cartItem==null?null:e.cartItem.VariantUnitQuantity)),") ")}}function Gc(o,t){if(o&1&&(r(0,"tr")(1,"th",111),d(2," Commision "),a(),r(3,"td",113)(4,"div",114),d(5),b(6,"number"),a()()()),o&2){let e=c(2);s(5),y(" ",x(6,1,e.cartItem==null?null:e.cartItem.SalesCommission)," ")}}function zc(o,t){if(o&1&&(r(0,"div",58)(1,"table",115)(2,"thead")(3,"tr")(4,"th",116),d(5,"Storage Location"),a()()(),r(6,"tbody")(7,"tr")(8,"td"),d(9),a()()()()()),o&2){let e=c(2);s(9),y(" ",e.cartItem.Variant.Storage," ")}}function Kc(o,t){if(o&1&&(r(0,"tr")(1,"td",97),d(2),a(),r(3,"td",97),d(4),b(5,"number"),a(),r(6,"td",97),d(7),b(8,"number"),a()()),o&2){let e=t.$implicit;s(2),y(" ",e.Name," "),s(2),y(" ",x(5,3,e.MinimumQuantity)," "),s(3),y(" ",x(8,5,e.UnitPrice)," ")}}function Yc(o,t){if(o&1&&(I(0),r(1,"div",117)(2,"div",90)(3,"div",91),C(4,"i",118),r(5,"div",93),d(6," Pricebook "),a()(),r(7,"table",94)(8,"thead")(9,"tr")(10,"th",95),d(11," Name "),a(),r(12,"th",119),d(13," Min Qty "),a(),r(14,"th",95),d(15," Price "),a()()(),r(16,"tbody"),_(17,Kc,9,7,"tr",120),b(18,"sortBy"),a()()()(),O()),o&2){let e=c(2);s(17),p("ngForOf",Ge(18,1,e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook,"asc","MinimumQuantity"))}}function Xc(o,t){if(o&1&&(I(0),r(1,"div",31)(2,"div",86)(3,"a",87),_(4,Uc,5,0,"ng-container",88)(5,Wc,1,1,"ng-template",null,8,J),a()(),r(7,"div",89)(8,"div",31)(9,"div",90)(10,"div",91),C(11,"i",92),r(12,"div",93),d(13," Inventory "),a()(),r(14,"table",94)(15,"thead")(16,"tr")(17,"th",95),d(18," On Hand "),a(),r(19,"th",95),d(20," Allocated "),a(),r(21,"th",96),d(22," Available "),a()()(),r(23,"tbody")(24,"tr")(25,"td",97),d(26),a(),r(27,"td",97),d(28),a(),r(29,"td",97),d(30),a()()()()()(),r(31,"div",38)(32,"div",58)(33,"table",98)(34,"thead"),_(35,qc,12,14,"tr")(36,$c,6,3,"tr")(37,Jc,7,4,"tr")(38,Gc,7,3,"tr"),a()()(),_(39,zc,10,1,"div",99),a(),_(40,Yc,19,5,"ng-container",20),a()(),O()),o&2){let e=Q(6),i=c();s(3),p("routerLink",lt(14,uc))("queryParams",R(15,fc,i.cartItem==null||i.cartItem.Variant==null?null:i.cartItem.Variant.ID)),s(),p("ngIf",(i.cartItem==null||i.cartItem.Variant==null?null:i.cartItem.Variant.ThumbnailUrl)==null)("ngIfElse",e),s(22),y(" ",i.onHand," "),s(2),y(" ",i.allocated," "),s(2),y(" ",i.onHand-i.allocated," "),s(),p("ngClass",R(17,wa,(i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.Cost==null?null:i.AppConfigJSON.ModuleSell.Cost.Visible)&&i.role.Cost||i.role.PriceVisible||i.role.Commission&&(i.cartItem==null?null:i.cartItem.SalesCommission))),s(4),E(!(i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.Cost==null)&&i.AppConfigJSON.ModuleSell.Cost.Visible&&i.role.Cost?35:-1),s(),E(i.role.PriceVisible?36:-1),s(),E((i.cartItem==null?null:i.cartItem.VariantUnitQuantity)>1?37:-1),s(),E(i.role.Commission&&(i.cartItem!=null&&i.cartItem.SalesCommission)?38:-1),s(),p("ngIf",(i.AppConfigJSON==null||i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.Grid==null?null:i.AppConfigJSON.ModuleSell.Grid.StorageVisible)&&i.cartItem.Variant.Storage),s(),p("ngIf",(i.cartItem==null||i.cartItem.Variant==null||i.cartItem.Variant.PriceBook==null?null:i.cartItem.Variant.PriceBook.length)>0)}}function Zc(o,t){if(o&1){let e=v();I(0),r(1,"app-item-serial",121),D("cartItemChange",function(n){u(e);let l=c();return M(l.cartItem,n)||(l.cartItem=n),f(n)})("serialsChange",function(n){u(e);let l=c();return M(l.serials,n)||(l.serials=n),f(n)}),a(),O()}if(o&2){let e=c();s(),p("entityId",e.deliveryEntityId),P("cartItem",e.cartItem),p("disabled",e.orderManager.posState==2&&e.constants.IsNotEmpty(e.cartItem.ID)),P("serials",e.serials)}}function ep(o,t){if(o&1){let e=v();r(0,"div",21)(1,"item-calculator-tab",122),g("discountTotal",function(n){u(e);let l=c();return f(l.cartItem.Discount=n)})("priceTotal",function(n){u(e);let l=c();return f(l.cartItem.Price=n)})("qtyTotal",function(n){u(e);let l=c();return f(l.cartItem.Quantity=n)})("noteChanges",function(n){u(e);let l=c();return f(l.cartItem.Note=n)}),a()()}if(o&2){let e=c();p("hidden",e.modalItemState.CALCULATOR!=e.currentState),s(),p("notes",e.cartItem.Note)("price",e.cartItem.Price)("discount",e.cartItem.Discount)("quantity",e.cartItem.Quantity)("variantName",e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.Name)("disabledQty",(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}var $e=class o extends Rn{constructor(e,i,n,l,h,A,le,Te,Fe,je,oi,wt,Yn,Xn,ri){super();this._dialogRef=e;this.data=i;this._shoppingCartService=n;this._outletService=l;this._posService=h;this._orderProcessorService=A;this._orderDataService=le;this._variantService=Te;this._toastr=Fe;this.decimalPipe=je;this._matDialog=oi;this._numpadService=wt;this._userRoleService=Yn;this._onlineStatusService=Xn;this.cdRef=ri;this.destroy$=new G,this.entities=this._posService.Data.Entities,this.AppConfigJSON=this._posService.Data.AppConfigJSON,this.mapAppConfigJson(this.AppConfigJSON),this.subscribeToObservableChanges()}calculatorTab=Do(kt);_quantityElement;_priceElement;_discountElement;_costElement;salesPersonName;destroy$;AppConfigJSON=new Nr;orderManager;salesOrderData;isOnline=!0;currentState;modalItemState=fo;isDiscMultipliciedQty=!0;inputedDiscountAmount=0;serials=[];constants=S;deliveryEntityId;selectedPriceBook=V(null);isPrepaidPackage=V(!1);isSellEdit=V(!1);ngOnInit(){this.initTabState(),this.isSerialItem=this.isSerial(),this.isPrepaidPackage.update(()=>this.cartItem?.Variant?.TypeID==10&&S.IsNotEmpty(this.cartItem.ID)),this.initStatusModal(),this.numpadVisible&&(this.keyboard=this._numpadService.keyboard),this.initIsUnitPriceEditor()}updateSales(e){this.salesPersonName=this.sales.find(i=>i.ID==e)?.Name,this.cartItem.SalesName=this.salesPersonName}initTabState(){this.currentState=0,this.data?.focus=="Discount"&&(this.currentState=this.modalItemState.DISCOUNT)}onTabChange(e){switch(this.currentState=e,e){case 2:this.queryInventoryOnOpen||this.getStockItem();break;case 1:this.onDiscountAmountChange(this.inputedDiscountAmount);break;case 4:{setTimeout(()=>this.calculatorTab()?.priceInputNativeElement?.focus(),100);break}}}ngAfterViewInit(){setTimeout(()=>{this.initFieldFocus()},200)}initFieldFocus(){switch(this.data&&this.data.focus){case"price":this._priceElement.nativeElement.focus();break;case"discount":this.currentState=1,this._discountElement.nativeElement.focus();break;case"quantity":this._quantityElement.nativeElement.focus()}}initIsUnitPriceEditor(){let e=this.cartItem.Variant?this.cartItem.Variant.SellPriceType:null;(e==1||e==2)&&(this.unitPriceEditor=!0)}initStatusModal(){if(this.data){let i=`Editing Cart Item - ${this.cartItem.Variant?this.cartItem.Variant.Name:""}`;this.updateHeaderTitle(i),this.statusModal="update"}else this.statusModal="create",this.cartItem=this.checkItemQuantityDefault(this.cartItem)}checkItemQuantityDefault(e){return this.quantityToOneInDialog||(e.Quantity=null),e}subscribeToObservableChanges(){this._userRoleService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.setUserRole(e)}),this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.salesOrderData=e,this.initCartItem(e.CartItems),this.checkPriceBookDisabled(),this.checkCalculatorPriceDisabled(),this.checkEmptySalesID(),this.initDeliveryEntityId()}),this._orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.isSellEdit.update(()=>e.posState==2),this.orderManager=e,this.checkCalculatorQtyDisabled()}),this._outletService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.sales=e.ListSales}),this._onlineStatusService.getOnlineStatus$().pipe(k(this.destroy$)).subscribe(e=>{this.isOnline=e})}initDeliveryEntityId(){let e=this.salesOrderData.Action.DeliveryEntityID;S.IsNotEmpty(e)?this.deliveryEntityId=e:this.deliveryEntityId=this.salesOrderData.Order.EntityID}initCartItem(e){if(this.data!=null){let i=e[this.data.index];this.cartItem=Vi(Be,i),this.cartItem.EntityID==S.GuidEmpty&&(this.cartItem.EntityID=null),S.IsEmpty(this.cartItem.SalesID)&&(this.cartItem.SalesID=null),this.oriDiscount=this.cartItem.Discount,this.initialSerial=this.cartItem.Serial,this.initSelectedPriceBook(),this.cartItem.PriceTypeID==2?this.oriUnitPrice=this.cartItem.Price:this.oriUnitPrice=this.cartItem.UnitPriceOriginal,this.inputedDiscountAmount=this.cartItem.DiscountAmount}else this.cartItem=new Be}initSelectedPriceBook(){if(this.cartItem.PriceTypeID==2){let e=this.cartItem.Variant&&this.cartItem.Variant.PriceBook?this.cartItem.Variant.PriceBook:[];if(e.length==1)this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=e[0].ID;else{let i=e.find(n=>n.ID==this.cartItem.PriceBookID);this.pricebookId=i?.ID}this.setSelectedPricebook()}}checkPriceBookDisabled(){if(this.cartItem.Variant){let e=this.cartItem.Variant.TypeID!=11&&!this.pricebookSelector,i=this.cartItem.Variant.TypeID==11&&this.cartItem.Variant.SellPriceType==0&&!this.pricebookSelector;this.pricebookDisabled=e||i}}checkCalculatorPriceDisabled(){if(this.cartItem.Variant){let e=this.cartItem.Variant.TypeID!=11&&!this.unitPriceEditor,i=this.cartItem.Variant.TypeID==11&&this.cartItem.Variant.SellPriceType==0&&!this.unitPriceEditor;this.calculatorPriceDisabled=e||i}}checkQtyInputDisabled(){let e=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion,i=S.IsNotEmpty(this.cartItem.ID);return!!(e&&!this.role.SellEditor&&this.orderManager.posState==4&&i||i&&this.cartItem?.Serial?.length>0)}checkCalculatorQtyDisabled(){let e=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkOrderDeletion,i=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion;this.calculatorQtyDisabled=!e&&this.orderManager.posState===4&&!this.role.Order&&i}checkEmptySalesID(){if(this.salesOrderData.Order!=null){let e=this.salesOrderData.Order.SalesID;this.isEmptySalesID=S.IsEmpty(e)}}pricebookChange(){S.IsNotEmpty(this.pricebookId)&&(this.cartItem.pricebookUpdate(this.pricebookId,!this.pricebookDisabled,this.pricebookCopyDesc),this.setSelectedPricebook())}setSelectedPricebook(){let e=this.cartItem.getSelectedPricebook(this.pricebookId);this.selectedPriceBook.set(e)}onClearPricebook(){this.cartItem=this._shoppingCartService.resetAppliedPricebook(this.cartItem)}updateHeaderTitle(e){this.modalConfig.title=e}onDeliveryEntityChange(){let e=this.entities.find(i=>i.ID==this.cartItem.EntityID);e?this.cartItem.EntityName=e.Name:delete this.cartItem.EntityName}onOk(e){this.cartItem.removeEnterNote(),!(!this.validateConfigDefaultQuantity(e)||(this.cartItem.Variant.SellPriceType==2&&(this.cartItem.Cost=this.cartItem.Price),!this._shoppingCartService.validatePriceMinimum(this.cartItem)))&&(this.validateOnSubmit(),document.getElementById("product").focus())}validateConfigDefaultQuantity(e){let i=this.cartItem.Quantity;if(e=="Enter"){if(this.isSerial())return!1;if(!this.quantityToOneInDialog)return i>0}return!0}validateOnSubmit(){if(S.IsEmpty(this.cartItem.VariantID)){this._toastr.error("Enter item data before clicking OK!","No item is entered!");return}S.IsEmpty(this.cartItem.Quantity)&&this.updateItemQuantity(1),this.generateSerialItem(),this.checkValidateSerialItem(this.cartItem)&&this.onSubmitCartItem()}onSubmitCartItem(){if(this.data==null){let e=this.cartItem;this._shoppingCartService.pushNewItemToArray(e,!0),this._shoppingCartService.addAvailableComponent(e)}else this._shoppingCartService.updateCartItem(this.cartItem,this.data.index);this._orderProcessorService.reedemPointToDiscount(),this._dialogRef.close()}generateSerialItem(){this.cartItem.isSerialType()&&this.serials.length>0&&(!this.cartItem.Serial||this.cartItem?.Serial?.length==0)&&(this.cartItem.Serial=this.serials.map(e=>({Number:e,Quantity:-1,ExpiryDate:null})),this.cartItem.Quantity=this.serials.length*-1)}onCancel(){this._dialogRef.close()}checkValidateSerialItem(e){return this._shoppingCartService.validateSerialItem(e)}updateItemQuantity(e){!this.role.Return&&e<0||(this.cartItem.Quantity=e,this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=this.cartItem.PriceBookID,this.setSelectedPricebook())}updateDiscountPercentage(e){this.cartItem.Discount=Number(e)}updateOrUnitPrice(e){this.oriUnitPrice=e}quantityEditDisabled(){return this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion&&!this.role.Order&&S.IsNotEmpty(this.cartItem.ID)}onAddItem(e){let i=this.salesOrderData.Order.EntityID;this._variantService.findVariantByID(e,i).then(n=>{let l=n,h=new Be;h.patchByVariant(l),this.addItem(h)})}onEnterProductCode(e){let i=this.salesOrderData.Order.EntityID;this._variantService.findVariantByCode(e,i).then(n=>{if(n){let l=Object.assign(new Or,n),h=new Be;h.patchByVariant(l),this.addItem(h)}else this.onProductNotFound(e)}).catch(n=>{window.alert(`Barcode "${e}" is not registered in the product`)})}onProductNotFound(e){this._matDialog.open(En,{data:{message:`Barcode "${e}" is not registered in the product`,title:"Product not found"},width:"30%"}),this.playAudio()}playAudio(){let e=new Audio;e.src="/Sounds/bell_ring.mp3",e.load(),e.play()}addItem(e){this.onHand=0,this.AppConfigJSON.ModuleSell.ProductDialog.QuantityToOneInDialog?e.Quantity=1:this._quantityElement.nativeElement.focus(),this.cartItem=this.checkItemQuantityDefault(e),this.isSerialItem=this.isSerial();let l=`Editing Cart item - ${e.Variant?e.Variant.Name:null}`;this.updateOrUnitPrice(e.UnitPriceOriginal),this.updateHeaderTitle(l),this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=this.cartItem.PriceBookID,this.checkPriceBookDisabled(),this.checkCalculatorPriceDisabled(),this.checkCalculatorQtyDisabled(),this.initIsUnitPriceEditor()}getStockItem(){this._variantService.getStockByID(this.cartItem.VariantID,this.salesOrderData.Order.EntityID).then(e=>{e&&(this.queryInventoryOnOpen=!0,this.allocated=e.Allocated,this.onHand=e.OnHand)})}onCalculatorQty(e){this.updateItemQuantity(e)}onCalculatorPrice(e){this.cartItem.Price=parseFloat(e)}onCalculatorUnitQty(e){this.cartItem.UnitQuantity=parseFloat(e)}resizeCloudinaryImage(e){return e&&(e=e.replace("w_80","w_150")),e}onDiscountAmountChange(e){this.isDiscMultipliciedQty?this.cartItem.DiscountAmount=e:this.cartItem.DiscountAmount=e/this.cartItem.Quantity}onSwitchToggleDiscount(){this.isDiscMultipliciedQty?this.cartItem.DiscountAmount=this.cartItem.DiscountAmount*this.cartItem.Quantity:this.cartItem.DiscountAmount=this.cartItem.DiscountAmount/this.cartItem.Quantity}onEditCost(){let e=!this.enabledEditCost();this.enabledEditCost.set(e),this.cdRef.detectChanges(),this.enabledEditCost()&&this._costElement.nativeElement?.focus()}onCalculatorValueChange(e){this.cartItem.Discount=e.discount,this.cartItem.Price=e.price,this.cartItem.Quantity=e.qty}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(i){return new(i||o)(m(j),m(Ae),m(De),m(Y),m(L),m(W),m(N),m(Fi),m(ee),m(Z),m(re),m(qr),m(de),m(qe),m(No))};static \u0275cmp=w({type:o,selectors:[["POS-modal-item"]],viewQuery:function(i,n){if(i&1&&(Eo(n.calculatorTab,kt,5),Se(cc,5),Se(pc,5),Se(dc,5),Se(mc,5)),i&2){Ro();let l;ye(l=xe())&&(n._quantityElement=l.first),ye(l=xe())&&(n._priceElement=l.first),ye(l=xe())&&(n._discountElement=l.first),ye(l=xe())&&(n._costElement=l.first)}},standalone:!1,features:[Mi],decls:18,vars:15,consts:[["variant",""],["itemTemplate",""],["quantity",""],["PRICE",""],["price",""],["DISCOUNT",""],["AMOUNT",""],["discount",""],["SHOW_IMAGE",""],["unitCost",""],[3,"onOk","onCancel","onClose","config"],[1,"mb-5"],[1,"container","w-100","h-100"],[1,"row","border-bottom","mt-8","mx-5"],["data-cy","input_sell",1,"btn","btn-link-tab",3,"click","ngClass"],["data-cy","product",1,"btn","btn-link-tab",3,"click","ngClass"],["class","btn btn-link-tab","data-cy","product",3,"ngClass","click",4,"ngIf"],["class","btn btn-link-tab","data-cy","serial",3,"ngClass","click",4,"ngIf"],["data-cy","serial",1,"btn","btn-link-tab",3,"ngClass"],[1,"mx-8"],[4,"ngIf"],[3,"hidden"],["data-cy","serial",1,"btn","btn-link-tab",3,"click","ngClass"],[1,"py-8"],[1,"alert","alert-warning","text-center","my-5","py-3"],["class","row",3,"ngClass",4,"ngIf"],[1,"row","mt-6"],["class","col-auto pe-0",4,"ngIf"],[1,"row","mt-6","mb-5"],[1,"col","tinymce"],["height","210px",3,"ngModelChange","ngModel"],[1,"row"],[1,"col"],["inputID","product","requestUrl","/API/AC/GetVariantSuggestionByCodeNName","placeholder","Input product name / code",1,"form-control",3,"onSelect","onInputEnter","localStorage","renderThumbnail","inputTextValue","clearOnSelect","useCustomTemplate","itemTemplate"],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"ms-3","text-wrap","text-break"],[1,"opacity-75"],[1,"fw-bold"],[1,"row",3,"ngClass"],[1,"col-auto","mb-4","pe-0",2,"width","145px"],[1,"input-group"],["type","button","id","button-addon1",1,"btn","btn-outline-secondary","fw-bold","rounded-0","fs-2","border-end-0","py-4","cart-input","d-flex","align-items-center","qty_btn","justify-content-center",3,"click","ngClass","disabled"],["id","txtCartQuantity","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","input-numpad","cart-input","text-center",3,"ngModelChange","simpleKeyboard","preventNegative","decimalPlaces","ngModel","disabled"],["type","button","id","button-addon2",1,"btn","btn-outline-secondary","fw-bold","rounded-0","fs-5","border-start-0","py-4","cart-input","d-flex","align-items-center","qty_btn","justify-content-center",3,"click","ngClass","disabled"],["class","col-auto pe-0","style","width: 82px",4,"ngIf"],[1,"col-auto","pe-0",2,"width","112px",3,"hidden"],["class","form-control cart-input","disabled","",3,"value",4,"ngIf","ngIfElse"],[1,"col-auto","d-flex","align-items-center","pt-5"],[1,"col-auto","pe-0",2,"width","82px"],["type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input","input-numpad",3,"ngModelChange","preventNegative","readOnly","decimalPlaces","ngModel"],["disabled","",1,"form-control","cart-input",3,"value"],["id","inputPrice","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input",3,"ngModelChange","simpleKeyboard","readonly","ngModel"],[1,"bg-gradient-warning","py-4","px-2"],[1,"col-auto","pe-0"],["position","top","parent","body","bindValue","ID","bindLabel","Name","placeholder","Sales Person",3,"selectedChange","customTooltip","items","selected"],["bindLabel","Name","bindValue","ID","placeholder","Delivery Outlet","appendTo","body",2,"width","200px",3,"ngModelChange","items","ngModel"],[1,"col-6","border-end","py-8"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-6"],[1,"col-5"],[2,"width","112px"],[1,"row","d-flex","align-items-center","justify-content-start","mt-4"],[1,"d-flex","align-items-center","mt-4"],[1,"form-check","form-switch","form-switch-lg","ms-1","mt-1"],["type","checkbox","id","flexSwitchCheckDefault",1,"form-check-input",3,"ngModelChange","ngModel"],[1,"ms-4"],["matTooltipPosition","above","matTooltip",`Use the final discount amount if you want to discount the price of the total
|
|
7
7
|
quantity of the product. The nominal will be calculated automatically and filled in the discount amount box.`,1,"pointer"],[1,"fa-solid","fa-info-circle","ms-2"],[1,"col-6","py-8"],[1,"w-100","text-center"],[1,"text-start","mt-12"],[1,"row","mt-12"],[1,"w-100","d-flex","align-items-center","justify-content-end"],[1,"mx-1","fw-bold"],[1,"w-100","d-flex","justify-content-end"],[1,"w-100","d-flex","justify-content-end","mt-2"],["id","inputDiscount","keyboardType","number","type","text","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","cart-input",3,"ngModelChange","simpleKeyboard","ngModel","preventNegative","readonly"],["id","inputDiscAmount","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input",3,"ngModelChange","max","simpleKeyboard","ngModel","preventNegative","readonly"],[1,"border","ps-6",2,"height","38px","padding-top","10px","width","112px","background-color","#e9ecef"],["bindLabel","Name","bindValue","ID","placeholder","Pricebook","appendTo","body",2,"width","140px",3,"ngModelChange","clear","items","ngModel","disabled"],[1,"d-flex","align-items-center","justify-content-end","mt-2"],[1,"fw-bold","text-danger"],[1,"d-flex","align-items-center","justify-content-end","mt-2","text-danger"],[1,"text-danger"],[1,"row","border-top","mx-0","px-0","mt-4"],[1,"col-6","d-flex","justify-content-end","mt-4"],[1,"col-sm-4","d-flex","justify-content-center","flex-column","align-items-center","text-body-secondary","py-8"],["target","_blank",2,"color","inherit",3,"routerLink","queryParams"],[4,"ngIf","ngIfElse"],[1,"col-sm-8","py-8"],[1,"col-12"],[1,"d-flex"],["aria-hidden","true",1,"fa-archive","fa-solid","fa-1x","pt-3","pe-2"],[2,"font-size","15px","font-family",'"Roboto Slab"'],[1,"table","table-bordered","text-center","inventory-table"],[1,"table-light","py-6","border-end",2,"text-transform","none"],[1,"table-light","py-6",2,"text-transform","none"],[1,"py-6"],[1,"table","table-bordered",2,"width","171px"],["class","col-6",4,"ngIf"],[1,"text-center"],["aria-hidden","true",1,"fa-solid","fa-image","fa-5x"],[1,"border","rounded",3,"src"],[1,"table-light",2,"text-transform","none","width","20px"],[1,"p-0"],[1,"d-flex","align-items-center"],[3,"ngClass"],["matTooltip","This field is editable","matTooltipPosition","above","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","border-0","bg-white","text-end","pe-2",3,"ngModelChange","ngModel"],[1,"w-100","text-end","ps-8","pe-2",3,"ngClass"],["type","button","matTooltip","This field is editable","matTooltipPosition","above",1,"text-d",3,"click"],[1,"fa-solid","fa-pen-to-square","fa-lg","cursor","mx-2"],[1,"table-light",2,"text-transform","none"],[1,"pe-4","text-end"],[1,"p-3","text-end"],["ngClass","ms-3"],[1,"table","table-bordered","text-center"],[1,"table-light"],[1,"row","mt-8"],[1,"fa-solid","fa-book","fa-1x","pt-3","pe-2"],[1,"table-light","py-6","border-end",2,"text-transform","none","width","70px"],[4,"ngFor","ngForOf"],[3,"cartItemChange","serialsChange","entityId","cartItem","disabled","serials"],[3,"discountTotal","priceTotal","qtyTotal","noteChanges","notes","price","discount","quantity","variantName","disabledQty"]],template:function(i,n){i&1&&(r(0,"modal-material",10),g("onOk",function(h){return n.onOk(h)})("onCancel",function(){return n.onCancel()})("onClose",function(){return n.onCancel()}),r(1,"content",11)(2,"div",12)(3,"div",13)(4,"div")(5,"a",14),g("click",function(){return n.onTabChange(n.modalItemState.SELL_INPUT)}),d(6," Cart "),a(),r(7,"a",15),g("click",function(){return n.onTabChange(n.modalItemState.DISCOUNT)}),d(8," Discount "),a(),_(9,gc,2,3,"a",16)(10,_c,2,3,"a",17)(11,Cc,2,3,"a",18),a()(),r(12,"div",19),_(13,wc,11,6,"ng-container",20)(14,Hc,59,22,"ng-container",20)(15,Xc,41,19,"ng-container",20)(16,Zc,2,4,"ng-container",20)(17,ep,2,7,"div",21),a()()()()),i&2&&(p("config",n.modalConfig),s(5),p("ngClass",R(11,yi,n.modalItemState.SELL_INPUT==n.currentState)),s(2),p("ngClass",R(13,yi,n.modalItemState.DISCOUNT==n.currentState)),s(2),p("ngIf",(n.cartItem==null||n.cartItem.Variant==null?null:n.cartItem.Variant.Name)&&n.hasInventoryView),s(),p("ngIf",n.isSerialItem),s(),E(n.productCalculator()?11:-1),s(2),p("ngIf",n.modalItemState.SELL_INPUT==n.currentState),s(),p("ngIf",n.modalItemState.DISCOUNT==n.currentState),s(),p("ngIf",n.modalItemState.PRODUCT==n.currentState),s(),p("ngIf",n.modalItemState.SERIAL==n.currentState),s(),E(n.productCalculator()?17:-1))},dependencies:[q,be,z,te,Lt,K,oe,U,mt,Vn,st,ce,dt,Nt,$r,aa,Wt,Ai,kt,Z,ur],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.tinymce[_ngcontent-%COMP%] a[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{z-index:2;position:absolute;right:15px;bottom:19px}.tinymce[_ngcontent-%COMP%] editor[_ngcontent-%COMP%]{height:max-content;z-index:1}.more[_ngcontent-%COMP%]{position:absolute;top:0;left:30px}.unit-qty[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100px}p-chips[_ngcontent-%COMP%]{width:100%}p-chips[_ngcontent-%COMP%] ul.ui-inputtext{width:100%}p-chips[_ngcontent-%COMP%] ul.ui-inputtext li input.undefined{border:none}.inventory-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .inventory-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{line-height:6px!important}.cart-input[_ngcontent-%COMP%]{height:36px!important}.table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{vertical-align:middle;line-height:15px}ng-select-infinite[_ngcontent-%COMP%] div.ng-select-container{width:200px!important}.form-check-input[_ngcontent-%COMP%]{clear:left}.form-switch.form-switch-lg[_ngcontent-%COMP%] .form-check-input[_ngcontent-%COMP%]{height:1.5rem;width:2.75rem;border-radius:3rem}.form-check-input[_ngcontent-%COMP%]:focus{border-color:#89b03e!important}.form-check-input[_ngcontent-%COMP%]:checked{border-color:#89b03e!important;background-color:#89b03e!important}.qtyBtn-disabled[_ngcontent-%COMP%]{background-color:#e9ecef;color:#000!important}button.qty_btn[_ngcontent-%COMP%]{background:#eee;border:1px solid #ddd;width:36px}"]})};var tp=o=>({"is-invalid":o});function ip(o,t){o&1&&(r(0,"div",6)(1,"span"),d(2,"Host URL is required."),a()())}var An=class o{constructor(t){this.dialogRef=t;this.config.title="Connect ECR",this.config.customWidth="400px"}config=new H;urlCtrl=new ht("https://localhost:5001/EcrHub",[ui.required]);onClose(){this.dialogRef.close()}onConnect(){this.urlCtrl.valid&&this.dialogRef.close(this.urlCtrl.value)}static \u0275fac=function(e){return new(e||o)(m(j))};static \u0275cmp=w({type:o,selectors:[["app-modal-connect-ecr"]],decls:10,vars:7,consts:[[3,"onCancel","onClose","onOk","config","dynamicValidated"],[1,"d-flex","flex-column",2,"row-gap","1.5rem"],[1,"fw-normal"],[1,"form-floating-outline"],["id","floatingInput","placeholder","https://localhost:4001/EcrHub","type","text",1,"form-control",3,"ngClass","formControl"],["for","floatingInput"],[1,"invalid-feedback"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()})("onOk",function(){return i.onConnect()}),r(1,"content")(2,"div",1)(3,"h4",2),d(4,"Please input the ECR Host URL:"),a(),r(5,"div",3),C(6,"input",4),r(7,"label",5),d(8,"Host URL"),a(),_(9,ip,3,0,"div",6),a()()()()),e&2&&(p("config",i.config)("dynamicValidated",i.urlCtrl.valid),s(6),p("ngClass",R(5,tp,i.urlCtrl.invalid&&(i.urlCtrl.touched||i.urlCtrl.dirty)))("formControl",i.urlCtrl),s(3),E(i.urlCtrl.invalid&&(i.urlCtrl.touched||i.urlCtrl.dirty)?9:-1))},dependencies:[X,q,ve,U,ze,te,K,bt],encapsulation:2})};function np(o,t){if(o&1){let e=v();I(0),r(1,"div",14)(2,"radio-options",15),D("modelChange",function(n){u(e);let l=c(2);return M(l.odsConfigType,n)||(l.odsConfigType=n),f(n)}),a(),r(3,"label",16),d(4,"Choose Configuration"),a()(),O()}if(o&2){let e=t.ngIf,i=c(2);s(2),P("model",i.odsConfigType),p("options",e.options.OrderDisplayBroadcastModeType)}}function op(o,t){if(o&1&&(I(0),_(1,np,5,2,"ng-container",13),b(2,"async"),O()),o&2){let e=c();s(),p("ngIf",x(2,1,e.odsConfig$))}}function rp(o,t){o&1&&(r(0,"div",17)(1,"div",18),C(2,"i",19),a(),r(3,"div",20)(4,"div"),d(5," Choose outlet first before configuring Order Display! "),a()()())}var Ln=class o{constructor(t,e,i,n){this.dialogRef=t;this.httpService=e;this.outletRegisterService=i;this.data=n;this.modalConfig=new H,this.modalConfig.title="Order Display Broadcast Configuration",this.modalConfig.okText="Save (F2)",this.modalConfig.customWidth="460px"}modalConfig;odsConfigType=1;odsLink="https://ods.dealpos.app";odsConfig$;hasOutlet=!1;ngOnInit(){let t=this.outletRegisterService.Data?.EntityID;this.hasOutlet=!!t,this.hasOutlet&&this.loadOdsConfig()}loadOdsConfig(){let t=this.outletRegisterService.Data.EntityID;this.odsConfig$=this.httpService.get(`/api/outlet/GetOrderDisplayBroadcastMode?EntityID=${t}`).pipe(Ne(e=>{this.odsConfigType=e.form?.OrderDisplayBroadcastMode}),ai(e=>(console.error("Error loading ODS configuration:",e),eo({form:{EntityID:null,OrderDisplayBroadcastMode:0},options:{OrderDisplayBroadcastModeType:[{Key:0,Value:"Off"},{Key:1,Value:"Park"},{Key:2,Value:"Pay"},{Key:3,Value:"Park and Pay"}]}}))),Rt(1))}onSave(){let e={EntityID:this.outletRegisterService.Data.EntityID,OrderDisplayBroadcastMode:this.odsConfigType};this.httpService.post("/api/outlet/UpdateOrderDisplayBroadcastMode",e).pipe(Ne(()=>{this.dialogRef.close(e)}),ai(i=>(console.error("Error saving ODS configuration:",i),eo(null)))).subscribe()}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||o)(m(j),m(Qe),m(Y),m(Ae))};static \u0275cmp=w({type:o,selectors:[["modal-ods-config"]],decls:18,vars:4,consts:[["outletWarning",""],[3,"onOk","onClose","onCancel","config"],[1,"container"],[1,"row"],[1,"col-12","text-center"],[4,"ngIf","ngIfElse"],[1,"text-center","mt-4"],[1,"m-0"],[1,"col-12","mt-2"],[1,"text-center"],["src","https://res.cloudinary.com/dealpos-m/image/upload/w_180/v1746771410/dealpos%20app/dealpos_order_fulfillment_u7xzqe.png","alt","Order Display System",1,"img-fluid","mb-4"],[1,"mb-0"],["target","_blank",1,"fw-bold",3,"href"],[4,"ngIf"],[1,"form-floating-outline","radio","border","rounded","mt-4",2,"height","auto !important"],["id","odsConfigType",3,"modelChange","model","options"],["for","odsConfigType"],[1,"warning-banner","mt-4","d-flex","align-items-center","p-3","border","rounded","bg-light"],[1,"ms-2","me-3"],[1,"fas","fa-exclamation-triangle","text-warning","fa-lg"],[1,"warning-text"]],template:function(e,i){if(e&1){let n=v();r(0,"modal-material",1),g("onOk",function(){return u(n),f(i.onSave())})("onClose",function(){return u(n),f(i.onClose())})("onCancel",function(){return u(n),f(i.onClose())}),r(1,"content")(2,"div",2)(3,"div",3)(4,"div",4),_(5,op,3,3,"ng-container",5)(6,rp,6,0,"ng-template",null,0,J),r(8,"div",6)(9,"p",7),d(10," This feature is used for monitoring incoming orders on a secondary screen, commonly used in the warehouse area. You can choose when the orders should appear on the display. "),a()()(),r(11,"div",8)(12,"div",9),C(13,"img",10),r(14,"p",11),d(15," You can access this feature through "),r(16,"a",12),d(17,"ods.dealpos.app"),a()()()()()()()()}if(e&2){let n=Q(7);p("config",i.modalConfig),s(5),p("ngIf",i.hasOutlet)("ngIfElse",n),s(11),p("href",i.odsLink,tt)}},dependencies:[X,z,Ve,fe,Ei,Ti,ve,U],styles:[".warning-banner[_ngcontent-%COMP%]{box-shadow:-3px 0 #ffc107;background-color:#fff9e8!important;padding:5px;border-radius:12px;margin-bottom:15px;display:flex;align-items:center}.warning-text[_ngcontent-%COMP%]{padding:5px}"]})};function ap(o,t){if(o&1&&(r(0,"span",11),d(1),a()),o&2){let e=c().$implicit;s(),y(": ",e.value,"")}}function lp(o,t){if(o&1&&(r(0,"p",6),d(1),_(2,ap,2,1,"span",11),a()),o&2){let e=t.$implicit;s(),y(" ",e.label," "),s(),E(e.value?2:-1)}}function sp(o,t){if(o&1&&(r(0,"div",7)(1,"p",13)(2,"span",14),d(3," Valid until "),r(4,"span",15),d(5),b(6,"date"),a()()()()),o&2){let e=c(2);s(5),T(ne(6,1,e.coupon==null||e.coupon.Requirement==null?null:e.coupon.Requirement.ExpiryDate,"longDate"))}}function cp(o,t){if(o&1&&_(0,sp,7,4,"div",12),o&2){let e=c();p("ngIf",(e.coupon==null||e.coupon.Requirement==null?null:e.coupon.Requirement.ExpiryDate)!=="0001-01-01T00:00:00")}}function pp(o,t){o&1&&(r(0,"p",16),C(1,"i",17),r(2,"span",15),d(3,"Edit Mode: "),a(),d(4," Coupon information is displayed for reference only. Coupon removal is not available in edit mode. "),a())}function dp(o,t){o&1&&(r(0,"p",10),C(1,"i",18),r(2,"span",15),d(3,"Important: "),a(),d(4," Removing the coupon removes the invoice level discount. Any discounts already applied to individual items will be kept. "),a())}function mp(o,t){if(o&1&&_(0,pp,5,0,"p",16)(1,dp,5,0,"p",10),o&2){let e=c();E(e.isRemoveCouponOnEdit()?1:0)}}function up(o,t){o&1&&(r(0,"p",10),C(1,"i",18),r(2,"span",15),d(3,"Important: "),a(),d(4,"Removing this coupon will reset your cart to its original state. All discounts and price changes from this coupon will be removed. "),a())}var Bn=class o{dialogRef=ie(j);decimalPipe=ie(Z);couponService=ie(Xe);couponProviderService=ie(xt);salesOrder=ie(N);orderProcessorService=ie(W);posService=ie(L);modalConfig;couponLabel=V(null);couponRequirements=V([]);coupon=this.couponService.coupon;couponProvider=this.couponProviderService.coupon;isEdit=V(!1);isRemoveCouponOnEdit=Vo(()=>this.posService.Data?.AppConfigJSON?.ModuleSell?.RemoveCouponOnEdit);constructor(){this.initModalConfig(),this.initCouponLabel(),this.generateCouponRequirement()}initModalConfig(){let t=this.orderProcessorService.Data.posState;this.modalConfig=new H,this.modalConfig.title=this.generateDialogTitle(),this.modalConfig.customWidth="400px",this.isEdit.set(t===2),t===2?(this.isRemoveCouponOnEdit()?(this.modalConfig.okText="Remove",this.modalConfig.hideCancel=!0):(this.modalConfig.hideOk=!0,this.modalConfig.cancelText="Close"),this.isEdit.set(!0)):(this.modalConfig.okText="Remove",this.modalConfig.hideCancel=!0)}generateDialogTitle(){let t=this.salesOrder?.Data?.Order?.PromotionCoupon;return`Coupon ${this.maskCouponCode(t)} Applied`}maskCouponCode(t){return t?`***${t.slice(-2)}`:""}generateCouponRequirement(){let t=[];if(this.coupon?.ApplyToProduct?.length>0&&t.push({label:"Required Specific Product",value:null}),this.coupon?.Requirement?.MaximumDiscount&&t.push({label:"Maximum Discount",value:`Rp. ${this.decimalPipe.transform(this.coupon?.Requirement?.MaximumDiscount)}`}),this.coupon?.Requirement?.MinimumSpendingAmount&&t.push({label:"Minimum Spending",value:`Rp. ${this.decimalPipe.transform(this.coupon?.Requirement?.MinimumSpendingAmount)}`}),this.coupon?.Requirement?.FullPriceProductOnly&&t.push({label:"Full Price Product Only",value:null}),S.IsNotEmpty(this.coupon?.Requirement?.CustomerName)){let i=this.coupon?.Requirement?.CustomerName,n=this.coupon?.Requirement?.CustomerCode;t.push({label:"Exclusive for "+i+(n?` - ${n}`:""),value:null})}this.coupon?.Requirement?.CouponDeductedAmount&&t.push({label:"Point Deduction",value:`${this.decimalPipe.transform(this.coupon?.Requirement?.CouponDeductedAmount)}`}),this.couponRequirements.set(t)}initCouponLabel(){let t=this.couponProviderService.coupon||this.couponService.coupon,e=this.couponProviderService.coupon,i="";if(!t){this.couponLabel.set("");return}if(e)e.Type==="Percentage"?i=`${this.decimalPipe.transform(e.Amount)}% Discount`:i=`Rp. ${this.decimalPipe.transform(e.Amount)} Discount`;else switch(t?.Requirement?.Type){case 2:i=`Rp. ${this.decimalPipe.transform(t?.Amount)} Discount`;break;case 1:i=`${this.decimalPipe.transform(t?.Amount)}% Discount`;break;case 5:i="Authorize Full Access";break;case 4:i="Authorize Parked Deletion";break;case 3:i="Authorize Return";break;case 6:i="Authorize Delete Item";break;default:i="Coupon Applied";break}this.couponLabel.set(i)}onClose(){this.dialogRef.close(!1)}onRemove(){this.dialogRef.close(!0)}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=w({type:o,selectors:[["app-modal-confirm-remove-coupon"]],decls:15,vars:4,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container-fluid"],[1,"card","coupon-card","mb-8"],[1,"card-body","text-center",2,"padding","0.2rem"],[1,"mb-6","badge","text-bg-success","fs-3","text-white"],[1,"d-flex","flex-column","gap-4"],[1,"mb-0"],[1,"valid-date","d-flex","justify-content-center"],[1,"card","warning-card","mb-0"],[1,"card-body","d-flex","justify-content-center","align-items-center"],[1,"warning-msg","mb-0","text-warning-emphasis"],[1,"text-success","fw-semibold"],["class","valid-date d-flex justify-content-center",4,"ngIf"],[1,"mb-0","p-4"],[1,"opacity-75"],[1,"fw-bold"],[1,"warning-msg","mb-0","text-info-emphasis"],[1,"fa-solid","fa-info-circle","text-info","me-2","fw-bold"],[1,"fa-solid","fa-triangle-exclamation","text-warning","me-2","fw-bold"]],template:function(e,i){e&1&&(r(0,"modal-material",0),g("onOk",function(){return i.onRemove()})("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"span",4),d(6),a(),r(7,"div",5),si(8,lp,3,2,"p",6,li),_(10,cp,1,1,"div",7),a()()(),r(11,"div",8)(12,"div",9),_(13,mp,2,1)(14,up,5,0,"p",10),a()()()()()),e&2&&(p("config",i.modalConfig),s(6),T(i.couponLabel()),s(2),ci(i.couponRequirements()),s(2),E(!(i.coupon==null||i.coupon.Requirement==null)&&i.coupon.Requirement.ExpiryDate?10:-1),s(3),E(i.isEdit()?13:14))},dependencies:[X,z,We,ve,U],styles:['body[_ngcontent-%COMP%]{font-family:Roboto Slab,serif;background:linear-gradient(135deg,#f5f7fa,#c3cfe2);min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}.coupon-card[_ngcontent-%COMP%]{background:linear-gradient(135deg,#f8f9fa,#e9ecef);border-radius:12px;padding:24px;border:2px solid #89b03e;position:relative;overflow:hidden}.coupon-card[_ngcontent-%COMP%]:before{content:"";position:absolute;top:0;left:0;right:0;height:4px;background:linear-gradient(90deg,#89b03e,#a4c449)}.valid-date[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{border:1px solid #e0e0e0;border-radius:4px;box-shadow:-3px 0 #c5e1a5;width:300px;background-color:#f7fbf0!important}.warning-card[_ngcontent-%COMP%]{border-radius:4px;box-shadow:-3px 0 #ffc107;background-color:#fff9e8!important}.badge[_ngcontent-%COMP%]{display:inline-block;background:linear-gradient(135deg,#89b03e,#a4c449);color:#fff;padding:12px 24px;border-radius:50px;font-size:1.4rem;font-weight:700;margin-bottom:20px;box-shadow:0 4px 15px #89b03e4d}']})};var Dt=class o{constructor(t,e,i,n,l,h,A,le,Te,Fe,je,oi,wt,Yn,Xn,ri){this.roleService=t;this.orderProcessorService=e;this.promotionService=i;this.promotionCouponService=n;this.promotionCouponProvider=l;this.dialog=h;this.parkOrderService=A;this.salesOrderService=le;this.outletRegisterService=Te;this.pageInitialService=Fe;this.toastrService=je;this.httpService=oi;this.shoppingCartService=wt;this.customerDisplay=Yn;this.ecrService=Xn;this.ecrSignalR=ri;this.destroy$=new G,this.sourceMenu=[...Oa],this._moreMenu=new Zn(this.sourceMenu),this.moreMenu$=this._moreMenu.asObservable(),this.initElgiblePromotion(),this.subscribeObservable()}_moreMenu;moreMenu$;eligiblePromotions$;destroy$;sourceMenu;_enabledDragDrop=new Zn(!0);enabledDragDrop$=this._enabledDragDrop.asObservable();subscribeObservable(){xi([this.orderProcessorService.Data$,this.salesOrderService.Data$]).pipe(k(this.destroy$)).subscribe(([t,e])=>{this.filterMoreMenu(t.posState)}),this.roleService.Data$.pipe(k(this.destroy$)).subscribe({next:()=>{this.filterMoreMenu(0)}})}initElgiblePromotion(){this.eligiblePromotions$=this.promotionService.Data$.pipe(et(()=>this.promotionService.getTotalEligiblePromotion()))}moreMenuAction(t){switch(t){case"ADD_ITEM":this.dialog.open($e);break;case"COUPON":let e=this.salesOrderService.Data?.Order?.PromotionCoupon;S.IsNotEmpty(e)?this.dialog.open(Bn).afterClosed().pipe(se(n=>n)).subscribe(()=>this.removePromotionCoupon()):this.dialog.open(yn);break;case"PROMOTION":this.dialog.open(Ki,{id:"promotion-event"});break;case"UPLOAD":this.onImportItems();break;case"RETURN":this.dialog.open(xn);break;case"CLEAR":this.dialog.open(Sn);break;case"SERIAL":this.dialog.open(In);break;case"SPLIT":this.onSplitItem();break;case"PRINT":this.parkOrderService.onPrintRetrieve();break;case"CANCEL":this.onCancel();break;case"SYNC":this.dialog.open(Mn);break;case"FULFILLMENT":this.onFulfillment();break;case"RETRIEVE":this.onRetrieve();break;case"INVENTORY":this.checkAvailableInventory();break;case"SORT":let i=!this._enabledDragDrop.value;this.enableDragDrop(i);break;case"CUSTOMER_DISPLAY":this.confirmEnabledCustomerDisplay();break;case"ECR":this.openModalInputEcrUrl();break;case"ODS_CONFIG":this.openOdsConfigDialog();break}}removePromotionCoupon(){let t=this.promotionCouponProvider.coupon;S.IsNotEmpty(t)?this.promotionCouponProvider.removeCoupon():this.promotionCouponService.removeAppliedCoupon()}openOdsConfigDialog(){this.dialog.open(Ln).afterClosed().pipe(se(t=>!!t)).subscribe(()=>{this.toastrService.success("Order Display Configuration applied successfully","Success")})}openModalInputEcrUrl(){this.ecrSignalR.isConnected()?this.confirmDisableEcr():this.dialog.open(An).afterClosed().pipe(se(e=>!!e)).subscribe(e=>{this.ecrSignalR.initConnection(e)})}confirmDisableEcr(){this.dialog.open(gi,{data:{title:"Disconnect ECR",message:"Are you sure you want to disconnect ECR?",okText:"OK",headerType:Le.Warning},width:"500px"}).afterClosed().pipe(se(t=>t),Ne(()=>{this.ecrService.disconnect(),this.ecrSignalR.stopConnection()})).subscribe(()=>{this.toastrService.success("ECR is disconnected","Success")})}confirmEnabledCustomerDisplay(){let t=this.customerDisplay.isEnabled(),e;t?e={title:"Disconnect from Customer Display",message:`
|
|
8
8
|
<div class="text-center">
|
|
@@ -54,4 +54,4 @@ Printing in 8mm format instead!`,"Error!"),this.printReceiptMini(),t}),Ne(()=>{t
|
|
|
54
54
|
Please add the tag <a href="/menu/Setup/Tag/Sales_Order">here</a> to continue.
|
|
55
55
|
</p>
|
|
56
56
|
`,headerType:Le.Error},width:"28rem"})}initializeRole(){let e=new Mr(this.roleService);this.userRoleService.pushNewValue(e)}subscribeToObservable(){this.orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.currentState=e.posState}),this.signalRClientService.OnPaymentReceived.pipe(k(this.destroy$)).subscribe(e=>{this.onQRPaymentComplete(e)}),this.outletService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.outletRegister=e,this.onOpenDialogOfflineOrder()}),this.userRoleService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.userRole=e}),this.parkOrderService.onPrint$.pipe(k(this.destroy$)).subscribe(e=>{switch(this.isPrintBillA4=!1,this.isPrintBillMini=!1,this.isPrintPark=!1,this.receiptTemplate=e.template,e.type){case"BILL_A4":this.isPrintBillA4=!0;break;case"BILL_MINI":this.isPrintBillMini=!0;break;case"PARK":this.isPrintPark=!0;break}this.receiptService.printWindow().finally(()=>{this.receiptTemplate=null})})}onQRPaymentComplete(e){if(!S.IsEmpty(e)){let i=JSON.parse(e);this.paymentServiceGateway.onQRPaymentComplete(i,this.posHttpResponse.AppConfigJSON).then(n=>{this.dialog.getDialogById("ModalPayment").close();let A=`IDR ${this.decimalPipe.transform(i.gross_amount)} received. Please verify in customer mobile app!`;this.toastr.success(A," QR Settlement"),this.paymentServiceGateway.clearTransactionID(),this.orderProcessorService.updatePosState(1,n)}).catch(n=>{this.toastr.error(n.message,n.header?n.header:"Error")})}}editInvoice(e){this.orderProcessorService.updatePosState(2),this.orderHttpService.GetInvoiceBySoID(e).pipe(k(this.destroy$)).subscribe(i=>{this.invoiceNumberEdit=i.Invoice.Number,i.Invoice.Number=null,this.orderProcessorService.plainToClass(i)})}initEcrSignalR(){if(this.ecrSignalRService.isConnected()){let i=this.ecrStorage.ecrUrl();this.ecrSignalRService.initConnection(i)}}openModalConfirmContinueEdit(e,i){this.currentState==2?this.dialog.open(Fn).afterClosed().pipe(se(n=>!S.IsEmpty(n))).subscribe(n=>{if(n==="CONTINUE_EDITING"){let l=this.salesOrderService.Data?.Order?.ID;this.router.navigate(["/menu/Sell"],{queryParams:{ID:l},queryParamsHandling:"merge"})}else n==="CREATE_NEW_ORDER"&&(this.orderProcessorService.createNewTransactionInSameOutletRegister(!0),this.orderProcessorService.emitClearOrder())}):this.outletService.setActiveRegisterFromOptions(e,i)}ngOnDestroy(){this.intercomService.showLauncher(),this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(i){return new(i||o)(m(Ye),m(L),m(Y),m(Ho),m(Uo),m(W),m(Z),m(Qi),m(re),m(ee),m(ke),m(de),m(Ot),m(Pe),m(Ft),m(Ko),m(lr),m(jt),m($t),m(zi),m(Ct),m(qe),m(Qe),m(xt),m(Xe),m(N))};static \u0275cmp=w({type:o,selectors:[["POS-sell-v3"]],features:[at([ke,Dt]),Mi],decls:9,vars:8,consts:[["COMPLETE",""],[1,"d-block","d-print-none"],[1,"container-fluid","sell-container",3,"ngClass"],[4,"ngIf","ngIfElse"],[1,"print_containers"],[3,"data","printTemplate","config","stylesheet",4,"ngIf"],[3,"data","printTemplate","config","outletInfo","stylesheet",4,"ngIf"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo","stylesheet",4,"ngIf"],["class","row d-print-none",4,"ngIf"],[1,"row","d-print-none"],[1,"col-5","pe-6"],[1,"border-start","ps-6","col-7"],[1,"row"],[1,"col-12","px-0"],[3,"data","printTemplate","config","stylesheet"],[3,"data","printTemplate","config","outletInfo","stylesheet"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo","stylesheet"]],template:function(i,n){if(i&1&&(C(0,"subscription-alert",1),r(1,"div",2),_(2,Xm,2,1,"ng-container",3)(3,Zm,3,0,"ng-template",null,0,J),a(),r(5,"div",4),_(6,eu,1,4,"park-order",5)(7,tu,1,5,"POS-bill-receipt-A4",6)(8,iu,1,6,"pos-receipt",7),a()),i&2){let l=Q(4);s(),p("ngClass",R(6,Km,n.currentSubsStatus==n.subscriptionStatus.OVERDUE||n.currentSubsStatus==n.subscriptionStatus.SELL_ONLY)),s(),p("ngIf",n.currentState!=n.sellState.IsComplete&&n.currentState!=n.sellState.UploadOrderFail)("ngIfElse",l),s(4),p("ngIf",n.isPrintPark&&n.receiptTemplate),s(),p("ngIf",n.receiptTemplate&&n.isPrintBillA4),s(),p("ngIf",n.receiptTemplate&&n.isPrintBillMini)}},dependencies:[X,q,z,pn,Un,Zr,Kn,hn,ze,yt,Gi,Ji,en,Qr,Wr,Ur,Hr,vn,gr,ma],styles:[`.cart-background{background-color:#fcfdff}.sell-container{margin:0 auto!important;height:100%}.sell-container>.row{height:100%}.sell-container>.row>[class*=col-]{height:100%}.sell-container .quicky{overflow:hidden}.sell-subscription-overdue{height:calc(100vh - 3rem)!important;overflow-y:auto}.print_containers{display:none}@media print{.print_containers{display:block;text-align:left}.sell-subscription-overdue{height:auto!important;overflow-y:visible!important}}
|
|
57
|
-
`],encapsulation:2})},fy=[{path:"Offline",loadChildren:()=>import("./chunk-
|
|
57
|
+
`],encapsulation:2})},fy=[{path:"Offline",loadChildren:()=>import("./chunk-7OYSGU2F.js").then(o=>o.OfflineModule)},{path:"",loadComponent:()=>go}];export{go as SellV3Component,fy as routes};
|