dealpos 12.1.2 → 12.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/POS/1007.64c8cc3ded28ccb1.js +1 -0
- package/POS/115.8a9512d938caa3a5.js +1 -0
- package/POS/1296.3e8d1d008f166dda.js +1 -0
- package/POS/{1407.a7083e7e7bc81fae.js → 1407.80466f526f9a5690.js} +1 -1
- package/POS/1853.2c194132ca398d7e.js +1 -0
- package/POS/{1930.58f6c06a1f59ffd3.js → 1930.b9bb70d6730520ca.js} +1 -1
- package/POS/2107.d0e578625f887541.js +1 -0
- package/POS/2750.f342073a2623ea5c.js +1 -0
- package/POS/3194.4fcfde55f9bdde6a.js +1 -0
- package/POS/3353.e678000a240bdb7c.js +1 -0
- package/POS/3515.d7aed35a5aceac43.js +1 -0
- package/POS/3769.e368263cdc775039.js +1 -0
- package/POS/399.96bcf31d657e0b66.js +1 -0
- package/POS/4043.16e5d76985d6246a.js +1 -0
- package/POS/4934.3ee9d255777c5bd9.js +1 -0
- package/POS/6268.ead36af8c38f7f11.js +1 -0
- package/POS/6510.14447646e5a7ef31.js +1 -0
- package/POS/7298.381b89ac988d828d.js +1 -0
- package/POS/7516.505d603e9add16cc.js +1 -0
- package/POS/758.1fba419f75bf03f5.js +1 -0
- package/POS/7877.ab4bf7fc8586e349.js +1 -0
- package/POS/7998.5302896d0c9db51a.js +1 -0
- package/POS/8006.c38fc1521b07c34d.js +1 -0
- package/POS/805.1c4c89d4cdf6801a.js +1 -0
- package/POS/8094.40c9dbd00397a2aa.js +1 -0
- package/POS/8105.4e2c623cfa0ff583.js +1 -0
- package/POS/811.d8f8f513de18077a.js +1 -0
- package/POS/8126.854312dfdc0b1f4f.js +1 -0
- package/POS/8401.4efb657fcd6e715f.js +1 -0
- package/POS/8565.3bc7466174ccd064.js +1 -0
- package/POS/8589.3d2c8de6ba32144e.js +1 -0
- package/POS/8761.02889e0f8f0ed695.js +1 -0
- package/POS/9160.caf169c0eef97fd6.js +1 -0
- package/POS/9443.149bac97f22d4473.js +1 -0
- package/POS/9757.be13d738d1e4531e.js +1 -0
- package/POS/9987.a9ccb5b654187185.js +1 -0
- package/POS/common.0a53a2ee937b6d58.js +1 -0
- package/POS/index.html +3 -3
- package/POS/{main.351ca0ad10fff271.js → main.dce7265d8f0589c8.js} +1 -1
- package/POS/runtime.27981a320ca2cc9b.js +1 -0
- package/POS/{styles.2ce96e18b30a6cd0.css → styles.b19fd94b39fae1d6.css} +1 -1
- package/package.json +1 -1
- package/POS/1007.2bc3ce8f5dd2e4cf.js +0 -1
- package/POS/1948.7f0402046722ef9a.js +0 -1
- package/POS/2668.acf6eba59483e5a8.js +0 -1
- package/POS/2750.9a4d0a879ee4dfcf.js +0 -1
- package/POS/2884.0bb1fedf67e20bb1.js +0 -1
- package/POS/3194.f668266c4a683c52.js +0 -1
- package/POS/3235.fcc13d7b59195b69.js +0 -1
- package/POS/3353.f4d9cdd493ab8423.js +0 -1
- package/POS/343.e88bde0575f7f1ee.js +0 -1
- package/POS/3515.efafd89aad6b7419.js +0 -1
- package/POS/3769.e61d78ece5b4f667.js +0 -1
- package/POS/399.23765757e5c84fcb.js +0 -1
- package/POS/4858.e73110daab6e473a.js +0 -1
- package/POS/5378.3acd949c2e044dd5.js +0 -1
- package/POS/6268.ef89535634e02a3a.js +0 -1
- package/POS/6510.b80561634ec9b06e.js +0 -1
- package/POS/6551.7eacfdbe44b86a27.js +0 -1
- package/POS/6874.b02e51b0dfc8e78b.js +0 -1
- package/POS/7130.322c946ddf2c809f.js +0 -1
- package/POS/7298.f0cf5b37ef12b850.js +0 -1
- package/POS/7349.2964fa195ab722a3.js +0 -1
- package/POS/7516.f0dc7b7fa3a6c9bc.js +0 -1
- package/POS/7517.b79d72d81b734c6e.js +0 -1
- package/POS/7877.9d0e297f0dc0dbc5.js +0 -1
- package/POS/7998.c099ad139eac3560.js +0 -1
- package/POS/8094.e6ac22b8d45d02f6.js +0 -1
- package/POS/8105.b213ae7fc8248c4e.js +0 -1
- package/POS/811.ec10768809a621c7.js +0 -1
- package/POS/8126.0c03615b04770e0d.js +0 -1
- package/POS/8401.3b1aac89de7e8b27.js +0 -1
- package/POS/8589.513bf5e24dda8655.js +0 -1
- package/POS/9328.cc0069560e7de574.js +0 -1
- package/POS/9757.9c6926ce4950d859.js +0 -1
- package/POS/9844.ab6e847cdc495bcd.js +0 -1
- package/POS/common.0674fef1a8b7576e.js +0 -1
- package/POS/runtime.6fcc139112f37165.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkPOS=self.webpackChunkPOS||[]).push([[1007],{11007:(Ve,V,l)=>{l.r(V),l.d(V,{SellV3Module:()=>zn});var o=l(81180),g=l(36895),d=l(76359),I=l(58393),e=l(94650),E=l(3238);const L=["*"],ae=new e.OlP("MAT_CARD_CONFIG");let $=(()=>{class i{constructor(t){this.appearance=t?.appearance||"raised"}}return i.\u0275fac=function(t){return new(t||i)(e.Y36(ae,8))},i.\u0275cmp=e.Xpm({type:i,selectors:[["mat-card"]],hostAttrs:[1,"mat-mdc-card","mdc-card"],hostVars:4,hostBindings:function(t,n){2&t&&e.ekj("mat-mdc-card-outlined","outlined"===n.appearance)("mdc-card--outlined","outlined"===n.appearance)},inputs:{appearance:"appearance"},exportAs:["matCard"],ngContentSelectors:L,decls:1,vars:0,template:function(t,n){1&t&&(e.F$t(),e.Hsn(0))},styles:['.mdc-card{display:flex;flex-direction:column;box-sizing:border-box}.mdc-card::after{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:"";pointer-events:none;pointer-events:none}@media screen and (forced-colors: active){.mdc-card::after{border-color:CanvasText}}.mdc-card--outlined::after{border:none}.mdc-card__content{border-radius:inherit;height:100%}.mdc-card__media{position:relative;box-sizing:border-box;background-repeat:no-repeat;background-position:center;background-size:cover}.mdc-card__media::before{display:block;content:""}.mdc-card__media:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.mdc-card__media:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.mdc-card__media--square::before{margin-top:100%}.mdc-card__media--16-9::before{margin-top:56.25%}.mdc-card__media-content{position:absolute;top:0;right:0;bottom:0;left:0;box-sizing:border-box}.mdc-card__primary-action{display:flex;flex-direction:column;box-sizing:border-box;position:relative;outline:none;color:inherit;text-decoration:none;cursor:pointer;overflow:hidden}.mdc-card__primary-action:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.mdc-card__primary-action:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.mdc-card__actions{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;min-height:52px;padding:8px}.mdc-card__actions--full-bleed{padding:0}.mdc-card__action-buttons,.mdc-card__action-icons{display:flex;flex-direction:row;align-items:center;box-sizing:border-box}.mdc-card__action-icons{flex-grow:1;justify-content:flex-end}.mdc-card__action-buttons+.mdc-card__action-icons{margin-left:16px;margin-right:0}[dir=rtl] .mdc-card__action-buttons+.mdc-card__action-icons,.mdc-card__action-buttons+.mdc-card__action-icons[dir=rtl]{margin-left:0;margin-right:16px}.mdc-card__action{display:inline-flex;flex-direction:row;align-items:center;box-sizing:border-box;justify-content:center;cursor:pointer;user-select:none}.mdc-card__action:focus{outline:none}.mdc-card__action--button{margin-left:0;margin-right:8px;padding:0 8px}[dir=rtl] .mdc-card__action--button,.mdc-card__action--button[dir=rtl]{margin-left:8px;margin-right:0}.mdc-card__action--button:last-child{margin-left:0;margin-right:0}[dir=rtl] .mdc-card__action--button:last-child,.mdc-card__action--button:last-child[dir=rtl]{margin-left:0;margin-right:0}.mdc-card__actions--full-bleed .mdc-card__action--button{justify-content:space-between;width:100%;height:auto;max-height:none;margin:0;padding:8px 16px;text-align:left}[dir=rtl] .mdc-card__actions--full-bleed .mdc-card__action--button,.mdc-card__actions--full-bleed .mdc-card__action--button[dir=rtl]{text-align:right}.mdc-card__action--icon{margin:-6px 0;padding:12px}.mat-mdc-card{position:relative;border-radius:var(--mdc-elevated-card-container-shape, var(--mdc-shape-medium, 4px));background-color:var(--mdc-elevated-card-container-color, transparent);border-width:0;border-style:solid;border-color:var(--mdc-elevated-card-container-color, transparent)}.mat-mdc-card .mdc-card::after{border-radius:var(--mdc-elevated-card-container-shape, var(--mdc-shape-medium, 4px))}.mat-mdc-card-outlined{border-width:var(--mdc-outlined-card-outline-width, 1px);border-style:solid;border-color:var(--mdc-outlined-card-outline-color, transparent)}.mat-mdc-card-title,.mat-mdc-card-subtitle{display:block;margin:0}.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-title,.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-subtitle{padding:16px 16px 0}.mat-mdc-card-header{display:flex;padding:16px 16px 0}.mat-mdc-card-content{display:block;padding:0 16px}.mat-mdc-card-content:first-child{padding-top:16px}.mat-mdc-card-content:last-child{padding-bottom:16px}.mat-mdc-card-title-group{display:flex;justify-content:space-between;width:100%}.mat-mdc-card-avatar{height:40px;width:40px;border-radius:50%;flex-shrink:0;margin-bottom:16px;object-fit:cover}.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-subtitle,.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-title{line-height:normal}.mat-mdc-card-sm-image{width:80px;height:80px}.mat-mdc-card-md-image{width:112px;height:112px}.mat-mdc-card-lg-image{width:152px;height:152px}.mat-mdc-card-xl-image{width:240px;height:240px}.mat-mdc-card-subtitle~.mat-mdc-card-title,.mat-mdc-card-title~.mat-mdc-card-subtitle,.mat-mdc-card-header .mat-mdc-card-header-text .mat-mdc-card-title,.mat-mdc-card-header .mat-mdc-card-header-text .mat-mdc-card-subtitle,.mat-mdc-card-title-group .mat-mdc-card-title,.mat-mdc-card-title-group .mat-mdc-card-subtitle{padding-top:0}.mat-mdc-card-content>:last-child:not(.mat-mdc-card-footer){margin-bottom:0}.mat-mdc-card-actions-align-end{justify-content:flex-end}'],encapsulation:2,changeDetection:0}),i})(),S=(()=>{class i{}return i.\u0275fac=function(t){return new(t||i)},i.\u0275mod=e.oAB({type:i}),i.\u0275inj=e.cJS({imports:[E.BQ,g.ez,E.BQ]}),i})();var Q=l(99602),De=l(24537),fe=l(3848),N=l(9116),Z=l(24006),_e=l(93669);let He=(()=>{class i{}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)}),(0,o.Z)(i,"\u0275mod",e.oAB({type:i})),(0,o.Z)(i,"\u0275inj",e.cJS({imports:[g.ez,Z.u5,d.q,I.Q,S,E.XK,Q.FA,De.ZU,fe.Nh,N.Bz,_e.dr]})),i})();var $e=l(90287),C=l(99865),m=l(67327),k=l(77579),f=l(82722),T=l(67347),D=l(10832),Ge=l(71638),A=l(12227),Pe=l(58908),x=l(65938),R=l(97185),Ke=l(96700),G=l(89748),je=l(74683),We=l(37646),ze=l(84254),Xe=l(30012),K=(()=>{return(i=K||(K={}))[i.FLAT=0]="FLAT",i[i.GROUP=1]="GROUP",K;var i})(),F=l(39300),et=l(89156),ve=l(47130),P=l(57372),Ce=l(43225),be=l(77091);let j=(()=>{class i{constructor(t,n,r,s,p,h,_,y,M,J){(0,o.Z)(this,"httpService",void 0),(0,o.Z)(this,"receiptService",void 0),(0,o.Z)(this,"orderProcessorService",void 0),(0,o.Z)(this,"pageInitialService",void 0),(0,o.Z)(this,"salesOrderService",void 0),(0,o.Z)(this,"toastrService",void 0),(0,o.Z)(this,"promotionEventService",void 0),(0,o.Z)(this,"outletService",void 0),(0,o.Z)(this,"orderHttpService",void 0),(0,o.Z)(this,"dialog",void 0),(0,o.Z)(this,"_onPrint",void 0),(0,o.Z)(this,"onPrint$",void 0),this.httpService=t,this.receiptService=n,this.orderProcessorService=r,this.pageInitialService=s,this.salesOrderService=p,this.toastrService=h,this.promotionEventService=_,this.outletService=y,this.orderHttpService=M,this.dialog=J,this._onPrint=new k.x,this.onPrint$=this._onPrint.asObservable(),this.subscribeToObservable()}subscribeToObservable(){this.orderProcessorService.Data$.subscribe(t=>{t.posState==C.J.isPark&&this.emitParkReceipt(!0)})}getParkedOrder(t,n){return this.httpService.post(m.Wz.GetPark,{EntityID:t,RegisterID:n})}removeOrder(t,n){return this.httpService.post(n?m.Wz.VoidPark:m.Wz.RemovePark,{OrderID:t})}mergePark(t){return this.httpService.post(m.Wz.MergePark,t)}getOutstanding(t){return this.httpService.post(m.Wz.GetOutStanding,{EntityID:t})}parkOrder(){let t=this.salesOrderService.Data;if(0!=t.CartItems.length){if(this.validateCustomerRequired(this.pageInitialService.Data.AppConfigJSON,t)&&this.validateUsedPromotion(t)){if(m.gT.IsEmpty(t.Order.RegisterID))return void this.toastrService.warning(m.g7.emptyEntity,Ke.n.Warning);this.validateShowParkModal()}}else this.toastrService.warning("You must have at least one item","No Item in Cart!")}validateCustomerRequired(t,n){return!t.ModuleSell.Header.CustomerRequired||null!=n.Order.CustomerID||(this.toastrService.warning("Customer is needed before parking orders!","Missing customer!"),!1)}validateUsedPromotion(t){return!m.gT.IsNotEmpty(this.promotionEventService.selectedPromotion)&&!m.gT.IsNotEmpty(t.Order.AuthorizationKey)||(this.toastrService.warning("sorry, you're using a promotion, can't use park!","can't use park when using promotions!"),!1)}validateShowParkModal(){let t=this.outletService.Data.ParkLayoutPack,n=this.pageInitialService.Data.AppConfigJSON,r=this.salesOrderService.Data;if(t&&m.gT.IsNotEmpty(t.ID))this.orderProcessorService.Data.posState==C.J.IsRetrieve?this.showReparkModal():this.showParkSelectModal(n,r);else{if(!this.validateRetrieveMode(n))return;this.setDefaultParkNote(n),this.showParkInputModal()}}showParkSelectModal(t,n){let r=this.orderProcessorService.Data,s=this.outletService.Data.ParkLayoutPack;this.orderHttpService.getVacant(n.Order.EntityID).subscribe(p=>{this.dialog.open(We.$,{data:{title:r.posState==C.J.IsSplit?"Split Order":t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle,parkLayoutPack:s,qty:n.TotalQuantity,entityId:n.Order.EntityID,occupied:p.Orders,replaceWithAlias:t.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias}})})}showReparkModal(){this.dialog.open(Xe.E,{data:null}).afterClosed().subscribe(()=>{})}validateRetrieveMode(t){return t.ApplicationParkAndRetrieve.Advance.retreiveMode!=K.GROUP||(this.toastrService.error("Your retrieve config is in Group mode, to enable park please setting your Park layout at Outlet page","Error!"),!1)}setDefaultParkNote(t){const n=t.ApplicationParkAndRetrieve.UserInterfaceLabel.DefaultParkNoteValue,s=this.salesOrderService.Data;this.orderProcessorService.Data.posState!=C.J.IsEdit&&m.gT.IsNotEmpty(n)&&m.gT.IsEmpty(s.Order.Note)&&(this.salesOrderService.Data.Order.Note=n)}showParkInputModal(){let t="PARK Details";const r=this.outletService.Data.ParkLayoutPack;this.orderProcessorService.Data.posState==C.J.IsSplit&&(t="Split Detail"),this.dialog.open(je.P,{id:"park-form-modal",data:{title:t,labelDisable:r&&m.gT.IsNotEmpty(r.ID)||this.orderProcessorService.Data.posState==C.J.IsSplit,ParkLabel:this.salesOrderService.Data.Order.ParkLabel}})}onPrintRetrieve(){this.pageInitialService.Data.AppConfigJSON.ApplicationParkAndRetrieve.Basic.EnablePrintBill?this.dialog.open(ze.n).afterClosed().pipe((0,F.h)(r=>m.gT.IsNotEmpty(r))).subscribe(r=>{"ORDER"==r?this.emitParkReceipt(!1):this.emitBillReceipt()}):this.emitParkReceipt(!1)}emitParkReceipt(t){const n=this.receiptService.generateParkReceipt(t);this._onPrint.next({type:"PARK",template:n})}emitBillReceipt(){let n;G.LA.A4==this.outletService.Data.PrintTemplate.PrintMode?(n=this.receiptService.generateBillInvoice(),this._onPrint.next({type:"BILL_A4",template:n})):(n=this.receiptService.generateBillReceipt(),this._onPrint.next({type:"BILL_MINI",template:n}))}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.LFG(et.O),e.LFG(ve.V),e.LFG(A.d),e.LFG(T.W),e.LFG(P.q),e.LFG(R._W),e.LFG(Ce.D),e.LFG(D.o),e.LFG(be.D),e.LFG(x.uw))}),(0,o.Z)(i,"\u0275prov",e.Yz7({token:i,factory:i.\u0275fac})),i})();var w=l(38933),tt=l(51161),q=l(92127),W=l(76874);function it(i,a){if(1&i&&e._UZ(0,"img",20),2&i){const t=e.oxw().$implicit;e.Q6J("src",t.ImageURLClient,e.LSH)}}function nt(i,a){if(1&i&&(e.TgZ(0,"p",21),e._uU(1),e.ALo(2,"slice"),e.qZA()),2&i){const t=e.oxw().$implicit;e.xp6(1),e.Oqu(e.Dn7(2,1,t.Display,0,3))}}function ot(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"div",16)(1,"a",17),e.NdJ("click",function(){const s=e.CHM(t).$implicit,p=e.oxw(4);return e.KtG(p.onSelectProduct(s))}),e.YNc(2,it,1,1,"img",18),e.YNc(3,nt,3,5,"p",19),e.TgZ(4,"small"),e._uU(5),e.ALo(6,"slice"),e.qZA()()()}if(2&i){const t=a.$implicit;e.xp6(2),e.Q6J("ngIf",t.ImageURLClient),e.xp6(1),e.Q6J("ngIf",!t.ImageURLClient),e.xp6(2),e.Oqu(e.Dn7(6,3,t.Display,0,36))}}const Me=function(){return["/menu/Outlets/Master/Quick_Key_Templates/Form"]},rt=function(i){return{ID:i}};function at(i,a){if(1&i&&(e.TgZ(0,"mat-tab",9)(1,"div",10)(2,"div",11),e.YNc(3,ot,7,7,"div",12),e.TgZ(4,"div",13)(5,"a",14),e._UZ(6,"i",15),e.qZA()()()()()),2&i){const t=a.$implicit,n=e.oxw(3);e.Q6J("label",t.Name),e.xp6(3),e.Q6J("ngForOf",null==t?null:t.Items),e.xp6(2),e.Q6J("routerLink",e.DdM(4,Me))("queryParams",e.VKq(5,rt,n.quickKey.ID))}}function st(i,a){if(1&i&&(e.TgZ(0,"mat-tab-group",7),e.YNc(1,at,7,7,"mat-tab",8),e.qZA()),2&i){const t=e.oxw(2);e.Q6J("disableRipple",!0)("selectedIndex",0),e.xp6(1),e.Q6J("ngForOf",null==t.quickKey?null:t.quickKey.Groups)}}function lt(i,a){if(1&i&&e._UZ(0,"img",20),2&i){const t=e.oxw().$implicit;e.Q6J("src",t.ImageURLClient,e.LSH)}}function ct(i,a){if(1&i&&(e.TgZ(0,"p"),e._uU(1),e.ALo(2,"slice"),e.qZA()),2&i){const t=e.oxw().$implicit;e.xp6(1),e.Oqu(e.Dn7(2,1,t.Model,0,3))}}function dt(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"div",27)(1,"a",17),e.NdJ("click",function(){const s=e.CHM(t).$implicit,p=e.oxw(3);return e.KtG(p.onSelectVariant(s.ID))}),e.YNc(2,lt,1,1,"img",18),e.YNc(3,ct,3,5,"p",28),e.TgZ(4,"small"),e._uU(5),e.ALo(6,"limitTo"),e.qZA()()()}if(2&i){const t=a.$implicit;e.xp6(2),e.Q6J("ngIf",t.ImageURLClient),e.xp6(1),e.Q6J("ngIf",!t.ImageURLClient),e.xp6(2),e.Oqu(e.xi3(6,3,t.Model,30))}}function pt(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"div",22)(1,"div",23),e.NdJ("click",function(){e.CHM(t);const r=e.oxw(2);return e.KtG(r.quickeyState="QUICKEY")}),e._UZ(2,"i",24),e.qZA(),e.TgZ(3,"div",25)(4,"b"),e._uU(5),e.qZA()()(),e.TgZ(6,"div",10)(7,"div",11),e.YNc(8,dt,7,6,"div",26),e.qZA()()}if(2&i){const t=e.oxw(2);e.xp6(5),e.hij(" ",t.subQuickeyPack.Display,""),e.xp6(3),e.Q6J("ngForOf",null==t.subQuickeyPack?null:t.subQuickeyPack.Children)}}function ut(i,a){if(1&i&&(e.ynx(0),e.YNc(1,st,2,3,"mat-tab-group",5),e.YNc(2,pt,9,2,"ng-template",null,6,e.W1O),e.BQk()),2&i){const t=e.MAs(3),n=e.oxw();e.xp6(1),e.Q6J("ngIf","QUICKEY"==n.quickeyState)("ngIfElse",t)}}const mt=function(i){return{OutletID:i}};function gt(i,a){if(1&i&&(e.TgZ(0,"div",29)(1,"a",30)(2,"strong"),e._uU(3,"QUICK KEYS UNCONFIGURED"),e.qZA(),e._UZ(4,"i",31),e.TgZ(5,"span"),e._uU(6,"Click here to setup your Quick keys"),e.qZA()()()),2&i){const t=e.oxw();e.xp6(1),e.Q6J("routerLink",e.DdM(2,Me))("queryParams",e.VKq(3,mt,t.entityId))}}let ht=(()=>{class i{constructor(t,n,r,s,p){(0,o.Z)(this,"outletRegisterService",void 0),(0,o.Z)(this,"shoppingCartService",void 0),(0,o.Z)(this,"dialog",void 0),(0,o.Z)(this,"pageInitialService",void 0),(0,o.Z)(this,"salesOrderService",void 0),(0,o.Z)(this,"destroy$",void 0),(0,o.Z)(this,"quickKey",void 0),(0,o.Z)(this,"subQuickeyPack",void 0),(0,o.Z)(this,"entityId",void 0),(0,o.Z)(this,"quickeyState",void 0),this.outletRegisterService=t,this.shoppingCartService=n,this.dialog=r,this.pageInitialService=s,this.salesOrderService=p,this.destroy$=new k.x,this.quickeyState="QUICKEY"}ngOnInit(){this.getOutletRegister()}getOutletRegister(){this.outletRegisterService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.entityId=t.EntityID,this.quickKey=t.QuickKeyPack})}onSelectProduct(t){t.Children?1==t.Children.length?this.onSelectVariant(t.Children[0].ID):(this.quickeyState="SUBQUICKEY",this.subQuickeyPack={Children:t.Children,Display:t.Display}):this.onSelectVariant(t.ItemID)}onSelectVariant(t){this.shoppingCartService.addCartItemById(t).then(()=>{this.quickeyState="QUICKEY",this.pageInitialService.Data.AppConfigJSON.ModuleSell.ProductDialog.OpenOnNewItemAdded&&this.dialog.open(q.k,{data:{index:this.salesOrderService.Data.CartItems.length-1}})})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.Y36(D.o),e.Y36(W.F),e.Y36(x.uw),e.Y36(T.W),e.Y36(P.q))}),(0,o.Z)(i,"\u0275cmp",e.Xpm({type:i,selectors:[["sell-quick-key"]],decls:6,vars:2,consts:[[1,"row"],[1,"col-12"],[1,"quick-key-tab"],[4,"ngIf","ngIfElse"],["noQuickKey",""],["class","h-100 bgQuickkeyIllustration landscape",3,"disableRipple","selectedIndex",4,"ngIf","ngIfElse"],["SUBQUICKEY",""],[1,"h-100","bgQuickkeyIllustration","landscape",3,"disableRipple","selectedIndex"],[3,"label",4,"ngFor","ngForOf"],[3,"label"],[1,"container","tabItems"],[1,"row","g-0"],["class","col-3 column px-8",4,"ngFor","ngForOf"],[1,"col-3","column","px-8","add","pt-8"],[3,"routerLink","queryParams"],["aria-hidden","true",1,"fa","fa-plus-circle","fa-5x","d-flex","align-items-center","justify-content-center","bg-white","h-100","text-primary"],[1,"col-3","column","px-8"],[3,"click"],[3,"src",4,"ngIf"],["class","fw-normal",4,"ngIf"],[3,"src"],[1,"fw-normal"],[1,"row","g-0","border","align-items-center","subquicKey"],[1,"col-auto","border-end","py-5","px-7","cursor-pointer",3,"click"],["aria-hidden","true",1,"fa","fa-arrow-left"],[1,"col","text-center","fw-bold","text-uppercase","fs-5"],["class","col-3 column",4,"ngFor","ngForOf"],[1,"col-3","column"],[4,"ngIf"],[1,"no-quick-key"],["id","LinkConfigureQuickkey","target","_blank",3,"routerLink","queryParams"],["aria-hidden","true",1,"fa-regular","fa-hand-pointer"]],template:function(t,n){if(1&t&&(e.TgZ(0,"div",0)(1,"div",1)(2,"section",2),e.YNc(3,ut,4,2,"ng-container",3),e.YNc(4,gt,7,5,"ng-template",null,4,e.W1O),e.qZA()()()),2&t){const r=e.MAs(5);e.xp6(3),e.Q6J("ngIf",n.quickKey&&n.quickKey.Groups)("ngIfElse",r)}},dependencies:[g.sg,g.O5,fe.uX,fe.SP,N.rH,g.OU,_e.OI],styles:[".quick-key-tab{width:100%;position:relative;height:100%;max-height:calc(100vh - 80px)} .quick-key-tab .mat-mdc-tab-header-pagination{display:none!important} .quick-key-tab .mat-mdc-tab-header{border:none} .quick-key-tab .mdc-tab-indicator{display:none!important} .quick-key-tab .mat-mdc-tab-body-wrapper{width:102%} .quick-key-tab .mat-mdc-tab-labels{border-bottom:0px;display:flex;flex-wrap:wrap;border-radius:6px;text-transform:uppercase} .quick-key-tab .mat-mdc-tab-labels .mat-mdc-tab{color:#151515;opacity:1;height:38px;max-height:40px;overflow:hidden;padding-top:.625rem!important;padding-bottom:.625rem!important;min-width:20%!important;font-size:12px;font-weight:500;display:flex;white-space:normal!important;flex-grow:1;flex-basis:0} .quick-key-tab .mat-mdc-tab-labels .mat-mdc-tab .mdc-tab__content{white-space:normal!important;align-self:center;font-size:.875rem!important} .quick-key-tab .mat-mdc-tab-labels .mdc-tab--active{background:#0976b4;border-radius:6px} .quick-key-tab .mat-mdc-tab-labels .mdc-tab--active .mdc-tab__text-label{color:#fff!important;font-weight:700} .quick-key-tab .tabItems{padding:0} .quick-key-tab .tabItems .column{margin-top:15px;margin-bottom:10px;word-break:break-all} .quick-key-tab .tabItems .column>div{border:solid 1px #cfcfcf} .quick-key-tab .tabItems .column>a{text-align:center;display:block;cursor:pointer} .quick-key-tab .tabItems .column>a img{height:100px;width:100px;display:block;margin:0 auto;border-top-left-radius:5px;border-bottom-right-radius:5px;border:solid 1px #dddddd} .quick-key-tab .tabItems .column>a p{height:100px;width:100px;font-size:20px;display:block;margin:0 auto;padding-top:30px;background-color:#a6a6a6;border:solid 1px #999999;border-top-left-radius:5px;border-bottom-right-radius:5px;color:#fff} .quick-key-tab .tabItems .column>a small{font-size:11px;display:block;margin:5px 0 0} .quick-key-tab .tabItems .column .ion-icon{font-size:75px;margin:10px} .quick-key-tab .col-md-3.column.add{cursor:pointer} .quick-key-tab .col-md-3.column.add i{margin-top:10px} .quick-key-tab ::-webkit-scrollbar{width:3px} .quick-key-tab ::-webkit-scrollbar-track{box-shadow:inset 0 0 5px #bfd2da} .quick-key-tab ::-webkit-scrollbar-thumb{background:hsl(0,0%,77%);border-radius:10px} .quick-key-tab .subquicKey{background-color:#0976b4;color:#fff;border-radius:6px} .quick-key-tab .no-quick-key{background-image:url(//res.cloudinary.com/pos/image/upload/w_500/POS/Images/Cashier/no-quick-key.png)!important;background-position:center;background-repeat:no-repeat;height:544px;position:relative}a#LinkConfigureQuickkey[_ngcontent-%COMP%]{background-color:#479ccf;padding:15px 25px;color:#fff;text-decoration:none;width:240px;display:block;opacity:.85;border-radius:6px}a#LinkConfigureQuickkey[_ngcontent-%COMP%]{position:absolute;top:200px;left:210px}a#LinkConfigureQuickkey[_ngcontent-%COMP%]:hover{opacity:.95}a#LinkConfigureQuickkey[_ngcontent-%COMP%] Strong[_ngcontent-%COMP%]{border-bottom:1px solid white;font-size:14px;margin:0 0 10px;padding:0 0 3px;display:block}a#LinkConfigureQuickkey[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{display:inline-block;height:35px;margin:0 10px 0 0;font-size:28px}a#LinkConfigureQuickkey[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:inline-block;font-size:14px;width:135px;vertical-align:top}"]})),i})();var ft=l(70755),_t=l(51178),xe=l(42046),z=l(63165);function vt(i,a){if(1&i){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",5)(2,"input",6),e.NdJ("ngModelChange",function(r){e.CHM(t);const s=e.oxw();return e.KtG(s.invoiceNumber=r)}),e.qZA(),e.TgZ(3,"label",7),e._uU(4,"Invoice Number"),e.qZA()(),e.BQk()}if(2&i){const t=e.oxw();e.xp6(2),e.Q6J("ngModel",t.invoiceNumber)}}let Ct=(()=>{class i{constructor(t,n,r){(0,o.Z)(this,"data",void 0),(0,o.Z)(this,"dialogRef",void 0),(0,o.Z)(this,"pageInitialService",void 0),(0,o.Z)(this,"config",void 0),(0,o.Z)(this,"orderNumber",void 0),(0,o.Z)(this,"invoiceNumber",void 0),(0,o.Z)(this,"appConfig",void 0),this.data=t,this.dialogRef=n,this.pageInitialService=r,this.config=new xe.O,this.config.hideClose=!0,this.config.title=t.title,this.orderNumber=t.orderNumber,this.invoiceNumber=t.invoiceNumber,this.appConfig=r.Data.AppConfigJSON}onOk(){this.dialogRef.close({orderNumber:this.orderNumber,invoiceNumber:this.invoiceNumber})}onClose(){this.dialogRef.close()}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.Y36(x.WI),e.Y36(x.so),e.Y36(T.W))}),(0,o.Z)(i,"\u0275cmp",e.Xpm({type:i,selectors:[["POS-modal-number-editor"]],decls:7,vars:3,consts:[[3,"config","onOk","onCancel","onClose"],[1,"form-floating-outline","mb-0"],["type","text","data-cy","orderNumber","id","orderNumber","name","orderNumber",1,"form-control",3,"ngModel","ngModelChange"],["for","orderNumber"],[4,"ngIf"],[1,"form-floating-outline","mb-0","mt-10"],["type","text","data-cy","invoiceNumber","id","invoiceNumber","name","invoiceNumber",1,"form-control",3,"ngModel","ngModelChange"],["for","invoiceNumber"]],template:function(t,n){1&t&&(e.TgZ(0,"modal-material",0),e.NdJ("onOk",function(){return n.onOk()})("onCancel",function(){return n.onClose()})("onClose",function(){return n.onClose()}),e.TgZ(1,"content")(2,"div",1)(3,"input",2),e.NdJ("ngModelChange",function(s){return n.orderNumber=s}),e.qZA(),e.TgZ(4,"label",3),e._uU(5,"Order Number"),e.qZA()(),e.YNc(6,vt,5,1,"ng-container",4),e.qZA()()),2&t&&(e.Q6J("config",n.config),e.xp6(3),e.Q6J("ngModel",n.orderNumber),e.xp6(3),e.Q6J("ngIf",null==n.appConfig||null==n.appConfig.ModuleSell||null==n.appConfig.ModuleSell.Numbering?null:n.appConfig.ModuleSell.Numbering.SalesOrderNumberVisible))},dependencies:[g.O5,Z.Fj,Z.JJ,Z.On,z.M]})),i})();var bt=l(65550);function xt(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"span",15),e._uU(2,"/"),e.qZA(),e.TgZ(3,"span",16),e._uU(4),e.qZA(),e.BQk()),2&i){const t=e.oxw(2);e.xp6(4),e.hij("#",null==t.salesOrder||null==t.salesOrder.Invoice?null:t.salesOrder.Invoice.Number,"")}}function yt(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"h6",12),e.NdJ("click",function(){e.CHM(t);const r=e.oxw();return e.KtG(r.onEditNumber())}),e.TgZ(1,"span",13),e._uU(2),e.qZA(),e.YNc(3,xt,5,1,"ng-container",14),e.qZA()}if(2&i){const t=e.oxw();e.xp6(2),e.hij("#",null==t.salesOrder||null==t.salesOrder.Order?null:t.salesOrder.Order.Number,""),e.xp6(1),e.Q6J("ngIf",null==t.appConfig||null==t.appConfig.ModuleSell||null==t.appConfig.ModuleSell.Numbering?null:t.appConfig.ModuleSell.Numbering.SalesOrderNumberVisible)}}let St=(()=>{class i{constructor(t,n,r,s,p,h,_){(0,o.Z)(this,"registerService",void 0),(0,o.Z)(this,"salesOrderService",void 0),(0,o.Z)(this,"pageInitialService",void 0),(0,o.Z)(this,"coreService",void 0),(0,o.Z)(this,"dialog",void 0),(0,o.Z)(this,"shoppingCartService",void 0),(0,o.Z)(this,"userRoleService",void 0),(0,o.Z)(this,"date",new Date),(0,o.Z)(this,"selectedOutlet",void 0),(0,o.Z)(this,"destroy$",void 0),(0,o.Z)(this,"salesOrder",void 0),(0,o.Z)(this,"register",void 0),(0,o.Z)(this,"appConfig",void 0),(0,o.Z)(this,"userRole",void 0),(0,o.Z)(this,"renderThumbnail",!1),this.registerService=t,this.salesOrderService=n,this.pageInitialService=r,this.coreService=s,this.dialog=p,this.shoppingCartService=h,this.userRoleService=_,this.destroy$=new k.x}ngOnInit(){this.subscribeToObservable(),this.initThumbnailConfig()}ngAfterViewInit(){this.initCursorFocus()}subscribeToObservable(){this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.salesOrderService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.salesOrder=t,this.initCursorFocus()}),this.registerService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.register=this.registerService.findOutletRegisterById(t.RegisterID),this.selectedOutlet=t,this.initCursorFocus()}),this.userRoleService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.userRole=t})}initThumbnailConfig(){this.renderThumbnail=this.appConfig.ModuleSell.ProductDialog.ShowThumbnail}openRegisterModal(){this.dialog.open(_t.d,{id:"registerModal"}).afterClosed().pipe((0,f.R)(this.destroy$),(0,F.h)(t=>m.gT.IsNotEmpty(t))).subscribe(t=>{this.openOpeningCashModal()})}openOpeningCashModal(){const t=this.pageInitialService.Data.AppConfigJSON;t.ModuleShift.Closure.Enabled&&t.ModuleShift.Closure.OpeningCashRequired&&this.dialog.open(ft.X).afterClosed().subscribe(n=>{n&&null!=n.amount&&(this.coreService.recordOpeningCash({RegisterID:this.salesOrder.Order.RegisterID,OpAmount:n.amount}),document.getElementById("product").focus())})}onAddItem(t){this.shoppingCartService.addCartItemById(t).then(()=>{this.openModalItemOnNew(t)})}onBarcodeScan(t){m.gT.IsNotEmpty(t)&&this.shoppingCartService.addCartItemByCode(t).then(n=>{this.openModalItemOnNew(n.ID)})}openModalItemOnNew(t){if(this.pageInitialService.Data.AppConfigJSON.ModuleSell.ProductDialog.OpenOnNewItemAdded){let r=this.salesOrder.CartItems.find(p=>p.VariantID==t),s=this.salesOrder.Items.lastIndexOf(r);this.dialog.open(q.k,{data:{index:s}})}}onEditNumber(){this.userRole.NumberEditor&&this.dialog.open(Ct,{data:{title:"Edit Invoice Number",orderNumber:this.salesOrder.Order.Number,invoiceNumber:this.salesOrder.Invoice.Number},width:"20%"}).afterClosed().pipe((0,F.h)(t=>m.gT.IsNotEmpty(t))).subscribe(t=>{this.salesOrder.Order.Number=t.orderNumber,this.salesOrder.Invoice.Number=t.invoiceNumber,this.salesOrderService.pushNewValue(this.salesOrder)})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}initCursorFocus(){let t=document.getElementById("product");t&&t.focus()}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.Y36(D.o),e.Y36(P.q),e.Y36(T.W),e.Y36(bt.I),e.Y36(x.uw),e.Y36(W.F),e.Y36(w.J))}),(0,o.Z)(i,"\u0275cmp",e.Xpm({type:i,selectors:[["sell-header"]],decls:13,vars:4,consts:[[1,"row"],[1,"col-6","d-flex","align-items-center","ps-8"],[1,"text-danger","cursor-pointer",2,"font-size","30px",3,"click"],[1,"fa-solid","fa-location-dot"],[1,"ms-2","cursor-pointer"],[3,"click"],["class","fw-normal",3,"click",4,"ngIf"],[1,"col-6","d-flex","justify-content-end"],[1,"input-group","h-75","mt-3"],["inputID","product","requestUrl","/API/AC/GetVariantSuggestionByCodeNName","placeholder","Search all product here...","notFoundMessageFor","customer","aria-label","Search","localStorage","products","notFoundMessageFor","product",1,"form-control","autocomplete-product",3,"clearOnSelect","renderThumbnail","onSelect","onInputEnter"],[1,"input-group-text","fs-5","rounded-end"],["aria-hidden","true",1,"fa","fa-search"],[1,"fw-normal",3,"click"],["matTooltipPosition","above","matTooltip","Sales order number"],[4,"ngIf"],[1,"fw-bold","px-2"],["matTooltipPosition","above","matTooltip","Invoice number"]],template:function(t,n){1&t&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2),e.NdJ("click",function(){return n.openRegisterModal()}),e._UZ(3,"i",3),e.qZA(),e.TgZ(4,"div",4)(5,"h3",5),e.NdJ("click",function(){return n.openRegisterModal()}),e._uU(6),e.qZA(),e.YNc(7,yt,4,2,"h6",6),e.qZA()(),e.TgZ(8,"div",7)(9,"div",8)(10,"autocompleteV2",9),e.NdJ("onSelect",function(s){return n.onAddItem(s)})("onInputEnter",function(s){return n.onBarcodeScan(s)}),e.qZA(),e.TgZ(11,"span",10),e._UZ(12,"i",11),e.qZA()()()()),2&t&&(e.xp6(6),e.hij(" ",null!=n.register&&n.register.Name?null==n.register?null:n.register.Name:"Choose an Outlet"," "),e.xp6(1),e.Q6J("ngIf",null==n.salesOrder||null==n.salesOrder.Order?null:n.salesOrder.Order.Number),e.xp6(3),e.Q6J("clearOnSelect",!0)("renderThumbnail",n.renderThumbnail))},dependencies:[g.O5,I.J],styles:["div.custom-datepicker-sell>datepicker mat-form-field{padding-right:0!important;background:white}div.custom-datepicker-sell>datepicker mat-form-field .mat-mdc-text-field-wrapper{padding-bottom:0}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-flex{width:130px;height:40px;border:1px solid rgb(221,221,221);border-radius:4px}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-infix{border:none!important;top:7px}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-infix input{font-size:14px;color:#000;padding-left:40px}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-icon-suffix{left:-102px;top:5px}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-icon-suffix .mat-mdc-button-persistent-ripple{color:#000}div.custom-datepicker-sell>datepicker .mat-form-field-underline{display:none}autocompleteV2.autocomplete-product>mat-form-field>input{height:36px;border-bottom-left-radius:5px;border-top-left-radius:5px}\n"],encapsulation:2})),i})(),Zt=(()=>{class i{constructor(){}ngOnInit(){}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)}),(0,o.Z)(i,"\u0275cmp",e.Xpm({type:i,selectors:[["sell-left-content"]],decls:7,vars:0,consts:[[1,"d-flex","flex-column"],[1,"row","border-bottom","py-5","pb-4"],[1,"col-12"],[1,"row","mt-5"]],template:function(t,n){1&t&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2),e._UZ(3,"sell-header"),e.qZA()(),e.TgZ(4,"div",3)(5,"div",2),e._UZ(6,"sell-quick-key"),e.qZA()()())},dependencies:[ht,St]})),i})();var It=l(30420),Tt=l(31853),Ot=l(59810);function Dt(i,a){if(1&i){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",9)(2,"div",10),e.NdJ("click",function(){e.CHM(t);const r=e.oxw(2);return e.KtG(r.onRetrieve())}),e.TgZ(3,"span",11),e._UZ(4,"i",13),e.qZA(),e.TgZ(5,"span"),e._uU(6),e.qZA()()(),e.BQk()}if(2&i){const t=e.oxw(2);e.xp6(6),e.Oqu((null==t.appConfig||null==t.appConfig.ApplicationParkAndRetrieve||null==t.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel?null:t.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.RetreiveButtonLabel)||"Retrieve")}}const Pt=function(i,a){return{"bg-gradient-warning":i,"px-0":a}};function Mt(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"div",14)(1,"div",10),e.NdJ("click",function(){e.CHM(t);const r=e.oxw(2);return e.KtG(r.onFulfillment())}),e.TgZ(2,"span",11),e._UZ(3,"i",15),e.qZA(),e.TgZ(4,"span"),e._uU(5,"Fulfillment"),e.qZA()()()}if(2&i){const t=e.oxw(2);e.Q6J("ngClass",e.WLB(1,Pt,t.warningFullfillment,t.appConfig.ApplicationParkAndRetrieve.Basic.EnableParkAndRetrieve&&t.userRole.Retrieve))}}function kt(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"div",2)(1,"div",3)(2,"div",4),e.YNc(3,Dt,7,1,"ng-container",5),e.TgZ(4,"button",6),e.NdJ("click",function(){e.CHM(t);const r=e.oxw();return e.KtG(r.isCollapse=!r.isCollapse)}),e._UZ(5,"i",7),e.qZA(),e.YNc(6,Mt,6,4,"div",8),e.TgZ(7,"div",9)(8,"div",10),e.NdJ("click",function(){e.CHM(t);const r=e.oxw();return e.KtG(r.onOpenNotesModal())}),e.TgZ(9,"span",11),e._UZ(10,"i",12),e.qZA(),e.TgZ(11,"span"),e._uU(12,"Note"),e.qZA()()()()()()}if(2&i){const t=e.oxw();e.xp6(3),e.Q6J("ngIf",t.appConfig.ApplicationParkAndRetrieve.Basic.EnableParkAndRetrieve&&t.userRole.Retrieve),e.xp6(3),e.Q6J("ngIf",t.userRole.Shipping)}}function At(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"div",16)(1,"button",6),e.NdJ("click",function(){e.CHM(t);const r=e.oxw();return e.KtG(r.isCollapse=!r.isCollapse)}),e._UZ(2,"i",17),e.qZA()()}}let Nt=(()=>{class i{constructor(t,n,r,s,p,h,_){(0,o.Z)(this,"dialog",void 0),(0,o.Z)(this,"outletRegisterService",void 0),(0,o.Z)(this,"pageInitialService",void 0),(0,o.Z)(this,"toastrService",void 0),(0,o.Z)(this,"orderProcessorService",void 0),(0,o.Z)(this,"userRoleService",void 0),(0,o.Z)(this,"salesOrderService",void 0),(0,o.Z)(this,"isCollapse",void 0),(0,o.Z)(this,"appConfig",void 0),(0,o.Z)(this,"parkLayoutPack",void 0),(0,o.Z)(this,"destroy$",void 0),(0,o.Z)(this,"userRole",void 0),(0,o.Z)(this,"warningFullfillment",!1),(0,o.Z)(this,"emitOnRetrieve",void 0),this.dialog=t,this.outletRegisterService=n,this.pageInitialService=r,this.toastrService=s,this.orderProcessorService=p,this.userRoleService=h,this.salesOrderService=_,this.isCollapse=!1,this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.destroy$=new k.x,this.emitOnRetrieve=new e.vpe}ngOnInit(){this.subscribeToObservable()}subscribeToObservable(){this.outletRegisterService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.parkLayoutPack=t.ParkLayoutPack}),this.userRoleService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.userRole=t}),this.salesOrderService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.warningFullfillment=m.gT.IsEmpty(t.Action.DeliveryEntityID)})}onRetrieve(){null!=this.parkLayoutPack.Layout||1!=this.appConfig.ApplicationParkAndRetrieve.Advance.retreiveMode?this.dialog.open(Ot.Q).afterClosed().pipe((0,f.R)(this.destroy$),(0,F.h)(t=>m.gT.IsNotEmpty(t))).subscribe(t=>{this.emitOnRetrieve.emit(t),this.orderProcessorService.Data.posState=C.J.IsRetrieve}):this.toastrService.error("Your retrieve config is in Group mode, to enable park please setting your Park layout at Outlet page","Error!")}onFulfillment(){this.dialog.open(Tt.D)}onOpenNotesModal(){this.dialog.open(It.$,{width:"45%"})}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.Y36(x.uw),e.Y36(D.o),e.Y36(T.W),e.Y36(R._W),e.Y36(A.d),e.Y36(w.J),e.Y36(P.q))}),(0,o.Z)(i,"\u0275cmp",e.Xpm({type:i,selectors:[["sell-right-panel"]],outputs:{emitOnRetrieve:"onRetrieve"},decls:2,vars:2,consts:[["class","card right-panel",4,"ngIf"],["class","card right-panel right-panel-hide",4,"ngIf"],[1,"card","right-panel"],[1,"card-body","py-0"],[1,"row"],[4,"ngIf"],[1,"btn-collapse-custom","d-md-block","d-none","p-0","border-0","bg-white",3,"click"],[1,"fa","fa-angle-left"],["class","col d-flex align-items-center justify-content-center","style","height: 40px",3,"ngClass",4,"ngIf"],[1,"col","d-flex","align-items-center","justify-content-center",2,"height","40px"],[1,"cursor-pointer",3,"click"],[1,"me-1"],[1,"fa-solid","fa-edit"],[1,"fa-solid","fa-box"],[1,"col","d-flex","align-items-center","justify-content-center",2,"height","40px",3,"ngClass"],[1,"fa-solid","fa-truck"],[1,"card","right-panel","right-panel-hide"],[1,"fa","fa-angle-right"]],template:function(t,n){1&t&&(e.YNc(0,kt,13,2,"div",0),e.YNc(1,At,3,0,"div",1)),2&t&&(e.Q6J("ngIf",n.isCollapse),e.xp6(1),e.Q6J("ngIf",!n.isCollapse))},dependencies:[g.mk,g.O5],styles:[".right-panel[_ngcontent-%COMP%]{position:absolute;top:22vh;transform-origin:0 0;transform:rotate(90deg);width:290px;right:-290px;text-align:center;background-color:#d8f0ff;border-top-left-radius:0;border-top-right-radius:0}.right-panel[_ngcontent-%COMP%]:hover .btn-collapse-custom[_ngcontent-%COMP%]{color:#2996cc;opacity:1}.right-panel.right-panel-hide[_ngcontent-%COMP%]{transform:rotate(90deg);width:290px;right:-290px;height:16px}.right-panel.right-panel-hide[_ngcontent-%COMP%] .btn-collapse-custom[_ngcontent-%COMP%]{top:0}.btn-collapse-custom[_ngcontent-%COMP%]{transform:rotate(90deg)}"]})),i})();var wt=l(11156),X=l(54102),ke=l(71965),ye=l(88796),Ae=l(83902),Rt=l(23370),Jt=l(55593),Y=l(10266);function Et(i,a){if(1&i){const t=e.EpF();e.ynx(0),e.TgZ(1,"span",27),e._UZ(2,"i",28),e.qZA(),e.TgZ(3,"span",29),e.NdJ("click",function(){e.CHM(t);const r=e.oxw(2);return e.KtG(r.tabIndexActive=1)}),e._uU(4),e.qZA(),e.BQk()}if(2&i){const t=e.oxw(2);e.xp6(4),e.hij(" ",t.pointUsed," Points redeemed ")}}function Qt(i,a){if(1&i){const t=e.EpF();e.ynx(0),e.TgZ(1,"tab",23)(2,"div",13)(3,"div",7)(4,"label",8),e._uU(5,"Discount %"),e.qZA()(),e.TgZ(6,"div",9)(7,"input",24),e.NdJ("ngModelChange",function(r){e.CHM(t);const s=e.oxw();return e.KtG(s.discount1=r)}),e.qZA(),e.TgZ(8,"span",11),e._uU(9,"%"),e.qZA(),e.TgZ(10,"span",20),e._uU(11,"+"),e.qZA(),e.TgZ(12,"input",25),e.NdJ("ngModelChange",function(r){e.CHM(t);const s=e.oxw();return e.KtG(s.discount2=r)}),e.qZA(),e.TgZ(13,"span",11),e._uU(14,"%"),e.qZA()()(),e.TgZ(15,"div",6)(16,"div",7)(17,"label",8),e._uU(18),e.qZA()(),e.TgZ(19,"div",9)(20,"input",26),e.NdJ("ngModelChange",function(r){e.CHM(t);const s=e.oxw();return e.KtG(s.discountAmount=r)}),e.qZA(),e.YNc(21,Et,5,1,"ng-container",3),e.qZA()()(),e.BQk()}if(2&i){const t=e.oxw();e.xp6(1),e.Q6J("active",1!==t.tabIndexActive),e.xp6(6),e.Q6J("ngModel",t.discount1),e.xp6(5),e.Q6J("ngModel",t.discount2),e.xp6(6),e.hij("Discount ",t.currencySymbol,""),e.xp6(2),e.Q6J("readOnly",t.pointUsed&&t.pointUsed>0)("ngModel",t.discountAmount),e.xp6(1),e.Q6J("ngIf",t.pointUsed&&t.pointUsed>0)}}function Ut(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"tab",30)(1,"div",13)(2,"div",7)(3,"label",8),e._uU(4,"Point Used"),e.qZA()(),e.TgZ(5,"div",9)(6,"input",31),e.NdJ("ngModelChange",function(r){e.CHM(t);const s=e.oxw();return e.KtG(s.pointUsed=r)})("ngModelChange",function(r){e.CHM(t);const s=e.oxw();return e.KtG(s.onInputPoint(r))}),e.qZA(),e.TgZ(7,"span",32),e._uU(8),e.ALo(9,"number"),e.qZA()()()()}if(2&i){const t=e.oxw();e.Q6J("active",1==t.tabIndexActive),e.xp6(6),e.Q6J("ngModel",t.pointUsed)("max",t.availablePoint?t.availablePoint:0),e.xp6(2),e.hij("of ",e.lcZ(9,4,t.availablePoint)," Points")}}function Lt(i,a){if(1&i){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",13)(2,"div",7)(3,"label",8),e._uU(4,"Tax"),e.qZA()(),e.TgZ(5,"div",9)(6,"ng-select",33),e.NdJ("change",function(r){e.CHM(t);const s=e.oxw();return e.KtG(s.updateTax(r))}),e.qZA()()(),e.BQk()}if(2&i){const t=e.oxw();e.xp6(6),e.Q6J("clearable",!1)("ngModel",t.salesOrder.Order.TaxTypeID)("items",t.taxes)}}let Ne=(()=>{class i{constructor(t,n,r,s,p,h,_,y){(0,o.Z)(this,"dialogRef",void 0),(0,o.Z)(this,"orderService",void 0),(0,o.Z)(this,"invoiceCalculatorService",void 0),(0,o.Z)(this,"pageInitialService",void 0),(0,o.Z)(this,"roleService",void 0),(0,o.Z)(this,"customerService",void 0),(0,o.Z)(this,"outletRegisterService",void 0),(0,o.Z)(this,"data",void 0),(0,o.Z)(this,"modalConfig",new xe.O),(0,o.Z)(this,"discount1",void 0),(0,o.Z)(this,"discount2",void 0),(0,o.Z)(this,"discountAmount",void 0),(0,o.Z)(this,"surcharge",void 0),(0,o.Z)(this,"discountAfterTax",void 0),(0,o.Z)(this,"currencySymbol",void 0),(0,o.Z)(this,"salesOrder",void 0),(0,o.Z)(this,"discounts",[]),(0,o.Z)(this,"taxes",void 0),(0,o.Z)(this,"selectedTax",void 0),(0,o.Z)(this,"userRole",void 0),(0,o.Z)(this,"pointUsed",void 0),(0,o.Z)(this,"tabIndexActive",void 0),(0,o.Z)(this,"availablePoint",void 0),(0,o.Z)(this,"configMemberPointEnabled",!1),this.dialogRef=t,this.orderService=n,this.invoiceCalculatorService=r,this.pageInitialService=s,this.roleService=p,this.customerService=h,this.outletRegisterService=_,this.data=y,this.modalConfig.title="Discount and Tax",this.modalConfig.customWidth="480px",this.salesOrder=this.orderService.Data,this.userRole=this.roleService.Data,this.configMemberPointEnabled=this.outletRegisterService.Data.MemberPoint,this.tabIndexActive=y?.tabIndexActive,this.initDiscountAndTax(),this.initAvailablePoint()}initAvailablePoint(){this.availablePoint=(this.customerService.Data.Point||0)-(this.customerService.Data.PointUsed||0)}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}updateTax(t){this.selectedTax=t}onOk(){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.salesOrder.Order.DiscountAmount=this.discountAmount,this.invoiceCalculatorService.discountAfterTax=this.discountAfterTax,this.salesOrder.Order.TaxTypeID=this.selectedTax.ID,this.salesOrder.Order.PointUsed=this.pointUsed,this.invoiceCalculatorService.tax=this.selectedTax,this.orderService.pushNewValue(this.salesOrder),this.close()}close(){this.dialogRef.close()}calculateDiscountCalculator(){var t=100;this.discounts.forEach(n=>{t=t*(100-n)/100}),this.discount1=100-t,this.orderService.Data.Order.Discount=this.discount1}onDiscountAfterTaxChange(){this.discountAmount=this.discountAfterTax;let n=this.invoiceCalculatorService.TotalBeforeTax-this.discountAmount,p=m.gT.FilterByID(this.pageInitialService.Data.Taxes,this.orderService.Data.Order.TaxTypeID);if(m.gT.IsNotEmpty(p)&&p.CalculationTypeID==wt.E.Add){let h=1+p.Rate/100,_=n*h;this.discountAmount=(_-(_-this.discountAfterTax))/h}this.orderService.Data.Order.DiscountAmount=this.discountAmount}onInputPoint(t){const s=this.orderService.Data.RedeemableAmount;let p=t,h=this.pageInitialService.Data.AppConfigJSON.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,_=t*h;_>s&&(p=Math.ceil(s/h),_=s),this.pointUsed=p,this.discountAmount=_}onTabChange(t){"loyalty"!==t&&(this.tabIndexActive=null)}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.Y36(x.so),e.Y36(P.q),e.Y36(X.J),e.Y36(T.W),e.Y36(w.J),e.Y36(ke.r),e.Y36(D.o),e.Y36(x.WI))}),(0,o.Z)(i,"\u0275cmp",e.Xpm({type:i,selectors:[["POS-modal-discount"]],decls:41,vars:11,consts:[[3,"config","keydown.F2","onOk","onCancel","onClose"],[1,"container"],[3,"onTabChange"],[4,"ngIf"],["matTooltipPosition","above","matTooltip","Loyalty","tabTitle","Loyalty",3,"active",4,"ngIf"],["matTooltipPosition","above","matTooltip","Tax","tabTitle","Tax"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],[1,"col-3"],[1,"fw-bold","d-block"],[1,"col-9"],["type","text","data-cy","surcharge","autoNum","",1,"form-control","d-inline-block",2,"width","85px",3,"ngModel","max","min","ngModelChange"],[1,"ms-1"],["matTooltipPosition","above","matTooltip","Calculation","tabTitle","Others"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-4"],[1,"col-8","ps-6"],["type","text","num-neg","false","autoNum","",1,"txtPrice","form-control",2,"width","100px",3,"ngModel","ngModelChange"],[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","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModel","ngModelChange"],[1,"mx-2"],["type","text","data-cy","discountCal2","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModel","ngModelChange"],["type","text","data-cy","discountCal3","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModel","ngModelChange"],["matTooltipPosition","above","matTooltip","Discount","tabTitle","Discount",3,"active"],["type","text","data-cy","discount1","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","47px",3,"ngModel","ngModelChange"],["type","text","data-cy","discount2","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","47px",3,"ngModel","ngModelChange"],["type","text","data-cy","discountamount","autoNum","",1,"form-control","d-inline-block",2,"width","100px",3,"readOnly","ngModel","ngModelChange"],[1,"pointer"],[1,"fa-solid","fa-info-circle","ms-2"],[1,"pointer",3,"click"],["matTooltipPosition","above","matTooltip","Loyalty","tabTitle","Loyalty",3,"active"],["type","text","data-cy","surcharge","autoNum","",1,"form-control","d-inline-block",2,"width","80px",3,"ngModel","max","ngModelChange"],[1,"ms-3"],["bindLabel","Label","appendTo","body","bindValue","ID","placeholder","Tax","data-cy","Tax",1,"w-50",3,"clearable","ngModel","items","change"]],template:function(t,n){1&t&&(e.TgZ(0,"modal-material",0),e.NdJ("keydown.F2",function(){return n.onOk()})("onOk",function(){return n.onOk()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),e.TgZ(1,"content")(2,"div",1)(3,"custom-tabs",2),e.NdJ("onTabChange",function(s){return n.onTabChange(s)}),e.YNc(4,Qt,22,7,"ng-container",3),e.YNc(5,Ut,10,6,"tab",4),e.TgZ(6,"tab",5),e.YNc(7,Lt,7,3,"ng-container",3),e.TgZ(8,"div",6)(9,"div",7)(10,"label",8),e._uU(11,"Surcharge"),e.qZA()(),e.TgZ(12,"div",9)(13,"input",10),e.NdJ("ngModelChange",function(s){return n.surcharge=s}),e.qZA(),e.TgZ(14,"span",11),e._uU(15,"%"),e.qZA()()()(),e.TgZ(16,"tab",12)(17,"div",13)(18,"div",14)(19,"strong"),e._uU(20,"Discount After Tax"),e.qZA()(),e.TgZ(21,"div",15)(22,"input",16),e.NdJ("ngModelChange",function(s){return n.discountAfterTax=s})("ngModelChange",function(){return n.onDiscountAfterTaxChange()}),e.qZA()()(),e.TgZ(23,"div",17)(24,"div",14)(25,"label",8),e._uU(26,"Discount Calculator"),e.qZA()(),e.TgZ(27,"div",18)(28,"input",19),e.NdJ("ngModelChange",function(s){return n.discounts[0]=s})("ngModelChange",function(){return n.calculateDiscountCalculator()}),e.qZA(),e.TgZ(29,"span"),e._uU(30," %"),e.qZA(),e.TgZ(31,"span",20),e._uU(32,"+"),e.qZA(),e.TgZ(33,"input",21),e.NdJ("ngModelChange",function(s){return n.discounts[1]=s})("ngModelChange",function(){return n.calculateDiscountCalculator()}),e.qZA(),e.TgZ(34,"span"),e._uU(35," %"),e.qZA(),e.TgZ(36,"span",20),e._uU(37,"+"),e.qZA(),e.TgZ(38,"input",22),e.NdJ("ngModelChange",function(s){return n.discounts[2]=s})("ngModelChange",function(){return n.calculateDiscountCalculator()}),e.qZA(),e.TgZ(39,"span"),e._uU(40," %"),e.qZA()()()()()()()()),2&t&&(e.Q6J("config",n.modalConfig),e.xp6(4),e.Q6J("ngIf",n.userRole.Discount),e.xp6(1),e.Q6J("ngIf",n.availablePoint&&n.availablePoint>0&&n.configMemberPointEnabled),e.xp6(2),e.Q6J("ngIf",n.userRole.Tax),e.xp6(6),e.Q6J("ngModel",n.surcharge)("max",100)("min",-100),e.xp6(9),e.Q6J("ngModel",n.discountAfterTax),e.xp6(6),e.Q6J("ngModel",n.discounts[0]),e.xp6(5),e.Q6J("ngModel",n.discounts[1]),e.xp6(5),e.Q6J("ngModel",n.discounts[2]))},dependencies:[g.O5,Z.Fj,Z.JJ,Z.On,z.M,ye.w9,Ae.b,Rt.x,Jt.i,Y.gM,g.JJ]})),i})();var Ft=l(70075),Se=l(11113),we=l(82707),Re=l(79666),Je=l(29099);let Ee=(()=>{class i{constructor(t,n,r,s,p,h,_,y){(0,o.Z)(this,"salesOrderService",void 0),(0,o.Z)(this,"toastrService",void 0),(0,o.Z)(this,"pageInitialService",void 0),(0,o.Z)(this,"orderProcessorService",void 0),(0,o.Z)(this,"dialog",void 0),(0,o.Z)(this,"onlineStatusService",void 0),(0,o.Z)(this,"promotionEventService",void 0),(0,o.Z)(this,"outletService",void 0),(0,o.Z)(this,"appConfig",void 0),(0,o.Z)(this,"salesOrder",void 0),(0,o.Z)(this,"isOnline",void 0),this.salesOrderService=t,this.toastrService=n,this.pageInitialService=r,this.orderProcessorService=s,this.dialog=p,this.onlineStatusService=h,this.promotionEventService=_,this.outletService=y,this.initSubscribeObservable()}initSubscribeObservable(){this.salesOrderService.Data$.subscribe(t=>{this.salesOrder=t}),this.pageInitialService.Data$.subscribe(t=>{this.appConfig=t.AppConfigJSON}),this.onlineStatusService.getOnlineStatus$().subscribe(t=>{this.isOnline=t})}payOrder(){this.isCartNotEmpty()&&this.isSalesPersonValid()&&this.isCustomerRequired()&&this.validateCustomerID()&&this.validatePromotionDiscount()&&this.openPaymentModal()}isCartNotEmpty(){return!(this.salesOrderService.Data.CartItems.length<1&&(this.toastrService.warning(m.g7.emptyPOItem,"Warning!"),1))}isSalesPersonValid(){let n=this.salesOrderService.Data;if(this.pageInitialService.Data.AppConfigJSON.ModuleSell.Header.SalesPersonRequired){if(this.salesOrder.CartItems.every(r=>m.gT.IsNotEmpty(r.SalesID)))return!0;if(n.Order.SalesID==m.gT.GuidEmpty||null==n.Order.SalesID)return this.toastrService.warning(m.g7.emptySalesPerson,"Warning!"),!1}return!0}validateCustomerID(){if(m.gT.IsEmpty(this.salesOrderService.Data.Order.CustomerID)){let n=this.orderProcessorService.Data.InputTextValue;if(m.gT.IsNotEmpty(n)&&(this.toastrService.warning("Customer is not Saved","Warning"),this.appConfig.ModuleSell.Customer.QuickAddEnabled))return this.openCustomerModal(n),!1}return!0}isCustomerRequired(){return!(this.appConfig.ModuleSell.Header.CustomerRequired&&this.isOnline&&m.gT.IsEmpty(this.salesOrder.Order.CustomerID)&&(this.toastrService.warning(m.g7.emptyCustomer,"Warning!"),1))}openCustomerModal(t){this.dialog.open(Re.A,{data:{name:t},autoFocus:!1}).afterClosed().subscribe(n=>{n&&this.openPaymentModal()})}validatePromotionDiscount(){let n=(this.outletService.Data.Promotion?this.outletService.Data.Promotion:[]).find(h=>h.TypeID===we.qe.Discount),s=this.promotionEventService.selectedPromotion,p=!0;return this.appConfig.ModuleSell.MandatoryActiveDiscount&&n&&(s?s.TypeID!=we.qe.Discount&&(p=!1):p=!1),0==p&&(this.dialog.open(Se.t,{id:"promotion-event"}),this.toastrService.warning("You need to apply Discount promotion","Required Promotion")),p}openPaymentModal(){this.dialog.open(Ft.n,{id:"ModalPayment"})}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.LFG(P.q),e.LFG(R._W),e.LFG(T.W),e.LFG(A.d),e.LFG(x.uw),e.LFG(Je.q),e.LFG(Ce.D),e.LFG(D.o))}),(0,o.Z)(i,"\u0275prov",e.Yz7({token:i,factory:i.\u0275fac})),i})();function qt(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"tr")(2,"th",12)(3,"span"),e._uU(4,"Total"),e.qZA(),e.TgZ(5,"span",13),e._uU(6),e.ALo(7,"number"),e.qZA()(),e.TgZ(8,"td",14)(9,"span",15),e._uU(10),e.ALo(11,"number"),e.qZA()()(),e.BQk()),2&i){const t=e.oxw(2);e.xp6(6),e.hij("",e.lcZ(7,2,t.salesOrder.TotalQuantity)," Item(s)"),e.xp6(4),e.hij(" ",e.lcZ(11,4,t.calculatorService.GrossTotal)," ")}}function Yt(i,a){if(1&i&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"number"),e.qZA()),2&i){const t=e.oxw(3);e.xp6(1),e.hij("",e.lcZ(2,1,t.salesOrder.Order.Discount),"%")}}function Bt(i,a){if(1&i&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"number"),e.qZA()),2&i){const t=e.oxw(3);e.xp6(1),e.hij("",e.xi3(2,1,t.salesOrder.Order.Discount,"1.0-4"),"%")}}function Vt(i,a){if(1&i&&(e.TgZ(0,"tr")(1,"th",12),e._uU(2),e.YNc(3,Yt,3,3,"span",0),e.YNc(4,Bt,3,4,"span",0),e.qZA(),e.TgZ(5,"td",16),e._uU(6),e.ALo(7,"number"),e.qZA()()),2&i){const t=e.oxw(2);e.xp6(2),e.hij(" ",null==t.appConfig||null==t.appConfig.CorePrint?null:t.appConfig.CorePrint.Alias.Discount1," "),e.xp6(1),e.Q6J("ngIf",t.isIgnoreDecimalDisc1),e.xp6(1),e.Q6J("ngIf",!(null!=t.appConfig&&t.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal)),e.xp6(2),e.Oqu(e.lcZ(7,4,-1*t.calculatorService.Discount1Amount))}}function Ht(i,a){if(1&i&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"number"),e.qZA()),2&i){const t=e.oxw(3);e.xp6(1),e.hij("",e.lcZ(2,1,t.salesOrder.Order.Discount2),"%")}}function $t(i,a){if(1&i&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"number"),e.qZA()),2&i){const t=e.oxw(3);e.xp6(1),e.hij("",e.xi3(2,1,t.salesOrder.Order.Discount2,"1.0-4"),"%")}}function Gt(i,a){if(1&i&&(e.TgZ(0,"tr")(1,"th",12),e._uU(2),e.YNc(3,Ht,3,3,"span",0),e.YNc(4,$t,3,4,"span",0),e.qZA(),e.TgZ(5,"td",16),e._uU(6),e.ALo(7,"number"),e.qZA()()),2&i){const t=e.oxw(2);e.xp6(2),e.hij(" ",null==t.appConfig||null==t.appConfig.CorePrint?null:t.appConfig.CorePrint.Alias.Discount2," "),e.xp6(1),e.Q6J("ngIf",t.isIgnoreDecimalDisc2),e.xp6(1),e.Q6J("ngIf",!(null!=t.appConfig&&t.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal)),e.xp6(2),e.Oqu(e.lcZ(7,4,-1*t.calculatorService.Discount2Amount))}}function Kt(i,a){if(1&i&&(e.TgZ(0,"tr")(1,"th",12),e._uU(2),e.qZA(),e.TgZ(3,"td",16),e._uU(4),e.ALo(5,"number"),e.qZA()()),2&i){const t=e.oxw(2);e.xp6(2),e.AsE(" ",null==t.appConfig||null==t.appConfig.CorePrint?null:t.appConfig.CorePrint.Alias.DiscountAmount," ",t.calculatorService.currencySymbol," "),e.xp6(2),e.Oqu(e.lcZ(5,3,-1*t.salesOrder.Order.DiscountAmount))}}function jt(i,a){if(1&i&&(e.TgZ(0,"tr")(1,"th",12),e._uU(2),e.qZA(),e.TgZ(3,"td",14),e._uU(4),e.ALo(5,"number"),e.qZA()()),2&i){const t=e.oxw(2);e.xp6(2),e.hij(" ",null==t.calculatorService||null==t.calculatorService.tax?null:t.calculatorService.tax.Label," "),e.xp6(2),e.Oqu(e.lcZ(5,2,null==t.calculatorService?null:t.calculatorService.TaxAmount))}}function Wt(i,a){if(1&i&&(e.TgZ(0,"tr")(1,"th",12),e._uU(2),e.ALo(3,"number"),e.qZA(),e.TgZ(4,"td",17),e._uU(5),e.ALo(6,"number"),e.qZA()()),2&i){const t=e.oxw(2);e.xp6(2),e.hij(" SURCHARGE ",e.lcZ(3,3,null==t.salesOrder?null:t.salesOrder.Invoice.SurchargePcg),"% "),e.xp6(2),e.Q6J("ngClass",(null==t.salesOrder?null:t.salesOrder.Invoice.SurchargePcg)<0?"text-danger":""),e.xp6(1),e.hij(" ",e.lcZ(6,5,null==t.calculatorService?null:t.calculatorService.SurchargeAmount),"")}}function zt(i,a){if(1&i&&(e.TgZ(0,"tr")(1,"th",18),e._uU(2,"Deposit"),e.qZA(),e.TgZ(3,"td",16),e._uU(4),e.ALo(5,"number"),e.qZA()()),2&i){const t=e.oxw(2);e.xp6(4),e.Oqu(e.lcZ(5,1,-1*(null==t.salesOrder?null:t.salesOrder.Order.Deposit)))}}function Xt(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"div",9)(2,"div",10)(3,"table",11),e.YNc(4,qt,12,6,"ng-container",0),e.YNc(5,Vt,8,6,"tr",0),e.YNc(6,Gt,8,6,"tr",0),e.YNc(7,Kt,6,5,"tr",0),e.YNc(8,jt,6,4,"tr",0),e.YNc(9,Wt,7,7,"tr",0),e.YNc(10,zt,6,3,"tr",0),e.qZA()()(),e.BQk()),2&i){const t=e.oxw();e.xp6(4),e.Q6J("ngIf",t.salesOrder.TotalQuantity>0),e.xp6(1),e.Q6J("ngIf",0!=(null==t.salesOrder?null:t.salesOrder.Order.Discount)),e.xp6(1),e.Q6J("ngIf",0!=(null==t.salesOrder?null:t.salesOrder.Order.Discount2)),e.xp6(1),e.Q6J("ngIf",0!=(null==t.salesOrder?null:t.salesOrder.Order.DiscountAmount)),e.xp6(1),e.Q6J("ngIf",null==t.calculatorService||null==t.calculatorService.tax?null:t.calculatorService.tax.Rate),e.xp6(1),e.Q6J("ngIf",0!=(null==t.salesOrder?null:t.salesOrder.Invoice.SurchargePcg)),e.xp6(1),e.Q6J("ngIf",(null==t.salesOrder?null:t.salesOrder.Order.Deposit)>0&&t.appConfig.ApplicationParkAndRetrieve.Deposit.Enabled)}}function ei(i,a){if(1&i){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",19)(2,"button",3),e.NdJ("click",function(){e.CHM(t);const r=e.oxw();return e.KtG(r.onPark())}),e._UZ(3,"i",20),e._uU(4),e.qZA()(),e.BQk()}if(2&i){const t=e.oxw();e.xp6(4),e.hij(" ",(null==t.appConfig||null==t.appConfig.ApplicationParkAndRetrieve||null==t.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel?null:t.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkButtonLabel)||"Park"," ")}}const ti=function(i,a){return{"col-3":i,"col-6":a}};let ii=(()=>{class i{handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.payService.payOrder()}constructor(t,n,r,s,p,h,_,y,M){(0,o.Z)(this,"calculatorService",void 0),(0,o.Z)(this,"salesOrderService",void 0),(0,o.Z)(this,"userRoleService",void 0),(0,o.Z)(this,"outletService",void 0),(0,o.Z)(this,"pageInitialService",void 0),(0,o.Z)(this,"dialog",void 0),(0,o.Z)(this,"orderProcessorService",void 0),(0,o.Z)(this,"payService",void 0),(0,o.Z)(this,"parkOrderService",void 0),(0,o.Z)(this,"destroy$",void 0),(0,o.Z)(this,"salesOrder",void 0),(0,o.Z)(this,"userRole",void 0),(0,o.Z)(this,"appConfig",void 0),(0,o.Z)(this,"parkLayoutPack",void 0),(0,o.Z)(this,"orderProcessor",void 0),(0,o.Z)(this,"isIgnoreDecimalDisc1",void 0),(0,o.Z)(this,"isIgnoreDecimalDisc2",void 0),(0,o.Z)(this,"outletRegister",void 0),(0,o.Z)(this,"parkOrderRetrieve",void 0),this.calculatorService=t,this.salesOrderService=n,this.userRoleService=r,this.outletService=s,this.pageInitialService=p,this.dialog=h,this.orderProcessorService=_,this.payService=y,this.parkOrderService=M,this.destroy$=new k.x}ngOnInit(){this.subscribeToObservable()}subscribeToObservable(){this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.salesOrderService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.salesOrder=t,this.initIgnoreDecimal()}),this.userRoleService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.userRole=t}),this.outletService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.outletRegister=t,this.parkLayoutPack=t.ParkLayoutPack}),this.orderProcessorService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.orderProcessor=t})}initIgnoreDecimal(){this.isIgnoreDecimalDisc1=this.checkIgnoreDecimalDisc(this.salesOrder.Order.Discount),this.isIgnoreDecimalDisc2=this.checkIgnoreDecimalDisc(this.salesOrder.Order.Discount2)}onPark(){this.parkOrderService.parkOrder()}onOpenModalDiscount(){this.dialog.open(Ne)}onPayOrder(){this.payService.payOrder()}checkIgnoreDecimalDisc(t){return this.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal&&t%1==0}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.Y36(X.J),e.Y36(P.q),e.Y36(w.J),e.Y36(D.o),e.Y36(T.W),e.Y36(x.uw),e.Y36(A.d),e.Y36(Ee),e.Y36(j))}),(0,o.Z)(i,"\u0275cmp",e.Xpm({type:i,selectors:[["sell-cart-footer"]],hostBindings:function(t,n){1&t&&e.NdJ("keydown.F8",function(s){return n.handleF8(s)},!1,e.Jf7)},inputs:{parkOrderRetrieve:"parkOrderRetrieve"},decls:16,vars:14,consts:[[4,"ngIf"],[1,"row","mt-2","d-flex","align-items-center"],[1,"pe-0",3,"ngClass"],["type","button",1,"btn","btn-gray","w-100","fs-3","px-0","py-6",3,"click"],[1,"fa-solid","fa-tag","me-2"],["matTooltipPosition","above",1,"col-6","pe-0",3,"matTooltip"],["type","button",1,"btn","btn-success","w-100","fs-1","py-4",3,"disabled","click"],[1,"d-flex","justify-content-between","align-items-center"],[1,"fs-3"],[1,"row"],[1,"col-12","pe-3","pt-3"],[1,"table","table-borderless"],[1,"text-start"],[1,"ms-2","fs-6"],[1,"text-end"],["title","Gross Total",1,"fs-5"],[1,"text-end","text-danger"],[1,"text-end",3,"ngClass"],[1,"table-light",2,"vertical-align","middle","line-height","30px !important"],[1,"col-3","pe-0"],[1,"fa-solid","fa-floppy-disk","me-2"]],template:function(t,n){1&t&&(e.YNc(0,Xt,11,7,"ng-container",0),e.TgZ(1,"div",1),e.YNc(2,ei,5,1,"ng-container",0),e.TgZ(3,"div",2)(4,"button",3),e.NdJ("click",function(){return n.onOpenModalDiscount()}),e._UZ(5,"i",4),e._uU(6,"Discount "),e.qZA()(),e.TgZ(7,"div",5)(8,"button",6),e.NdJ("click",function(){return n.onPayOrder()}),e.TgZ(9,"div",7)(10,"span"),e._uU(11,"Pay:"),e.qZA(),e.TgZ(12,"span",8),e._uU(13),e.ALo(14,"number"),e.ALo(15,"async"),e.qZA()()()()()),2&t&&(e.Q6J("ngIf",n.userRole.PriceVisible),e.xp6(2),e.Q6J("ngIf",n.appConfig.ApplicationParkAndRetrieve.Basic.EnableParkAndRetrieve),e.xp6(1),e.Q6J("ngClass",e.WLB(11,ti,n.appConfig.ApplicationParkAndRetrieve.Basic.EnableParkAndRetrieve,!n.appConfig.ApplicationParkAndRetrieve.Basic.EnableParkAndRetrieve)),e.xp6(4),e.Q6J("matTooltip",n.userRole.Payment?"":"You don\u2019t have access to pay this transaction"),e.xp6(1),e.Q6J("disabled",!n.userRole.Payment),e.xp6(5),e.hij(" ",e.xi3(14,6,e.lcZ(15,9,n.calculatorService.Data$),"1.0-4")," "))},dependencies:[g.mk,g.O5,Y.gM,g.Ov,g.JJ],styles:[".table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] > th[_ngcontent-%COMP%] span[_ngcontent-%COMP%], .table[_ngcontent-%COMP%] td[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{padding:0}"]})),i})();var ee=l(41206),U=l(28255);function ni(i,a){if(1&i){const t=e.EpF();e.ynx(0),e.TgZ(1,"td")(2,"input",27),e.NdJ("ngModelChange",function(r){e.CHM(t);const s=e.oxw().$implicit;return e.KtG(s.Splited=r)}),e.qZA()(),e.BQk()}if(2&i){const t=e.oxw().$implicit;e.xp6(2),e.Q6J("ngModel",t.Splited)}}function oi(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"td",28)(2,"small"),e._uU(3),e.qZA()(),e.BQk()),2&i){const t=e.oxw().index;e.xp6(3),e.hij("",t+1,".")}}function ri(i,a){if(1&i&&(e.ynx(0),e._UZ(1,"img",29),e.BQk()),2&i){const t=e.oxw().$implicit;e.xp6(1),e.Q6J("src",null==t.Variant?null:t.Variant.ImageUrl,e.LSH)}}function ai(i,a){1&i&&(e.TgZ(0,"div",30),e._UZ(1,"i",31),e.qZA())}function si(i,a){1&i&&(e.ynx(0),e.TgZ(1,"i",34),e._uU(2,"V"),e.qZA(),e.BQk())}function li(i,a){1&i&&(e.TgZ(0,"i",35),e._uU(1,"N"),e.qZA())}function ci(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"span",32),e.YNc(2,si,3,0,"ng-container",13),e.YNc(3,li,2,0,"ng-template",null,33,e.W1O),e.qZA(),e.BQk()),2&i){const t=e.MAs(4),n=e.oxw().$implicit;e.xp6(2),e.Q6J("ngIf",n.Taxable)("ngIfElse",t)}}function di(i,a){1&i&&(e.ynx(0),e._UZ(1,"i",36),e.BQk())}function pi(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"small",37),e._uU(2),e.qZA(),e.BQk()),2&i){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",t.Variant.CategoryName," ")}}function ui(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"small",38),e._uU(2),e.qZA(),e.BQk()),2&i){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",t.Variant.BrandName," ")}}function mi(i,a){if(1&i&&(e.ynx(0),e._UZ(1,"small",39),e.BQk()),2&i){const t=e.oxw().$implicit;e.xp6(1),e.Q6J("innerHtml",t.Note,e.oJD)}}function gi(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"small",40),e._uU(2," Sold by "),e.TgZ(3,"i"),e._uU(4),e.qZA()(),e.BQk()),2&i){const t=e.oxw().$implicit;e.xp6(4),e.Oqu(t.SalesName)}}function hi(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"small")(2,"i",41),e._uU(3),e.qZA()(),e.BQk()),2&i){const t=e.oxw().$implicit;e.xp6(3),e.hij("Fulfillment from: ",t.EntityName,"")}}function fi(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"span")(1,"input",45),e.NdJ("ngModelChange",function(r){e.CHM(t);const s=e.oxw(2).$implicit;return e.KtG(s.SplitQuantity=r)}),e.qZA(),e._uU(2,"/ "),e.qZA()}if(2&i){const t=e.oxw(2).$implicit;e.xp6(1),e.Q6J("min",0)("max",t.Quantity-1)("ngModel",t.SplitQuantity)}}function _i(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"div",42),e.YNc(2,fi,3,3,"span",9),e.TgZ(3,"span",43),e._uU(4),e.ALo(5,"number"),e.qZA(),e.TgZ(6,"span",44),e._uU(7,"x"),e.qZA()(),e.BQk()),2&i){const t=e.oxw().$implicit,n=e.oxw();e.xp6(2),e.Q6J("ngIf",t.Splited&&n.isSplit()),e.xp6(2),e.Oqu(e.xi3(5,2,t.Quantity,"1.0-4"))}}function vi(i,a){if(1&i&&(e.TgZ(0,"span",50),e._uU(1),e.qZA()),2&i){const t=e.oxw(2).$implicit;e.xp6(1),e.hij("@",t.VariantUnitQuantity,"")}}function Ci(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"small",51),e._uU(2),e.qZA(),e.BQk()),2&i){const t=e.oxw(2).$implicit,n=e.oxw();e.xp6(2),e.Oqu(n.isNotEmpty(t.Variant.UOM)?t.Variant.UOMName:"")}}function bi(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"div",46)(2,"span",47),e._uU(3),e.qZA(),e.YNc(4,vi,2,1,"span",48),e.YNc(5,Ci,3,1,"ng-container",9),e.TgZ(6,"span",49),e._uU(7,"x"),e.qZA()(),e.BQk()),2&i){const t=e.oxw().$implicit,n=e.oxw();e.xp6(3),e.Oqu(t.UnitQuantity),e.xp6(1),e.Q6J("ngIf",t.VariantUnitQuantity>1),e.xp6(1),e.Q6J("ngIf",n.isNotEmpty(t.Variant.UOM)&&t.UnitQuantity>1)}}function xi(i,a){if(1&i){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",52),e.NdJ("click",function(){e.CHM(t);const r=e.oxw().index,s=e.oxw();return e.KtG(s.onEditItem(r,"Price"))}),e._uU(2),e.ALo(3,"number"),e.qZA(),e.BQk()}if(2&i){const t=e.oxw().$implicit,n=e.oxw();e.xp6(2),e.hij(" ",n.userRole.PriceVisible?e.xi3(3,1,t.Price,"1.0-4"):" - "," ")}}function yi(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"div"),e._uU(2),e.ALo(3,"number"),e.qZA(),e.BQk()),2&i){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",0==t.Discount?"":e.lcZ(3,1,-1*t.Discount)+"%"," ")}}function Si(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"div"),e._uU(2),e.ALo(3,"number"),e.qZA(),e.BQk()),2&i){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",0==t.DiscountAmount?"":e.lcZ(3,1,-1*t.DiscountAmount)," ")}}function Zi(i,a){if(1&i){const t=e.EpF();e.ynx(0),e.TgZ(1,"span",53),e.NdJ("click",function(){e.CHM(t);const r=e.oxw().$implicit,s=e.oxw();return e.KtG(s.removeItem(r))}),e._UZ(2,"i",54),e.qZA(),e.BQk()}}const Ii=function(i){return{"ps-0":i}};function Ti(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"tr",8),e.NdJ("contextmenu",function(r){const s=e.CHM(t),p=s.$implicit,h=s.index,_=e.oxw();return e.KtG(_.onContextMenu(r,p,h))}),e.YNc(1,ni,3,1,"ng-container",9),e.YNc(2,oi,4,1,"ng-container",9),e.TgZ(3,"td",10),e.NdJ("click",function(){const s=e.CHM(t).index,p=e.oxw();return e.KtG(p.onEditItem(s))}),e.TgZ(4,"div",11)(5,"span",12),e.YNc(6,ri,2,1,"ng-container",13),e.YNc(7,ai,2,0,"ng-template",null,14,e.W1O),e.qZA(),e.TgZ(9,"div",15)(10,"div",16)(11,"span",17),e._uU(12),e.qZA(),e.YNc(13,ci,5,2,"ng-container",9),e.YNc(14,di,2,0,"ng-container",9),e.qZA(),e.TgZ(15,"div",18),e._uU(16),e.qZA(),e.YNc(17,pi,3,1,"ng-container",9),e.YNc(18,ui,3,1,"ng-container",9),e.YNc(19,mi,2,1,"ng-container",9),e.YNc(20,gi,5,1,"ng-container",9),e.YNc(21,hi,4,1,"ng-container",9),e.qZA()()(),e.TgZ(22,"td",19)(23,"div",20)(24,"div",21),e.YNc(25,_i,8,5,"ng-container",9),e.YNc(26,bi,8,3,"ng-container",9),e.YNc(27,xi,4,4,"ng-container",9),e.qZA()()(),e.TgZ(28,"td")(29,"div",22),e.NdJ("click",function(){const s=e.CHM(t).index,p=e.oxw();return e.KtG(p.onEditItem(s,"Price"))}),e.YNc(30,yi,4,3,"ng-container",9),e.YNc(31,Si,4,3,"ng-container",9),e.qZA()(),e.TgZ(32,"td",23),e.NdJ("click",function(){const s=e.CHM(t).index,p=e.oxw();return e.KtG(p.onEditItem(s))}),e.TgZ(33,"div",20)(34,"div",24),e._uU(35),e.ALo(36,"number"),e.qZA()()(),e.TgZ(37,"td",25)(38,"div",26),e.YNc(39,Zi,3,0,"ng-container",9),e.qZA()()()}if(2&i){const t=a.$implicit,n=e.MAs(8),r=e.oxw();e.xp6(1),e.Q6J("ngIf",r.isSplit()&&t.Quantity>1),e.xp6(1),e.Q6J("ngIf",null==r.appConfig||null==r.appConfig.ModuleSell?null:r.appConfig.ModuleSell.Grid.RowNumberVisible),e.xp6(1),e.Q6J("ngClass",e.VKq(23,Ii,null==r.appConfig||null==r.appConfig.ModuleSell?null:r.appConfig.ModuleSell.Grid.RowNumberVisible)),e.xp6(3),e.Q6J("ngIf",null==t.Variant?null:t.Variant.ImageUrl)("ngIfElse",n),e.xp6(6),e.hij(" ",t.Variant.Name," "),e.xp6(1),e.Q6J("ngIf",null==r.appConfig||null==r.appConfig.ModuleSell?null:r.appConfig.ModuleSell.Grid.TaxVisible),e.xp6(1),e.Q6J("ngIf",t.PromotionGift),e.xp6(2),e.hij("",null==t||null==t.Variant?null:t.Variant.Code," "),e.xp6(1),e.Q6J("ngIf",null==r.appConfig||null==r.appConfig.ModuleSell?null:r.appConfig.ModuleSell.Grid.CategoryVisible),e.xp6(1),e.Q6J("ngIf",null==r.appConfig||null==r.appConfig.ModuleSell?null:r.appConfig.ModuleSell.Grid.ShowBrandItemCart),e.xp6(1),e.Q6J("ngIf",t.Note),e.xp6(1),e.Q6J("ngIf",t.SalesName),e.xp6(1),e.Q6J("ngIf",t.EntityName),e.xp6(4),e.Q6J("ngIf",t.Quantity>1),e.xp6(1),e.Q6J("ngIf",t.UnitQuantity>1),e.xp6(1),e.Q6J("ngIf",t.Price!==t.Total),e.xp6(3),e.Q6J("ngIf",t.Discount>0),e.xp6(1),e.Q6J("ngIf",t.DiscountAmount>0),e.xp6(4),e.Oqu(r.userRole.PriceVisible?e.lcZ(36,21,t.Total):" - "),e.xp6(4),e.Q6J("ngIf",r.hasItemDeletion)}}function Oi(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"button",55),e.NdJ("click",function(){const s=e.CHM(t).item,p=e.oxw();return e.KtG(p.onReverse(s,!0))}),e._uU(1," Return "),e.qZA(),e.TgZ(2,"button",56),e.NdJ("click",function(){const s=e.CHM(t).item,p=e.oxw();return e.KtG(p.onReverse(s,!1))}),e._uU(3,"Sales"),e.qZA(),e.TgZ(4,"button",55),e.NdJ("click",function(){const s=e.CHM(t).item,p=e.oxw();return e.KtG(p.onSumPrice(s))}),e._uU(5," Merge / SUM Price "),e.qZA(),e.TgZ(6,"button",55),e.NdJ("click",function(){const s=e.CHM(t).item,p=e.oxw();return e.KtG(p.onBundlePrice(s))}),e._uU(7," Bundle Price "),e.qZA()}if(2&i){const t=e.oxw();e.Q6J("disabled",!t.userRole.Return),e.xp6(4),e.Q6J("disabled",!t.userRole.BundlingPrice),e.xp6(2),e.Q6J("disabled",!t.userRole.BundlingPrice)}}let Di=(()=>{class i{constructor(t,n,r,s,p,h,_){(0,o.Z)(this,"salesOrderService",void 0),(0,o.Z)(this,"roleService",void 0),(0,o.Z)(this,"shoppingCartService",void 0),(0,o.Z)(this,"pageInitialService",void 0),(0,o.Z)(this,"dialog",void 0),(0,o.Z)(this,"orderProcessorService",void 0),(0,o.Z)(this,"registerService",void 0),(0,o.Z)(this,"destroy$",void 0),(0,o.Z)(this,"cartItems",[]),(0,o.Z)(this,"userRole",void 0),(0,o.Z)(this,"appConfig",void 0),(0,o.Z)(this,"currentSellState",void 0),(0,o.Z)(this,"hasItemDeletion",void 0),(0,o.Z)(this,"eventAddItem",void 0),(0,o.Z)(this,"isAddItem",!0),(0,o.Z)(this,"contextMenu",void 0),(0,o.Z)(this,"contextMenuPosition",{x:"0px",y:"0px"}),this.salesOrderService=t,this.roleService=n,this.shoppingCartService=r,this.pageInitialService=s,this.dialog=p,this.orderProcessorService=h,this.registerService=_,this.destroy$=new k.x,this.eventAddItem=new e.vpe}ngOnInit(){this.subscribeToObservable()}onContextMenu(t,n,r){t.preventDefault(),this.contextMenuPosition.x=t.clientX+"px",this.contextMenuPosition.y=t.clientY+"px",n.Index=r,this.contextMenu.menuData={item:n},this.contextMenu.openMenu()}subscribeToObservable(){this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.salesOrderService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.emitEventAddItem(t.CartItems),this.cartItems=t.CartItems,this.setItemSalesName(),this.setItemFulfillmentName()}),this.roleService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.userRole=t,this.initConfigItemDeletion()}),this.orderProcessorService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.currentSellState=t.posState,this.initConfigItemDeletion()})}emitEventAddItem(t=[]){t.length!==this.cartItems.length&&this.isAddItem&&this.eventAddItem.emit(),this.isAddItem=!0}initConfigItemDeletion(){this.hasItemDeletion=!0,(this.currentSellState==C.J.IsSplit||!this.userRole.DeleteItem||this.appConfig.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion&&this.currentSellState==C.J.IsRetrieve||this.currentSellState==C.J.IsBill)&&(this.hasItemDeletion=!1)}setItemSalesName(){this.cartItems=this.cartItems.map(t=>(t.SalesName=this.registerService.getSalesname(t.SalesID),t))}setItemFulfillmentName(){this.cartItems=this.cartItems.map(t=>(t.EntityName=this.pageInitialService.getOutletName(t.EntityID),t))}isNotEmpty(t){return m.gT.IsNotEmpty(t)}drop(t){(0,ee.bA)(this.cartItems,t.previousIndex,t.currentIndex)}removeItem(t){this.isAddItem=!1,this.shoppingCartService.deleteCartItem(t)}onReverse(t,n){n?t.Quantity>0&&(t.Quantity=-1*t.Quantity):t.Quantity<0&&(t.Quantity=-1*t.Quantity),this.shoppingCartService.updateCartItem(t,t.Index)}onSumPrice(t){let n=0;this.cartItems.forEach((r,s)=>{n+=r.Quantity*r.Price*(100-r.Discount)/100-r.DiscountAmount,r.Price=0}),t.Price=n/t.Quantity,this.shoppingCartService.updateCartItem(t,t.Index)}onBundlePrice(t){let n=0;this.cartItems.forEach((r,s)=>{s!=t.Index&&(n+=r.Quantity*r.Price*(100-r.Discount)/100-r.DiscountAmount,r.Price=0)}),0==t.Price&&(t.Price=n/t.Quantity),this.shoppingCartService.updateCartItem(t,t.Index)}onEditItem(t,n){this.isAddItem=!1,this.dialog.open(q.k,{data:{index:t,focus:n}})}isSplit(){return this.currentSellState==C.J.IsSplit}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.Y36(P.q),e.Y36(w.J),e.Y36(W.F),e.Y36(T.W),e.Y36(x.uw),e.Y36(A.d),e.Y36(D.o))}),(0,o.Z)(i,"\u0275cmp",e.Xpm({type:i,selectors:[["sell-cart-body"]],viewQuery:function(t,n){if(1&t&&e.Gf(U.p6,7),2&t){let r;e.iGM(r=e.CRH())&&(n.contextMenu=r.first)}},outputs:{eventAddItem:"eventAddItem"},decls:9,vars:6,consts:[[1,"row","g-0"],[1,"col-12"],[1,"table","table-borderless"],["cdkDropList","",3,"cdkDropListDropped"],["cdkDrag","","style","border-bottom: 0.5px solid #dee2e6",3,"contextmenu",4,"ngFor","ngForOf"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],["contextMenu","matMenu"],["matMenuContent",""],["cdkDrag","",2,"border-bottom","0.5px solid #dee2e6",3,"contextmenu"],[4,"ngIf"],[2,"width","40%",3,"ngClass","click"],[1,"d-flex","align-items-center"],[1,"me-4"],[4,"ngIf","ngIfElse"],["NO_IMAGE",""],[1,"d-block",2,"line-height","18px"],[1,"fw-normal","fs-5"],[1,"me-1"],["title","Product Code",1,"fw-normal","fs-6","text-muted"],[1,"px-0","text-end",2,"width","15%"],[1,"d-flex","align-items-center","justify-content-end"],[1,"d-flex","text-end","fw-normal","align-items-center",2,"line-height","20px"],[1,"d-block","fw-normal","fs-6","text-danger","ps-3",3,"click"],[3,"click"],[1,"fs-5"],[1,"mt-6"],[1,"d-flex","justify-content-center","align-items-center"],["type","checkbox",3,"ngModel","ngModelChange"],[2,"width","10px"],[1,"item-image",3,"src"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],[1,"fst-italic","m-0","me-1"],["NotTaxable",""],["title","Taxable",1,"text-success"],["title","Non taxable",1,"text-danger"],["title","Product Promotion",1,"fa-solid","fa-gift"],["title","Product Category",1,"fst-italic","text-muted","d-block"],["title","Brand Name",1,"text-muted","d-block"],[1,"special-TinyMCE","m-0","fst-italic","d-block",3,"innerHtml"],["title","Sales Name",1,"text-success","fst-italic","d-block"],[1,"text-warning","d-block"],[1,"d-flex","algin-items-center","me-1"],[1,"me-1","fs-5"],[1,"fs-6"],["type","text","autoNum","",1,"text-end",2,"width","25px",3,"min","max","ngModel","ngModelChange"],[1,"d-flex","algin-items-center"],["title","Unit Quantity",1,"fs-5"],["class","me-1 fs-5","title","Variant Unit Quantity",4,"ngIf"],[1,"fs-6","me-1"],["title","Variant Unit Quantity",1,"me-1","fs-5"],["title","UOM",1,"ps-1","me-1"],["title","Price",1,"fs-5",3,"click"],["title","Delete Item",1,"me-4","fs-3","cursor-pointer",3,"click"],[1,"fa","fa-trash","text-danger","fs-4"],["mat-menu-item","",3,"disabled","click"],["mat-menu-item","",3,"click"]],template:function(t,n){if(1&t&&(e.TgZ(0,"div",0)(1,"div",1)(2,"table",2)(3,"tbody",3),e.NdJ("cdkDropListDropped",function(s){return n.drop(s)}),e.YNc(4,Ti,40,25,"tr",4),e.qZA()()()(),e._UZ(5,"div",5),e.TgZ(6,"mat-menu",null,6),e.YNc(8,Oi,8,3,"ng-template",7),e.qZA()),2&t){const r=e.MAs(7);e.xp6(4),e.Q6J("ngForOf",n.cartItems),e.xp6(1),e.Udp("left",n.contextMenuPosition.x)("top",n.contextMenuPosition.y),e.Q6J("matMenuTriggerFor",r)}},dependencies:[g.mk,g.sg,g.O5,Z.Fj,Z.Wl,Z.JJ,Z.On,ee.Wj,ee.Zt,U.VK,U.OP,U.KA,U.p6,Ae.b,g.JJ],styles:["span[_ngcontent-%COMP%] > .item-image[_ngcontent-%COMP%]{height:50px;width:50px;display:block;margin:0 auto;border:solid 1px #dddddd;border-radius:5px}"]})),i})();var Pi=l(23339),Mi=l(5607),ki=l(77814),Ai=l(79098),Ni=l(43111),wi=l(92408);class Ri{constructor(){(0,o.Z)(this,"ID",void 0),(0,o.Z)(this,"Name",void 0),(0,o.Z)(this,"Code",void 0),(0,o.Z)(this,"Address",void 0),(0,o.Z)(this,"Phone",void 0),(0,o.Z)(this,"Email",void 0),(0,o.Z)(this,"SalesTarget",void 0),(0,o.Z)(this,"SalesPersonGroupID",void 0),(0,o.Z)(this,"Bin",void 0)}}var Ji=l(54004);let Ei=(()=>{class i{constructor(t,n){(0,o.Z)(this,"data",void 0),(0,o.Z)(this,"dialogRef",void 0),(0,o.Z)(this,"modalConfig",void 0),(0,o.Z)(this,"message",void 0),this.data=t,this.dialogRef=n,this.message=t.message,this.modalConfig=new xe.O,this.modalConfig.title=t.title,this.modalConfig.okText="Yes",this.modalConfig.cancelText="No"}ngOnInit(){}onOk(){this.dialogRef.close(!0)}onClose(){this.dialogRef.close(!1)}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.Y36(x.WI),e.Y36(x.so))}),(0,o.Z)(i,"\u0275cmp",e.Xpm({type:i,selectors:[["app-modal-confirm"]],decls:4,vars:2,consts:[[3,"config","onOk","onCancel","onClose"],[1,"fs-4","mb-0"]],template:function(t,n){1&t&&(e.TgZ(0,"modal-material",0),e.NdJ("onOk",function(){return n.onOk()})("onCancel",function(){return n.onClose()})("onClose",function(){return n.onClose()}),e.TgZ(1,"content")(2,"p",1),e._uU(3),e.qZA()()()),2&t&&(e.Q6J("config",n.modalConfig),e.xp6(3),e.Oqu(n.message))},dependencies:[z.M]})),i})();class Qi{constructor(){(0,o.Z)(this,"menus",void 0),this.menus=[{label:"Add",class:"fa-circle-plus fa-solid fs-2 me-3 ms-2",action:"ADD_ITEM"},{label:"Coupon",class:"fa fa-coupon me-1",action:"COUPON"},{label:"Serial",class:"fa-barcode-read fa-solid fs-1 me-2 ms-1 text-black",action:"SERIAL"},{label:"Promotion",class:"fa-gift fas fs-1 text-black ms-2 me-2",action:"PROMOTION"},{label:"Upload",class:"fa-solid fa-upload fs-2 ms-3 me-2",action:"UPLOAD"},{label:"Return",class:"fa fa-retur retur-badge me-1 ms-1",action:"RETURN"},{label:"Clear",class:"fa-solid fa-trash fs-2 me-2 ms-4",action:"CLEAR"},{label:"Split",class:"fa-solid fa-split fs-1 ms-1 me-3",action:"SPLIT"},{label:"Cancel Split",class:"fa-solid fa-xmark",action:"CANCEL"},{label:"Print",class:"fa-print fa-solid fs-3 ms-4 me-3",action:"PRINT"},{label:"Sync Order",class:"fas fa-rotate text-black fs-3 me-2 ms-3",action:"SYNC"}]}get getMenu(){return this.menus}}var Qe=l(59660),Ui=l(69751),Li=l(63900);let Fi=(()=>{class i{constructor(t,n,r,s,p,h,_){(0,o.Z)(this,"customerHttpService",void 0),(0,o.Z)(this,"salesOrderService",void 0),(0,o.Z)(this,"pageInitialService",void 0),(0,o.Z)(this,"shoppingCartService",void 0),(0,o.Z)(this,"invoiceCalculatorService",void 0),(0,o.Z)(this,"orderProcessorService",void 0),(0,o.Z)(this,"toastr",void 0),(0,o.Z)(this,"customerId",void 0),(0,o.Z)(this,"customerData",void 0),this.customerHttpService=t,this.salesOrderService=n,this.pageInitialService=r,this.shoppingCartService=s,this.invoiceCalculatorService=p,this.orderProcessorService=h,this.toastr=_}addCustomerById(t){return new Ui.y(n=>{this.customerId=JSON.parse(JSON.stringify(this.salesOrderService.Data.Order.CustomerID)),this.resetCartOnChangeCustomer(t),m.gT.IsNotEmpty(t)&&this.salesOrderService.updateCustomerID(t).then(r=>{this.applyCustomerPricebook(r),this.updateTaxCustomer(r.TaxTypeId),this.setSalesOrderCustomerId(r),this.setCustomerData(r),null==this.customerData.DiscountRate&&(this.customerData.DiscountRate=0),this.updateDiscountRate(this.customerData.DiscountRate);let s=this.checkResetRedeemPoint();this.orderProcessorService.reedemPointToDiscount(s),n.next(r)})})}addCustomerByCode(t){return this.salesOrderService.Data.ContactName=null,this.customerHttpService.findCustomerByCode(t).pipe((0,Li.w)(n=>(this.salesOrderService.Data.ContactName=n.Display,this.addCustomerById(n.ID))))}setSalesOrderCustomerId(t){const n=this.salesOrderService.Data;m.gT.IsNotEmpty(t.SalesID)&&(n.Order.SalesID=t.SalesID)}setCustomerData(t){const n=this.salesOrderService.Data;t.EntityID==m.gT.GuidEmpty?this.customerData=t:t.EntityID!=n.Order.EntityID?(n.Order.CustomerID=null,n.ContactName=null,alert("your customer has a exclusive outlet")):this.customerData=t}checkResetRedeemPoint(){let t=!1;return m.gT.IsNotEmpty(this.customerId)&&(t=!0),t}applyCustomerPricebook(t){const n=this.salesOrderService.Data;if(m.gT.IsNotEmpty(t.PricebookID)){let r=n.CartItems.map(s=>(s.Variant.PriceBook&&0!==s.Variant.PriceBook.length&&s.Variant.PriceBook.forEach(p=>{p.ID===t.PricebookID&&(s=this.shoppingCartService.applyPricebookToItem(s,p))}),s));n.CartItems=r}}updateTaxCustomer(t){let r=this.pageInitialService.Data.Taxes.find(s=>s.ID==t);r&&(this.salesOrderService.Data.Order.TaxTypeID=r.ID,this.invoiceCalculatorService.tax=r)}resetCartOnChangeCustomer(t){this.customerId!=t&&this.pageInitialService.Data.AppConfigJSON.ModuleSell.Customer.ClearCartOnChange&&(this.salesOrderService.Data.CartItems=[]),this.customerId=t}updateDiscountRate(t=0){this.salesOrderService.Data.Order.Discount=t}onEmptyInputCustomer(){this.orderProcessorService.Data.InputTextValue="",this.resetCustomerPricebook(),this.resetAppliedPoint(),this.customerId=JSON.parse(JSON.stringify(this.salesOrderService.Data.Order.CustomerID)),this.customerData=null,this.salesOrderService.Data.ContactName=null,this.salesOrderService.Data.Order.CustomerID=null,this.customerHttpService.Data=new Qe.B,this.customerData=new Qe.B,this.updateDiscountRate()}resetCustomerPricebook(){if(this.customerData){let t=this.customerData.PricebookID;m.gT.IsNotEmpty(t)&&(this.salesOrderService.Data.CartItems=this.salesOrderService.Data.CartItems.map(r=>(r.PriceBookID==t&&(r.Discount=r.Variant.PriceDiscount,r.Note=r.Variant.PriceNote,r.PriceNote=r.Variant.PriceNote,r.PriceBookID=m.gT.GuidEmpty,r.Price=r.Variant.UnitPrice,r.UnitPrice=r.Variant.UnitPrice),r)))}}resetAppliedPoint(){const r=this.salesOrderService.Data;this.pageInitialService.Data.AppConfigJSON.ApplicationLoyalty.Rules.PrefferedPayment&&this.customerData.Point>0&&(r.Order.PointUsed=0,r.Order.DiscountAmount=0)}redeemPoint(t){const r=this.salesOrderService.Data;let s=this.pageInitialService.Data.AppConfigJSON.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,p=t*s;const h=r.RedeemableAmount;p>h&&(t=Math.ceil(h/s),p=h,this.toastr.warning("You enter the number of points more than the total amount","Points Adjusted")),r.Order.PointUsed=t,r.Order.DiscountAmount=p,this.salesOrderService.pushNewValue(r)}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.LFG(ke.r),e.LFG(P.q),e.LFG(T.W),e.LFG(W.F),e.LFG(X.J),e.LFG(A.d),e.LFG(R._W))}),(0,o.Z)(i,"\u0275prov",e.Yz7({token:i,factory:i.\u0275fac,providedIn:"root"})),i})();var Ue=l(4859);function qi(i,a){if(1&i){const t=e.EpF();e.ynx(0),e.TgZ(1,"span",25),e.NdJ("click",function(){e.CHM(t);const r=e.oxw(2);return e.KtG(r.showPointModal())}),e._UZ(2,"i",26),e.TgZ(3,"span",21),e._uU(4),e.ALo(5,"number"),e.qZA()(),e.BQk()}if(2&i){const t=e.oxw(2);e.xp6(4),e.Oqu(null!=t.customerData&&t.customerData.Point?e.lcZ(5,1,null==t.customerData?null:t.customerData.Point):0)}}function Yi(i,a){if(1&i&&(e.ynx(0),e._uU(1),e.ALo(2,"number"),e.BQk()),2&i){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.lcZ(2,1,null==t.customerData?null:t.customerData.Debt)," ")}}function Bi(i,a){1&i&&(e.TgZ(0,"span"),e._uU(1,"-"),e.qZA())}function Vi(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"span"),e._uU(2),e.ALo(3,"number"),e.qZA(),e.BQk()),2&i){const t=e.oxw(2);e.xp6(2),e.Oqu(e.lcZ(3,1,null==t.customerData?null:t.customerData.DebtLimit))}}function Hi(i,a){1&i&&(e.TgZ(0,"span"),e._uU(1,"\u221e"),e.qZA())}function $i(i,a){if(1&i&&(e.TgZ(0,"div",17),e.YNc(1,qi,6,3,"ng-container",18),e.TgZ(2,"span",19),e._UZ(3,"i",20),e.TgZ(4,"span",21),e.YNc(5,Yi,3,3,"ng-container",22),e.YNc(6,Bi,2,0,"ng-template",null,23,e.W1O),e.qZA(),e.TgZ(8,"span"),e._uU(9,"/"),e.qZA(),e.TgZ(10,"span"),e.YNc(11,Vi,4,3,"ng-container",22),e.YNc(12,Hi,2,0,"ng-template",null,24,e.W1O),e.qZA()()()),2&i){const t=e.MAs(7),n=e.MAs(13),r=e.oxw();e.xp6(1),e.Q6J("ngIf",r.isEnabledLoyaltyPoint),e.xp6(4),e.Q6J("ngIf",null==r.userRole?null:r.userRole.DebtView)("ngIfElse",t),e.xp6(6),e.Q6J("ngIf",(null==r.customerData?null:r.customerData.DebtLimit)>0)("ngIfElse",n)}}function Gi(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"mat-card",27)(1,"mat-calendar",28),e.NdJ("selectedChange",function(r){e.CHM(t);const s=e.oxw();return e.KtG(s.onSelectDate(r))}),e.qZA()()}if(2&i){const t=e.oxw();e.xp6(1),e.Q6J("selected",t.selectedDate)}}function Ki(i,a){if(1&i&&(e.TgZ(0,"span",34),e._uU(1),e.ALo(2,"number"),e.ALo(3,"async"),e.qZA()),2&i){const t=e.oxw(3);e.xp6(1),e.Oqu(e.lcZ(2,1,e.lcZ(3,3,t.promotionEligible$)))}}function ji(i,a){if(1&i&&(e.ynx(0),e.YNc(1,Ki,4,5,"span",33),e.ALo(2,"async"),e.BQk()),2&i){const t=e.oxw(2);e.xp6(1),e.Q6J("ngIf",0!=e.lcZ(2,1,t.promotionEligible$))}}function Wi(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"li")(1,"div",29),e.NdJ("click",function(){const s=e.CHM(t).$implicit,p=e.oxw();return e.KtG(p.moreMenuAction(s.action))}),e.TgZ(2,"span",30),e._UZ(3,"i",31),e.qZA(),e.TgZ(4,"span",32),e._uU(5),e.qZA(),e.YNc(6,ji,3,3,"ng-container",18),e.qZA()()}if(2&i){const t=a.$implicit;e.xp6(3),e.Tol(t.class),e.xp6(2),e.Oqu(t.label),e.xp6(1),e.Q6J("ngIf","PROMOTION"==t.action)}}const zi=function(i){return{"cursor-pointer":i}},Xi=function(i){return{"bg-gradient-warning":i}};let en=(()=>{class i{handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.dialog.open(q.k)}constructor(t,n,r,s,p,h,_,y,M,J,B){(0,o.Z)(this,"pageInitialService",void 0),(0,o.Z)(this,"salesOrderService",void 0),(0,o.Z)(this,"userRoleService",void 0),(0,o.Z)(this,"customerService",void 0),(0,o.Z)(this,"outletService",void 0),(0,o.Z)(this,"dialog",void 0),(0,o.Z)(this,"promotionEventService",void 0),(0,o.Z)(this,"orderProcessorService",void 0),(0,o.Z)(this,"parkOrderService",void 0),(0,o.Z)(this,"toastrService",void 0),(0,o.Z)(this,"_eref",void 0),(0,o.Z)(this,"moreMenu",[]),(0,o.Z)(this,"filteredMoreMenu",[]),(0,o.Z)(this,"customerData",void 0),(0,o.Z)(this,"salesOrder",void 0),(0,o.Z)(this,"appConfig",void 0),(0,o.Z)(this,"selectedDate",new Date),(0,o.Z)(this,"showDatePicker",void 0),(0,o.Z)(this,"selectedCustomerId",void 0),(0,o.Z)(this,"userRole",void 0),(0,o.Z)(this,"salesPersonList",[]),(0,o.Z)(this,"destroy$",void 0),(0,o.Z)(this,"outletRegister",void 0),(0,o.Z)(this,"currentSellState",void 0),(0,o.Z)(this,"salesPersonName",void 0),(0,o.Z)(this,"promotionEligible$",void 0),(0,o.Z)(this,"disabledSalesOption",!1),(0,o.Z)(this,"isEnabledLoyaltyPoint",void 0),(0,o.Z)(this,"isToday",!0),this.pageInitialService=t,this.salesOrderService=n,this.userRoleService=r,this.customerService=s,this.outletService=p,this.dialog=h,this.promotionEventService=_,this.orderProcessorService=y,this.parkOrderService=M,this.toastrService=J,this._eref=B,this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.destroy$=new k.x,this.moreMenu=(new Qi).getMenu,this.promotionEligible$=this.promotionEventService.Data$.pipe((0,Ji.U)(ie=>this.promotionEventService.getTotalEligiblePromotion()))}onCloseDatePicker(t){this._eref.nativeElement.contains(t.target)||(this.showDatePicker=!1)}ngOnInit(){this.subscribeToObservable()}subscribeToObservable(){this.userRoleService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.userRole=t,this.filterMoreMenu(C.J.IsNew)}),this.salesOrderService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.salesOrder=t,this.checkDisabledSalesOption(t.CartItems),m.gT.IsEmpty(this.salesOrder.Order.SalesID)&&(this.salesOrder.Order.SalesID=m.gT.GuidEmpty)}),this.outletService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.initSalesPerson(t.ListSales),this.outletRegister=t,this.initEnableLoyaltyPoint()}),this.promotionEventService.onClickToastPromo.pipe((0,f.R)(this.destroy$)).subscribe(t=>{t&&this.dialog.open(Se.t,{id:"promotion-event"})}),this.orderProcessorService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.filterMoreMenu(t.posState),this.currentSellState=t.posState})}checkDisabledSalesOption(t=[]){this.disabledSalesOption=!1,t.filter(r=>m.gT.IsNotEmpty(r.SalesID)).length>0&&(this.disabledSalesOption=!0)}filterMenuByRole(){return this.moreMenu.filter(t=>"RETURN"!=t.action||this.userRole?.Return)}filterMoreMenu(t){this.filteredMoreMenu=t==C.J.IsRetrieve?this.filterMenuByRole().filter(n=>"CANCEL"!==n.action):t==C.J.IsSplit?this.filterMenuByRole().filter(n=>"SPLIT"!==n.action):this.filterMenuByRole().filter(n=>"PRINT"!==n.action&&"SPLIT"!==n.action&&"CANCEL"!==n.action)}initSalesPerson(t){const n=new Ri;n.ID=m.gT.GuidEmpty,n.Name="-Sales Person-",this.salesPersonList=[n,...t]}onSelectDate(t){this.salesOrder.Order.Date=t,this.showDatePicker=!1,this.selectedDate=new Date(t),this.salesOrderService.pushNewValue(this.salesOrder),this.checkIsToday(t)}checkIsToday(t){if(t){const n=new Date;n.setHours(0,0,0,0),this.isToday=n.getTime()==t.getTime()}}onScanCodeCustomer(t){t.length>0&&this.customerService.addCustomerByCode(t).pipe((0,f.R)(this.destroy$)).subscribe(n=>{this.customerData=n,this.initEnableLoyaltyPoint()})}onSelectCustomer(t){this.customerService.addCustomerById(t).pipe((0,f.R)(this.destroy$)).subscribe(n=>{this.customerData=n,this.initEnableLoyaltyPoint()})}onInputCustomer(t){this.orderProcessorService.Data.InputTextValue=t,null!==t&&0==t.length&&(this.customerService.onEmptyInputCustomer(),this.customerData=null)}initEnableLoyaltyPoint(){this.isEnabledLoyaltyPoint=!1,!this.customerData?.LoyaltyDisabled&&this.outletRegister.MemberPoint&&(this.isEnabledLoyaltyPoint=!0)}moreMenuAction(t){switch(t){case"ADD_ITEM":this.dialog.open(q.k);break;case"COUPON":this.dialog.open(ki.P);break;case"PROMOTION":this.dialog.open(Se.t,{id:"promotion-event"});break;case"UPLOAD":this.dialog.open(Mi.h);break;case"RETURN":this.dialog.open(Ai.F);break;case"CLEAR":this.dialog.open(Pi.U);break;case"SERIAL":this.dialog.open(Ni.y);break;case"SPLIT":this.onSplit();break;case"PRINT":this.parkOrderService.onPrintRetrieve();break;case"CANCEL":this.onCancel();break;case"SYNC":this.dialog.open(wi.c)}}onSplit(){this.orderProcessorService.updatePosState(C.J.IsSplit)}onCancel(){this.currentSellState==C.J.IsRetrieve?this.orderProcessorService.updatePosState(C.J.IsSplit):(this.orderProcessorService.updatePosState(C.J.IsRetrieve),this.resetSplitedItem())}resetSplitedItem(){this.salesOrder.CartItems=this.salesOrder.CartItems.map(t=>(t.SplitQuantity=0,t.Splited=!1,t)),this.salesOrderService.pushNewValue()}openCustomerModal(){this.appConfig.ModuleSell.Customer.QuickAddEnabled&&this.userRole.ContactsCreate&&this.dialog.open(Re.A,{autoFocus:!1}).afterClosed().subscribe(t=>{t&&(this.orderProcessorService.pushNewValue(this.orderProcessorService.Data),this.customerService.updateDiscountRate(t.DiscountRate))})}onShowDatePicker(){this.userRole.DateEditor&&(this.showDatePicker=!this.showDatePicker)}onDeleteCustomer(){m.gT.IsNotEmpty(this.customerData)&&this.dialog.open(Ei,{data:{title:"Delete Customer",message:`Are you sure to delete customer ${this.orderProcessorService.Data.InputTextValue}?`}}).afterClosed().pipe((0,F.h)(t=>t)).subscribe(t=>{this.customerService.onEmptyInputCustomer(),this.customerData=null,this.orderProcessorService.Data.InputTextValue=null})}showPointModal(){this.outletRegister.MemberPoint&&(this.orderProcessorService.Data.posState!=C.J.IsEdit?this.dialog.open(Ne,{data:{tabIndexActive:1}}):this.toastrService.warning("Apply Loyalty Point is not allowed in edit mode","Warning!"))}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.Y36(T.W),e.Y36(P.q),e.Y36(w.J),e.Y36(Fi),e.Y36(D.o),e.Y36(x.uw),e.Y36(Ce.D),e.Y36(A.d),e.Y36(j),e.Y36(R._W),e.Y36(e.SBq))}),(0,o.Z)(i,"\u0275cmp",e.Xpm({type:i,selectors:[["sell-cart-header"]],hostBindings:function(t,n){1&t&&e.NdJ("mousedown",function(s){return n.onCloseDatePicker(s)},!1,e.evT)("keydown.F4",function(s){return n.handleF8(s)},!1,e.Jf7)},decls:21,vars:22,consts:[[1,"row","g-0","d-print-none"],[1,"col-6","d-flex","align-items-center"],[1,"text-secondary","icon-size",3,"ngClass","matTooltip","click"],["src","//res.cloudinary.com/pos/image/upload/v1659336548/POS/Images/Icon/Sell3/phone-book_1.png","alt","Customer Icon",2,"height","34px"],[1,"d-block"],["requestUrl","/API/AC/GetCustomerSuggestion","placeholder","Add Customer...","inputID","ContactID","notFoundMessageFor","customer",1,"customer-footer-autocomplete",3,"inputTextValue","inputLock","onInputChange","onSelect","onInputEnter","click"],["class","ms-1","style","font-size: 10px",4,"ngIf"],[1,"col-6","text-end","d-flex","align-items-center","justify-content-end"],[1,"fs-5","text-start",3,"matTooltip"],["bindValue","ID","bindLabel","Name","width","","placeholder","Sales Person",1,"sales-person","select-max-width","d-flex","justify-content-end",3,"clearable","items","selected","disabled","optionTitle","selectedChange","selectedLabel"],[1,"pe-5","pt-2",3,"ngClass"],["matTooltip","Order Date",1,"fs-6",3,"click"],["appearance","outlined","class","calendar-ui p-1",4,"ngIf"],["mat-icon-button","","id","moreMenu","data-bs-toggle","dropdown",1,"p-0"],[1,"fa-solid","fa-ellipsis-vertical","fs-3"],["aria-labelledby","moreMenu",1,"dropdown-menu"],[4,"ngFor","ngForOf"],[1,"ms-1",2,"font-size","10px"],[4,"ngIf"],[1,"ms-3"],["aria-hidden","true",1,"fa-solid","fa-dollar-sign","text-primary"],[1,"ms-1"],[4,"ngIf","ngIfElse"],["NotHasRole",""],["UNLIMITED",""],[1,"cursor-pointer",3,"click"],["aria-hidden","true",1,"fa","fa-star","text-primary"],["appearance","outlined",1,"calendar-ui","p-1"],[3,"selected","selectedChange"],[1,"dropdown-item","d-flex","align-items-center",2,"cursor","pointer",3,"click"],[1,"me-2"],["aria-hidden","true"],[1,"fw-normal","fs-4"],["class","position-absolute badge badge rounded-pill bg-danger pt-2","style","height: 16px;",4,"ngIf"],[1,"position-absolute","badge","badge","rounded-pill","bg-danger","pt-2",2,"height","16px"]],template:function(t,n){1&t&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2),e.NdJ("click",function(){return n.openCustomerModal()}),e._UZ(3,"img",3),e.qZA(),e.TgZ(4,"div",4)(5,"autocompleteV2",5),e.NdJ("onInputChange",function(s){return n.onInputCustomer(s)})("onSelect",function(s){return n.onSelectCustomer(s)})("onInputEnter",function(s){return n.onScanCodeCustomer(s)})("click",function(){return n.onDeleteCustomer()}),e.qZA(),e.YNc(6,$i,14,5,"div",6),e.qZA()(),e.TgZ(7,"div",7)(8,"div")(9,"div",8)(10,"ng-select-infinite",9),e.NdJ("selectedChange",function(s){return n.salesOrder.Order.SalesID=s})("selectedLabel",function(s){return n.salesPersonName=s}),e.qZA()(),e.TgZ(11,"div",10)(12,"div",11),e.NdJ("click",function(){return n.onShowDatePicker()}),e._uU(13),e.ALo(14,"date"),e.qZA(),e.YNc(15,Gi,2,1,"mat-card",12),e.qZA()(),e.TgZ(16,"div")(17,"button",13),e._UZ(18,"i",14),e.qZA(),e.TgZ(19,"ul",15),e.YNc(20,Wi,7,4,"li",16),e.qZA()()()()),2&t&&(e.xp6(2),e.Q6J("ngClass",e.VKq(18,zi,null==n.appConfig.ModuleSell||null==n.appConfig.ModuleSell.Customer?null:n.appConfig.ModuleSell.Customer.QuickAddEnabled))("matTooltip",null!=n.appConfig.ModuleSell&&null!=n.appConfig.ModuleSell.Customer&&n.appConfig.ModuleSell.Customer.QuickAddEnabled?"Add new customer":""),e.xp6(3),e.Q6J("inputTextValue",n.salesOrder.ContactName)("inputLock",n.userRole.CustomerInputLock),e.xp6(1),e.Q6J("ngIf",n.customerData),e.xp6(3),e.Q6J("matTooltip",n.salesPersonName),e.xp6(1),e.Q6J("clearable",!0)("items",n.salesPersonList)("selected",n.salesOrder.Order.SalesID)("disabled",n.disabledSalesOption)("optionTitle",!0),e.xp6(1),e.Q6J("ngClass",e.VKq(20,Xi,!n.isToday)),e.xp6(2),e.hij(" ",e.xi3(14,15,n.selectedDate,"dd MMMM yyyy")," "),e.xp6(2),e.Q6J("ngIf",n.showDatePicker),e.xp6(5),e.Q6J("ngForOf",n.filteredMoreMenu))},dependencies:[g.mk,g.sg,g.O5,d.R,$,Q._H,I.J,Ue.RK,Y.gM,g.Ov,g.JJ,g.uU],styles:[".fa-coupon{background-position-y:center;background-image:url(//res.cloudinary.com/pos/image/upload/POS/Images/Icon/coupon.svg);height:26px;width:26px;background-repeat:no-repeat}.fa-retur{background-position-y:center;background-image:url(//res.cloudinary.com/pos/image/upload/POS/Images/Icon/return.svg);height:26px;width:26px;background-repeat:no-repeat}.btn-gray{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#ffffff 0%,#eeeeee 100%)}i.retur-badge.mat-badge>span.mat-badge-content{font-size:10px}.cart-title{font-size:28px}autocompleteV2.customer-footer-autocomplete>mat-form-field>input{font-size:14px;border:none;padding-left:4px;padding-bottom:4px;border-radius:5px}autocompleteV2.customer-footer-autocomplete>mat-form-field ::placeholder{color:#343a40!important}autocompleteV2.customer-footer-autocomplete>mat-form-field :-ms-input-placeholder{color:#343a40!important}autocompleteV2.customer-footer-autocomplete>mat-form-field ::-ms-input-placeholder{color:#343a40!important}autocompleteV2.customer-footer-autocomplete>mat-form-field>input:focus{border:none}.calendar-ui{position:absolute!important;width:280px;top:62px;z-index:1;right:100px}ng-select-infinite.sales-person.select-max-width>ng-select{max-width:200px;height:23px;min-width:125px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{font-size:14px;border:none;padding-right:6px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-arrow-wrapper{display:none}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{min-height:26px!important;height:26px!important}.icon-size{font-size:20px}ng-select-infinite.sales-person.select-max-width ng-select .ng-dropdown-panel.ng-select-bottom{width:11rem!important}\n"],encapsulation:2})),i})();const tn=["cardContainer"];let nn=(()=>{class i{constructor(){(0,o.Z)(this,"cardContainer",void 0),(0,o.Z)(this,"parkOrderRetrieve",void 0)}ngOnInit(){}onRetrieve(t){this.parkOrderRetrieve=t}onEventAddItem(){this.cardContainer&&setTimeout(()=>{this.cardContainer.nativeElement.scrollTop=this.cardContainer.nativeElement.scrollHeight},1)}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)}),(0,o.Z)(i,"\u0275cmp",e.Xpm({type:i,selectors:[["sell-cart"]],viewQuery:function(t,n){if(1&t&&e.Gf(tn,5),2&t){let r;e.iGM(r=e.CRH())&&(n.cardContainer=r.first)}},decls:12,vars:1,consts:[[1,"d-flex","flex-column","customize-scroll-bar",2,"min-height","100vh"],[1,"row","pt-4","border-bottom",2,"padding-bottom","7px"],[1,"col-12","px-3"],[1,"row","d-print-none","flex-grow-1",2,"height","0px","overflow-y","auto"],["cardContainer",""],[1,"col-12","px-1"],[3,"onRetrieve"],[3,"eventAddItem"],[1,"row","d-print-none","pb-6","pe-10"],[1,"col-11","border-top"],[3,"parkOrderRetrieve"]],template:function(t,n){1&t&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2),e._UZ(3,"sell-cart-header"),e.qZA()(),e.TgZ(4,"div",3,4)(6,"div",5)(7,"sell-right-panel",6),e.NdJ("onRetrieve",function(s){return n.onRetrieve(s)}),e.qZA(),e.TgZ(8,"sell-cart-body",7),e.NdJ("eventAddItem",function(){return n.onEventAddItem()}),e.qZA()()(),e.TgZ(9,"div",8)(10,"div",9),e._UZ(11,"sell-cart-footer",10),e.qZA()()()),2&t&&(e.xp6(11),e.Q6J("parkOrderRetrieve",n.parkOrderRetrieve))},dependencies:[Nt,ii,Di,en],styles:["@media print{div.py-4.border-bottom[_ngcontent-%COMP%]{border:none!important}}div.customize-scroll-bar[_ngcontent-%COMP%] [_ngcontent-%COMP%]::-webkit-scrollbar{width:4px}div.customize-scroll-bar[_ngcontent-%COMP%] [_ngcontent-%COMP%]::-webkit-scrollbar-track{box-shadow:inset 0 0 5px #bfd2da}div.customize-scroll-bar[_ngcontent-%COMP%] [_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:hsl(0,0%,77%);border-radius:10px}"]})),i})();var te=l(98448),Ze=l(82621),Ie=l(33142),on=l(75033),rn=l(34915),an=l(98210),sn=l(45882),Le=l(40083),Fe=l(10812),ln=l(86725),cn=l(13337),dn=l(87019),qe=l(117);const pn=function(){return["/Print/TaxInvoice"]},Ye=function(i){return{ID:i}};function un(i,a){if(1&i&&(e.TgZ(0,"a",47),e._uU(1,"Tax"),e.qZA()),2&i){const t=e.oxw();e.Q6J("routerLink",e.DdM(2,pn))("queryParams",e.VKq(3,Ye,t.completeData.ObjectID))}}const mn=function(i,a){return{ID:i,Template:a}};function gn(i,a){if(1&i&&(e.TgZ(0,"a",48),e._uU(1,"Delivery Order"),e.qZA()),2&i){const t=e.oxw();e.Q6J("queryParams",e.WLB(1,mn,t.completeData.OutDeliveryID,t.outletRegister.PrintTemplate.ID))}}const hn=function(i,a,t){return{InvoiceID:i,OutID:a,Template:t}};function fn(i,a){if(1&i&&(e.TgZ(0,"a",49),e._uU(1,"Invoice & Delivery Order"),e.qZA()),2&i){const t=e.oxw();e.Q6J("queryParams",e.kEZ(1,hn,t.completeData.ObjectID,t.completeData.OutDeliveryID,t.outletRegister.PrintTemplate.ID))}}function _n(i,a){if(1&i&&(e.TgZ(0,"a",50),e._uU(1,"Invoice (No Price)"),e.qZA()),2&i){const t=e.oxw();e.Q6J("href",t.getInvoicePrintURL(!0),e.LSH)}}const vn=function(i){return{ID:i,Print:1,Printer:"Normal"}};function Cn(i,a){if(1&i&&(e.TgZ(0,"a",51),e._uU(1,"Packing Slip"),e.qZA()),2&i){const t=e.oxw();e.Q6J("queryParams",e.VKq(1,vn,t.completeData.OutDeliveryID))}}function bn(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"div",52)(1,"div",53),e._UZ(2,"i",54),e.qZA(),e.TgZ(3,"div",55)(4,"autocompleteV2",56),e.NdJ("onSelect",function(r){e.CHM(t);const s=e.oxw();return e.KtG(s.updateEmail(r))}),e.qZA()(),e.TgZ(5,"div",57)(6,"a",58),e.NdJ("click",function(){e.CHM(t);const r=e.oxw();return e.KtG(r.sendEmail())}),e._uU(7,"Send Receipt"),e.qZA()()()}if(2&i){const t=e.oxw();e.xp6(4),e.Q6J("inputTextValue",t.customerEmail)}}function xn(i,a){if(1&i&&(e.TgZ(0,"a",64),e._UZ(1,"i",65),e._uU(2,"Print Receipt "),e.qZA()),2&i){const t=e.oxw(2);e.Q6J("href",t.getInvoicePrintURL(!1),e.LSH)}}function yn(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"a",66),e.NdJ("click",function(){e.CHM(t);const r=e.oxw(2);return e.KtG(r.print())}),e._UZ(1,"i",65),e._uU(2,"Print Receipt "),e.qZA()}}function Sn(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"div",60)(1,"button",67),e.NdJ("click",function(){e.CHM(t);const r=e.oxw(2);return e.KtG(r.generateLink())}),e._UZ(2,"i",68),e._uU(3,"Generate Payment Link "),e.qZA()()}}function Zn(i,a){if(1&i){const t=e.EpF();e.TgZ(0,"div",60)(1,"button",69),e.NdJ("click",function(){e.CHM(t);const r=e.oxw(2);return e.KtG(r.verifyPaymentSettlement())}),e._UZ(2,"i",70),e._uU(3,"Verify Payment Settlement "),e.qZA()()}}function In(i,a){if(1&i&&(e.TgZ(0,"div",15)(1,"div",59)(2,"div",60),e.YNc(3,xn,3,1,"a",61),e.YNc(4,yn,3,0,"a",62),e.qZA(),e.YNc(5,Sn,4,0,"div",63),e.YNc(6,Zn,4,0,"div",63),e.qZA()()),2&i){const t=e.oxw();e.xp6(3),e.Q6J("ngIf",t.completeData),e.xp6(1),e.Q6J("ngIf",!t.completeData),e.xp6(1),e.Q6J("ngIf",1==t.completeData.PaymentStateID),e.xp6(1),e.Q6J("ngIf",t.isNotEmpty(t.paymentGatewayService.getTransactionId()))}}function Tn(i,a){if(1&i&&(e.ynx(0),e.TgZ(1,"a",71),e._uU(2),e.qZA(),e.BQk()),2&i){const t=e.oxw();e.xp6(1),e.Q6J("queryParams",e.VKq(2,Ye,t.completeData.ObjectID)),e.xp6(1),e.hij(" Invoice #",null==t.completeData?null:t.completeData.InvoiceNumber," ")}}function On(i,a){if(1&i&&(e.TgZ(0,"span",72),e._uU(1),e.qZA()),2&i){const t=e.oxw();e.xp6(1),e.hij(" Invoice #",null==t.completeData?null:t.completeData.InvoiceNumber," ")}}function Dn(i,a){if(1&i&&(e.TgZ(0,"div",74)(1,"div",75),e._uU(2),e.qZA(),e.TgZ(3,"div",76),e._uU(4),e.ALo(5,"number"),e.qZA()()),2&i){const t=a.$implicit;e.xp6(2),e.Oqu(t.Label),e.xp6(2),e.AsE(" ",t.CurrencySymbol," ",e.lcZ(5,3,t.Amount)," ")}}function Pn(i,a){if(1&i&&(e.TgZ(0,"div",11),e.YNc(1,Dn,6,5,"div",73),e.qZA()),2&i){const t=e.oxw();e.xp6(1),e.Q6J("ngForOf",t.itemSummary)}}function Mn(i,a){if(1&i&&(e.TgZ(0,"div",80)(1,"div",81),e._uU(2),e.qZA(),e.TgZ(3,"div",84),e._uU(4),e.ALo(5,"number"),e.qZA()()),2&i){const t=a.$implicit,n=e.oxw(3);e.xp6(1),e.Q6J("hidden",!n.role.PriceVisible),e.xp6(1),e.AsE(" ",t.Label,": ",t.CurrencySymbol," "),e.xp6(1),e.Q6J("hidden",!n.role.PriceVisible),e.xp6(1),e.hij(" ",e.lcZ(5,5,t.Amount)," ")}}function kn(i,a){if(1&i&&(e.TgZ(0,"div",80)(1,"div",81)(2,"div",82),e._uU(3),e.ALo(4,"number"),e.qZA()(),e.TgZ(5,"div",83),e.YNc(6,Mn,6,7,"div",78),e.qZA()()),2&i){const t=a.$implicit,n=a.index,r=e.oxw(2);e.xp6(1),e.Q6J("hidden",!r.role.PriceVisible),e.xp6(1),e.Q6J("hidden",!r.role.PriceVisible)("ngClass",n+1===r.amountSummary.length?"amount":""),e.xp6(1),e.hij(" ",e.lcZ(4,5,t.Amount)," "),e.xp6(3),e.Q6J("ngForOf",r.paymentSummary)}}function An(i,a){if(1&i&&(e.TgZ(0,"div",85)(1,"div",86)(2,"p",87),e._uU(3," INVALID AMOUNT CHARGE, CORRECT AMOUNT "),e.qZA(),e.TgZ(4,"P",88),e._uU(5),e.ALo(6,"number"),e.qZA()()()),2&i){const t=e.oxw(2);e.xp6(5),e.hij("",e.lcZ(6,1,t.completeData.Final)," ")}}function Nn(i,a){if(1&i&&(e.TgZ(0,"div",77),e.YNc(1,kn,7,7,"div",78),e.YNc(2,An,7,3,"div",79),e.qZA()),2&i){const t=e.oxw();e.xp6(1),e.Q6J("ngForOf",t.amountSummary),e.xp6(1),e.Q6J("ngIf",t.finalAmountDifferent)}}function wn(i,a){if(1&i&&(e.TgZ(0,"div",89)(1,"div",37)(2,"h3",38),e._uU(3,"Point Balance"),e.qZA()(),e._UZ(4,"div",90),e.qZA()),2&i){const t=e.oxw();e.xp6(4),e.Q6J("innerHtml",t.completeData.LoyaltyPoint,e.oJD)}}function Rn(i,a){if(1&i&&e._UZ(0,"pos-receipt",91),2&i){const t=e.oxw();e.Q6J("data",t.receiptTemplate)("printTemplate",t.outletRegister.PrintTemplate)("config",t.posStorage.AppConfigJSON)("priceVisibleRestriction",!t.role.PriceVisible)("outletInfo",t.outletRegister)}}function Jn(i,a){if(1&i&&e._UZ(0,"pos-receipt-a4",92),2&i){const t=e.oxw();e.Q6J("data",t.receiptTemplate)("printTemplate",t.outletRegister.PrintTemplate)("config",t.posStorage.AppConfigJSON)("workOrderMode",!1)}}const En=function(i){return{"bg-gradient-warning":i}};let Qn=(()=>{class i{handleF8(){this.newSale()}get posStorage(){return this._posService.Data}constructor(t,n,r,s,p,h,_,y,M,J,B,ie,Te,Oe,Xn,eo,to,io,no,oo,ro){(0,o.Z)(this,"_posDataService",void 0),(0,o.Z)(this,"_posService",void 0),(0,o.Z)(this,"_orderProcessorService",void 0),(0,o.Z)(this,"_OrderHttpService",void 0),(0,o.Z)(this,"_PaymentHttpService",void 0),(0,o.Z)(this,"_receiptService",void 0),(0,o.Z)(this,"_outletService",void 0),(0,o.Z)(this,"_toastr",void 0),(0,o.Z)(this,"_onlineStatusService",void 0),(0,o.Z)(this,"_matDialog",void 0),(0,o.Z)(this,"ref",void 0),(0,o.Z)(this,"_signalBroadCast",void 0),(0,o.Z)(this,"_calculatorService",void 0),(0,o.Z)(this,"_localDataService",void 0),(0,o.Z)(this,"_userRoleService",void 0),(0,o.Z)(this,"_router",void 0),(0,o.Z)(this,"_receiptCalculatorService",void 0),(0,o.Z)(this,"datePipe",void 0),(0,o.Z)(this,"decimalPipe",void 0),(0,o.Z)(this,"paymentGatewayService",void 0),(0,o.Z)(this,"paymentHttpService",void 0),(0,o.Z)(this,"salesOrder",new on.m),(0,o.Z)(this,"receiptTemplate",null),(0,o.Z)(this,"completeData",new rn.u),(0,o.Z)(this,"printMode",G.LA.Mini),(0,o.Z)(this,"outletRegister",new an.t),(0,o.Z)(this,"role",void 0),(0,o.Z)(this,"customerEmail",void 0),(0,o.Z)(this,"finalAmountDifferent",!1),(0,o.Z)(this,"amountSummary",[]),(0,o.Z)(this,"itemSummary",[]),(0,o.Z)(this,"paymentSummary",[]),(0,o.Z)(this,"isOnline",!1),(0,o.Z)(this,"destroy$",new k.x),(0,o.Z)(this,"currentSellState",void 0),(0,o.Z)(this,"isOrderDateNow",void 0),this._posDataService=t,this._posService=n,this._orderProcessorService=r,this._OrderHttpService=s,this._PaymentHttpService=p,this._receiptService=h,this._outletService=_,this._toastr=y,this._onlineStatusService=M,this._matDialog=J,this.ref=B,this._signalBroadCast=ie,this._calculatorService=Te,this._localDataService=Oe,this._userRoleService=Xn,this._router=eo,this._receiptCalculatorService=to,this.datePipe=io,this.decimalPipe=no,this.paymentGatewayService=oo,this.paymentHttpService=ro}ngOnInit(){this.subscribeToObservableChanges()}subscribeToObservableChanges(){this._posDataService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.salesOrder=t}),this._outletService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.outletRegister=t,this.printMode=this.outletRegister.PrintTemplate.PrintMode}),this._OrderHttpService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(()=>{this.itemSummary=this._receiptService.generateCartItemSummary(),this.amountSummary=this._receiptCalculatorService.generateAmountSummary(),this.paymentSummary=this._receiptService.generatePaymentSummary()}),this._orderProcessorService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.currentSellState=t.posState,this._OrderHttpService.Data&&(this.completeData=this._OrderHttpService.Data,this.InitPrintInvoice()),this.checkOrderDateIsNow(),this.checkFinalAmountDifferent()}),this._onlineStatusService.getOnlineStatus$().pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.isOnline=t,this.isOnline||(this.printMode=2,this._toastr.warning(m.g7.submitLocally,"Info!"),this._toastr.info("Could not print in A4 format due to network connectivity","Can't Print A4 Format!"))}),this._userRoleService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.role=t}),this._router.events.pipe((0,f.R)(this.destroy$)).subscribe(t=>{t instanceof N.OD&&(this._orderProcessorService.createNewTransactionInSameOutletRegister(),this._signalBroadCast.BroadcastStateToCustomerDisplay(C.J.IsNew))})}InitPrintInvoice(){this.currentSellState==C.J.IsComplete&&(this.checkOrderNumber(),m.gT.IsEmpty(this.customerEmail)&&this.isNotEmpty(this.completeData?.Contact?.Email)&&(this.customerEmail=this.completeData.Contact.Email),this.print())}checkOrderDateIsNow(){let t=this.completeData.OrderTimeString,n=this.datePipe.transform(this.salesOrder.Order.Date,"dd MMM yyyy");this.isOrderDateNow=t.includes(n)}checkFinalAmountDifferent(){if(this.currentSellState==C.J.IsComplete){const n=this.completeData.Final;if(n-this._calculatorService.Data>this.posStorage.AppConfigJSON.ModuleSell.ToleranceAmount){this.finalAmountDifferent=!0;const h=this.decimalPipe.transform(n);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 invoice number is changed to "+this.completeData.InvoiceNumber,"Invoice Number Changed!"),this.salesOrder.Order.Number=this.completeData.InvoiceNumber)}generateLink(){1==this.posStorage.AppConfigJSON.PaymentConfigLink&&this._matDialog.open(Le.z),this._PaymentHttpService.generateLink({InvoiceID:this.completeData.ObjectID}).subscribe({next:n=>{this._matDialog.open(Le.z,{data:{link:n.token.redirect_url}})},error:n=>{this._toastr.error(n.Message,"Couldn't generate link!")}})}newSale(){try{this._orderProcessorService.createNewTransactionInSameOutletRegister(),this._signalBroadCast.BroadcastStateToCustomerDisplay(C.J.IsNew),this._router.navigate([],{queryParams:{ID:null}})}catch(t){console.error(t),this._toastr.error(t,"Error redirecting to NEW mode")}}shelve(){const t=this._OrderHttpService.generatePOSDataForSubmission(this.salesOrder);this._localDataService.syncOrder(t).subscribe(()=>{this.newSale()})}retrySubmit(){this._posDataService.pushNewValue(this.salesOrder),this._posDataService.submitOrder(this.posStorage.AppConfigJSON).then(t=>{t.Success?(this._signalBroadCast.BroadcastStateToCustomerDisplay(C.J.IsComplete,t.ObjectID,t.LoyaltyPoint,this.salesOrder.TotalPaidAmount-this._calculatorService.Data),this._posDataService.pushNewValue(this.salesOrder),this._orderProcessorService.updatePosState(C.J.IsComplete,t)):(this._posDataService.pushNewValue(this.salesOrder),this._orderProcessorService.updatePosState(C.J.IsComplete,t))})}getInvoicePrintURL(t){let r="";return t&&(r="&Print=1&Price=0"),m.gT.StringFormat("{0}?ID={1}&Template={2}{3}","/print/Invoice"+(2===this.outletRegister.PrintTemplate.PrintMode?"Mini":""),this.completeData.ObjectID,this.outletRegister.PrintTemplate.ID,r)}sendEmail(){m.gT.IsEmpty(this.customerEmail)?this._toastr.error("Please enter email before sending receipt!","No email"):this._OrderHttpService.sendEmail(this.customerEmail,this.completeData.ObjectID).then(t=>{this._toastr.success(t,"Email sent!")})}print(){this.printMode==G.LA.Mini?this.printReceiptMini():this.printMode==G.LA.A4&&this.printReceiptA4(),this.posStorage.AppConfigJSON.ModuleSell.Printing.PrintOnPayment&&this.printWindow()}printReceiptMini(){this.receiptTemplate=this._receiptService.generateReceiptMini()}printReceiptA4(){this._OrderHttpService.generateReceiptA4(this.completeData.ObjectID).subscribe({next:t=>{this.receiptTemplate=t.Data},error:t=>{this._toastr.error("Could not print in A4 format!\nPrinting in 8mm format instead!","Error!"),this.printReceiptMini()}})}printWindow(){this.finalAmountDifferent||setTimeout(()=>{window.print()},500)}isNotEmpty(t){return m.gT.IsNotEmpty(t)}updateEmail(t){this.customerEmail=t}verifyPaymentSettlement(){let t=new sn.r;t.Amount=this.completeData.Final,t.TransactionID=this.paymentGatewayService.getTransactionId(),t.RegisterID=this._outletService.Data.RegisterID,t.Number=this.salesOrder.Order.Number,this.paymentHttpService.VerifyPayment(t).pipe((0,f.R)(this.destroy$)).subscribe({next:n=>{this._toastr.success(n.Message,"QR Settlement")}})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.Y36(P.q),e.Y36(T.W),e.Y36(A.d),e.Y36(be.D),e.Y36(Fe.q),e.Y36(ve.V),e.Y36(D.o),e.Y36(R._W),e.Y36(Je.q),e.Y36(x.uw),e.Y36(e.sBO),e.Y36(ln.j),e.Y36(X.J),e.Y36(cn.T),e.Y36(w.J),e.Y36(N.F0),e.Y36(dn.i),e.Y36(g.uU),e.Y36(g.JJ),e.Y36(Pe.i),e.Y36(Fe.q))}),(0,o.Z)(i,"\u0275cmp",e.Xpm({type:i,selectors:[["sell-complete"]],hostBindings:function(t,n){1&t&&e.NdJ("keydown.F8",function(s){return n.handleF8(s)},!1,e.Jf7)},decls:63,vars:21,consts:[[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",3,"hidden"],[1,"card-header","alert-danger"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-times-circle","me-1","text-danger"],[1,"card-body"],[1,"row","mt-9","justify-content-center","g-0","mb-9"],[1,"col-5","text-center"],["type","button","matTooltipPosition","above","matTooltip","Try uploading order to the server again",1,"btn","btn-success","btn-lg",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"],[1,"card-header",3,"ngClass"],[1,"fa-solid","fa-check","me-1"],[1,"fst-italic"],[1,"dropdown"],["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","target","_blank",3,"routerLink","queryParams",4,"ngIf"],["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"],[1,"container"],["class","row border-bottom align-items-center g-0 mt-5",4,"ngIf"],[1,"col-10","text-center"],["type","button",1,"btn","btn-success","btn-lg","w-100",3,"click"],["class","card-footer bg-light-gray",4,"ngIf"],[1,"col-md-4"],[1,"card-header","bg-light-gray"],[1,"text-dark"],[4,"ngIf","ngIfElse"],["OFFLINE",""],["class","card-body",4,"ngIf"],["class","card-footer bg-white",4,"ngIf"],["class","card",4,"ngIf"],[1,"print_containers"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo",4,"ngIf"],[3,"data","printTemplate","config","workOrderMode",4,"ngIf"],["target","_blank",1,"dropdown-item",3,"routerLink","queryParams"],["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,"row","border-bottom","align-items-center","g-0","mt-5"],[1,"col-auto","px-2"],[1,"fa-solid","fa-envelope","fa-lg"],[1,"col"],["placeholder","Email Receipt","inputID","contactEmail","requestUrl","/API/AC/GetEmailSuggestion",1,"border-0","w-100",3,"inputTextValue","onSelect"],[1,"col-auto","pe1"],["type","button",1,"btn","btn-light-gray",3,"click"],[1,"row","justify-content-between"],[1,"col-auto","my-6"],["target","_blank","class","btn btn-light-gray",3,"href",4,"ngIf"],["class","btn btn-light-gray",3,"click",4,"ngIf"],["class","col-auto my-6",4,"ngIf"],["target","_blank",1,"btn","btn-light-gray",3,"href"],[1,"fa-solid","fa-print","me-2"],[1,"btn","btn-light-gray",3,"click"],["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"],["target","_blank","routerLink","/menu/Orders/Orders/Customer_Invoice/Info",1,"text-dark","fst-italic",3,"queryParams"],[1,"text-dark","fst-italic"],["class","row",4,"ngFor","ngForOf"],[1,"row"],[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"],["class","card-footer bg-gradient-warning",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,"card-footer","bg-gradient-warning"],[1,"text-end"],[1,"fw-bold"],[1,"text-danger",2,"font-size","38px"],[1,"card"],[1,"card-body","pb-0","text-center",3,"innerHtml"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo"],[3,"data","printTemplate","config","workOrderMode"]],template:function(t,n){if(1&t&&(e.TgZ(0,"section",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"h1",4),e._uU(5," Order Complete "),e.qZA()()(),e.TgZ(6,"div",5)(7,"div",6)(8,"div",7)(9,"div",8)(10,"div",9)(11,"h2"),e._UZ(12,"i",10),e._uU(13," Order Upload Fail! "),e.qZA()()(),e.TgZ(14,"div",11)(15,"div",12)(16,"div",13)(17,"button",14),e.NdJ("click",function(){return n.retrySubmit()}),e._uU(18," Retry Upload "),e.qZA()()()(),e.TgZ(19,"div",15)(20,"div",16)(21,"div",17)(22,"button",18),e.NdJ("click",function(){return n.shelve()}),e._UZ(23,"i",19),e._uU(24,"Save Offline "),e.qZA()()()()(),e.TgZ(25,"div",7)(26,"div",20)(27,"div",9)(28,"h2"),e._UZ(29,"i",21),e._uU(30," Sell Complete "),e.TgZ(31,"small",22),e._uU(32),e.qZA()(),e.TgZ(33,"div")(34,"div",23),e._UZ(35,"button",24),e.TgZ(36,"div",25),e.YNc(37,un,2,5,"a",26),e.YNc(38,gn,2,4,"a",27),e.YNc(39,fn,2,5,"a",28),e.YNc(40,_n,2,1,"a",29),e.YNc(41,Cn,2,3,"a",30),e.qZA()()()()(),e.TgZ(42,"div",11)(43,"div",31),e.YNc(44,bn,8,1,"div",32),e.TgZ(45,"div",12)(46,"div",33)(47,"button",34),e.NdJ("click",function(){return n.newSale()}),e._uU(48," New Sale (F8) "),e.qZA()()()()(),e.YNc(49,In,7,4,"div",35),e.qZA()(),e.TgZ(50,"div",36)(51,"div",7)(52,"div",37)(53,"h3",38),e.YNc(54,Tn,3,4,"ng-container",39),e.YNc(55,On,2,1,"ng-template",null,40,e.W1O),e.qZA()(),e.YNc(57,Pn,2,1,"div",41),e.YNc(58,Nn,3,2,"div",42),e.YNc(59,wn,5,1,"div",43),e.qZA()()()()(),e.TgZ(60,"div",44),e.YNc(61,Rn,1,5,"pos-receipt",45),e.YNc(62,Jn,1,4,"pos-receipt-a4",46),e.qZA()),2&t){const r=e.MAs(56);e.xp6(8),e.Q6J("hidden",1==n.currentSellState),e.xp6(17),e.Q6J("hidden",9==n.currentSellState),e.xp6(1),e.Q6J("ngClass",e.VKq(19,En,!n.isOrderDateNow||n.completeData.PaymentStateID<3)),e.xp6(6),e.hij(" (",n.completeData.PaymentStateLabel,")"),e.xp6(5),e.Q6J("ngIf",n.completeData),e.xp6(1),e.Q6J("ngIf",n.completeData.OutDeliveryID),e.xp6(1),e.Q6J("ngIf",n.completeData.OutDeliveryID),e.xp6(1),e.Q6J("ngIf",n.completeData),e.xp6(1),e.Q6J("ngIf",n.completeData.OutDeliveryID),e.xp6(3),e.Q6J("ngIf",n.role.Email&&n.isOnline),e.xp6(5),e.Q6J("ngIf",n.isOnline),e.xp6(2),e.Q6J("hidden",9==n.currentSellState),e.xp6(3),e.Q6J("ngIf",n.isOnline)("ngIfElse",r),e.xp6(3),e.Q6J("ngIf",n.itemSummary),e.xp6(1),e.Q6J("ngIf",!n.finalAmountDifferent),e.xp6(1),e.Q6J("ngIf",n.completeData.LoyaltyPoint),e.xp6(2),e.Q6J("ngIf",n.receiptTemplate&&2==n.printMode),e.xp6(1),e.Q6J("ngIf",n.receiptTemplate&&1==n.printMode)}},dependencies:[g.mk,g.sg,g.O5,N.rH,I.J,te.t,qe.Y,g.JJ],styles:[".bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px,#f5c6cb 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#28a745,#28a745 15px,#a2dbb0 15px,#a2dbb0 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#FCF3CF,#FCF3CF 15px,#F9E79F 15px,#F9E79F 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}.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[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%]{border-bottom:1px solid rgba(0,0,0,.125);padding-bottom:.9375rem}.sell-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:2rem}.sell-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%] .container{max-width:500px;margin-top:30px;margin-bottom:30px}.sell-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%] mat-form-field input.form-control{border:none;font-size:16px;padding-left:2px}.sell-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%] mat-form-field input.form-control:focus{border:none}.sell-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%] [type=button]{-webkit-appearance:initial}.sell-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%] input{font-size:1rem}.sell-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%] .btn-success{padding:.5rem 1rem;font-size:1.25rem}.sell-complete[_ngcontent-%COMP%] .amount[_ngcontent-%COMP%]{font-size:16px}"]})),i})();function Un(i,a){1&i&&(e.TgZ(0,"div",8)(1,"div",9),e._UZ(2,"sell-left-content"),e.qZA(),e.TgZ(3,"div",10),e._UZ(4,"sell-cart"),e.qZA()())}function Ln(i,a){if(1&i&&(e.ynx(0),e.YNc(1,Un,5,0,"div",7),e.BQk()),2&i){const t=e.oxw();e.xp6(1),e.Q6J("ngIf",t.posHttpResponse)}}function Fn(i,a){1&i&&(e.TgZ(0,"div",11)(1,"div",12),e._UZ(2,"sell-complete"),e.qZA()())}function qn(i,a){if(1&i&&e._UZ(0,"park-order",13),2&i){const t=e.oxw();e.Q6J("data",t.receiptTemplate)("printTemplate",t.outletRegister.PrintTemplate)("config",t.appConfig)}}function Yn(i,a){if(1&i&&e._UZ(0,"POS-bill-receipt-A4",14),2&i){const t=e.oxw();e.Q6J("data",t.receiptTemplate)("printTemplate",t.outletRegister.PrintTemplate)("config",t.appConfig)("outletInfo",t.outletRegister)}}function Bn(i,a){if(1&i&&e._UZ(0,"pos-receipt",15),2&i){const t=e.oxw();e.Q6J("data",t.receiptTemplate)("printTemplate",t.outletRegister.PrintTemplate)("config",t.appConfig)("priceVisibleRestriction",!t.userRole.PriceVisible)("outletInfo",t.outletRegister)}}const Vn=[{path:"",component:(()=>{class i{constructor(t,n,r,s,p,h,_,y,M,J,B,ie,Te,Oe){(0,o.Z)(this,"posService",void 0),(0,o.Z)(this,"outletService",void 0),(0,o.Z)(this,"route",void 0),(0,o.Z)(this,"signalRClientService",void 0),(0,o.Z)(this,"orderProcessorService",void 0),(0,o.Z)(this,"decimalPipe",void 0),(0,o.Z)(this,"paymentServiceGateway",void 0),(0,o.Z)(this,"dialog",void 0),(0,o.Z)(this,"toastr",void 0),(0,o.Z)(this,"parkOrderService",void 0),(0,o.Z)(this,"userRoleService",void 0),(0,o.Z)(this,"receiptService",void 0),(0,o.Z)(this,"orderHttpService",void 0),(0,o.Z)(this,"roleService",void 0),(0,o.Z)(this,"destroy$",void 0),(0,o.Z)(this,"sellState",C.J),(0,o.Z)(this,"isOnline",void 0),(0,o.Z)(this,"posHttpResponse",void 0),(0,o.Z)(this,"currentState",void 0),(0,o.Z)(this,"receiptTemplate",void 0),(0,o.Z)(this,"isPrintBillMini",!1),(0,o.Z)(this,"isPrintBillA4",!1),(0,o.Z)(this,"isPrintPark",!1),(0,o.Z)(this,"outletRegister",void 0),(0,o.Z)(this,"appConfig",void 0),(0,o.Z)(this,"userRole",void 0),(0,o.Z)(this,"invoiceNumberEdit",void 0),this.posService=t,this.outletService=n,this.route=r,this.signalRClientService=s,this.orderProcessorService=p,this.decimalPipe=h,this.paymentServiceGateway=_,this.dialog=y,this.toastr=M,this.parkOrderService=J,this.userRoleService=B,this.receiptService=ie,this.orderHttpService=Te,this.roleService=Oe,this.destroy$=new k.x}ngOnInit(){this.initialPage()}initialPage(){this.posService.request().then(t=>{if(this.posHttpResponse=t,this.appConfig=t.AppConfigJSON,this.subscribeToObservable(),this.route.snapshot.queryParamMap.has("ID")){const n=this.route.snapshot.queryParamMap.get("ID");this.editInvoice(n)}else this.outletService.setActiveRegisterFromOptions(t.Registers,t.UserName);this.initializeRole()})}initializeRole(){const t=new $e.Q(this.roleService);this.userRoleService.pushNewValue(t)}subscribeToObservable(){this.orderProcessorService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.currentState=t.posState}),this.signalRClientService.OnPaymentReceived.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.onQRPaymentComplete(t)}),this.outletService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.outletRegister=t}),this.userRoleService.Data$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{this.userRole=t}),this.parkOrderService.onPrint$.pipe((0,f.R)(this.destroy$)).subscribe(t=>{switch(this.isPrintBillA4=!1,this.isPrintBillMini=!1,this.isPrintPark=!1,this.receiptTemplate=t.template,t.type){case"BILL_A4":this.isPrintBillA4=!0;break;case"BILL_MINI":this.isPrintBillMini=!0;break;case"PARK":this.isPrintPark=!0}this.receiptService.printWindow().finally(()=>{this.receiptTemplate=null})})}onQRPaymentComplete(t){if(!m.gT.IsEmpty(t)){const n=JSON.parse(t);this.paymentServiceGateway.onQRPaymentComplete(n,this.posHttpResponse.AppConfigJSON).then(r=>{this.dialog.getDialogById("ModalPayment").close();const h=`IDR ${this.decimalPipe.transform(n.gross_amount)} received. Please verify in customer mobile app!`;this.toastr.success(h," QR Settlement"),this.paymentServiceGateway.clearTransactionID(),this.orderProcessorService.updatePosState(C.J.IsComplete,r)}).catch(r=>{this.toastr.error(r.message,r.header?r.header:"Error")})}}editInvoice(t){this.orderProcessorService.updatePosState(C.J.IsEdit),this.orderHttpService.GetInvoiceBySoID(t).pipe((0,f.R)(this.destroy$)).subscribe(n=>{this.invoiceNumberEdit=n.Invoice.Number,this.orderProcessorService.plainToClass(n)})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)(e.Y36(T.W),e.Y36(D.o),e.Y36(N.gz),e.Y36(Ge.G),e.Y36(A.d),e.Y36(g.JJ),e.Y36(Pe.i),e.Y36(x.uw),e.Y36(R._W),e.Y36(j),e.Y36(w.J),e.Y36(ve.V),e.Y36(be.D),e.Y36(tt.N))}),(0,o.Z)(i,"\u0275cmp",e.Xpm({type:i,selectors:[["POS-sell-v3"]],decls:8,vars:5,consts:[[1,"container-fluid","sell-container"],[4,"ngIf","ngIfElse"],["COMPLETE",""],[1,"print_containers"],[3,"data","printTemplate","config",4,"ngIf"],[3,"data","printTemplate","config","outletInfo",4,"ngIf"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo",4,"ngIf"],["class","row d-print-none",4,"ngIf"],[1,"row","d-print-none"],[1,"col-6"],[1,"col-6","border-start"],[1,"row"],[1,"col-12","px-0"],[3,"data","printTemplate","config"],[3,"data","printTemplate","config","outletInfo"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo"]],template:function(t,n){if(1&t&&(e.TgZ(0,"div",0),e.YNc(1,Ln,2,1,"ng-container",1),e.YNc(2,Fn,3,0,"ng-template",null,2,e.W1O),e.qZA(),e.TgZ(4,"div",3),e.YNc(5,qn,1,3,"park-order",4),e.YNc(6,Yn,1,4,"POS-bill-receipt-A4",5),e.YNc(7,Bn,1,5,"pos-receipt",6),e.qZA()),2&t){const r=e.MAs(3);e.xp6(1),e.Q6J("ngIf",n.currentState!=n.sellState.IsComplete)("ngIfElse",r),e.xp6(4),e.Q6J("ngIf",n.isPrintPark&&n.receiptTemplate),e.xp6(1),e.Q6J("ngIf",n.receiptTemplate&&n.isPrintBillA4),e.xp6(1),e.Q6J("ngIf",n.receiptTemplate&&n.isPrintBillMini)}},dependencies:[g.O5,Zt,nn,te.t,Ze.g,Ie.Q,Qn],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}.print_containers{display:none}@media print{.print_containers{display:block;text-align:left}}\n"],encapsulation:2})),i})()}];let Hn=(()=>{class i{}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)}),(0,o.Z)(i,"\u0275mod",e.oAB({type:i})),(0,o.Z)(i,"\u0275inj",e.cJS({imports:[N.Bz.forChild(Vn),N.Bz]})),i})();var $n=l(97392),Be=l(65131);let Gn=(()=>{class i{}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)}),(0,o.Z)(i,"\u0275mod",e.oAB({type:i})),(0,o.Z)(i,"\u0275inj",e.cJS({providers:[Ee],imports:[g.ez,d.q,S,Z.u5,Q.FA,I.Q,$n.Ps,Ue.ot,ee._t,U.Tx,te.e,Ie.y,Ze.I,Be.X,Y.AV]})),i})();var Kn=l(94673),jn=l(945);let Wn=(()=>{class i{}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)}),(0,o.Z)(i,"\u0275mod",e.oAB({type:i})),(0,o.Z)(i,"\u0275inj",e.cJS({imports:[g.ez,Z.u5,z.d,_e.dr,ye.A0,Kn.z,Be.X,jn.M,Y.AV]})),i})(),zn=(()=>{class i{}return(0,o.Z)(i,"\u0275fac",function(t){return new(t||i)}),(0,o.Z)(i,"\u0275mod",e.oAB({type:i})),(0,o.Z)(i,"\u0275inj",e.cJS({providers:[j],imports:[g.ez,Hn,He,Gn,Wn,Z.UX,I.Q,te.e,qe.o,Ze.I,Ie.y,ye.A0]})),i})()},58393:(Ve,V,l)=>{l.d(V,{J:()=>ge,Q:()=>he});var o=l(81180),g=l(36895),d=l(94650),I=l(24006),e=l(47957),E=l(10266),L=l(67327),ne=l(77579),oe=l(78372),re=l(71884),H=l(82722),ae=l(89156),$=l(13337),se=l(97185),le=l(3238);function ce(v,O){if(1&v&&(d.ynx(0),d.TgZ(1,"div",7)(2,"span",8),d._UZ(3,"i"),d.qZA()(),d.BQk()),2&v){const c=d.oxw();d.xp6(2),d.Q6J("matTooltip",c.prefixIconTitle),d.xp6(1),d.Tol(c.prefixIcon)}}function de(v,O){if(1&v&&(d.TgZ(0,"label",9),d._uU(1),d.qZA()),2&v){const c=d.oxw();d.Q6J("for",c.inputID),d.xp6(1),d.Oqu(c.customLabel)}}function pe(v,O){if(1&v&&d._UZ(0,"img",12),2&v){const c=d.oxw().$implicit;d.Q6J("src",c.ImgUrl,d.LSH)}}function ue(v,O){if(1&v&&(d.TgZ(0,"mat-option",10),d.YNc(1,pe,1,1,"img",11),d.TgZ(2,"span"),d._uU(3),d.qZA()()),2&v){const c=O.$implicit,u=d.oxw();d.Q6J("value",c),d.xp6(1),d.Q6J("ngIf",u.renderThumbnail&&c.ImgUrl),d.xp6(2),d.hij(" ",c.Value," ")}}const me=function(v){return{"form-floating-outline":v}};let ge=(()=>{class v{set inputTextValue(c){L.gT.IsEmpty(c)||(this.skipXHR=!0),this.inputControl.setValue(c)}constructor(c,u,b){(0,o.Z)(this,"httpService",void 0),(0,o.Z)(this,"localData",void 0),(0,o.Z)(this,"toastrService",void 0),(0,o.Z)(this,"data_cy",void 0),(0,o.Z)(this,"requestUrl",void 0),(0,o.Z)(this,"placeholder",void 0),(0,o.Z)(this,"clearOnSelect",!1),(0,o.Z)(this,"inputLock",!1),(0,o.Z)(this,"readonly",!1),(0,o.Z)(this,"localStorage",void 0),(0,o.Z)(this,"renderThumbnail",!1),(0,o.Z)(this,"inputID",void 0),(0,o.Z)(this,"customStyle",void 0),(0,o.Z)(this,"customLabel",void 0),(0,o.Z)(this,"customClass",void 0),(0,o.Z)(this,"ngModel",void 0),(0,o.Z)(this,"optionSelected",new d.vpe),(0,o.Z)(this,"onSelect",new d.vpe),(0,o.Z)(this,"onInputEnter",new d.vpe),(0,o.Z)(this,"onInputChange",new d.vpe),(0,o.Z)(this,"notFoundMessageFor",void 0),(0,o.Z)(this,"showToastrNotFound",!0),(0,o.Z)(this,"inputControl",new I.NI),(0,o.Z)(this,"options",[]),(0,o.Z)(this,"destroy$",void 0),(0,o.Z)(this,"skipXHR",!1),(0,o.Z)(this,"onOptionsEmpty",new d.vpe),(0,o.Z)(this,"startInput",void 0),(0,o.Z)(this,"requestValue",void 0),(0,o.Z)(this,"prefixIcon",void 0),(0,o.Z)(this,"prefixIconTitle",void 0),(0,o.Z)(this,"propagateChange",S=>{}),this.httpService=c,this.localData=u,this.toastrService=b,this.destroy$=new ne.x}ngOnInit(){this.subscribeInputChanges()}ngOnChanges(c){}subscribeInputChanges(){this.inputControl.valueChanges.pipe((0,oe.b)(500),(0,re.x)(),(0,H.R)(this.destroy$)).subscribe(c=>{this.requestValue=null,this.options=[],c&&c.length>2&&!this.skipXHR&&this.setOptions({prefix:c,count:100}),this.emitInputChange(c),this.skipXHR=!1})}emitInputChange(c){"object"!=typeof c&&(this.onInputChange.emit(c),this.setNgModelBlank(c))}setNgModelBlank(c){c||this.clearInput()}setOptions(c){this.localData.isProductFromServer().subscribe(u=>{u?this.httpService.post(this.requestUrl,c).pipe((0,H.R)(this.destroy$)).subscribe(b=>{this.options=b,this.requestValue=c.prefix,0==b.length&&(this.onOptionsEmpty.emit(c.prefix),this.showToastrOnEmptySearch(c.prefix))}):this.setOptionsWithStorage(c.prefix)})}showToastrOnEmptySearch(c){if(this.showToastrNotFound)if(L.gT.IsNotEmpty(this.notFoundMessageFor)){let u=this.generateMessage(c);this.toastrService.warning(u,"Warning")}else this.toastrService.warning(`No result found for ${c}`,"Warning")}generateMessage(c){let u;switch(this.notFoundMessageFor){case"customer":u=`Customer with name ${c} is not found`;break;case"supplier":u=`Supplier with name ${c} is not found`;break;case"invoice":u=`Invoice with number ${c} is not found`;break;case"product":u=`Product with name ${c} is not found`;break;case"variant":u=`Variant with name ${c} is not found`}return u}setOptionsWithStorage(c){"products"==this.localStorage&&this.localData.findAllVariant().subscribe(u=>{const b=[];for(let S of u){let Q={Key:S.ID,Value:S.Name+(S.Code?" - "+S.Code:"")};JSON.stringify(Q).toUpperCase().indexOf(c.toUpperCase())>-1&&b.push(Q)}this.options=b})}onOptionSelected(c){let u=c.option.value;this.checkClearOnSelect(),this.emitOnOptionSelect(u)}emitOnOptionSelect(c={}){this.propagateChange(c.Key),this.onSelect.emit(c.Key),this.optionSelected.emit(JSON.stringify({Key:c.Key,Value:c.Value}))}onKeyDown(c){let u=c.key;"Enter"===u?(this.skipXHR=!0,this.requestValue||(this.onInputEnter.emit(c.target.value),this.requestValue=null),this.checkClearOnSelect()):this.inputLock&&("Backspace"===u?this.clearInput():this.validateInputLock())}checkClearOnSelect(){this.clearOnSelect&&this.clearInput()}validateInputLock(){let c=this.inputControl.value;if("string"==typeof c)if(""==c||0==c.length)this.startInput=new Date;else{const u=new Date;this.startInput=this.startInput?this.startInput:new Date,u.getTime()-this.startInput.getTime()>500&&this.clearInput()}else this.startInput=new Date}displayFn(c){let u="";return u="string"==typeof c?c:c?c.Value:"",u}clearInput(){this.inputControl.setValue(""),this.propagateChange(null)}isNotEmpty(c){return L.gT.IsNotEmpty(c)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}writeValue(c){}registerOnChange(c){this.propagateChange=c}registerOnTouched(){}}return(0,o.Z)(v,"\u0275fac",function(c){return new(c||v)(d.Y36(ae.O),d.Y36($.T),d.Y36(se._W))}),(0,o.Z)(v,"\u0275cmp",d.Xpm({type:v,selectors:[["autocompleteV2"]],inputs:{data_cy:"data_cy",requestUrl:"requestUrl",placeholder:"placeholder",clearOnSelect:"clearOnSelect",inputLock:"inputLock",readonly:"readonly",localStorage:"localStorage",renderThumbnail:"renderThumbnail",inputID:"inputID",inputTextValue:"inputTextValue",customStyle:"customStyle",customLabel:"customLabel",customClass:"customClass",ngModel:"ngModel",notFoundMessageFor:"notFoundMessageFor",showToastrNotFound:"showToastrNotFound",prefixIcon:"prefixIcon",prefixIconTitle:"prefixIconTitle"},outputs:{optionSelected:"optionSelected",onSelect:"onSelect",onInputEnter:"onInputEnter",onInputChange:"onInputChange",onOptionsEmpty:"onOptionsEmpty"},features:[d._Bn([{provide:I.JU,useExisting:(0,d.Gpc)(()=>v),multi:!0}]),d.TTD],decls:7,vars:17,consts:[[3,"ngClass"],[4,"ngIf"],["type","text","matInput","",1,"form-control","text-black",3,"id","readonly","matAutocomplete","placeholder","formControl","paste","keydown"],["style","width: max-content;",3,"for",4,"ngIf"],["autoActiveFirstOption","true",3,"panelWidth","displayWith","optionSelected"],["autocomplete","matAutocomplete"],[3,"value",4,"ngFor","ngForOf"],[1,"position-relative"],["matTooltipPosition","above",1,"position-absolute","prefix-icon",3,"matTooltip"],[2,"width","max-content",3,"for"],[3,"value"],["width","30","height","30","align","left","class","me-2",3,"src",4,"ngIf"],["width","30","height","30","align","left",1,"me-2",3,"src"]],template:function(c,u){if(1&c&&(d.TgZ(0,"mat-form-field",0),d.YNc(1,ce,4,3,"ng-container",1),d.TgZ(2,"input",2),d.NdJ("paste",function(S){return u.inputLock?S.preventDefault():""})("keydown",function(S){return u.onKeyDown(S)}),d.qZA(),d.YNc(3,de,2,2,"label",3),d.qZA(),d.TgZ(4,"mat-autocomplete",4,5),d.NdJ("optionSelected",function(S){return u.onOptionSelected(S)}),d.YNc(6,ue,4,3,"mat-option",6),d.qZA()),2&c){const b=d.MAs(5);d.Gre("w-100 ",u.customClass,""),d.Q6J("ngClass",d.VKq(15,me,u.customStyle)),d.xp6(1),d.Q6J("ngIf",u.isNotEmpty(u.prefixIcon)),d.xp6(1),d.Q6J("id",u.inputID)("readonly",u.readonly)("matAutocomplete",b)("placeholder",u.placeholder||"")("formControl",u.inputControl),d.uIk("data-cy",u.data_cy),d.xp6(1),d.Q6J("ngIf",u.customStyle),d.xp6(1),d.Q6J("panelWidth","30%")("displayWith",u.displayFn),d.xp6(2),d.Q6J("ngForOf",u.options)}},dependencies:[e.XC,le.ey,e.ZL,g.mk,g.sg,g.O5,I.Fj,I.JJ,I.oH,E.gM],styles:["div.mat-mdc-autocomplete-panel mat-option{background-image:none!important;background-repeat:no-repeat!important;z-index:9999999}div.mat-mdc-autocomplete-panel mat-option.mat-mdc-option:hover{font-weight:700;background-color:#f7fcfc;border:1px solid #a6c9e2;width:100%}div.mat-mdc-autocomplete-panel mat-option.mat-mdc-option{margin:.1rem 0;overflow:visible;line-height:initial;word-wrap:break-word;white-space:pre-wrap}div.mat-mdc-autocomplete-panel mat-option.mat-mdc-option span.mdc-list-item__primary-text{white-space:normal}div.mat-mdc-autocomplete-panel mat-option.mat-mdc-option-active{background-color:#f7fcfc;border:1px solid #a6c9e2}div[role=listbox].mat-mdc-autocomplete-panel{border:1px solid #a6c9e2;background-color:#fffff3}.mat-mdc-option{font-size:13px;height:auto!important;padding:10px 6px!important}.prefix-icon{left:162px;top:8px;font-size:12px}\n"],encapsulation:2})),v})(),he=(()=>{class v{}return(0,o.Z)(v,"\u0275fac",function(c){return new(c||v)}),(0,o.Z)(v,"\u0275mod",d.oAB({type:v})),(0,o.Z)(v,"\u0275inj",d.cJS({imports:[e.Bb,g.ez,I.UX,E.AV]})),v})()}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkPOS=self.webpackChunkPOS||[]).push([[115],{24424:(O,T,l)=>{l.d(T,{O:()=>L});var s=l(81180),C=l(69751),y=l(94650);let L=(()=>{class b{constructor(){(0,s.Z)(this,"csvPrefixFormat","")}convertToCSV(u,I){let S;if("string"==typeof u)S=u;else{var m="object"==typeof u?u:JSON.parse(u);S=this.transformToCSVStringFormat(m)}this.exportCSV(S,I)}isNumeric(u){return/^-?\d+$/.test(u)}parseCSV(u){return new C.y(S=>{let m=new FileReader;m.onload=()=>{let f=m.result.split(/\r\n|\n/),e=f[0].split(","),a=[];for(let t=0;t<f.length;t++){let n=f[t].split(",");if(n.length==e.length){let r=[];for(let d=0;d<e.length;d++)this.isNumeric(n[d])?r.push(parseFloat(n[d])):r.push(n[d]);a.push(r)}else{var i=f[t].split(new RegExp(',(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)'));let r=[];for(let d=0;d<i.length;d++)this.isNumeric(i[d])?r.push(parseFloat(i[d])):r.push(i[d]);a.push(r)}}S.next(a)},m.readAsBinaryString(u)})}transformToCSVStringFormat(u){if(!u||!u.length)return;const S=Object.keys(u[0]);return u.map(M=>S.map(f=>{let e=null==M[f]?"":M[f];return e=e instanceof Date?e.toLocaleString():e.toString().replace(/"/g,'""'),e.search(/("|,|\n)/g)>=0&&(e=`"${e}"`),e}).join(",")).join("\n")}exportCSV(u,I){var S=new Blob([u],{type:"text/csv;charset=utf8;"}),m=document.createElement("a");m.setAttribute("href",window.URL.createObjectURL(S)),m.setAttribute("download",I),document.body.appendChild(m),m.click(),document.body.removeChild(m)}}return(0,s.Z)(b,"\u0275fac",function(u){return new(u||b)}),(0,s.Z)(b,"\u0275prov",y.Yz7({token:b,factory:b.\u0275fac,providedIn:"root"})),b})()},4077:(O,T,l)=>{l.d(T,{s:()=>m,n:()=>M});var s=l(81180),C=l(96700),y=l(67327),L=l(24351),b=l(41206);class A{constructor(){(0,s.Z)(this,"enabledDragItem",void 0),this.enabledDragItem=!1}drop(e,a){(0,b.bA)(a.Data,e.previousIndex,e.currentIndex)}toggleEnabledDragItem(){}onSaveDragAndDrop(e,a){this.enabledDragItem=!this.enabledDragItem,this.enabledDragItem||a.postListID(e,a.data.Data)}onPutSaveDragAndDrop(e,a){this.enabledDragItem=!this.enabledDragItem,this.enabledDragItem||a.putListID(e,a.data.Data)}}class u{constructor(e){(0,s.Z)(this,"httpService",void 0),this.httpService=e}exportCSV(e,a,i,t){i.pageData.Filter.Export=!0,i.pageData.Filter.FormatType=m.CSV,t=t||"export.csv",this.httpService.post(`/api/${a}`,JSON.stringify(i.pageData.Filter)).subscribe(n=>{e.convertToCSV(n,t),i.pageData.Filter.Export=!1})}convertToCSV(e,a=!1,i){let t=this.ExportDataFromUI2(a);e.convertToCSV(t,i)}ExportDataFromUI2(e=!1){const a=document.getElementById("tableGrid"),i=[];return y.gT.IsNotEmpty(a)&&a.querySelectorAll("tr").forEach(n=>{const r=new Object;let d=0;n.querySelectorAll("th, td").forEach(P=>{d++;const N=parseInt(P.getAttribute("colspan"));for(let g=1;g<N;g++)r["column"+d]="",d++;const E=P.innerText,R=E.toString().split("");if(e&&"0"===R[0]&&R.length>1){let g="'"+E.trim();r["column"+d]=g}else r["column"+d]=E.trim()}),i.push(r)}),i}}var I=l(22863);class S{constructor(){(0,s.Z)(this,"listTotal",void 0),(0,s.Z)(this,"pageSize",void 0),(0,s.Z)(this,"show",void 0),this.listTotal=0,this.pageSize=0,this.show=!1}changePaginationData(e){this.pageSize=e.pageData.Filter.RowCount,this.listTotal=e.data?.ListTotal,this.show=this.pageSize<=this.listTotal}changePage(e,a,i){a.Filter.PageNumber=e.pageIndex+1,i.getListData()}}var m=(()=>{return(f=m||(m={}))[f.CSV=0]="CSV",f[f.XLSX=1]="XLSX",m;var f})();class M extends I.M{constructor(e,a,i,t,n){if(super(e),(0,s.Z)(this,"_httpService",void 0),(0,s.Z)(this,"dataAPI",void 0),(0,s.Z)(this,"pageAPI",void 0),(0,s.Z)(this,"toastrService",void 0),(0,s.Z)(this,"route",void 0),(0,s.Z)(this,"pageData",{Filter:{},Options:{},Roles:{},Config:{}}),(0,s.Z)(this,"data",void 0),(0,s.Z)(this,"pagination",new S),(0,s.Z)(this,"dragDrop",new A),(0,s.Z)(this,"exportHandler",void 0),(0,s.Z)(this,"comparation",0),this._httpService=e,this.dataAPI=a,this.pageAPI=i,this.toastrService=t,this.route=n,this.exportHandler=new u(e),i){let r={};n&&(r=this.route.snapshot.queryParams),this.menuData$.pipe((0,L.b)(()=>this._httpService.post("/api/"+this.pageAPI,JSON.stringify(r)))).subscribe(d=>{this.pageData=d,this.pageData.Filter||(this.pageData.Filter={}),this.pageData.Filter.PageNumber=1,this.pageData.Filter.ID=r.ID,this.preInitList(),this.getListData()})}else this.pageData.Filter.RowCount=20,this.pageData.Filter.PageNumber=1,this.preInitList(),this.menuData$.subscribe(()=>{this.getListData()})}preInitList(){}getListData(e){this.preGetList(),this.dataAPI&&this._httpService.post("/api/"+this.dataAPI,JSON.stringify(this.pageData.Filter)).subscribe(a=>{this.data=a,this.postInit(a),this.pagination.changePaginationData(this),e&&(this.pageData.HideStoreApiCount=!1)})}searchFromPageOne(){this.preSearchFromPageOne(),this.pageData.Filter.PageNumber=1,this.getListData("filterMode")}postInit(e){null!=e.PageTitle&&(this.menuData.H=e.PageTitle)}preGetList(){null==this.pageData.Filter.From&&(this.pageData.Filter.From=y.gT.MinDate),null==this.pageData.Filter.To&&(this.pageData.Filter.To=y.gT.MinDate)}preSearchFromPageOne(){}onPaginationChange(e){this.pagination.changePage(e,this.pageData,this)}onSelectAllData(e){this.data.Data=this.data.Data.map(a=>(a.selected=e,a))}getSelectedData(){let e=[];return this.data&&(e=this.data.Data.filter(a=>a.selected)),e}httpPostListID(e,a,i){if(a||(a="Are you sure you want to selected record/s?"),0==confirm(a))return;let t=this.getSelectedData();t.length>0&&this.postListID(e,t,i)}httpPutListID(e,a,i){if(a||(a="Are you sure you want to selected record/s?"),0==confirm(a))return;let t=this.getSelectedData();t.length>0&&this.putListID(e,t,i)}httpDeleteListID(e,a,i){if(a||(a="Are you sure you want to delete selected record/s?"),0==confirm(a))return;let t=this.getSelectedData();t.length>0&&this.DeleteListID(e,t,i)}onSaveDragAndDrop(e){this.dragDrop.onSaveDragAndDrop(e,this)}onPutSaveDragAndDrop(e){this.dragDrop.onPutSaveDragAndDrop(e,this)}postListID(e,a,i){const t=a.map(n=>i?n[i]:n.ID);this._httpService.post(`/api/${e}`,t).subscribe(n=>{this.toastrService.success(n.Message?n.Message:n,C.n.Success),this.getListData()})}putListID(e,a,i){const t=a.map(n=>i?n[i]:n.ID);this._httpService.put(`/api/${e}`,t).subscribe(n=>{this.toastrService.success(n.Message?n.Message:n,C.n.Success),this.afterPutListSuccess(),this.getListData()})}afterPutListSuccess(){}DeleteListID(e,a,i){const t=a.map(n=>i?n[i]:n.ID);this._httpService.delete(`/api/${e}`,t).subscribe(n=>{this.toastrService.success(n.Message?n.Message:n,C.n.Success),this.getListData()})}postData(e,a){this._httpService.post("/API/"+e,JSON.stringify(a)).subscribe(i=>{this.getListData(),this.toastrService.success(i.Message?i.Message:i,C.n.Success)})}compare(e,a,i){return(e<a?-1:1)*(i?1:-1)}exportCSV(e,a,i){this.exportHandler.exportCSV(e,a,this,i)}s2ab(e){for(var a=new ArrayBuffer(e.length),i=new Uint8Array(a),t=0;t!=e.length;++t)i[t]=255&e.charCodeAt(t);return a}exportXlsx(e,a){this.pageData.Filter.FormatType=1,this.pageData.Filter.Export=!0,this.httpService.post(`/api/${e}`,JSON.stringify(this.pageData.Filter)).subscribe(i=>{a=decodeURI(a);const t=window.URL.createObjectURL(new Blob([this.s2ab(atob(i))],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,"})),n=document.createElement("a");n.href=t,n.setAttribute("download",a),document.body.appendChild(n),n.click(),window.URL.revokeObjectURL(t),n.remove()})}convertToCSV(e,a=!1,i){let t=this.exportHandler.ExportDataFromUI2(a);e.convertToCSV(t,i)}OnCompare(e){const a=e?this.data[e]:this.data;if(a.length<1)return;const i=Object.assign({},this.pageData.Filter);i.From=new Date(new Date(this.pageData.Filter.From).getFullYear(),new Date(this.pageData.Filter.From).getMonth()-1,1),i.To=new Date(new Date(this.pageData.Filter.To).getFullYear(),new Date(this.pageData.Filter.To).getMonth(),0).toDateString(),this._httpService.post("/API/"+this.dataAPI,JSON.stringify(i)).subscribe(t=>{const n=e?t[e]:t;this.comparation=0,a.forEach(r=>{r.PrevIndex="-",r.CurrentIndex="-",r.Increase="-";const d=n.filter(D=>D.EntityID==r.EntityID);if(r.CurrentIndex=r.Rank,d.length>0){const D=d[0];r.PrevIndex=D.Rank,D.SalesNet?r.Increase=(r.SalesNet-D.SalesNet)/D.SalesNet*100:D.Sales&&(r.Increase=(r.Sales-D.Sales)/D.Sales*100),r.IsPositive=r.Increase>0,r.IsNegative=r.Increase<0,this.comparation+=r.Increase}})})}}},17554:(O,T,l)=>{l.d(T,{H:()=>R});var s=l(81180),C=l(36895),y=l(24006),L=l(90811),b=l(65938),A=l(88796),u=l(65131),I=l(42046),S=l(63165),m=l(77579),M=l(63900),f=l(54004),e=l(18505),a=l(34782),i=l(95698),t=l(94650),n=l(89156),r=l(4077);let d=(()=>{class g{constructor(o){(0,s.Z)(this,"http",void 0),this.http=o}exportCSV(o,p,c){const h={...p,Export:!0,FormatType:r.s.CSV};this.http.post(`/api/${o}`,JSON.stringify(h)).subscribe(x=>this.convertToCSV(x,c+".csv"))}convertToCSV(o,p){let c;if("string"==typeof o)c=o;else{var h="object"==typeof o?o:JSON.parse(o);c=this.transformToCSVStringFormat(h)}this.downloadCSV(c,p)}transformToCSVStringFormat(o){if(!o||!o.length)return;const c=Object.keys(o[0]);return o.map(x=>c.map(F=>{let v=null==x[F]?"":x[F];return v=v instanceof Date?v.toLocaleString():v.toString().replace(/"/g,'""'),v.search(/("|,|\n)/g)>=0&&(v=`"${v}"`),v}).join(",")).join("\n")}downloadCSV(o,p){var c=new Blob([o],{type:"text/csv;charset=utf8;"}),h=document.createElement("a");h.setAttribute("href",window.URL.createObjectURL(c)),h.setAttribute("download",p),document.body.appendChild(h),h.click(),document.body.removeChild(h)}exportXlsx(o,p,c){const h={...p,FormatType:r.s.XLSX};this.http.post(`/api/${o}`,JSON.stringify(h)).subscribe(x=>{c=decodeURI(c+".xlsx");const F=window.URL.createObjectURL(new Blob([this.s2ab(atob(x))],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,"})),v=document.createElement("a");v.href=F,v.setAttribute("download",c),document.body.appendChild(v),v.click(),window.URL.revokeObjectURL(F),v.remove()})}s2ab(o){const p=new ArrayBuffer(o.length),c=new Uint8Array(p);for(let h=0;h!=o.length;++h)c[h]=255&o.charCodeAt(h);return p}}return(0,s.Z)(g,"\u0275fac",function(o){return new(o||g)(t.LFG(n.O))}),(0,s.Z)(g,"\u0275prov",t.Yz7({token:g,factory:g.\u0275fac,providedIn:"root"})),g})();var D=l(83902);function P(g,Z){if(1&g){const o=t.EpF();t.TgZ(0,"i",21),t.NdJ("click",function(){t.CHM(o);const c=t.oxw(3);return t.KtG(c.onGetAllDataLength())}),t.qZA()}}function N(g,Z){if(1&g&&(t.TgZ(0,"span"),t._uU(1,"of "),t.YNc(2,P,1,0,"i",19),t.ALo(3,"async"),t.TgZ(4,"span",20),t._uU(5),t.ALo(6,"async"),t.qZA(),t._uU(7," page(s)"),t.qZA()),2&g){const o=t.oxw(2);t.xp6(2),t.Q6J("ngIf",!t.lcZ(3,2,o.allDataLength$)),t.xp6(3),t.Oqu(t.lcZ(6,4,o.allDataLength$))}}function E(g,Z){if(1&g){const o=t.EpF();t.ynx(0),t.TgZ(1,"div",6),t._uU(2,"Page"),t.qZA(),t.TgZ(3,"div",14)(4,"input",15),t.NdJ("ngModelChange",function(c){t.CHM(o);const h=t.oxw();return h.pageNumber=c,t.KtG(h.onChangePageNumber())}),t.qZA(),t.YNc(5,N,8,6,"span",13),t.qZA(),t.TgZ(6,"div",16)(7,"div",17),t._UZ(8,"i",18),t._uU(9),t.ALo(10,"number"),t.ALo(11,"number"),t.qZA()(),t.BQk()}if(2&g){const o=t.oxw();t.xp6(4),t.Q6J("ngModel",o.pageNumber),t.xp6(1),t.Q6J("ngIf",o.getAllDataLengthAPI),t.xp6(4),t.AsE(" Exporting data from ",t.lcZ(10,4,o.displayedMinRangeRow)," - ",t.lcZ(11,6,o.displayedMaxRangeRow)," ")}}let R=(()=>{class g{constructor(o,p,c,h){(0,s.Z)(this,"dialogRef",void 0),(0,s.Z)(this,"exportHandler",void 0),(0,s.Z)(this,"pageNumber",1),(0,s.Z)(this,"pageSize",1e4),(0,s.Z)(this,"config",new I.O),(0,s.Z)(this,"exportTypes",[]),(0,s.Z)(this,"exportType",void 0),(0,s.Z)(this,"exportFormat","CSV"),(0,s.Z)(this,"exportFormats",[{ID:"CSV"},{ID:"XLSX"}]),(0,s.Z)(this,"_onGetAllDataLength",new m.x),(0,s.Z)(this,"onGetAllDataLength$",this._onGetAllDataLength.asObservable()),(0,s.Z)(this,"allDataLength$",void 0),(0,s.Z)(this,"filterExport",void 0),(0,s.Z)(this,"displayedMaxRangeRow",this.pageSize),(0,s.Z)(this,"displayedMinRangeRow",this.pageNumber),(0,s.Z)(this,"fileName",void 0),(0,s.Z)(this,"pagination",void 0),(0,s.Z)(this,"getAllDataLengthAPI",""),this.dialogRef=p,this.exportHandler=h,this.config.title=`Export ${o.title}`,this.config.hideCancel=!0,this.config.customWidth="450px",this.exportTypes=o.exportTypes,this.exportType=this.exportTypes[0].ID,this.fileName=this.exportTypes[0].FileName,this.filterExport=o.filterExport,this.pagination=o.pagination,this.getAllDataLengthAPI=o.getAllDataLengthAPI,this.allDataLength$=this.onGetAllDataLength$.pipe((0,M.w)(()=>c.post("/API/"+o.getAllDataLengthAPI,this.filterExport)),(0,f.U)(x=>"number"==typeof x?x:x.Count),(0,e.b)(x=>{x<this.displayedMaxRangeRow&&this.setMinMaxRangeDisplayedRow(x)}),(0,f.U)(x=>Math.floor(x/this.pageSize)+(x%this.pageSize>0?1:0)),(0,a.d)(1),(0,i.q)(1))}onOk(){this.filterExport={...this.filterExport,Export:!0},this.pagination&&(this.filterExport={...this.filterExport,ExportPageNumber:this.pageNumber,ExportRowCount:this.pageSize}),"CSV"==this.exportFormat?this.exportHandler.exportCSV(this.exportType,this.filterExport,this.fileName):"XLSX"==this.exportFormat&&this.exportHandler.exportXlsx(this.exportType,this.filterExport,this.fileName),this.dialogRef.close()}onGetAllDataLength(){this._onGetAllDataLength.next()}onChangePageNumber(){this.setDisplayedMinMaxRangeRow()}setMinMaxRangeDisplayedRow(o){for(;this.displayedMaxRangeRow>o&&this.pageNumber>1;)this.pageNumber-=1,this.setDisplayedMinMaxRangeRow();this.displayedMaxRangeRow=o}onChangeExportType(o){this.fileName=o.FileName}setDisplayedMinMaxRangeRow(){this.displayedMinRangeRow=this.pageNumber*this.pageSize-this.pageSize+1,this.displayedMaxRangeRow=this.pageNumber*this.pageSize}}return(0,s.Z)(g,"\u0275fac",function(o){return new(o||g)(t.Y36(b.WI),t.Y36(b.so),t.Y36(n.O),t.Y36(d))}),(0,s.Z)(g,"\u0275cmp",t.Xpm({type:g,selectors:[["POS-modal-complex-export"]],standalone:!0,features:[t.jDz],decls:19,vars:5,consts:[[3,"config","onCancel","onClose","onOk"],[1,"container-fluid"],[1,"row"],[1,"col-3","fw-bold",2,"display","flex","align-items","center"],[1,"col-9"],["appendTo","body","bindLabel","Value","bindValue","ID",3,"items","ngModel","ngModelChange","change"],[1,"col-3","fw-bold","mt-8",2,"display","flex","align-items","center"],[1,"col-9","mt-8"],[3,"ngModel","ngModelChange"],["value","CSV"],[1,"fa-solid","fa-file-csv","me-3","mb-1"],["value","XLSX"],[1,"fa-solid","fa-file-excel","me-3","mb-1"],[4,"ngIf"],[1,"col-9","mt-8",2,"display","flex","align-items","center","column-gap","10px"],["type","text","autoNum","","name","pageNumber","id","pageNumber",1,"form-control","text-center",2,"width","50px",3,"ngModel","ngModelChange"],[1,"col-12","mt-8"],[1,"p-3",2,"background-color","#ADD8E6","border-radius","4px"],[1,"fa-solid","fa-circle-exclamation","mx-3"],["class","fa-solid fa-circle-question mx-3",3,"click",4,"ngIf"],[1,"fw-bold"],[1,"fa-solid","fa-circle-question","mx-3",3,"click"]],template:function(o,p){1&o&&(t.TgZ(0,"modal-material",0),t.NdJ("onCancel",function(){return p.dialogRef.close()})("onClose",function(){return p.dialogRef.close()})("onOk",function(){return p.onOk()}),t.TgZ(1,"content")(2,"div",1)(3,"div",2)(4,"div",3),t._uU(5,"Columns"),t.qZA(),t.TgZ(6,"div",4)(7,"ng-select",5),t.NdJ("ngModelChange",function(h){return p.exportType=h})("change",function(h){return p.onChangeExportType(h)}),t.qZA()(),t.TgZ(8,"div",6),t._uU(9,"Format"),t.qZA(),t.TgZ(10,"div",7)(11,"mat-button-toggle-group",8),t.NdJ("ngModelChange",function(h){return p.exportFormat=h}),t.TgZ(12,"mat-button-toggle",9),t._UZ(13,"i",10),t._uU(14,"CSV"),t.qZA(),t.TgZ(15,"mat-button-toggle",11),t._UZ(16,"i",12),t._uU(17,"XLSX"),t.qZA()()(),t.YNc(18,E,12,8,"ng-container",13),t.qZA()()()()),2&o&&(t.Q6J("config",p.config),t.xp6(7),t.Q6J("items",p.exportTypes)("ngModel",p.exportType),t.xp6(4),t.Q6J("ngModel",p.exportFormat),t.xp6(7),t.Q6J("ngIf",p.pagination))},dependencies:[S.d,S.M,A.A0,A.w9,y.u5,y.Fj,y.JJ,y.On,C.ez,C.O5,C.Ov,C.JJ,u.X,D.b,L.vV,L.A9,L.Yi],styles:[".general[_ngcontent-%COMP%], .page[_ngcontent-%COMP%]{border:1px solid #dcdcdc;border-radius:3px;padding:10px 8px;position:relative}.general[_ngcontent-%COMP%]{margin-bottom:15px}.floating-title[_ngcontent-%COMP%]{position:absolute;top:-10.5px;background:white;color:gray;font-size:14px}.select-header[_ngcontent-%COMP%]{line-height:36px}.input-header[_ngcontent-%COMP%]{line-height:36.6px}.form-control[_ngcontent-%COMP%]{height:max-content!important;padding:.375rem .75rem!important}"]})),g})()}}]);
|