dealpos 11.6.5 → 11.6.6

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.
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkPOS=self.webpackChunkPOS||[]).push([[1455],{61455:(Ee,St,p)=>{p.r(St),p.d(St,{POSModule:()=>Ws});var g=p(36895),S=p(78317),t=p(94650),T=p(77579),_=(()=>{return(o=_||(_={}))[o.IsNew=0]="IsNew",o[o.IsComplete=1]="IsComplete",o[o.IsEdit=2]="IsEdit",o[o.isPark=3]="isPark",o[o.IsRetrieve=4]="IsRetrieve",o[o.IsSplit=5]="IsSplit",o[o.IsBill=6]="IsBill",o[o.IsReturn=7]="IsReturn",o[o.IsUndo=8]="IsUndo",o[o.UploadOrderFail=9]="UploadOrderFail",_;var o})(),m=p(82722),Yt=p(22863),c=p(67327),U=p(96700),h=p(65412),H=p(61135),V=p(39300),lt=p(71884),j=p(63900),x=p(29099),P=p(13337),M=p(89156);let C=(()=>{class o{constructor(e,n,i){this._onlineStatusService=e,this._localDataService=n,this._httpService=i,this._Data=new H.X(null),this.Data$=this._Data.asObservable().pipe((0,V.h)(a=>null!==a),(0,lt.x)()),this._onlineStatusService.getOnlineStatus$().subscribe(a=>{this.isOnline=a})}get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}request(){return new Promise((e,n)=>{this.isOnline?this._httpService.post(c.Wz.GetPOSStorage).pipe((0,j.w)(i=>this._localDataService.syncPOSStorage(i))).subscribe({next:i=>{this._Data.next(i),e(i)},error:i=>{n(i)}}):this._localDataService.getPOSStorage().pipe((0,V.h)(i=>null!=i)).subscribe(i=>{e(i)})})}getOutletName(e){const n=this.Data.Entities.find(i=>i.ID==e);return void 0!==n?n.Name:e}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(x.q),t.LFG(P.T),t.LFG(M.O))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();var N=p(77091),J=p(75033),Ht=p(49808);class Tt{constructor(){this.posState=_.IsNew,this.CommissionID="",this.ReturNumber="",this.parkTemporaryItem=[],this.InputTextValue=""}}var Le=p(63631),ft=p(71378),It=(()=>{return(o=It||(It={}))[o.NOW=0]="NOW",o[o.LATER=1]="LATER",It;var o})(),Ct=p(21750);class kt{constructor(){this.RegisterID=null,this.RegisterCode=null,this.EntityID=null,this.EntityName=null,this.NumberElement=new Ct.V,this.InvoiceNumberElement=new Ct.V,this.Promotion=[]}}var W=p(50494),G=p(94768),ct=(()=>{return(o=ct||(ct={}))[o.Pending=1]="Pending",o[o.Complete=3]="Complete",ct;var o})(),D=p(42046),Ve=p(78372),bt=(()=>{return(o=bt||(bt={}))[o.Never=0]="Never",o[o.OnRetrieve=1]="OnRetrieve",o[o.Always=2]="Always",bt;var o})(),X=p(16571);class Ye{constructor(r){r&&(this.EntityID=r.EntityID,this.ID=r.ID,this.Note=r.Note,this.Serial=r.Serial,this.VariantID=r.VariantID)}get EntityID(){return this._EntityID}get ID(){return this._ID}get Note(){return this._Note}get Serial(){return this._Serial}get VariantID(){return this._VariantID}set EntityID(r){this._EntityID=r}set ID(r){this._ID=r}set Note(r){this._Note=r}set Serial(r){this._Serial=r}set VariantID(r){this._VariantID=r}}var Gt=p(54004);let oe=(()=>{class o{constructor(e,n){this.httpService=e,this.localData=n}findVariantByID(e,n,i=!0){return new Promise((a,s)=>{this.localData.isConfigFromServer().subscribe(l=>{l?this.httpService.post(c.Wz.GetVariantByID,{id:e,entityID:n,Promotion:i}).subscribe({next:f=>{a(f)},error:f=>{s(f)}}):this.localData.findVariantById(e).subscribe({next:d=>{a(d)},error:d=>{s(d)}})})})}findVariantByCode(e,n,i=!1){return new Promise((a,s)=>{this.localData.isProductFromServer().subscribe(l=>{l?this.httpService.post("/API/catalog/variant/GetVariantByCode",{code:e,entityID:n,barcodeSerial:i,Promotion:!0}).subscribe({next:f=>{a(f)},error:f=>{s(f)}}):this.localData.findVariantByCode(e).subscribe({next:d=>{a(d)},error:d=>{s(d)}})})})}getVariantSerial(e,n,i){return this.httpService.post("/API/catalog/variant/GetVariantSerial",{entityID:e,soID:n,variantID:i}).pipe((0,Gt.U)(a=>a.map(l=>new Ye(l))))}getStockByID(e,n){return new Promise((i,a)=>{this.httpService.post("/API/catalog/variant/GetInventoryByVariantID",{id:e,entityID:n}).subscribe({next:l=>i(l),error:l=>a(l)})})}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(M.O),t.LFG(P.T))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();var Pt=p(55706),tt=p(21968),I=p(97185);let v=(()=>{class o{constructor(e,n,i){this._OrderHttpService=e,this._customerHttpService=n,this._toastrService=i,this._Data=new H.X(new J.m),this.Data$=this._Data.asObservable()}get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e||this.Data)}submitOrder(e){return new Promise((n,i)=>{null!=this.Data.Invoice.Due&&(this.Data.Payments=[]),this.checkTransactionId(),this._OrderHttpService.submitOrder(this.Data,e).then(a=>{n(a)},a=>{this.Data.Items=[],i(a)})})}checkTransactionId(){const n=this.Data.Payments.find(i=>i.TypeID==Pt.Q.emoney);c.gT.IsNotEmpty(n)&&c.gT.IsEmpty(this.transaction_id)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure")}updateCustomerID(e){return this.Data.Order.CustomerID=e,this.pushNewValue(this.Data),new Promise((n,i)=>{this._customerHttpService.GetPrivilegeByID(e,this.Data.Order.EntityID).subscribe({next:a=>{this._customerHttpService.Data=a,this.pushNewValue(this.Data),n(a)},error:()=>{i([])}})})}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(N.D),t.LFG(tt.r),t.LFG(I._W))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();var B=p(63385),et=(()=>{return(o=et||(et={}))[o.DiscountPercentage=1]="DiscountPercentage",o[o.DiscountAmount=2]="DiscountAmount",o[o.Return=3]="Return",o[o.ParkedDeletion=4]="ParkedDeletion",o[o.FullAccess=5]="FullAccess",et;var o})(),Y=p(90287);let K=(()=>{class o{constructor(e){this.posHttpResponseService=e,this._Data=new H.X(new Y.Q),this.Data$=this._Data.asObservable(),this.posHttpResponseService.Data$.subscribe(n=>{const i=new Y.Q;i.Assign(n.Roles),this.pushNewValue(i)})}get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(C))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})(),ie=(()=>{class o{constructor(e,n,i,a){this._httpService=e,this._orderDataService=n,this._userRoleService=i,this.toastr=a,this.role=new Y.Q,this.subscribeToObservable()}subscribeToObservable(){this._userRoleService.Data$.subscribe(e=>{this.role=e})}RedeemCoupon(e,n,i,a=!0){this._httpService.post(c.Wz.Authorize,{Key:e,EntityID:this._orderDataService.Data.Order.EntityID,CouponType:i}).subscribe(l=>{switch(l.Type){case et.DiscountPercentage:this.HandleDiscountPercentage(l),a&&this.toastr.success(l.Notify,"Coupon Applied");break;case et.DiscountAmount:this.HandleDiscountAmount(l),a&&this.toastr.success(l.Notify,"Coupon Applied");break;case et.Return:this.HandleReturn();break;case et.ParkedDeletion:this.HandleParkedDeletion();break;case et.FullAccess:this.HandleFullAccess(),a&&this.toastr.success("You now have Full Access for this Order!","Coupon Applied")}this._orderDataService.Data.Order.AuthorizationKey=e,this._orderDataService.Data.Order.AuthorizationNote=n,this._orderDataService.Data.Order.CouponType=i,i==B.$.Tada&&(c.gT.IsNotEmpty(this._orderDataService.Data.Order.Note)?this._orderDataService.Data.Order.Note+="\nCoupon TADA - "+l.Notify:this._orderDataService.Data.Order.Note=" Coupon TADA - "+l.Notify)})}HandleDiscountPercentage(e){e.amount>0?(this._orderDataService.Data.Order.Discount=e.amount,this._orderDataService.pushNewValue()):(this.role.Discount=!0,this._userRoleService.pushNewValue(this.role))}HandleDiscountAmount(e){e.amount>0?(this._orderDataService.Data.Order.DiscountAmount=e.amount,this._orderDataService.pushNewValue()):(this.role.Discount=!0,this._userRoleService.pushNewValue(this.role))}HandleReturn(){this.role.Return=!0,this._userRoleService.pushNewValue(this.role)}HandleParkedDeletion(){this.role.ParkedDeletionAuthorized=!0,this._userRoleService.pushNewValue(this.role)}HandleFullAccess(){this.role.UnitPriceEditor=!0,this.role.Discount=!0,this.role.Return=!0,this.role.TaxRestriction=!1,this.role.NumberEditor=!0,this.role.DateEditor=!0,this.role.PricebookSelector=!0,this._userRoleService.pushNewValue(this.role)}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(M.O),t.LFG(v),t.LFG(K),t.LFG(I._W))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})(),at=(()=>{class o{constructor(e,n,i,a,s,l,d){this.variantService=e,this._posService=n,this._orderDataService=i,this.toastr=a,this._orderProcessorService=s,this._customerHttpService=l,this.promotionCouponService=d,this.audio=new Audio,this.subscribeToObservable()}subscribeToObservable(){this._posService.Data$.subscribe(e=>{this.restriction=e.Restriction,this.appConfigJson=e.AppConfigJSON}),this._orderDataService.Data$.subscribe(e=>{this.salesOrderData=e,this.entityID=e.Order.EntityID})}addCartItemById(e,n,i=!0){return new Promise((a,s)=>{this.variantService.findVariantByID(e,this.entityID,i).then(l=>{this.createNewCartItem(l,n),a(l)}).catch(l=>{s(l)})})}addCartItemByCode(e){return new Promise((n,i)=>{const a=this.appConfigJson.ModuleSell.DigitalScale;a.Digit>0&&c.gT.IsNotEmpty(a.Regex)&&e.length==a.Digit?this.parseDigitalScaleBarcodeWithRegex(e,a).then(l=>{l||this.findVariantByCode(e).then(d=>n(d)).catch(d=>i(d))}):this.findVariantByCode(e).then(l=>n(l)).catch(l=>i(l))})}findVariantByCode(e){const n=this.appConfigJson.ModuleSell.BarcodeSerialEnabled;return new Promise((i,a)=>{this.variantService.findVariantByCode(e,this.entityID,n).then(s=>{s.TypeID==X.J.Serialized&&(s.SerialNote=`[${e}]`),i(s),this.createNewCartItem(s)}).catch(s=>{this.playBellRing(),a(s)})})}playBellRing(){this.audio.src="//res.cloudinary.com/pos/video/upload/v1659947782/POS/Music/bell_ring.mp3",this.audio.load(),this.audio.play()}updateCartItem(e,n){e=this.applyPromotionProduct(e),this.salesOrderData.CartItems[n]=e,this._orderDataService.pushNewValue(this.salesOrderData),this.reApplyPromotionCoupon()}deleteCartItem(e){this.salesOrderData.CartItems=this.salesOrderData.CartItems.filter(n=>n!==e),this._orderDataService.pushNewValue(this.salesOrderData),this.reApplyPromotionCoupon()}parseDigitalScaleBarcodeWithRegex(e,n){const i=this.appConfigJson.ModuleSell.BarcodeSerialEnabled,a=new RegExp(n.Regex),s=e.match(a),l=s[1];let d=parseFloat(s[2]);return d/=n.QuantityDivider,new Promise(f=>{this.variantService.findVariantByCode(l,this.entityID,i).then(b=>{this.createNewCartItem(b,null,d),f(!0)}).catch(()=>{f(!1)})})}createNewCartItem(e,n,i){let a=new G.t;a.patchByVariant(e,this.appConfigJson.ModuleSell.ProductNotes.CopyProductDescription,this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName),a=this.applyReward(a,n),c.gT.IsEmpty(n)&&(a=this.applyPriceBook(a)),this.validateCartItem(a)&&(a.Quantity=i||a.Quantity,this.pushNewItemToArray(a,a.PromotionGift)),this.addAvailableComponent(a)}applyPromotionProduct(e){const n=e.Variant.DiscountAmount;return n&&(this._posService.Data.AppConfigJSON.ModuleSell.promotion.ShowPromotionDiscountAmount?e.DiscountAmount=n*e.Quantity:e.Price=e.Price-n),e}applyReward(e,n){if(n){const i=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;e.Discount=n.Discount,e.Price=n.OriginalPrice;const a=n.OriginalPrice-n.UnitPrice;this.appConfigJson.ModuleSell.promotion.ShowPromotionDiscountAmount?e.DiscountAmount=a:e.Price=e.Price-a,e.PromotionGift=!0,e.Cost+=n.ExtraCost,i&&(e.Note=n.PromotionName)}return e}addAvailableComponent(e){const n=0!=e.Price,i=this.appConfigJson.ModuleSell.SellProductComponentDefaultPrice,a=e.Variant;if(null!=a.Component&&a.Component.length>0)for(const s of a.Component){const l=new G.t;l.patchByVariant(s),l.Quantity=e.Quantity*s.Quantity,n&&!i&&(s.UnitPrice=0),l.Price=s.UnitPrice,this.pushNewItemToArray(l)}}pushNewItemToArray(e,n=!1){const i=this.salesOrderData.CartItems.findIndex(a=>a.VariantID==e.VariantID);if(e=this.applyPromotionProduct(e),-1==i||n)this.salesOrderData.CartItems.push(e);else{const a=this.appConfigJson.ModuleSell.QuickKey.NewRowBehaviour;a==bt.Always||a==bt.OnRetrieve&&this._orderProcessorService.Data.posState==_.IsRetrieve?this.salesOrderData.CartItems.push(e):this.addingQuantityItem(i,e)}this._orderDataService.pushNewValue(this.salesOrderData),this.reApplyPromotionCoupon()}reApplyPromotionCoupon(){const e=this.salesOrderData.Order.AuthorizationKey,n=this.salesOrderData.Order.CouponType,i=this.salesOrderData.Order.AuthorizationNote;c.gT.IsNotEmpty(e)&&this.promotionCouponService.RedeemCoupon(e,i,n,!1)}addingQuantityItem(e,n){let i=this.salesOrderData.CartItems.filter(d=>d.VariantID==n.VariantID),a=i.length,s=i.find(d=>!d.PromotionGift);this.salesOrderData.CartItems[e].PromotionGift&&1==a?this.salesOrderData.CartItems.push(n):(s=this.addingSerialItem(s,n),s.Quantity+=n.Quantity,s=this.applyPromotionProduct(s)),s&&(s=this.applyPriceBook(s))}addingSerialItem(e,n){if(e.Variant.TypeID==X.J.Serialized){let i=[...e.Serial,...n.Serial];e.Serial=i.filter((a,s)=>i.indexOf(a)==s),e.Note=`[${e.Serial}]`}return e}validateCartItem(e){return-1==e.Variant.CategoryTypeID?(this.toastr.info(e.Variant.Name+" cannot be sold, check Category "+e.Variant.CategoryName+" settings","info"),!1):!(!this.checkPriceMinimum(e)||!this.validateSerialItem(e))}checkPriceMinimum(e){const n=1===this.appConfigJson.ModuleSell.ProductDialog.PriceMinimumTypeID?"UnitPrice":"UnitCost";let a=!0;if(e.Price<e.Variant[n]&&this.restriction.PriceMinimum){a=!1;const s=e.Variant[n].toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");alert(`You have no right to sell this item lower than ${s}`)}return a}validateSerialItem(e){let n=!0;return 4==e.Variant.TypeID&&c.gT.IsNotEmpty(e.Note)&&e.Quantity>0&&e.Serial.length!=e.Quantity&&(this.toastr.error("Serial must be equal with the quantity","Error"),n=!1),n}applyPriceBook(e){const n=null!=e.Variant.PriceBook?e.Variant.PriceBook:[],i=this.findCustomerPricebook(n);if(n&&0!==n.length){const a=n.sort(function(s,l){return l.MinimumQuantity-s.MinimumQuantity}).filter(s=>e.Quantity>=s.MinimumQuantity);a.length>0&&(void 0!==i?e=this.applyPricebookToItem(e,i):0!=a[0].MinimumQuantity&&(e=this.applyPricebookToItem(e,a[0])))}return e}applyPricebookToItem(e,n){const i=this.appConfigJson.ModuleSell.Pricebook.PricebookVisible;return e.Discount=n.PriceDiscount,e.PriceNote=n.Name,e.UnitPrice=n.UnitPrice,e.PriceBookID=n.ID,e.Price=n.UnitPrice,i&&(e.Note=n.Name),e}findCustomerPricebook(e=[]){const n=this._customerHttpService.Data;let i;return n&&(i=e.find(a=>a.ID==n.PricebookID)),i}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(oe),t.LFG(C),t.LFG(v),t.LFG(I._W),t.LFG(Z),t.LFG(tt.r),t.LFG(ie))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();var y=p(63165),u=p(24006),k=p(93669);function He(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",9)(1,"div",4)(2,"input",10),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.model=i)})("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.changed(i))}),t.qZA()()()}if(2&o){const e=t.oxw();t.xp6(2),t.Q6J("ngModel",e.model)}}function Ge(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"tr")(1,"td"),t._uU(2),t.qZA(),t.TgZ(3,"td"),t._uU(4),t.qZA(),t.TgZ(5,"td",11),t._uU(6),t.ALo(7,"number"),t.qZA(),t.TgZ(8,"td",11),t._uU(9),t.ALo(10,"number"),t.qZA(),t.TgZ(11,"td")(12,"div",12)(13,"button",13),t.NdJ("click",function(){const a=t.CHM(e).$implicit,s=t.oxw();return t.KtG(s.select(a))}),t._uU(14,"Apply"),t.qZA()()()()}if(2&o){const e=r.$implicit;t.xp6(2),t.Oqu(e.VariantName),t.xp6(2),t.Oqu(e.VariantCode),t.xp6(2),t.Oqu(t.lcZ(7,4,e.OriginalPrice)),t.xp6(3),t.Oqu(t.lcZ(10,6,e.UnitPrice))}}let Be=(()=>{class o{constructor(e,n,i,a,s,l){this._dialogRef=e,this._matDialog=n,this._shoppingCartService=i,this._promotionEventService=a,this._toastr=s,this.rewards=l,this.modalConfig=new D.O,this.modelChanged=new T.x,this.temp=[],this.selectedPromotion=this._promotionEventService.selectedPromotion,this.temp=l,this.modelChanged.pipe((0,Ve.b)(300),(0,lt.x)()).subscribe(d=>this.model=d)}changed(e){this.rewards=""!=e||null!=e?this.temp.filter(n=>this.findKeywordInValue(e,n.VariantName)||this.findKeywordInValue(e,n.VariantCode)):this.temp,this.modelChanged.next(e)}findKeywordInValue(e,n){return n.toUpperCase().indexOf(e.toUpperCase())>-1}ngOnInit(){this.modalConfig.title="Select a Reward",this.modalConfig.customWidth="'300px'",this.modalConfig.hideFooter=!0}select(e){this._shoppingCartService.addCartItemById(e.VariantID,e,!1).then(()=>{this._matDialog.closeAll(),this._promotionEventService.pushNewValue(this._promotionEventService.Data),this.showToastAppliedPromo()})}showToastAppliedPromo(){this._toastr.success("Applied "+this.selectedPromotion.Name+" to order!","Applied successfully!")}close(){this._dialogRef.close()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(h.uw),t.Y36(at),t.Y36(rt),t.Y36(I._W),t.Y36(h.WI))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-select-item"]],decls:21,vars:7,consts:[[3,"config","onCancel","onClose"],[1,"container"],["class","row mb-3",4,"ngIf"],[1,"row","table-scroll"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[4,"ngFor","ngForOf"],[1,"row","mb-3"],["type","text","placeholder","Type to filter reward",1,"form-control",3,"ngModel","ngModelChange"],[1,"text-end"],[1,"col","text-end"],[1,"btn","btn-sm","btn-success",3,"click"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),t.TgZ(1,"content")(2,"div",1),t.YNc(3,He,3,1,"div",2),t.TgZ(4,"div",3)(5,"div",4)(6,"table",5)(7,"thead",6)(8,"tr")(9,"th",7),t._uU(10,"Name"),t.qZA(),t.TgZ(11,"th",7),t._uU(12,"Code"),t.qZA(),t.TgZ(13,"th",7),t._uU(14,"Price"),t.qZA(),t.TgZ(15,"th",7),t._uU(16,"Promo"),t.qZA(),t._UZ(17,"th",7),t.qZA()(),t.TgZ(18,"tbody"),t.YNc(19,Ge,15,8,"tr",8),t.ALo(20,"sortBy"),t.qZA()()()()()()()),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(3),t.Q6J("ngIf",(null==n.temp?null:n.temp.length)>5),t.xp6(16),t.Q6J("ngForOf",t.Dn7(20,3,n.rewards,"desc","VariantCode")))},dependencies:[g.sg,g.O5,y.M,u.Fj,u.JJ,u.On,g.JJ,k.W7],styles:[".table-scroll[_ngcontent-%COMP%]{max-height:400px;overflow-y:auto}table[_ngcontent-%COMP%]{max-width:600px!important;overflow-x:hidden}"]}),o})();var w=(()=>{return(o=w||(w={}))[o.Amount=1]="Amount",o[o.Quantity=2]="Quantity",o[o.Discount=3]="Discount",o[o.Product=4]="Product",o[o.PromotionTiered=5]="PromotionTiered",w;var o})(),Mt=(()=>{return(o=Mt||(Mt={}))[o.Product=1]="Product",o[o.Cheapest=2]="Cheapest",Mt;var o})(),Ke=p(95698),ae=p(40796);function $e(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"span",17),t.NdJ("click",function(i){t.CHM(e);const a=t.oxw().$implicit;return t.oxw().closeRegister(a),t.KtG(i.stopPropagation())}),t.qZA()}}function ze(o,r){1&o&&(t.TgZ(0,"div")(1,"span",18),t._uU(2,"VACANT"),t.qZA()())}function je(o,r){if(1&o&&(t.TgZ(0,"div")(1,"span",19),t._UZ(2,"i",20),t.TgZ(3,"font"),t._uU(4),t.qZA()(),t.TgZ(5,"span",21),t._UZ(6,"i",22),t.TgZ(7,"font"),t._uU(8),t.qZA()()()),2&o){const e=t.oxw().$implicit;t.xp6(4),t.Oqu(e.LoginID),t.xp6(4),t.hij("",e.StartDisplay.split(" ")[3]," - Now")}}const We=function(o){return{active:o}},Xe=function(o){return{gray:o}};function tn(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),t.NdJ("click",function(){const a=t.CHM(e).$implicit,s=t.oxw();return t.KtG(s.select(a))}),t.TgZ(4,"span"),t._UZ(5,"i",13),t._uU(6),t.ALo(7,"limitTo"),t.qZA(),t.YNc(8,$e,1,0,"span",14),t.qZA(),t.TgZ(9,"div",15),t.NdJ("click",function(){const a=t.CHM(e).$implicit,s=t.oxw();return t.KtG(s.select(a))}),t.YNc(10,ze,3,0,"div",16),t.YNc(11,je,9,2,"div",16),t.qZA()()()()}if(2&o){const e=r.$implicit,n=t.oxw();t.xp6(1),t.Q6J("ngClass",e.Active?"active":""),t.xp6(1),t.Q6J("ngClass",t.VKq(11,We,(null==e?null:e.ID)==(null==n.selectedRegister?null:n.selectedRegister.ID))),t.xp6(1),t.Q6J("ngClass",t.VKq(13,Xe,e!=n.selectedRegister)),t.xp6(3),t.Oqu(t.xi3(7,8,e.Name,15)),t.xp6(2),t.Q6J("ngIf","Close"!=e.State),t.xp6(1),t.Q6J("ngSwitch",e.State),t.xp6(1),t.Q6J("ngSwitchCase","Close"),t.xp6(1),t.Q6J("ngSwitchCase","Open")}}let re=(()=>{class o{constructor(e,n,i,a,s){this._dialogRef=e,this._outletService=n,this._posService=i,this._userRoleService=a,this.router=s,this.searchInput="",this.selectedRegister=new ae.e,this.modalConfig=new D.O,this.role=new Y.Q,this.destroy$=new T.x}get AppConfigJSON(){return this._posService.Data.AppConfigJSON}ngOnInit(){this.subscribeToObsChanges(),this.initModalConfig()}subscribeToObsChanges(){this.registers=this._posService.Data.Registers,this._outletService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.selectedRegister=this.findOutletRegisterById(e.RegisterID)}),this._userRoleService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.role=e})}findOutletRegisterById(e){return this.registers.find(i=>i.ID===e)||new ae.e}initModalConfig(){this.modalConfig.hideClose=!1,this.modalConfig.hideCancel=!1,this.modalConfig.bodyScrollable=!0,this.modalConfig.title="Choose an outlet"}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}close(){this._dialogRef.close()}onOk(){null!=this.selectedRegister.ID?(this._outletService.pushNewRegister(this.selectedRegister),this._dialogRef.close(this.selectedRegister)):alert("Please select a register first!")}select(e){if(this.AppConfigJSON.ModuleShift.Closure.Enabled)if(null!=this.selectedRegister.ID&&this.selectedRegister.Open&&null==e.CashierID)confirm("You already have an active register with "+this.selectedRegister.Name+"!\nDo you want to end your session?")&&(this.close(),this.router.navigate(["menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}}));else if(e.Open&&this.selectedRegister.ID!=e.ID){if(0==this.role.SellEditor)return void alert("You cannot end shift for Register "+e.Name+" - Unauthorized Access");alert("This Register has already active register, Are you sure you want to end this register?"),this.close(),this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}})}else this.selectedRegister=e;else this.selectedRegister=e}closeRegister(e){0!=this.role.SellEditor?(this.selectedRegister.ID==e.ID?this.router.navigate(["/menu/Shift/Main/My_Shift"]):this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}}),this.close()):alert("You cannot end shift for Register "+e.Name+" - Unauthorized Access")}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(q),t.Y36(C),t.Y36(K),t.Y36(S.F0))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-modal-register"]],decls:12,vars:7,consts:[[3,"config","onOk","onCancel","onClose"],[1,"ms-0","mb-8",2,"width","200px",3,"hidden"],[1,"input-group","mb-3"],[1,"input-group-text","txtFilter"],["aria-hidden","true",1,"fa","fa-search"],["data-cy","SearchOutlet","type","text","placeholder","Filter by Name","aria-label","Search",1,"txtFilter","form-control","border-start-0",3,"ngModel","ngModelChange"],[1,"container"],[1,"row",2,"width","600px"],["class","col-4","data-cy","registers",4,"ngFor","ngForOf"],["data-cy","registers",1,"col-4"],[1,"card","border-0",3,"ngClass"],[1,"card-body","p-0",3,"ngClass"],[1,"card-title","mb-0",3,"ngClass","click"],[1,"fa","fa-info-circle","pe-1"],["class","fa fa-times-circle fa-lg position-absolute","style","text-shadow: 0 1px 0 #afafaf; right: 5px; top: 16px;",3,"click",4,"ngIf"],[1,"card-text","px-0","py-2",3,"ngSwitch","click"],[4,"ngSwitchCase"],[1,"fa","fa-times-circle","fa-lg","position-absolute",2,"text-shadow","0 1px 0 #afafaf","right","5px","top","16px",3,"click"],[1,"idle"],[1,"cashier"],["aria-hidden","true",1,"fa","fa-user","pe-2"],[1,"open"],["aria-hidden","true",1,"fa-regular","fa-clock","pe-2"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return n.onOk()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),t.TgZ(1,"content")(2,"div",1)(3,"div",2)(4,"span",3),t._UZ(5,"i",4),t.qZA(),t.TgZ(6,"input",5),t.NdJ("ngModelChange",function(a){return n.searchInput=a}),t.qZA()()(),t.TgZ(7,"div",6)(8,"div",7),t.YNc(9,tn,12,15,"div",8),t.ALo(10,"FilterByName"),t.qZA()()(),t._UZ(11,"footer"),t.qZA()),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(2),t.Q6J("hidden",n.registers.length<=6),t.xp6(4),t.Q6J("ngModel",n.searchInput),t.xp6(3),t.Q6J("ngForOf",t.xi3(10,4,n.registers,n.searchInput)))},dependencies:[g.mk,g.sg,g.O5,g.RF,g.n9,u.Fj,u.JJ,u.On,y.M,k.OI,k.bs],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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.col-4[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]{width:180px;min-height:95px;margin-right:17px;margin-bottom:17px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]{display:block;outline:0;border:1px solid #B1AAAA;border-radius:5px;cursor:pointer}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{height:30px;border-radius:4px;padding:5px 10px;color:#fff;background:#B1AAAA;overflow:hidden}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover, .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%]{background:#ffffe1;border:1px solid #89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%]{background:#89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{border:1px solid #c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover > h6[_ngcontent-%COMP%]{background:#c9302c!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{background:white}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]{border:1px solid #f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover{border:1px solid #f6a828;background:white}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover > strong[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] div[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.75rem!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{height:80px;padding:15px 10px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;font-weight:400;font-size:.875rem;width:100%;margin-bottom:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:first-child{margin-top:-10px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:last-child{margin-bottom:0}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{text-align:center;position:absolute;bottom:0px;right:0px;width:auto;background-color:#b1aaaa;border-radius:3px;padding:2px 5px;color:#fff;display:none!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.idle[_ngcontent-%COMP%]{display:block;font-size:1.25rem;text-align:center}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{position:absolute;width:27px;height:28px;cursor:pointer;top:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#000}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:last-of-type{right:-5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:nth-last-of-type(2){right:15px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{bottom:20px;right:5px;position:absolute}.col-4[_ngcontent-%COMP%] .duration[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{border:1px solid!important;position:absolute;bottom:-3px;left:58px;background:#fff;border-radius:5px}"]}),o})();var nt=p(83902);let se=(()=>{class o{constructor(e,n){this.dialogRef=e,this.data=n,this.config=new D.O}ngOnInit(){this.config.title="Opening Cash"}onOk(){this.dialogRef.close({amount:this.amount})}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(h.WI))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-opening-cash"]],decls:3,vars:3,consts:[[3,"title","config","onOk","onCancel","onClose"],["data-cy","InputCash","autoNum","",1,"border","w-100","rounded","p-4",3,"ngModel","ngModelChange"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return n.onOk()})("onCancel",function(){return n.dialogRef.close()})("onClose",function(){return n.dialogRef.close()}),t.TgZ(1,"content")(2,"input",1),t.NdJ("ngModelChange",function(a){return n.amount=a}),t.qZA()()()),2&e&&(t.Q6J("title","Opening Cash")("config",n.config),t.xp6(2),t.Q6J("ngModel",n.amount))},dependencies:[u.Fj,u.JJ,u.On,y.M,nt.b]}),o})();var At=p(95018);class en{}var nn=p(39646);let Bt=(()=>{class o{constructor(e,n,i){this._httpService=e,this._onlineStatusService=n,this._localDataService=i,this._onlineStatusService.getOnlineStatus$().subscribe(a=>{this.isOnline=a})}GenerateNumber(e,n){if(this.isOnline)return this._httpService.post(c.Wz.GenerateNumber,{entityID:e,typeID:1});{let i=new en;return c.gT.IsNotEmpty(n.NumberElement)&&(n.NumberElement.Seed+=1),c.gT.IsNotEmpty(n.InvoiceNumberElement)&&(n.InvoiceNumberElement.Seed+=1),i.InvoiceNumberElement=n.InvoiceNumberElement,i.OrderNumberElement=n.NumberElement,i.NewOrderID=c.gT.Guid_NewGuid(),(0,nn.of)(i)}}findRegisterById(e){const n={RegisterID:e};return new Promise(i=>{this._localDataService.isConfigFromServer().subscribe(a=>{a?this._httpService.post(c.Wz.GetRegisterInfo,n).subscribe(s=>{i(s)}):this._localDataService.findRegisterByID(e).subscribe(s=>{i(s)})})})}recordOpeningCash(e){return(0,Ht.n)(this._httpService.post("/API/POS/RecordOpeningCash",e))}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(M.O),t.LFG(x.q),t.LFG(P.T))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})(),q=(()=>{class o{constructor(e,n,i,a,s){this._signalRClientService=e,this._matDialog=n,this._posHttpResponseService=i,this._CoreHttpService=a,this._toastrService=s,this._Data=new H.X(null),this.Data$=this._Data.asObservable().pipe((0,V.h)(l=>null!==l),(0,lt.x)())}get Data(){return this._Data.value}getSalesname(e){let n="";if(this.Data&&this.Data.ListSales){const i=this._Data.value.ListSales.find(a=>a.ID==e);i&&(n=i.Name)}return n}setActiveRegisterFromOptions(e,n){const a=this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled;if(e.length>1){const s=e.find(l=>l.LoginID==n);s?this.pushNewRegister(s):(c.gT.IsEmpty(this.Data?this.Data.RegisterID:null)||a)&&this.openChooseRegisterModal()}1==e.length&&(this.pushNewRegister(e[0]),c.gT.IsEmpty(e[0].LoginID)&&c.gT.IsEmpty(e[0].CashierID)&&this.openOpeningCashModal(e[0].ID)),0==e.length&&this._toastrService.warning("You do not have access to any OUTLET","Warning")}openChooseRegisterModal(){this._matDialog.open(re,{id:"registerModal"}).afterClosed().subscribe(e=>{e&&this.openOpeningCashModal(e.ID)})}openOpeningCashModal(e){const n=this._posHttpResponseService.Data.AppConfigJSON;n.ModuleShift.Closure.Enabled&&n.ModuleShift.Closure.OpeningCashRequired&&this._matDialog.open(se).afterClosed().subscribe(a=>{a&&null!=a.amount&&this._CoreHttpService.recordOpeningCash({RegisterID:e,OpAmount:a.amount})})}pushNewRegister(e){const n=this._Data.value,i=n?n.RegisterID:null;i!=e.ID&&this._CoreHttpService.findRegisterById(e.ID).then(a=>{a.RegisterCode=e.Code,a.DefaultPrintTemplate=a.PrintTemplate,this.pushNewValue(a),this._signalRClientService.SubscribeGroup(a.RegisterID,i)})}getOutletRegister(){const e=this.Data.RegisterID;return this._posHttpResponseService.Data.Registers.find(a=>a.ID==e)}pushNewValue(e){this._Data.next(e)}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(At.G),t.LFG(h.uw),t.LFG(C),t.LFG(Bt),t.LFG(I._W))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();class ot{}var yt=p(11156),on=p(4062),Kt=p(77890),vt=(()=>{return(o=vt||(vt={}))[o.AFTER_DISCOUNT=1]="AFTER_DISCOUNT",o[o.BEFORE_DISCOUNT=2]="BEFORE_DISCOUNT",vt;var o})(),an=p(95521);let L=(()=>{class o{constructor(e,n,i,a){this._orderDataService=e,this._posService=n,this.POSMATH=i,this.decimalPipe=a,this._Data=new H.X(0),this.Data$=this._Data.asObservable().pipe((0,lt.x)()),this.tax=new on.z,this.discountAfterTax=0,this.currencySymbol="Rp",this.AppConfigJSON=new ot,this._orderDataService.Data$.subscribe(s=>{this.salesOrderData=s,c.gT.IsNotEmpty(s.Order.Number)&&(this.calculateDiscountAmount(),this.pushNewValue(this.grandTotal))}),this._posService.Data$.subscribe(s=>{this.AppConfigJSON=s.AppConfigJSON})}get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}get grandTotal(){const e=this.TotalAfterSurcharge;return isNaN(e)?0:e}setDecimalDigit(e){let n=this.decimalPipe.transform(e,"1.0-4");return parseFloat(n.split(",").join(""))}get TotalAfterTax(){let n=this.TotalBeforeTax+this.TaxAmount;return n=this.POSMATH.Round(n,this.AppConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.AppConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm),n}get TotalBeforeTax(){let n=0;return n=this.tax.CalculationTypeID===yt.E.Include?this.DiscountTotal-this.TaxAmount:this.DiscountTotal,n}get TotalAfterSurcharge(){return this.POSMATH.Round(this.TotalAfterTax+this.SurchargeAmount,this.AppConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.AppConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm)}get TotalAfterDiscountTaxable(){return this.GrossTotalTaxable-this.DiscountTotal}get TaxAmount(){if(null!=this.tax){let e=0;const a=this.GrossTotalTaxable;return e=this.tax.CalculationTypeID==yt.E.Include?this.tax.Rate/(100+this.tax.Rate)*a:this.tax.Rate/100*a,e=this.POSMATH.Round(e,this.AppConfigJSON.ApplicationMath.RoundingTaxDigit.DecimalPlaceValue,this.AppConfigJSON.ApplicationMath.RoundingTaxDigit.RoundAlgorithm),e}return 0}get SurchargeAmount(){return this.TotalAfterTax*this.salesOrderData.Invoice.SurchargePcg/100}get Discount1Amount(){return this.GrossTotal*this.salesOrderData.Order.Discount/100}get AfterDiscount1Amount(){return this.GrossTotal-this.Discount1Amount}get Discount2Amount(){return this.AfterDiscount1Amount*this.salesOrderData.Order.Discount2/100}get AfterDiscount2Amount(){return this.AfterDiscount1Amount-this.Discount2Amount}get DiscountTotal(){return this.AfterDiscount2Amount-this.salesOrderData.Order.DiscountAmount}calculateDiscountAmount(){let e=this.salesOrderData.Order.DiscountAmount,n=0;this.AfterDiscount2Amount>=0&&e>0&&e>this.AfterDiscount2Amount&&(n=this.AfterDiscount2Amount),0!==n&&n<=e&&0!==this.GrossTotal&&(e=n),this.salesOrderData.Order.DiscountAmount=e}get GrossTotal(){return this.sum(this.salesOrderData.CartItems,"Total")}get GrossTotalTaxable(){const e=this.salesOrderData.CartItems.filter(i=>i.Taxable);let n=this.sum(e,"Total");if(0!==e.length)if(this.AppConfigJSON.ModuleSell.BaseTaxCalculation===vt.AFTER_DISCOUNT)n=n*(100-this.salesOrderData.Order.Discount)/100,n=n*(100-this.salesOrderData.Order.Discount2)/100,n-=this.salesOrderData.Order.DiscountAmount;else{for(const i of e)i.TotalWithoutDiscount=i.Quantity*i.Price*i.UnitQuantity;n=this.sum(e,"TotalWithoutDiscount")}return n}get GrossTotalNonTaxable(){const e=this.salesOrderData.CartItems.filter(i=>0==i.Taxable);let n=this.sum(e,"Total");if(this.AppConfigJSON.ModuleSell.BaseTaxCalculation===vt.AFTER_DISCOUNT)n=n*(100-this.salesOrderData.Order.Discount)/100,n=n*(100-this.salesOrderData.Order.Discount2)/100,n-=this.salesOrderData.Order.DiscountAmount;else{for(const i of e)i.TotalWithoutDiscount=i.Quantity*i.Price*i.UnitQuantity;n=this.sum(e,"TotalWithoutDiscount")}return n}sum(e,n){let i=e.reduce((a,s)=>a+s[n],0);return i=this.setDecimalDigit(i),i}GetPointOnlyAmount(){const e=this.salesOrderData.CartItems.filter(n=>n.Variant.PaymentTypeID==Kt._.Point);return this.GetAmountByCart(e)}GetCashOnlyAmount(){const e=this.salesOrderData.CartItems.filter(n=>n.Variant.PaymentTypeID==Kt._.Cash);return this.GetAmountByCart(e)}GetCashAndPointAmountCart(){const e=this.salesOrderData.CartItems.filter(n=>n.Variant.PaymentTypeID!=Kt._.Cash);return this.GetAmountByCart(e)}GetAmountByCart(e){let n=this.sum(e,"Total");return n=n*(100-this.salesOrderData.Order.Discount)/100,n=n*(100-this.salesOrderData.Order.Discount2)/100,n}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(v),t.LFG(C),t.LFG(an.l),t.LFG(g.JJ))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})(),rt=(()=>{class o{constructor(e,n,i,a,s,l,d,f){this._orderDataService=e,this._outletService=n,this._invoiceCalculatorService=i,this._dialog=a,this._httpService=s,this._posService=l,this._toastr=d,this.locale=f,this._Data=new H.X([]),this.Data$=this._Data.asObservable(),this.selectedPromotion=null,this.onClickToastPromo=new T.x,this.taxes=[],this.previousQuantity=0,this.previousTotalEligible=0,this.decimalPipe=new g.JJ(f),this._posService.Data$.subscribe(b=>{this.taxes=b.Taxes}),this._outletService.Data$.subscribe(b=>{const O=this.getPromotionDesc(b.Promotion);this.pushNewValue(O)}),this._orderDataService.Data$.pipe((0,V.h)(b=>(this.salesOrderData=b,this.previousQuantity!=b.TotalQuantity))).subscribe(b=>{this.checkEligibleQtyPromotion(b.CartItems),this.checkEligibleTierPromotion(b.CartItems),this.previousQuantity=b.TotalQuantity,this.checkSelectedPromotionRequirement()}),this._invoiceCalculatorService.Data$.subscribe(b=>{this.checkEligibleAmountPromotion(b),this.checkSelectedPromotionRequirement()})}get Data(){return this._Data.getValue()}pushNewValue(e){this.showToastEligiblePromotion(),this._Data.next(e)}checkSelectedPromotionRequirement(){if(null!=this.selectedPromotion&&!1===this.Data.find(n=>n.ID===this.selectedPromotion.ID).Eligible){if(this._dialog.openDialogs.length>0)return;this._dialog.open(le,{id:"modal-promotion-confirm",data:{message:"Order will be restored to before the promotion is applied"},disableClose:!0})}}restoreOrder(){this._orderDataService.pushNewValue(this.orderDataBeforePromotion),this.selectedPromotion=null}getPromotionDesc(e=[]){return e.map(i=>(i.Description=this.generatePromotionDesc(i),i))}checkEligibleAmountPromotion(e){const n=this.Data.filter(a=>a.TypeID===w.Amount&&!this.checkExpiredPromotion(a)).map(a=>(a.Eligible=e>=a.MinimumAmount,a)),i=this.mappingEligiblePromotion(n);this.pushNewValue(i)}checkEligibleQtyPromotion(e){let n=0;const i=this.Data.filter(s=>s.TypeID===w.Quantity&&!this.checkExpiredPromotion(s)).map(s=>(s.Eligible=!1,s.ListVariant.length>0?(n=this.getQuantityByRequirementType(e,"variant",s.ListVariant),n>=s.MinimumAmount&&(s.Eligible=!0)):s.ListCategory.length>0?(n=this.getQuantityByRequirementType(e,"category",s.ListCategory),n>=s.MinimumAmount&&(s.Eligible=!0)):this.salesOrderData.TotalQuantity>=s.MinimumAmount&&(s.Eligible=!0),s)),a=this.mappingEligiblePromotion(i);this.pushNewValue(a)}checkEligibleTierPromotion(e){let n;const i=this.Data.filter(s=>s.TypeID===w.PromotionTiered&&!this.checkExpiredPromotion(s)).map(s=>(s.Eligible=!1,n=s.ListVariant.length>0?this.getQuantityByRequirementType(e,"variant",s.ListVariant):s.ListCategory.length>0?this.getQuantityByRequirementType(e,"category",s.ListCategory):this.salesOrderData.TotalQuantity,s.PromotionTieredQuantity.forEach(l=>{n>=l.Quantity&&(s.Eligible=!0)}),s)),a=this.mappingEligiblePromotion(i);this.pushNewValue(a)}getQuantityByRequirementType(e,n,i){let s,a=0;return e.forEach("variant"==n?l=>{s=i.findIndex(d=>d.ID===l.VariantID),-1!==s&&(a+=l.Quantity)}:l=>{l.Variant&&(s=i.findIndex(d=>d.ID===l.Variant.CategoryID),-1!==s&&(a+=l.Quantity))}),a}mappingEligiblePromotion(e){let n=this.Data;if(e.length>0){let i;n=this.Data.map(a=>(i=e.findIndex(s=>s.ID==a.ID),-1!==i&&(a=e[i]),a))}return n}checkExpiredPromotion(e){const n=new Date,i=new Date(e.StartDate),a=e.StartTime.split(":").map(d=>parseInt(d));i.setHours(a[0],a[1],a[2]);const s=new Date(e.ExpirationDate),l=e.EndTime.split(":").map(d=>parseInt(d));return s.setHours(l[0],l[1],l[2]),!(n.getTime()>=i.getTime()&&n.getTime()<=s.getTime())}showToastEligiblePromotion(){const e=this.getTotalEligiblePromotion();this.previousTotalEligible!==e&&e>0&&this._toastr.info(e+" promotion(s) can be applied!","Promo available!").onTap.pipe((0,Ke.q)(1)).subscribe(()=>{this.onClickToastPromo.next(!0)}),this.previousTotalEligible=e}getTotalEligiblePromotion(){return this.Data.filter(n=>n.Eligible||n.TypeID==w.Discount).length}generatePromotionDesc(e){let n="";switch(e.TypeID){case w.Quantity:n+="Minimum "+this.decimalPipe.transform(e.MinimumAmount)+" ",e.ListVariant.length>0?(n+=" piece of ",n+=this.generateItemListDescription(e.ListVariant)):e.ListCategory.length>0?(n+="from category ",n+=this.generateItemListDescription(e.ListCategory)):n+="items";break;case w.Amount:n+="Minimum spend Rp. "+this.decimalPipe.transform(e.MinimumAmount);break;case w.Discount:n+=`Apply \n ${0!==e.Discount1?"discount1 = "+e.Discount1+"%":""}\n ${0!==e.Discount1&&0!==e.Discount2?" and ":""}\n ${0!==e.Discount2?"discount2 = "+e.Discount2+"%":""}\n `,e.Eligible=!0}return n}generateItemListDescription(e){let n="";for(const i of e)n+=""==n?"":" or ",n+=`[${i.Name}]`;return n=this.slicePromotionDesc(n),n}slicePromotionDesc(e){return e.length>200&&(e=e.slice(0,200),e+="..."),e}applyPromotion(e){switch(this.orderDataBeforePromotion=(0,W.d8)(J.m,this.salesOrderData),this.selectedPromotion=e,e.TypeID){case w.Amount:this.applyProductReward(e);break;case w.Quantity:switch(e.RewardTypeID){case Mt.Product:this.applyProductReward(e);break;case Mt.Cheapest:this.applyCheapestReward(e)}break;case w.Discount:this.applyDiscountReward(e);break;case w.Product:break;case w.PromotionTiered:this.applyTierReward(e)}}applyProductReward(e){(0,Ht.n)(this._httpService.post(c.Wz.GetRewardByPromotionID,{PromotionID:e.ID})).then(n=>{this.openDialogSelectReward(n)})}openDialogSelectReward(e){this._dialog.open(Be,{data:e.Rewards})}applyCheapestReward(e){let n=this.salesOrderData.CartItems;if(n.length>0){const a=n.sort((l,d)=>l.Price-d.Price)[0];let s=a.Total;a.Quantity>1&&(s=a.Total/a.Quantity),a.DiscountAmount=s,a.Note=e.Name,n=n.map(l=>(l.VariantID==a.VariantID&&((l=a).PromotionGift=!0),l)),this.salesOrderData.CartItems=n,this._orderDataService.pushNewValue(this.salesOrderData),this.showToastAppliedPromo(this.selectedPromotion)}}applyDiscountReward(e){let i=this._posService.Data.AppConfigJSON.ModuleSell.ProductNotes.CopyPromotionName;if(this.salesOrderData.Order.Discount+=e.Discount1,this.salesOrderData.Order.Discount2+=e.Discount2,1==i&&(this.salesOrderData.Order.Note=e.Name),c.gT.IsNotEmpty(e.TaxTypeID)){const a=this.taxes.find(s=>s.ID==e.TaxTypeID);this._invoiceCalculatorService.tax=a,this.salesOrderData.Order.TaxTypeID=e.TaxTypeID}this._orderDataService.pushNewValue(this.salesOrderData),this.pushNewValue(this.Data),this.showToastAppliedPromo(this.selectedPromotion)}applyTierReward(e){let n=this.salesOrderData.CartItems,i=[];i=n.filter(e.ListVariant.length>0?a=>-1!==e.ListVariant.findIndex(s=>s.ID==a.VariantID):a=>-1!==e.ListCategory.findIndex(s=>s.ID==a.Variant.CategoryID)),n=0==i.length?this.tierPromotionBlankRequirement(e):this.tierPromotionWithRequirement(e,i),this.salesOrderData.CartItems=n,this._orderDataService.pushNewValue(this.salesOrderData)}tierPromotionBlankRequirement(e){let n=this.salesOrderData.CartItems;const i=this.salesOrderData.TotalQuantity;return e.PromotionTieredQuantity.sort((a,s)=>a.Quantity-s.Quantity).forEach(a=>{i>=a.Quantity&&(n=n.map(s=>(s.Discount=a.Discount,this.copyPromotionNameToItem(e,s))))}),n}tierPromotionWithRequirement(e,n){let s,i=0,a=this.salesOrderData.CartItems;return n.forEach(l=>{i+=l.Quantity}),e.PromotionTieredQuantity.sort((l,d)=>l.Quantity-d.Quantity).forEach(l=>{i>=l.Quantity&&(n=n.map(d=>(d.Discount=l.Discount,d)))}),a=a.map(l=>(s=n.find(d=>d==l),s&&(l=this.copyPromotionNameToItem(e,l=s)),l)),a}copyPromotionNameToItem(e,n){return 1==this._posService.Data.AppConfigJSON.ModuleSell.ProductNotes.CopyPromotionName&&(n.Note=e.Name),n}removePromotion(){this._orderDataService.pushNewValue(this.orderDataBeforePromotion),this.showToastRemovePromo(this.selectedPromotion),this.selectedPromotion=null}showToastAppliedPromo(e){this._toastr.success("Applied "+e.Name+" to order!","Applied successfully!")}showToastRemovePromo(e){this._toastr.info("Removed "+e.Name+" from order!","Removed successfully!")}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(v),t.LFG(q),t.LFG(L),t.LFG(h.uw),t.LFG(M.O),t.LFG(C),t.LFG(I._W),t.LFG(t.soG))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})(),le=(()=>{class o{constructor(e,n,i){this._promotionEventService=e,this._dialogRef=n,this.data=i,this.modalConfig=new D.O,this.modalConfig.hideCancel=!0,this.modalConfig.hideClose=!0,this.modalConfig.headerType=U.n.Warning,this.modalConfig.title="Promotion Requirement unfulfilled!",this.modalConfig.customWidth="350px",this.modalConfig.okText="Ok",this.selectedPromotion=e.selectedPromotion}onOk(){this._promotionEventService.restoreOrder(),this._dialogRef.close()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(rt),t.Y36(h.so),t.Y36(h.WI))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-promotion-confirm"]],decls:9,vars:4,consts:[[3,"config","onOk"],[1,"fst-italic","text-danger","mb-3"],[1,"mb-0"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return n.onOk()}),t.TgZ(1,"content")(2,"div")(3,"h5"),t._uU(4),t.qZA(),t.TgZ(5,"p",1),t._uU(6),t.qZA(),t.TgZ(7,"p",2),t._uU(8),t.qZA()()()()),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(4),t.Oqu(null==n.selectedPromotion?null:n.selectedPromotion.Name),t.xp6(2),t.Oqu(null==n.selectedPromotion?null:n.selectedPromotion.Description),t.xp6(2),t.Oqu(null==n.data?null:n.data.message))},dependencies:[y.M]}),o})();var wt=p(59660);class Nt{}class rn{}class sn{}class ln{}class cn{}class F{constructor(r,e,n,i){this.Amount=r,this.CurrencySymbol=e,this.Label=n,this.Type=i}}let $t=(()=>{class o{constructor(e,n,i,a){this._invoiceCalculatorService=e,this._decimalPipe=n,this._poshttpResponseService=i,this._orderService=a,this.appConfig=new ot,this._poshttpResponseService.Data$.subscribe(s=>{this.appConfig=s.AppConfigJSON})}generateAmountSummary(){let e=[];return this.generateAmount(e),this.generateDiscountSummary(e),this.generateSubTotal(e),this.generateTaxSummary(e),this.generateSurchargeSummary(e),e}generateAmount(e){e.push(new F(this._invoiceCalculatorService.GrossTotal,this._invoiceCalculatorService.currencySymbol,"Amount",1))}generateDiscountSummary(e){if(0!=this._invoiceCalculatorService.Discount1Amount){const n=this._decimalPipe.transform(this._orderService.Data.Order.Discount),a=this.checkDiscountIgnoreDecimal(n)?"{0}":"{0} ({1}%)";e.push(new F(-1*this._invoiceCalculatorService.Discount1Amount,this._invoiceCalculatorService.currencySymbol,c.gT.StringFormat(a,this.appConfig.CorePrint.Alias.Discount1,n),1))}if(0!=this._invoiceCalculatorService.Discount2Amount){const n=this._decimalPipe.transform(this._orderService.Data.Order.Discount2),a=this.checkDiscountIgnoreDecimal(n)?"{0}":"{0} ({1}%)";e.push(new F(-1*this._invoiceCalculatorService.Discount2Amount,this._invoiceCalculatorService.currencySymbol,c.gT.StringFormat(a,this.appConfig.CorePrint.Alias.Discount2,n),1))}0!=this._orderService.Data.Order.DiscountAmount&&this.appConfig.PrintConfigInvoice.ItemsFooter.DiscountAmountVisible&&e.push(new F(-1*this._orderService.Data.Order.DiscountAmount,this._invoiceCalculatorService.currencySymbol,"Discount ("+this._invoiceCalculatorService.currencySymbol+")",1))}generateSubTotal(e){const n=this._invoiceCalculatorService.tax,i=0!==n.Rate&&1==n.PrintVisible;if(this.isDiscounted()&&!this.isTaxReserveSequence()){let a="Sub Total",s=this._invoiceCalculatorService.DiscountTotal;i||(s=this._invoiceCalculatorService.TotalAfterTax,a="Total"),e.push(new F(s,this._invoiceCalculatorService.currencySymbol,a,1))}}generateTaxSummary(e){const n=this._invoiceCalculatorService.tax;if(!n.PrintVisible||0==n.Rate)return;const i=this.appConfig.PrintConfigInvoice.Footer.TaxDetailVisible?2:1;e.push(new F(this._invoiceCalculatorService.TaxAmount,this._invoiceCalculatorService.currencySymbol,n.Label,i)),this.appConfig.PrintConfigInvoice.Footer.TaxDetailVisible&&(e.push(new F(this._invoiceCalculatorService.GrossTotalTaxable,this._invoiceCalculatorService.currencySymbol,this.appConfig.PrintConfigInvoice.Footer.TaxableSales,i)),this.appConfig.PrintConfigInvoice.Footer.LabelWithZeroAmount&&e.push(new F(0,this._invoiceCalculatorService.currencySymbol,this.appConfig.PrintConfigInvoice.Footer.LabelWithZeroAmount,i)),e.push(new F(this._invoiceCalculatorService.GrossTotalNonTaxable,this._invoiceCalculatorService.currencySymbol,this.appConfig.PrintConfigInvoice.Footer.TaxExemptSales,i)),this.appConfig.PrintConfigInvoice.Footer.LabelWithZeroAmount&&e.push(new F(0,this._invoiceCalculatorService.currencySymbol,this.appConfig.PrintConfigInvoice.Footer.LabelWithZeroAmount,i)));const a=n.CalculationTypeID===yt.E.Include,s=!this.isTaxReserveSequence()&&a;e.push(new F(s?this._invoiceCalculatorService.TotalBeforeTax:this._invoiceCalculatorService.TotalAfterTax,this._invoiceCalculatorService.currencySymbol,s?"Before Tax":"Total Amount",i))}generateSurchargeSummary(e){if(0==this._invoiceCalculatorService.SurchargeAmount)return;const n=this.appConfig.CorePrint;e.push(new F(this._invoiceCalculatorService.SurchargeAmount,this._invoiceCalculatorService.currencySymbol,c.gT.StringFormat("{0} ({1}%)",n&&n.Alias.SurchargePcg?n.Alias.SurchargePcg:"Surcharge",this._decimalPipe.transform(this._orderService.Data?.Invoice.SurchargePcg)),1)),this.generateGrandTotal(e)}generateGrandTotal(e){e.push(new F(this._invoiceCalculatorService.Data,this._invoiceCalculatorService.currencySymbol,"Total Amount",1))}checkDiscountIgnoreDecimal(e){const i=this.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal;let s=!1;return 0!=parseFloat(e)%1&&i&&(s=!0),s}isDiscounted(){let a=!1;return(0!=this._invoiceCalculatorService.Discount1Amount||0!=this._invoiceCalculatorService.Discount2Amount||0!=this._orderService.Data.Order.DiscountAmount)&&(a=!0),a}isTaxReserveSequence(){let e=this._invoiceCalculatorService.tax;const n=!!e;return n&&(n?e.CalculationTypeID:null)===yt.E.Include&&this.appConfig.PrintConfigInvoice.Footer.TaxIncludeBeforeTotalAmount}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(L),t.LFG(g.JJ),t.LFG(C),t.LFG(v))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})(),dt=(()=>{class o{constructor(e,n,i,a,s,l,d){this.localdata=e,this._receiptCalculatorService=n,this._salesOrderDataModelService=i,this._outletService=a,this._cashierCalculatorService=s,this._signal=l,this._customerHttpService=d,this._salesOrderDataModelService.Data$.subscribe(f=>{f.Order.Number&&(this.orderDataModel=f,this.BroadcastCartToCustomerDisplay())})}ConstructCartModelForCustomerDisplay(){const e=this._customerHttpService.Data,n=new cn;n.Number=this.orderDataModel.Order.Number,n.Items=Array();for(const i of this.orderDataModel.CartItems){const a=new ln;a.Name=i.Variant.Name,a.Discount=i.Discount,a.DiscountAmount=i.DiscountAmount,a.Price=i.Price,a.Quantity=i.Quantity,a.UnitQuantity=i.UnitQuantity,n.Items.push(a)}return n.SalesName=c.gT.IsNotEmpty(this.orderDataModel.Order.SalesID)?this._outletService.getSalesname(this.orderDataModel.Order.SalesID):"",c.gT.IsNotEmpty(this.orderDataModel.Order.CustomerID)&&c.gT.IsNotEmpty(e)&&(n.Customer=new wt.B,n.Customer.Email=e.Email,n.Customer.Mobile=e.Mobile,n.Customer.Name=this.orderDataModel.ContactName),n.CurrencySymbol=this._cashierCalculatorService.currencySymbol,n.FinalAmount=this._cashierCalculatorService.Data,n.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),n}BroadcastCartToCustomerDisplay(){if(this._outletService.Data){const e=this.ConstructCartModelForCustomerDisplay(),n=new Nt;n.GroupID=this._outletService.Data.RegisterID+"_Subscriber",n.Method="POSCartAmountUpdated",n.Data=e,this.localdata.isStoreOrderInServer().subscribe(i=>{i&&this._signal.Broadcast(n)})}}BroadcastStateToCustomerDisplay(e,n="",i="",a=0){const s=new rn;s.Status=e,s.InvoiceID=n,s.LoyaltyPoint=i,s.diff=a;const l=new Nt;l.GroupID=this._outletService.Data.RegisterID+"_Subscriber",l.Method="POSStateUpdated",l.Data=s,this.localdata.isStoreOrderInServer().subscribe(d=>{d&&this._signal.Broadcast(l)})}BroadcastQRToCustomerDisplay(e){const n=new sn;n.GopayQr=e;const i=new Nt;i.GroupID=this._outletService.Data.RegisterID+"_Subscriber",i.Method="POSQRPaymentActivated",i.Data=n,this.localdata.isStoreOrderInServer().subscribe(a=>{a&&this._signal.Broadcast(i)})}BroadcastChangeToKitchenDisplay(){const e=new Nt;e.GroupID=this._outletService.Data.EntityID+"_Subscriber",e.Method="ReceiveKitchenDisplayMessage",e.Data={changes:!0},this.localdata.isStoreOrderInServer().subscribe(n=>{n&&this._signal.Broadcast(e)})}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(P.T),t.LFG($t),t.LFG(v),t.LFG(q),t.LFG(L),t.LFG(At.G),t.LFG(tt.r))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();var dn=p(32076),pn=p(62843),ce=p(32880),gn=p(18505),Ot=p(23389);class de{}let zt=(()=>{class o{constructor(e){this.httpService=e}VerifyPayment(e){return this.httpService.post(c.Wz.VerifyPayment,e)}generateLink(e){return this.httpService.post(c.Wz.GenerateLink,e)}generateQRCode(e,n){return this.httpService.post(e,n)}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(M.O))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})(),Zt=(()=>{class o{constructor(e,n,i,a,s){this._posHubService=e,this._orderDataService=n,this._PaymentHttpService=i,this._InvoicecashierCalculatorService=a,this._toastrService=s}onQRPaymentComplete(e,n){return new Promise((i,a)=>{if(e.transaction_id!==this.transactionId)return void a({header:"Invalid QR Payment",message:`transaction_id: ${e.transaction_id} / gross_amount: ${e.gross_amount}`});if(e.gross_amount!==this._InvoicecashierCalculatorService.Data)return void a({header:"Invalid QR Payment",message:`paid_amount: ${e.gross_amount} vs invoice_amount: ${this._InvoicecashierCalculatorService.Data}`});const s=this._orderDataService.Data.Order.Number;0!=e.order_id.includes(s)?"settlement"===e.transaction_status?this.validateEMoneyPayment(n).subscribe(l=>{i(l)}):a({header:"Invalid QR Payment",message:`Transaction status is ${e.transaction_status}`}):a({header:"Invalid QR Payment",message:`Order ID: ${e.order_id} vs Order Number: ${s}`})})}generateNewPayment(e,n){const i=this._orderDataService.Data;c.gT.IsEmpty(this.qrPaymentMethodID)&&alert("QR PaymentMethod.ID is not available!");const a=new Ot.j;return a.PaidAmount=n,a.Amount=n,a.Date=i.Order.Date,a.MethodID=this.qrPaymentMethodID,a.Code=e,c.gT.IsEmpty(e)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure"),a}sendStateCompleteToCustomerDisplay(e){this._posHubService.BroadcastStateToCustomerDisplay(_.IsComplete,e.ObjectID,e.LoyaltyPoint,0)}generateQR(e,n){this.qrPaymentMethodID=n.ID;const i=this.getServiceUrl(n.EMoneyTypeID);return this._PaymentHttpService.generateQRCode(i,e).pipe((0,Gt.U)(l=>(this.transactionId=l.Transaction_id,this._orderDataService.transaction_id=l.Transaction_id,this.sendQRToCustomerDisplay(l.Url),l)))}sendQRToCustomerDisplay(e){this._posHubService.BroadcastQRToCustomerDisplay(e)}validateEMoneyPayment(e){if(c.gT.IsNotEmpty(this.transactionId)){const n=this._InvoicecashierCalculatorService.Data,i=this.generatePaymentVerificationData(n);return this._PaymentHttpService.VerifyPayment(i).pipe((0,j.w)(a=>(this.updatePosDataForSubmission(n),(0,dn.D)(this._orderDataService.submitOrder(e)).pipe((0,gn.b)(s=>{this.sendStateCompleteToCustomerDisplay(s)})))))}{let n=new Error("Transaction ID is Empty");throw(0,pn._)(()=>n)}}generatePaymentVerificationData(e){const n=this._orderDataService.Data,i=new de;return i.RegisterID=n.Order.RegisterID,i.Number=n.Order.Number,i.Amount=e,i.TransactionID=this.transactionId,i}updatePosDataForSubmission(e){const n=this._orderDataService.Data,i=this.generateNewPayment(this.transactionId,e),a=[];a.push(i),n.Invoice.Due=null,n.Action.Type=ft.q.Payment,n.Order.InvoicedStateID=ct.Complete,n.Payments=a,this._orderDataService.pushNewValue(n)}getServiceUrl(e){let n;switch(e){case ce.m.Gopay:n=c.Wz.GenerateGopayQrCode;break;case ce.m.EmpatKali:n=c.Wz.GenerateEmpatKaliQrCode}return n}clearTransactionID(){this.transactionId=null,this._orderDataService.transaction_id=null}getTransactionId(){return this.transactionId}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(dt),t.LFG(v),t.LFG(zt),t.LFG(L),t.LFG(I._W))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})(),Z=(()=>{class o{constructor(e,n,i,a,s,l,d,f,b,O,R,Q,z){this._orderDataService=e,this._posHttpResponseService=n,this._CoreHttpService=i,this._outletService=a,this._orderHttpService=s,this._signal=l,this._promotionEventService=d,this._customerHttpService=f,this._posHubService=b,this._invoiceCalculatorService=O,this._dialog=R,this._toastr=Q,this._paymentGatewayService=z,this._Data=new H.X(new Tt),this.Data$=this._Data.asObservable(),this.posData=new J.m,this.activeRegister=new kt,this.subscribeObservableChanges(),this._signal.OnContactReceive.subscribe(it=>{if(!c.gT.IsEmpty(it)){const ht=JSON.parse(it);this._orderDataService.updateCustomerID(ht.ID).then(Dt=>{this.posData.ContactName=ht.Name,this._customerHttpService.Data=Dt,this.pushNewValue(this.Data)})}})}get Data(){return this._Data.value}subscribeObservableChanges(){this._orderDataService.Data$.subscribe(e=>{this.posData=e}),this._outletService.Data$.subscribe(e=>{this.activeRegister=e,this.Data.posState!=_.IsEdit&&this.createNewSalesOrderDataModel()})}pushNewValue(e){this._Data.next(e)}createNewTransactionInSameOutletRegister(e=!0){e?this._CoreHttpService.GenerateNumber(this._orderDataService.Data.Order.EntityID,this.activeRegister).subscribe(i=>{this.activeRegister.NumberElement=i.OrderNumberElement,this.activeRegister.InvoiceNumberElement=i.InvoiceNumberElement,this.activeRegister.NewOrderID=i.NewOrderID,this.pushNewValue(new Tt),this.createNewSalesOrderDataModel()}):(this.pushNewValue(new Tt),this.createNewSalesOrderDataModel())}updatePosState(e,n){n&&this._orderHttpService.pushNewValue(n),this.Data.posState=e,this.pushNewValue(this.Data)}ReturnOrder(e){e&&(this.posData.CartItems=(0,W.yE)(G.t,e.CartItems),this.posData.CartItems=this.posData.CartItems.map(n=>(n.generateSerial(n.Variant),n.Quantity=-1*n.Quantity,n.DiscountAmount=-1*n.DiscountAmount,n)),this.posData.Order.Note="Return "+e.Order.Number,this.posData.Order.Discount=e.Order.Discount,this.posData.Order.Discount2=e.Order.Discount2,this.posData.Order.DiscountAmount=-1*e.Order.DiscountAmount,this.posData.Order.TaxTypeID=e.Order.TaxTypeID,this.posData.Order.SalesID=e.Order.SalesID,this.posData.Order.CustomerID=e.Order.CustomerID,this.posData.ContactName=e.ContactName,this._orderDataService.pushNewValue(this.posData))}plainToClass(e,n){this.posData=(0,W.d8)(J.m,e),this.setSerialItems(),this.assignInvoice(e),this.assignCustomerData(e),this.initSelectedRegister(e,n),this.assignParkTemporaryItem(e),n==_.IsRetrieve&&(this.posData.Order.Date=(new Date).toJSON(),this.posData.Action.DeliveryEntityID=this.getDeliveryEntityID(this.activeRegister)),this._invoiceCalculatorService.tax=this.getTaxObjectByID(this.posData.Order.TaxTypeID),this._orderDataService.pushNewValue(this.posData)}assignInvoice(e){if(e.Invoice)this.posData.Invoice=e.Invoice,this.posData.Action.Type=ft.q.Payment;else{const n=this._posHttpResponseService.Data.AppConfigJSON,i=this.activeRegister;this.posData.Invoice=new Le.m,n.ModuleSell.Numbering.SalesOrderNumberVisible&&(this.posData.Invoice.Number=Ct.V.Generate(i.InvoiceNumberElement))}}assignCustomerData(e){const n=e.Order.CustomerID,i=e.Order.EntityID;c.gT.IsNotEmpty(n)&&c.gT.IsNotEmpty(i)?(0,Ht.n)(this._customerHttpService.GetPrivilegeByID(n,i)).then(a=>{const l=this._posHttpResponseService.Data.AppConfigJSON.ApplicationLoyalty.Label;this._customerHttpService.Data=a,this._customerHttpService.Data.Label=l,this.pushNewValue(this.Data)}):this.Data.InputTextValue=null}initSelectedRegister(e,n){if(n!==_.IsRetrieve){const i=this._posHttpResponseService.Data.Registers;0!=i.length?this.checkAccessOutletUser(e,i):this._toastr.warning("You do not have access to edit in this outlet","Warning")}else{const i=this.activeRegister.RegisterID;i!==e.Order.RegisterID&&(this.posData.Order.RegisterID=i,this._toastr.warning("You are processing order from different Register","Different Register"))}}checkAccessOutletUser(e,n){const i=e.Order.RegisterID,a=n.find(s=>s.ID==i);a?this._outletService.pushNewRegister(a):this._toastr.warning("You do not have access to edit in this outlet","Warning")}setSerialItems(){this.posData.CartItems=this.posData.CartItems.map(e=>(e.generateSerial(e.Variant),e))}assignParkTemporaryItem(e){this.Data.parkTemporaryItem=(0,W.d8)(G.t,e.CartItems),this.pushNewValue(this.Data)}getDefaultOrderType(e){if(c.gT.IsNotEmpty(e.DefaultCustomerPOType))return e.DefaultCustomerPOType;{let n=this._posHttpResponseService.Data.PoTypes;return n.length>0?n[0].ID:null}}createNewSalesOrderDataModel(){const e=this._posHttpResponseService.Data.AppConfigJSON;this._promotionEventService.selectedPromotion=null,this._paymentGatewayService.clearTransactionID(),this._invoiceCalculatorService.discountAfterTax=0,this._customerHttpService.Data=new wt.B;const n=this._posHttpResponseService.Data,i=this.activeRegister,a=new J.m;!c.gT.IsEmpty(n.SalesID)&&null!=i.ListSales&&i.ListSales.find(d=>d.ID==n.SalesID)&&(a.Order.SalesID=n.SalesID),a.Order.Number=Ct.V.Generate(i.NumberElement),a.Action.NewOrderID=i.NewOrderID,e.ModuleSell.Numbering.SalesOrderNumberVisible&&(a.Invoice.Number=Ct.V.Generate(i.InvoiceNumberElement)),a.Order.CurrencyID=n.AppConfigJSON.CoreDefaults.CurrencyID;const s=this.findCurrencyById(a.Order.CurrencyID);this._invoiceCalculatorService.currencySymbol=s.Symbol,a.Order.CurrencyRate=s.ExchangeRate,c.gT.IsNotEmpty(i.DefaultTaxType)?(a.Order.TaxTypeID=i.DefaultTaxType,this._invoiceCalculatorService.tax=this.getTaxObjectByID(i.DefaultTaxType)):(a.Order.TaxTypeID=n.Taxes[0].ID,this._invoiceCalculatorService.tax=n.Taxes[0]),this._posHttpResponseService.Data.AppConfigJSON.ModuleSell.RememberOrderTypeFromPreviousTransaction?c.gT.IsEmpty(this._orderHttpService.Data)?(a.Order.TypeID=this.getDefaultOrderType(i),this.setPrintTemplateToDefault()):a.Order.TypeID=this.posData.Order.TypeID:(a.Order.TypeID=this.getDefaultOrderType(i),this.setPrintTemplateToDefault()),c.gT.IsNotEmpty(i.EntityID)&&(a.Order.EntityID=i.EntityID,a.Order.RegisterID=i.RegisterID),a.Order.CouponType=e.TadaCouponVisible?B.$.Tada:B.$.DealPOS,a.Action.DeliveryEntityID=this.getDeliveryEntityID(i),this.Data.posState=_.IsNew,this._orderDataService.pushNewValue(a)}setPrintTemplateToDefault(){this.activeRegister.PrintTemplate=this.activeRegister.DefaultPrintTemplate,this._outletService.pushNewValue(this.activeRegister)}findCurrencyById(e=1){return this._posHttpResponseService.Data.Currencies.find(a=>a.ID==e)}getTaxObjectByID(e){return this._posHttpResponseService.Data.Taxes.find(i=>i.ID==e)}getDeliveryEntityID(e){return this._posHttpResponseService.Data.AppConfigJSON.ModuleSell.Shipping.DefaultOrderDelivery==It.NOW?c.gT.IsEmpty(e.DefaultWarehouse)?e.EntityID:e.DefaultWarehouse:c.gT.GuidEmpty}submitParkToServer(e){if(this._promotionEventService.selectedPromotion)return void this.clearPromotionAppliedInPark();const n=this._posHttpResponseService.Data.AppConfigJSON;return this.posData.Action.DeliveryEntityID=c.gT.GuidEmpty,this.posData.Action.Type=ft.q.Park,null!=e.ParkLabel&&(this.posData.Order.ParkLabel=e.ParkLabel),this.posData.Order.Note=e.Note,this.posData.Order.Deposit=e.Deposit,this.posData.Order.InvoicedStateID=ct.Pending,this.posData.Order.DepositPaymentMethodID=e.DepositPaymentMethodID,c.gT.IsNotEmpty(e.ID)&&(this.posData.Order.ID=e.ID),this._orderDataService.pushNewValue(this.posData),new Promise((i,a)=>{this._orderDataService.submitOrder(n).then(s=>{i(s),this._posHubService.BroadcastChangeToKitchenDisplay(),this.updatePosState(_.isPark,s),this.createNewTransactionInSameOutletRegister()}).catch(s=>{a(s)})})}reedemPointToDiscount(e=!1){const n=this._posHttpResponseService.Data.AppConfigJSON,a=this._customerHttpService.Data,s=this.Data.posState==_.IsEdit;if(n.ApplicationLoyalty.Rules.PrefferedPayment){if(c.gT.IsNotEmpty(this.posData.Order.CustomerID)&&!s){const l=n.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,d=a.Point?a.Point:0,f=this._invoiceCalculatorService.GetCashAndPointAmountCart();let b=d*l,O=d;b>f&&(b=f),O=Math.ceil(b/l),a.PointUsed=O,this.posData.Order.PointUsed=O,this.posData.Order.DiscountAmount=b}else e&&(a.PointUsed=0,this.posData.Order.PointUsed=0,this.posData.Order.DiscountAmount=0);this._orderDataService.pushNewValue()}}clearPromotionAppliedInPark(){this._dialog.open(le,{id:"modal-promotion-confirm",data:{message:"\n Promotion cannot be applied when Park, \n Order will be restored to before the promotion is applied\n "},disableClose:!0})}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(v),t.LFG(C),t.LFG(Bt),t.LFG(q),t.LFG(N.D),t.LFG(At.G),t.LFG(rt),t.LFG(tt.r),t.LFG(dt),t.LFG(L),t.LFG(h.uw),t.LFG(I._W),t.LFG(Zt))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();var jt=p(25873),pt=p(90811);function un(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",6)(1,"mat-button-toggle-group",9),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.modeCouponType=i)})("change",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.changeCoupon())}),t.TgZ(2,"mat-button-toggle",10)(3,"large",11),t._uU(4,"TADA"),t.qZA()(),t.TgZ(5,"mat-button-toggle",10)(6,"large",11),t._uU(7,"DealPOS"),t.qZA()()()()}if(2&o){const e=t.oxw();t.xp6(1),t.Q6J("ngModel",e.modeCouponType),t.xp6(1),t.Q6J("value",!0),t.xp6(3),t.Q6J("value",!1)}}let mn=(()=>{class o{constructor(e,n,i,a){this.promotionService=e,this._orderDataService=n,this._posService=i,this.dialogRef=a,this.modalConfig=new D.O,this.destroy$=new T.x,this.modeType=!1,this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash",this.modalConfig.title="Promotion Coupon",this.modalConfig.customWidth="284px",this.modeCouponType=!1,this.TadaVisible=i.Data.AppConfigJSON.TadaCouponVisible,this.subscribeToObservable(),this.initCouponType()}subscribeToObservable(){this._orderDataService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.AuthorizationKey=e.Order.AuthorizationKey,this.AuthorizationNote=e.Order.AuthorizationNote,this.couponType=e.Order.CouponType,this.ChangeTypeCoupon(),this.CustomerID=e.Order.CustomerID})}initCouponType(){this.TadaVisible&&c.gT.IsEmpty(this.AuthorizationKey)&&(this.modeCouponType=!0,this.couponType=B.$.Tada)}ChangeTypeCoupon(){null==this.couponType&&(this.couponType=B.$.DealPOS,this.modeCouponType=!1),this.couponType==B.$.Tada&&(this.modeCouponType=!0),this.couponType==B.$.DealPOS&&(this.modeCouponType=!1)}changeCoupon(){this.couponType=this.modeCouponType?B.$.Tada:B.$.DealPOS}showPassword(){this.modeType?(this.typeText="text",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye"):(this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash")}onOk(){this.TadaVisible&&this.couponType==B.$.Tada&&c.gT.IsEmpty(this.CustomerID)?alert("Please enter your customer"):(this.promotionService.RedeemCoupon(this.AuthorizationKey,this.AuthorizationNote,this.couponType),this.dialogRef.close())}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(ie),t.Y36(v),t.Y36(C),t.Y36(h.so))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-modal-coupon-code"]],decls:12,vars:9,consts:[[3,"title","config","onOk","onCancel","onClose"],["class","form-floating-outline",4,"ngIf"],[1,"form-floating-outline","mb-0"],["data-cy","CouponInput","id","cpn","name","AuthorizationKey",1,"form-control",3,"type","ngModel","ngModelChange"],[3,"click"],["for","cpn"],[1,"form-floating-outline"],["name","note","id","note","data-cy","CouponNote","name","AuthorizationNote",1,"form-control",3,"ngModel","ngModelChange"],["for","note"],["name","fontStyle","aria-label","Font Style",3,"ngModel","ngModelChange","change"],[3,"value"],[1,"fw-bold"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return n.onOk()})("onCancel",function(){return n.dialogRef.close()})("onClose",function(){return n.dialogRef.close()}),t.TgZ(1,"content"),t.YNc(2,un,8,3,"div",1),t.TgZ(3,"div",2)(4,"input",3),t.NdJ("ngModelChange",function(a){return n.AuthorizationKey=a}),t.qZA(),t.TgZ(5,"i",4),t.NdJ("click",function(){return n.modeType=!n.modeType,n.showPassword()}),t.qZA(),t.TgZ(6,"label",5),t._uU(7,"Coupon"),t.qZA()(),t.TgZ(8,"div",6)(9,"textarea",7),t.NdJ("ngModelChange",function(a){return n.AuthorizationNote=a}),t.qZA(),t.TgZ(10,"label",8),t._uU(11,"Note"),t.qZA()()()()),2&e&&(t.Q6J("title","Promotion Coupon")("config",n.modalConfig),t.xp6(2),t.Q6J("ngIf",n.TadaVisible),t.xp6(2),t.Q6J("type",n.typeText)("ngModel",n.AuthorizationKey),t.xp6(1),t.Tol(n.typeIcon),t.xp6(4),t.Q6J("ngModel",n.AuthorizationNote))},dependencies:[g.O5,y.M,u.Fj,u.JJ,u.On,pt.A9,pt.Yi],styles:[".passwordIcon[_ngcontent-%COMP%]{position:relative;margin:0 auto!important;cursor:pointer;left:13.5rem;top:-2.3rem;z-index:999}.mat-button-toggle-checked[_ngcontent-%COMP%]{background-color:#dfeffc;color:#0976b4}"]}),o})();function _n(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",13)(1,"div",14)(2,"div",15),t._uU(3,"Orders"),t.qZA(),t.TgZ(4,"div",15)(5,"input",16),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.offlineConfig.orderUsingLocal=i)}),t.qZA(),t.TgZ(6,"label",17),t._uU(7,"Online"),t.qZA()(),t.TgZ(8,"div",15)(9,"input",16),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.offlineConfig.orderUsingLocal=i)}),t.qZA(),t.TgZ(10,"label",17),t._uU(11,"Offline"),t.qZA()()(),t.TgZ(12,"div",14)(13,"div",15),t._uU(14,"Products"),t.qZA(),t.TgZ(15,"div",15)(16,"input",18),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.offlineConfig.productUsingLocal=i)}),t.qZA(),t.TgZ(17,"label",17),t._uU(18,"Online"),t.qZA()(),t.TgZ(19,"div",15)(20,"input",18),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.offlineConfig.productUsingLocal=i)}),t.qZA(),t.TgZ(21,"label",17),t._uU(22,"Offline"),t.qZA()()(),t.TgZ(23,"div",14)(24,"div",15),t._uU(25,"Start Config"),t.qZA(),t.TgZ(26,"div",15)(27,"input",19),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.offlineConfig.configUsingLocal=i)}),t.qZA(),t.TgZ(28,"label",17),t._uU(29,"Online"),t.qZA()(),t.TgZ(30,"div",15)(31,"input",19),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.offlineConfig.configUsingLocal=i)}),t.qZA(),t.TgZ(32,"label",17),t._uU(33,"Offline"),t.qZA()()()()}if(2&o){const e=t.oxw();t.xp6(5),t.Q6J("ngModel",e.offlineConfig.orderUsingLocal)("value",!1),t.xp6(4),t.Q6J("ngModel",e.offlineConfig.orderUsingLocal)("value",!0),t.xp6(7),t.Q6J("ngModel",e.offlineConfig.productUsingLocal)("value",!1),t.xp6(4),t.Q6J("ngModel",e.offlineConfig.productUsingLocal)("value",!0),t.xp6(7),t.Q6J("ngModel",e.offlineConfig.configUsingLocal)("value",!1),t.xp6(4),t.Q6J("ngModel",e.offlineConfig.configUsingLocal)("value",!0)}}let hn=(()=>{class o{constructor(e,n,i){this._onlineStatusService=e,this.dialogRef=n,this.indexDbService=i,this.modalConfig=new D.O,this.modalConfig.title="Working Status",this.destroy$=new T.x,this.modalConfig.showMoreButton=!0}ngOnInit(){this._onlineStatusService.offlineConfig$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.offlineConfig=e})}updateOnlineStatus(e){this.offlineConfig.configUsingLocal=e,this.offlineConfig.orderUsingLocal=e,this.offlineConfig.productUsingLocal=e}onCancel(){this.dialogRef.close()}onSave(){this.indexDbService.updateOfflineConfig(this.offlineConfig).pipe((0,m.R)(this.destroy$)).subscribe({next:e=>{this._onlineStatusService.pushNewValue(this.offlineConfig),this.dialogRef.close()},error:e=>{console.error(e,"Error")}})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(x.q),t.Y36(h.so),t.Y36(P.T))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-modal-online-status"]],decls:23,vars:6,consts:[[3,"config","onOk","onCancel","onClose"],[2,"width","420px"],[1,"row","g-0","text-center"],[1,"col-6","pe-3",3,"click"],[1,"btn","btn-outline-secondary","success"],[1,"fa","fa-wifi"],[1,"pt-5","pb-10"],[1,"h6"],[1,"col-6","ps-3",3,"click"],["for","radOffline",1,"btn","btn-outline-secondary","danger"],[1,"fa","fa-wifi-off"],[1,"pt-3"],["class","container","style","margin-top: 10px",4,"ngIf"],[1,"container",2,"margin-top","10px"],[1,"row"],[1,"col-md-4"],["type","radio","name","order",3,"ngModel","value","ngModelChange"],[1,"fw-bold"],["type","radio","name","product",3,"ngModel","value","ngModelChange"],["type","radio","name","config",3,"ngModel","value","ngModelChange"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return n.onSave()})("onCancel",function(){return n.onCancel()})("onClose",function(){return n.onCancel()}),t.TgZ(1,"content")(2,"div",1)(3,"div",2)(4,"div",3),t.NdJ("click",function(){return n.updateOnlineStatus(!1)}),t.TgZ(5,"label",4),t._UZ(6,"i",5),t.TgZ(7,"h4",6)(8,"strong"),t._uU(9,"ONLINE"),t.qZA()(),t.TgZ(10,"small",7),t._uU(11," Upload orders in realtime to cloud server "),t.qZA()()(),t.TgZ(12,"div",8),t.NdJ("click",function(){return n.updateOnlineStatus(!0)}),t.TgZ(13,"label",9),t._UZ(14,"i",10),t.TgZ(15,"h4",11)(16,"strong"),t._uU(17,"OFFLINE"),t.qZA()(),t.TgZ(18,"small",7),t._uU(19," Save order locally, upload manually when connection is available "),t.qZA()()()()()(),t.TgZ(20,"more-content"),t.YNc(21,_n,34,12,"div",12),t.qZA(),t._UZ(22,"footer"),t.qZA()),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(5),t.ekj("success",!(n.offlineConfig.orderUsingLocal&&n.offlineConfig.productUsingLocal&&n.offlineConfig.configUsingLocal)),t.xp6(8),t.ekj("offline",n.offlineConfig.orderUsingLocal&&n.offlineConfig.productUsingLocal&&n.offlineConfig.configUsingLocal),t.xp6(8),t.Q6J("ngIf",n.offlineConfig))},dependencies:[g.O5,y.M,u.Fj,u._,u.JJ,u.On],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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.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}.success[_ngcontent-%COMP%]{color:#fff;background-color:#89b03e}.offline[_ngcontent-%COMP%]{color:#fff;background-color:#c9302c}.fa-wifi-off[_ngcontent-%COMP%]{background-image:url(//res.cloudinary.com/pos/image/upload/v1535431932/POS/Images/Icon/wifi-off.svg);height:30px;width:30px;background-size:30px;background-repeat:no-repeat}#radOffline[_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%] .fa-wifi-off[_ngcontent-%COMP%]{background-image:url(//res.cloudinary.com/pos/image/upload/POS/Images/Icon/wifi-off-white.svg)}.fa-wifi[_ngcontent-%COMP%]{font-size:30px}"]}),o})();function fn(o,r){if(1&o){const e=t.EpF();t.ynx(0),t.TgZ(1,"button",10),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(2).$implicit,a=t.oxw();return t.KtG(a.onApplyPromotion(i))}),t._uU(2," APPLY "),t.qZA(),t.BQk()}if(2&o){const e=t.oxw(3);t.xp6(1),t.Q6J("disabled",e.selectedPromotion)}}function Cn(o,r){if(1&o){const e=t.EpF();t.ynx(0),t.TgZ(1,"button",11),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(2).$implicit,a=t.oxw();return t.KtG(a.onRemovePromotion(i))}),t._uU(2," REMOVE "),t.qZA(),t.BQk()}}function bn(o,r){if(1&o&&(t.ynx(0),t.YNc(1,fn,3,1,"ng-container",9),t.YNc(2,Cn,3,0,"ng-container",9),t.BQk()),2&o){const e=t.oxw().$implicit,n=t.oxw();t.xp6(1),t.Q6J("ngIf",(null==n.selectedPromotion?null:n.selectedPromotion.ID)!=e.ID),t.xp6(1),t.Q6J("ngIf",(null==n.selectedPromotion?null:n.selectedPromotion.ID)==e.ID)}}function Pn(o,r){1&o&&(t.TgZ(0,"p",12),t._uU(1,"Not Eligible"),t.qZA())}const Mn=function(o){return{"bg-light":o}};function yn(o,r){if(1&o&&(t.TgZ(0,"div",3)(1,"div",4)(2,"h5"),t._uU(3),t.qZA(),t.TgZ(4,"p",5),t._uU(5),t.qZA()(),t.TgZ(6,"div",6),t.YNc(7,bn,3,2,"ng-container",7),t.YNc(8,Pn,2,0,"ng-template",null,8,t.W1O),t.qZA()()),2&o){const e=r.$implicit,n=t.MAs(9),i=t.oxw();t.Q6J("ngClass",t.VKq(5,Mn,!e.Eligible&&e.TypeID!==i.promotionType.Discount)),t.xp6(3),t.Oqu(e.Name),t.xp6(2),t.Oqu(e.Description),t.xp6(2),t.Q6J("ngIf",e.Eligible||e.TypeID===i.promotionType.Discount)("ngIfElse",n)}}let pe=(()=>{class o{constructor(e,n){this._dialogRef=e,this._promotionEventService=n,this.modalConfig=new D.O,this.promotions=[],this.promotionType=w,this.destroy$=new T.x}ngOnInit(){this.subscribePromotionService(),this.initModalConfig()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}subscribePromotionService(){this._promotionEventService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.promotions=e,this.checkValidSelectedPromotion()})}checkValidSelectedPromotion(){this.selectedPromotion=this._promotionEventService.selectedPromotion,this.selectedPromotion&&-1===this.promotions.findIndex(n=>n.ID==this.selectedPromotion.ID&&n.Eligible)&&(this.selectedPromotion=null,this._promotionEventService.selectedPromotion=null)}initModalConfig(){this.modalConfig.title="Promotions",this.modalConfig.customWidth="500px",this.modalConfig.hideFooter=!0,this.modalConfig.bodyScrollable=!0}onApplyPromotion(e){this._promotionEventService.applyPromotion(e),e.TypeID!=w.Product&&this.close()}onRemovePromotion(e){this._promotionEventService.removePromotion(),this.selectedPromotion=null}close(){this._dialogRef.close()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(rt))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-promotion"]],decls:5,vars:6,consts:[[3,"config","onCancel","onClose"],[1,"container"],["class","row border mt-3 py-2 justify-content-between",3,"ngClass",4,"ngFor","ngForOf"],[1,"row","border","mt-3","py-2","justify-content-between",3,"ngClass"],[1,"col","mt-3"],[1,"description"],[1,"col-auto","my-auto"],[4,"ngIf","ngIfElse"],["notEligible",""],[4,"ngIf"],[1,"btn","btn-success","my-auto",3,"disabled","click"],[1,"btn","btn-danger","my-auto",3,"click"],[1,"text-danger","my-auto"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),t.TgZ(1,"content")(2,"div",1),t.YNc(3,yn,10,7,"div",2),t.ALo(4,"sortBy"),t.qZA()()()),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(3),t.Q6J("ngForOf",t.Dn7(4,2,n.promotions,"desc","Eligible")))},dependencies:[g.mk,g.sg,g.O5,y.M,k.W7],styles:[".description[_ngcontent-%COMP%]{word-wrap:break-word}"]}),o})(),vn=(()=>{class o{constructor(e,n,i,a){this.dialogRef=e,this._orderDataService=n,this._orderProcessorService=i,this._OrderHttpService=a,this.modalConfig=new D.O,this.modalConfig.title="Return",this.modalConfig.customWidth="284px",this.destroy$=new T.x}ngOnInit(){this.initInvoiceRetur()}initInvoiceRetur(){this.ReturNumber=null,this._orderProcessorService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{e.posState===_.IsReturn&&(this.ReturNumber=e.ReturNumber)})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}onOk(){this._OrderHttpService.GetReturnInvoice(this.ReturNumber,this._orderDataService.Data.Order.EntityID).pipe((0,m.R)(this.destroy$)).subscribe(n=>{this._orderProcessorService.Data.ReturNumber=this.ReturNumber,this._orderProcessorService.ReturnOrder(n),this._orderProcessorService.updatePosState(_.IsReturn),this.dialogRef.close()})}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(v),t.Y36(Z),t.Y36(N.D))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-modal-return"]],decls:6,vars:2,consts:[[3,"config","onOk","onCancel","onClose"],[1,"form-floating-outline"],["type","text","data-cy","ReturnNumber","id","ReturNumber","name","ReturNumber",1,"form-control",3,"ngModel","ngModelChange"],["for","ReturNumber"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return n.onOk()})("onCancel",function(){return n.dialogRef.close()})("onClose",function(){return n.dialogRef.close()}),t.TgZ(1,"content")(2,"div",1)(3,"input",2),t.NdJ("ngModelChange",function(a){return n.ReturNumber=a}),t.qZA(),t.TgZ(4,"label",3),t._uU(5,"Number Invoice"),t.qZA()()()()),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(3),t.Q6J("ngModel",n.ReturNumber))},dependencies:[y.M,u.Fj,u.JJ,u.On]}),o})();var E=p(3848),On=p(39841);function xn(o,r){if(1&o&&(t.ynx(0),t._uU(1),t.ALo(2,"date"),t.BQk()),2&o){const e=t.oxw();t.xp6(1),t.hij(" ",t.xi3(2,1,e.syncDate,"dd MMM yyyy HH:mm")," ")}}function Dn(o,r){1&o&&t._uU(0," Never been synced ")}function Sn(o,r){if(1&o&&(t.TgZ(0,"p"),t._uU(1),t.qZA()),2&o){const e=t.oxw();t.xp6(1),t.hij("You last synced ",e.dayDiff," days ago!")}}let Tn=(()=>{class o{constructor(e,n,i,a){this.indexDbService=e,this.toastr=n,this.httpService=i,this.dialogRef=a,this.offlineProduct=0,this.onlineProducts=0,this.destroy$=new T.x}ngOnInit(){this.initOfflineProducts()}initOfflineProducts(){this.indexDbService.findAllVariant().pipe((0,V.h)(e=>e.length>0),(0,j.w)(e=>(this.offlineProduct=e.length,this.httpService.POSText("/api/catalog/product/ProductRowsCount",'{"RowCount":99999,"PageNumber":1,"ProductDiscontinued":false,"VariantDiscontinued":false}'))),(0,Gt.U)(e=>JSON.parse(e))).subscribe({next:e=>{this.onlineProducts=e.Count,this.getSyncTime()},error:e=>{console.error(e)}})}syncToLocalDatabase(){(0,On.a)([this.syncOutlets(),this.syncProducts(),this.syncOutletPrices()]).pipe((0,m.R)(this.destroy$),(0,j.w)(()=>this.indexDbService.updateSyncTime())).subscribe({next:()=>{this.initOfflineProducts(),this.toastr.success("Sync Product Offline Successfully","Success!"),this.dialogRef.close()},error:e=>{console.error(e)}})}getSyncTime(){this.indexDbService.getSyncTime().pipe((0,m.R)(this.destroy$),(0,V.h)(e=>null!=e)).subscribe({next:e=>{this.syncDate=new Date(e.time),this.calculateSyncDiff()},error:e=>{console.error(e)}})}calculateSyncDiff(){this.dayDiff=this.syncDate?Math.floor(((new Date).getTime()-this.syncDate.getTime())/1e3/60/60/24):0}syncOutlets(){return this.httpService.post(c.Wz.SynOutlet).pipe((0,m.R)(this.destroy$),(0,j.w)(e=>this.indexDbService.syncRegisters(e)))}syncProducts(){return this.httpService.post("/API/POSSync/Products",{}).pipe((0,m.R)(this.destroy$),(0,j.w)(e=>this.indexDbService.syncVariants(e)))}syncOutletPrices(){return this.httpService.post(c.Wz.SynOutletPrice).pipe((0,m.R)(this.destroy$),(0,j.w)(e=>this.indexDbService.syncOutletPrice(e)))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(P.T),t.Y36(I._W),t.Y36(M.O),t.Y36(h.so))},o.\u0275cmp=t.Xpm({type:o,selectors:[["sync-products"]],decls:25,vars:5,consts:[[1,"sync-product","row","justify-content-between"],[1,"col"],[1,"row","justify-content-start"],[1,"col-auto"],[4,"ngIf","ngIfElse"],["neverSync",""],[4,"ngIf"],[1,"col-auto","my-auto"],[1,"btn","btn-success",3,"click"],[1,"fa-solid","fa-sync-alt","me-2","pe-2"]],template:function(e,n){if(1&e&&(t.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),t._uU(4,"Online Products :"),t.qZA(),t.TgZ(5,"div",3),t._uU(6),t.qZA()(),t.TgZ(7,"div",2)(8,"div",3),t._uU(9,"Offline products :"),t.qZA(),t.TgZ(10,"div",3),t._uU(11),t.qZA()(),t.TgZ(12,"div",2)(13,"div",3),t._uU(14,"Last Sync :"),t.qZA(),t.TgZ(15,"div",3),t.YNc(16,xn,3,4,"ng-container",4),t.YNc(17,Dn,1,0,"ng-template",null,5,t.W1O),t.YNc(19,Sn,2,1,"p",6),t.qZA()()(),t.TgZ(20,"div",7)(21,"button",8),t.NdJ("click",function(){return n.syncToLocalDatabase()}),t._UZ(22,"i",9),t.TgZ(23,"span"),t._uU(24,"Sync"),t.qZA()()()()),2&e){const i=t.MAs(18);t.xp6(6),t.hij(" ",n.onlineProducts??"Failed to get Online Products"," "),t.xp6(5),t.hij(" ",n.offlineProduct," "),t.xp6(5),t.Q6J("ngIf",n.syncDate)("ngIfElse",i),t.xp6(3),t.Q6J("ngIf",n.dayDiff>14)}},dependencies:[g.O5,g.uU],styles:[".sync-product[_ngcontent-%COMP%]{padding:16px;font-size:14px}"]}),o})();function In(o,r){if(1&o&&(t.TgZ(0,"tr")(1,"td"),t._uU(2),t.qZA(),t.TgZ(3,"td"),t._uU(4),t.ALo(5,"date"),t.qZA(),t.TgZ(6,"td"),t._uU(7),t.ALo(8,"date"),t.qZA(),t.TgZ(9,"td",6),t._uU(10),t.qZA(),t.TgZ(11,"td",6),t._uU(12),t.ALo(13,"number"),t.qZA()()),2&o){const e=r.$implicit;t.xp6(2),t.Oqu(e.Order.Number),t.xp6(2),t.Oqu(t.xi3(5,5,e.Order.ClientTimestamp,"dd MMM yyyy")),t.xp6(3),t.Oqu(t.xi3(8,8,e.Order.ClientTimestamp,"HH:mm")),t.xp6(3),t.Oqu(e.Items.length),t.xp6(2),t.Oqu(t.lcZ(13,11,e.TotalPaidAmount))}}function kn(o,r){if(1&o&&(t.TgZ(0,"div",2)(1,"div",3)(2,"table",4)(3,"thead",5)(4,"tr")(5,"th"),t._uU(6,"Number"),t.qZA(),t.TgZ(7,"th"),t._uU(8,"Date"),t.qZA(),t.TgZ(9,"th"),t._uU(10,"Time"),t.qZA(),t.TgZ(11,"th",6),t._uU(12,"Qty"),t.qZA(),t.TgZ(13,"th",6),t._uU(14,"Total"),t.qZA()()(),t.TgZ(15,"tbody"),t.YNc(16,In,14,13,"tr",7),t.qZA()()()()),2&o){const e=t.oxw();t.xp6(16),t.Q6J("ngForOf",e.offlineOrders)}}function An(o,r){1&o&&(t.TgZ(0,"h1",8),t._uU(1,"There is no offline orders!"),t.qZA())}let wn=(()=>{class o{constructor(e){this._localDataService=e,this.offlineOrders=[],this.destroy$=new T.x}ngOnInit(){this.getOfflineOrders()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}getOfflineOrders(){this._localDataService.findAllOrders().pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.offlineOrders=e.map(n=>(0,W.yE)(J.m,n))})}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(P.T))},o.\u0275cmp=t.Xpm({type:o,selectors:[["sync-orders"]],decls:3,vars:2,consts:[["class","table-responsive",4,"ngIf","ngIfElse"],["noOrders",""],[1,"table-responsive"],[1,"container-fluid","mt-5"],[1,"table"],[1,"thead-light"],[1,"text-end"],[4,"ngFor","ngForOf"],[1,"text-center","mt-5"]],template:function(e,n){if(1&e&&(t.YNc(0,kn,17,1,"div",0),t.YNc(1,An,2,0,"ng-template",null,1,t.W1O)),2&e){const i=t.MAs(2);t.Q6J("ngIf",null!=n.offlineOrders&&n.offlineOrders.length>0)("ngIfElse",i)}},dependencies:[g.sg,g.O5,g.JJ,g.uU]}),o})();const Nn=["navTabs"];function Zn(o,r){1&o&&(t.TgZ(0,"span"),t._uU(1,"Products"),t.qZA())}let Jn=(()=>{class o{constructor(e,n){this._router=e,this.dialogRef=n,this.modalConfig=new D.O}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig.headerType=U.n.Success,this.modalConfig.title="You are online to synchronize",this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="550px",this.modalConfig.noPadding=!0}goToOfflinePage(){0==this.tabs.selectedIndex?this._router.navigate(["/menu","Sell","Offline","Products"]):1==this.tabs.selectedIndex&&this._router.navigate(["/menu","Sell","Offline","Orders"]),this.close()}close(){this.dialogRef.close()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(S.F0),t.Y36(h.so))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-modal-sync"]],viewQuery:function(e,n){if(1&e&&t.Gf(Nn,5),2&e){let i;t.iGM(i=t.CRH())&&(n.tabs=i.first)}},decls:13,vars:2,consts:[[3,"config","onOk","onCancel","onClose"],["mat-align-tabs","start",1,"sync","mb-5",3,"dynamicHeight"],["navTabs",""],["mat-tab-label",""],["label","Orders"],[1,"d-flex","justify-content-center","my-5"],[1,"btn","btn-primary","btn-lg",3,"click"],[1,"fa-solid","fa-paper-plane"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return n.close()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),t.TgZ(1,"content")(2,"mat-tab-group",1,2)(4,"mat-tab"),t.YNc(5,Zn,2,0,"ng-template",3),t._UZ(6,"sync-products"),t.qZA(),t.TgZ(7,"mat-tab",4),t._UZ(8,"sync-orders"),t.qZA()(),t.TgZ(9,"div",5)(10,"button",6),t.NdJ("click",function(){return n.goToOfflinePage()}),t._UZ(11,"i",7),t._uU(12," Go to Details "),t.qZA()()()()),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(2),t.Q6J("dynamicHeight",!1))},dependencies:[y.M,E.SP,E.uD,E.uX,Tn,wn],styles:[".mat-ink-bar{background-color:#93bd45!important} .sync mat-tab-body{height:200px} .mat-tab-body-content{overflow-x:hidden!important}.btn-gray[_ngcontent-%COMP%]{background-color:#f4f4f4;border:1px solid #D6D6D6;font-weight:700;color:#545454!important;background:linear-gradient(to bottom,#ffffff 0%,#eeeeee 100%)}.h5[_ngcontent-%COMP%]{font-size:12px}.row[_ngcontent-%COMP%]{width:450px}"]}),o})();function Rn(o,r){if(1&o&&(t.TgZ(0,"span",9),t._uU(1),t.qZA()),2&o){const e=t.oxw(2);t.xp6(1),t.Oqu(e.totalOfflineOrders)}}function qn(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",6),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.openSyncModal())}),t._UZ(1,"i",7),t.YNc(2,Rn,2,1,"span",8),t.qZA()}if(2&o){const e=t.oxw();t.xp6(2),t.Q6J("ngIf",0!=e.totalOfflineOrders)}}function Fn(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",10),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.openCouponCodeModal())}),t._UZ(1,"i",11),t.qZA()}}function Qn(o,r){if(1&o&&(t.TgZ(0,"span",9),t._uU(1),t.qZA()),2&o){const e=t.oxw(2);t.xp6(1),t.Oqu(e.totalEligiblePromotion)}}function Un(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",12),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.openPromotionModal())}),t._UZ(1,"i",13),t.YNc(2,Qn,2,1,"span",8),t.qZA()}if(2&o){const e=t.oxw();t.xp6(2),t.Q6J("ngIf",0!=e.totalEligiblePromotion)}}function En(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",14),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.openReturnModal())}),t._UZ(1,"i",15),t.qZA()}}let Ln=(()=>{class o{constructor(e,n,i,a,s){this._localDataService=e,this._promotionEventService=n,this.matDialog=i,this._posService=a,this._userRoleService=s,this.returnEnabled=!0,this.totalOfflineOrders=0,this.totalEligiblePromotion=0,this.destroy$=new T.x,this.restriction=this._posService.Data.Restriction}ngOnInit(){this.subscribeToObservable()}subscribeToObservable(){this.returnEnabled=this.restriction.Return,this._userRoleService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.returnEnabled=e.Return}),this._promotionEventService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(()=>{this.totalEligiblePromotion=this._promotionEventService.getTotalEligiblePromotion()}),this._promotionEventService.onClickToastPromo.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.openPromotionModal()}),this._localDataService.findAllOrders().pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.totalOfflineOrders=e.length})}openOnlineStatusModal(){this.matDialog.open(hn)}openSyncModal(){this.matDialog.open(Jn)}openCouponCodeModal(){this.matDialog.open(mn)}openReturnModal(){this.matDialog.open(vn)}openPromotionModal(){this.matDialog.open(pe,{id:"promotion-event"})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(P.T),t.Y36(rt),t.Y36(h.uw),t.Y36(C),t.Y36(K))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-header"]],inputs:{isOnline:"isOnline"},decls:8,vars:6,consts:[["title","Working Status",1,"btn","btn-gray","fw-normal","me-5","p-4",3,"click"],[1,"fa","fa-circle","pe-2",3,"ngClass"],["title","Synchronize","class","header me-5 align-middle",3,"click",4,"ngIf"],["title","Promotion Coupon","class","header me-5 align-middle",3,"click",4,"ngIf"],["title","Promotion","class","header me-5 align-middle",3,"click",4,"ngIf"],["title","Return","data-cy","Return","class","header align-middle",3,"click",4,"ngIf"],["title","Synchronize",1,"header","me-5","align-middle",3,"click"],[1,"fas","fa-sync-alt","text-black"],["class","position-absolute badge badge rounded-pill bg-danger",4,"ngIf"],[1,"position-absolute","badge","badge","rounded-pill","bg-danger"],["title","Promotion Coupon",1,"header","me-5","align-middle",3,"click"],["data-cy","Coupon","aria-hidden","true",1,"fa","fa-coupon"],["title","Promotion",1,"header","me-5","align-middle",3,"click"],[1,"fas","fa-gift","text-black"],["title","Return","data-cy","Return",1,"header","align-middle",3,"click"],["aria-hidden","true",1,"fa","fa-retur"]],template:function(e,n){1&e&&(t.TgZ(0,"a",0),t.NdJ("click",function(){return n.openOnlineStatusModal()}),t._UZ(1,"i",1),t.TgZ(2,"span"),t._uU(3),t.qZA()(),t.YNc(4,qn,3,1,"a",2),t.YNc(5,Fn,2,0,"a",3),t.YNc(6,Un,3,1,"a",4),t.YNc(7,En,2,0,"a",5)),2&e&&(t.xp6(1),t.Q6J("ngClass",n.isOnline?"text-success":"text-danger"),t.xp6(2),t.Oqu(n.isOnline?"Online":"Offline"),t.xp6(1),t.Q6J("ngIf",n.isOnline),t.xp6(1),t.Q6J("ngIf",n.isOnline),t.xp6(1),t.Q6J("ngIf",n.isOnline),t.xp6(1),t.Q6J("ngIf",n.returnEnabled&&n.isOnline))},dependencies:[g.mk,g.O5],styles:[".fa-coupon[_ngcontent-%COMP%]{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[_ngcontent-%COMP%]{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}.fa-sync-alt[_ngcontent-%COMP%], .fa-gift[_ngcontent-%COMP%]{font-size:26px}.btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#ffffff 0%,#eeeeee 100%)}"]}),o})(),Vn=(()=>{class o{constructor(e,n){this.dialogRef=e,this.data=n,this.modalConfig=new D.O,this.pointUsed=this.data.pointUsed,this.availablePoint=this.data.availablePoint,this.label=this.data.label,this.modalConfig.title=this.getLabelLoyalty(),this.modalConfig.customWidth="284px"}ngOnInit(){0==this.pointUsed&&(this.pointUsed=null)}onOk(){this.dialogRef.close(this.pointUsed>this.availablePoint?{pointUsed:this.availablePoint}:{pointUsed:this.pointUsed})}getLabelLoyalty(){return null==this.label||""==this.label.trim()?"Loyalty Point":this.label}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(h.WI))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-loyalty-point"]],decls:6,vars:7,consts:[[3,"title","config","onOk","onCancel","onClose"],["autoNum","","preventNegative","","data-cy","pointUsed",1,"border","rounded","p-4",3,"max","ngModel","ngModelChange"],[1,"ps-2"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return n.onOk()})("onCancel",function(){return n.dialogRef.close()})("onClose",function(){return n.dialogRef.close()}),t.TgZ(1,"content")(2,"input",1),t.NdJ("ngModelChange",function(a){return n.pointUsed=a}),t.qZA(),t.TgZ(3,"span",2),t._uU(4),t.ALo(5,"number"),t.qZA()()()),2&e&&(t.Q6J("title",n.getLabelLoyalty())("config",n.modalConfig),t.xp6(2),t.Q6J("max",n.availablePoint)("ngModel",n.pointUsed),t.xp6(2),t.hij("/ ",t.lcZ(5,5,n.availablePoint),""))},dependencies:[u.Fj,u.JJ,u.On,y.M,nt.b,g.JJ],styles:["input[_ngcontent-%COMP%]{width:110px}"]}),o})();var Yn=p(54840),gt=p(62834),$=p(88796);const Hn=["firstNameAutoFocus"];function Gn(o,r){1&o&&t._UZ(0,"option",31),2&o&&t.Q6J("value",r.$implicit.Name)}const ge=function(o){return{"has-error":o}};function Bn(o,r){if(1&o&&(t.TgZ(0,"div",32)(1,"i",33),t._uU(2," Name is mandatory."),t.qZA()()),2&o){t.oxw();const e=t.MAs(12);t.Q6J("ngClass",t.VKq(1,ge,e.touched&&e.invalid))}}function Kn(o,r){if(1&o&&(t.TgZ(0,"div",32)(1,"i",33),t._uU(2," Mobile is mandatory."),t.qZA()()),2&o){t.oxw();const e=t.MAs(24);t.Q6J("ngClass",t.VKq(1,ge,e.invalid))}}const $n=function(o){return{"border border-danger":o}},ue=function(o){return{"is-invalid border border-danger":o}};function zn(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",9)(1,"div",10)(2,"div",11)(3,"input",12),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.Title=i)}),t.qZA(),t.TgZ(4,"label",13),t._uU(5,"Title"),t.qZA(),t.TgZ(6,"datalist",14),t.YNc(7,Gn,1,1,"option",15),t.qZA()()(),t.TgZ(8,"div",16)(9,"div",11)(10,"input",17,18),t.NdJ("keyup",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.onKeyUpFirstName())})("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.FirstName=i)}),t.qZA(),t.YNc(13,Bn,3,3,"div",19),t.TgZ(14,"label",20),t._uU(15,"First Name"),t.qZA()()(),t.TgZ(16,"div",21)(17,"div",11)(18,"input",22),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.LastName=i)}),t.qZA(),t.TgZ(19,"label",23),t._uU(20,"Last Name"),t.qZA()()(),t.TgZ(21,"div",24)(22,"div",11)(23,"input",25,26),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.Mobile=i)}),t.qZA(),t.YNc(25,Kn,3,3,"div",19),t.TgZ(26,"label",27),t._uU(27,"Mobile"),t.qZA()()(),t.TgZ(28,"div",24)(29,"div",11)(30,"input",28,29),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.Email=i)}),t.qZA(),t.TgZ(32,"label",30),t._uU(33,"Email"),t.qZA()()()()}if(2&o){const e=t.MAs(12),n=t.MAs(24),i=t.MAs(31),a=t.oxw();t.xp6(3),t.Q6J("ngModel",a.customer.Title),t.xp6(4),t.Q6J("ngForOf",null==a.options?null:a.options.Titles),t.xp6(3),t.Q6J("ngClass",t.VKq(14,$n,e.touched&&e.invalid))("ngModel",a.customer.FirstName)("required",!0),t.xp6(3),t.Q6J("ngIf",e.touched&&e.invalid),t.xp6(5),t.Q6J("ngModel",a.customer.LastName),t.xp6(5),t.Q6J("ngClass",t.VKq(16,ue,n.invalid))("ngModel",a.customer.Mobile)("required",null==a.config||null==a.config.ModuleContact?null:a.config.ModuleContact.Advance.RequireContactMobile),t.xp6(2),t.Q6J("ngIf",n.invalid),t.xp6(5),t.Q6J("ngClass",t.VKq(18,ue,i.invalid))("ngModel",a.customer.Email)("required",null==a.config||null==a.config.ModuleContact?null:a.config.ModuleContact.Advance.RequireEmailActivation)}}function jn(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",34)(1,"div",35)(2,"label",36),t._uU(3,"Address"),t.qZA(),t.TgZ(4,"textarea",37),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.Address=i)}),t.qZA()(),t.TgZ(5,"div",38)(6,"ng-select",39),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.City=i)}),t.qZA()(),t.TgZ(7,"div",38)(8,"ng-select",40),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.NationalityID=i)}),t.qZA()(),t.TgZ(9,"div",38)(10,"ng-select",41),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.Gender=i)}),t.qZA()(),t.TgZ(11,"div",24)(12,"div",11)(13,"input",42),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.Code=i)}),t.qZA(),t.TgZ(14,"label",43),t._uU(15,"Member Code"),t.qZA()()(),t.TgZ(16,"div",24)(17,"div",11)(18,"input",44),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.NationalIDNumber=i)}),t.qZA(),t.TgZ(19,"label",45),t._uU(20,"Identification"),t.qZA()()(),t.TgZ(21,"div",46)(22,"datepicker",47),t.NdJ("dateChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.Birthdate=i)}),t.qZA()(),t.TgZ(23,"div",48)(24,"strong"),t._uU(25,"Customer Race"),t.qZA(),t.TgZ(26,"ng-select",49),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.RaceID=i)}),t.qZA()(),t.TgZ(27,"div",48)(28,"strong"),t._uU(29,"Group"),t.qZA(),t.TgZ(30,"ng-select",50),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.customer.Group=i)}),t.qZA()()()}if(2&o){const e=t.oxw();t.xp6(4),t.Q6J("ngModel",e.customer.Address),t.xp6(2),t.Q6J("ngModel",e.customer.City)("items",null==e.options?null:e.options.Cities),t.xp6(2),t.Q6J("ngModel",e.customer.NationalityID)("items",null==e.options?null:e.options.Nationalities),t.xp6(2),t.Q6J("ngModel",e.customer.Gender)("items",null==e.options?null:e.options.Genders),t.xp6(3),t.Q6J("ngModel",e.customer.Code),t.xp6(5),t.Q6J("ngModel",e.customer.NationalIDNumber),t.xp6(4),t.Q6J("date",e.customer.Birthdate),t.xp6(4),t.Q6J("ngModel",e.customer.RaceID)("items",null==e.options?null:e.options.Races),t.xp6(4),t.Q6J("ngModel",e.customer.Group)("items",null==e.options?null:e.options.Groups)}}const me=function(o){return{selected:o}};let _e=(()=>{class o{constructor(e,n,i,a,s){this._dialogRef=e,this._posService=n,this._orderDataService=i,this._CustomerHttpService=a,this.data=s,this.modalConfig=new D.O,this.title=""}get options(){return this._posService.Data.CustomerOptions}get config(){return this._posService.Data.AppConfigJSON}ngOnInit(){this.initCustomer(),this.modalConfig.customWidth="532px",this.modalConfig.title=this.title?this.title:"New Customer",this.modalConfig.bodyScrollable=!0,this.modalConfig.hideScrollbar=!0,this.initModalValidated()}initCustomer(){let e=this._posService.Data.AppConfigJSON;this.customer=new Yn.O8,c.gT.IsNotEmpty(this.data)&&(this.customer.FirstName=this.data.name),c.gT.IsNotEmpty(e.ModuleContact.DefaultContactGroup.ContactGroup)&&(this.customer.Group=e.ModuleContact.DefaultContactGroup.ContactGroup),this.setEntityID()}initModalValidated(){this.modalConfig.validated=null!=this.data&&!!this.data.name}ngAfterViewInit(){this.setAutoFocus()}setEntityID(){this.customer.CreatorEntityID=this._orderDataService.Data.Order.EntityID}setAutoFocus(){this.firstNameRef.nativeElement.focus()}onKeyUpFirstName(){this.modalConfig.validated=!!this.customer.FirstName}chooiceDetail(e){this.detailVisible=e}onOk(){const e=this._orderDataService.Data;this.customer.Name=this.getCustomerName(),this._CustomerHttpService.addCustomer(this.customer).then(n=>{e.ContactName=this.customer.Name,this._orderDataService.pushNewValue(e),this._orderDataService.updateCustomerID(n.ID).then(i=>{this.customerData=i,this.close("ok")})})}getCustomerName(){let e="";return e+=" "+(this.customer.FirstName?this.customer.FirstName:""),e+=" "+(this.customer.LastName?this.customer.LastName:""),e=e.trim(),e}close(e){this._dialogRef.close("ok"===e?this.customerData:null)}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(C),t.Y36(v),t.Y36(tt.r),t.Y36(h.WI))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-customer"]],viewQuery:function(e,n){if(1&e&&t.Gf(Hn,5),2&e){let i;t.iGM(i=t.CRH())&&(n.firstNameRef=i.first)}},decls:15,vars:10,consts:[[3,"validated","config","onOk","onCancel","onClose"],[1,"container"],["name","form"],["f","ngForm"],[1,"row","align-items-center","border-bottom"],[1,"btn","btn-link",3,"ngClass","click"],[1,"mt-6"],["class","row",4,"ngIf"],["class","row mt-2",4,"ngIf"],[1,"row"],[1,"col-md-3","mt-3"],[1,"form-floating-outline"],["list","cust-title","id","Title","name","Title","placeholder","Title",1,"form-control",3,"ngModel","ngModelChange"],["for","Title"],["id","cust-title"],[3,"value",4,"ngFor","ngForOf"],[1,"col-md-5","mt-3"],["type","text","data-cy","FirstName","id","FirstName","name","FirstName","placeholder","First Name",1,"form-control",3,"ngClass","ngModel","required","keyup","ngModelChange"],["firstNameAutoFocus","","FirstName","ngModel"],[3,"ngClass",4,"ngIf"],["for","FirstName"],[1,"col-md-4","mt-3"],["type","text","data-cy","LastName","id","LastName","name","LastName","placeholder","Last Name",1,"form-control",3,"ngModel","ngModelChange"],["for","LastName"],[1,"col-md-6","mt-3"],["type","text","id","Phone","name","Phone","placeholder","Mobile",1,"form-control",3,"ngClass","ngModel","required","ngModelChange"],["Phone","ngModel"],["for","Phone"],["type","email","id","email","name","Email","placeholder","Email","email","",1,"form-control",3,"ngClass","ngModel","required","ngModelChange"],["Email","ngModel"],["for","email"],[3,"value"],[3,"ngClass"],[1,"control-label","text-danger"],[1,"row","mt-2"],[1,"col-md-12"],[1,"fw-bold"],["name","address",1,"form-control",3,"ngModel","ngModelChange"],[1,"col-md-6","mt-5"],["appendTo","body","name","city","bindLabel","Name","bindValue","ID","placeholder","City",1,"tall",3,"ngModel","items","ngModelChange"],["name","NationalityID","bindLabel","Name","bindValue","ID","placeholder","Nationality","appendTo","body",1,"tall",3,"ngModel","items","ngModelChange"],["name","gender","bindLabel","Value","bindValue","Key","placeholder","Gender","appendTo","body",1,"tall",3,"ngModel","items","ngModelChange"],["type","text","name","code","id","code","placeholder","Member Code",1,"form-control",3,"ngModel","ngModelChange"],["for","code"],["type","text","id","Identification","name","Identification","placeholder","Identification",1,"form-control",3,"ngModel","ngModelChange"],["for","Identification"],[1,"col-auto","w-50","mt-3"],["placeholder","Birthday","appearance","outline","name","orderDate",3,"date","dateChange"],[1,"col-md","mt-2"],["name","race","bindLabel","Name","bindValue","ID","placeholder","Race","dropdownPosition","top",1,"tall",3,"ngModel","items","ngModelChange"],["name","group","bindLabel","Name","bindValue","ID","placeholder","Group","dropdownPosition","top",1,"tall",3,"ngModel","items","ngModelChange"]],template:function(e,n){if(1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return n.onOk()})("onCancel",function(){return n.close("cancel")})("onClose",function(){return n.close("close")}),t.TgZ(1,"content")(2,"div",1)(3,"form",2,3)(5,"div",4)(6,"div")(7,"a",5),t.NdJ("click",function(){return n.chooiceDetail(!1)}),t._uU(8," General "),t.qZA(),t.TgZ(9,"a",5),t.NdJ("click",function(){return n.chooiceDetail(!0)}),t._uU(10," Detail "),t.qZA()()(),t.TgZ(11,"div",6),t.YNc(12,zn,34,20,"div",7),t.YNc(13,jn,31,14,"div",8),t.qZA()()()(),t._UZ(14,"footer"),t.qZA()),2&e){const i=t.MAs(4);t.Q6J("validated",i.form.valid)("config",n.modalConfig),t.xp6(7),t.Q6J("ngClass",t.VKq(6,me,!n.detailVisible)),t.xp6(2),t.Q6J("ngClass",t.VKq(8,me,n.detailVisible)),t.xp6(3),t.Q6J("ngIf",!n.detailVisible),t.xp6(1),t.Q6J("ngIf",n.detailVisible)}},dependencies:[g.mk,g.sg,g.O5,gt.QB,u._Y,u.YN,u.Kr,u.Fj,u.JJ,u.JL,u.Q7,u.on,u.On,u.F,y.M,$.w9],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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:2px solid #07a519}.form-floating-outline[_ngcontent-%COMP%]{margin-bottom:.2rem!important}"]}),o})();var st=p(58393),Jt=p(76359),he=p(19835);function Wn(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",11),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.onShowPointModal())}),t._UZ(1,"i",12),t.qZA()}}function Xn(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",13),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.onShowPointModal())}),t._UZ(1,"h6",14),t.TgZ(2,"span",15),t._uU(3),t.ALo(4,"number"),t.qZA()()}if(2&o){const e=t.oxw();t.xp6(1),t.Q6J("innerHtml",e.getLabelLoyalty(),t.oJD),t.xp6(2),t.Oqu(null!=e.customerData&&e.customerData.Point?t.lcZ(4,2,null==e.customerData?null:e.customerData.Point):0)}}function to(o,r){if(1&o&&(t.ynx(0),t._uU(1),t.ALo(2,"number"),t.BQk()),2&o){const e=t.oxw();t.xp6(1),t.hij(" ",t.lcZ(2,1,null==e.customerData?null:e.customerData.Debt)," ")}}function eo(o,r){1&o&&(t.TgZ(0,"span"),t._uU(1,"-"),t.qZA())}function no(o,r){if(1&o&&(t.ynx(0),t.TgZ(1,"span"),t._uU(2),t.ALo(3,"number"),t.qZA(),t.BQk()),2&o){const e=t.oxw();t.xp6(2),t.Oqu(t.lcZ(3,1,null==e.customerData?null:e.customerData.DebtLimit))}}function oo(o,r){1&o&&(t.TgZ(0,"span"),t._uU(1,"\u221e"),t.qZA())}let io=(()=>{class o{constructor(){this.showPointModal=new t.vpe}getLabelLoyalty(){if(null!=this.customerData)return null!=this.customerData.Label?""==this.customerData.Label.trim()?"Loyalty":this.customerData.Label:"Loyalty"}onShowPointModal(){this.enabledPoint&&this.showPointModal.emit()}}return o.\u0275fac=function(e){return new(e||o)},o.\u0275cmp=t.Xpm({type:o,selectors:[["customer-info"]],inputs:{customerData:"customerData",enabledPoint:"enabledPoint",role:"role"},outputs:{showPointModal:"showPointModal"},decls:18,vars:6,consts:[[1,"customer-panel"],["data-cy","Loyalty",1,"row","px-5","customer-info-box","arrow-box-bottom","g-0"],["class","col-auto",3,"click",4,"ngIf"],["class","col-auto ms-3",3,"click",4,"ngIf"],[1,"col-auto","ms-3"],["aria-hidden","true",1,"fa-solid","fa-dollar-sign","fa-fw"],[1,"col-auto"],[4,"ngIf","ngIfElse"],["NotHasRole",""],[1,"ms-1","me-1"],["UNLIMITED",""],[1,"col-auto",3,"click"],["data-cy","Loyalty","aria-hidden","true",1,"fa","fa-star","fa-fw"],[1,"col-auto","ms-3",3,"click"],[3,"innerHtml"],[2,"font-size","12px"]],template:function(e,n){if(1&e&&(t.TgZ(0,"div",0)(1,"div",1),t.YNc(2,Wn,2,0,"div",2),t.YNc(3,Xn,5,4,"div",3),t.TgZ(4,"div",4),t._UZ(5,"i",5),t.qZA(),t.TgZ(6,"div",6)(7,"h6"),t._uU(8,"Debt"),t.qZA(),t.TgZ(9,"span"),t.YNc(10,to,3,3,"ng-container",7),t.YNc(11,eo,2,0,"ng-template",null,8,t.W1O),t.TgZ(13,"span",9),t._uU(14,"/"),t.qZA(),t.YNc(15,no,4,3,"ng-container",7),t.YNc(16,oo,2,0,"ng-template",null,10,t.W1O),t.qZA()()()()),2&e){const i=t.MAs(12),a=t.MAs(17);t.xp6(2),t.Q6J("ngIf",n.enabledPoint),t.xp6(1),t.Q6J("ngIf",n.enabledPoint),t.xp6(7),t.Q6J("ngIf",null==n.role?null:n.role.DebtView)("ngIfElse",i),t.xp6(5),t.Q6J("ngIf",(null==n.customerData?null:n.customerData.DebtLimit)>0)("ngIfElse",a)}},dependencies:[g.O5,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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.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}.customer-panel[_ngcontent-%COMP%]{position:absolute;top:6px;z-index:1030;margin:auto;left:640px}.customer-panel[_ngcontent-%COMP%] > div.row[_ngcontent-%COMP%]{text-align:left;border:1px solid #bbbbbb;padding:5px;margin-bottom:2px;position:relative;display:flex;left:100px}.customer-panel[_ngcontent-%COMP%] > div.row[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:0;font-size:1.25rem;padding-top:4px;color:#337ab7}.customer-panel[_ngcontent-%COMP%] > div.row[_ngcontent-%COMP%] div.col-3[_ngcontent-%COMP%]{text-align:left;right:8px}.customer-panel[_ngcontent-%COMP%] > div.row[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.65625rem;margin-top:4px}.customer-info-box[_ngcontent-%COMP%]{background-color:#ffffe1!important}.customer-info-box[_ngcontent-%COMP%]:after{border-width:6px!important;margin-left:-6px!important;border-top-color:#ffffe1!important}.customer-info-box[_ngcontent-%COMP%]:before{border-width:7px!important;margin-left:-7px!important}.arrow-box-bottom[_ngcontent-%COMP%]{position:relative;background:white;border:2px solid #bbbbbb;border-radius:.25rem}.arrow-box-bottom[_ngcontent-%COMP%]:after, .arrow-box-bottom[_ngcontent-%COMP%]:before{top:100%;left:50%;border:solid transparent;content:"";height:0;width:0;position:absolute;pointer-events:none}.arrow-box-bottom[_ngcontent-%COMP%]:after{border-color:#0000;border-top-color:#fff;border-width:5px;margin-left:-5px}.arrow-box-bottom[_ngcontent-%COMP%]:before{border-color:#c2e1f500;border-top-color:#bbb;border-width:8px;margin-left:-8px}']}),o})();function ao(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"customer-info",17),t.NdJ("showPointModal",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.cashierShowPointModal())}),t.qZA()}if(2&o){const e=t.oxw(2);t.Q6J("customerData",e.customerData)("role",e.role)("enabledPoint",null==e.selectedRegister?null:e.selectedRegister.MemberPoint)}}function ro(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",18),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.openCustomerModal())}),t._UZ(1,"i",19),t.qZA()}}function so(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div"),t.YNc(1,ao,1,3,"customer-info",13),t._UZ(2,"i",14),t.TgZ(3,"autocompleteV2",15),t.NdJ("onInputChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.onInputCustomer(i))})("onSelect",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.onCustomerSelected(i))})("onInputEnter",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.onScanCodeCustomer(i))}),t.qZA(),t.YNc(4,ro,2,0,"a",16),t.qZA()}if(2&o){const e=t.oxw();t.Gre("col-auto customer ",e.salesOrderNumberingVisible?"small":""," mobile-view"),t.xp6(1),t.Q6J("ngIf",e.customerData&&((null==e.customerData?null:e.customerData.Point)>=0||(null==e.customerData?null:e.customerData.Debt)>0)&&e.checkCustomerEmpty(e.posData.Order.CustomerID)),t.xp6(2),t.Q6J("inputTextValue",e.posData.ContactName)("inputLock",e.role.CustomerInputLock),t.xp6(1),t.Q6J("ngIf",e.role.Contacts&&e.customerQuickAddEnabled||e.role.ContactsCreate&&e.customerQuickAddEnabled)}}const lo=function(o){return{"bg-gradient-warnings":o}};let co=(()=>{class o{constructor(e,n,i,a,s,l,d,f,b,O,R,Q){this._onlineStatusService=e,this._outletService=n,this._orderDataService=i,this._posService=a,this._matDialog=s,this._orderProcessorService=l,this._CustomerHttpService=d,this._toastrService=f,this._userRoleService=b,this._CoreHttpService=O,this._invoiceCalculatorService=R,this._shoppingCartService=Q,this.selectedRegister=new kt,this.salesOrderNumberingVisible=!1,this.customerQuickAddEnabled=!0,this.role=new Y.Q,this.newDate=new Date,this.posData=new J.m,this.posState=_.IsNew,this.SalesPerson=!0,this.appConfig=new ot,this.salesPersonName="",this.destroy$=new T.x}get isEditState(){return this.posState===_.IsEdit}ngOnInit(){this.appConfig=this._posService.Data.AppConfigJSON,this.customerQuickAddEnabled=this.appConfig.ModuleSell.Customer.QuickAddEnabled,this.salesOrderNumberingVisible=this.appConfig.ModuleSell.Numbering.SalesOrderNumberVisible,this.subscribeToValueChanges()}subscribeToValueChanges(){this.subscribeToCartItemsChange(),this._onlineStatusService.getOnlineStatus$().pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.isOnline=e}),this._orderDataService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.posData=e}),this._userRoleService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.role=e}),this._orderProcessorService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.customerData=this._CustomerHttpService.Data,this.posState=e.posState,e.posState===_.isPark&&(this.posData.ContactName=null)}),this._outletService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.selectedRegister=e,this.sales=e.ListSales})}subscribeToCartItemsChange(){let e=0;this._orderDataService.Data$.pipe((0,m.R)(this.destroy$),(0,V.h)(n=>e!=n.TotalQuantity)).subscribe(n=>{e=n.TotalQuantity,this._orderProcessorService.reedemPointToDiscount()})}openRegisterModal(){this._matDialog.open(re,{id:"registerModal"}).afterClosed().subscribe(n=>{n&&this.openOpeningCashModal()})}openOpeningCashModal(){this.appConfig.ModuleShift.Closure.Enabled&&this.appConfig.ModuleShift.Closure.OpeningCashRequired&&this._matDialog.open(se).afterClosed().subscribe(n=>{n&&null!=n.amount&&(this._CoreHttpService.recordOpeningCash({RegisterID:this.posData.Order.RegisterID,OpAmount:n.amount}),document.getElementById("product").focus())})}openCustomerModal(){this._matDialog.open(_e,{autoFocus:!1}).afterClosed().subscribe(e=>{e&&(this._orderProcessorService.pushNewValue(this._orderProcessorService.Data),this.updateDiscountRate(e.DiscountRate))})}cashierShowPointModal(){this._orderProcessorService.Data.posState!=_.IsEdit?this._matDialog.open(Vn,{data:{pointUsed:this.customerData.PointUsed,availablePoint:this.customerData.Point,label:this.customerData.Label}}).afterClosed().subscribe(i=>{if(i){let a=i.pointUsed,s=this.appConfig.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,l=i.pointUsed*s;const d=this.posData.RedeemableAmount;l>d&&(a=Math.ceil(d/s),l=d,this._toastrService.warning("You enter the number of points more than the total amount","Points Adjusted")),this.posData.Order.PointUsed=a,this.posData.Order.DiscountAmount=l,this._orderDataService.pushNewValue(this.posData)}}):this._toastrService.warning("Apply Loyalty Point is not allowed in edit mode","Warning!")}updateSales(){this.salesPersonName=this.sales.filter(e=>e.ID==this.posData.Order.SalesID)[0]?.Name,this._orderDataService.pushNewValue(this.posData)}checkIsNotToday(e){if(e){const n=new Date;n.setHours(0,0,0,0),this.isNotToday=n.getTime()!=e.getTime()}}inputNumberModelChanged(e){this.posData.Order.Number=e}onInputCustomer(e){this._orderProcessorService.Data.InputTextValue=e,null!==e&&0==e.length&&(this.resetCustomerPricebook(),this.posData.Order.PointUsed=0,this.posData.Order.DiscountAmount=0,this.previousCustomerID=JSON.parse(JSON.stringify(this.posData.Order.CustomerID)),this.posData.Order.CustomerID=null,this._CustomerHttpService.Data=new wt.B,this.customerData=new wt.B,this.updateDiscountRate())}resetCustomerPricebook(){if(this.customerData){let e=this.customerData.PricebookID;c.gT.IsNotEmpty(e)&&(this.posData.CartItems=this.posData.CartItems.map(i=>(i.PriceBookID==e&&(i.Discount=i.Variant.PriceDiscount,i.Note=i.Variant.PriceNote,i.PriceNote=i.Variant.PriceNote,i.PriceBookID=c.gT.GuidEmpty,i.Price=i.Variant.UnitPrice,i.UnitPrice=i.Variant.UnitPrice),i)))}}onScanCodeCustomer(e){this.posData.ContactName=null,0!==e.length&&this._CustomerHttpService.findCustomerByCode(e).pipe((0,m.R)(this.destroy$)).subscribe(n=>{this.posData.ContactName=n.Display,this.onCustomerSelected(n.ID)})}onCustomerSelected(e){this.previousCustomerID=JSON.parse(JSON.stringify(this.posData.Order.CustomerID)),this.resetCartOnChangeCustomer(e),c.gT.IsNotEmpty(e)&&this._orderDataService.updateCustomerID(e).then(n=>{this.applyCustomerPricebook(n),this.updateTaxCustomer(n.TaxTypeId),c.gT.IsNotEmpty(n.SalesID)&&(this.posData.Order.SalesID=n.SalesID),n.EntityID==c.gT.GuidEmpty?this.customerData=n:n.EntityID!=this.posData.Order.EntityID?(this.posData.Order.CustomerID=null,this.posData.ContactName=null,alert("your customer has a exclusive outlet")):this.customerData=n,null==this.customerData.DiscountRate&&(this.customerData.DiscountRate=0),this.updateDiscountRate(this.customerData.DiscountRate);let i=this.checkResetRedeemPoint();this._orderProcessorService.reedemPointToDiscount(i)})}checkResetRedeemPoint(){let e=!1;return c.gT.IsNotEmpty(this.previousCustomerID)&&(e=!0),e}applyCustomerPricebook(e){if(c.gT.IsNotEmpty(e.PricebookID)){let n=this.posData.CartItems.map(i=>(i.Variant.PriceBook&&0!==i.Variant.PriceBook.length&&i.Variant.PriceBook.forEach(a=>{a.ID===e.PricebookID&&(i=this._shoppingCartService.applyPricebookToItem(i,a))}),i));this.posData.CartItems=n}}updateDiscountRate(e=0){this.posData.Order.Discount=e,this._orderDataService.pushNewValue()}updateTaxCustomer(e){let i=this._posService.Data.Taxes.find(a=>a.ID==e);i&&(this._orderDataService.Data.Order.TaxTypeID=i.ID,this._invoiceCalculatorService.tax=i,this._orderDataService.pushNewValue())}checkCustomerEmpty(e){let n=c.gT.IsNotEmpty(e);return e&&e.length<c.gT.GuidEmpty.length&&(n=!1),n}resetCartOnChangeCustomer(e){this.selectedCustomerId!=e&&this.appConfig.ModuleSell.Customer.ClearCartOnChange&&(this.posData.CartItems=[],this._orderDataService.pushNewValue(this.posData)),this.selectedCustomerId=e}displayRegisterName(e){let n="Choose an Outlet";const i=this.findOutletRegisterById(e.RegisterID);return null!=i&&null!=i.Name&&(n=i.Name),n}findOutletRegisterById(e){return this._posService.Data.Registers.find(a=>a.ID===e)}ngOnDestroy(){this._CustomerHttpService.Data=null,this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(x.q),t.Y36(q),t.Y36(v),t.Y36(C),t.Y36(h.uw),t.Y36(Z),t.Y36(tt.r),t.Y36(I._W),t.Y36(K),t.Y36(Bt),t.Y36(L),t.Y36(at))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-toolbar"]],decls:17,vars:34,consts:[[1,"row","header","g-0","py-4"],["data-cy","ChooseRegister"],["title","Outlet",1,"fa","fa-home"],["placeholder","Choose an outlet","readonly","",1,"outlet","cursor","mobile-view",3,"disabled","value","click"],["appearance","legacy","data_cy","soDate","name","orderDate",3,"ngClass","disabled","date","dateChange"],["aria-hidden","true","title","Sales order number",1,"fa","fa-hashtag"],["type","text","data-cy","soNumber","required","","placeholder","Sales Order Number",1,"number",2,"margin-left","3px",3,"ngModel","disabled","ngModelChange"],[3,"hidden"],["aria-hidden","true","title","Invoice number",1,"fa-regular","fa-file-alt"],["type","text","required","","placeholder","Invoice Number",1,"number",3,"ngModel","disabled","ngModelChange"],[3,"class",4,"ngIf"],["aria-hidden","true","title","sales",1,"fa","fa-id-badge","align-middle"],["bindValue","ID","bindLabel","Name","width","185px","position","top","placeholder","Sales Person",1,"sales-person",3,"items","selected","customTooltip","selectedChange"],[3,"customerData","role","enabledPoint","showPointModal",4,"ngIf"],["aria-hidden","true","title","Customer",1,"fa","fa-user"],["data_cy","Contact","requestUrl","/API/AC/GetCustomerSuggestion","placeholder","Customer","inputID","ContactID","notFoundMessageFor","customer",3,"inputTextValue","inputLock","onInputChange","onSelect","onInputEnter"],["id","btnCustomer","class","ms-1 pointer","title","New Customer Form",3,"click",4,"ngIf"],[3,"customerData","role","enabledPoint","showPointModal"],["id","btnCustomer","title","New Customer Form",1,"ms-1","pointer",3,"click"],["data-cy","btnCust","aria-hidden","true",1,"fa","fa-plus-circle"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0)(1,"div",1),t._UZ(2,"i",2),t.TgZ(3,"input",3),t.NdJ("click",function(){return n.openRegisterModal()}),t.ALo(4,"limitTo"),t.qZA()(),t.TgZ(5,"div")(6,"datepicker",4),t.NdJ("dateChange",function(a){return(null==n.posData?null:n.posData.Order).Date=a})("dateChange",function(a){return n.checkIsNotToday(a)}),t.qZA()(),t.TgZ(7,"div"),t._UZ(8,"i",5),t.TgZ(9,"input",6),t.NdJ("ngModelChange",function(a){return n.inputNumberModelChanged(a)}),t.qZA()(),t.TgZ(10,"div",7),t._UZ(11,"i",8),t.TgZ(12,"input",9),t.NdJ("ngModelChange",function(a){return(null==n.posData?null:n.posData.Invoice).Number=a}),t.qZA()(),t.YNc(13,so,5,7,"div",10),t.TgZ(14,"div"),t._UZ(15,"i",11),t.TgZ(16,"ng-select-infinite",12),t.NdJ("selectedChange",function(a){return(null==n.posData?null:n.posData.Order).SalesID=a})("selectedChange",function(){return n.updateSales()}),t.qZA()()()),2&e&&(t.xp6(1),t.Gre("col-auto ",n.salesOrderNumberingVisible?"small":"",""),t.xp6(2),t.Q6J("disabled",n.isEditState)("value",t.xi3(4,29,n.displayRegisterName(n.selectedRegister),20)),t.xp6(2),t.Gre("col-auto date ",n.salesOrderNumberingVisible?"small":""," mobile-view"),t.xp6(1),t.Q6J("ngClass",t.VKq(32,lo,n.isNotToday))("disabled",!n.role.DateEditor)("date",null==n.posData?null:n.posData.Order.Date),t.xp6(1),t.Gre("col-auto number ",n.salesOrderNumberingVisible?"small":""," mobile-view"),t.xp6(2),t.Q6J("ngModel",null==n.posData?null:n.posData.Order.Number)("disabled",!n.role.NumberEditor),t.xp6(1),t.Gre("col-auto ",n.salesOrderNumberingVisible?"small":""," mobile-view"),t.Q6J("hidden",!n.salesOrderNumberingVisible),t.xp6(2),t.Q6J("ngModel",null==n.posData?null:n.posData.Invoice.Number)("disabled",!n.role.NumberEditor),t.xp6(1),t.Q6J("ngIf",n.isOnline),t.xp6(1),t.Gre("col-auto d-flex flex-row sales ",n.salesOrderNumberingVisible?"small":""," mobile-view"),t.xp6(2),t.Q6J("items",n.sales)("selected",null==n.posData?null:n.posData.Order.SalesID)("customTooltip",n.salesPersonName))},dependencies:[g.mk,g.O5,gt.QB,u.Fj,u.JJ,u.Q7,u.On,st.J,Jt.R,he.i,io,k.OI],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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.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}.small[_ngcontent-%COMP%]{margin-right:5px!important}.small[_ngcontent-%COMP%] .number[_ngcontent-%COMP%]{width:143px}.small[_ngcontent-%COMP%] select[_ngcontent-%COMP%]{width:140px}.small[_ngcontent-%COMP%] .select2-container[_ngcontent-%COMP%]{font-size:12px}.col-auto[_ngcontent-%COMP%]{font-size:.875rem;height:-moz-fit-content;height:fit-content}.col-auto[_ngcontent-%COMP%]:last-child{margin-right:0}.col-auto.date[_ngcontent-%COMP%]{margin-left:38px}.col-auto.date[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{top:3px!important}.col-auto.date[_ngcontent-%COMP%] datepicker[_ngcontent-%COMP%] mat-form-field{padding-right:0!important;background:white}.col-auto.date[_ngcontent-%COMP%] datepicker[_ngcontent-%COMP%] mat-form-field .mat-form-field-wrapper{padding-bottom:0}.col-auto.date[_ngcontent-%COMP%] datepicker[_ngcontent-%COMP%] .mat-form-field-flex{width:117px;height:36px;border:1px solid rgb(221,221,221)}.col-auto.date[_ngcontent-%COMP%] datepicker[_ngcontent-%COMP%] .mat-form-field-infix{border:none!important;top:5px}.col-auto.date[_ngcontent-%COMP%] datepicker[_ngcontent-%COMP%] .mat-form-field-infix input{font-size:14px;color:#000;padding-left:5px}.col-auto.date[_ngcontent-%COMP%] datepicker[_ngcontent-%COMP%] .mat-form-field-suffix{left:-128px;top:2px}.col-auto.date[_ngcontent-%COMP%] datepicker[_ngcontent-%COMP%] .mat-form-field-suffix .mat-button-wrapper{color:#000}.col-auto.date[_ngcontent-%COMP%] datepicker[_ngcontent-%COMP%] .mat-form-field-underline{display:none}.col-auto.date[_ngcontent-%COMP%] datepicker.date-warnings[_ngcontent-%COMP%] .mat-form-field-flex{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px,#f9e79f 30px)!important}.col-auto[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:1.25rem;color:#3b3b3b;margin-right:5px;line-height:unset!important;position:relative;top:2px}.col-auto[_ngcontent-%COMP%] input[_ngcontent-%COMP%], .col-auto[_ngcontent-%COMP%] span.outlet[_ngcontent-%COMP%]{padding:4px 8px 3px 5px;border:1px solid #dddddd;font-size:.875rem}.col-auto[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{height:36px}.col-auto[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:disabled{background-color:#e9ecef!important;opacity:1!important;color:#00000061!important}.col-auto[_ngcontent-%COMP%] .outlet[_ngcontent-%COMP%]{width:165px;color:#337ab7;background:#ffffff}.col-auto[_ngcontent-%COMP%] .number[_ngcontent-%COMP%]{width:135px}.col-auto.customer[_ngcontent-%COMP%] autocomplete[_ngcontent-%COMP%] input{font-size:14px}.col-auto.customer[_ngcontent-%COMP%] autocompleteV2[_ngcontent-%COMP%] input{font-size:14px}.col-auto.sales[_ngcontent-%COMP%] ng-select[_ngcontent-%COMP%] input{font-size:14px}.col-auto[_ngcontent-%COMP%] ng-select[_ngcontent-%COMP%]{width:135px}.header[_ngcontent-%COMP%]{border-bottom:1px solid #dde2eb}.number[_ngcontent-%COMP%], .customer[_ngcontent-%COMP%]{margin-left:9px}.sales[_ngcontent-%COMP%]{margin-left:5px}@media (max-width: 575.98px){.mobile-view[_ngcontent-%COMP%]{margin-top:5px}.mobile-view[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:75%!important}}"]}),o})(),po=(()=>{class o{constructor(e,n,i,a,s){this._dialogRef=e,this.toastr=n,this._shoppingCartService=i,this._OrderHttpService=a,this._orderDataService=s,this.modalConfig=new D.O,this.produk=[],this.items=[],this.properties="",this.objek=[],this.flag=!1,this.modalConfig.title="Upload",this.modalConfig.customWidth="284px"}ngOnInit(){this._orderDataService.Data$.subscribe(e=>{this.cart=e.CartItems})}onFileLoad(e){this.csvContent=e.target.result;let i=!1,a=[],s=[],l=0;for(const d of this.csvContent.split(/[\r\n]+/))if(i){let f={};for(let b=0;b<l;b++)f[s[b]]=d.split(",")[b];a.push(f)}else{for(let f=0;f<d.split(",").length;f++)l=d.split(",").length,s.push(d.split(",")[f].replace(/ /g,""));i=!0}this.produk=a.filter(d=>""!=d.Code),localStorage.setItem("uploadcsv",JSON.stringify(this.produk)),this.flag=!0}onFileSelect(e){localStorage.removeItem("uploadcsv");const n=e.files,i=["csv"];if(n&&n.length){const a=e.files[0].name.split(".").pop().toLowerCase();if(i.indexOf(a)>-1){const l=n[0],d=new FileReader;d.onload=this.onFileLoad,d.readAsText(l,"UTF-8")}else this.toastr.error("Invalid File Type","Failed")}}onOk(){const e=localStorage.getItem("uploadcsv"),n=this._orderDataService.Data;this.produk=JSON.parse(e),this.produk&&(this._OrderHttpService.UploadCSV(this.produk,n.Order.EntityID).subscribe(i=>{let a;localStorage.removeItem("uploadcsv");for(const s of i)a=new G.t,s.Variant.UnitPrice=s.Price,s.Variant.UnitCost=s.Cost,s.Variant.PriceDiscount=s.Discount,a.Quantity=s.Quantity,a.patchByVariant(s.Variant,!0),a.Note=s.Note?s.Note:a.Note,a.DiscountAmount=s.DiscountAmount,this._shoppingCartService.pushNewItemToArray(a)},i=>{localStorage.removeItem("uploadcsv")}),this.close())}close(){this._dialogRef.close()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(I._W),t.Y36(at),t.Y36(N.D),t.Y36(v))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-upload"]],decls:14,vars:1,consts:[[3,"config","onOk","onCancel","onClose"],[1,"modal-dialog"],[1,"modal-content","border-0"],["href","https://res.cloudinary.com/pos/raw/upload/v1629353710/POS/CSV/ImportInSell_DealPOS_New.csv",1,"noteBox"],[1,"d-flex","justify-content-between"],["accept",".csv","id","csv","type","file","name","myfile",1,"form-control",3,"change"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return n.onOk()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),t.TgZ(1,"content",1)(2,"div",2)(3,"div")(4,"a",3),t._uU(5,"Download Sample File"),t.qZA()(),t.TgZ(6,"div",4)(7,"table")(8,"tbody")(9,"tr")(10,"th"),t._uU(11," CSV: "),t.qZA(),t.TgZ(12,"td")(13,"input",5),t.NdJ("change",function(a){return n.onFileSelect(a.target)}),t.qZA()()()()()()()()()),2&e&&t.Q6J("config",n.modalConfig)},dependencies:[y.M],styles:[".noteBox[_ngcontent-%COMP%]{background-color:#ffffe1;border:1px solid #cacaca;padding:3px;display:block;outline:0;margin-bottom:5px;font-size:11px;text-decoration:none}"]}),o})(),fe=(()=>{class o{constructor(e,n){this.data=e,this._dialogRef=n,this.modalConfig=new D.O,this.message=e.message,this.initModal()}initModal(){this.modalConfig.title=this.data.title,this.modalConfig.headerType=U.n.Success,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0,this.modalConfig.hideFooter=!0}close(){this._dialogRef.close()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.WI),t.Y36(h.so))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-info"]],decls:4,vars:2,consts:[[3,"config","onCancel"],[1,"fw-normal","d-flex","justify-content-center"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onCancel",function(){return n.close()}),t.TgZ(1,"content")(2,"h4",1),t._uU(3),t.qZA()()()),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(3),t.Oqu(n.message))},dependencies:[y.M]}),o})();var ut=(()=>{return(o=ut||(ut={}))[o.RequireAuthorization=0]="RequireAuthorization",o[o.DoNotRequireAuthorization=1]="DoNotRequireAuthorization",o[o.DoNotRequireAuthorizationNSyncCost=2]="DoNotRequireAuthorizationNSyncCost",ut;var o})(),uo=p(69753),mt=(()=>{return(o=mt||(mt={}))[o.SELL_INPUT=0]="SELL_INPUT",o[o.PRODUCT=1]="PRODUCT",mt;var o})();function mo(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"tr")(1,"td"),t._uU(2),t.qZA(),t.TgZ(3,"td")(4,"input",3),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.otherModel=i)})("ngModelChange",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.onOtherChange())}),t.qZA()(),t.TgZ(5,"td"),t._uU(6,"X"),t.qZA(),t.TgZ(7,"td")(8,"input",3),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.otherMultiplier=i)})("ngModelChange",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.onOtherChange())}),t.qZA()()()}if(2&o){const e=t.oxw();t.xp6(2),t.Oqu(null==e.appConfigJSON||null==e.appConfigJSON.ModuleSell||null==e.appConfigJSON.ModuleSell.ProductDialog?null:e.appConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel),t.xp6(2),t.Q6J("disabled",e.qtyDisabled)("ngModel",e.otherModel),t.xp6(4),t.Q6J("disabled",e.qtyDisabled)("ngModel",e.otherMultiplier)}}let _o=(()=>{class o{constructor(e){this._posService=e,this.qtyChange=new t.vpe,this.priceChange=new t.vpe,this.otherChange=new t.vpe,this.qtyDisabled=!1,this.priceDisabled=!1,this.appConfigJSON=this._posService.Data.AppConfigJSON}onPriceChange(){let e=this.priceModel?parseFloat(this.priceModel):0,n=this.priceMultiplier?parseFloat(this.priceMultiplier):0;this.priceChange.emit(e*n)}onQtyChange(){let e=this.qtyModel?parseFloat(this.qtyModel):0,n=this.qtyMultiplier?parseFloat(this.qtyMultiplier):0;this.qtyChange.emit(e*n)}onOtherChange(){let e=this.otherModel?parseFloat(this.otherModel):0,n=this.otherMultiplier?parseFloat(this.otherMultiplier):0;this.otherChange.emit(e*n)}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(C))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-calculator"]],inputs:{left:"left",top:"top",appConfigJSON:"appConfigJSON",qtyDisabled:"qtyDisabled",priceDisabled:"priceDisabled"},outputs:{priceChange:"priceChange",qtyChange:"qtyChange",otherChange:"otherChange"},decls:24,vars:15,consts:[[1,"price_calculator","arrow_box","arrow_box_left"],[1,"header","bg-warning","text-white"],[1,"table","table-sm","table-borderless"],["type","text",3,"disabled","ngModel","ngModelChange"],[4,"ngIf"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0)(1,"span",1),t._uU(2,"Calculator"),t.qZA(),t.TgZ(3,"table",2)(4,"tbody")(5,"tr")(6,"td"),t._uU(7,"Qty"),t.qZA(),t.TgZ(8,"td")(9,"input",3),t.NdJ("ngModelChange",function(a){return n.qtyModel=a})("ngModelChange",function(){return n.onQtyChange()}),t.qZA()(),t.TgZ(10,"td"),t._uU(11,"X"),t.qZA(),t.TgZ(12,"td")(13,"input",3),t.NdJ("ngModelChange",function(a){return n.qtyMultiplier=a})("ngModelChange",function(){return n.onQtyChange()}),t.qZA()()(),t.YNc(14,mo,9,5,"tr",4),t.TgZ(15,"tr")(16,"td"),t._uU(17,"Price"),t.qZA(),t.TgZ(18,"td")(19,"input",3),t.NdJ("ngModelChange",function(a){return n.priceModel=a})("ngModelChange",function(){return n.onPriceChange()}),t.qZA()(),t.TgZ(20,"td"),t._uU(21,"X"),t.qZA(),t.TgZ(22,"td")(23,"input",3),t.NdJ("ngModelChange",function(a){return n.priceMultiplier=a})("ngModelChange",function(){return n.onPriceChange()}),t.qZA()()()()()()),2&e&&(t.Udp("position","absolute")("left",n.left+"%")("top",n.top+"%"),t.xp6(9),t.Q6J("disabled",n.qtyDisabled)("ngModel",n.qtyModel),t.xp6(4),t.Q6J("disabled",n.qtyDisabled)("ngModel",n.qtyMultiplier),t.xp6(1),t.Q6J("ngIf",null==n.appConfigJSON||null==n.appConfigJSON.ModuleSell||null==n.appConfigJSON.ModuleSell.ProductDialog?null:n.appConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel),t.xp6(5),t.Q6J("disabled",n.priceDisabled)("ngModel",n.priceModel),t.xp6(4),t.Q6J("disabled",n.priceDisabled)("ngModel",n.priceMultiplier))},dependencies:[g.O5,u.Fj,u.JJ,u.On],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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.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}div.price_calculator[_ngcontent-%COMP%]{left:calc((100vw - 725px)/2 - 250px);top:85px;width:250px;height:max-content;padding-top:20px;border-radius:3px;position:fixed!important}div.price_calculator[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{border:0px!important;border-bottom:1px solid #dddddd!important;background-color:transparent!important;padding:8px 5px 5px!important;width:60px!important}.arrow_box[_ngcontent-%COMP%]{position:relative;background:#ffffff;border:2px solid #dddddd}.arrow_box[_ngcontent-%COMP%]:after, .arrow_box[_ngcontent-%COMP%]:before{right:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}.arrow_box[_ngcontent-%COMP%]:after{border-color:#eee0;border-right-color:#fff;border-width:6px;top:50%;margin-top:-6px}.arrow_box[_ngcontent-%COMP%]:before{border-color:#c8d3df00;border-right-color:#ddd;border-width:9px;top:50%;margin-top:-9px}.arrow_box[_ngcontent-%COMP%] > .header[_ngcontent-%COMP%]{font-size:.65625rem;padding:1px 2px 1px 3px;position:absolute;top:0;right:0;border-radius:0 0 0 3px}.arrow_box_left[_ngcontent-%COMP%]:after, .arrow_box_left[_ngcontent-%COMP%]:before{left:100%!important}.arrow_box_left[_ngcontent-%COMP%]:after{border-left-color:#fff!important;border-right-color:transparent!important}.arrow_box_left[_ngcontent-%COMP%]:before{border-left-color:#ddd!important;border-right-color:transparent!important}.more[_ngcontent-%COMP%]{position:absolute;top:0px;left:30px}']}),o})(),ho=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=t.oAB({type:o}),o.\u0275inj=t.cJS({imports:[g.ez,u.u5]}),o})();var Ce=p(29080),Wt=p(54825);const fo=["quantity"],Co=["price"],bo=["discount"],be=function(o){return{selected:o}};function Po(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",8),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.onTabChange(i.modalItemState.PRODUCT))}),t._uU(1," Product "),t.qZA()}if(2&o){const e=t.oxw();t.Q6J("ngClass",t.VKq(1,be,e.modalItemState.PRODUCT==e.currentState))}}function Mo(o,r){if(1&o){const e=t.EpF();t.ynx(0),t.TgZ(1,"div",23)(2,"div",18)(3,"autocompleteV2",24,25),t.NdJ("onSelect",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.onAddItem(i))})("onInputEnter",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.onEnterProductCode(i))}),t.qZA()()(),t.BQk()}if(2&o){const e=t.oxw(2);t.xp6(3),t.Q6J("localStorage","products")("inputTextValue",null==e.cartItem||null==e.cartItem.Variant?null:e.cartItem.Variant.Name)("clearOnSelect",!1)}}function yo(o,r){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.qZA()),2&o){const e=t.oxw(3);t.xp6(1),t.hij("(",null==e.cartItem.Variant?null:e.cartItem.Variant.UOMName,")")}}function vo(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",34)(1,"strong")(2,"span"),t._uU(3),t.qZA()(),t.TgZ(4,"input",38),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(3);return t.KtG(a.cartItem.UnitQuantity=i)}),t.qZA()()}if(2&o){const e=t.oxw(3);t.xp6(3),t.Oqu(e.AppConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel),t.xp6(1),t.Q6J("preventNegative",!0)("readOnly",null==e.cartItem?null:e.cartItem.PromotionGift)("ngModel",e.cartItem.UnitQuantity)}}function Oo(o,r){if(1&o&&(t._UZ(0,"input",39),t.ALo(1,"number")),2&o){const e=t.oxw(3);t.Q6J("value",t.lcZ(1,1,e.cartItem.Price))}}function xo(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"input",40,41),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(3);return t.KtG(a.cartItem.Price=i)}),t.qZA()}if(2&o){const e=t.oxw(3);t.Q6J("simpleKeyboard",e.keyboard)("readonly",!e.unitPriceEditor||(null==e.cartItem?null:e.cartItem.PromotionGift))("ngModel",e.cartItem.Price)}}function Do(o,r){if(1&o&&(t._UZ(0,"input",39),t.ALo(1,"number")),2&o){const e=t.oxw(3);t.Q6J("value",t.lcZ(1,1,e.cartItem.Discount))}}function So(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"input",42,43),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(3);return t.KtG(a.updateDiscountPercentage(i))}),t.qZA()}if(2&o){const e=t.oxw(3);t.Q6J("simpleKeyboard",e.keyboard)("ngModel",e.cartItem.Discount)("readonly",!e.role.Discount||(null==e.cartItem?null:e.cartItem.PromotionGift))}}function To(o,r){if(1&o&&(t._UZ(0,"input",39),t.ALo(1,"number")),2&o){const e=t.oxw(3);t.Q6J("value",t.lcZ(1,1,e.cartItem.DiscountAmount))}}function Io(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"input",44,37),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(3);return t.KtG(a.cartItem.DiscountAmount=i)}),t.qZA()}if(2&o){const e=t.oxw(3);t.Q6J("simpleKeyboard",e.keyboard)("ngModel",e.cartItem.DiscountAmount)("readonly",!e.role.Discount||(null==e.cartItem?null:e.cartItem.PromotionGift))}}function ko(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",26)(1,"div",27)(2,"strong"),t._uU(3," Qty "),t.YNc(4,yo,2,1,"span",7),t.qZA(),t.TgZ(5,"input",28,29),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.updateItemQuantity(i))}),t.qZA()(),t.YNc(7,vo,5,4,"div",30),t.TgZ(8,"div",31)(9,"strong"),t._uU(10,"Price"),t.qZA(),t.YNc(11,Oo,2,3,"input",32),t.YNc(12,xo,2,3,"ng-template",null,33,t.W1O),t.qZA(),t.TgZ(14,"div",34)(15,"strong"),t._uU(16,"Discount %"),t.qZA(),t.YNc(17,Do,2,3,"input",32),t.YNc(18,So,2,3,"ng-template",null,35,t.W1O),t.qZA(),t.TgZ(20,"div",36)(21,"strong"),t._uU(22,"Disc. Amount"),t.qZA(),t.YNc(23,To,2,3,"input",32),t.YNc(24,Io,2,3,"ng-template",null,37,t.W1O),t.qZA()()}if(2&o){const e=t.MAs(13),n=t.MAs(19),i=t.MAs(25),a=t.oxw(2);t.xp6(4),t.Q6J("ngIf",(null==a.cartItem.Variant?null:a.cartItem.Variant.UOM)&&(null==a.cartItem.Variant?null:a.cartItem.Variant.UOMName)),t.xp6(1),t.Q6J("simpleKeyboard",a.keyboard)("preventNegative",!a.role.Return)("ngModel",a.cartItem.Quantity)("readOnly",(null==a.cartItem?null:a.cartItem.PromotionGift)||a.checkQtyInputDisabled()),t.xp6(2),t.Q6J("ngIf",a.AppConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel),t.xp6(1),t.Q6J("hidden",a.priceVisibleRestriction),t.xp6(3),t.Q6J("ngIf",!a.unitPriceEditor||(null==a.cartItem?null:a.cartItem.PromotionGift))("ngIfElse",e),t.xp6(6),t.Q6J("ngIf",!a.role.Discount||(null==a.cartItem?null:a.cartItem.PromotionGift))("ngIfElse",n),t.xp6(6),t.Q6J("ngIf",!a.role.Discount||(null==a.cartItem?null:a.cartItem.PromotionGift))("ngIfElse",i)}}function Ao(o,r){if(1&o){const e=t.EpF();t.ynx(0),t.TgZ(1,"div",45)(2,"strong"),t._uU(3,"Sales Person"),t.qZA(),t.TgZ(4,"ng-select-infinite",46),t.NdJ("selectedChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.updateSales(i))})("selectedChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.cartItem.SalesID=i)}),t.qZA()(),t.BQk()}if(2&o){const e=t.oxw(2);t.xp6(4),t.Q6J("customTooltip",e.salesPersonName)("items",e.sales)("selected",e.cartItem.SalesID)}}function wo(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",45)(1,"strong"),t._uU(2,"Fulfillment From"),t.qZA(),t.TgZ(3,"ng-select",47),t.NdJ("ngModelChange",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.onDeliveryEntityChange())})("ngModelChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.cartItem.EntityID=i)}),t.qZA()()}if(2&o){const e=t.oxw(2);t.xp6(3),t.Q6J("items",e.entities)("ngModel",e.cartItem.EntityID)}}function No(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",45)(1,"strong"),t._uU(2,"Pricebook"),t.qZA(),t.TgZ(3,"ng-select",48),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.pricebookId=i)})("ngModelChange",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.pricebookChange())}),t.qZA()()}if(2&o){const e=t.oxw(2);t.xp6(3),t.Q6J("items",null==e.cartItem||null==e.cartItem.Variant?null:e.cartItem.Variant.PriceBook)("ngModel",e.pricebookId)("disabled",e.pricebookDisabled)}}function Zo(o,r){1&o&&(t.TgZ(0,"label",49),t._uU(1,"Note:"),t.qZA())}function Jo(o,r){1&o&&(t.TgZ(0,"label",49),t._uU(1,"Serial:"),t.qZA())}function Ro(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",50)(1,"a",51),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.serialSelectMode=!0)}),t._UZ(2,"i",52),t._uU(3," Back "),t.qZA()()}}function qo(o,r){if(1&o){const e=t.EpF();t.ynx(0),t.YNc(1,Mo,5,3,"ng-container",7),t.YNc(2,ko,26,13,"div",9),t.TgZ(3,"div",10),t.YNc(4,Ao,5,3,"ng-container",7),t.YNc(5,wo,4,2,"div",11),t.YNc(6,No,4,3,"div",11),t.qZA(),t.TgZ(7,"div",12)(8,"div",13),t.YNc(9,Zo,2,0,"label",14),t.YNc(10,Jo,2,0,"label",14),t.YNc(11,Ro,4,0,"div",15),t.qZA(),t.TgZ(12,"div",16)(13,"POS-tinymce-editor",17),t.NdJ("valueChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.cartItem.Note=i)}),t.qZA()()(),t.TgZ(14,"div",12)(15,"div",18)(16,"strong"),t._uU(17,"Serial:"),t.qZA(),t.TgZ(18,"div",19)(19,"ng-select",20),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.cartItem.Serial=i)})("ngModelChange",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.updateSerial())}),t.qZA(),t.TgZ(20,"a",21),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.serialSelectMode=!i.serialSelectMode)}),t._UZ(21,"i",22),t.qZA()()()(),t.BQk()}if(2&o){const e=t.oxw();t.xp6(1),t.Q6J("ngIf","create"===e.statusModal),t.xp6(1),t.Q6J("ngIf",e.cartItem),t.xp6(2),t.Q6J("ngIf",e.isEmptySalesID&&(null==e.sales?null:e.sales.length)>0),t.xp6(1),t.Q6J("ngIf",e.AppConfigJSON.ModuleSell.ProductDialog.SplitDeliveryOutletEnabled&&1==e.salesOrderData.Order.DeliveryStateID),t.xp6(1),t.Q6J("ngIf",null!=e.cartItem.Variant&&null!=(null==e.cartItem||null==e.cartItem.Variant?null:e.cartItem.Variant.PriceBook)&&(null==e.cartItem||null==e.cartItem.Variant?null:e.cartItem.Variant.PriceBook.length)>0),t.xp6(1),t.Q6J("hidden",e.serialSelectMode),t.xp6(2),t.Q6J("ngIf",!e.isSerial()),t.xp6(1),t.Q6J("ngIf",e.isSerial()),t.xp6(1),t.Q6J("ngIf",e.isSerial()),t.xp6(2),t.Q6J("value",e.cartItem.Note),t.xp6(1),t.Q6J("hidden",!e.serialSelectMode),t.xp6(5),t.Q6J("items",e.serials)("ngModel",e.cartItem.Serial)("multiple",!0)("disabled","update"===e.statusModal&&0!==(null==e.initialSerial?null:e.initialSerial.length))}}function Fo(o,r){1&o&&(t.ynx(0),t._UZ(1,"i",71),t.TgZ(2,"h6"),t._uU(3,"No Image"),t.qZA(),t.BQk())}function Qo(o,r){if(1&o&&t._UZ(0,"img",72),2&o){const e=t.oxw(2);t.Q6J("src",e.cartItem.Variant.ThumbnailUrl,t.LSH)}}function Uo(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"tr")(1,"th",68),t._uU(2,"Cost"),t.qZA(),t.TgZ(3,"td",73)(4,"input",74),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.cartItem.Cost=i)}),t.qZA()()()}if(2&o){const e=t.oxw(2);t.xp6(4),t.Q6J("ngModel",e.cartItem.Cost)("readonly",!e.AppConfigJSON.ModuleSell.Cost.Enabled)}}function Eo(o,r){if(1&o&&(t.TgZ(0,"tr")(1,"th",68),t._uU(2,"Content"),t.qZA(),t.TgZ(3,"td",75)(4,"div",76),t._uU(5),t.ALo(6,"number"),t.qZA()()()),2&o){const e=t.oxw(2);t.xp6(5),t.AsE(" ",null==e.cartItem?null:e.cartItem.VariantUnitQuantity," (@",t.lcZ(6,2,e.cartItem.Price/(null==e.cartItem?null:e.cartItem.VariantUnitQuantity)),")")}}function Lo(o,r){if(1&o&&(t.TgZ(0,"div",66)(1,"table",77)(2,"thead")(3,"tr")(4,"th",78),t._uU(5,"Storage Location"),t.qZA()()(),t.TgZ(6,"tbody")(7,"tr")(8,"td"),t._uU(9),t.qZA()()()()()),2&o){const e=t.oxw(2);t.xp6(9),t.hij(" ",e.cartItem.Variant.Storage," ")}}const Vo=function(){return["/menu/Products/Catalog/Variants/Info"]},Yo=function(o){return{ID:o}};function Ho(o,r){if(1&o&&(t.ynx(0),t.TgZ(1,"div",23)(2,"div",53)(3,"a",54),t.YNc(4,Fo,4,0,"ng-container",55),t.YNc(5,Qo,1,1,"ng-template",null,56,t.W1O),t.qZA()(),t.TgZ(7,"div",57)(8,"div",58)(9,"div",59)(10,"div",19),t._UZ(11,"i",60),t.TgZ(12,"div",61),t._uU(13,"Inventory"),t.qZA()(),t.TgZ(14,"table",62)(15,"thead")(16,"tr")(17,"th",63),t._uU(18,"On Hand"),t.qZA(),t.TgZ(19,"th",63),t._uU(20,"Allocated"),t.qZA(),t.TgZ(21,"th",64),t._uU(22,"Available"),t.qZA()()(),t.TgZ(23,"tbody")(24,"tr")(25,"td",65),t._uU(26),t.qZA(),t.TgZ(27,"td",65),t._uU(28),t.qZA(),t.TgZ(29,"td",65),t._uU(30),t.qZA()()()()()(),t.TgZ(31,"div",23)(32,"div",66)(33,"table",67)(34,"thead"),t.YNc(35,Uo,5,2,"tr",7),t.TgZ(36,"tr")(37,"th",68),t._uU(38,"Price"),t.qZA(),t.TgZ(39,"td",69),t._uU(40),t.ALo(41,"number"),t.qZA()(),t.YNc(42,Eo,7,4,"tr",7),t.qZA()()(),t.YNc(43,Lo,10,1,"div",70),t.qZA()()(),t.BQk()),2&o){const e=t.MAs(6),n=t.oxw();t.xp6(3),t.Q6J("routerLink",t.DdM(13,Vo))("queryParams",t.VKq(14,Yo,null==n.cartItem||null==n.cartItem.Variant?null:n.cartItem.Variant.ID)),t.xp6(1),t.Q6J("ngIf",null==(null==n.cartItem||null==n.cartItem.Variant?null:n.cartItem.Variant.ThumbnailUrl))("ngIfElse",e),t.xp6(22),t.hij(" ",n.onHand," "),t.xp6(2),t.hij(" ",n.allocated," "),t.xp6(2),t.hij(" ",n.onHand-n.allocated," "),t.xp6(5),t.Q6J("ngIf",n.AppConfigJSON.ModuleSell.Cost.Visible&&n.role.ShowCost),t.xp6(5),t.hij(" ",t.lcZ(41,11,n.cartItem.Variant.UnitPrice)," "),t.xp6(2),t.Q6J("ngIf",(null==n.cartItem?null:n.cartItem.VariantUnitQuantity)>1),t.xp6(1),t.Q6J("ngIf",(null==n.AppConfigJSON||null==n.AppConfigJSON.ModuleSell||null==n.AppConfigJSON.ModuleSell.Grid?null:n.AppConfigJSON.ModuleSell.Grid.StorageVisible)&&n.cartItem.Variant.Storage)}}function Go(o,r){if(1&o){const e=t.EpF();t.ynx(0),t.TgZ(1,"POS-calculator",79),t.NdJ("priceChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.onCalculatorPrice(i))})("qtyChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.onCalculatorQty(i))})("otherChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.onCalculatorUnitQty(i))}),t.qZA(),t.BQk()}if(2&o){const e=t.oxw();t.xp6(1),t.Q6J("qtyDisabled",e.calculatorQtyDisabled)("priceDisabled",e.calculatorPriceDisabled)("appConfigJSON",e.AppConfigJSON)("top",20)}}let Rt=(()=>{class o extends class go{constructor(){this.modalConfig=new D.O,this.cartItem=new G.t,this.role=new Y.Q,this.serialSelectMode=!1,this.serials=[],this.costVisible=!1,this.unitQtyLabel="Unit Quantity",this.modalConfig.title="Adding new items to order",this.modalConfig.hideScrollbar=!0,this.modalConfig.customWidth="680px",this.onHand=0,this.allocated=0,this.pricebookDisabled=!0}mapAppConfigJson(r){this.numpadVisible=r.ModuleSell.NumPadVisible,this.pricebookCopyDesc=r.ModuleSell.Pricebook.PricebookVisible,this.queryInventoryOnOpen=!1,this.calculatorEnabled=r.ModuleSell.ProductDialog.CalculatorEnabled,this.quantityToOneInDialog=r.ModuleSell.ProductDialog.QuantityToOneInDialog,this.unitQtyLabel=r.ModuleSell.ProductDialog.UnitQtyLabel,this.splitDeliveryOutletEnabled=r.ModuleSell.ProductDialog.SplitDeliveryOutletEnabled}isSerial(){return null!=this.cartItem.Variant&&4==this.cartItem.Variant.TypeID}setUserRole(r){this.role=r,this.unitPriceEditor=this.role.UnitPriceEditor,this.priceVisibleRestriction=this.role.PriceVisibleRestriction,this.pricebookSelector=this.role.PricebookSelector,this.hasInventoryView=this.role.InventoryView}}{constructor(e,n,i,a,s,l,d,f,b,O,R,Q,z,it){super(),this._dialogRef=e,this.data=n,this._shoppingCartService=i,this._outletService=a,this._posService=s,this._orderProcessorService=l,this._orderDataService=d,this._variantService=f,this._toastr=b,this.decimalPipe=O,this._matDialog=R,this._numpadService=Q,this._userRoleService=z,this._onlineStatusService=it,this.AppConfigJSON=new ot,this.isOnline=!0,this.modalItemState=mt,this.destroy$=new T.x,this.entities=this._posService.Data.Entities,this.AppConfigJSON=this._posService.Data.AppConfigJSON,this.mapAppConfigJson(this.AppConfigJSON),this.subscribeToObservableChanges()}ngOnInit(){this.initTabState(),this.serialSelectMode=this.isSerial(),this.initStatusModal(),this.numpadVisible&&(this.keyboard=this._numpadService.keyboard),this.initIsUnitPriceEditor()}updateSales(e){this.salesPersonName=this.sales.filter(n=>n.ID==e)[0].Name}initTabState(){this.currentState=mt.SELL_INPUT}onTabChange(e){this.currentState=e,e==mt.PRODUCT&&!this.queryInventoryOnOpen&&this.getStockItem()}ngAfterViewInit(){setTimeout(()=>{this.initFieldFocus()},200)}initFieldFocus(){switch(this.data&&this.data.focus){case"Price":this._priceElement.nativeElement.focus();break;case"Discount":this._discountElement.nativeElement.focus();break;case"Quantity":this._quantityElement.nativeElement.focus()}}initIsUnitPriceEditor(){const n=this.cartItem.Variant?this.cartItem.Variant.SellPriceType:null;(this.cartItem.Variant?this.cartItem.Variant.TypeID:null)==X.J.NonInventory&&(n==ut.DoNotRequireAuthorization||n==ut.DoNotRequireAuthorizationNSyncCost)&&(this.unitPriceEditor=!0)}initStatusModal(){this.data?(this.updateHeaderTitle(`Editing Cart Item - ${this.cartItem.Variant?this.cartItem.Variant.Name:""}`),this.statusModal="update"):(this.statusModal="create",this.cartItem=this.checkItemQuantityDefault(this.cartItem))}checkItemQuantityDefault(e){return this.quantityToOneInDialog||(e.Quantity=null),e}subscribeToObservableChanges(){this._userRoleService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.setUserRole(e)}),this._orderDataService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.salesOrderData=e,this.initCartItem(e.CartItems),this.checkPriceBookDisabled(),this.checkCalculatorPriceDisabled(),this.checkEmptySalesID()}),this._orderProcessorService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.OrderManager=e,this.checkCalculatorQtyDisabled()}),this._outletService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.sales=e.ListSales}),this._onlineStatusService.getOnlineStatus$().pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.isOnline=e}),this.getSerialVariant()}initCartItem(e){null!=this.data?(this.cartItem=(0,W.d8)(G.t,e[this.data.index]),this.cartItem.EntityID==c.gT.GuidEmpty&&(this.cartItem.EntityID=null),this.oriUnitPrice=c.gT.IsEmpty(this.cartItem.PriceBookID)?this.cartItem.Price:this.cartItem.UnitPriceOriginal,this.oriDiscount=this.cartItem.Discount,this.initialSerial=this.cartItem.Serial,this.pricebookId=this.cartItem.PriceBookID,this.initSelectedPriceBook()):this.cartItem=new G.t}getSerialVariant(){null!=this.cartItem.Variant&&this.isOnline&&4==this.cartItem.Variant.TypeID&&this._variantService.getVariantSerial(this.salesOrderData.Order.EntityID,this.salesOrderData.Order.ID,this.cartItem.VariantID).pipe((0,m.R)(this.destroy$)).subscribe(a=>{this.serials=a})}initSelectedPriceBook(){1===(this.cartItem.Variant&&this.cartItem.Variant.PriceBook?this.cartItem.Variant.PriceBook:[]).length&&!this.cartItem.PriceBookID&&!this.cartItem.PromotionGift&&(this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=this.cartItem.PriceBookID)}checkPriceBookDisabled(){if(this.cartItem.Variant){const n=this.cartItem.Variant.TypeID==X.J.NonInventory&&0==this.cartItem.Variant.SellPriceType&&!this.pricebookSelector;this.pricebookDisabled=this.cartItem.Variant.TypeID!=X.J.NonInventory&&!this.pricebookSelector||n}}checkCalculatorPriceDisabled(){if(this.cartItem.Variant){const n=this.cartItem.Variant.TypeID==X.J.NonInventory&&0==this.cartItem.Variant.SellPriceType&&!this.unitPriceEditor;this.calculatorPriceDisabled=this.cartItem.Variant.TypeID!=X.J.NonInventory&&!this.unitPriceEditor||n}}checkQtyInputDisabled(){let e=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion,n=c.gT.IsNotEmpty(this.cartItem.ID);return!(!e||this.role.Order||this.OrderManager.posState!=_.IsRetrieve||!n)}checkCalculatorQtyDisabled(){this.calculatorQtyDisabled=!this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkOrderDeletion&&this.OrderManager.posState===_.IsRetrieve&&!this.role.Order&&this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion}checkEmptySalesID(){null!=this.salesOrderData.Order&&(this.isEmptySalesID=c.gT.IsEmpty(this.salesOrderData.Order.SalesID))}pricebookChange(){this.cartItem.pricebookUpdate(this.pricebookId,!this.pricebookDisabled,this.pricebookCopyDesc)}updateHeaderTitle(e){this.modalConfig.title=e}onDeliveryEntityChange(){const e=this.entities.find(n=>n.ID==this.cartItem.EntityID);e?this.cartItem.EntityName=e.Name:delete this.cartItem.EntityName}onOk(e){if(!this.validateConfigDefaultQuantity(e))return;this.cartItem.Variant.SellPriceType==ut.DoNotRequireAuthorizationNSyncCost&&(this.cartItem.Cost=this.cartItem.Price);const i=this.cartItem.Cost,a=this.cartItem.UnitPriceOriginal,s=this.cartItem.Price;this.role.PriceMinimum?2==this.AppConfigJSON.ModuleSell.ProductDialog.PriceMinimumTypeID?s<i?this.priceMinimumAlert(i):this.validateOnSubmit():s<a?this.priceMinimumAlert(a):this.validateOnSubmit():this.validateOnSubmit(),document.getElementById("product").focus()}validateConfigDefaultQuantity(e){return!("Enter"==e&&!this.quantityToOneInDialog)||this.cartItem.Quantity>0}validateOnSubmit(){c.gT.IsEmpty(this.cartItem.VariantID)?this._toastr.error("Enter item data before clicking OK!","No item is entered!"):(c.gT.IsEmpty(this.cartItem.Quantity)&&this.updateItemQuantity("1"),this.checkValidateSerialItem(this.cartItem)&&this.onSubmitCartItem())}priceMinimumAlert(e){const n=c.gT.StringFormat("You have no right to sell this item lower than {0}",this.decimalPipe.transform(e));alert(n)}onSubmitCartItem(){if(this.cartItem.SalesOrderItemCommission.SalesName=this.salesPersonName,null==this.data){let e=this.cartItem;this._shoppingCartService.pushNewItemToArray(e,!0),this._shoppingCartService.addAvailableComponent(e)}else this._shoppingCartService.updateCartItem(this.cartItem,this.data.index);this._orderProcessorService.reedemPointToDiscount(),this._dialogRef.close()}onCancel(){this._dialogRef.close()}checkValidateSerialItem(e){const n=this._shoppingCartService.validateSerialItem(e);return n&&this.cartItem.TypeID==X.J.Serialized&&(this.cartItem.Note=this.cartItem.Note.replace("<p>","").replace("</p>","").split(",").toString(),this.cartItem.generateSerial(this.cartItem.Variant)),n}updateItemQuantity(e){this.cartItem.Quantity=Number(e),this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=this.cartItem.PriceBookID}updateDiscountPercentage(e){this.cartItem.Discount=Number(e)}updateOrUnitPrice(e){this.oriUnitPrice=e}quantityEditDisabled(){return this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion&&!this.role.Order&&c.gT.IsNotEmpty(this.cartItem.ID)}updateSerial(){this.cartItem.updateSerial()}onAddItem(e){this._variantService.findVariantByID(e,this.salesOrderData.Order.EntityID).then(i=>{const a=i,s=new G.t;s.patchByVariant(a),this.addItem(s)})}onEnterProductCode(e){this._variantService.findVariantByCode(e,this.salesOrderData.Order.EntityID).then(i=>{if(i){const a=Object.assign(new uo.O,i),s=new G.t;s.patchByVariant(a),this.addItem(s)}else this.onProductNotFound(e)}).catch(i=>{window.alert(`Barcode "${e}" is not registered in the product`)})}onProductNotFound(e){this._matDialog.open(fe,{data:{message:`Barcode "${e}" is not registered in the product`,title:"Product not found"},width:"30%"}),this.playAudio()}playAudio(){const e=new Audio;e.src="/Sounds/bell_ring.mp3",e.load(),e.play()}addItem(e){this.onHand=0,this.AppConfigJSON.ModuleSell.ProductDialog.QuantityToOneInDialog?e.Quantity=1:this._quantityElement.nativeElement.focus(),this.cartItem=this.checkItemQuantityDefault(e);const a=`Editing Cart item - ${e.Variant?e.Variant.Name:null}`;this.updateOrUnitPrice(e.UnitPriceOriginal),this.updateHeaderTitle(a),this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=this.cartItem.PriceBookID,this.getSerialVariant(),this.checkPriceBookDisabled(),this.checkCalculatorPriceDisabled(),this.checkCalculatorQtyDisabled(),this.initIsUnitPriceEditor()}getStockItem(){this._variantService.getStockByID(this.cartItem.VariantID,this.salesOrderData.Order.EntityID).then(e=>{e&&(this.queryInventoryOnOpen=!0,this.allocated=e.Allocated,this.onHand=e.OnHand)})}onCalculatorQty(e){this.updateItemQuantity(e)}onCalculatorPrice(e){this.cartItem.Price=parseFloat(e)}onCalculatorUnitQty(e){this.cartItem.UnitQuantity=parseFloat(e)}resizeCloudinaryImage(e){return e&&(e=e.replace("w_80","w_150")),e}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(h.WI),t.Y36(at),t.Y36(q),t.Y36(C),t.Y36(Z),t.Y36(v),t.Y36(oe),t.Y36(I._W),t.Y36(g.JJ),t.Y36(h.uw),t.Y36(jt.u),t.Y36(K),t.Y36(x.q))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-item"]],viewQuery:function(e,n){if(1&e&&(t.Gf(fo,5),t.Gf(Co,5),t.Gf(bo,5)),2&e){let i;t.iGM(i=t.CRH())&&(n._quantityElement=i.first),t.iGM(i=t.CRH())&&(n._priceElement=i.first),t.iGM(i=t.CRH())&&(n._discountElement=i.first)}},features:[t.qOj],decls:12,vars:8,consts:[[3,"config","onOk","onCancel","onClose"],[1,"mb-5"],[1,"container","w-100","h-100"],[1,"row","border-bottom"],["data-cy","input_sell",1,"btn","btn-link",3,"ngClass","click"],["class","btn btn-link","data-cy","product",3,"ngClass","click",4,"ngIf"],[1,"mt-8"],[4,"ngIf"],["data-cy","product",1,"btn","btn-link",3,"ngClass","click"],["class","row mt-8",4,"ngIf"],[1,"row","mt-6"],["class","col-auto pe-0",4,"ngIf"],[1,"row","mt-6","mb-5",3,"hidden"],[1,"col-sm-12","d-flex","justify-content-between"],["class","fw-bold d-block",4,"ngIf"],["class","mx-3",4,"ngIf"],[1,"col","tinymce"],["height","210px",3,"value","valueChange"],[1,"col"],[1,"d-flex"],["bindLabel","Serial","bindValue","Serial","placeholder","Insert Serial",2,"width","490px","position","fixed","z-index","100",3,"items","ngModel","multiple","disabled","ngModelChange"],[1,"keyboard-serial","ms-auto",3,"click"],[1,"fa-solid","fa-keyboard","fa-2x"],[1,"row"],["inputID","product","requestUrl","/API/AC/GetVariantSuggestionByCodeNName","placeholder","Input product name / code",1,"form-control",3,"localStorage","inputTextValue","clearOnSelect","onSelect","onInputEnter"],["variant",""],[1,"row","mt-8"],[1,"col-auto","mb-4","pe-0",2,"width","82px"],["id","txtCartQuantity","keyboardType","number","type","text","autoNum","",1,"form-control","input-numpad","cart-input",3,"simpleKeyboard","preventNegative","ngModel","readOnly","ngModelChange"],["quantity",""],["class","col-auto pe-0","style","width: 82px",4,"ngIf"],[1,"col-auto","pe-0",2,"width","112px",3,"hidden"],["class","form-control cart-input","disabled","",3,"value",4,"ngIf","ngIfElse"],["PRICE",""],[1,"col-auto","pe-0",2,"width","82px"],["DISCOUNT",""],[1,"col-auto","pe-0",2,"width","112px"],["AMOUNT",""],["type","text","autoNum","",1,"form-control","cart-input","input-numpad",3,"preventNegative","readOnly","ngModel","ngModelChange"],["disabled","",1,"form-control","cart-input",3,"value"],["id","inputPrice","keyboardType","number","type","text","autoNum","",1,"form-control","cart-input",3,"simpleKeyboard","readonly","ngModel","ngModelChange"],["price",""],["id","inputDiscount","keyboardType","number","type","text","autoNum","","percentage","","decimalPlaces","2",1,"form-control","cart-input",3,"simpleKeyboard","ngModel","readonly","ngModelChange"],["discount",""],["id","inputDiscAmount","keyboardType","number","type","text","autoNum","","preventNegative","",1,"form-control","cart-input",3,"simpleKeyboard","ngModel","readonly","ngModelChange"],[1,"col-auto","pe-0"],["position","top","parent","body","bindValue","ID","bindLabel","Name","placeholder","Sales Person",3,"customTooltip","items","selected","selectedChange"],["bindLabel","Name","bindValue","ID","placeholder","Delivery Outlet","appendTo","body",2,"width","200px",3,"items","ngModel","ngModelChange"],["bindLabel","Name","bindValue","ID","placeholder","Pricebook","appendTo","body",2,"width","200px",3,"items","ngModel","disabled","ngModelChange"],[1,"fw-bold","d-block"],[1,"mx-3"],[1,"keyboard-serial","ms-auto",2,"cursor","pointer",3,"click"],[1,"fa-solid","fa-undo","me-2"],[1,"col-sm-4","d-flex","justify-content-center","flex-column","align-items-center","text-muted"],["target","_blank",2,"color","inherit",3,"routerLink","queryParams"],[4,"ngIf","ngIfElse"],["SHOW_IMAGE",""],[1,"col-sm-8"],[1,"row","mb-8"],[1,"col-12"],["aria-hidden","true",1,"fa-archive","fa-solid","fa-1x","pt-3","pe-2"],[2,"font-size","15px","font-family","Roboto Slab"],[1,"table","table-bordered","text-center","inventory-table"],[1,"table-light","py-6","border-end",2,"text-transform","none"],[1,"table-light","py-6",2,"text-transform","none"],[1,"py-6"],[1,"col-6"],[1,"table","table-bordered",2,"width","171px"],[1,"table-light",2,"text-transform","none"],[1,"pe-4","text-end"],["class","col-6",4,"ngIf"],["aria-hidden","true",1,"fa","fa-picture-o","fa-5x"],[1,"border","rounded",3,"src"],[1,"p-0"],["type","text","autoNum","",1,"form-control","border-0","bg-white","text-end",3,"ngModel","readonly","ngModelChange"],[1,"p-3","text-end"],["ngClass","ms-3"],[1,"table","table-bordered","text-center"],[1,"table-light"],[3,"qtyDisabled","priceDisabled","appConfigJSON","top","priceChange","qtyChange","otherChange"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(a){return n.onOk(a)})("onCancel",function(){return n.onCancel()})("onClose",function(){return n.onCancel()}),t.TgZ(1,"content",1)(2,"div",2)(3,"div",3)(4,"div")(5,"a",4),t.NdJ("click",function(){return n.onTabChange(n.modalItemState.SELL_INPUT)}),t._uU(6," Cart "),t.qZA(),t.YNc(7,Po,2,3,"a",5),t.qZA()(),t.TgZ(8,"div",6),t.YNc(9,qo,22,15,"ng-container",7),t.YNc(10,Ho,44,16,"ng-container",7),t.qZA()()()(),t.YNc(11,Go,2,4,"ng-container",7)),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(5),t.Q6J("ngClass",t.VKq(6,be,n.modalItemState.SELL_INPUT==n.currentState)),t.xp6(2),t.Q6J("ngIf",(null==n.cartItem||null==n.cartItem.Variant?null:n.cartItem.Variant.Name)&&n.hasInventoryView),t.xp6(2),t.Q6J("ngIf",n.modalItemState.SELL_INPUT==n.currentState),t.xp6(1),t.Q6J("ngIf",n.modalItemState.PRODUCT==n.currentState),t.xp6(1),t.Q6J("ngIf",n.calculatorEnabled))},dependencies:[g.mk,g.O5,$.w9,u.Fj,u.JJ,u.On,y.M,nt.b,_o,Ce.V,st.J,S.yS,Jt.R,Wt.V,he.i,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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.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}.tinymce[_ngcontent-%COMP%] a[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{z-index:2;position:absolute;right:15px;bottom:19px}.tinymce[_ngcontent-%COMP%] editor[_ngcontent-%COMP%]{height:max-content;z-index:1}.more[_ngcontent-%COMP%]{position:absolute;top:0px;left:30px}.unit-qty[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100px}p-chips[_ngcontent-%COMP%]{width:100%}p-chips[_ngcontent-%COMP%] ul.ui-inputtext{width:100%}p-chips[_ngcontent-%COMP%] ul.ui-inputtext li input.undefined{border:none}.inventory-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .inventory-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{line-height:6px!important}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519}.cart-input[_ngcontent-%COMP%]{height:36px!important}.table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{vertical-align:middle;line-height:15px}ng-select-infinite[_ngcontent-%COMP%] div.ng-select-container{width:200px!important}"]}),o})();function Bo(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",9)(1,"a",10),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.openUploadModal())}),t._UZ(2,"i",11),t.qZA()()}}function Ko(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",9)(1,"a",12),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.openAddItemModal())}),t._UZ(2,"i",13),t.TgZ(3,"small",14),t._uU(4,"(F4)"),t.qZA()()()}}let $o=(()=>{class o{constructor(e,n,i,a,s){this._posService=e,this._orderDataService=n,this._cartService=i,this._matDialog=a,this._outletRegisterService=s,this.posData=new J.m,this.isEdit=!1,this.isOnline=!0,this.AppConfigJSON=new ot,this.renderThumbnail=!1,this.destroy$=new T.x,this.AppConfigJSON=this._posService.Data.AppConfigJSON,this.renderThumbnail=this.AppConfigJSON.ModuleSell.ProductDialog.ShowThumbnail,this.subscribeToObservable()}handleF4(){this._matDialog.openDialogs&&this._matDialog.openDialogs.length>0||this.openAddItemModal()}ngAfterViewInit(){this.setFocusToAutoComplete()}subscribeToObservable(){this._orderDataService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.posData=e,this.Items=e.CartItems,this.setFocusToAutoComplete()}),this._outletRegisterService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.setFocusToAutoComplete()})}setFocusToAutoComplete(){let e=document.getElementById("product");e&&e.focus()}openUploadModal(){this._matDialog.open(po)}openAddItemModal(){this._matDialog.open(Rt)}addItem(e){this._cartService.addCartItemById(e).then(()=>{this.openModalItemOnNew(e)})}onBarcodeScan(e){c.gT.IsNotEmpty(e)&&this._cartService.addCartItemByCode(e).then(n=>{this.openModalItemOnNew(n.ID)})}openModalItemOnNew(e){if(this.AppConfigJSON.ModuleSell.ProductDialog.OpenOnNewItemAdded){let n=this.Items.find(a=>a.VariantID==e),i=this.Items.lastIndexOf(n);this._matDialog.open(Rt,{data:{index:i}})}}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(C),t.Y36(v),t.Y36(at),t.Y36(h.uw),t.Y36(q))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-cart-header"]],hostBindings:function(e,n){1&e&&t.NdJ("keydown.F4",function(a){return n.handleF4(a)},!1,t.Jf7)},decls:14,vars:9,consts:[[1,"row","cart-header","g-0","justify-content-between","align-items-center","p-6"],[1,"col-auto",3,"title"],[1,"fa","fa-shopping-cart","fa-lg","text-success","me-3"],[1,"col-auto"],[1,"input-group","barcode","barcode-input"],[1,"input-group-text","input-group-text"],["aria-hidden","true",1,"fa","fa-barcode"],["data-cy","ProductCart","requestUrl","/API/AC/GetVariantSuggestionByCodeNName","placeholder","Search product by name / code","localStorage","products","inputID","product","notFoundMessageFor","product",1,"input-left",3,"clearOnSelect","renderThumbnail","onSelect","onInputEnter"],["class","col-auto add-item",4,"ngIf"],[1,"col-auto","add-item"],["title","Upload Item","data-bs-toggle","modal",1,"pointer","d-block","position-relative","cart-add",3,"click"],["aria-hidden","true",1,"fa","fa-upload","fa-2x","text-success"],["title","Add Item (F4)",1,"pointer","d-block","position-relative","cart-add",3,"click"],["aria-hidden","true",1,"fa","fa-plus","fa-2x","text-success"],[1,"position-absolute","fst-italic","right-bottom","text-dark"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0)(1,"div",1)(2,"h5"),t._UZ(3,"i",2),t._uU(4),t.ALo(5,"number"),t.qZA()(),t.TgZ(6,"div",3)(7,"div",4)(8,"div",5)(9,"span"),t._UZ(10,"i",6),t.qZA()(),t.TgZ(11,"autocompleteV2",7),t.NdJ("onSelect",function(a){return n.addItem(a)})("onInputEnter",function(a){return n.onBarcodeScan(a)}),t.qZA()()(),t.YNc(12,Bo,3,0,"div",8),t.YNc(13,Ko,5,0,"div",8),t.qZA()),2&e&&(t.xp6(1),t.MGl("title","You have ",n.posData.cartQuantity," items in current sale"),t.xp6(3),t.AsE(" ",n.isEdit?"Update "+(n.posData.Order.ParkLabel??""):"Current Sale "," (",t.lcZ(5,7,n.posData.cartQuantity),") "),t.xp6(7),t.Q6J("clearOnSelect",!0)("renderThumbnail",n.renderThumbnail),t.xp6(1),t.Q6J("ngIf",n.isOnline),t.xp6(1),t.Q6J("ngIf",n.isOnline))},dependencies:[g.O5,st.J,g.JJ],styles:["div.row.cart-header{border:solid 1px #cfcfcf;border-bottom:none;border-radius:3px 3px 0 0;background:#f2f7fa;color:#222}div.row.cart-header .right-bottom{font-size:9px;right:-6px;bottom:-10px}.barcode-input{width:305px}.barcode-input>input{height:28px}.barcode-input autocompleteV2{width:267px}autocompleteV2.input-left>mat-form-field>input.form-control{padding-left:0!important;border-left:0!important}\n"],encapsulation:2}),o})();var qt=p(41206),_t=p(28255),Xt=p(96308);const zo=["cardContainer"];function jo(o,r){1&o&&t._UZ(0,"th")}function Wo(o,r){1&o&&(t.TgZ(0,"th",20),t._uU(1," Brand "),t.qZA())}function Xo(o,r){1&o&&(t.TgZ(0,"th",20),t._uU(1," Inv. "),t.qZA())}function ti(o,r){1&o&&t._UZ(0,"th",21)}function ei(o,r){if(1&o&&(t.TgZ(0,"td")(1,"small"),t._uU(2),t.qZA()()),2&o){const e=t.oxw().index;t.xp6(2),t.hij("",e+1,".")}}function ni(o,r){1&o&&t._UZ(0,"i",41)}function oi(o,r){if(1&o&&(t.TgZ(0,"i",42),t._uU(1),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.Oqu(e.Variant.CategoryName)}}function ii(o,r){1&o&&(t.ynx(0),t.TgZ(1,"i",46),t._uU(2,"V"),t.qZA(),t.BQk())}function ai(o,r){1&o&&(t.TgZ(0,"i",47),t._uU(1,"N"),t.qZA())}function ri(o,r){if(1&o&&(t.TgZ(0,"p",43),t.YNc(1,ii,3,0,"ng-container",44),t.YNc(2,ai,2,0,"ng-template",null,45,t.W1O),t.qZA()),2&o){const e=t.MAs(3),n=t.oxw().$implicit;t.xp6(1),t.Q6J("ngIf",n.Taxable)("ngIfElse",e)}}function si(o,r){if(1&o&&t._UZ(0,"p",48),2&o){const e=t.oxw().$implicit;t.Q6J("innerHtml",e.Note,t.oJD)}}function li(o,r){if(1&o&&(t.TgZ(0,"p")(1,"i",49),t._uU(2),t.qZA()()),2&o){const e=t.oxw().$implicit,n=t.oxw();t.xp6(2),t.hij("Fulfillment from: ",n.getOutletName(e.EntityID),"")}}function ci(o,r){if(1&o&&(t.TgZ(0,"p",50),t._uU(1," Sold by "),t.TgZ(2,"i"),t._uU(3),t.qZA()()),2&o){const e=t.oxw().$implicit,n=t.oxw();t.xp6(3),t.hij(" ",n.getSalesName(e.SalesID)," ")}}function di(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"td",37),t.NdJ("click",function(){t.CHM(e);const i=t.oxw().index,a=t.oxw();return t.KtG(a.openItemModal(i))}),t._uU(1),t.qZA()}if(2&o){const e=t.oxw().$implicit;t.xp6(1),t.hij(" ",e.Variant.BrandName," ")}}function pi(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"td",34),t.NdJ("click",function(){t.CHM(e);const i=t.oxw().index,a=t.oxw();return t.KtG(a.openItemModal(i))}),t.qZA()}if(2&o){const e=t.oxw().$implicit;t.Q6J("innerHtml",e.Variant.UnitsInStock,t.oJD)}}function gi(o,r){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.hij("x",e.UnitQuantity,"")}}function ui(o,r){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.hij("@",e.VariantUnitQuantity,"")}}function mi(o,r){if(1&o&&(t.TgZ(0,"td")(1,"small"),t._uU(2),t.qZA()()),2&o){const e=t.oxw().$implicit;t.xp6(2),t.Oqu("null"!=e.Variant.UOM?e.Variant.UOMName:"")}}function _i(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"tr",22),t.NdJ("contextmenu",function(i){const a=t.CHM(e),s=a.$implicit,l=a.index,d=t.oxw();return t.KtG(d.onContextMenu(i,s,l))}),t.TgZ(1,"td",23)(2,"input",24),t.NdJ("ngModelChange",function(i){const s=t.CHM(e).$implicit;return t.KtG(s.Splited=i)})("click",function(){const a=t.CHM(e).$implicit,s=t.oxw();return t.KtG(s.SplitQuantityValidate(a))}),t.qZA(),t.TgZ(3,"i",25),t.NdJ("click",function(){const a=t.CHM(e).$implicit,s=t.oxw();return t.KtG(s.removeItem(a))}),t.qZA()(),t.YNc(4,ei,3,1,"td",5),t.TgZ(5,"td",26),t.NdJ("click",function(){const a=t.CHM(e).index,s=t.oxw();return t.KtG(s.openItemModal(a))}),t.TgZ(6,"span"),t._uU(7),t.YNc(8,ni,1,0,"i",27),t.qZA(),t.YNc(9,oi,2,1,"i",28),t.YNc(10,ri,4,2,"p",29),t.YNc(11,si,1,1,"p",30),t.YNc(12,li,3,1,"p",5),t.YNc(13,ci,4,1,"p",31),t.qZA(),t.YNc(14,di,2,1,"td",32),t.YNc(15,pi,1,1,"td",33),t.TgZ(16,"td",34),t.NdJ("click",function(){const a=t.CHM(e).index,s=t.oxw();return t.KtG(s.openItemModal(a))}),t.qZA(),t.TgZ(17,"td",21)(18,"input",35),t.NdJ("ngModelChange",function(i){const s=t.CHM(e).$implicit;return t.KtG(s.SplitQuantity=i)})("keyup",function(){const a=t.CHM(e).$implicit,s=t.oxw();return t.KtG(s.SplitQuantityValidate(a))}),t.qZA(),t.TgZ(19,"span",36),t._uU(20,"/"),t.qZA(),t.TgZ(21,"span",37),t.NdJ("click",function(){const a=t.CHM(e).index,s=t.oxw();return t.KtG(s.openItemModal(a,"Quantity"))}),t._uU(22),t.ALo(23,"number"),t.qZA(),t.YNc(24,gi,2,1,"span",5),t.YNc(25,ui,2,1,"span",5),t.qZA(),t.YNc(26,mi,3,1,"td",5),t.TgZ(27,"td",38),t.NdJ("click",function(){const a=t.CHM(e).index,s=t.oxw();return t.KtG(s.openItemModal(a,"Price"))}),t.ALo(28,"number"),t.qZA(),t.TgZ(29,"td",39),t.NdJ("click",function(){const a=t.CHM(e).index,s=t.oxw();return t.KtG(s.openItemModal(a,"Discount"))}),t._uU(30),t.ALo(31,"number"),t.ALo(32,"number"),t.qZA(),t.TgZ(33,"td",40),t.NdJ("click",function(){const a=t.CHM(e).index,s=t.oxw();return t.KtG(s.openItemModal(a))}),t._uU(34),t.ALo(35,"number"),t.qZA()()}if(2&o){const e=r.$implicit,n=t.oxw();t.Q6J("cdkDragDisabled",n.disabledDragItem)("ngClass",5==n.state?"Split":""),t.xp6(2),t.Q6J("ngModel",e.Splited)("hidden",5!=n.state),t.xp6(1),t.Q6J("hidden",5==n.state||n.disabledBilledEdit(e.ID)||n.role.DeleteItemRestriction||n.isRetrieve&&n.AuthorizeParkedOrdersItemDeletion&&"00000000-0000-0000-0000-000000000000"!=e.ID||n.isBill),t.xp6(1),t.Q6J("ngIf",null==n.AppConfigJSON||null==n.AppConfigJSON.ModuleSell?null:n.AppConfigJSON.ModuleSell.Grid.RowNumberVisible),t.xp6(3),t.hij("",e.Variant.Name," "),t.xp6(1),t.Q6J("ngIf",e.PromotionGift),t.xp6(1),t.Q6J("ngIf",null==n.AppConfigJSON||null==n.AppConfigJSON.ModuleSell?null:n.AppConfigJSON.ModuleSell.Grid.CategoryVisible),t.xp6(1),t.Q6J("ngIf",null==n.AppConfigJSON||null==n.AppConfigJSON.ModuleSell?null:n.AppConfigJSON.ModuleSell.Grid.TaxVisible),t.xp6(1),t.Q6J("ngIf",e.Note),t.xp6(1),t.Q6J("ngIf",!n.isEmpty(e.EntityID)),t.xp6(1),t.Q6J("ngIf","00000000-0000-0000-0000-000000000000"!=e.SalesID&&e.SalesID),t.xp6(1),t.Q6J("ngIf",null==n.AppConfigJSON||null==n.AppConfigJSON.ModuleSell?null:n.AppConfigJSON.ModuleSell.Grid.ShowBrandItemCart),t.xp6(1),t.Q6J("ngIf",null==n.AppConfigJSON||null==n.AppConfigJSON.ModuleSell?null:n.AppConfigJSON.ModuleSell.Grid.InventoryVisible),t.xp6(1),t.Q6J("innerHtml",e.Variant.Code,t.oJD),t.xp6(2),t.Q6J("hidden",!(5==n.state&&e.Splited))("ngModel",e.SplitQuantity),t.xp6(1),t.Q6J("hidden",!(5==n.state&&e.Splited)),t.xp6(3),t.Oqu(t.xi3(23,27,e.Quantity,"1.0-4")),t.xp6(2),t.Q6J("ngIf",e.UnitQuantity>1),t.xp6(1),t.Q6J("ngIf",e.VariantUnitQuantity>1),t.xp6(1),t.Q6J("ngIf",null==n.AppConfigJSON||null==n.AppConfigJSON.ModuleSell?null:n.AppConfigJSON.ModuleSell.Grid.UOMVisible),t.xp6(1),t.Q6J("innerHtml",n.role.PriceVisibleRestriction?" - ":t.xi3(28,30,e.Price,"1.0-4"),t.oJD),t.xp6(3),t.AsE(" ",0==e.Discount?"":t.lcZ(31,33,-1*e.Discount)+"%"," ",0==e.DiscountAmount?"":t.lcZ(32,35,-1*e.DiscountAmount)," "),t.xp6(4),t.hij(" ",n.role.PriceVisibleRestriction?" - ":t.lcZ(35,37,e.Total)," ")}}function hi(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",51)(1,"button",52),t.NdJ("click",function(){const a=t.CHM(e).item,s=t.oxw();return t.KtG(s.onReverse(a,!0))}),t._uU(2," Return "),t.qZA(),t.TgZ(3,"button",53),t.NdJ("click",function(){const a=t.CHM(e).item,s=t.oxw();return t.KtG(s.onReverse(a,!1))}),t._uU(4,"Sales"),t.qZA(),t.TgZ(5,"button",52),t.NdJ("click",function(){const a=t.CHM(e).item,s=t.oxw();return t.KtG(s.onSumPrice(a))}),t._uU(6," Merge / SUM Price "),t.qZA(),t.TgZ(7,"button",52),t.NdJ("click",function(){const a=t.CHM(e).item,s=t.oxw();return t.KtG(s.onBundlePrice(a))}),t._uU(8," Bundle Price "),t.qZA()()}if(2&o){const e=t.oxw();t.xp6(1),t.Q6J("disabled",!e.role.Return),t.xp6(4),t.Q6J("disabled",!e.role.BundlingPrice),t.xp6(2),t.Q6J("disabled",!e.role.BundlingPrice)}}let fi=(()=>{class o{constructor(e,n,i,a,s,l,d){this._shoppingCartService=e,this._posService=n,this._outletService=i,this._orderProcessorService=a,this._matDialog=s,this._userRoleService=l,this._orderDataService=d,this.cartItems=[],this.AppConfigJSON=new ot,this.role=new Y.Q,this.isRetrieve=!1,this.AuthorizeParkedOrdersItemDeletion=!1,this.isBill=!1,this.isRemoveItem=!1,this.isUpdateItem=!1,this.contextMenuPosition={x:"0px",y:"0px"},this.destroy$=new T.x,this.AppConfigJSON=this._posService.Data.AppConfigJSON,this.AuthorizeParkedOrdersItemDeletion=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion,this.scrollToBottom()}ngOnInit(){this.subscribeTobservable(),this.checkDisabledDragItem()}ngAfterViewInit(){setTimeout(()=>{this.scrollToBottom()},2e3)}scrollToBottom(){this.cardContainer&&!this.isRemoveItem&&!this.isUpdateItem&&setTimeout(()=>{this.cardContainer.nativeElement.scrollTop=this.cardContainer.nativeElement.scrollHeight},1),this.isRemoveItem=!1,this.isUpdateItem=!1}SelectState(e){switch(e){case _.IsBill:this.isBill=!0;break;case _.IsRetrieve:this.isRetrieve=!0;break;default:this.isBill=!1,this.isRetrieve=!1}}subscribeTobservable(){this._orderDataService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.cartItems=e.CartItems,this.cartItemsSource=e.CartItems,this.scrollToBottom()}),this._orderProcessorService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.state=e.posState,this.SelectState(this.state)}),this._userRoleService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.role=e})}checkDisabledDragItem(){this.disabledDragItem=!0===window.matchMedia("(pointer: coarse)").matches}isEmpty(e){return c.gT.IsEmpty(e)}getSalesName(e){return this._outletService.getSalesname(e)}getOutletName(e){return this._posService.getOutletName(e)}onContextMenu(e,n,i){e.preventDefault(),this.contextMenuPosition.x=e.clientX+"px",this.contextMenuPosition.y=e.clientY+"px",n.Index=i,this.contextMenu.menuData={item:n},this.contextMenu.openMenu()}drop(e){(0,qt.bA)(this.cartItems,e.previousIndex,e.currentIndex)}onReverse(e,n){this.isUpdateItem=!0,n?e.Quantity>0&&(e.Quantity=-1*e.Quantity):e.Quantity<0&&(e.Quantity=-1*e.Quantity),this.isUpdateItem=!0,this._shoppingCartService.updateCartItem(e,e.Index)}onSumPrice(e){this.isUpdateItem=!0;let n=0;this.cartItems.forEach((i,a)=>{n+=i.Quantity*i.Price*(100-i.Discount)/100-i.DiscountAmount,i.Price=0}),e.Price=n/e.Quantity,this._shoppingCartService.updateCartItem(e,e.Index)}onBundlePrice(e){let n=0;this.cartItems.forEach((i,a)=>{a!=e.Index&&(n+=i.Quantity*i.Price*(100-i.Discount)/100-i.DiscountAmount,i.Price=0)}),0==e.Price&&(e.Price=n/e.Quantity),this._shoppingCartService.updateCartItem(e,e.Index)}SplitQuantityValidate(e){}removeItem(e){this.isRemoveItem=!0,this._shoppingCartService.deleteCartItem(e)}disabledBilledEdit(e){return!1}openItemModal(e,n){this.isUpdateItem=!0,this._matDialog.open(Rt,{data:{index:e,focus:n}})}sortItemByCode(e){const n=this.cartItems.slice();e.active&&""!==e.direction?(this.cartItems=n.sort((i,a)=>this.compare(i.Variant.Code,a.Variant.Code,"asc"===e.direction)),this._orderDataService.Data.CartItems=this.cartItems):this.cartItems=this.cartItemsSource}compare(e,n,i){return(e<n?-1:1)*(i?1:-1)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(at),t.Y36(C),t.Y36(q),t.Y36(Z),t.Y36(h.uw),t.Y36(K),t.Y36(v))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-cart-display"]],viewQuery:function(e,n){if(1&e&&(t.Gf(zo,5),t.Gf(_t.p6,7)),2&e){let i;t.iGM(i=t.CRH())&&(n.cardContainer=i.first),t.iGM(i=t.CRH())&&(n.contextMenu=i.first)}},decls:30,vars:10,consts:[[1,"row","g-0","cart-table"],[1,"col"],["cardContainer",""],["matSort","",1,"table",3,"matSortChange"],[2,"width","18px"],[4,"ngIf"],[1,"text-start"],["style","cursor: pointer; width: 60px",4,"ngIf"],["mat-sort-header","Code",1,"hide-arrow",2,"cursor","pointer","width","60px"],[1,"fas","fa-sort-amount-down","ms-1"],[1,"text-end",2,"width","50px"],["class","text-end",4,"ngIf"],[1,"text-end",2,"width","70px"],[1,"text-end",2,"width","20px"],[1,"text-end",2,"width","85px"],["cdkDropList","",3,"cdkDropListDropped"],["cdkDrag","",3,"cdkDragDisabled","ngClass","contextmenu",4,"ngFor","ngForOf"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],["contextMenu","matMenu"],["matMenuContent",""],[2,"cursor","pointer","width","60px"],[1,"text-end"],["cdkDrag","",3,"cdkDragDisabled","ngClass","contextmenu"],[1,"cursor"],["type","checkbox",3,"ngModel","hidden","ngModelChange","click"],["aria-hidden","true","title","Click to Remove",1,"fa","fa-times","text-danger",3,"hidden","click"],[1,"text-start",3,"click"],["class","fa-solid fa-gift",4,"ngIf"],["class","ms-3",4,"ngIf"],["class","fst-italic m-0",4,"ngIf"],["class","special-TinyMCE m-0 fst-italic",3,"innerHtml",4,"ngIf"],["class","text-success fst-italic",4,"ngIf"],[3,"click",4,"ngIf"],[3,"innerHtml","click",4,"ngIf"],[3,"innerHtml","click"],["type","text","autoNum","",1,"text-end",2,"width","30px",3,"hidden","ngModel","ngModelChange","keyup"],[3,"hidden"],[3,"click"],[1,"text-end",3,"innerHtml","click"],[1,"text-end","text-danger",3,"click"],[1,"text-end",3,"click"],[1,"fa-solid","fa-gift"],[1,"ms-3"],[1,"fst-italic","m-0"],[4,"ngIf","ngIfElse"],["NotTaxable",""],[1,"text-success"],[1,"text-danger"],[1,"special-TinyMCE","m-0","fst-italic",3,"innerHtml"],[1,"text-warning"],[1,"text-success","fst-italic"],["data-cy","ctx-menu-item"],["mat-menu-item","",3,"disabled","click"],["mat-menu-item","",3,"click"]],template:function(e,n){if(1&e&&(t.TgZ(0,"div",0)(1,"div",1,2)(3,"table",3),t.NdJ("matSortChange",function(a){return n.sortItemByCode(a)}),t.TgZ(4,"thead")(5,"tr"),t._UZ(6,"th",4),t.YNc(7,jo,1,0,"th",5),t.TgZ(8,"th",6),t._uU(9,"Name"),t.qZA(),t.YNc(10,Wo,2,0,"th",7),t.YNc(11,Xo,2,0,"th",7),t.TgZ(12,"th",8),t._uU(13," Code "),t._UZ(14,"i",9),t.qZA(),t.TgZ(15,"th",10),t._uU(16,"Qty"),t.qZA(),t.YNc(17,ti,1,0,"th",11),t.TgZ(18,"th",12),t._uU(19,"Price"),t.qZA(),t.TgZ(20,"th",13),t._uU(21,"Disc"),t.qZA(),t.TgZ(22,"th",14),t._uU(23,"Total"),t.qZA()()(),t.TgZ(24,"tbody",15),t.NdJ("cdkDropListDropped",function(a){return n.drop(a)}),t.YNc(25,_i,36,39,"tr",16),t.qZA()()()(),t._UZ(26,"div",17),t.TgZ(27,"mat-menu",null,18),t.YNc(29,hi,9,3,"ng-template",19),t.qZA()),2&e){const i=t.MAs(28);t.xp6(7),t.Q6J("ngIf",null==n.AppConfigJSON||null==n.AppConfigJSON.ModuleSell?null:n.AppConfigJSON.ModuleSell.Grid.RowNumberVisible),t.xp6(3),t.Q6J("ngIf",null==n.AppConfigJSON||null==n.AppConfigJSON.ModuleSell?null:n.AppConfigJSON.ModuleSell.Grid.ShowBrandItemCart),t.xp6(1),t.Q6J("ngIf",null==n.AppConfigJSON||null==n.AppConfigJSON.ModuleSell?null:n.AppConfigJSON.ModuleSell.Grid.InventoryVisible),t.xp6(6),t.Q6J("ngIf",null==n.AppConfigJSON||null==n.AppConfigJSON.ModuleSell?null:n.AppConfigJSON.ModuleSell.Grid.UOMVisible),t.xp6(8),t.Q6J("ngForOf",n.cartItems),t.xp6(1),t.Udp("left",n.contextMenuPosition.x)("top",n.contextMenuPosition.y),t.Q6J("matMenuTriggerFor",i)}},dependencies:[g.mk,g.sg,g.O5,_t.VK,_t.OP,_t.p6,_t.KA,u.Fj,u.Wl,u.JJ,u.On,qt.Wj,qt.Zt,nt.b,Xt.YE,Xt.nU,g.JJ],styles:["div.row.cart-table[_ngcontent-%COMP%]{border-left:solid 1px #cfcfcf}div.row.cart-table[_ngcontent-%COMP%] div.col[_ngcontent-%COMP%]{overflow:auto;height:250px}div.row.cart-table[_ngcontent-%COMP%] div.col[_ngcontent-%COMP%] table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]{background:#fbfbf7;border-left:none}div.row.cart-table[_ngcontent-%COMP%] div.col[_ngcontent-%COMP%] table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{font-size:.75rem;padding:5px!important}div.row.cart-table[_ngcontent-%COMP%] div.col[_ngcontent-%COMP%] table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-size:.75rem;padding:6px 5px;border-bottom:1px solid #cfcfcf}div.row.cart-table[_ngcontent-%COMP%] div.col[_ngcontent-%COMP%] table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-child{padding-right:0} .hide-arrow .mat-sort-header-arrow{color:#fff}"]}),o})();class Ci{}let Ft=(()=>{class o{}return o.Gopay={url:"https://res.cloudinary.com/pos/image/upload/v1623982216/POS/Images/Payment/PaymentDialog/GoPay48.jpg",label:"Go-Pay"},o.Ovo={url:"https://res.cloudinary.com/pos/image/upload/v1623982217/POS/Images/Payment/PaymentDialog/OVO48.webp",label:"OVO"},o.Dana={url:"https://res.cloudinary.com/pos/image/upload/v1623982216/POS/Images/Payment/PaymentDialog/Dana48.jpg",label:"Dana"},o.BcaMobile={url:"https://res.cloudinary.com/pos/image/upload/v1623982216/POS/Images/Payment/PaymentDialog/BCA_48.webp",label:"BCA Mobile"},o})();var A=(()=>{return(o=A||(A={}))[o.Now=0]="Now",o[o.Later=1]="Later",o[o.QR=2]="QR",o[o.SplitPayment=3]="SplitPayment",A;var o})();class bi{constructor(){this.modalConfig=new D.O,this.viewState=A.Now,this.isDemoKey=!1,this.payLaterEnabled=!1,this.payNowEnabled=!1,this.payNowNLaterEnabled=!1,this.toleranceAmount=0,this.logoPayment=[Ft.Gopay,Ft.Ovo,Ft.Dana,Ft.BcaMobile],this.numpadVisible=!1,this.modalConfig.title="Amount to Pay: ",this.modalConfig.disableKeyup=!0,this.modalConfig.customWidth="650px",this.modalConfig.bodyScrollable=!0}mapAppConfigJson(r){this.merchantName=r.PaymentConfigGopay.MerchantName,this.toleranceAmount=r.ModuleSell.ToleranceAmount,this.numpadVisible=r.ModuleSell.NumPadVisible;let e=r.ModuleSell.PaymentDialog;switch(this.config=e,this.uniquePaymentMethodOnSplit=e.UniquePaymentMethodOnSplit,e.EnabledOptions){case 0:this.viewState=A.Now,this.payNowEnabled=!0;break;case 1:this.viewState=A.Later,this.payLaterEnabled=!0;break;case 2:switch(e.DefaultOption){case 0:this.viewState=A.Now;break;case 1:this.viewState=A.Later}this.payNowNLaterEnabled=!0}}enableEMoneyModal(r){this.modalConfig.eMoney=r,this.modalConfig.hideCancel=r,this.modalConfig.hideClose=r,this.modalConfig.hideOk=r}get isStateNow(){return this.viewState==A.Now}get isStateLater(){return this.viewState==A.Later}get isStateSplit(){return this.viewState==A.SplitPayment}get isStateQR(){return this.viewState==A.QR}}var xt=(()=>{return(o=xt||(xt={}))[o.Unpaid=1]="Unpaid",o[o.Partial=2]="Partial",o[o.Paid=3]="Paid",o[o.Bulk=4]="Bulk",o[o.Exceed=5]="Exceed",o[o.WriteOff=6]="WriteOff",xt;var o})();let Pi=(()=>{class o{constructor(e,n,i,a,s,l,d){this._invoiceCalculatorService=e,this._posService=n,this._orderDataService=i,this._orderProcessorService=a,this._onlineStatusService=s,this._signalBroadCast=l,this.decimalPipe=d,this.defaultCashPaymentMethodID=0,this.isOnline=!0,this.salesOrderData=new J.m,this.subscribeToObservableChanges(),this.defaultCashPaymentMethodID=this.paymentList[0].ID}get State(){return this._State}set State(e){this._State=e}get denomination(){return this._posService.Data.Denomination}get appConfigJSON(){return this._posService.Data.AppConfigJSON}get toleranceAmount(){return this.appConfigJSON.ModuleSell.ToleranceAmount}get paymentList(){return null!=this._posService.Data?this._posService.Data.Payments:Array()}subscribeToObservableChanges(){this._onlineStatusService.getOnlineStatus$().subscribe(e=>{this.isOnline=e}),this._orderDataService.Data$.subscribe(e=>{this.salesOrderData=e})}getPaymentList(){return this.paymentList}submitOrder(e){this.salesOrderData.Payments=(0,W.yE)(Ot.j,e),this._orderDataService.pushNewValue(this.salesOrderData),this._orderDataService.submitOrder(this.appConfigJSON).then(n=>{this._signalBroadCast.BroadcastStateToCustomerDisplay(_.IsComplete,n.ObjectID,n.LoyaltyPoint,this.salesOrderData.TotalPaidAmount-this._invoiceCalculatorService.Data),n=this.setFinalAmountOfflineOrder(n),this._orderProcessorService.updatePosState(_.IsComplete,n)},n=>{null==n.error&&(this._orderDataService.pushNewValue(this.salesOrderData),this._orderProcessorService.updatePosState(_.UploadOrderFail))})}setFinalAmountOfflineOrder(e){return 0==this.isOnline&&(e.Final=this._invoiceCalculatorService.Data),e}generateCashSuggestion(){const e=this.paymentList.filter(i=>i.TypeID==Pt.Q.cash),n=[];return e.length>0&&(n.push(this._invoiceCalculatorService.Data),this.defaultCashPaymentMethodID=e[0].ID,this.denomination.forEach(i=>{let a=this._invoiceCalculatorService.Data/i;a=Math.ceil(a);const s=a*i;s!=this._invoiceCalculatorService.Data&&-1===n.indexOf(s)&&n.length<3&&n.push(s)})),n}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(L),t.LFG(C),t.LFG(v),t.LFG(Z),t.LFG(x.q),t.LFG(dt),t.LFG(g.JJ))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();var Mi=p(11481);function yi(o,r){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.qZA()),2&o){const e=t.oxw();t.xp6(1),t.hij(" (+",null==e.posData?null:e.posData.Invoice.SurchargePcg,"%) ")}}const te=function(o){return{selected:o}};function vi(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",13),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(4);return t.KtG(i.onSplitClick())}),t._uU(1," Split "),t.TgZ(2,"span",14),t._uU(3,"Payment"),t.qZA()()}if(2&o){const e=t.oxw(4);t.Q6J("ngClass",t.VKq(1,te,e.modalFields.isStateSplit))}}function Oi(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",15),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(4);return t.KtG(i.onLaterClick())}),t._uU(1," Later "),t.TgZ(2,"span",14),t._uU(3,"Take Credit"),t.qZA()()}if(2&o){const e=t.oxw(4);t.Q6J("ngClass",t.VKq(1,te,e.modalFields.isStateLater))}}function xi(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div")(1,"a",10),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(3);return t.KtG(i.onNowClick())}),t._uU(2," Now "),t.qZA(),t.YNc(3,vi,4,3,"a",11),t.YNc(4,Oi,4,3,"a",12),t.qZA()}if(2&o){const e=t.oxw(3);t.xp6(1),t.Q6J("ngClass",t.VKq(3,te,e.modalFields.isStateNow)),t.xp6(2),t.Q6J("ngIf",e.cashPaymentChange<0&&e.modalFields.config.SplitPaymentMethodEnabled),t.xp6(1),t.Q6J("ngIf",0==e.modalFields.payNowEnabled&&!e.userRole.CreditSalesLock)}}function Di(o,r){if(1&o&&(t.TgZ(0,"div",9),t.YNc(1,xi,5,5,"div",2),t.qZA()),2&o){const e=t.oxw(2);t.xp6(1),t.Q6J("ngIf",e.modalFields.payNowNLaterEnabled||e.modalFields.payNowEnabled)}}const Si=function(o,r){return{active:o,"font-12":r}};function Ti(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",28)(1,"a",29),t.NdJ("click",function(){const a=t.CHM(e).$implicit,s=t.oxw(3);return t.KtG(s.updateCashPayment(a))}),t._uU(2),t.ALo(3,"number"),t.qZA()()}if(2&o){const e=r.$implicit,n=t.oxw(3);t.xp6(1),t.Q6J("ngClass",t.WLB(5,Si,(null==n.Payments[0]?null:n.Payments[0].MethodID)==n.defaultCashPaymentMethodID&&(null==n.Payments[0]?null:n.Payments[0].PaidAmount)==e,n.modalFields.paymentSuggestion[0].toString().length>8)),t.xp6(1),t.AsE("",null==n.cashierCalculatorService?null:n.cashierCalculatorService.currencySymbol," ",t.lcZ(3,3,e),"")}}function Ii(o,r){if(1&o&&(t.TgZ(0,"div",30),t._uU(1),t.ALo(2,"number"),t.qZA()),2&o){const e=t.oxw(3);t.Q6J("ngClass",e.cashPaymentChange>0?"success":"danger"),t.xp6(1),t.AsE(" ",null==e.cashierCalculatorService?null:e.cashierCalculatorService.currencySymbol," ",t.lcZ(2,3,e.cashPaymentChange)," ")}}const ki=function(o){return{background:o}};function Ai(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",34)(1,"a",35),t.NdJ("click",function(){const a=t.CHM(e).$implicit,s=t.oxw(4);return s.onPaymentMethodChanged(a),t.KtG(s.payWithEmoney(a))}),t.TgZ(2,"span",36),t._UZ(3,"img",37),t.qZA(),t.TgZ(4,"span",38),t._uU(5),t.ALo(6,"limitTo"),t.qZA()()()}if(2&o){const e=r.$implicit,n=t.oxw(4);t.xp6(1),t.Akn(t.VKq(11,ki,"ovo"==e.Name.toLowerCase()?"#4c3394":"white")),t.Q6J("ngClass",n.Payments[0].MethodID===e.ID?"active":""),t.xp6(1),t.Q6J("hidden",null==e.ImageUrl),t.xp6(1),t.Q6J("src",e.ImageUrl,t.LSH),t.xp6(1),t.s9C("title",e.Name),t.Q6J("hidden",null!=e.ImageUrl),t.xp6(1),t.hij(" ",t.xi3(6,8,e.Name,20)," ")}}function wi(o,r){if(1&o&&(t.TgZ(0,"div",31)(1,"div",17),t._UZ(2,"i",32),t._uU(3," E-Money "),t.qZA(),t.TgZ(4,"div",19)(5,"div",22),t.YNc(6,Ai,7,13,"div",33),t.qZA()()()),2&o){const e=t.oxw(3);t.xp6(6),t.Q6J("ngForOf",e.getTypePaymentList(3))}}function Ni(o,r){if(1&o&&(t.TgZ(0,"div",17),t._UZ(1,"i"),t._uU(2),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.Tol(e.Icon),t.xp6(1),t.hij(" ",e.Name," ")}}function Zi(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",34)(1,"a",42),t.NdJ("click",function(){const a=t.CHM(e).$implicit,s=t.oxw(5);return t.KtG(s.onPaymentMethodChanged(a))}),t._uU(2),t.ALo(3,"limitTo"),t.qZA()()}if(2&o){const e=r.$implicit,n=t.oxw(5);t.xp6(1),t.s9C("title",e.Name),t.Q6J("ngClass",n.Payments[0].MethodID===e.ID?"active":""),t.xp6(1),t.hij(" ",t.xi3(3,3,e.Name,20)," ")}}function Ji(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",43)(1,"div",44)(2,"input",45),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(5);return t.KtG(a.Payments[0].Note=i)}),t.qZA(),t.TgZ(3,"input",46),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(5);return t.KtG(a.Payments[0].Code=i)}),t.qZA()()()}if(2&o){const e=t.oxw(5);t.xp6(2),t.Q6J("ngModel",e.Payments[0].Note),t.xp6(1),t.Q6J("maxlength",e.userRole.PaymentCodeLock?1:void 0)("ngModel",e.Payments[0].Code)}}function Ri(o,r){if(1&o&&(t.TgZ(0,"div",19)(1,"div",22),t.YNc(2,Zi,4,6,"div",33),t.qZA(),t.YNc(3,Ji,4,3,"div",41),t.qZA()),2&o){const e=t.oxw().$implicit,n=t.oxw(3);t.xp6(2),t.Q6J("ngForOf",n.getTypePaymentList(e.ID)),t.xp6(1),t.Q6J("ngIf",n.isOtherPayment(e.ID))}}function qi(o,r){if(1&o&&(t.TgZ(0,"div",31),t.YNc(1,Ni,3,4,"div",39),t.YNc(2,Ri,4,2,"div",40),t.qZA()),2&o){const e=r.$implicit,n=t.oxw(3);t.xp6(1),t.Q6J("ngIf",n.getTypePaymentList(e.ID).length>0),t.xp6(1),t.Q6J("ngIf",n.getTypePaymentList(e.ID).length>0)}}function Fi(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div")(1,"div",16)(2,"div",17),t._UZ(3,"i",18),t._uU(4," Cash "),t.qZA(),t.TgZ(5,"div",19)(6,"div",20),t.YNc(7,Ti,4,8,"div",21),t.qZA(),t.TgZ(8,"div",22)(9,"div",23)(10,"input",24),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.inputAmountString=i)})("ngModelChange",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.updateCashPayment(i.inputAmountString))}),t.qZA(),t.YNc(11,Ii,3,5,"div",25),t.qZA()()()(),t.YNc(12,wi,7,1,"div",26),t.YNc(13,qi,3,2,"div",27),t.qZA()}if(2&o){const e=t.oxw(2);t.xp6(7),t.Q6J("ngForOf",e.modalFields.paymentSuggestion),t.xp6(3),t.Q6J("simpleKeyboard",e.keyboard)("ngModel",e.inputAmountString),t.xp6(1),t.Q6J("ngIf",0!=e.cashPaymentChange),t.xp6(1),t.Q6J("ngIf",e.getTypePaymentList(3).length>0&&e.isOnline),t.xp6(1),t.Q6J("ngForOf",e.paymentTypes)}}function Qi(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div")(1,"div",47)(2,"strong",48),t._uU(3,"Due"),t.qZA(),t.TgZ(4,"datepicker",49),t.NdJ("dateChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.modalFields.payLaterDueDate=i)})("dateChange",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.dueDateChange())}),t.qZA()(),t.TgZ(5,"div",50)(6,"strong",51),t._uU(7,"Days Due"),t.qZA(),t.TgZ(8,"input",52),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.modalFields.payLaterDueDays=i)})("ngModelChange",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.dueDayChange())}),t.qZA()()()}if(2&o){const e=t.oxw(2);t.xp6(4),t.Q6J("date",e.modalFields.payLaterDueDate)("displayToggle",!1),t.xp6(4),t.Q6J("simpleKeyboard",e.keyboard)("ngModel",e.modalFields.payLaterDueDays)}}function Ui(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",53)(1,"div",54)(2,"div",55)(3,"strong",56),t._uU(4,"Payment 2:"),t.qZA()(),t.TgZ(5,"div",57)(6,"ng-select",58),t.NdJ("change",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.onSplitPaymentMethodAssigned(i))}),t.qZA()()(),t.TgZ(7,"div",59)(8,"strong",60),t._uU(9,"Amount 2:"),t.qZA(),t._UZ(10,"input",61),t.qZA()()}if(2&o){const e=t.oxw(2);t.xp6(6),t.Q6J("items",e.splitPaymentMethodList)("ngModel",null==e.Payments[1]?null:e.Payments[1].MethodID),t.xp6(4),t.Q6J("ngModel",e.paymentSplitDefaultVal)}}function Ei(o,r){if(1&o&&(t.TgZ(0,"div",6),t.YNc(1,Di,2,1,"div",7),t.YNc(2,Fi,14,6,"div",2),t.YNc(3,Qi,9,4,"div",2),t.YNc(4,Ui,11,3,"div",8),t.qZA()),2&o){const e=t.oxw();t.xp6(1),t.Q6J("ngIf",0==e.modalFields.payLaterEnabled),t.xp6(1),t.Q6J("ngIf",e.modalFields.isStateNow),t.xp6(1),t.Q6J("ngIf",e.modalFields.isStateLater),t.xp6(1),t.Q6J("ngIf",e.modalFields.isStateSplit)}}function Li(o,r){if(1&o&&(t.TgZ(0,"h5",76),t._uU(1),t.qZA()),2&o){const e=t.oxw(2);t.xp6(1),t.Oqu(e.modalFields.merchantName)}}function Vi(o,r){if(1&o&&(t.TgZ(0,"div",77)(1,"p"),t._UZ(2,"i",78),t._uU(3," This QR is intended for Testing Purpose only, "),t.TgZ(4,"a",79),t._uU(5,"register for a new account here."),t.qZA()()()),2&o){const e=t.oxw(2);t.xp6(4),t.Q6J("href",e.sanitize("https://www.dealpos.co.id/tour/mobile-payment"),t.LSH)}}function Yi(o,r){if(1&o&&(t.TgZ(0,"div",80),t._UZ(1,"img",81),t.TgZ(2,"div",82),t._uU(3),t.qZA()()),2&o){const e=r.$implicit;t.xp6(1),t.s9C("src",e.url,t.LSH),t.xp6(2),t.hij(" ",e.label," ")}}function Hi(o,r){if(1&o&&(t.TgZ(0,"div",62)(1,"div",63)(2,"span",64),t._uU(3),t.qZA(),t.TgZ(4,"div",65)(5,"div",66)(6,"span",67),t._uU(7,"Invoice"),t.qZA(),t.TgZ(8,"span"),t._uU(9,":"),t.qZA()(),t.TgZ(10,"div",68)(11,"span",69),t._uU(12),t.qZA()()(),t.TgZ(13,"div",65)(14,"div",66)(15,"span"),t._uU(16,"Amount"),t.qZA(),t.TgZ(17,"span"),t._uU(18,":"),t.qZA()(),t.TgZ(19,"div",68)(20,"span",69),t._uU(21),t.ALo(22,"number"),t.qZA()()()(),t.TgZ(23,"div",70),t._UZ(24,"img",71),t.qZA(),t.YNc(25,Li,2,1,"h5",72),t.YNc(26,Vi,6,1,"div",73),t.TgZ(27,"div",74),t.YNc(28,Yi,4,2,"div",75),t.qZA()()),2&o){const e=t.oxw();t.xp6(3),t.Oqu(null==e.modalFields?null:e.modalFields.merchantName),t.xp6(9),t.Oqu(null==e.posData||null==e.posData.Order?null:e.posData.Order.Number),t.xp6(9),t.AsE("",e.cashierCalculatorService.currencySymbol," ",t.lcZ(22,8,e.cashierCalculatorService.Data),""),t.xp6(3),t.Q6J("src",e.qrImage,t.LSH),t.xp6(1),t.Q6J("ngIf",e.modalFields.merchantName),t.xp6(1),t.Q6J("ngIf",e.modalFields.isDemoKey),t.xp6(2),t.Q6J("ngForOf",e.modalFields.logoPayment)}}function Gi(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",83),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.onPrintQR())}),t._UZ(1,"i",84),t._uU(2,"Print QR "),t.qZA()}}function Bi(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",83),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.validateEMoneyPayment())}),t._uU(1," Verify Payment Settlement "),t.qZA()}}let Ki=(()=>{class o{constructor(e,n,i,a,s,l,d,f,b,O,R,Q,z,it,ht,Dt){this.dialogRef=e,this._orderDataService=n,this.cashierCalculatorService=i,this._paymentService=a,this._posHubService=s,this._posService=l,this._toastr=d,this._dialog=f,this._paymentGatewayService=b,this.decimalPipe=O,this.sanitizer=R,this._orderProcessorService=Q,this._numpadService=z,this._userRoleService=it,this._customerHttpService=ht,this._onlineStatusService=Dt,this.modalFields=new bi,this.userRole=new Y.Q,this.posData=new J.m,this.AppConfigJSON=new ot,this.Payments=[],this.inputAmountString=null,this.isOnline=!0,this.paymentSplitDefaultVal=0,this.defaultCashPaymentMethodID=0,this.destroy$=new T.x,this.AppConfigJSON=this._posService.Data.AppConfigJSON,this.modalFields.mapAppConfigJson(this.AppConfigJSON),this.initializeDefaultValues(),this.subscribeToObservableChanges()}get firstPayment(){return this.Payments[0]}set firstPayment(e){this.Payments[0]=e}get cashPaymentChange(){return(this.firstPayment?this.firstPayment.PaidAmount:0)-this.cashierCalculatorService.Data}subscribeToObservableChanges(){this._orderDataService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.posData=e}),this._orderProcessorService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.posState=e.posState,this.initializeInvoicePaymentsValue(this.posState)}),this._onlineStatusService.getOnlineStatus$().pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.isOnline=e})}initializeInvoicePaymentsValue(e){e!==_.IsEdit?(this.firstPayment=new Ot.j,this.firstPayment.Amount=this.cashierCalculatorService.Data,this.firstPayment.PaidAmount=this.cashierCalculatorService.Data,this.firstPayment.MethodID=this.defaultCashPaymentMethodID,this.firstPayment.TypeID=Pt.Q.cash):(this.Payments=this.posData.Payments,this.initFirstPayment())}initFirstPayment(){this.firstPayment?this.posData.Invoice.PaymentStateID==xt.Paid?this.Payments.length>1?this.initSplitPayment():(this.firstPayment.PaidAmount=this.cashierCalculatorService.Data,this.firstPayment.Amount=this.cashierCalculatorService.Data):this.firstPayment.Amount=this.cashierCalculatorService.Data:(this.firstPayment=new Ot.j,this.firstPayment.Amount=this.cashierCalculatorService.Data,this.firstPayment.PaidAmount=this.cashierCalculatorService.Data,this.firstPayment.MethodID=this.defaultCashPaymentMethodID,this.modalFields.viewState=A.Later);const e=this.firstPayment.PaidAmount;this.inputAmountString=e?e.toString():null}initSplitPayment(){let n=this.Payments[1].PaidAmount,i=this.cashierCalculatorService.Data-n;this.firstPayment.PaidAmount=i,this.firstPayment.Amount=i,this.paymentSplitDefaultVal=n}initializeDefaultValues(){this.modalFields.paymentSuggestion=this._paymentService.generateCashSuggestion(),this.paymentMethodList=this._posService.Data.Payments,this.splitPaymentMethodList=this._posService.Data.Payments,this.paymentTypes=this._posService.Data.PaymentTypes,this.defaultCashPaymentMethodID=this._paymentService.defaultCashPaymentMethodID,this._userRoleService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.userRole=e})}ngOnInit(){this.modalFields.numpadVisible&&(this.keyboard=this._numpadService.keyboard),this.initDefaultDueDays()}initDefaultDueDays(){let e=this._customerHttpService.Data,n=e?e.DueDays:null,i=e?e.DueMonths:null,a=new Date;a.setHours(0,0,0,0);let s=new Date;s.setHours(0,0,0,0),c.gT.IsNotEmpty(this.posData.Invoice.Due)&&c.gT.MinDate!==this.posData.Invoice.Due?a=new Date(this.posData.Invoice.Due):(i&&a.setMonth(a.getMonth()+i),!n&&!i&&(n=this.modalFields.config.DefaultDueDays),a.setDate(a.getDate()+n)),this.modalFields.payLaterDueDate=a,this.modalFields.payLaterDueDays=c.gT.calculateNumberBetweenDate(s,a),this.posData.Invoice.Due=this.modalFields.payLaterDueDate}onBack(){this.modalFields.viewState=A.Now,this.changeModalForEmoney(!1),this.setToCashPayment(),this._paymentGatewayService.clearTransactionID()}onOk(){if(this.validateSerialItem())if(this.posData.Action.Type=ft.q.Payment,this.posData.Order.InvoicedStateID=ct.Complete,this.posData.Action.Type=ft.q.Payment,this.modalFields.viewState!=A.Later){if(this.validatePay()){if(this.posData.Invoice.Due=null,this.validatePaymentSplit(),this.isCustomerLimitDebt())return;this._paymentService.submitOrder(this.Payments),this.close()}}else this.validatePaymentLater(this.userRole)&&(this._paymentService.submitOrder(this.Payments),this.close())}isCustomerLimitDebt(){if(this.paymentSplitDefaultVal>0&&1==this.Payments.length){let e=this._customerHttpService.Data;if(e.DebtLimit>0){let i=e.Debt+this.paymentSplitDefaultVal>e.DebtLimit;if(0==e.Debt&&this.paymentSplitDefaultVal>e.DebtLimit||i)return this._toastr.warning(c.g7.debtLimit,"Warning!"),!0}}return!1}validateSerialItem(){let e=this.findItemWithoutSerial();return!(e.length>0&&!c.gT.IsEmpty(this.posData.Action.DeliveryEntityID)&&(this.dialogRef.close(),this.showModalSerialRequired(e[0]),1))}findItemWithoutSerial(){let e;return this.posData.CartItems.filter(i=>(e=!1,i.Variant&&4===i.Variant.TypeID&&(e=0===i.Serial.length),e))}validatePaymentLater(e){let n=this._customerHttpService.Data;if(this.IsCreditSales()&&e.CreditSalesLock)return alert(c.g7.creditLock),!1;const i=c.gT.IsEmpty(this.posData.Order.CustomerID);return this.modalFields.viewState==A.Later&&i||this.IsCreditSales()&&i?(alert(c.g7.emptyCustomerCredit),!1):0===n.DebtLimit||!(n.Debt>=n.DebtLimit||0==n.Debt&&this.cashierCalculatorService.Data>n.DebtLimit||n.Debt+this.cashierCalculatorService.Data>n.DebtLimit)||(this._toastr.warning(c.g7.debtLimit,"Warning!"),!1)}showModalSerialRequired(e){this._dialog.open(fe,{data:{message:`Serial can not Empty in ${e.Variant.Name}`,title:"Submit Order Error"},width:"350px"})}validatePaymentSplit(){const e=this.firstPayment.PaidAmount,n=this.Payments[1]?this.Payments[1].PaidAmount:0,i=this.cashierCalculatorService.Data;let a=[];e+this.modalFields.toleranceAmount>=i?(a=this.Payments.slice(0,1),0!==this.modalFields.toleranceAmount&&e<i&&(this.firstPayment.Amount=i),this.Payments=a):a=n+e===i?this.Payments.slice(0,2):this.Payments,this.Payments=a}validatePay(){if(this.IsDepositPayment()&&this.userRole.CreditSalesLock)return this._toastr.warning(c.g7.creditLock,U.n.Warning),!1;if(!this.AppConfigJSON.ApplicationLoyalty.Rules.MixCashAndPoint&&this.posData.Order.PointUsed>0&&this.cashierCalculatorService.Data>0)return this._toastr.info(c.g7.partialLoyaltyPointUnable,U.n.Info),!1;const e=this.posData.Order.PointUsed*this.AppConfigJSON.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue;if(this.cashierCalculatorService.GetPointOnlyAmount()>0&&this.cashierCalculatorService.GetPointOnlyAmount()>e){const i=c.gT.StringFormat(c.g7.pointOnly,this.decimalPipe.transform(this.posData.PointOnlyAmount));return this._toastr.info(i,U.n.Info),!1}const n=this.cashierCalculatorService.Data+this.posData.Order.DiscountAmount-e;if(this.cashierCalculatorService.GetCashOnlyAmount()>0&&this.cashierCalculatorService.GetCashOnlyAmount()>n&&Math.abs(this.cashierCalculatorService.GetCashOnlyAmount()-n)>this.modalFields.toleranceAmount){const i=c.gT.StringFormat(c.g7.cashOnly,this.decimalPipe.transform(this.posData.CashOnlyAmount));return this._toastr.info(i,U.n.Info),!1}return this.IsDepositPayment()&&c.gT.IsEmpty(this.posData.Order.CustomerID)?(alert(c.g7.emptyCustomerDeposit),!1):!(this.posData.PrepaidPackageItem.length>0&&c.gT.IsEmpty(this.posData.Order.CustomerID)&&(this._toastr.info("Products with prepaid package type must use the customer",U.n.Info),1))}onNowClick(){this.modalFields.viewState=A.Now}onLaterClick(){this.modalFields.viewState=A.Later}onSplitClick(){this.modalFields.viewState=A.SplitPayment}IsCreditSales(){return this.modalFields.viewState!=A.Later||this.IsDepositPayment()}IsDepositPayment(){let e=!1;const n=this.Payments.map(l=>l.PaidAmount).reduce((l,d)=>l+d);return this.modalFields.toleranceAmount+n<this.cashierCalculatorService.Data&&(e=!0),e}close(){this.initializeDefaultValues(),this.dialogRef.close()}updateCashPayment(e){const n=this.cashierCalculatorService.Data;this.paymentSplitDefaultVal=0,this.firstPayment.MethodID=this.defaultCashPaymentMethodID,this.firstPayment.Amount=n,this.firstPayment.PaidAmount=e,this.firstPayment.TypeID=Pt.Q.cash,0!==this.posData.Invoice.SurchargePcg&&this.updateSurcharge(0),e<n&&(this.firstPayment.Amount=e,this.paymentSplitDefaultVal=n-e,this.filterSplitPaymentList(),this.changePaymentSplitValue())}changePaymentSplitValue(){this.Payments[1]&&(this.Payments[1].Amount=this.paymentSplitDefaultVal,this.Payments[1].PaidAmount=this.paymentSplitDefaultVal)}onPaymentMethodChanged(e){this.updateSurcharge(e.ExtraCharge);const n=this.cashierCalculatorService.Data;this.firstPayment.Amount=n,this.firstPayment.PaidAmount=n,this.firstPayment.MethodID=e.ID,this.firstPayment.TypeID=e.TypeID,e.ExtraCharge>0&&this.paymentSplitDefaultVal>0?this._toastr.warning("Cannot apply Split Payment for Payment Method with Surcharge","Warning"):this.paymentSplitDefaultVal>0&&(this.firstPayment.Amount=n-this.paymentSplitDefaultVal,this.firstPayment.PaidAmount=n-this.paymentSplitDefaultVal),this.filterSplitPaymentList()}filterSplitPaymentList(){this.modalFields.uniquePaymentMethodOnSplit&&(this.splitPaymentMethodList=this.paymentMethodList.filter(e=>e.ID!==this.firstPayment.MethodID))}updateSurcharge(e){this.posData.Invoice.SurchargePcg=e,this.posData.Invoice.TempSurchargePcg=e,this._orderDataService.pushNewValue(this.posData)}onSplitPaymentMethodAssigned(e){e?(this.Payments[1]=this.Payments[1]?this.Payments[1]:new Ot.j,this.Payments[1].MethodID=e.ID,this.Payments[1].MethodName=e.Name,this.Payments[1].Amount=this.paymentSplitDefaultVal,this.Payments[1].PaidAmount=this.paymentSplitDefaultVal,this.Payments[1].TypeID=e.TypeID):(this.Payments[1].Amount=0,this.Payments[1].PaidAmount=0)}isCardPayment(){return this.getTypePaymentList(2).findIndex(n=>n.ID==this.firstPayment.MethodID)>=0}isOtherPayment(e){return this.getTypePaymentList(e).findIndex(n=>n.ID==this.firstPayment.MethodID)>=0}getTypePaymentList(e){return this._paymentService.getPaymentList().filter(i=>i.TypeID==e)}getSplitPaymentList(e,n=0){let i=this._paymentService.getPaymentList();return e||(i=i.filter(a=>a.ID!=this.Payments[n].MethodID)),i}payWithEmoney(e){const n=new Ci;n.RegisterID=this.posData.Order.RegisterID,n.InvoiceNumber=this.posData.Order.Number,n.Amount=this.cashierCalculatorService.Data,this._paymentGatewayService.generateQR(n,e).pipe((0,m.R)(this.destroy$)).subscribe({next:i=>{this.qrImage=i.Url,this.modalFields.isDemoKey=i.IsDemoKey,this.showModalQRIS()},error:i=>{this.setToCashPayment(),this.onErrorGenerateQR(i)}})}setToCashPayment(){this.firstPayment.MethodID=this.defaultCashPaymentMethodID,this.firstPayment.TypeID=Pt.Q.cash}showModalQRIS(){this.modalFields.viewState=A.QR,this.changeModalForEmoney(!0)}onErrorGenerateQR(e){400==e.status?this.validateEMoneyPayment():this._toastr.error(c.g7.failGenerateQR,U.n.Error)}validateEMoneyPayment(){this._paymentGatewayService.validateEMoneyPayment(this.AppConfigJSON).pipe((0,m.R)(this.destroy$)).subscribe({next:e=>{this.dialogRef.close();const i=`IDR ${this.decimalPipe.transform(e.Final)} received. Please verify in customer mobile app!`;this._toastr.success(i," QR Settlement"),this._orderProcessorService.updatePosState(_.IsComplete,e)}})}changeModalForEmoney(e){this.modalFields.enableEMoneyModal(e),e||this._posHubService.BroadcastQRToCustomerDisplay("")}dueDateChange(){const e=new Date(this.posData.Order.Date);let n=this.modalFields.payLaterDueDate?this.modalFields.payLaterDueDate:new Date;e.setHours(0,0,0,0),this.modalFields.payLaterDueDays=c.gT.calculateNumberBetweenDate(e,n),this.posData.Invoice.Due=n.toJSON()}dueDayChange(){const e=new Date(this.posData.Order.Date);e.setDate(e.getDate()+this.modalFields.payLaterDueDays),e.setHours(0,0,0,0),this.modalFields.payLaterDueDate=e,this.posData.Invoice.Due=e.toJSON()}sanitize(e){return this.sanitizer.bypassSecurityTrustUrl(e)}onPrintQR(){window.print()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(v),t.Y36(L),t.Y36(Pi),t.Y36(dt),t.Y36(C),t.Y36(I._W),t.Y36(h.uw),t.Y36(Zt),t.Y36(g.JJ),t.Y36(Mi.H7),t.Y36(Z),t.Y36(jt.u),t.Y36(K),t.Y36(tt.r),t.Y36(x.q))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-payment"]],decls:12,vars:9,consts:[[3,"config","keydown.NumpedEnter","keydown.Enter","keydown.F2","onOk","onCancel","onClose","onBack"],[1,"mt-1","ms-2"],[4,"ngIf"],["class","container w-100 h-100",4,"ngIf"],["class","text-center position-relative w-100",4,"ngIf"],["class","btn btn-light-blue text-primary btn-lg fw-bold me-5 py-8",3,"click",4,"ngIf"],[1,"container","w-100","h-100"],["class","row border-bottom",4,"ngIf"],["style","margin-bottom: 80px;","class","row py-5",4,"ngIf"],[1,"row","border-bottom"],[1,"btn","btn-link",3,"ngClass","click"],["class","btn btn-link","data-cy","Split",3,"ngClass","click",4,"ngIf"],["data-cy","Later","class","btn btn-link",3,"ngClass","click",4,"ngIf"],["data-cy","Split",1,"btn","btn-link",3,"ngClass","click"],[1,"fst-italic",2,"font-size","10px"],["data-cy","Later",1,"btn","btn-link",3,"ngClass","click"],[1,"row","py-5"],[1,"col-3","h5","pt-5"],[1,"fa-solid","fa-money-bill-wave"],[1,"col-9"],[1,"row","mb-5"],["class","col-4 pe-0 ps-4",4,"ngFor","ngForOf"],[1,"row"],[1,"col","pe-0","ps-4"],["id","cashInput","type","text","keyboardType","number","placeholder","Custom Cash Amount","data-cy","CustomAmount","autoNum","",1,"form-control","form-control-lg","py-3",3,"simpleKeyboard","ngModel","ngModelChange"],["class","change",3,"ngClass",4,"ngIf"],["class","row border-top py-5",4,"ngIf"],["class","row border-top py-5",4,"ngFor","ngForOf"],[1,"col-4","pe-0","ps-4"],[1,"btn","btn-outline-info","px-1","py-6","w-100",3,"ngClass","click"],[1,"change",3,"ngClass"],[1,"row","border-top","py-5"],[1,"fa-solid","fa-qrcode"],["class","col-auto pb-3 ps-4 pe-0",4,"ngFor","ngForOf"],[1,"col-auto","pb-3","ps-4","pe-0"],[1,"btn","btn-outline-info",3,"ngClass","click"],[3,"hidden"],[3,"src"],[3,"hidden","title"],["class","col-3 h5 pt-5",4,"ngIf"],["class","col-9",4,"ngIf"],["class","position-relative row",4,"ngIf"],[1,"btn","btn-outline-info",3,"ngClass","title","click"],[1,"position-relative","row"],[1,"paymentNote","col","row","g-0","pt-2","ms-4"],["type","text","placeholder","Payment Note",1,"form-control","w-50","border-end-0","py-6","col-6",3,"ngModel","ngModelChange"],["type","text","placeholder","Payment Code",1,"form-control","w-50","border-start-0","py-6","paymentCode","col-6",3,"maxlength","ngModel","ngModelChange"],[1,"row","d-flex","align-items-center","g-0","later-payment","date-picker","mt-4"],[1,"col-3"],["appearance","legacy","name","orderDate",1,"col-9",3,"date","displayToggle","dateChange"],[1,"row","d-flex","align-items-center","g-0","later-payment","mt-10"],["id","daysInput",1,"col-3"],["id","day","type","text","keyboardType","number","autoNum","",1,"col-9","form-control",2,"width","75%",3,"simpleKeyboard","ngModel","ngModelChange"],[1,"row","py-5",2,"margin-bottom","80px"],[1,"col-6","d-flex","align-items-center","pe-0"],[1,"col-auto","px-0"],[1,"me-2"],[1,"col"],["bindLabel","Name","bindValue","ID","placeholder","Payment","appendTo","body","data-cy","Payment2",1,"ng-select-width","category-select",3,"items","ngModel","change"],[1,"col-6","d-flex","justify-content-end","align-items-center","text-end"],[1,"me-3"],["type","text","autoNum","","disabled","",1,"text-end","height-input",3,"ngModel"],[1,"text-center","position-relative","w-100"],[1,"d-none","d-print-flex","flex-column","justify-content-center","title-pay","position-relative"],[1,"fw-bold","fs-3"],[1,"row","d-flex","justify-content-center","me-5","fs-6"],[1,"col-3","text-end","pe-3","ms-13"],[1,"me-1"],[1,"col-6","text-start","ps-0"],[1,"fw-normal"],[1,"d-flex","justify-content-center","qris-container"],["alt","Gopay QR",1,"d-block","qris-barcode","border-0",3,"src"],["class","position-relative d-print-none","style","top:-17px",4,"ngIf"],["class","alert-warning qrDemo pt-2 pb-2 border border-1",4,"ngIf"],[1,"row","justify-content-center","d-print-none"],["class","col-auto qris",4,"ngFor","ngForOf"],[1,"position-relative","d-print-none",2,"top","-17px"],[1,"alert-warning","qrDemo","pt-2","pb-2","border","border-1"],[1,"fa-solid","fa-info-circle","me-1"],["target","_blank",3,"href"],[1,"col-auto","qris"],[1,"d-block","mx-auto","mb-2",3,"src"],[1,"text-center"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","me-5","py-8",3,"click"],[1,"fa-solid","fa-print","me-2"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("keydown.NumpedEnter",function(){return n.onOk()})("keydown.Enter",function(){return n.onOk()})("keydown.F2",function(){return n.onOk()})("onOk",function(){return n.onOk()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()})("onBack",function(){return n.onBack()}),t.TgZ(1,"header")(2,"div",1),t.YNc(3,yi,2,1,"span",2),t._uU(4),t.ALo(5,"number"),t.qZA()(),t.TgZ(6,"content"),t.YNc(7,Ei,5,4,"div",3),t.YNc(8,Hi,29,10,"div",4),t.qZA(),t.TgZ(9,"footer"),t.YNc(10,Gi,3,0,"a",5),t.YNc(11,Bi,2,0,"a",5),t.qZA()()),2&e&&(t.Q6J("config",n.modalFields.modalConfig),t.xp6(3),t.Q6J("ngIf",(null==n.posData?null:n.posData.Invoice.SurchargePcg)>0),t.xp6(1),t.hij(" ",n.userRole.PriceVisibleRestriction?"-":t.lcZ(5,7,n.cashierCalculatorService.Data)," "),t.xp6(3),t.Q6J("ngIf",!n.modalFields.isStateQR),t.xp6(1),t.Q6J("ngIf",n.modalFields.isStateQR),t.xp6(2),t.Q6J("ngIf",n.modalFields.isStateQR),t.xp6(1),t.Q6J("ngIf",n.modalFields.isStateQR))},dependencies:[g.mk,g.sg,g.O5,$.w9,u.Fj,u.JJ,u.nD,u.On,y.M,gt.QB,nt.b,Ce.V,g.JJ,k.OI],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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.margin-note[_ngcontent-%COMP%]{margin-left:-7px!important}.quickKeyTabs[_ngcontent-%COMP%]{margin-right:-15px;margin-left:-7px}.change[_ngcontent-%COMP%]{position:absolute;top:119px;height:40px;background:#89b03e;color:#fff;right:17px;padding:0 10px;line-height:40px;font-size:16px}.change[_ngcontent-%COMP%]:before{content:"\\a";border-style:solid;border-width:40px 24px 0 0;border-color:transparent #89b03e transparent transparent;position:absolute;left:-24px}.change.danger[_ngcontent-%COMP%]{background:#c9302c}.change.danger[_ngcontent-%COMP%]:before{border-color:transparent #c9302c transparent transparent}.paymentNote[_ngcontent-%COMP%]:before{z-index:10;content:"";position:absolute;top:4px;left:calc(50% - 10px);height:90%;width:10px;background-color:inherit;border-right:1px solid lightgray;transform:skew(-10deg)}.height-input[_ngcontent-%COMP%]{height:37px}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519}.later-payment[_ngcontent-%COMP%] strong{font-size:20px}.later-payment[_ngcontent-%COMP%] input{font-size:20px;padding:20px 10px!important}.later-payment[_ngcontent-%COMP%] .mat-form-field{width:100%;font-size:20px;border:1px solid #c8d3df;padding-left:10px}.later-payment[_ngcontent-%COMP%] .mat-form-field .mat-icon-button, .later-payment[_ngcontent-%COMP%] .mat-form-field .mat-button-wrapper, .later-payment[_ngcontent-%COMP%] .mat-form-field .mat-form-field-suffix{outline:none!important} .later-payment.date-picker .mat-form-field{font-size:4px}.phone[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{height:50px;width:50px;padding-top:11px;background-color:#f5f5f5;border:1px solid gray!important}.phone[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{padding-left:65px!important;border:1px solid gray!important;font-size:25px;height:50px}.phone[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:focus{border-color:#8bb8df!important}.qris[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{font-size:.75rem}.ng-select.ng-select-width[_ngcontent-%COMP%] .ng-select-container{width:160px;max-width:160px}.qrDemo[_ngcontent-%COMP%]{position:relative;top:-10px}.qrDemo[_ngcontent-%COMP%] > p[_ngcontent-%COMP%]{margin-bottom:0}input[type=text][_ngcontent-%COMP%]:disabled{background:#e5e5e5} ng-dropdown-panel.category-select{z-index:1100}.row[_ngcontent-%COMP%] > div.tab-button[_ngcontent-%COMP%]{padding-left:0}.qris-barcode[_ngcontent-%COMP%]{height:300px;line-height:50px}@media print{.qris-barcode[_ngcontent-%COMP%]{height:200px;margin-bottom:20px}.title-pay[_ngcontent-%COMP%]{font-size:10px;font-weight:400;top:10px}.title-pay[_ngcontent-%COMP%] div.ms-13[_ngcontent-%COMP%]{margin-left:1.7rem}.qris-container[_ngcontent-%COMP%]{margin-bottom:20px}}']}),o})(),$i=(()=>{class o{constructor(e,n){this._dialogRef=e,this._orderProcessorService=n,this.modalConfig=new D.O,this.modalConfig.title="Clear Order?",this.modalConfig.headerType=U.n.Success}ngOnInit(){}onOk(){this._orderProcessorService.createNewTransactionInSameOutletRegister(!1),this.close()}close(){this._dialogRef.close()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(Z))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-clear"]],decls:4,vars:2,consts:[[3,"config","onOk","onCancel","onClose"],[1,"fw-normal"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return n.onOk()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),t.TgZ(1,"content")(2,"h4",1),t._uU(3),t.qZA()()()),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(3),t.Oqu("This will replace current order's item(s) with blank order."))},dependencies:[y.M]}),o})(),zi=(()=>{class o{constructor(e,n,i,a){this._dialogRef=e,this._orderService=n,this._invoiceCalculatorService=i,this._posHttpResponseService=a,this.modalConfig=new D.O,this.discounts=[],this.modalConfig.title="Order Discount",this.modalConfig.showMoreButton=!0,this.modalConfig.customWidth="415px",this.salesOrderData=this._orderService.Data,this.discount1=this.salesOrderData.Order.Discount,this.discount2=this.salesOrderData.Order.Discount2,this.discountAmount=this.salesOrderData.Order.DiscountAmount,this.surcharge=this.salesOrderData.Invoice.SurchargePcg,this.discountAfterTax=this._invoiceCalculatorService.discountAfterTax,this.currencySymbol=this._invoiceCalculatorService.currencySymbol}onOk(){this.salesOrderData.Order.Discount=this.discount1,this.salesOrderData.Order.Discount2=this.discount2,this.salesOrderData.Invoice.SurchargePcg=this.surcharge,this.salesOrderData.Invoice.TempSurchargePcg=this.surcharge,this.salesOrderData.Order.DiscountAmount=this.discountAmount,this._invoiceCalculatorService.discountAfterTax=this.discountAfterTax,this._orderService.pushNewValue(this.salesOrderData),this.close()}close(){this._dialogRef.close()}onDiscountAfterTaxChange(){this.discountAmount=this.discountAfterTax;let n=this._invoiceCalculatorService.TotalBeforeTax-this.discountAmount,s=c.gT.FilterByID(this._posHttpResponseService.Data.Taxes,this._orderService.Data.Order.TaxTypeID);if(c.gT.IsNotEmpty(s)&&s.CalculationTypeID==yt.E.Add){let l=1+s.Rate/100,d=n*l;this.discountAmount=(d-(d-this.discountAfterTax))/l}this._orderService.Data.Order.DiscountAmount=this.discountAmount}calculateDiscountCalculator(){var e=100;this.discounts.forEach(n=>{e=e*(100-n)/100}),this.discount1=100-e,this._orderService.Data.Order.Discount=this.discount1}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(v),t.Y36(L),t.Y36(C))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-discount"]],decls:59,vars:12,consts:[[3,"config","keydown.F2","onOk","onCancel","onClose"],[1,"container"],[1,"row"],[1,"col-sm-5","pe-4"],[1,"fw-bold","d-block"],[1,"row","g-0"],[1,"col-4"],["type","text","data-cy","discount1","autoNum","","percentage","","decimalPlaces","2",1,"form-control",3,"ngModel","ngModelChange"],[1,"col-auto","d-flex","align-items-center","px-2"],["type","text","data-cy","discount2","autoNum","","percentage","","decimalPlaces","2",1,"form-control",3,"ngModel","ngModelChange"],[1,"col-1","d-flex","align-items-center","ps-2"],[1,"col-sm-4","pe-0","ps-2"],["type","text","data-cy","discountamount","autoNum","",1,"form-control",2,"width","100px",3,"ngModel","ngModelChange"],[1,"col-sm-3"],[1,"col-8"],["type","text","data-cy","surcharge","autoNum","",1,"form-control",3,"ngModel","max","min","ngModelChange"],[1,"col-1","ps-2","d-flex","align-items-center"],[1,"row","mt-8"],[1,"col-sm-12","d-flex","align-items-center"],["type","text","num-neg","false","autoNum","",1,"txtPrice","ms-3","form-control",2,"width","100px",3,"ngModel","ngModelChange"],[1,"row","mt-8","g-0"],[1,"col-12"],[1,"col-2","d-flex","align-items-center"],["type","text","data-cy","discountCal1","autoNum","","percentage","",1,"form-control",2,"width","47px",3,"ngModel","ngModelChange"],[1,"d-flex","align-items-center","col-1","text-end","p-0"],[1,"col-2","d-flex","align-items-center","ps-0"],["type","text","data-cy","discountCal2","autoNum","","percentage","",1,"form-control",2,"width","47px",3,"ngModel","ngModelChange"],["type","text","data-cy","discountCal3","autoNum","","percentage","",1,"form-control",2,"width","47px",3,"ngModel","ngModelChange"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("keydown.F2",function(){return n.onOk()})("onOk",function(){return n.onOk()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),t.TgZ(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"label",4),t._uU(6,"Discount %"),t.qZA(),t.TgZ(7,"div",5)(8,"div",6)(9,"input",7),t.NdJ("ngModelChange",function(a){return n.discount1=a}),t.qZA()(),t.TgZ(10,"div",8),t._uU(11,"% +"),t.qZA(),t.TgZ(12,"div",6)(13,"input",9),t.NdJ("ngModelChange",function(a){return n.discount2=a}),t.qZA()(),t.TgZ(14,"div",10),t._uU(15,"%"),t.qZA()()(),t.TgZ(16,"div",11)(17,"label",4),t._uU(18),t.qZA(),t.TgZ(19,"input",12),t.NdJ("ngModelChange",function(a){return n.discountAmount=a}),t.qZA()(),t.TgZ(20,"div",13)(21,"label",4),t._uU(22,"Surcharge"),t.qZA(),t.TgZ(23,"div",5)(24,"div",14)(25,"input",15),t.NdJ("ngModelChange",function(a){return n.surcharge=a}),t.qZA()(),t.TgZ(26,"div",16)(27,"span"),t._uU(28,"%"),t.qZA()()()()()()(),t.TgZ(29,"more-content")(30,"div",1)(31,"div",17)(32,"div",18)(33,"strong"),t._uU(34,"Discount After Tax"),t.qZA(),t.TgZ(35,"input",19),t.NdJ("ngModelChange",function(a){return n.discountAfterTax=a})("ngModelChange",function(){return n.onDiscountAfterTaxChange()}),t.qZA()()(),t.TgZ(36,"div",20)(37,"div",21)(38,"label",4),t._uU(39,"Discount Calculator"),t.qZA()(),t.TgZ(40,"div",22)(41,"input",23),t.NdJ("ngModelChange",function(a){return n.discounts[0]=a})("ngModelChange",function(){return n.calculateDiscountCalculator()}),t.qZA(),t.TgZ(42,"span"),t._uU(43," %"),t.qZA()(),t.TgZ(44,"div",24)(45,"span"),t._uU(46,"+"),t.qZA()(),t.TgZ(47,"div",25)(48,"input",26),t.NdJ("ngModelChange",function(a){return n.discounts[1]=a})("ngModelChange",function(){return n.calculateDiscountCalculator()}),t.qZA(),t.TgZ(49,"span"),t._uU(50," %"),t.qZA()(),t.TgZ(51,"div",24)(52,"span"),t._uU(53,"+"),t.qZA()(),t.TgZ(54,"div",25)(55,"input",27),t.NdJ("ngModelChange",function(a){return n.discounts[2]=a})("ngModelChange",function(){return n.calculateDiscountCalculator()}),t.qZA(),t.TgZ(56,"span"),t._uU(57," %"),t.qZA()()()()(),t._UZ(58,"footer"),t.qZA()),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(9),t.Q6J("ngModel",n.discount1),t.xp6(4),t.Q6J("ngModel",n.discount2),t.xp6(5),t.hij("Discount ",n.currencySymbol,""),t.xp6(1),t.Q6J("ngModel",n.discountAmount),t.xp6(6),t.Q6J("ngModel",n.surcharge)("max",100)("min",-100),t.xp6(10),t.Q6J("ngModel",n.discountAfterTax),t.xp6(6),t.Q6J("ngModel",n.discounts[0]),t.xp6(7),t.Q6J("ngModel",n.discounts[1]),t.xp6(7),t.Q6J("ngModel",n.discounts[2]))},dependencies:[u.Fj,u.JJ,u.On,y.M,nt.b]}),o})();var Pe=p(89748),Qt=p(47134);const Ut=function(o){return{selected:o}};function ji(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",8),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.onTabChange(i.modalTabState.TYPE))}),t._uU(1," Type "),t.qZA()}if(2&o){const e=t.oxw();t.Q6J("ngClass",t.VKq(1,Ut,e.modalTabState.TYPE==e.currentTabState))}}function Wi(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",11)(1,"label",12)(2,"input",13),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.posData.Order.TypeID=i)})("click",function(){const a=t.CHM(e).$implicit,s=t.oxw(2);return t.KtG(s.onSelectCustomerPoType(a))}),t.qZA(),t._uU(3),t.qZA()()}if(2&o){const e=r.$implicit,n=r.index,i=t.oxw(2);t.xp6(1),t.s9C("for","potype-"+n),t.Q6J("ngClass",t.VKq(6,Ut,i.posData.Order.TypeID==e.ID)),t.xp6(1),t.s9C("id","potype-"+n),t.Q6J("ngModel",i.posData.Order.TypeID)("value",e.ID),t.xp6(1),t.hij(" ",e.Name," ")}}function Xi(o,r){if(1&o&&(t.ynx(0),t.TgZ(1,"div",9),t.YNc(2,Wi,4,8,"div",10),t.qZA(),t.BQk()),2&o){const e=t.oxw();t.xp6(2),t.Q6J("ngForOf",e.poTypes)}}function ta(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"POS-tinymce-editor",17),t.NdJ("valueChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.posData.Order.Note=i)}),t.qZA()}if(2&o){const e=t.oxw(2);t.Q6J("value",e.posData.Order.Note)}}function ea(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"textarea",18),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.posData.Order.Note=i)}),t.qZA()}if(2&o){const e=t.oxw(2);t.Q6J("ngModel",e.posData.Order.Note)}}function na(o,r){if(1&o&&(t.ynx(0),t.TgZ(1,"div",14),t.YNc(2,ta,1,1,"POS-tinymce-editor",15),t.YNc(3,ea,1,1,"textarea",16),t.qZA(),t.BQk()),2&o){const e=t.oxw();t.xp6(2),t.Q6J("ngIf",e.isOnline),t.xp6(1),t.Q6J("ngIf",!e.isOnline)}}function oa(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",28)(1,"span",29),t._uU(2,"@"),t.qZA(),t.TgZ(3,"input",30),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.exchangeRate=i)}),t.qZA()()}if(2&o){const e=t.oxw(2);t.xp6(3),t.Q6J("ngModel",e.exchangeRate)}}function ia(o,r){if(1&o){const e=t.EpF();t.ynx(0),t.TgZ(1,"div",19)(2,"div",20)(3,"strong",21),t._uU(4,"Number of Person"),t.qZA(),t.TgZ(5,"input",22),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.posData.Order.NumberOfPerson=i)}),t.qZA()()(),t.TgZ(6,"div",23)(7,"div",9)(8,"strong",21),t._uU(9,"Currency"),t.qZA(),t.TgZ(10,"div",24)(11,"ng-select",25),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.posData.Order.CurrencyID=i)})("change",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.updateCurrencySymbol(i))}),t.qZA(),t.YNc(12,oa,4,1,"div",26),t.qZA()()(),t.TgZ(13,"div",23)(14,"div",20)(15,"strong",21),t._uU(16,"PO#"),t.qZA(),t.TgZ(17,"input",27),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.posData.Order.PurchaseOrderNumber=i)}),t.qZA()()(),t.BQk()}if(2&o){const e=t.oxw();t.xp6(5),t.Q6J("ngModel",e.posData.Order.NumberOfPerson),t.xp6(6),t.Q6J("items",e.currencies)("ngModel",e.posData.Order.CurrencyID)("clearable",!1),t.xp6(1),t.Q6J("ngIf",e.posData.Order.CurrencyID!=e.defaultCurrencyID),t.xp6(5),t.Q6J("ngModel",e.posData.Order.PurchaseOrderNumber)}}let aa=(()=>{class o{constructor(e,n,i,a,s,l,d,f){this._dialogRef=e,this._orderDataService=n,this._posService=i,this._cashierCalculatorService=a,this._outletRegisterService=s,this._orderHttpService=l,this._toastrService=d,this._onlineService=f,this.config=new D.O,this.modalTabState=Qt.e,this.exchangeRate=1,this.destroy$=new T.x,this.currentTabState=Qt.e.NOTE}get currencies(){return this._posService.Data.Currencies}get poTypes(){return this._posService.Data.PoTypes}ngOnInit(){this.config.title="Invoice Notes",this.subscribeToObservable(),this.copyInvoiceNumberToNote()}subscribeToObservable(){this._orderDataService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.posData=e,this.exchangeRate=this.posData.Order.CurrencyRate}),this._posService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.appConfigJson=e.AppConfigJSON,this.defaultCurrencyID=this.appConfigJson.CoreDefaults.CurrencyID}),this._onlineService.getOnlineStatus$().pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.isOnline=e,this.currentTabState=Qt.e.NOTE,e||(this.currentTabState=Qt.e.TYPE)})}copyInvoiceNumberToNote(){if(this.appConfigJson.ModuleSell.Numbering.FillNoteWithInvoiceNumber&&""==this.posData.Order.Note){let n=this.posData.Order.Number,i=n.slice(n.length-4);this.posData.Order.Note=i}}onOk(e){if("Enter"==e)return;let n=this.posData.Order.Note;n&&n.length>500?this._toastrService.warning("Maximum 500 characters allowed","Warning"):(this.posData.Order.CurrencyRate=this.exchangeRate,this._orderDataService.pushNewValue(this.posData),this._dialogRef.close())}close(){this._dialogRef.close()}updateCurrencySymbol(e){this._cashierCalculatorService.currencySymbol=e.Symbol,this.exchangeRate=e.ExchangeRate}onSelectCustomerPoType(e){let n=this._outletRegisterService.Data;0==e.PrintTemplateID?(n.PrintTemplate=n.DefaultPrintTemplate,this._outletRegisterService.pushNewValue(n)):this._orderHttpService.getSalesOrderPrint(e.PrintTemplateID).pipe((0,m.R)(this.destroy$)).subscribe(i=>{let a=(0,W.d8)(Pe.vb,i.Template);n.PrintTemplate=a,this._outletRegisterService.pushNewValue(n)})}onTabChange(e){this.currentTabState=e}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(v),t.Y36(C),t.Y36(L),t.Y36(q),t.Y36(N.D),t.Y36(I._W),t.Y36(x.q))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-note"]],decls:14,vars:11,consts:[[3,"config","onOk","onCancel","onClose"],[1,"container-fluid"],[1,"row","border-bottom"],["data-cy","note",1,"btn","btn-link","note-tab",3,"ngClass","click"],["class","btn btn-link note-tab","data-cy","type",3,"ngClass","click",4,"ngIf"],["data-cy","other",1,"btn","btn-link","note-tab",3,"ngClass","click"],[1,"row","mt-8"],[4,"ngIf"],["data-cy","type",1,"btn","btn-link","note-tab",3,"ngClass","click"],[1,"col-12"],["class","rad-btn",4,"ngFor","ngForOf"],[1,"rad-btn"],[3,"for","ngClass"],["type","radio",3,"ngModel","value","id","ngModelChange","click"],[1,"col-12","tinymce"],[3,"value","valueChange",4,"ngIf"],["name","note","cols","80","class","form-control","rows","10",3,"ngModel","ngModelChange",4,"ngIf"],[3,"value","valueChange"],["name","note","cols","80","rows","10",1,"form-control",3,"ngModel","ngModelChange"],[1,"row"],[1,"col-6"],[1,"mb-2"],["autoNum","",1,"form-control","w-75","height-input",3,"ngModel","ngModelChange"],[1,"row","mt-3"],[1,"ps-0","d-flex","align-items-center"],["bindLabel","Name","bindValue","ID","placeholder","Outlet","appendTo","body",1,"currency-option",3,"items","ngModel","clearable","ngModelChange","change"],["class","ms-6 d-flex",4,"ngIf"],[1,"form-control","w-75","height-input",3,"ngModel","ngModelChange"],[1,"ms-6","d-flex"],[1,"pt-4"],["type","text","autoNum","",1,"border","border-light","ms-2","form-control",2,"width","100px",3,"ngModel","ngModelChange"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(a){return n.onOk(a)})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),t.TgZ(1,"content")(2,"div",1)(3,"div",2)(4,"div")(5,"a",3),t.NdJ("click",function(){return n.onTabChange(n.modalTabState.NOTE)}),t._uU(6," Note "),t.qZA(),t.YNc(7,ji,2,3,"a",4),t.TgZ(8,"a",5),t.NdJ("click",function(){return n.onTabChange(n.modalTabState.OTHER)}),t._uU(9," Other "),t.qZA()()(),t.TgZ(10,"div",6),t.YNc(11,Xi,3,1,"ng-container",7),t.YNc(12,na,4,2,"ng-container",7),t.YNc(13,ia,18,6,"ng-container",7),t.qZA()()()()),2&e&&(t.Q6J("config",n.config),t.xp6(5),t.Q6J("ngClass",t.VKq(7,Ut,n.modalTabState.NOTE==n.currentTabState)),t.xp6(2),t.Q6J("ngIf",n.isOnline),t.xp6(1),t.Q6J("ngClass",t.VKq(9,Ut,n.modalTabState.OTHER==n.currentTabState)),t.xp6(3),t.Q6J("ngIf",n.modalTabState.TYPE==n.currentTabState),t.xp6(1),t.Q6J("ngIf",n.modalTabState.NOTE==n.currentTabState),t.xp6(1),t.Q6J("ngIf",n.modalTabState.OTHER==n.currentTabState))},dependencies:[g.mk,g.sg,g.O5,$.w9,u.Fj,u._,u.JJ,u.On,y.M,nt.b,Wt.V],styles:[".bg-light-gray{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px,#f5c6cb 30px)!important}.bg-gradient-success{background:repeating-linear-gradient(-60deg,#28a745,#28a745 15px,#a2dbb0 15px,#a2dbb0 30px)!important}.bg-gradient-warning{background:repeating-linear-gradient(-60deg,#FCF3CF,#FCF3CF 15px,#F9E79F 15px,#F9E79F 30px)!important}.bg-light-orange{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-primary{color:#0976b4!important}.text-danger{color:#fb404b!important}.text-dark{color:#5e5e5e!important}.text-success{color:#87cb16!important}.text-black{color:#000!important}.btn-light-blue{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue:focus,.btn-light-blue.focus{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled,.btn-light-blue:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue:not(:disabled):not(.disabled):active,.btn-light-blue:not(:disabled):not(.disabled).active,.show>.btn-light-blue.dropdown-toggle{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue:not(:disabled):not(.disabled):active:focus,.btn-light-blue:not(:disabled):not(.disabled).active:focus,.show>.btn-light-blue.dropdown-toggle:focus{box-shadow:0 0 0 .2rem #c3d1dc80}content>div.container-fluid{min-height:200px}.tinymce a img{z-index:2;position:absolute;right:15px;bottom:19px}.tinymce editor{height:max-content;z-index:1}.rad-btn{position:relative;display:inline-block}.rad-btn label{border:1px solid #dddddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000}.rad-btn input[type=radio]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn label.selected{background:#dcdcdc;border:1px solid #dcdcdc}.btn-link.note-tab{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.note-tab.selected{color:#3b3b3b;border-bottom:4px solid #07a519}a.btn.btn-link.note-tab{color:inherit}.ng-select.currency-option{width:36%!important}\n"],encapsulation:2}),o})();var ee=p(52029),Me=p(70585),ra=p(35593),sa=p(10805);function la(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",12)(1,"div")(2,"h5"),t._uU(3,"Deduct inventory from outlet"),t.qZA()(),t.TgZ(4,"div")(5,"ng-select",13),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.deliveryEntityID=i)}),t.qZA()()()}if(2&o){const e=t.oxw();t.xp6(1),t.ekj("col-6",e.shippingFormVisible)("col-auto",!e.shippingFormVisible),t.xp6(3),t.ekj("col-6",e.shippingFormVisible)("col",!e.shippingFormVisible),t.xp6(1),t.Q6J("disabled",e.isDisabledNgSelectOutlet)("ngModel",e.deliveryEntityID)("items",e.entities)}}function ca(o,r){1&o&&(t.ynx(0),t.TgZ(1,"h5",14),t._uU(2,"Unfulfilled order, product inventory is allocated "),t.qZA(),t.BQk())}function da(o,r){if(1&o){const e=t.EpF();t.ynx(0),t.TgZ(1,"div",29)(2,"div",30)(3,"div",31)(4,"input",32),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.shipping.Name=i)}),t.qZA(),t.TgZ(5,"label",33),t._uU(6,"Recipient"),t.qZA()()(),t.TgZ(7,"div",30)(8,"div",31)(9,"input",34),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.shipping.Phone=i)}),t.qZA(),t.TgZ(10,"label",35),t._uU(11,"Phone"),t.qZA()()()(),t.TgZ(12,"div",29)(13,"div",30)(14,"div",31)(15,"textarea",36),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.shipping.Address=i)}),t.qZA(),t.TgZ(16,"label",37),t._uU(17,"Address"),t.qZA()()(),t.TgZ(18,"div",30)(19,"div",31)(20,"input",38),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw(2);return t.KtG(a.shipping.City=i)}),t.qZA(),t.TgZ(21,"label",39),t._uU(22,"City"),t.qZA()()()(),t.BQk()}if(2&o){const e=t.oxw(2);t.xp6(4),t.Q6J("ngModel",e.shipping.Name),t.xp6(5),t.Q6J("ngModel",e.shipping.Phone),t.xp6(6),t.Q6J("ngModel",e.shipping.Address),t.xp6(5),t.Q6J("ngModel",e.shipping.City)}}const pa=function(){return{standalone:!0}};function ga(o,r){if(1&o){const e=t.EpF();t.ynx(0),t.TgZ(1,"div",15)(2,"div",16)(3,"div",17)(4,"h5",18),t._uU(5," Recipient != Buyer"),t.qZA()(),t.TgZ(6,"div",19)(7,"input",20),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.recipientNotBuyer=i)}),t.qZA(),t._UZ(8,"label",21),t.qZA()(),t.TgZ(9,"div",16)(10,"div",22)(11,"label",23),t._uU(12),t.qZA(),t.TgZ(13,"div")(14,"datepicker",24),t.NdJ("dateChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.posData.Invoice.DateCustom=i)}),t.qZA()()(),t.TgZ(15,"div")(16,"label",25),t._uU(17,"Time"),t.qZA(),t.TgZ(18,"div")(19,"p-calendar",26,27),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.posData.Invoice.TimeCustom=i)}),t.TgZ(21,"p-footer")(22,"button",28),t.NdJ("click",function(){t.CHM(e);const i=t.MAs(20);return t.KtG(i.hideOverlay())}),t.qZA()()()()()()(),t.YNc(23,da,23,4,"ng-container",11),t.BQk()}if(2&o){const e=t.oxw();t.xp6(7),t.Q6J("ngModel",e.recipientNotBuyer),t.xp6(5),t.Oqu(e.dateLabel),t.xp6(2),t.Q6J("date",e.posData.Invoice.DateCustom),t.xp6(1),t.Udp("margin-top","-20px"),t.xp6(4),t.Q6J("ngModel",e.posData.Invoice.TimeCustom)("timeOnly",!0)("ngModelOptions",t.DdM(9,pa)),t.xp6(4),t.Q6J("ngIf",e.recipientNotBuyer)}}let ua=(()=>{class o{constructor(e,n,i,a,s){this._dialogRef=e,this._orderDataService=n,this._posService=i,this._orderProcessorService=a,this.locale=s,this.modalConfig=new D.O,this.isDisabledNgSelectOutlet=!1,this.isDelivery=!1,this.customDate=null,this.shipping=new ee.Q,this.deliveryEntityID="",this.posData=new J.m,this.dateLabel="Fulfillment Date",this.destroy$=new T.x,this.initStartTime(),this.subscribePosData(),this.initModal()}get entities(){return this._posService.Data.Entities}ngOnInit(){this.initShipingFormVisible(),this.initDefaultOrderDelivery(),this.checkRecepientIsBuyer(),this.initDateLabel(),this.initDisabledOutletOption()}initDisabledOutletOption(){this._orderProcessorService.Data.posState==_.IsEdit&&(this.isDisabledNgSelectOutlet=!0)}checkRecepientIsBuyer(){this.recipientNotBuyer=!!c.gT.IsNotEmpty(this.shipping.Name)}initDateLabel(){let e=this._posService.Data.AppConfigJSON;e.ModuleSell.Shipping.DateLabel&&(this.dateLabel=e.ModuleSell.Shipping.DateLabel)}initStartTime(){this.datePipe=new g.uU(this.locale);var e=new Date;this.startTime=e.getHours()+":"+e.getMinutes()}subscribePosData(){this._orderDataService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.posData=e,this.posData.Invoice.DateCustom=this.posData.Invoice.DateCustom?this.posData.Invoice.DateCustom:null,this.deliveryEntityID=e.Action.DeliveryEntityID,this.shipping=e.Shipping?e.Shipping:new ee.Q})}initModal(){this.modalConfig.title="Order Fullfillment",this.modalConfig.customWidth="590px"}initShipingFormVisible(){this.shippingFormVisible=this._posService.Data.AppConfigJSON.ModuleSell.Shipping.DeliveryAddressAlwaysVisible}initDefaultOrderDelivery(){this.isDelivery=this.deliveryEntityID==c.gT.GuidEmpty}changeDelivery(){this.deliveryEntityID=this.isDelivery?c.gT.GuidEmpty:this.posData.Order.EntityID}onOk(){this.setCustomDateField(),this.clearShippingData(),this.posData.Shipping=this.shipping,this.posData.Action.DeliveryEntityID=this.deliveryEntityID,this._orderDataService.pushNewValue(this.posData),this.close()}clearShippingData(){if(!this.recipientNotBuyer)for(const e of Object.getOwnPropertyNames(this.shipping))this.shipping[e]=""}setCustomDateField(){let e=this.posData.Invoice.DateCustom?this.posData.Invoice.DateCustom:null,n=this.posData.Invoice.TimeCustom?this.datePipe.transform(this.posData.Invoice.TimeCustom,"HH:mm"):"00:00";if((this.isDelivery||this.shippingFormVisible)&&e){let i=this.datePipe.transform(this.posData.Invoice.DateCustom,"d MMM y");this.posData.Invoice.CustomDateField=`${i} ${n}`}}close(){this._dialogRef.close()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(v),t.Y36(C),t.Y36(Z),t.Y36(t.soG))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-shipping"]],decls:21,vars:7,consts:[[3,"config","onOk","onCancel","onClose"],[1,"container"],[1,"row","align-items-start","py-2","my-2"],[1,"col"],["name","fontStyle","aria-label","Font Style",3,"ngModel","ngModelChange","change"],["data-cy","Now",3,"value"],[1,"p-7","me-2"],[1,"text-muted","tabDesc"],["data-cy","Later",3,"value"],[1,"p-5"],["class","row align-items-center mt-5",4,"ngIf"],[4,"ngIf"],[1,"row","align-items-center","mt-5"],["bindLabel","Name","bindValue","ID","appendTo","body","placeholder","Outlet","data-cy","DeductInventory",1,"tall","auto-grow",2,"width","250px",3,"disabled","ngModel","items","ngModelChange"],[1,"bg-gradient-warning","text-center","py-7","rounded-3","border","mb-7"],[1,"row","mt-8"],[1,"col-md-6","d-flex","align-items-center"],[1,"me-3","pb-5"],["title","Recipient is not the same as Buyer (ex: when someone buys an item as GIFT for another person)"],[1,"form-check","form-switch","form-switch-lg","ms-1"],["type","checkbox","id","flexSwitchCheckDefault",1,"form-check-input",3,"ngModel","ngModelChange"],["for","flexSwitchCheckDefault",1,"form-check-label"],[1,"w-75"],["for","shippingDate",1,"text-muted","mb-0"],["appearance","outline","width","85","id","shippingDate",3,"date","dateChange"],["for","shippingTime",1,"text-muted","mb-0"],["styleClass","custom-height","id","shippingTime","appendTo","body",3,"ngModel","timeOnly","ngModelOptions","ngModelChange"],["myCalendar",""],["pButton","","type","button","label","Close",3,"click"],[1,"row"],[1,"col-md-6"],[1,"form-floating-outline"],["id","recipient","placeholder","Recipient","type","text",1,"w-100","form-control",3,"ngModel","ngModelChange"],["for","recipient"],["id","phone","placeholder","Phone","type","text",1,"w-100","form-control",3,"ngModel","ngModelChange"],["for","phone"],["id","address","placeholder","Address","type","text",1,"w-100","form-control",3,"ngModel","ngModelChange"],["for","address"],["id","city","placeholder","City","type","text",1,"w-100","form-control",3,"ngModel","ngModelChange"],["for","city"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return n.onOk()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),t.TgZ(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"mat-button-toggle-group",4),t.NdJ("ngModelChange",function(a){return n.isDelivery=a})("change",function(){return n.changeDelivery()}),t.TgZ(6,"mat-button-toggle",5)(7,"h3",6),t._uU(8," Now "),t.TgZ(9,"small",7)(10,"em"),t._uU(11,"(in store purchase)"),t.qZA()()()(),t.TgZ(12,"mat-button-toggle",8)(13,"h3",9),t._uU(14," Later "),t.TgZ(15,"small",7)(16,"em"),t._uU(17,"(shipped to customer address)"),t.qZA()()()()()()(),t.YNc(18,la,6,11,"div",10),t.YNc(19,ca,3,0,"ng-container",11),t.YNc(20,ga,24,10,"ng-container",11),t.qZA()()()),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(5),t.Q6J("ngModel",n.isDelivery),t.xp6(1),t.Q6J("value",!1),t.xp6(6),t.Q6J("value",!0),t.xp6(6),t.Q6J("ngIf",!n.isDelivery),t.xp6(1),t.Q6J("ngIf",n.isDelivery),t.xp6(1),t.Q6J("ngIf",n.isDelivery||n.shippingFormVisible))},dependencies:[g.O5,$.w9,u.Fj,u.Wl,u.JJ,u.On,y.M,gt.QB,pt.A9,pt.Yi,Me.f,ra.Hq,sa.$_],styles:[".container[_ngcontent-%COMP%]{min-height:220px}input[type=radio][_ngcontent-%COMP%]{margin-top:-.2rem;vertical-align:middle}.mat-button-toggle-checked[_ngcontent-%COMP%]{background-color:#dfeffc;color:#0976b4} p-calendar span.p-calendar.p-calendar-timeonly.custom-height{height:44px;margin-top:3px;width:55px}.form-check-input[_ngcontent-%COMP%]{clear:left}.form-switch.form-switch-lg[_ngcontent-%COMP%]{margin-bottom:.8rem}.form-switch.form-switch-lg[_ngcontent-%COMP%] .form-check-input[_ngcontent-%COMP%]{height:1.5rem;width:2.75rem;border-radius:3rem}.form-check-input[_ngcontent-%COMP%]:focus{border-color:#89b03e!important}.form-check-input[_ngcontent-%COMP%]:checked{border-color:#89b03e!important;background-color:#89b03e!important}.tabDesc[_ngcontent-%COMP%]{font-size:80%;font-weight:400}"]}),o})();function ma(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",30),t._UZ(1,"i",31),t.TgZ(2,"ng-select",32),t.NdJ("change",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.updateTax(i))}),t.qZA()()}if(2&o){const e=t.oxw();t.xp6(2),t.Q6J("clearable",!1)("items",e.Taxes)("ngModel",e.posData.Order.TaxTypeID)}}function _a(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",33),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.openDiscountModal())}),t._UZ(1,"i",34),t.TgZ(2,"span"),t._uU(3,"Discount"),t.qZA()()}}function ha(o,r){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.qZA()),2&o){const e=t.oxw(2);t.xp6(1),t.hij("(",null==e.posData?null:e.posData.Order.Discount,"%) ")}}function fa(o,r){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.ALo(2,"number"),t.qZA()),2&o){const e=t.oxw(2);t.xp6(1),t.hij("(",t.xi3(2,1,null==e.posData?null:e.posData.Order.Discount,"1.0-4"),"%)")}}function Ca(o,r){if(1&o&&(t.TgZ(0,"tr",35)(1,"th",36),t._uU(2),t.YNc(3,ha,2,1,"span",11),t.YNc(4,fa,3,4,"span",11),t.qZA(),t._UZ(5,"td",14),t.ALo(6,"number"),t.qZA()),2&o){const e=t.oxw();t.xp6(2),t.hij(" ",null==e.AppConfigJSON?null:e.AppConfigJSON.CorePrint.Alias.Discount1," "),t.xp6(1),t.Q6J("ngIf",e.isIgnoreDecimalDisc1),t.xp6(1),t.Q6J("ngIf",!(null!=e.AppConfigJSON&&e.AppConfigJSON.PrintConfigInvoice.Footer.DiscountIgnoredDecimal)),t.xp6(1),t.Q6J("innerHtml",t.lcZ(6,4,-1*e._cashierCalculatorService.Discount1Amount),t.oJD)}}function ba(o,r){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.qZA()),2&o){const e=t.oxw(2);t.xp6(1),t.hij("(",null==e.posData?null:e.posData.Order.Discount2,"%)")}}function Pa(o,r){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.ALo(2,"number"),t.qZA()),2&o){const e=t.oxw(2);t.xp6(1),t.hij(" (",t.xi3(2,1,null==e.posData?null:e.posData.Order.Discount2,"1.0-4"),"%) ")}}function Ma(o,r){if(1&o&&(t.TgZ(0,"tr")(1,"th",36),t._uU(2),t.YNc(3,ba,2,1,"span",11),t.YNc(4,Pa,3,4,"span",11),t.qZA(),t._UZ(5,"td",14),t.ALo(6,"number"),t.qZA()),2&o){const e=t.oxw();t.xp6(2),t.hij(" ",null==e.AppConfigJSON?null:e.AppConfigJSON.CorePrint.Alias.Discount2," "),t.xp6(1),t.Q6J("ngIf",e.isIgnoreDecimalDisc2),t.xp6(1),t.Q6J("ngIf",!(null!=e.AppConfigJSON&&e.AppConfigJSON.PrintConfigInvoice.Footer.DiscountIgnoredDecimal)),t.xp6(1),t.Q6J("innerHtml",t.lcZ(6,4,-1*e._cashierCalculatorService.Discount2Amount),t.oJD)}}function ya(o,r){if(1&o&&(t.TgZ(0,"tr"),t._UZ(1,"th",13)(2,"td",37),t.ALo(3,"number"),t.qZA()),2&o){const e=t.oxw();t.xp6(1),t.Q6J("innerHtml",null==e._cashierCalculatorService||null==e._cashierCalculatorService.tax?null:e._cashierCalculatorService.tax.Label,t.oJD),t.xp6(1),t.Q6J("innerHtml",t.lcZ(3,2,e._cashierCalculatorService.TaxAmount),t.oJD)}}function va(o,r){if(1&o&&(t.TgZ(0,"tr")(1,"th",36),t._uU(2,"Deposit"),t.qZA(),t._UZ(3,"td",38),t.ALo(4,"number"),t.qZA()),2&o){const e=t.oxw();t.xp6(3),t.Q6J("innerHtml",t.lcZ(4,1,-1*(null==e.posData?null:e.posData.Order.Deposit)),t.oJD)}}function Oa(o,r){if(1&o&&(t.TgZ(0,"div",39)(1,"strong"),t._uU(2,"Fulfillment From: "),t.qZA(),t.TgZ(3,"span"),t._uU(4),t.qZA()()),2&o){const e=t.oxw();t.xp6(4),t.Oqu(e.getOutletName(e.posData.Action.DeliveryEntityID))}}const xa=function(o){return{"bg-gradient-warning":o}};function Da(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",40),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.openFullfillmentModal())}),t._UZ(1,"i",41),t.TgZ(2,"span"),t._uU(3,"Fulfillment"),t.qZA()()}if(2&o){const e=t.oxw();t.Q6J("ngClass",t.VKq(1,xa,e.warningFullfillment))}}let Sa=(()=>{class o{constructor(e,n,i,a,s,l,d,f,b,O){this._matDialog=e,this._orderDataService=n,this._cashierCalculatorService=i,this._posService=a,this._toastr=s,this._orderProcessorService=l,this._outletService=d,this._onlineStatusService=f,this._userRoleService=b,this._promotionEventService=O,this.role=new Y.Q,this.discountPromotion=[],this.destroy$=new T.x,this.Taxes=this._posService.Data.Taxes,this.AppConfigJSON=this._posService.Data.AppConfigJSON,this.isDepositEnabled=this.AppConfigJSON.ApplicationParkAndRetrieve.Deposit.Enabled,this.restriction=this._posService.Data.Restriction}handleF8(){this._matDialog.openDialogs&&this._matDialog.openDialogs.length>0||this.payButtonClicked()}ngOnInit(){this.subscribeToObservable(),this.initConfig(),this.initOrderTypeID()}subscribeToObservable(){this._orderDataService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.posData=e,this.setStatusIgnoreDecimalDisc(),this.initOrderTypeID(),this.warningFullfillment=c.gT.IsEmpty(e.Action.DeliveryEntityID)}),this._onlineStatusService.getOnlineStatus$().subscribe(e=>{this.onlineStatus=e}),this._userRoleService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.taxRestriction=e.TaxRestriction,this.enabledDiscount=e.Discount}),this._outletService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{let n=e.Promotion.filter(i=>"Discount"===i.PromotionTypeString);this.discountPromotion=n})}setStatusIgnoreDecimalDisc(){this.isIgnoreDecimalDisc1=this.checkIgnoreDecimalDisc(this.posData.Order.Discount),this.isIgnoreDecimalDisc2=this.checkIgnoreDecimalDisc(this.posData.Order.Discount2)}initOrderTypeID(){0==this.posData.Order.TypeID&&(this.posData.Order.TypeID=this._posService.Data.PoTypes[0].ID)}initConfig(){this.paymentRestrction=this.restriction.PaymentRestriction,this.enabledDiscount=this.restriction.Discount,this.taxRestriction=this.restriction.TaxRestriction,this.priceVisibleRestriction=this.restriction.PriceVisibleRestriction,this.shippingRestriction=this.restriction.ShippingRestriction}updateTax(e){this._orderDataService.Data.Order.TaxTypeID=e.ID,this._cashierCalculatorService.tax=e,this._orderDataService.pushNewValue()}payButtonClicked(){!this.isCartNotEmpty()||!this.isSalesPersonValid()||!this.validateCustomerID()||!this.isCustomerRequired()||!this.validatePromotionDiscount()||this.OpenPaymentModal()}validatePromotionDiscount(){let n=(this._outletService.Data.Promotion?this._outletService.Data.Promotion:[]).find(l=>l.TypeID===w.Discount),a=this._promotionEventService.selectedPromotion,s=!0;return this.AppConfigJSON.ModuleSell.MandatoryActiveDiscount&&n&&(a?a.TypeID!=w.Discount&&(s=!1):s=!1),0==s&&(this._matDialog.open(pe,{id:"promotion-event"}),this._toastr.warning("You need to apply Discount promotion","Required Promotion")),s}OpenPaymentModal(){this._matDialog.open(Ki,{id:"ModalPayment"}).afterClosed().pipe((0,m.R)(this.destroy$)).subscribe()}isCartNotEmpty(){return!(this.posData.CartItems.length<1&&(this._toastr.warning(c.g7.emptyPOItem,"Warning!"),1))}isSalesPersonValid(){return!this.AppConfigJSON.ModuleSell.Header.SalesPersonRequired||this.posData.Order.SalesID!=c.gT.GuidEmpty&&null!=this.posData.Order.SalesID||(this._toastr.warning(c.g7.emptySalesPerson,"Warning!"),!1)}isCustomerRequired(){return!(this.AppConfigJSON.ModuleSell.Header.CustomerRequired&&this.onlineStatus&&c.gT.IsEmpty(this.posData.Order.CustomerID)&&(this._toastr.warning(c.g7.emptyCustomer,"Warning!"),1))}validateCustomerID(){if(c.gT.IsEmpty(this.posData.Order.CustomerID)){let n=this._orderProcessorService.Data.InputTextValue;if(c.gT.IsNotEmpty(n)&&(this._toastr.warning("Customer is not Saved","Warning"),this.AppConfigJSON.ModuleSell.Customer.QuickAddEnabled))return this.openCustomerModal(n),!1}return!0}openCustomerModal(e){this._matDialog.open(_e,{data:{name:e},autoFocus:!1}).afterClosed().subscribe(n=>{n&&this.OpenPaymentModal()})}openDiscountModal(){this._matDialog.open(zi)}openClearOrderModal(){this._matDialog.open($i)}openNotesModal(){this._matDialog.open(aa,{width:"45%"})}openFullfillmentModal(){this._matDialog.open(ua)}getOutletName(e){if(!c.gT.IsEmpty(e))return this._posService.getOutletName(e)}isFulfillmentVisible(e,n){return!c.gT.IsEmpty(n)&&e!=n}checkIgnoreDecimalDisc(e){return this.AppConfigJSON.PrintConfigInvoice.Footer.DiscountIgnoredDecimal&&e%1==0}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.uw),t.Y36(v),t.Y36(L),t.Y36(C),t.Y36(I._W),t.Y36(Z),t.Y36(q),t.Y36(x.q),t.Y36(K),t.Y36(rt))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-cart-action"]],hostBindings:function(e,n){1&e&&t.NdJ("keydown.F8",function(a){return n.handleF8(a)},!1,t.Jf7)},decls:52,vars:28,consts:[[1,"row","g-0","cart-footer","justify-content-between"],[1,"col-auto","align-self-center","mobile-view"],[1,"row","g-0"],["class","col-auto mx-5 d-flex flex-row",4,"ngIf"],[1,"col-auto"],["data-cy","Discount","class","btn btn-gray fw-normal disc",3,"click",4,"ngIf"],[1,"col-auto","summary","mobile-view"],[1,"table",3,"hidden"],[1,"table-light","border-top-0",2,"vertical-align","middle","line-height","30px !important"],[1,"text-end","border-top-0",2,"width","100px",3,"innerHtml"],["context-menu","ctrl.MenuDiscount",4,"ngIf"],[4,"ngIf"],[3,"hidden"],[1,"table-light",2,"vertical-align","middle","line-height","30px !important",3,"innerHtml"],[1,"text-danger","text-end","text-danger",3,"innerHtml"],[1,"text-end",3,"ngClass","innerHtml"],[1,"mt-5","row","g-0","action-buttons","justify-content-between"],[1,"col-auto","mobile-view"],[1,"position-relative"],["class","cashier-note-arrow arrow-box-right",4,"ngIf"],["class","btn btn-gray mobile-view","data-cy","Fulfillment",3,"ngClass","click",4,"ngIf"],[1,"col-auto","mobile-view","ms-3"],["data-cy","Note",1,"btn","btn-gray","w-100",3,"click"],[1,"fa-regular","fa-sticky-note","pe-2"],[1,"btn","btn-gray","mobile-view",3,"hidden","click"],[1,"fa-regular","fa-window-close","pe-2"],["data-cy","PaySales",1,"ms-auto","btn","btn-success","pay","mobile-view",3,"hidden","click"],[1,"d-flex"],[1,"ms-auto"],[1,"position-absolute","fst-italic","right-bottom"],[1,"col-auto","mx-5","d-flex","flex-row"],["aria-hidden","true",1,"fa","fa-tags","d-flex","align-items-center","me-2"],["bindLabel","Label","bindValue","ID","placeholder","Tax","data-cy","Tax",2,"width","125px",3,"clearable","items","ngModel","change"],["data-cy","Discount",1,"btn","btn-gray","fw-normal","disc",3,"click"],["aria-hidden","true",1,"fa","fa-tags","pe-2"],["context-menu","ctrl.MenuDiscount"],[1,"table-light",2,"vertical-align","middle","line-height","30px !important"],[1,"text-end",3,"innerHtml"],[1,"text-end","text-danger",3,"innerHtml"],[1,"cashier-note-arrow","arrow-box-right"],["data-cy","Fulfillment",1,"btn","btn-gray","mobile-view",3,"ngClass","click"],[1,"fa","fa-truck","pe-2"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0)(1,"div",1)(2,"div",2),t.YNc(3,ma,3,3,"div",3),t.TgZ(4,"div",4),t.YNc(5,_a,4,0,"a",5),t.qZA()()(),t.TgZ(6,"div",6)(7,"table",7)(8,"tbody")(9,"tr")(10,"th",8),t._uU(11,"Amount"),t.qZA(),t._UZ(12,"td",9),t.ALo(13,"number"),t.qZA(),t.YNc(14,Ca,7,6,"tr",10),t.YNc(15,Ma,7,6,"tr",11),t.TgZ(16,"tr",12),t._UZ(17,"th",13)(18,"td",14),t.ALo(19,"number"),t.qZA(),t.YNc(20,ya,4,4,"tr",11),t.TgZ(21,"tr",12),t._UZ(22,"th",13)(23,"td",15),t.ALo(24,"number"),t.qZA(),t.YNc(25,va,5,3,"tr",11),t.qZA()()()(),t.TgZ(26,"div",16)(27,"div",17)(28,"div",18),t.YNc(29,Oa,5,1,"div",19),t.YNc(30,Da,4,3,"a",20),t.qZA()(),t.TgZ(31,"div",21)(32,"a",22),t.NdJ("click",function(){return n.openNotesModal()}),t._UZ(33,"i",23),t.TgZ(34,"span"),t._uU(35,"Note"),t.qZA()()(),t.TgZ(36,"div",21)(37,"a",24),t.NdJ("click",function(){return n.openClearOrderModal()}),t._UZ(38,"i",25),t.TgZ(39,"span"),t._uU(40,"Clear"),t.qZA()()(),t.TgZ(41,"div",21)(42,"a",26),t.NdJ("click",function(){return n.payButtonClicked()}),t.TgZ(43,"div",27)(44,"strong"),t._uU(45,"Pay:"),t.qZA(),t.TgZ(46,"span",28),t._uU(47),t.ALo(48,"number"),t.qZA()(),t.TgZ(49,"small",29),t._uU(50,"(F8)"),t.qZA()()()(),t._UZ(51,"div")),2&e&&(t.xp6(3),t.Q6J("ngIf",!n.taxRestriction),t.xp6(2),t.Q6J("ngIf",n.enabledDiscount),t.xp6(2),t.Q6J("hidden",n.priceVisibleRestriction),t.xp6(5),t.Q6J("innerHtml",t.lcZ(13,20,n._cashierCalculatorService.GrossTotal),t.oJD),t.xp6(2),t.Q6J("ngIf",0!=(null==n.posData?null:n.posData.Order.Discount)),t.xp6(1),t.Q6J("ngIf",0!=(null==n.posData?null:n.posData.Order.Discount2)),t.xp6(1),t.Q6J("hidden",0==(null==n.posData?null:n.posData.Order.DiscountAmount)),t.xp6(1),t.Q6J("innerHtml",(null==n.AppConfigJSON?null:n.AppConfigJSON.CorePrint.Alias.DiscountAmount)+" "+(null==n._cashierCalculatorService?null:n._cashierCalculatorService.currencySymbol),t.oJD),t.xp6(1),t.Q6J("innerHtml",t.lcZ(19,22,-1*(null==n.posData?null:n.posData.Order.DiscountAmount)),t.oJD),t.xp6(2),t.Q6J("ngIf",null==n._cashierCalculatorService||null==n._cashierCalculatorService.tax?null:n._cashierCalculatorService.tax.Rate),t.xp6(1),t.Q6J("hidden",0==(null==n.posData?null:n.posData.Invoice.SurchargePcg)),t.xp6(1),t.Q6J("innerHtml","SURCHARGE "+(null==n.posData?null:n.posData.Invoice.SurchargePcg)+" %",t.oJD),t.xp6(1),t.Q6J("ngClass",(null==n.posData?null:n.posData.Invoice.SurchargePcg)<0?"text-danger":"")("innerHtml",t.lcZ(24,24,n._cashierCalculatorService.SurchargeAmount),t.oJD),t.xp6(2),t.Q6J("ngIf",(null==n.posData?null:n.posData.Order.Deposit)>0&&n.isDepositEnabled),t.xp6(4),t.Q6J("ngIf",n.isFulfillmentVisible(n.posData.Order.EntityID,n.posData.Action.DeliveryEntityID)),t.xp6(1),t.Q6J("ngIf",!n.shippingRestriction),t.xp6(7),t.Q6J("hidden",n.role.ClearCartRestriction),t.xp6(5),t.Q6J("hidden",n.paymentRestrction),t.xp6(5),t.Oqu(n.priceVisibleRestriction?"-":t.lcZ(48,26,n._cashierCalculatorService.Data)))},dependencies:[g.mk,g.O5,$.w9,u.JJ,u.On,g.JJ],styles:['div.row.cart-footer[_ngcontent-%COMP%]{border-top:solid 1px #cfcfcf;min-height:85px}div.row.cart-footer[_ngcontent-%COMP%] div.summary[_ngcontent-%COMP%] table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], div.row.cart-footer[_ngcontent-%COMP%] div.summary[_ngcontent-%COMP%] table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-size:.75rem;border-left:solid 1px #cfcfcf;border-bottom:solid 1px #cfcfcf;line-height:16px!important}div.row.cart-footer[_ngcontent-%COMP%] div.summary[_ngcontent-%COMP%] table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:5px 8px}div.row.cart-footer[_ngcontent-%COMP%] div.summary[_ngcontent-%COMP%] table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:5px}div.row.cart-footer[_ngcontent-%COMP%] .disc[_ngcontent-%COMP%]{padding-top:7px;padding-bottom:6px}div.row.action-buttons[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{font-size:1.125rem;padding:15px 16px}div.row.action-buttons[_ngcontent-%COMP%] .btn-success[_ngcontent-%COMP%]{width:195px}div.row.action-buttons[_ngcontent-%COMP%] .right-bottom[_ngcontent-%COMP%]{font-size:.625rem;right:4px}.cashier-note-arrow[_ngcontent-%COMP%]{position:absolute;min-width:130px;max-width:180px;min-height:55px;background-color:#ffffe1!important;right:110%;top:0%;z-index:1;text-align:center;padding:8px 2px;border:1px solid #bbbbbb!important}.cashier-note-arrow[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{font-style:italic}.cashier-note-arrow[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{margin-top:3px;font-family:Roboto Slab,serif;display:block;text-transform:uppercase}.cashier-note-arrow[_ngcontent-%COMP%]:after{border-left-color:#ffffe1!important}.arrow-box-right[_ngcontent-%COMP%]:before{border-width:6px!important;margin-top:-6px!important}@media (max-width: 575.98px){.mobile-view[_ngcontent-%COMP%]{width:100%!important;margin-top:5px}}.arrow-box-right[_ngcontent-%COMP%]{position:absolute;background:white;border:2px solid #bbbbbb;border-radius:.25rem}.arrow-box-right[_ngcontent-%COMP%]:after, .arrow-box-right[_ngcontent-%COMP%]:before{left:100%;top:50%;border:solid transparent;content:"";height:0;width:0;position:absolute;pointer-events:none}.arrow-box-right[_ngcontent-%COMP%]:after{border-color:#0000;border-left-color:#fff;border-width:5px;margin-top:-5px}.arrow-box-right[_ngcontent-%COMP%]:before{border-color:#c2e1f500;border-left-color:#bbb;border-width:8px;margin-top:-8px}.btn-gray[_ngcontent-%COMP%]{background-color:#f4f4f4;border:1px solid #d6d6d6;font-weight:700;color:#545454!important;background:linear-gradient(to bottom,#ffffff 0%,#eeeeee 100%)}']}),o})(),Ta=(()=>{class o{constructor(){}}return o.\u0275fac=function(e){return new(e||o)},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-cart"]],decls:4,vars:0,consts:[[1,"cashier"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0),t._UZ(1,"pos-cart-header")(2,"pos-cart-display")(3,"pos-cart-action"),t.qZA())},dependencies:[$o,fi,Sa],styles:['@media print{.cashier[_ngcontent-%COMP%], pos-quick-key[_ngcontent-%COMP%], pos-header[_ngcontent-%COMP%], pos-toolbar[_ngcontent-%COMP%]{display:none}}.quickKey[_ngcontent-%COMP%]{margin-right:10px}.cashier[_ngcontent-%COMP%] [_ngcontent-%COMP%]::-webkit-input-placeholder{font-style:italic}.cashier[_ngcontent-%COMP%] [_ngcontent-%COMP%]:-moz-placeholder{font-style:italic}.cashier[_ngcontent-%COMP%] [_ngcontent-%COMP%]::-moz-placeholder{font-style:italic}.cashier[_ngcontent-%COMP%] [_ngcontent-%COMP%]:-ms-input-placeholder{font-style:italic}.cashier[_ngcontent-%COMP%] div.container-fluid[_ngcontent-%COMP%] div.row.body[_ngcontent-%COMP%] div.quickKey[_ngcontent-%COMP%]{width:420px;margin-right:10px}.cashier[_ngcontent-%COMP%] div.container-fluid[_ngcontent-%COMP%] div.row.body[_ngcontent-%COMP%] div.cart[_ngcontent-%COMP%]{width:570px}@media only screen and (max-width: 1280px){input[id=ContactID][_ngcontent-%COMP%]{width:135px}}@media only screen and (max-width: 1215px){input[id=ContactID][_ngcontent-%COMP%]{width:120px}}@media only screen and (max-width: 1185px){input[id=ContactID][_ngcontent-%COMP%]{width:140px}}.simple-keyboard[_ngcontent-%COMP%]{width:20vw;position:absolute;left:77%;top:30%;z-index:1200} .hg-theme-default .hg-button{height:70px!important;font-size:16px!important} .hg-button-bksp{width:21px} .hg-button[data-skbtn="{enter}"]{width:90px}.cashier[_ngcontent-%COMP%]{max-width:37rem;min-width:34rem}@media (max-width: 1200px){.cashier[_ngcontent-%COMP%]{width:40rem}}@media (max-width: 1172px){.cashier[_ngcontent-%COMP%]{width:30rem}}']}),o})();var Ia=p(11989);let ye=(()=>{class o{constructor(e,n,i,a){this._cartService=e,this._posService=n,this._orderDataService=i,this._matDialog=a,this._quickKeySubject=new H.X(new Ia.AM),this.quickKey$=this._quickKeySubject.asObservable(),this._orderDataService.Data$.subscribe(s=>{this.Items=s.CartItems})}get _appConfigJSON(){return this._posService.Data.AppConfigJSON}addQuickKeyItem(e){this._cartService.addCartItemById(e).then(()=>{this._appConfigJSON.ModuleSell.ProductDialog.OpenOnNewItemAdded&&this._matDialog.open(Rt,{data:{index:this.Items.length-1}})}).catch(n=>{window.alert(n)})}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(at),t.LFG(C),t.LFG(v),t.LFG(h.uw))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();function ka(o,r){if(1&o&&t._UZ(0,"img",17),2&o){const e=t.oxw().$implicit;t.Q6J("src",e.ImageURLClient.indexOf("cloudinary")>-1?"https:"+e.ImageURLClient:e.ImageURLClient,t.LSH)}}function Aa(o,r){if(1&o&&(t.TgZ(0,"p"),t._uU(1),t.ALo(2,"slice"),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.Oqu(t.Dn7(2,1,e.Display,0,3))}}function wa(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",13)(1,"a",14),t.NdJ("click",function(){const a=t.CHM(e).$implicit,s=t.oxw(3);return t.KtG(s.select(a))}),t.YNc(2,ka,1,1,"img",15),t.YNc(3,Aa,3,5,"p",16),t.TgZ(4,"small"),t._uU(5),t.ALo(6,"slice"),t.qZA()()()}if(2&o){const e=r.$implicit;t.xp6(2),t.Q6J("ngIf",e.ImageURLClient),t.xp6(1),t.Q6J("ngIf",!e.ImageURLClient),t.xp6(2),t.Oqu(t.Dn7(6,3,e.Display,0,36))}}const ve=function(){return["/menu/Outlets/Master/Quick_Key_Templates/Form"]},Na=function(o){return{ID:o}};function Za(o,r){if(1&o&&(t.TgZ(0,"mat-tab",6)(1,"div",7)(2,"div",8),t.YNc(3,wa,7,7,"div",9),t.TgZ(4,"div",10)(5,"a",11),t._UZ(6,"i",12),t.qZA()()()()()),2&o){const e=r.$implicit,n=t.oxw(2);t.Q6J("label",e.Name),t.xp6(3),t.Q6J("ngForOf",e.Items),t.xp6(2),t.Q6J("routerLink",t.DdM(4,ve))("queryParams",t.VKq(5,Na,n.quickKey.ID))}}function Ja(o,r){if(1&o&&(t.TgZ(0,"mat-tab-group",4),t.YNc(1,Za,7,7,"mat-tab",5),t.qZA()),2&o){const e=t.oxw();t.Q6J("disableRipple",!0)("hidden",e.subQuickKey),t.xp6(1),t.Q6J("ngForOf",e.quickKey.Groups)}}function Ra(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",13)(1,"a",14),t.NdJ("click",function(){const a=t.CHM(e).$implicit,s=t.oxw(2);return t.KtG(s.selectChild(a.ID))}),t.TgZ(2,"p"),t._uU(3),t.ALo(4,"limitTo"),t.qZA(),t.TgZ(5,"small"),t._uU(6),t.ALo(7,"limitTo"),t.qZA()()()}if(2&o){const e=r.$implicit;t.xp6(3),t.Oqu(t.xi3(4,2,e.Model,3)),t.xp6(3),t.Oqu(t.xi3(7,5,e.Model,30))}}function qa(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",18)(1,"div",19),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.back())}),t.TgZ(2,"div",20),t._UZ(3,"i",21),t.qZA(),t.TgZ(4,"div",22)(5,"b"),t._uU(6),t.qZA()()(),t.TgZ(7,"div",23),t.YNc(8,Ra,8,8,"div",9),t.qZA()()}if(2&o){const e=t.oxw();t.xp6(6),t.hij(" ",e.subQuickKey.Name," "),t.xp6(2),t.Q6J("ngForOf",e.subQuickKey.Items)}}const Fa=function(o){return{OutletID:o}};function Qa(o,r){if(1&o&&(t.TgZ(0,"a",24)(1,"strong"),t._uU(2,"QUICK KEYS UNCONFIGURED"),t.qZA(),t._UZ(3,"i",25),t.TgZ(4,"span"),t._uU(5,"Click here to setup your Quick keys"),t.qZA()()),2&o){const e=t.oxw();t.Q6J("routerLink",t.DdM(2,ve))("queryParams",t.VKq(3,Fa,e.entityID))}}let Ua=(()=>{class o{constructor(e,n){this._quickKeyService=e,this._outletRegisterService=n,this.destroy$=new T.x}ngOnInit(){this.subscribeToObservableChanges()}subscribeToObservableChanges(){this._outletRegisterService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.entityID=e.EntityID,this.setQuickey(e.QuickKeyPack)})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}setQuickey(e){if(e){let n;e.Groups&&0!==e.Groups.length&&(n=e.Groups),this.quickKey=n?e:null}}addQuickKeyItem(e){this._quickKeyService.addQuickKeyItem(e)}selectChild(e){this.addQuickKeyItem(e),this.back(),this.openNextProduct(this.NextProductID)}select(e){this.NextProductID=e.NextProductID,!e.Children||e.Children.length<1?this.selectChild(e.ItemID):1==e.Children.length?this.selectChild(e.Children[0].ID):this.subQuickKey={Items:e.Children,Name:e.Display}}openNextProduct(e){c.gT.IsNotEmpty(e)&&this.data.Groups.forEach(n=>{const i=n.Items.find(a=>a.ProductID==e);null!=i&&i.Children.length>1&&(this.NextProductID=i.NextProductID,this.subQuickKey={Items:i.Children,Name:i.Display})})}back(){delete this.subQuickKey}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(ye),t.Y36(q))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-quick-key"]],inputs:{data:"data"},decls:5,vars:4,consts:[[1,"quickKeys",3,"ngClass"],["animationDuration","0ms","class","quickKeyTabs",3,"disableRipple","hidden",4,"ngIf","ngIfElse"],["class","container",4,"ngIf"],["noQuickKey",""],["animationDuration","0ms",1,"quickKeyTabs",3,"disableRipple","hidden"],[3,"label",4,"ngFor","ngForOf"],[3,"label"],[1,"container","tabItems"],[1,"row","g-0"],["class","col-3 column",4,"ngFor","ngForOf"],[1,"col-3","column","add"],[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"],[3,"click"],[3,"src",4,"ngIf"],[4,"ngIf"],[3,"src"],[1,"container"],[1,"row","g-0","border","align-items-center","variants-header","cursor",3,"click"],[1,"col-auto","border-end","py-5","px-7"],["aria-hidden","true",1,"fa","fa-arrow-left"],[1,"col","text-center","fw-bold","text-uppercase","h5"],[1,"tabItems","row","g-0"],["id","LinkConfigureQuickkey","target","_blank",3,"routerLink","queryParams"],["aria-hidden","true",1,"fa-regular","fa-hand-pointer"]],template:function(e,n){if(1&e&&(t.TgZ(0,"section",0),t.YNc(1,Ja,2,3,"mat-tab-group",1),t.YNc(2,qa,9,2,"div",2),t.YNc(3,Qa,6,5,"ng-template",null,3,t.W1O),t.qZA()),2&e){const i=t.MAs(4);t.Q6J("ngClass",n.quickKey?"":"no-quick-key"),t.xp6(1),t.Q6J("ngIf",n.quickKey)("ngIfElse",i),t.xp6(1),t.Q6J("ngIf",n.subQuickKey)}},dependencies:[g.mk,g.sg,g.O5,E.SP,E.uX,S.yS,g.OU,k.OI],styles:['.btn-add[_ngcontent-%COMP%]{-webkit-border-radius:50%;-moz-border-radius:50%;padding:6px 10px;cursor:pointer;right:-14px;top:5px;border:solid 1px #dddddd}section.quickKeys.no-quick-key[_ngcontent-%COMP%]{background-image:url(//res.cloudinary.com/pos/image/upload/POS/Images/Cashier/no-quick-key.png);background-repeat:no-repeat;height:544px;position:relative}.quickKeys[_ngcontent-%COMP%] .tabItems[_ngcontent-%COMP%] .column[_ngcontent-%COMP%] > a[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{height:80px;width:80px;display:block;margin:0 auto;border-top-left-radius:5px;border-bottom-right-radius:5px;border:solid 1px #dddddd}.quickKeys[_ngcontent-%COMP%] .row.g-0.border.align-items-center.variants-header.cursor[_ngcontent-%COMP%]{background:linear-gradient(to bottom,#ffffff 0%,#eeeeee 100%)}.btn-add[_ngcontent-%COMP%]{-webkit-border-radius:50%;-moz-border-radius:50%;padding:6px 10px;cursor:pointer;right:-14px;top:5px;border:solid 1px #DDDDDD}section.quickKeys.no-quick-key[_ngcontent-%COMP%]{background-image:url(//res.cloudinary.com/pos/image/upload/POS/Images/Cashier/no-quick-key.png);background-repeat:no-repeat;height:544px}.quickKeys[_ngcontent-%COMP%] .quickKeyTabs[_ngcontent-%COMP%] div.row[_ngcontent-%COMP%]{border-bottom:0px;display:flex;border-radius:3px;cursor:pointer}.quickKeys[_ngcontent-%COMP%] .quickKeyTabs[_ngcontent-%COMP%] div.row[_ngcontent-%COMP%] > div.col[_ngcontent-%COMP%]{background:#ffffff;background:linear-gradient(to bottom,#ffffff 0%,#eeeeee 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#ffffff",endColorstr="#eeeeee",GradientType=0);height:44px;max-height:44px;overflow:hidden;color:#aaa!important;font-size:14px;text-decoration:none;font-weight:700;outline:none;text-transform:uppercase;text-align:center;min-width:25%;display:flex;justify-content:center}.quickKeys[_ngcontent-%COMP%] .quickKeyTabs[_ngcontent-%COMP%] div.row[_ngcontent-%COMP%] > div.col[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{align-self:center;text-align:center}.quickKeys[_ngcontent-%COMP%] .quickKeyTabs[_ngcontent-%COMP%] div.row[_ngcontent-%COMP%] > div.col[_ngcontent-%COMP%]:last-child{border-right:none}.quickKeys[_ngcontent-%COMP%] .quickKeyTabs[_ngcontent-%COMP%] div.row[_ngcontent-%COMP%] > div.col[_ngcontent-%COMP%]:nth-child(4n){border-right:none}.quickKeys[_ngcontent-%COMP%] .quickKeyTabs[_ngcontent-%COMP%] div.row[_ngcontent-%COMP%] > div.col[_ngcontent-%COMP%]:first-child{border-left:1px solid #cfcfcf}.quickKeys[_ngcontent-%COMP%] .quickKeyTabs[_ngcontent-%COMP%] div.row[_ngcontent-%COMP%] > div.col[_ngcontent-%COMP%]:nth-child(-n+4){border-right:1px solid #cfcfcf;border-top:1px solid #cfcfcf;border-bottom:1px solid #cfcfcf}.quickKeys[_ngcontent-%COMP%] .quickKeyTabs[_ngcontent-%COMP%] div.row[_ngcontent-%COMP%] > div.col[_ngcontent-%COMP%]:nth-child(4n+1){border-left:1px solid #cfcfcf;border-bottom:1px solid #cfcfcf;border-right:1px solid #cfcfcf}.quickKeys[_ngcontent-%COMP%] .quickKeyTabs[_ngcontent-%COMP%] div.row[_ngcontent-%COMP%] > div.col[_ngcontent-%COMP%]:nth-child(4n+2){border-bottom:1px solid #cfcfcf;border-right:1px solid #cfcfcf}.quickKeys[_ngcontent-%COMP%] .quickKeyTabs[_ngcontent-%COMP%] div.row[_ngcontent-%COMP%] > div.col[_ngcontent-%COMP%]:nth-child(4n+3){border-bottom:1px solid #cfcfcf;border-right:1px solid #cfcfcf}.quickKeys[_ngcontent-%COMP%] .quickKeyTabs[_ngcontent-%COMP%] div.row[_ngcontent-%COMP%] > div.col[_ngcontent-%COMP%]:nth-child(4n+4){border-bottom:1px solid #cfcfcf;border-right:1px solid #cfcfcf}.quickKeys[_ngcontent-%COMP%] .quickKeyTabs[_ngcontent-%COMP%] div.row[_ngcontent-%COMP%] > div.col[_ngcontent-%COMP%]:nth-child(n+5){width:25%;flex-grow:0}.quickKeys[_ngcontent-%COMP%] .quickKeyTabs[_ngcontent-%COMP%] div.row[_ngcontent-%COMP%] > div.col.active[_ngcontent-%COMP%]{color:#268ec1!important}.quickKeys[_ngcontent-%COMP%] .tabItems[_ngcontent-%COMP%]{padding:0}.quickKeys[_ngcontent-%COMP%] .tabItems[_ngcontent-%COMP%] .column[_ngcontent-%COMP%]{margin-top:15px;margin-bottom:10px;word-break:break-all}.quickKeys[_ngcontent-%COMP%] .tabItems[_ngcontent-%COMP%] .column[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{border:solid 1px #cfcfcf}.quickKeys[_ngcontent-%COMP%] .tabItems[_ngcontent-%COMP%] .column[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{text-align:center;display:block;cursor:pointer}.quickKeys[_ngcontent-%COMP%] .tabItems[_ngcontent-%COMP%] .column[_ngcontent-%COMP%] > a[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{height:80px;width:80px;display:block;margin:0 auto;border-top-left-radius:5px;border-bottom-right-radius:5px;border:solid 1px #DDDDDD}.quickKeys[_ngcontent-%COMP%] .tabItems[_ngcontent-%COMP%] .column[_ngcontent-%COMP%] > a[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{height:80px;width:80px;font-size:20px;display:block;margin:0 auto;padding-top:22px;background-color:#a6a6a6;border:solid 1px #999999;border-top-left-radius:5px;border-bottom-right-radius:5px;color:#fff}.quickKeys[_ngcontent-%COMP%] .tabItems[_ngcontent-%COMP%] .column[_ngcontent-%COMP%] > a[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{color:#000;font-size:11px;display:block;margin:5px 0 0}.quickKeys[_ngcontent-%COMP%] .tabItems[_ngcontent-%COMP%] .column[_ngcontent-%COMP%] .ion-icon[_ngcontent-%COMP%]{font-size:75px;margin:10px}.quickKeys[_ngcontent-%COMP%] .variants-header[_ngcontent-%COMP%]{background:#ffffff;background:linear-gradient(to bottom,#ffffff 0%,#eeeeee 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#ffffff",endColorstr="#eeeeee",GradientType=0);color:#268ec1;cursor:pointer}.quickKeys[_ngcontent-%COMP%] .col-md-3.column.add[_ngcontent-%COMP%]{cursor:pointer}.quickKeys[_ngcontent-%COMP%] .col-md-3.column.add[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-top:10px}.quickKeys[_ngcontent-%COMP%] i.icon-col.fa.fa-times.text-danger[_ngcontent-%COMP%]{color:#fb404b!important;position:absolute;right:16px;top:5px}.quickKeys[_ngcontent-%COMP%] a#LinkConfigureQuickkey[_ngcontent-%COMP%], .quickKeys[_ngcontent-%COMP%] a#LinkConfigureParkLayout[_ngcontent-%COMP%]{background-color:#479ccf;padding:15px 25px;color:#fff;text-decoration:none;width:240px;display:block;opacity:.85;border-radius:5px}.quickKeys[_ngcontent-%COMP%] a#LinkConfigureQuickkey[_ngcontent-%COMP%]{position:absolute;top:120px;left:90px}.quickKeys[_ngcontent-%COMP%] a#LinkConfigureQuickkey[_ngcontent-%COMP%]:hover, .quickKeys[_ngcontent-%COMP%] a#LinkConfigureParkLayout[_ngcontent-%COMP%]:hover{opacity:.95}.quickKeys[_ngcontent-%COMP%] a#LinkConfigureQuickkey[_ngcontent-%COMP%] Strong[_ngcontent-%COMP%], .quickKeys[_ngcontent-%COMP%] a#LinkConfigureParkLayout[_ngcontent-%COMP%] Strong[_ngcontent-%COMP%]{border-bottom:1px solid white;font-size:14px;margin:0 0 10px;padding:0 0 3px;display:block}.quickKeys[_ngcontent-%COMP%] a#LinkConfigureQuickkey[_ngcontent-%COMP%] i[_ngcontent-%COMP%], .quickKeys[_ngcontent-%COMP%] a#LinkConfigureParkLayout[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{display:inline-block;height:35px;margin:0 10px 0 0;font-size:28px}.quickKeys[_ngcontent-%COMP%] a#LinkConfigureQuickkey[_ngcontent-%COMP%] span[_ngcontent-%COMP%], .quickKeys[_ngcontent-%COMP%] a#LinkConfigureParkLayout[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:inline-block;font-size:14px;width:135px;vertical-align:top}.quickKeys[_ngcontent-%COMP%] .row.no-gutters.border.align-items-center.variants-header.cursor[_ngcontent-%COMP%]{background:linear-gradient(to bottom,#ffffff 0%,#eeeeee 100%)}.general-information[_ngcontent-%COMP%] ol.mt-5.ml-5.pl-7[_ngcontent-%COMP%] > li[_ngcontent-%COMP%]{line-height:20px}.quickKeys[_ngcontent-%COMP%] {width:420px;position:relative}.quickKeys[_ngcontent-%COMP%] .mat-tab-header-pagination{display:none!important}.quickKeys[_ngcontent-%COMP%] .mat-tab-header{border-bottom:none}.quickKeys[_ngcontent-%COMP%] .mat-ink-bar{display:none!important}.quickKeys[_ngcontent-%COMP%] .mat-tab-labels{border-bottom:0px;display:flex;flex-wrap:wrap}.quickKeys[_ngcontent-%COMP%] .mat-tab-labels .mat-tab-label{height:44px;max-height:44px;overflow:hidden;padding:0!important;border-right:1px solid #cfcfcf;min-width:25%!important;flex-grow:1;flex-basis:0;font-size:14px;font-weight:700;outline:none;text-transform:uppercase;background:#ffffff;background:linear-gradient(to bottom,#ffffff 0%,#eeeeee 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#ffffff",endColorstr="#eeeeee",GradientType=0);display:flex;white-space:normal!important}.quickKeys[_ngcontent-%COMP%] .mat-tab-labels .mat-tab-label .mat-tab-label-content{white-space:normal!important;align-self:center}.quickKeys[_ngcontent-%COMP%] .mat-tab-labels .mat-tab-label:nth-child(4n){border-right:none}.quickKeys[_ngcontent-%COMP%] .mat-tab-labels .mat-tab-label:first-child{border-left:1px solid #cfcfcf}.quickKeys[_ngcontent-%COMP%] .mat-tab-labels .mat-tab-label:nth-child(-n+4){border-right:1px solid #cfcfcf;border-top:1px solid #cfcfcf;border-bottom:1px solid #cfcfcf}.quickKeys[_ngcontent-%COMP%] .mat-tab-labels .mat-tab-label:nth-child(4n+1){border-left:1px solid #cfcfcf;border-bottom:1px solid #cfcfcf;border-right:1px solid #cfcfcf}.quickKeys[_ngcontent-%COMP%] .mat-tab-labels .mat-tab-label:nth-child(4n+2){border-bottom:1px solid #cfcfcf;border-right:1px solid #cfcfcf}.quickKeys[_ngcontent-%COMP%] .mat-tab-labels .mat-tab-label:nth-child(4n+3){border-bottom:1px solid #cfcfcf;border-right:1px solid #cfcfcf}.quickKeys[_ngcontent-%COMP%] .mat-tab-labels .mat-tab-label:nth-child(4n+4){border-bottom:1px solid #cfcfcf;border-right:1px solid #cfcfcf}.quickKeys[_ngcontent-%COMP%] .mat-tab-labels .mat-tab-label:nth-child(n+5){width:25%;flex-grow:0}@media (max-width: 1092px){.quickKeys[_ngcontent-%COMP%] .mat-tab-labels .mat-tab-label{font-size:12px}}.quickKeys[_ngcontent-%COMP%] .mat-tab-labels .mat-tab-label-active{color:#268ec1!important;text-shadow:0px 0px 1px #268ec1!important}@media (max-width: 1210px){.quickKeys[_ngcontent-%COMP%]{width:340px}}']}),o})();var Oe=p(30273),Ea=p(15861);class xe{}class De{}function La(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",4)(1,"strong",7),t._uU(2,"Name"),t.qZA(),t.TgZ(3,"input",8),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.form.ParkLabel=i)}),t.qZA()()}if(2&o){const e=t.oxw();t.xp6(3),t.s9C("placeholder",e.labelPlaceholder||"Girl in blue dress"),t.Q6J("ngModel",e.form.ParkLabel)}}function Va(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",9)(1,"strong",7),t._uU(2,"Deposit"),t.qZA(),t.TgZ(3,"div",10)(4,"input",11),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.form.Deposit=i)}),t.qZA()(),t.TgZ(5,"div",12)(6,"ng-select",13),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.form.DepositPaymentMethodID=i)}),t.qZA()()()}if(2&o){const e=t.oxw();t.xp6(4),t.Q6J("ngModel",e.form.Deposit),t.xp6(2),t.Q6J("items",e.listPayment)("ngModel",e.form.DepositPaymentMethodID)}}let Se=(()=>{class o{constructor(e,n,i){this.dialogRef=e,this._orderProcessorService=n,this.data=i,this.modalConfig=new D.O,this.form=new De,this.initModalDialog(),this.title=i.title,this.labelDisable=i.labelDisable,this.labelPlaceholder=i.labelPlaceholder,this.depositEnabled=i.depositEnabled,this.listPayment=i.listPayment,this.numberOfPersonEnabled=i.numberOfPersonEnabled,this.noteEnabled=i.noteEnabled,this.form.ParkLabel=i.ParkLabel,this.form.Deposit=i.deposit,this.form.DepositPaymentMethodID=this.listPayment[0].ID,this.form.Note=i.note}initModalDialog(){this.modalConfig.title=this.data.title,this.modalConfig.customWidth="800px",this.modalConfig.customWidth="400px"}onOk(){this.dialogRef.close(!0),this._orderProcessorService.submitParkToServer(this.form)}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(Z),t.Y36(h.WI))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-park-input"]],decls:9,vars:4,consts:[[3,"config","onCancel","onOk","onClose"],[2,"width","330px"],["class","row d-flex mb-3 align-items-center g-0",4,"ngIf"],["class","row mb-3 align-items-center g-0",4,"ngIf"],[1,"row","d-flex","mb-3","align-items-center","g-0"],[1,"col-3","mb-3"],["placeholder","Want to return after exchange size",1,"form-control","w-75","col-9","ps-2",3,"ngModel","ngModelChange"],[1,"col-3","mb-2"],[1,"form-control","w-75","col-9","height-input",3,"ngModel","placeholder","ngModelChange"],[1,"row","mb-3","align-items-center","g-0"],[1,"col-4"],["autoNum","","placeholder","Deposit",1,"form-control","w-100","col-4","height-input",3,"ngModel","ngModelChange"],[1,"col-5","ps-4","deposit"],["bindLabel","Name","bindValue","ID","placeholder","Payment","appendTo","body",1,"park-detail",2,"width","180px",3,"items","ngModel","ngModelChange"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onCancel",function(){return n.dialogRef.close()})("onOk",function(){return n.onOk()})("onClose",function(){return n.dialogRef.close()}),t.TgZ(1,"content")(2,"div",1),t.YNc(3,La,4,2,"div",2),t.YNc(4,Va,7,3,"div",3),t.TgZ(5,"div",4)(6,"strong",5),t._uU(7,"Notes"),t.qZA(),t.TgZ(8,"textarea",6),t.NdJ("ngModelChange",function(a){return n.form.Note=a}),t.qZA()()()()()),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(3),t.Q6J("ngIf",!n.labelDisable),t.xp6(1),t.Q6J("ngIf",n.depositEnabled),t.xp6(4),t.Q6J("ngModel",n.form.Note))},dependencies:[g.O5,u.Fj,u.JJ,u.On,$.w9,y.M,nt.b],styles:[".height-input[_ngcontent-%COMP%]{height:36px} ng-select.park-detail>div.ng-select-container{border-radius:0!important}.deposit[_ngcontent-%COMP%] .ng-select{width:auto!important}"]}),o})();function Ya(o,r){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.ALo(2,"limitTo"),t.qZA()),2&o){const e=t.oxw().$implicit,n=t.oxw(3);t.xp6(1),t.Oqu(n.parkLayoutPack.Layout.length<5?e.Name:t.xi3(2,1,e.Name,5))}}function Ha(o,r){if(1&o&&t._UZ(0,"span",23),2&o){const e=t.oxw().$implicit;t.Q6J("innerHtml",e.Alias,t.oJD)}}const Ga=function(o,r){return{"text-danger":o,"text-success":r}};function Ba(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",14)(1,"div",15),t.NdJ("click",function(){const a=t.CHM(e).$implicit,s=t.oxw(4);return t.KtG(s.onSelect(a))}),t.TgZ(2,"div",16)(3,"h6",17),t._UZ(4,"i",18),t._uU(5),t.ALo(6,"limitTo"),t.qZA(),t.TgZ(7,"div",19)(8,"span",20),t._UZ(9,"i",21),t.qZA(),t.YNc(10,Ha,1,1,"span",22),t.qZA()()()()}if(2&o){const e=r.$implicit,n=t.oxw(4);t.xp6(1),t.Q6J("title",e.Name),t.xp6(1),t.Q6J("ngClass",n.getStatus(e.Name)),t.xp6(3),t.hij(" ",t.xi3(6,5,n.replaceWithAlias&&e.Alias?e.Alias:e.Name,15)," "),t.xp6(3),t.Q6J("ngClass",t.WLB(8,Ga,"OCCUPIED"==n.getNote(e.Name),"OCCUPIED"!=n.getNote(e.Name))),t.xp6(2),t.Q6J("ngIf",e.Alias&&!n.replaceWithAlias)}}function Ka(o,r){if(1&o&&(t.TgZ(0,"mat-tab"),t.YNc(1,Ya,3,4,"ng-template",10),t.TgZ(2,"div",11)(3,"div",12),t.YNc(4,Ba,11,11,"div",13),t.ALo(5,"Filter"),t.qZA()()()),2&o){const e=r.$implicit,n=t.oxw(3);t.xp6(4),t.Q6J("ngForOf",t.Dn7(5,1,e.Options,n.filter,"Name"))}}function $a(o,r){if(1&o&&(t.TgZ(0,"mat-tab-group"),t.YNc(1,Ka,6,5,"mat-tab",9),t.qZA()),2&o){const e=t.oxw(2);t.xp6(1),t.Q6J("ngForOf",e.parkLayoutPack.Layout)}}function za(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div")(1,"div",4)(2,"span",5),t._UZ(3,"i",6),t.qZA(),t.TgZ(4,"input",7),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.filter=i)}),t.qZA()(),t.YNc(5,$a,2,1,"mat-tab-group",8),t.qZA()}if(2&o){const e=t.oxw();t.xp6(4),t.Q6J("ngModel",e.filter),t.xp6(1),t.Q6J("ngIf",e.parkLayoutPack.Layout)}}const ja=function(o){return{ID:o}};function Wa(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",24)(1,"h4"),t._uU(2,"Please write Layout column inside Park Layout Template, "),t.TgZ(3,"a",25),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i._dialogRef.close())}),t._uU(4,"click here to setup the park layout"),t.qZA()()()}if(2&o){const e=t.oxw();t.xp6(3),t.Q6J("queryParams",t.VKq(1,ja,e.parkLayoutPack.ID))}}let Te=(()=>{class o{constructor(e,n,i,a,s,l,d,f,b){this._dialogRef=e,this.data=n,this._orderHttpService=i,this._orderDataService=a,this._localData=s,this._posService=l,this._orderProcessorService=d,this._dialog=f,this._toastr=b,this.modalConfig=new D.O,this.payments=[],this.parkLayoutPack=n.parkLayoutPack,this.qty=n.qty,this.replaceWithAlias=n.replaceWithAlias,this.entityId=n.entityId,this.occupied=n.occupied,this.totalOption=0,this.appConfigJson=this._posService.Data.AppConfigJSON,this.salesOrderData=this._orderDataService.Data,this.payments=this._posService.Data.Payments,this.parkLayoutPack.Layout.forEach(O=>{this.totalOption+=O.Size,O.Options=[];for(let R=1;R<=O.Size;R++){const Q=new xe;Q.Name=O.Name+R,Q.Alias=this.GetAlias(Q.Name),O.Options.push(Q)}})}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig.title=this.data.title,this.modalConfig.customWidth="850px",this.modalConfig.hideFooter=!0,this.modalConfig.bodyScrollable=!0}GetAlias(e){if(this.parkLayoutPack.Alias){const n=this.parkLayoutPack.Alias.filter(i=>i.Name==e);if(n.length>0)return n[0].Alias}return""}onSelect(e){"vacant"==this.getStatus(e.Name)?this.submitToServer(e.Name):this._toastr.warning("Please choose another slot!",`${e.Name} - Occupied`)}submitToServer(e){if(this.appConfigJson.ApplicationParkAndRetrieve.NumberOfPerson||this.appConfigJson.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableNotes||this.appConfigJson.ApplicationParkAndRetrieve.Deposit.Enabled)this.openParkFormModal(e);else{let n=new De;n.ParkLabel=e,this._dialogRef.close(!0),this._orderProcessorService.submitParkToServer(n)}}openParkFormModal(e){this._dialog.open(Se,{data:{title:e,labelDisable:c.gT.IsNotEmpty(this.parkLayoutPack.ID)||this._orderProcessorService.Data.posState==_.IsSplit,labelPlaceholder:this.appConfigJson.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkLabelPlaceholder,depositEnabled:this.appConfigJson.ApplicationParkAndRetrieve.Deposit.Enabled,listPayment:this.payments,ParkLabel:e||this.salesOrderData.Order.ParkLabel,deposit:this.appConfigJson.ApplicationParkAndRetrieve.Deposit.DefaultAmount,note:this.salesOrderData.Order.Note,noteEnabled:this.appConfigJson.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableNotes,numberOfPerson:this.salesOrderData.Order.NumberOfPerson,depositPaymentMethodID:this.salesOrderData.Order.DepositPaymentMethodID,numberOfPersonEnabled:this.appConfigJson.ApplicationParkAndRetrieve.NumberOfPerson},id:"park-form-modal"}).afterClosed().subscribe(n=>{n&&this._dialogRef.close(!0)})}getNote(e){const n=this.getStatus(e);return"preparing"==n?this.houseKeeping.filter(a=>a.Option==e)[0].Notes:n.toUpperCase()}getStatus(e){return this.occupied&&this.occupied.filter(i=>i.ParkLabel==e).length>0?"occupied":this.houseKeeping&&this.houseKeeping.filter(i=>i.Option==e).length>0?"preparing":"vacant"}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(h.WI),t.Y36(N.D),t.Y36(v),t.Y36(P.T),t.Y36(C),t.Y36(Z),t.Y36(h.uw),t.Y36(I._W))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-park-select"]],decls:5,vars:3,consts:[[3,"config","onClose","onCancel"],[1,"park"],[4,"ngIf","ngIfElse"],["BLANK",""],[1,"input-group","mb-3",2,"width","200px","top","12px"],[1,"input-group-text","txtFilter","pe-0"],["aria-hidden","true",1,"fa","fa-search"],["type","text","placeholder","Filter by Name","aria-label","Search",1,"txtFilter","form-control","border-start-0",3,"ngModel","ngModelChange"],[4,"ngIf"],[4,"ngFor","ngForOf"],["mat-tab-label",""],[1,"container","px-0"],[1,"row","dialogPicker"],["class","col-auto px-0",4,"ngFor","ngForOf"],[1,"col-auto","px-0"],[1,"card","mb-0",2,"width","135px",3,"title","click"],[1,"card-body","p-0",3,"ngClass"],[1,"card-title","mb-0","p-5","text-white","rounded","d-flex",2,"width","132px"],["aria-hidden","true",1,"fa","fa-info-circle","pe-3","mt-1"],[1,"card-text","text-center",2,"width","135px"],[1,"pt-4",3,"ngClass"],[1,"fa-solid","fa-chair"],["class","alias",3,"innerHtml",4,"ngIf"],[1,"alias",3,"innerHtml"],[1,"d-flex","justify-content-center","align-items-center"],["routerLink","/menu/Outlets/Master/Park_Layout_Templates/Form","target","_blank",3,"queryParams","click"]],template:function(e,n){if(1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onClose",function(){return n._dialogRef.close()})("onCancel",function(){return n._dialogRef.close()}),t.TgZ(1,"content",1),t.YNc(2,za,6,2,"div",2),t.YNc(3,Wa,5,3,"ng-template",null,3,t.W1O),t.qZA()()),2&e){const i=t.MAs(4);t.Q6J("config",n.modalConfig),t.xp6(2),t.Q6J("ngIf",(null==n.parkLayoutPack||null==n.parkLayoutPack.Layout?null:n.parkLayoutPack.Layout.length)>0)("ngIfElse",i)}},dependencies:[g.mk,g.sg,g.O5,S.yS,u.Fj,u.JJ,u.On,E.SP,E.uD,E.uX,y.M,k.OI,k.wn],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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.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}.dialogPicker[_ngcontent-%COMP%]{list-style:none;padding:0 0 6px;display:flex;flex-wrap:wrap!important;margin:0 0 0 20px}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%]{min-height:95px;margin-bottom:-6px;width:140px;margin-right:12px;margin-top:15px}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body[_ngcontent-%COMP%]{display:block;outline:0;border:1px solid #B1AAAA;border-radius:5px;cursor:pointer}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body[_ngcontent-%COMP%]:hover, .dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.active[_ngcontent-%COMP%], .dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.vacant[_ngcontent-%COMP%]{background:#ffffe1;border:1px solid #89b03e}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body[_ngcontent-%COMP%]:hover > h6[_ngcontent-%COMP%], .dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.active[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%], .dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.vacant[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%]{background:#89b03e}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.occupied[_ngcontent-%COMP%], .dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.occupied[_ngcontent-%COMP%]:hover{border:1px solid #c9302c}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.occupied[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%], .dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.occupied[_ngcontent-%COMP%]:hover > h6[_ngcontent-%COMP%]{background:#c9302c!important}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.occupied[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#c9302c}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.occupied[_ngcontent-%COMP%]:hover{background:white}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.preparing[_ngcontent-%COMP%]{border:1px solid #f6a828}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.preparing[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%]{background:#f6a828!important}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.preparing[_ngcontent-%COMP%]:hover{border:1px solid #f6a828;background:white}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.preparing[_ngcontent-%COMP%]:hover > strong[_ngcontent-%COMP%]{background:#f6a828!important}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.preparing[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#f6a828}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body.preparing[_ngcontent-%COMP%] div[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.75rem!important}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body[_ngcontent-%COMP%] .card-text[_ngcontent-%COMP%] i.fa-chair[_ngcontent-%COMP%]{font-size:2.5rem}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{height:55px;padding:10px;position:relative}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;font-weight:400;font-size:.875rem;width:100%;margin-bottom:5px;font-size:20px}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:first-child{margin-top:-10px}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:last-child{margin-bottom:0}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{text-align:center;position:absolute;bottom:0px;right:0px;width:auto;background-color:#b1aaaa;border-radius:3px;padding:2px 5px;color:#fff;display:none!important}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] div.card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.idle[_ngcontent-%COMP%]{display:block;font-size:1.25rem;text-align:center}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{position:absolute;width:27px;height:28px;cursor:pointer;top:5px}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#000}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:last-of-type{right:-5px}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:nth-last-of-type(2){right:15px}.dialogPicker[_ngcontent-%COMP%] div.col-auto[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{bottom:20px;right:5px;position:absolute}.dialogPicker[_ngcontent-%COMP%] .duration[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{border:1px solid!important;position:absolute;bottom:-3px;left:58px;background:#fff;border-radius:5px}mat-tab-group[_ngcontent-%COMP%]{position:relative;top:-35px}mat-tab-group[_ngcontent-%COMP%] .mat-tab-header{width:70%;max-width:calc(100% - 196px);position:relative;left:215px}mat-tab-group[_ngcontent-%COMP%] .mat-tab-label{min-width:80px;padding:0 12px}.park[_ngcontent-%COMP%] .mat-tab-body-content{overflow:hidden!important;padding-top:15px}"]}),o})(),Xa=(()=>{class o{constructor(e,n,i,a,s,l,d,f){this.dialogRef=e,this.parkOrderRetrieve=n,this._orderDataService=i,this._posHttpResponseService=a,this._orderProcessorService=s,this._orderHttpService=l,this._dialog=d,this._outletRegisterService=f,this.modalConfig=new D.O,this.salesOrderData=this._orderDataService.Data,this.appConfig=this._posHttpResponseService.Data.AppConfigJSON,this.parkLayoutPack=this._outletRegisterService.Data.ParkLayoutPack}ngOnInit(){this.modalConfig.title="Re-Park Order?",this.modalConfig.hideFooter=!0}onRepark(){this.dialogRef.close(),this._orderProcessorService.submitParkToServer(this.parkOrderRetrieve)}onMove(){this.dialogRef.close(),this.showParkSelectModal()}showParkSelectModal(){this._orderHttpService.getVacant(this.salesOrderData.Order.EntityID).subscribe(e=>{this._dialog.open(Te,{data:{title:this.title,parkLayoutPack:this.parkLayoutPack,qty:this.salesOrderData.TotalQuantity,entityId:this.salesOrderData.Order.EntityID,occupied:e.Orders,replaceWithAlias:this.appConfig.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias}})})}get title(){return this._orderProcessorService.Data.posState==_.IsSplit?"Split Order":this.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(h.WI),t.Y36(v),t.Y36(C),t.Y36(Z),t.Y36(N.D),t.Y36(h.uw),t.Y36(q))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-repark"]],decls:13,vars:3,consts:[[3,"title","hideFooter","config","onClose","onCancel"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg",3,"click"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onClose",function(){return n.dialogRef.close()})("onCancel",function(){return n.dialogRef.close()}),t.TgZ(1,"content")(2,"div",1)(3,"a",2),t.NdJ("click",function(){return n.onRepark()}),t.TgZ(4,"h4"),t._uU(5,"Re-Park"),t.qZA(),t.TgZ(6,"span"),t._uU(7,"Store order to same location"),t.qZA()(),t.TgZ(8,"a",2),t.NdJ("click",function(){return n.onMove()}),t.TgZ(9,"h4"),t._uU(10,"Move"),t.qZA(),t.TgZ(11,"span"),t._uU(12,"Shift order to Different location"),t.qZA()()()()()),2&e&&t.Q6J("title","Re-Park Order?")("hideFooter",!0)("config",n.modalConfig)},dependencies:[y.M],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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-gray[_ngcontent-%COMP%]{background-color:#f4f4f4;border:1px solid #D6D6D6;font-weight:700;color:#545454!important;background:linear-gradient(to bottom,#ffffff 0%,#eeeeee 100%)}.btn[_ngcontent-%COMP%]{padding:25px 0;width:190px;margin-right:10px}.btn[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{font-weight:700;text-transform:uppercase}.btn[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.75rem;font-style:italic;color:#868686;margin-top:10px}"]}),o})(),tr=(()=>{class o{constructor(e){this.httpService=e}getParkedOrder(e,n){return this.httpService.post(c.Wz.GetPark,{EntityID:e,RegisterID:n})}removeOrder(e,n){return this.httpService.post(n?c.Wz.VoidPark:c.Wz.RemovePark,{OrderID:e})}mergePark(e){return this.httpService.post(c.Wz.MergePark,e)}getOutstanding(e){return this.httpService.post(c.Wz.GetOutStanding,{EntityID:e})}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(M.O))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();function er(o,r){if(1&o&&(t.TgZ(0,"span",11),t._uU(1),t.qZA()),2&o){const e=r.$implicit;t.Q6J("hidden",0==r.index),t.xp6(1),t.Oqu(e.ParkLabel)}}function nr(o,r){if(1&o&&(t.TgZ(0,"div",8),t.YNc(1,er,2,2,"span",9),t._uU(2," Merge To "),t.TgZ(3,"span",10),t._uU(4),t.qZA()()),2&o){const e=t.oxw();t.xp6(1),t.Q6J("ngForOf",e.listMerge),t.xp6(3),t.hij(" ",e.listMerge[0].ParkLabel,"")}}const or=function(o){return{width:o}};function ir(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",12)(1,"div",13)(2,"span",14),t._UZ(3,"i",15),t.qZA(),t.TgZ(4,"input",16),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.filter=i)}),t.qZA()()()}if(2&o){const e=t.oxw();t.Akn(t.VKq(3,or,1==e.retreiveMode?" 13.75rem":" 23.75rem")),t.xp6(4),t.Q6J("ngModel",e.filter)}}function ar(o,r){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.ALo(2,"limitTo"),t.qZA()),2&o){const e=t.oxw().$implicit,n=t.oxw(3);t.xp6(1),t.Oqu(n.parkedOrders.length<5?e.Name:t.xi3(2,1,e.Name,5))}}function rr(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"span",45),t.NdJ("click",function(i){t.CHM(e);const a=t.oxw().$implicit;return t.oxw(5).remove(a),t.KtG(i.stopPropagation())}),t._UZ(1,"i",46),t.qZA()}}function sr(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",25)(1,"div",26)(2,"div",27),t.NdJ("click",function(){const a=t.CHM(e).$implicit,s=t.oxw(5);return t.KtG(s.onOrderClicked(a))}),t.TgZ(3,"h5",28),t._UZ(4,"i",29),t.TgZ(5,"div",30),t._uU(6),t.qZA(),t.TgZ(7,"span",31),t.YNc(8,rr,2,0,"span",32),t.qZA()(),t.TgZ(9,"div",33)(10,"div")(11,"div",34),t._UZ(12,"i",35),t._uU(13),t.ALo(14,"date"),t.qZA(),t.TgZ(15,"div",36),t._UZ(16,"i",37),t._uU(17),t.qZA(),t.TgZ(18,"div",38),t._UZ(19,"i",39),t._uU(20),t.qZA(),t.TgZ(21,"div",40),t._uU(22),t.qZA()()()(),t.TgZ(23,"div",41)(24,"input",42),t.NdJ("ngModelChange",function(i){const s=t.CHM(e).$implicit;return t.KtG(s.selected=i)})("change",function(){const a=t.CHM(e).$implicit,s=t.oxw(5);return t.KtG(s.chooseMerge(a))}),t.qZA(),t.TgZ(25,"div",43)(26,"span",44),t._uU(27),t.qZA()()()()()}if(2&o){const e=r.$implicit,n=t.oxw(5);t.xp6(6),t.hij(" ",n.replaceAlias&&e.Alias?e.Alias:e.ParkLabel," "),t.xp6(2),t.Q6J("ngIf",!n.AuthorizeParkOrderDeletion),t.xp6(5),t.hij(" ",t.xi3(14,9,e.Created,"dd-MMM HH:mm")," "),t.xp6(4),t.hij(" ",e.Number," "),t.xp6(3),t.hij(" ",e.CustomerDisplay," "),t.xp6(1),t.Q6J("hidden",n.replaceAlias),t.xp6(1),t.hij(" ",e.alias," "),t.xp6(2),t.Q6J("ngModel",e.selected),t.xp6(3),t.hij(" ",e.Duration," min ")}}const Ie=function(){return["ParkLabel","Number"]};function lr(o,r){if(1&o&&(t.TgZ(0,"div",22)(1,"div",23),t.YNc(2,sr,28,12,"div",24),t.ALo(3,"FilterByArray"),t.qZA()()),2&o){const e=t.oxw().$implicit,n=t.oxw(3);t.xp6(2),t.Q6J("ngForOf",t.Dn7(3,1,e.List,t.DdM(5,Ie),n.filter))}}function cr(o,r){if(1&o&&(t.TgZ(0,"mat-tab"),t.YNc(1,ar,3,4,"ng-template",20),t.YNc(2,lr,4,6,"div",21),t.qZA()),2&o){const e=t.oxw(3);t.xp6(2),t.Q6J("ngIf",e.Layout.length>0)}}function dr(o,r){if(1&o&&(t.TgZ(0,"mat-tab-group"),t.YNc(1,cr,3,1,"mat-tab",19),t.qZA()),2&o){const e=t.oxw(2);t.xp6(1),t.Q6J("ngForOf",e.Layout)}}function pr(o,r){if(1&o&&(t.TgZ(0,"div",17),t.YNc(1,dr,2,1,"mat-tab-group",18),t.qZA()),2&o){const e=t.oxw();t.xp6(1),t.Q6J("ngIf",0!=e.parkedOrders.length)}}function gr(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"span",45),t.NdJ("click",function(i){t.CHM(e);const a=t.oxw().$implicit;return t.oxw(2).remove(a),t.KtG(i.stopPropagation())}),t._UZ(1,"i",46),t.qZA()}}function ur(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"input",42),t.NdJ("ngModelChange",function(i){t.CHM(e);const a=t.oxw().$implicit;return t.KtG(a.selected=i)})("change",function(){t.CHM(e);const i=t.oxw().$implicit,a=t.oxw(2);return t.KtG(a.chooseMerge(i))}),t.qZA()}if(2&o){const e=t.oxw().$implicit;t.Q6J("ngModel",e.selected)}}function mr(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",25)(1,"div",26)(2,"div",27),t.NdJ("click",function(){const a=t.CHM(e).$implicit,s=t.oxw(2);return t.KtG(s.onOrderClicked(a))}),t.TgZ(3,"h5",28),t._UZ(4,"i",48),t.TgZ(5,"div",49),t._uU(6),t.qZA(),t.TgZ(7,"span",50),t.YNc(8,gr,2,0,"span",32),t.qZA()(),t.TgZ(9,"div",33)(10,"div")(11,"div",34),t._UZ(12,"i",35),t._uU(13),t.ALo(14,"date"),t.qZA(),t.TgZ(15,"div",36),t._UZ(16,"i",37),t._uU(17),t.qZA(),t.TgZ(18,"div",38),t._UZ(19,"i",39),t._uU(20),t.qZA(),t.TgZ(21,"div",40),t._uU(22),t.qZA()()()(),t.TgZ(23,"div",41),t.YNc(24,ur,1,1,"input",51),t.TgZ(25,"div",43)(26,"span",44),t._uU(27),t.qZA()()()()()}if(2&o){const e=r.$implicit,n=t.oxw(2);t.xp6(6),t.hij(" ",n.replaceAlias&&e.Alias?e.Alias:e.ParkLabel," "),t.xp6(2),t.Q6J("ngIf",!n.AuthorizeParkOrderDeletion),t.xp6(5),t.hij(" ",t.xi3(14,9,e.Created,"dd-MMM HH:mm")," "),t.xp6(4),t.hij(" ",e.Number," "),t.xp6(3),t.hij(" ",e.CustomerDisplay," "),t.xp6(1),t.Q6J("hidden",n.replaceAlias),t.xp6(1),t.hij(" ",e.alias," "),t.xp6(2),t.Q6J("ngIf",n.parkEnableMerge),t.xp6(3),t.hij(" ",e.Duration," min ")}}function _r(o,r){if(1&o&&(t.TgZ(0,"div",17)(1,"div",47),t.YNc(2,mr,28,12,"div",24),t.ALo(3,"FilterByArray"),t.qZA()()),2&o){const e=t.oxw();t.xp6(2),t.Q6J("ngForOf",t.Dn7(3,1,e.parkedOrders,t.DdM(5,Ie),e.filter))}}function hr(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",52),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.clearSelection())}),t._uU(1,"Clear All"),t.qZA()}}function fr(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",52),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.merge())}),t._uU(1,"Merge"),t.qZA()}}let Cr=(()=>{class o{constructor(e,n,i,a,s,l,d){this._dialogRef=e,this.data=n,this._parkedOrderService=i,this._localData=a,this._OrderHttpService=s,this._orderProcessorService=l,this._toastr=d,this.modalConfig=new D.O,this.parkedOrders=[],this.listMerge=[],this.modalConfig.title=n.title,this.modalConfig.customWidth="850px",this.modalConfig.bodyScrollable=!0,this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0,this.title=n.title,this.filterAlwaysVisible=n.filterAlwaysVisible,this.parkDeletionRestriction=n.parkDeletionRestriction,this.entityId=n.entityId,this.replaceAlias=n.replaceAlias,this.posHub=n.posHub,this.mode=n.mode,this.templateID=n.templateID,this.RegisterID=n.RegisterID,this.park=n.Park,this.voidEnabled=n.voidEnabled,this.retreiveMode=n.retreiveMode,this.Layout=n.Layout,this.parkEnableMerge=n.parkEnableMerge,this.RetreiveOrderDifferentRegister=n.RetreiveOrderDifferentRegister,this.AuthorizeParkOrderDeletion=n.AuthorizeParkOrderDeletion,this.getData()}getData(){this._localData.isConfigFromServer().subscribe(e=>{e&&this._parkedOrderService.getParkedOrder(this.entityId,this.RegisterID).subscribe({next:n=>{if(this.parkedOrders=n,this.parkedOrders.length>0&&this.parkedOrders.forEach(i=>{if(1==this.retreiveMode)i.Orders.forEach(a=>{a.Alias=this.park.GetAlias(a.ParkLabel),a.MemberIdentification=a.MemberIdentification?a.MemberIdentification:"";const s=new Date(a.Created),l=new Date,d=Math.abs(l.getTime()-s.getTime()),f=Math.floor(d%864e5/36e5),b=Math.round(d%864e5%36e5/6e4);a.Duration=f>0?b+60*f:b});else{i.Alias=this.park.GetAlias(i.ParkLabel),i.MemberIdentification=i.MemberIdentification?i.MemberIdentification:"";const a=new Date(i.Created),s=new Date,l=Math.abs(s.getTime()-a.getTime()),d=Math.floor(l%864e5/36e5),f=Math.round(l%864e5%36e5/6e4);i.Duration=d>0?f+60*d:f}}),1==this.retreiveMode)for(const i of this.Layout){i.List=[];const a=this.parkedOrders.find(s=>s.Group==i.Name);i.List=null!=a?a.Orders:[]}},error:()=>{this._dialogRef.close()}})})}remove(e){confirm("Are you sure you want to "+(this.voidEnabled?"void":"delete")+" park "+e.ParkLabel+" ?")&&this.delete(e)}delete(e){this._parkedOrderService.removeOrder(e.ID,this.voidEnabled).subscribe(()=>{this._toastr.info(this.voidEnabled?"Order "+e.Number+" has been voided":"Order "+e.Number+" has been deleted","Park "+e.ParkLabel+" removed!"),this.posHub.BroadcastChangeToKitchenDisplay(),this.getData()},n=>{this._toastr.error(n,"Failed to remove "+e.ParkLabel+" !"),this._dialogRef.close({Error:n})})}clearSelection(){this.parkedOrders.forEach(0==this.mode?e=>e.selected=!1:e=>{e.selected=!1}),this.listMerge=[]}merge(){const e=[];this.listMerge.forEach(n=>{e.push(n.ID)}),this._parkedOrderService.mergePark(e).subscribe({next:n=>{const i=this.listMerge.find(a=>a.ID==n.ID);this.onOrderClicked(i)},error:n=>{this._dialogRef.close({Error:n})}})}onOrderClicked(e){this._OrderHttpService.GetInvoiceBySoID(e.ID).subscribe(n=>{this._orderProcessorService.updatePosState(_.IsRetrieve),this._orderProcessorService.plainToClass(n,_.IsRetrieve),this._dialogRef.close(e)})}chooseMerge(e){if(void 0===this.listMerge.find(i=>i.Number==e.Number))this.listMerge.push(e);else{const i=[];this.listMerge.forEach(a=>{a.Number!=e.Number&&i.push(a)}),this.listMerge=i,void 0===this.listMerge[0]&&(this.listMerge=[])}}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(h.WI),t.Y36(tr),t.Y36(P.T),t.Y36(N.D),t.Y36(Z),t.Y36(I._W))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-retrieve"]],decls:12,vars:7,consts:[[3,"config","onCancel"],["class","input-group fw-bold",4,"ngIf"],[2,"width","800px"],["class","input-group search",3,"style",4,"ngIf"],["class","container mt-6",4,"ngIf"],[1,"d-flex","justify-content-end"],["class","btn btn-light-blue text-primary fw-bold me-3",3,"click",4,"ngIf"],["class","btn btn-light-blue text-primary fw-bold me-3",3,"click",4,"ngIf"],[1,"input-group","fw-bold"],["class","me-3",3,"hidden",4,"ngFor","ngForOf"],[1,"ms-3"],[1,"me-3",3,"hidden"],[1,"input-group","search"],[1,"input-group","mb-3"],[1,"input-group-text","txtFilter"],["aria-hidden","true",1,"fa","fa-search"],["type","text","placeholder","Search by number or note","aria-label","Search",1,"txtFilter","form-control","border-start-0",3,"ngModel","ngModelChange"],[1,"container","mt-6"],[4,"ngIf"],[4,"ngFor","ngForOf"],["mat-tab-label",""],["class","container px-0",4,"ngIf"],[1,"container","px-0"],[1,"row","dialogPicker","mx-0","mt-2"],["class","col-3",4,"ngFor","ngForOf"],[1,"col-3"],[1,"card","border-0"],[1,"card-body","p-0",3,"click"],[1,"card-title","d-flex","justify-content-between","px-0"],["aria-hidden","true",1,"fa","fa-info-circle","ms-0","me-0","my-auto"],[1,"label-title","me-0","my-auto"],[1,"d-flex","my-auto"],[3,"click",4,"ngIf"],[1,"card-text","ps-5","pe-8","pt-3","pb-8"],[1,"date","mb-0"],[1,"fa-regular","fa-calendar-check","fa-fw","pe-2"],[1,"invoice","mb-0"],["aria-hidden","true",1,"fa","fa-hashtag","fa-fw","pe-2"],[1,"customer","mb-0"],["aria-hidden","true",1,"fa","fa-user","fa-fw","pe-2"],[1,"alias",3,"hidden"],[1,"card-footer"],["type","checkbox",1,"retrieve_checkbox","mb-5",3,"ngModel","ngModelChange","change"],[1,"duration","text-center"],[1,"py-2","px-4"],[3,"click"],["aria-hidden","true",1,"fa","fa-times-circle","me-0","text-dark"],[1,"row"],["aria-hidden","true",1,"fa","fa-info-circle","ms-3","me-2","my-auto"],[1,"label-title","me-2","my-auto"],[1,"d-flex","my-auto","me-2"],["class","retrieve_checkbox mb-5","type","checkbox",3,"ngModel","ngModelChange","change",4,"ngIf"],[1,"btn","btn-light-blue","text-primary","fw-bold","me-3",3,"click"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onCancel",function(){return n._dialogRef.close()}),t.TgZ(1,"content"),t.YNc(2,nr,5,2,"div",1),t.TgZ(3,"div",2),t.YNc(4,ir,5,5,"div",3),t.YNc(5,pr,2,1,"div",4),t.TgZ(6,"div"),t.YNc(7,_r,4,6,"div",4),t.qZA()()(),t.TgZ(8,"footer")(9,"div",5),t.YNc(10,hr,2,0,"a",6),t.YNc(11,fr,2,0,"a",7),t.qZA()()()),2&e&&(t.Q6J("config",n.modalConfig),t.xp6(2),t.Q6J("ngIf",n.listMerge.length>0),t.xp6(2),t.Q6J("ngIf",n.parkedOrders.length>0||1==n.retreiveMode||n.filterAlwaysVisible),t.xp6(1),t.Q6J("ngIf",1==n.retreiveMode),t.xp6(2),t.Q6J("ngIf",0==n.retreiveMode),t.xp6(3),t.Q6J("ngIf",n.listMerge.length>1),t.xp6(1),t.Q6J("ngIf",n.listMerge.length>1))},dependencies:[g.sg,g.O5,u.Fj,u.Wl,u.JJ,u.On,E.SP,E.uD,E.uX,y.M,g.uU,k.OI,k.Rt],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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.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}.nofocus[_ngcontent-%COMP%]:focus{outline:none!important}.label-title[_ngcontent-%COMP%]{font-size:1vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.col-3[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap!important}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]{width:180px;min-height:95px;margin-right:17px;margin-bottom:17px;position:relative}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]{display:block;outline:0;border:1px solid #b1aaaa;border-radius:5px;cursor:pointer}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{height:30px;border-radius:4px;padding:5px 10px;color:#fff;background:#b1aaaa;overflow:hidden}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:5px}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover, .col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%], .col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%]{background:#ffffe1;border:1px solid #89b03e}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover > h5[_ngcontent-%COMP%], .col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%], .col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%]{background:#89b03e}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]{border:1px solid #f6a828}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%]{background:#f6a828!important}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover{border:1px solid #f6a828;background:white}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover > strong[_ngcontent-%COMP%]{background:#f6a828!important}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#f6a828}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] div[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.75rem!important}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{position:relative;font-size:14px}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;font-weight:400;font-size:.875rem;width:100%;margin-bottom:5px}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:first-child{margin-top:-10px}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:last-child{margin-bottom:0}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{text-align:center;position:absolute;bottom:0px;right:0px;width:auto;background-color:#b1aaaa;border-radius:3px;padding:2px 5px;color:#fff;display:none!important}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.idle[_ngcontent-%COMP%]{display:block;font-size:1.25rem;text-align:center}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{position:absolute;width:27px;height:28px;cursor:pointer;top:5px}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#000}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:last-of-type{right:-5px}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:nth-last-of-type(2){right:15px}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{bottom:0px;right:5px;position:absolute}.col-3[_ngcontent-%COMP%] .duration[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{border:1px solid!important;position:absolute;bottom:-8px;left:58px;background:#fff;border-radius:5px}mat-tab-group[_ngcontent-%COMP%]{position:relative}mat-tab-group[_ngcontent-%COMP%] .mat-tab-header{width:768px;top:-65px}mat-tab-group[_ngcontent-%COMP%] .mat-tab-body-wrapper{top:-49px}mat-tab-group[_ngcontent-%COMP%] mat-tab-body{margin-top:.5rem}mat-tab-group[_ngcontent-%COMP%] .mat-tab-label-container{max-width:calc(100% - 196px);position:relative;left:14.0625rem}mat-tab-group[_ngcontent-%COMP%] .mat-tab-label{min-width:80px;padding:0 12px}.search[_ngcontent-%COMP%]{z-index:20}"]}),o})();class ke{constructor(r){this.LayoutPack=r}GenerateLayoutOption(){null!=this.LayoutPack&&this.LayoutPack.Layout&&this.LayoutPack.Layout.forEach(r=>{r.Options=[];for(let e=1;e<=r.Size;e++){let n=new xe;n.Name=r.Name+e,n.Alias=this.GetAlias(n.Name),r.Options.push(n)}})}GetAlias(r){if(null!=this.LayoutPack&&this.LayoutPack.Alias){let e=this.LayoutPack.Alias.filter(n=>n.Name==r);return e.length>0?e[0].Alias:r}return""}}let br=(()=>{class o{constructor(e){this._dialogRef=e,this.modalConfig=new D.O,this.modalConfig.title="Select Print Type",this.modalConfig.hideFooter=!0}onPrintOrder(){this._dialogRef.close("ORDER")}onPrintBill(){this._dialogRef.close("BILL")}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-print"]],decls:17,vars:1,consts:[[3,"config","onCancel"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg","me-1",3,"click"],["src","//res.cloudinary.com/pos/image/upload/v1650423915/icons/order.png"],[1,"mt-1"],[1,"mt-0"],[1,"btn","btn-gray","btn-lg","ms-1",3,"click"],["src","//res.cloudinary.com/pos/image/upload/v1650423915/icons/bill.png",2,"width","23px"]],template:function(e,n){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onCancel",function(){return n._dialogRef.close()}),t.TgZ(1,"content")(2,"div",1)(3,"a",2),t.NdJ("click",function(){return n.onPrintOrder()}),t._UZ(4,"img",3),t.TgZ(5,"h4",4),t._uU(6,"Order"),t.qZA(),t.TgZ(7,"div",5),t._uU(8,"For order for the kitchen"),t.qZA()(),t.TgZ(9,"a",6),t.NdJ("click",function(){return n.onPrintBill()}),t._UZ(10,"img",7),t.TgZ(11,"h4",4),t._uU(12,"Bill"),t.qZA(),t.TgZ(13,"div",5),t._uU(14,"To see amount of the bill"),t.qZA(),t.TgZ(15,"div",5),t._uU(16,"(Pre-settlement bill)"),t.qZA()()()()()),2&e&&t.Q6J("config",n.modalConfig)},dependencies:[y.M],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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-gray[_ngcontent-%COMP%]{background-color:#f4f4f4;border:1px solid #D6D6D6;font-weight:700;color:#545454!important;background:linear-gradient(to bottom,#ffffff 0%,#eeeeee 100%)}.btn[_ngcontent-%COMP%]{padding:8px 0;width:190px;margin-right:10px}.btn[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{font-weight:700;text-transform:uppercase}.btn[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{font-size:.75rem;font-style:italic;color:#868686;margin-top:10px}"]}),o})();class Pr{get point(){return this._point}set point(r){this._point=r}get pricebookID(){return this._pricebookID}set pricebookID(r){this._pricebookID=r}get discountRate(){return this._discountRate}set discountRate(r){this._discountRate=r}get groups(){return this._groups}set groups(r){this._groups=r}get salesID(){return this._salesID}set salesID(r){this._salesID=r}get dueDays(){return this._dueDays}set dueDays(r){this._dueDays=r}get expiryDate(){return this._expiryDate}set expiryDate(r){this._expiryDate=r}get debt(){return this._debt}set debt(r){this._debt=r}get expirtedString(){return this._expirtedString}set expirtedString(r){this._expirtedString=r}get loyaltyDisabled(){return this._loyaltyDisabled}set loyaltyDisabled(r){this._loyaltyDisabled=r}get taxTypeID(){return this._taxTypeID}set taxTypeID(r){this._taxTypeID=r}get entityID(){return this._entityID}set entityID(r){this._entityID=r}get mobile(){return this._mobile}set mobile(r){this._mobile=r}get email(){return this._email}set email(r){this._email=r}get dueMonths(){return this._dueMonths}set dueMonths(r){this._dueMonths=r}get memberIdentification(){return this._memberIdentification}set memberIdentification(r){this._memberIdentification=r}}var Et=(()=>{return(o=Et||(Et={}))[o.Draft=1]="Draft",o[o.Complete=2]="Complete",Et;var o})();class Ae{constructor(){this.OutletName="",this.Status=Et.Draft,this.AmountSummary=[],this.Coupon="",this.Creator="",this.CurrencySymbol="",this.Customer=new Pr,this.Date="",this.Delivery={Number:""},this.ExtraNote="",this.FinalAmount=0,this.InvoiceNote="",this.Items=[],this.List=[],this.LoyaltyPoint="",this.Payments=[],this.PrintDate="",this.RegisterCode="",this.SalesOrderItemCommission={SalesName:""},this.Shipping=new ee.Q,this.Title="",this.TypeName="",this.paymentState=0,this.InvoiceID="",this.Number="",this.Created=""}}class Mr{constructor(){this.ExtraNote="",this.Title="",this.Customer="",this.SalesName="",this.InvoiceNote="",this.Date="",this.Items=[],this.AmountSummary=[],this.Creator="",this.Deposit=0,this.NumberOfPerson=0,this.CurrencySymbol="Rp"}}class yr{}let we=(()=>{class o{constructor(e,n,i,a,s,l,d,f){this._posService=e,this._orderDataService=n,this._cashierCalculatorService=i,this._outletService=a,this._OrderHttpService=s,this._receiptCalculatorService=l,this._orderProcessorService=d,this._customerHttpService=f,this.park=new ke(null),this.outletInfo=new kt,this.datePipe=new g.uU("en-US"),this.ParkTemp=Array(),this.CartItems=[],this.subscribeToObservableChanges()}get posStorage(){return this._posService.Data}get AppConfigJSON(){return this._posService.Data.AppConfigJSON}subscribeToObservableChanges(){this._orderDataService.Data$.subscribe(e=>{this.posData=e}),this._OrderHttpService.Data$.subscribe(e=>{this.completeData=e}),this._outletService.Data$.subscribe(e=>{this.outletInfo=e}),this._orderProcessorService.Data$.subscribe(e=>{this.ParkTemp=e.parkTemporaryItem})}generateReceiptMini(){const e=new Ae;e.Title=c.gT.StringFormat("{0} #{1}",this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,this.GetSubmittedNumber()),e.OutletName=this.outletInfo.EntityName,e.ExtraNote=this.getParkLabel(),e.Customer=this.getSubmitedCustomer(),e.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),e.SalesOrderItemCommission={SalesName:this._outletService.getSalesname(this.posData.Order.SalesID)},e.Number=this.completeData.InvoiceNumber,e.FinalAmount=this.completeData.Final,e.InvoiceNote=this.posData.Order.Note,e.RegisterCode=this.outletInfo.RegisterCode??"",e.Date=this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.CustomerEntryTimeVisible?this.getSubmitedOrderDate():this.datePipe.transform(this.posData.Order.Date,"dd MMM yyyy"),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoiceCreatedTimeVisible&&(e.Created=this.datePipe.transform(new Date,"dd MMM yyyy")),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.OrderTimeVisible&&(e.Created=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm:ss")),this.posData.CartItems.forEach(i=>{i.SalesID&&(i.SalesName=this._outletService.getSalesname(i.SalesID))}),e.Items=this.posData.CartItems;for(let i=0;i<e.Items.length;i++)e.List.push({Name:e.Items[i].Variant.Name,Quantity:e.Items[i].Quantity,VariantID:e.Items[i].VariantID});null!=e.Customer&&null!=e.Customer.Display&&null!=e.Customer.Display&&null!=e.Customer.Display&&(e.Customer={ID:this.posData.Order.CustomerID,Display:this.posData.ContactName,Email:e.Customer.Email,CityName:null,Address:e.Customer.Address,Code:e.Customer.Code,Name:e.Customer.Name,Phone:e.Customer.Phone,Mobile:e.Customer.Mobile,NationalIDNumber:e.Customer.NationalIDNumber,Title:e.Customer.Title}),e.Delivery={Number:this.posData.Order.Number};const n=c.gT.FilterByID(this.posStorage.PoTypes,this.posData.Order.TypeID);if(null!==n&&(e.TypeName=n.Name),e.Shipping=this.generateShippingData(),this.AppConfigJSON.PrintConfigInvoice.ItemsTable.ItemWithoutPriceVisible||(e.Items=e.Items.filter(i=>0!=i.Price)),e.Coupon=this.posData.Order.AuthorizationKey,e.LoyaltyPoint=this.completeData?this.completeData.LoyaltyPoint:"",e.FinalAmount=this._cashierCalculatorService.Data,e.CurrencySymbol=this._cashierCalculatorService.currencySymbol,e.paymentState=this.getPaymentState(),e.Payments=this.posData.Payments,e.Payments.forEach(i=>{i.MethodName=this.findPaymentName(i.MethodID)}),e.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),e.Creator=this.completeData?this.completeData.Creator:"",this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoicePaymentTermsVisible&&0==this.posData.Payments.length){const i=this.posData.Invoice.Due?new Date(this.posData.Invoice.Due):null,a=new Date(this.posData.Order.Date);a.setHours(0,0,0,0),e.ToP=this.generateTop(a,i),void 0!==this.posData.Invoice.Due&&(e.Due=this.datePipe.transform(new Date(this.posData.Invoice.Due),"dd MMMM yyyy"))}return e}generateShippingData(){return{City:null!==this.posData.Shipping?this.posData.Shipping.City:null,Description:null!==this.posData.Shipping?this.posData.Shipping.Address:null,ID:null,Phone:null!==this.posData.Shipping?this.posData.Shipping.Phone:null,Recipient:null!==this.posData.Shipping?this.posData.Shipping.Name:null,SalesOrderID:null,Sender:null,SenderAddress:null,SenderCity:null,SenderPhone:null,Street:null}}generateParkReceipt(e=!0){const n=new Mr;if(n.ExtraNote=c.gT.StringFormat("{0} #{1}",this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.NumberPrefix,this.GetSubmittedNumber()),n.Title=this.getParkLabel(),n.Customer=this.getSubmitedCustomer(),n.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),n.InvoiceNote=this.posData.Order.Note,n.Date=this.getSubmitedOrderDate(),n.CurrencySymbol=this._cashierCalculatorService.currencySymbol,e&&this.AppConfigJSON.ApplicationParkAndRetrieve.PrintBehaviour.PrintAdditionalItemsOnlyOnRePark){if(this.CartItems=Array(),this.ParkTemp.length>0)for(let i of this.posData.CartItems){const a=this.ParkTemp.find(s=>s.ID==i.ID);null==a?this.CartItems.push(i):i.Quantity!=a.Quantity&&(i.Quantity=i.Quantity-a.Quantity,this.CartItems.push(i))}else this.CartItems=this.posData.CartItems;n.Items=this.CartItems}else n.Items=this.posData.CartItems;if(n.Creator=this.posStorage.UserName,n.Deposit=this.posData.Order.Deposit,n.NumberOfPerson=this.posData.Order.NumberOfPerson,this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.AmountVisible){const i=JSON.parse(JSON.stringify(this._receiptCalculatorService.generateAmountSummary()));n.AmountSummary=i}return n}generateBillInvoice(){let e=new yr;return e.ContactDisplay=this.posData.ContactName,e.Invoice=this.posData.Invoice,e.Order=this.posData.Order,e.Payments=this.posData.Payments,e.Shipping=this.posData.Shipping,e.CurrencySymbol=this._cashierCalculatorService.currencySymbol,e.FinalAmount=this._cashierCalculatorService.Data,e.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),e.Contact=this.getSubmitedCustomer(),e.Items=this.getItemsBillInvoice(),e.PrintTime=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm"),e.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),e.HeaderTitle="Invoice",e.Invoice.Number=`#${this.posData.Order.Number}`,e.Invoice.Date=new Date,e.Invoice.PaymentStateID=xt.Unpaid,e.Invoice.Note=this.posData.Order.Note,e.PrintPerson="",e.IsPrice=!0,e.PriceVisible=!0,e}getItemsBillInvoice(){return this.posData.CartItems.map(n=>({Name:n.Variant.Name,Quantity:n.Quantity,Code:n.Variant.Code,UnitPrice:n.Price,Discount:n.Discount,UOMName:n.Variant.UOMName,Total:n.Total,Note:n.Note}))}generateBillReceipt(){const e=new Ae;e.Title=c.gT.StringFormat("{0} #{1}",this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,this.posData.Order.Number),e.OutletName=this.outletInfo.EntityName,e.ExtraNote=this.getParkLabel(),e.Customer=this._customerHttpService.Data,e.SalesOrderItemCommission.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),e.Number=this.posData.Order.Number,e.FinalAmount=this._cashierCalculatorService.Data,e.InvoiceNote=this.posData.Order.Note,e.Date=this.datePipe.transform(this.posData.Order.Date,"dd MMM yyyy"),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoiceCreatedTimeVisible&&(e.Created=this.datePipe.transform(new Date,"dd MMM yyyy")),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.OrderTimeVisible&&(e.Created=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm:ss")),e.Items=this.posData.CartItems;for(let i=0;i<e.Items.length;i++)e.List.push({Name:e.Items[i].Variant.Name,Quantity:e.Items[i].Quantity,VariantID:e.Items[i].VariantID});e.Customer.ID=this.posData.Order.CustomerID,e.Customer.Name=this.posData.ContactName,e.Customer.Display=this.posData.ContactName,e.Customer.Mobile&&1==e.Customer.Mobile.length&&(e.Customer.Mobile=null),e.Delivery={Number:this.posData.Order.Number};const n=c.gT.FilterByID(this.posStorage.PoTypes,this.posData.Order.TypeID);return null!==n&&(e.TypeName=n.Name),e.Shipping=this.generateShippingData(),this.AppConfigJSON.PrintConfigInvoice.ItemsTable.ItemWithoutPriceVisible||(e.Items=e.Items.filter(i=>0!=i.Price)),e.Coupon=this.posData.Order.AuthorizationKey,e.paymentState=this.getPaymentState(),e.Payments=this.posData.Payments,e.Payments=e.Payments.map(i=>(i.MethodName=this.findPaymentName(i.MethodID),i)),e.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),e}getPaymentState(){let e=1;this.posData.Payments.length>1&&(e=2);const n=this.posData.TotalPaidAmount-this._cashierCalculatorService.Data;return(Math.abs(n)<=this.AppConfigJSON.ModuleSell.ToleranceAmount||n>=0)&&(e=3),e}generateTop(e,n){const i=new Date(n),a=new Date(e),s=i.getTime()-a.getTime();return Math.floor(s/864e5)}getSubmitedOrderDate(){return c.gT.IsNotEmpty(this.completeData)?this.completeData.OrderTimeString:this.datePipe.transform(new Date,"dd MMMM yyyy hh :mm")}getSubmitedCustomer(){return c.gT.IsEmpty(this.completeData)?{}:this.completeData.Contact}getParkLabel(){const e=this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.LabelPrefix;let i=this.posData.Order.ParkLabel;return this.AppConfigJSON.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias&&c.gT.IsNotEmpty(i)&&(i=this.park.GetAlias(i)||i),i?c.gT.IsEmpty(e)?i:c.gT.StringFormat("{0} # {1}",e,i):""}GetSubmittedNumber(){return c.gT.IsNotEmpty(this.completeData)?this.completeData.InvoiceNumber:this.posData.Invoice.Number?this.posData.Invoice.Number:this.posData.Order.Number}generateCartItemSummary(){const e=[];for(const n of this.posData.CartItems)e.push(new F(n.Total,this._cashierCalculatorService.currencySymbol,n.Variant.Name,1));return e}generatePaymentSummary(){const e=[];let n;for(let a=0;a<this.posData.Payments.length;a++){let s="Payment"+(a+1);this.AppConfigJSON.PrintConfigInvoice.Footer.PaymentMethodVisible&&(s=this.findPaymentName(Number(this.posData.Payments[a].MethodID))),n=new F(this.posData.Payments[a].PaidAmount,this._cashierCalculatorService.currencySymbol,s,1),e.push(n)}const i=this.generateChangeSummary();return null!==i&&e.push(i),e}generateChangeSummary(){let a=0,s=null;return a=this.posData.TotalPaidAmount-this._cashierCalculatorService.Data,a>0&&(s=new F(a,this._cashierCalculatorService.currencySymbol,"Change",1)),s}findPaymentName(e){return this._posService.Data.Payments.find(n=>n.ID==e).Name}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(C),t.LFG(v),t.LFG(L),t.LFG(q),t.LFG(N.D),t.LFG($t),t.LFG(Z),t.LFG(tt.r))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();var Ne=p(82621),Lt=p(117),Vt=p(98448);function vr(o,r){if(1&o&&t._UZ(0,"img",40),2&o){const e=t.oxw(2);t.s9C("src",e.printTemplate.Logo,t.LSH)}}function Or(o,r){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.qZA()),2&o){const e=t.oxw(3);t.xp6(1),t.hij("(",e.data.Contact.MemberIdentification,")")}}function xr(o,r){if(1&o&&(t.TgZ(0,"div",41)(1,"h3")(2,"span"),t._uU(3),t.qZA()(),t.TgZ(4,"div",42)(5,"strong"),t._uU(6),t.qZA(),t.YNc(7,Or,2,1,"span",0),t.TgZ(8,"div",43)(9,"div")(10,"span"),t._uU(11),t.qZA()(),t.TgZ(12,"div")(13,"span"),t._uU(14),t.qZA()(),t.TgZ(15,"div"),t._UZ(16,"span",12),t.qZA(),t.TgZ(17,"div")(18,"span"),t._uU(19),t.qZA()()()()()),2&o){const e=t.oxw(2);t.xp6(3),t.Oqu(e.appConfigJson.PrintConfigInvoice.DocumentLabel.Customer),t.xp6(3),t.Oqu(e.data.ContactDisplay),t.xp6(1),t.Q6J("ngIf",e.data.Contact.MemberIdentification),t.xp6(4),t.Oqu(e.data.Contact.Email),t.xp6(3),t.Oqu(e.data.Contact.Phone?e.data.Contact.Phone:e.data.Contact.Mobile),t.xp6(2),t.Q6J("innerHTML",e.data.Contact.Address,t.oJD),t.xp6(3),t.Oqu(e.data.City)}}function Dr(o,r){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.qZA()),2&o){const e=t.oxw(3);t.xp6(1),t.hij(", ",e.data.Shipping.Phone,"")}}function Sr(o,r){if(1&o&&(t.TgZ(0,"div",44)(1,"h3"),t._uU(2),t.qZA(),t.TgZ(3,"div",42)(4,"div"),t._uU(5),t.YNc(6,Dr,2,1,"span",0),t.qZA(),t._UZ(7,"div",12),t.TgZ(8,"div"),t._uU(9),t.qZA()()()),2&o){const e=t.oxw(2);t.xp6(2),t.hij(" ",e.appConfigJson.PrintConfigInvoice.DocumentLabel.ShippingAddress," "),t.xp6(3),t.hij(" ",e.data.Shipping.Name,""),t.xp6(1),t.Q6J("ngIf",e.data.Shipping.Phone),t.xp6(1),t.Q6J("innerHTML",e.data.Shipping.Street,t.oJD),t.xp6(2),t.hij(" ",e.data.Shipping.City," ")}}function Tr(o,r){if(1&o&&t._UZ(0,"i",47),2&o){const e=t.oxw().$implicit;t.Q6J("innerHTML",e.Note,t.oJD)}}function Ir(o,r){if(1&o&&(t.TgZ(0,"div"),t._uU(1),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.hij("-",e.Discount,"%")}}function kr(o,r){if(1&o&&(t.TgZ(0,"div"),t._uU(1),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.hij("-",e.DiscountAmount,"")}}function Ar(o,r){if(1&o&&(t.TgZ(0,"tr")(1,"td",13),t._uU(2),t.qZA(),t.TgZ(3,"td"),t._uU(4),t.TgZ(5,"div"),t.YNc(6,Tr,1,1,"i",45),t.qZA()(),t.TgZ(7,"td"),t._uU(8),t.qZA(),t.TgZ(9,"td",13),t._uU(10),t.ALo(11,"number"),t.qZA(),t.TgZ(12,"td"),t._uU(13),t.qZA(),t.TgZ(14,"td",13),t._uU(15),t.ALo(16,"number"),t.qZA(),t.TgZ(17,"td",46),t.YNc(18,Ir,2,1,"div",0),t.YNc(19,kr,2,1,"div",0),t.qZA(),t.TgZ(20,"td",13),t._uU(21),t.ALo(22,"TrailingZero"),t.qZA()()),2&o){const e=r.$implicit,n=r.index,i=t.oxw(2);t.xp6(2),t.hij("",n+1,"."),t.xp6(2),t.hij(" ",e.Name," "),t.xp6(2),t.Q6J("ngIf",null!=e.Note),t.xp6(2),t.Oqu(e.Code),t.xp6(2),t.Oqu(t.lcZ(11,10,e.Quantity)),t.xp6(3),t.Oqu(e.UOMName),t.xp6(2),t.Oqu(t.lcZ(16,12,e.UnitPrice)),t.xp6(3),t.Q6J("ngIf",0!=e.Discount),t.xp6(1),t.Q6J("ngIf",0!=e.DiscountAmount),t.xp6(2),t.Oqu(t.xi3(22,14,e.Total,i.appConfigJson.PrintConfigGeneral.TrailingZero))}}function wr(o,r){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.ALo(2,"sum"),t.qZA()),2&o){const e=t.oxw().index,n=t.oxw(2);t.xp6(1),t.hij(" ",0==e&&(null==n.data?null:n.data.Items.length)>1?"Qty: "+t.xi3(2,1,n.data.Items,"Quantity"):"","")}}function Nr(o,r){if(1&o&&(t.TgZ(0,"tr")(1,"th",48),t.YNc(2,wr,3,4,"span",0),t._uU(3),t.qZA(),t.TgZ(4,"th"),t._uU(5,":"),t.qZA(),t.TgZ(6,"th",49),t._uU(7),t.qZA(),t.TgZ(8,"th",50),t._uU(9),t.ALo(10,"TrailingZero"),t.qZA()()),2&o){const e=r.$implicit,n=r.index,i=t.oxw(2);t.xp6(2),t.Q6J("ngIf",i.appConfigJson.PrintConfigInvoice.ItemsFooter.TotalQuantityVisible),t.xp6(1),t.hij(" ",(null==i.data?null:i.data.Payments.length)>1&&n==(null==i.data?null:i.data.AmountSummary.length)-2?"Payment":e.Label," "),t.xp6(4),t.Oqu(e.CurrencySymbol),t.xp6(2),t.hij(" ",t.xi3(10,4,e.Amount,i.appConfigJson.PrintConfigGeneral.TrailingZero),"")}}function Zr(o,r){if(1&o&&(t.TgZ(0,"tr")(1,"th"),t._uU(2),t.qZA(),t.TgZ(3,"td"),t._uU(4,":"),t.qZA(),t.TgZ(5,"td",49),t._uU(6),t.qZA(),t.TgZ(7,"td",24),t._uU(8),t.ALo(9,"TrailingZero"),t.qZA()()),2&o){const e=r.$implicit,n=t.oxw(2);t.xp6(2),t.Oqu(e.Label),t.xp6(4),t.Oqu(e.CurrencySymbol),t.xp6(2),t.hij("",t.xi3(9,3,e.Amount,n.appConfigJson.PrintConfigGeneral.TrailingZero)," ")}}function Jr(o,r){if(1&o&&(t.TgZ(0,"span")(1,"span",51),t._uU(2),t.ALo(3,"date"),t.qZA(),t._uU(4),t.ALo(5,"number"),t._UZ(6,"br"),t.qZA()),2&o){const e=r.$implicit,n=t.oxw(3);t.xp6(1),t.Q6J("hidden",n.data.Payments),t.xp6(1),t.Oqu(t.xi3(3,5,e.Date,"dd MMM yy")),t.xp6(2),t.lnq(" ",e.MethodName," ",e.Note?e.Note:""," ",t.lcZ(5,8,e.Amount)," ")}}function Rr(o,r){if(1&o&&(t.TgZ(0,"tr"),t._UZ(1,"th",12),t.TgZ(2,"td"),t._uU(3," : "),t.qZA(),t.TgZ(4,"td"),t.YNc(5,Jr,7,10,"span",27),t.qZA()()),2&o){const e=t.oxw(2);t.xp6(1),t.Q6J("innerHTML",2==e.data.Invoice.PaymentStateID?"Down Payment":"Payment",t.oJD),t.xp6(4),t.Q6J("ngForOf",e.data.Payments)}}function qr(o,r){if(1&o&&(t.TgZ(0,"tr")(1,"th"),t._uU(2," Delivery "),t.qZA(),t.TgZ(3,"td"),t._uU(4," : "),t.qZA(),t.TgZ(5,"td")(6,"ul",52)(7,"li"),t._uU(8),t.qZA()()()()),2&o){const e=t.oxw(2);t.xp6(8),t.hij(" ",null==e.data.CustomerTransaction?null:e.data.CustomerTransaction.SO.DeliveryStateString," ")}}function Fr(o,r){if(1&o&&(t.TgZ(0,"tr")(1,"th",53),t._uU(2,"Remaining"),t.qZA(),t.TgZ(3,"td"),t._uU(4," :"),t.qZA(),t._UZ(5,"td",54),t.ALo(6,"number"),t.ALo(7,"sum"),t.qZA()),2&o){const e=t.oxw(2);t.xp6(5),t.Q6J("innerHtml",t.lcZ(6,1,(null==e.data?null:e.data.FinalAmount)-t.xi3(7,3,null==e.data?null:e.data.Payments,"Amount")),t.oJD)}}function Qr(o,r){if(1&o&&(t.TgZ(0,"tr")(1,"th"),t._uU(2," Note "),t.qZA(),t.TgZ(3,"td"),t._uU(4," : "),t.qZA(),t.TgZ(5,"td")(6,"ul",52)(7,"li"),t._uU(8),t.qZA()()()()),2&o){const e=t.oxw(2);t.xp6(8),t.hij(" ",null==e.data.Invoice?null:e.data.Invoice.Note," ")}}function Ur(o,r){if(1&o&&(t.TgZ(0,"div",55)(1,"h5"),t._uU(2),t.qZA(),t.TgZ(3,"div",33),t._uU(4," \xa0 "),t.qZA()()),2&o){const e=t.oxw(2);t.xp6(2),t.hij(" ",null==e.appConfigJson.PrintConfigInvoice?null:e.appConfigJson.PrintConfigInvoice.FooterLabel.ApprovedBy," ")}}function Er(o,r){if(1&o&&(t.TgZ(0,"div",56)(1,"h5"),t._uU(2),t.qZA(),t.TgZ(3,"div",33),t._uU(4," \xa0 "),t.qZA()()),2&o){const e=t.oxw(2);t.xp6(2),t.hij(" ",null==e.appConfigJson.PrintConfigDelivery?null:e.appConfigJson.PrintConfigDelivery.FooterLabel.DeliveredBy," ")}}function Lr(o,r){if(1&o&&t._UZ(0,"div",57),2&o){const e=t.oxw(2);t.Q6J("innerHTML",e.printTemplate.FooterRight,t.oJD)}}function Vr(o,r){if(1&o&&(t.TgZ(0,"div"),t._UZ(1,"link",1)(2,"link",2),t.TgZ(3,"div",3)(4,"div",4)(5,"div",5)(6,"div",6)(7,"div",7),t.YNc(8,vr,1,1,"img",8),t.TgZ(9,"div",9)(10,"h2"),t._uU(11),t.qZA(),t.TgZ(12,"small"),t._uU(13),t.qZA(),t.TgZ(14,"div",10)(15,"div",11),t._UZ(16,"span",12),t.ALo(17,"newlines"),t.qZA(),t.TgZ(18,"div",13),t._UZ(19,"span",12),t.ALo(20,"newlines"),t.qZA()()()(),t.YNc(21,xr,20,7,"div",14),t.qZA(),t.TgZ(22,"div",15)(23,"h1")(24,"strong"),t._uU(25),t.qZA(),t.TgZ(26,"span"),t._uU(27),t.qZA()(),t.TgZ(28,"div")(29,"table")(30,"thead")(31,"tr")(32,"th"),t._uU(33,"Date"),t.qZA()()(),t.TgZ(34,"tbody")(35,"tr")(36,"td"),t._uU(37),t.ALo(38,"date"),t.qZA()()()()(),t.YNc(39,Sr,10,5,"div",16),t.qZA()()(),t.TgZ(40,"section",17)(41,"div",18)(42,"table",19)(43,"thead",20)(44,"tr")(45,"th",21),t._uU(46,"No"),t.qZA(),t.TgZ(47,"th"),t._uU(48,"Name"),t.qZA(),t.TgZ(49,"th",22),t._uU(50,"Code"),t.qZA(),t.TgZ(51,"th",23),t._uU(52,"Qty"),t.qZA(),t.TgZ(53,"th",24),t._uU(54,"UOM"),t.qZA(),t.TgZ(55,"th",25),t._uU(56),t.qZA(),t.TgZ(57,"th",26),t._uU(58," Disc"),t.qZA(),t.TgZ(59,"th",25),t._uU(60),t.qZA()()(),t.TgZ(61,"tbody"),t.YNc(62,Ar,23,17,"tr",27),t.qZA()(),t.TgZ(63,"div",28)(64,"table",29)(65,"tbody"),t.YNc(66,Nr,11,7,"tr",27),t.qZA(),t.TgZ(67,"tbody"),t.YNc(68,Zr,10,6,"tr",27),t.qZA()()()()(),t.TgZ(69,"table",30),t.YNc(70,Rr,6,2,"tr",0),t.YNc(71,qr,9,1,"tr",0),t.YNc(72,Fr,8,6,"tr",0),t.YNc(73,Qr,9,1,"tr",0),t.qZA(),t.TgZ(74,"div")(75,"div")(76,"div",31)(77,"div",32)(78,"h5"),t._uU(79),t.qZA(),t.TgZ(80,"div",33),t._uU(81," \xa0 "),t.qZA()(),t.YNc(82,Ur,5,1,"div",34),t.YNc(83,Er,5,1,"div",35),t.TgZ(84,"div",36)(85,"h5"),t._uU(86),t.qZA(),t.TgZ(87,"div",33),t._uU(88),t.qZA()()()()(),t.TgZ(89,"div",37),t._UZ(90,"div",38),t.YNc(91,Lr,1,1,"div",39),t.qZA()()()),2&o){const e=t.oxw();t.xp6(8),t.Q6J("ngIf",e.printTemplate.Logo),t.xp6(3),t.Oqu(e.printTemplate.Name),t.xp6(2),t.Oqu(e.printTemplate.Field),t.xp6(3),t.Q6J("innerHTML",t.lcZ(17,27,e.printTemplate.Address),t.oJD),t.xp6(3),t.Q6J("innerHTML",t.lcZ(20,29,e.printTemplate.ContactInfo),t.oJD),t.xp6(2),t.Q6J("ngIf",e.data.ContactDisplay),t.xp6(4),t.Oqu(e.data.Prefixed),t.xp6(2),t.hij(" ",null==e.data.Invoice?null:e.data.Invoice.Number," "),t.xp6(10),t.Oqu(t.xi3(38,31,null==e.data.Invoice?null:e.data.Invoice.Date,"dd MMM yyyy")),t.xp6(2),t.Q6J("ngIf",e.data.Shipping),t.xp6(17),t.hij("Price(",e.data.CurrencySymbol,")"),t.xp6(4),t.hij("Total(",e.data.CurrencySymbol,")"),t.xp6(2),t.Q6J("ngForOf",e.data.Items),t.xp6(4),t.Q6J("ngForOf",null==e.data?null:e.data.AmountSummary),t.xp6(2),t.Q6J("ngForOf",null==e.data?null:e.data.PaidAmountSummary),t.xp6(2),t.Q6J("ngIf",(null==e.appConfigJson.PrintConfigInvoice?null:e.appConfigJson.PrintConfigInvoice.Footer.PaymentMethodVisible)&&e.data.Payments.length>0),t.xp6(1),t.Q6J("ngIf",null!=(null==e.data.CustomerTransaction?null:e.data.CustomerTransaction.SO)&&3!=(null==e.data.CustomerTransaction?null:e.data.CustomerTransaction.SO.DeliveryStateID)&&(null==e.appConfigJson.PrintConfigInvoice?null:e.appConfigJson.PrintConfigInvoice.Footer.DeliveryInfoVisible)),t.xp6(1),t.Q6J("ngIf",(null==e.data||null==e.data.Invoice?null:e.data.Invoice.PaymentStateID)&&(null==e.data||null==e.data.Invoice?null:e.data.Invoice.PaymentStateID)<3),t.xp6(1),t.Q6J("ngIf",null==e.data.Invoice?null:e.data.Invoice.Note),t.xp6(6),t.hij(" ",null==e.appConfigJson.PrintConfigInvoice?null:e.appConfigJson.PrintConfigInvoice.FooterLabel.ReceivedBy," "),t.xp6(3),t.Q6J("ngIf",1==(null==e.appConfigJson.PrintConfigDelivery?null:e.appConfigJson.PrintConfigDelivery.Footer.SignatureCountType)||2==(null==e.appConfigJson.PrintConfigDelivery?null:e.appConfigJson.PrintConfigDelivery.Footer.SignatureCountType)),t.xp6(1),t.Q6J("ngIf",2==(null==e.appConfigJson.PrintConfigDelivery?null:e.appConfigJson.PrintConfigDelivery.Footer.SignatureCountType)),t.xp6(3),t.hij(" ",null==e.appConfigJson.PrintConfigInvoice?null:e.appConfigJson.PrintConfigInvoice.FooterLabel.SignedBy," "),t.xp6(2),t.hij(" ",null==e.data.ItemTransfer?null:e.data.ItemTransfer.Courier," "),t.xp6(2),t.Q6J("ngClass",!e.printTemplate.FooterRight&&"single")("innerHTML",e.printTemplate.FooterLeft,t.oJD),t.xp6(1),t.Q6J("ngIf",e.printTemplate.FooterRight)}}let Yr=(()=>{class o{constructor(){}ngOnInit(){}}return o.\u0275fac=function(e){return new(e||o)},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-bill-receipt-A4"]],inputs:{data:"data",outletInfo:"outletInfo",appConfigJson:["config","appConfigJson"],printTemplate:"printTemplate"},decls:1,vars:1,consts:[[4,"ngIf"],["rel","stylesheet","href","/Styles/Master/app_custom.css","type","text/css"],["rel","stylesheet","href","/Styles/Print/PaperSizeA4_custom.css","type","text/css"],[1,"print_container"],[1,"sales_order_A4"],[1,"header","clearfix"],[1,"header_left"],[1,"company"],["class","float",3,"src",4,"ngIf"],[1,"companyBody"],[1,"contact_info","clearfix"],[1,"address"],[3,"innerHTML"],[1,"number"],["class","contact","style","min-width: 400px",4,"ngIf"],[1,"header_right"],["class","contact shippingAddress mt-3",4,"ngIf"],[1,"cart-mini-items"],[1,"cartItems"],[1,"w-100","table","table-sm","table-bordered","plain"],[2,"background","#FDF3C6"],[1,"number",2,"width","20px"],[2,"width","100px"],[1,"number",2,"width","50px"],[2,"width","50px"],[1,"number",2,"width","100px"],[1,"number","text-end",2,"width","20px"],[4,"ngFor","ngForOf"],[1,"col-12"],[1,"table","table-sm","table-borderless","d-flex","justify-content-end"],[1,"info"],[1,"signature"],[1,"left"],[1,"name"],["class","left leftSmall",4,"ngIf"],["class","left rightSmall",4,"ngIf"],[1,"right"],[1,"note"],[1,"left",3,"ngClass","innerHTML"],["class","right",3,"innerHTML",4,"ngIf"],[1,"float",3,"src"],[1,"contact",2,"min-width","400px"],[1,"box"],[1,"customer_info"],[1,"contact","shippingAddress","mt-3"],["class","special-TinyMCE","style","word-break:break-all",3,"innerHTML",4,"ngIf"],[1,"number","red","text-end"],[1,"special-TinyMCE",2,"word-break","break-all",3,"innerHTML"],["colspan","3"],[1,"currency"],[1,"text-end",2,"width","50px"],[3,"hidden"],[1,"float"],[1,"bg-light-gray"],[3,"innerHtml"],[1,"left","leftSmall"],[1,"left","rightSmall"],[1,"right",3,"innerHTML"]],template:function(e,n){1&e&&t.YNc(0,Vr,92,34,"div",0),2&e&&t.Q6J("ngIf",n.data)},dependencies:[g.mk,g.sg,g.O5,g.JJ,g.uU,k.qU,k.sH,k.Qc],styles:['.UOMWidth[_ngcontent-%COMP%]{width:40px!important;font-size:10px;font-style:italic}.sellPayment[_ngcontent-%COMP%] input.txtPrice[_ngcontent-%COMP%]{font-size:55px}div.print_container[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{font-size:10px!important}body[_ngcontent-%COMP%]{padding:0;font-size:12px}a.linkMini[_ngcontent-%COMP%]{left:130px;position:absolute;top:.5px;text-decoration:none;color:#3b5998}div.print_container[_ngcontent-%COMP%]{margin:0 auto;width:900px;text-align:left;color:#000;position:relative}div.print_container[_ngcontent-%COMP%], div.print_container[_ngcontent-%COMP%] h1[_ngcontent-%COMP%], div.print_container[_ngcontent-%COMP%] h2[_ngcontent-%COMP%], div.print_container[_ngcontent-%COMP%] h3[_ngcontent-%COMP%], div.print_container[_ngcontent-%COMP%] h4[_ngcontent-%COMP%], div.print_container[_ngcontent-%COMP%] h5[_ngcontent-%COMP%], div.print_container[_ngcontent-%COMP%] h6[_ngcontent-%COMP%]{font-family:Arial!important;background-color:#fff}div.mode[_ngcontent-%COMP%]{color:gray;font-size:11px;text-align:right;height:20px;padding-top:2px}div.mode[_ngcontent-%COMP%] span[_ngcontent-%COMP%], div.mode[_ngcontent-%COMP%] ul[_ngcontent-%COMP%], div.mode[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{float:left;display:block;margin:0;padding:0}div.mode[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:first-child{padding-right:5px;margin-right:5px;border-right:solid 1px gray}div.mode[_ngcontent-%COMP%] div.printer[_ngcontent-%COMP%]{float:left}div.mode[_ngcontent-%COMP%] div.template[_ngcontent-%COMP%]{float:right}div.mode[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:#3b5998;text-decoration:none}div.mode[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}div.mode[_ngcontent-%COMP%] a.active[_ngcontent-%COMP%]{color:gray}div.mode[_ngcontent-%COMP%] a.active[_ngcontent-%COMP%]:hover{text-decoration:none}div.mode[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{margin:0 5px}div.header_left[_ngcontent-%COMP%]{float:left;padding:5px 0 0 5px;max-width:425px}div.header_left[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:5px 0 0;padding:0;font-size:18px}div.header_right[_ngcontent-%COMP%]{float:right;padding:0 5px 0 0;max-width:425px}div.header_right[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:0;padding:0;text-align:right}div.header_right[_ngcontent-%COMP%] h1[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{font-size:16px;font-weight:700;margin:0 5px 0 0;text-transform:uppercase}div.header_right[_ngcontent-%COMP%] h1[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:18px;font-weight:400}div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{float:right;border-collapse:collapse}div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border:solid 1px #9E9E9E;padding:4px}div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background:#f6f6f6}div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding-bottom:6px}div.header[_ngcontent-%COMP%] img.float[_ngcontent-%COMP%]{margin:5px 0 0 5px;float:left}div.header[_ngcontent-%COMP%] div.company[_ngcontent-%COMP%]{width:100%;overflow:auto;margin:0 0 8px}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%]{float:left}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:18px;font-weight:700;margin:0;padding:0}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{font-size:11px;text-align:left;font-weight:400}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] div.contact_info[_ngcontent-%COMP%]{margin-top:3px}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] div.contact_info[_ngcontent-%COMP%] div.address[_ngcontent-%COMP%]{float:left;min-width:125px}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] div.contact_info[_ngcontent-%COMP%] div.number[_ngcontent-%COMP%]{margin-right:5px;min-width:160px}div.header[_ngcontent-%COMP%] div.contact[_ngcontent-%COMP%]{width:calc(100% - 12px);overflow:auto;border:solid 1px #9E9E9E;padding:5px}div.header[_ngcontent-%COMP%] div.contact[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-size:12px;margin:0 5px 0 0;padding:0;font-weight:700;float:left}div.header[_ngcontent-%COMP%] div.contact[_ngcontent-%COMP%] div.box[_ngcontent-%COMP%]{float:left}div.cartItems[_ngcontent-%COMP%]{padding:10px 3px 2px 5px}div.copy[_ngcontent-%COMP%]{background-image:url(/Images/Print/copy_bg.png);background-repeat:no-repeat;background-position:50% 70px}div.topNote[_ngcontent-%COMP%]{clear:both;text-align:right}div.invoiceNote[_ngcontent-%COMP%]{padding:10px 0 0 7px}div.note[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-weight:700;font-size:12px;margin:0 0 3px;padding:0}div.note[_ngcontent-%COMP%] div.single[_ngcontent-%COMP%]{width:895px!important}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%]{float:left;margin-left:5px;width:440px}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] ol[_ngcontent-%COMP%]{margin:5px 0 0;padding:0 0 0 20px}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] ol[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin:0 0 2px}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin:2px 0 5px;padding:0 0 0 20px}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin:0 0 2px}div.note[_ngcontent-%COMP%] div.right[_ngcontent-%COMP%]{float:right;width:440px;border-left:solid 1px #CACACA;padding-left:8px;margin-right:5px}div.note[_ngcontent-%COMP%] div.right[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin:0;padding:0;list-style:none}div.note[_ngcontent-%COMP%] div.right[_ngcontent-%COMP%] h3.closing[_ngcontent-%COMP%]{margin-top:10px;text-align:right}div.note-info[_ngcontent-%COMP%]{margin:auto;width:23%}table.info[_ngcontent-%COMP%]{border-collapse:collapse;margin-top:5px;margin-left:5px}table.info[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table.info[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:5px 7px;border:solid 1px #d8d8d8}table.info[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#f6f6f6}div.fullContainer[_ngcontent-%COMP%] div.print_container[_ngcontent-%COMP%]{min-height:970px;position:relative}.clearfix[_ngcontent-%COMP%]:before, .clearfix[_ngcontent-%COMP%]:after{content:"";display:table}.clearfix[_ngcontent-%COMP%]:after{clear:both}.clearfix[_ngcontent-%COMP%]{zoom:1}div.reportMargin[_ngcontent-%COMP%]{margin:20px 0 0}@media print{div.mode[_ngcontent-%COMP%], .linkMini[_ngcontent-%COMP%]{display:none;visibility:hidden;height:0px}thead[_ngcontent-%COMP%]{display:table-header-group}}small.timestamp[_ngcontent-%COMP%], small.creator[_ngcontent-%COMP%], small.printed[_ngcontent-%COMP%]{font-size:12px;text-align:center;display:block;font-style:italic;padding:2px 0}small.creator[_ngcontent-%COMP%]{padding:2px 0 20px;font-style:normal}span.titleJB[_ngcontent-%COMP%]{font-weight:700;padding:10px 0 7px 8px;display:block}.topHolder[_ngcontent-%COMP%]{margin-top:15px!important}h1.jobOrderHeader[_ngcontent-%COMP%]{text-align:center}.shippingAddress[_ngcontent-%COMP%]{text-align:right;min-width:240px;clear:both}.shippingAddress[_ngcontent-%COMP%] div.box[_ngcontent-%COMP%] div[_ngcontent-%COMP%]:first-child{text-align:left;font-weight:700}.packingSlip[_ngcontent-%COMP%]{min-width:150px}.customer_info[_ngcontent-%COMP%]{min-width:310px}body[_ngcontent-%COMP%]{padding:0;font-size:12px}div.print_container[_ngcontent-%COMP%]{margin:0 auto!important;text-align:left;color:#000;position:relative}div.mode[_ngcontent-%COMP%]{color:gray;text-align:right;height:20px;padding-top:2px;font-size:10px}div.mode[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{float:left;display:block;margin:0 5px 0 0;padding:0}div.mode[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{float:left;display:block;margin:0;padding:0}div.mode[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{float:left;display:block;margin:0 5px 0 0;padding:0 5px 0 0;border-right:solid 1px gray}div.mode[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:last-child{border-right:none}div.mode[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:#3b5998;text-decoration:none}div.mode[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}div.mode[_ngcontent-%COMP%] a.active[_ngcontent-%COMP%]{color:gray}div.mode[_ngcontent-%COMP%] a.active[_ngcontent-%COMP%]:hover{text-decoration:none}div.header[_ngcontent-%COMP%]{width:100%;overflow:auto}div.header_left[_ngcontent-%COMP%]{float:left;padding:5px 0 0 5px;max-width:425px}div.header_left[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:5px 0 0;padding:0;font-size:18px}div.header_right[_ngcontent-%COMP%]{float:right;padding:0 5px 0 0;max-width:425px}div.header_right[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:0;padding:0;text-align:right}div.header_right[_ngcontent-%COMP%] h1[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{font-size:16px;font-weight:700;margin:0 5px 0 0;text-transform:uppercase}div.header_right[_ngcontent-%COMP%] h1[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:18px;font-weight:400}div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{float:right;border-collapse:collapse}div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border:solid 1px #9E9E9E;padding:4px}div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background:#f6f6f6}div.header_right[_ngcontent-%COMP%] table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding-bottom:6px}div.header[_ngcontent-%COMP%] img.float[_ngcontent-%COMP%]{margin:5px 0 0 5px;float:left}div.header[_ngcontent-%COMP%] div.company[_ngcontent-%COMP%]{width:100%;overflow:auto;margin:0 0 8px}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%]{float:left}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:18px;font-weight:700;margin:0;padding:0}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{font-size:11px;text-align:left;font-weight:400}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] div.contact_info[_ngcontent-%COMP%]{margin-top:3px}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] div.contact_info[_ngcontent-%COMP%] div.address[_ngcontent-%COMP%]{float:left;min-width:125px}div.header[_ngcontent-%COMP%] div.companyBody[_ngcontent-%COMP%] div.contact_info[_ngcontent-%COMP%] div.number[_ngcontent-%COMP%]{margin-right:5px;min-width:160px}div.header[_ngcontent-%COMP%] div.contact[_ngcontent-%COMP%]{width:calc(100% - 12px);overflow:auto;border:solid 1px #9E9E9E;padding:5px}div.header[_ngcontent-%COMP%] div.contact[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-size:12px;margin:0 5px 0 0;padding:0;font-weight:700;float:left}div.header[_ngcontent-%COMP%] div.contact[_ngcontent-%COMP%] div.box[_ngcontent-%COMP%]{float:left}div.cartItems[_ngcontent-%COMP%]{padding:10px 3px 2px 5px}.company[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{max-width:30%}div.copy[_ngcontent-%COMP%]{background-image:url(/Images/Print/copy_bg.png);background-repeat:no-repeat;background-position:50% 70px}div.topNote[_ngcontent-%COMP%]{clear:both;text-align:right}div.invoiceNote[_ngcontent-%COMP%]{padding:10px 0 0 7px}div.note[_ngcontent-%COMP%]{position:relative}div.note[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-weight:700;font-size:12px;margin:0 0 3px;padding:0}div.note[_ngcontent-%COMP%] div.single[_ngcontent-%COMP%]{width:895px!important}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%]{float:left;margin-left:5px;width:440px;text-align:left}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] ol[_ngcontent-%COMP%]{margin:5px 0 0;padding:0 0 0 20px}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] ol[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin:0 0 2px}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin:2px 0 5px;padding:0 0 0 20px}div.note[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin:0 0 2px}div.note[_ngcontent-%COMP%] div.right[_ngcontent-%COMP%]{float:right;width:440px;border-left:solid 1px #CACACA;padding-left:8px;margin-right:5px}div.note[_ngcontent-%COMP%] div.right[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin:0;padding:0;list-style:none}div.note[_ngcontent-%COMP%] div.right[_ngcontent-%COMP%] h3.closing[_ngcontent-%COMP%]{margin-top:10px;text-align:right}.clearfix[_ngcontent-%COMP%]:before, .clearfix[_ngcontent-%COMP%]:after{content:"";display:table}.clearfix[_ngcontent-%COMP%]:after{clear:both}small.timestamp[_ngcontent-%COMP%], small.creator[_ngcontent-%COMP%], small.printed[_ngcontent-%COMP%]{font-size:12px;text-align:center;display:block;font-style:italic;padding:2px 0}.shippingAddress[_ngcontent-%COMP%]{text-align:right;min-width:240px;clear:both}.shippingAddress[_ngcontent-%COMP%] div.box[_ngcontent-%COMP%] div[_ngcontent-%COMP%]:first-child{text-align:left;font-weight:700}.packingSlip[_ngcontent-%COMP%]{min-width:150px}.customer_info[_ngcontent-%COMP%]{min-width:310px}.special-TinyMCE[_ngcontent-%COMP%]{padding-top:10px!important}@media print{body[_ngcontent-%COMP%]{font-family:Arial;color:#000}}div.signature[_ngcontent-%COMP%], div.signature-b[_ngcontent-%COMP%]{clear:both;height:111px;margin-top:25px}div.signature[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{margin:0 0 80px;padding:0;font-size:12px;font-weight:700}div.signature[_ngcontent-%COMP%] div.name[_ngcontent-%COMP%]{border-top:solid 1px Gray;height:15px;text-align:center}div.signature[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%]{float:left;margin-left:70px;width:150px}div.signature[_ngcontent-%COMP%] div.center[_ngcontent-%COMP%]{float:left;margin-left:155px;width:150px}div.signature[_ngcontent-%COMP%] div.noLeftMargin[_ngcontent-%COMP%]{margin-left:0!important}div.signature[_ngcontent-%COMP%] div.leftSmall[_ngcontent-%COMP%]{margin-left:120px!important}div.signature[_ngcontent-%COMP%] div.left[_ngcontent-%COMP%] h5[_ngcontent-%COMP%], div.signature[_ngcontent-%COMP%] div.center[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{text-align:center}div.signature[_ngcontent-%COMP%] div.right[_ngcontent-%COMP%]{float:right;width:150px;margin-right:5px}div.print_container[_ngcontent-%COMP%] div.footerNote[_ngcontent-%COMP%]{padding-left:5px;width:150px}div.signature[_ngcontent-%COMP%] div.right[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{text-align:center}div.fullSignatureNote[_ngcontent-%COMP%]{position:absolute;bottom:0;width:100%}table[_ngcontent-%COMP%] tfoot[_ngcontent-%COMP%]{display:table-row-group}table.plain[_ngcontent-%COMP%]{border-collapse:collapse}table.plain[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{text-shadow:0 -1px 0 rgba(0,0,0,.4);height:28px;line-height:16px;padding:2px 7px;color:#fff;font-weight:700}table.plain[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]{background-color:#fceca3!important;background-image:none!important}table.plain[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{color:#000;text-shadow:none}table.plain[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:5px 7px}table.plain[_ngcontent-%COMP%] tr.thick[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] tr.thick[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-bottom:3px solid black}table.plain[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(even){background-color:#f6f6f6}table.plain[_ngcontent-%COMP%] a.thumb[_ngcontent-%COMP%]{margin:0 5px 0 0;padding:0;float:left;display:block}table.plain[_ngcontent-%COMP%] a.thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;background-color:#fff;display:block;background-color:#d8dfea;border:1px solid #bbb;border-radius:3px}table.plain[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{color:#2b4e75;font-style:italic;margin:0;padding:0}table.plain[_ngcontent-%COMP%] div.text[_ngcontent-%COMP%]{padding:2px 0 0}table.plain[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%] a[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:visited{display:block;color:#00f;text-decoration:none}table.plain[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(-n+3) a[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(-n+3) a[_ngcontent-%COMP%]:visited{font-weight:700}table.plain[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}table.plain[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{margin:0;padding:0;display:block}table.plain[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] input.txtPrice[_ngcontent-%COMP%]{border:solid 1px #C8D3DF;padding:3px;text-align:right}table.plain[_ngcontent-%COMP%] tr.group[_ngcontent-%COMP%]{background-color:#fdf3c6!important}table.plain[_ngcontent-%COMP%] tr.group[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:#000!important}table.plain[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:#fff}table.plain[_ngcontent-%COMP%] th.borderLRB0[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] td.borderLRB0[_ngcontent-%COMP%]{border-left-width:0px!important;border-right-width:0px!important;border-bottom-width:0px!important;background-color:#fff!important}table.plain[_ngcontent-%COMP%] th.number[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] td.number[_ngcontent-%COMP%]{text-align:right}table.plain[_ngcontent-%COMP%] th.numberCenter[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] td.numberCenter[_ngcontent-%COMP%]{text-align:center}table.plain[_ngcontent-%COMP%] th.red[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] td.red[_ngcontent-%COMP%]{color:red;text-align:right}table.plain[_ngcontent-%COMP%] td.top[_ngcontent-%COMP%]{vertical-align:top}table.plain[_ngcontent-%COMP%] td.noTopPad[_ngcontent-%COMP%]{padding-top:0}table.plain[_ngcontent-%COMP%] td.small[_ngcontent-%COMP%]{font-size:11px}table.plain[_ngcontent-%COMP%] tr.grid_footer[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] tr.grid_footer[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-width:0px;background-color:#fff}table.plain[_ngcontent-%COMP%] span.serial[_ngcontent-%COMP%]{display:inline-block;margin-left:10px}table.plain[_ngcontent-%COMP%] tr.grid_footer[_ngcontent-%COMP%] table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table.plain[_ngcontent-%COMP%] tr.grid_footer[_ngcontent-%COMP%] table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:5px 0 5px 5px;background-color:#fff}table.plain[_ngcontent-%COMP%] td[_ngcontent-%COMP%] .inlineMarginLeft[_ngcontent-%COMP%]{display:inline-block;margin-left:10px}table.rightAuto[_ngcontent-%COMP%]{margin:0 0 0 auto}table[_ngcontent-%COMP%] ul.float[_ngcontent-%COMP%]{margin:0;padding:0;list-style-type:circle;list-style-position:inside}table[_ngcontent-%COMP%] ul.float[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin:0 20px 0 0;padding:0;float:left;display:block}table[_ngcontent-%COMP%] ul.float[_ngcontent-%COMP%] li[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{text-decoration:none}table[_ngcontent-%COMP%] ul.float[_ngcontent-%COMP%] li[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}div.scroll[_ngcontent-%COMP%]{width:100%;overflow:auto;padding:0 0 2px}table.fixed[_ngcontent-%COMP%]{table-layout:fixed}table.footer_row[_ngcontent-%COMP%]{margin:5px 8px 0 auto}table.footer_row[_ngcontent-%COMP%] td.currency[_ngcontent-%COMP%], table.footer_row[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:last-child{padding:5px 0 5px 5px;text-align:right}table.footer_row[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:5px;text-align:right;float:left}table.footer_adjust[_ngcontent-%COMP%]{margin:-10px 18px 0 auto}table.footer_adjust[_ngcontent-%COMP%] td.currency[_ngcontent-%COMP%], table.footer_adjust[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:last-child{padding:5px 0 5px 5px;text-align:right}table.footer_adjust[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:5px 23px 5px 5px;text-align:right;float:left}table.total-all-grid[_ngcontent-%COMP%]{width:100%!important;border-collapse:collapse;margin-top:10px}table.manufacture[_ngcontent-%COMP%]{width:100%;border-collapse:collapse}table.manufacture[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#fceca3!important}table.manufacture[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border:1px solid #BBBBBB!important}table.accounting[_ngcontent-%COMP%]{max-width:1000px;border-collapse:collapse}table.accounting[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{border-top:1px solid #999;border-bottom:1px solid #999;height:28px;line-height:16px;color:#444;background-color:#fceca3!important}table.accounting[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(even){background-color:#f6f6f6}table.accounting[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table.accounting[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid black}table.accounting[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%] a[_ngcontent-%COMP%], table.accounting[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:visited{color:#00f;text-decoration:none}table.accounting[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}table.accounting[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] input.txtPrice[_ngcontent-%COMP%]{border:solid 1px #C8D3DF;padding:3px;text-align:right}table.accounting[_ngcontent-%COMP%] th.number[_ngcontent-%COMP%], table.accounting[_ngcontent-%COMP%] td.number[_ngcontent-%COMP%]{text-align:right}table.accounting[_ngcontent-%COMP%] th.red[_ngcontent-%COMP%], table.accounting[_ngcontent-%COMP%] td.red[_ngcontent-%COMP%]{color:red;text-align:right}table.accounting[_ngcontent-%COMP%] th.bordertop[_ngcontent-%COMP%], table.accounting[_ngcontent-%COMP%] td.bordertop[_ngcontent-%COMP%]{border-top:1px #999 solid}table.accounting[_ngcontent-%COMP%] tfoot[_ngcontent-%COMP%] td[_ngcontent-%COMP%], table.accounting[_ngcontent-%COMP%] tfoot[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding-bottom:20px}table.main[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr.main[_ngcontent-%COMP%]:nth-child(2n){background-color:#fff}table.main[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr.main[_ngcontent-%COMP%]:nth-child(4n-1){background-color:#f6f6f6}table.main[_ngcontent-%COMP%] table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]{background-color:#fceca3!important;background-image:none!important}table.main[_ngcontent-%COMP%] table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{border:1px solid #9e9e9e;color:#000;text-shadow:none}.cartItems[_ngcontent-%COMP%] .flow[_ngcontent-%COMP%]{width:100%;padding:0;margin:0}.cartItems[_ngcontent-%COMP%] .flow[_ngcontent-%COMP%] > li[_ngcontent-%COMP%]{width:calc(33% - 17px);float:left;list-style:none;padding:5px 7px;border:solid 1px #d8d8d8}.cartItems[_ngcontent-%COMP%] .flow[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{width:calc(33% - 17px);float:left;list-style:none;padding:5px 7px;border:solid 1px #d8d8d8;display:table-cell}.cartItems[_ngcontent-%COMP%] .flow[_ngcontent-%COMP%] td[_ngcontent-%COMP%] > p[_ngcontent-%COMP%]{color:#2b4e75;font-style:italic;margin:0;padding:0}.listReturn[_ngcontent-%COMP%] tr.item[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(2){width:10%!important}.listReturn[_ngcontent-%COMP%] tr.item[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(3){width:10%!important}.listReturn[_ngcontent-%COMP%] tr.item[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(5){width:10%!important}.listReturn[_ngcontent-%COMP%] tr.item[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(6){width:5%!important}.listReturn[_ngcontent-%COMP%] tr.item[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(7){width:10%!important}.listReturn[_ngcontent-%COMP%] a.head[_ngcontent-%COMP%]{padding:10px 0 10px 10px;display:block;width:50%}.listReturn[_ngcontent-%COMP%] td.numberCenter[_ngcontent-%COMP%]{text-align:right!important}.listReturn[_ngcontent-%COMP%] table.summary[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{padding-top:20px!important;display:block}table.paidAmount[_ngcontent-%COMP%]{float:right;margin-top:-10px;text-align:right;padding-right:7px}table.paidAmount[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:0 0 1px}table.paidAmount[_ngcontent-%COMP%] td.currency[_ngcontent-%COMP%]{width:20px;text-align:left}table.paidAmount[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:nth-child(2){padding:0 5px}div.zebra[_ngcontent-%COMP%]{display:table;border-collapse:collapse}div.zebra[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{display:table-cell}div.zebra[_ngcontent-%COMP%] > div[_ngcontent-%COMP%] > strong[_ngcontent-%COMP%]{display:block;border:1px solid #525252;background-color:#545454;background-image:linear-gradient(#888,#545454);box-shadow:inset 0 2px 0 -1px #fff3;text-shadow:0 -1px 0 rgba(0,0,0,.4);height:28px;line-height:24px;border-bottom:1px solid #333;padding:2px 7px;color:#fff;font-weight:700}div.zebra[_ngcontent-%COMP%] > div[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{display:block;padding:5px 7px;border:solid 1px #d8d8d8;font-weight:700}div.zebra[_ngcontent-%COMP%] > div[_ngcontent-%COMP%] > span.number[_ngcontent-%COMP%]{text-align:right}']}),o})(),Hr=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=t.oAB({type:o}),o.\u0275inj=t.cJS({imports:[g.ez,k.dr]}),o})();function Gr(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"li",12),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.onPark())}),t._uU(1),t.qZA()}if(2&o){const e=t.oxw(2);t.xp6(1),t.hij(" ",e.AppConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkButtonLabel||"Park"," ")}}function Br(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"li",13),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.showRetrieveModal())}),t._uU(1," Retrieve "),t.qZA()}}function Kr(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"li",14),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.onSplit())}),t._uU(1),t.qZA()}if(2&o){const e=t.oxw(2);t.xp6(1),t.hij(" ",e.isSplit()?"Cancel":"Split"," ")}}function $r(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"li",15),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.onPrintRetrieve())}),t._uU(1," Print "),t.qZA()}}function zr(o,r){if(1&o&&(t.TgZ(0,"ul",7),t.YNc(1,Gr,2,1,"li",8),t.YNc(2,Br,2,0,"li",9),t.YNc(3,Kr,2,1,"li",10),t.YNc(4,$r,2,0,"li",11),t.qZA()),2&o){const e=t.oxw();t.xp6(1),t.Q6J("ngIf",(null==e.AppConfig?null:e.AppConfig.ApplicationParkAndRetrieve.Basic.EnableParkAndRetrieve)&&(!e.IsEdit()||e.isRetrive())),t.xp6(1),t.Q6J("ngIf",!e.role.RetrieveRestriction&&(null==e.AppConfig?null:e.AppConfig.ApplicationParkAndRetrieve.Basic.EnableParkAndRetrieve)),t.xp6(1),t.Q6J("ngIf",(null==e.AppConfig?null:e.AppConfig.ApplicationParkAndRetrieve.Basic.EnableParkAndRetrieve)&&(e.isRetrive()||e.isSplit())),t.xp6(1),t.Q6J("ngIf",(null==e.AppConfig?null:e.AppConfig.ApplicationParkAndRetrieve.Basic.EnableParkAndRetrieve)&&e.isRetrive())}}function jr(o,r){1&o&&t._UZ(0,"link",16)}function Wr(o,r){if(1&o&&t._UZ(0,"park-order",17),2&o){const e=t.oxw();t.Q6J("data",e.parkMini)("printTemplate",e.outletInfo.PrintTemplate)("config",e.AppConfig)}}function Xr(o,r){if(1&o&&t._UZ(0,"pos-receipt-a4",18),2&o){const e=t.oxw();t.Q6J("data",e.receiptTemplate)("printTemplate",e.outletInfo.PrintTemplate)("config",e.AppConfig)("outletInfo",e.outletInfo)}}function ts(o,r){if(1&o&&t._UZ(0,"POS-bill-receipt-A4",18),2&o){const e=t.oxw();t.Q6J("data",e.receiptTemplate)("printTemplate",e.outletInfo.PrintTemplate)("config",e.AppConfig)("outletInfo",e.outletInfo)}}function es(o,r){if(1&o&&t._UZ(0,"pos-receipt",19),2&o){const e=t.oxw();t.Q6J("data",e.receiptTemplate)("printTemplate",e.outletInfo.PrintTemplate)("config",e.AppConfig)("priceVisibleRestriction",e.role.PriceVisibleRestriction)("outletInfo",e.outletInfo)}}let ns=(()=>{class o{constructor(e,n,i,a,s,l,d,f,b,O,R){this._posService=e,this._orderProcessorService=n,this._orderDataService=i,this._outletService=a,this._receiptService=s,this._posHubService=l,this.toastr=d,this.matDialog=f,this._orderHttpService=b,this._userRoleService=O,this._promotionEvent=R,this.AppConfig=new ot,this.role=new Y.Q,this.orderProcessor=new Tt,this.posData=new J.m,this.printMode=2,this.destroy$=new T.x,this.subscribeToObservable(),this.Payments=this._posService.Data.Payments,this.AppConfig=this._posService.Data.AppConfigJSON}ngOnInit(){this.parkMini=null}subscribeToObservable(){this._orderProcessorService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.orderProcessor=e,this.checkPrintParkOrder()}),this._orderDataService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.posData=e}),this._outletService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.outletInfo=e,this.ParkLayoutPack=e.ParkLayoutPack,this.park=new ke(this.ParkLayoutPack)}),this._userRoleService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.role=e})}onPark(){if(this.AppConfig.ModuleSell.Header.CustomerRequired&&null==this.posData.Order.CustomerID)return void this.toastr.warning("Customer is needed before parking orders!","Missing customer!");if(c.gT.IsNotEmpty(this._promotionEvent.selectedPromotion)||c.gT.IsNotEmpty(this.posData.Order.AuthorizationKey))return void this.toastr.warning("sorry, you're using a promotion, can't use park!","can't use park when using promotions!");let n=!0;if(c.gT.IsEmpty(this.posData.Order.RegisterID)&&(this.toastr.warning(c.g7.emptyEntity,U.n.Warning),n=!1),this.isSplit()){const i=this.posData.CartItems.filter(a=>a.Splited).length;!i&&this.posData.CartItems.length!=i&&(this.toastr.warning(c.g7.emptyPOItem,U.n.Warning),n=!1)}if(0==this._orderDataService.Data.CartItems.length&&(this.toastr.warning("You must have at least one item","No Item in Cart!"),n=!1),n)if(c.gT.IsNotEmpty(this.ParkLayoutPack.ID))this.isRetrive()&&!this.isSplit()?this.showReparkModal():this.showParkSelectModal();else{if(1==this.AppConfig.ApplicationParkAndRetrieve.Advance.retreiveMode)return void this.toastr.error("Your retrieve config is in Group mode, to enable park please setting your Park layout at Outlet page","Error!");const i=this.AppConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.DefaultParkNoteValue;!this.IsEdit()&&""!=i&&c.gT.IsEmpty(this.posData.Order.Note)&&(this.posData.Order.Note=i),this.showParkFormModal()}}showRetrieveModal(){null!=this.ParkLayoutPack.Layout||1!=this.AppConfig.ApplicationParkAndRetrieve.Advance.retreiveMode?this.matDialog.open(Cr,{data:{title:this.AppConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.RetreiveDialogTitle,filterAlwaysVisible:this.AppConfig.ApplicationParkAndRetrieve.Advance.RetreiveFilterBoxAlwaysVisible,parkDeletionRestriction:this.AppConfig.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkOrderDeletion&&!this.role.Order,entityId:this.posData.Order.EntityID,replaceAlias:this.AppConfig.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,RegisterID:this.posData.Order.RegisterID,Park:this.park,posHub:this._posHubService,templateID:this.outletInfo.PrintTemplate.ID,voidEnabled:this.AppConfig.ModuleOrders.VoidEnabled,retreiveMode:this.AppConfig.ApplicationParkAndRetrieve.Advance.retreiveMode,Layout:this.ParkLayoutPack.Layout,parkEnableMerge:this.AppConfig.ApplicationParkAndRetrieve.Basic.EnableMergeServeralTables,AuthorizeParkOrderDeletion:this.AppConfig.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkOrderDeletion}}).afterClosed().pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.parkOrderRetrieve=e}):this.toastr.error("Your retrieve config is in Group mode, to enable park please setting your Park layout at Outlet page","Error!")}onSplit(){this._orderProcessorService.updatePosState(this.orderProcessor.posState==_.IsRetrieve?_.IsSplit:_.IsRetrieve)}IsEdit(){return this.orderProcessor.posState==_.IsEdit}isRetrive(){return this.orderProcessor.posState==_.IsRetrieve}isSplit(){return this.orderProcessor.posState==_.IsSplit}showReparkModal(){this.matDialog.open(Xa,{data:this.parkOrderRetrieve})}showParkSelectModal(){this._orderHttpService.getVacant(this.posData.Order.EntityID).subscribe(e=>{this.matDialog.open(Te,{data:{title:this.orderProcessor.posState==_.IsSplit?"Split Order":this.AppConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle,parkLayoutPack:this.ParkLayoutPack,qty:this.posData.TotalQuantity,entityId:this.posData.Order.EntityID,occupied:e.Orders,replaceWithAlias:this.AppConfig.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias}})})}showParkFormModal(e){let n="PARK Details";e&&(n="# "+e),this.isSplit()&&(n="Split Detail"),this.matDialog.open(Se,{id:"park-form-modal",data:{title:n,labelDisable:c.gT.IsNotEmpty(this.ParkLayoutPack.ID)||this.orderProcessor.posState==_.IsSplit,labelPlaceholder:this.AppConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkLabelPlaceholder,depositEnabled:this.AppConfig.ApplicationParkAndRetrieve.Deposit.Enabled,listPayment:this.Payments,ParkLabel:e||this.posData.Order.ParkLabel,deposit:this.AppConfig.ApplicationParkAndRetrieve.Deposit.DefaultAmount,note:this.posData.Order.Note,noteEnabled:this.AppConfig.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableNotes,numberOfPerson:this.posData.Order.NumberOfPerson,depositPaymentMethodID:this.posData.Order.DepositPaymentMethodID,numberOfPersonEnabled:this.AppConfig.ApplicationParkAndRetrieve.NumberOfPerson}})}checkPrintParkOrder(){this.orderProcessor.posState==_.isPark&&this.AppConfig.ApplicationParkAndRetrieve.PrintBehaviour.PrintAfterPark&&this.printPark(!0)}printPark(e){this.parkMini=this._receiptService.generateParkReceipt(e),this.printWindow().then(()=>{this.parkMini=null})}onPrintRetrieve(){this.AppConfig.ApplicationParkAndRetrieve.Basic.EnablePrintBill?this.matDialog.open(br).afterClosed().pipe((0,V.h)(n=>c.gT.IsNotEmpty(n))).subscribe(n=>{"ORDER"==n?this.printPark(!1):(this.isPrintBIll=!0,this.printBill())}):this.printPark(!1)}printBill(){let e;this.printMode=this.outletInfo.PrintTemplate.PrintMode,Pe.LA.A4==this.printMode?(e=this._receiptService.generateBillInvoice(),this.receiptTemplate=e):(e=this._receiptService.generateBillReceipt(),this.receiptTemplate=e),this.printWindow().then(()=>{this.receiptTemplate=null,this.isPrintBIll=!1})}printWindow(){return(0,Ea.Z)(function*(){return new Promise(e=>{setTimeout(()=>{window.print(),e()},500)})})()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(C),t.Y36(Z),t.Y36(v),t.Y36(q),t.Y36(we),t.Y36(dt),t.Y36(I._W),t.Y36(h.uw),t.Y36(N.D),t.Y36(K),t.Y36(rt))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-sidebutton"]],decls:9,vars:6,consts:[["class","park-action",4,"ngIf"],[1,"print_containers"],["rel","stylesheet","href","/Styles/Master/app_custom.css"],["rel","stylesheet","href","/Styles/Print/PaperSize8cm_custom.css",4,"ngIf"],[3,"data","printTemplate","config",4,"ngIf"],[3,"data","printTemplate","config","outletInfo",4,"ngIf"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo",4,"ngIf"],[1,"park-action"],["id","btnPark","data-cy","btnPark","class","park",3,"click",4,"ngIf"],["class","retrieve","data-cy","btnRetreive",3,"click",4,"ngIf"],["class","split",3,"click",4,"ngIf"],["class","retrieve",3,"click",4,"ngIf"],["id","btnPark","data-cy","btnPark",1,"park",3,"click"],["data-cy","btnRetreive",1,"retrieve",3,"click"],[1,"split",3,"click"],[1,"retrieve",3,"click"],["rel","stylesheet","href","/Styles/Print/PaperSize8cm_custom.css"],[3,"data","printTemplate","config"],[3,"data","printTemplate","config","outletInfo"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo"]],template:function(e,n){1&e&&(t.YNc(0,zr,5,4,"ul",0),t.TgZ(1,"div",1),t._UZ(2,"link",2),t.YNc(3,jr,1,0,"link",3),t.YNc(4,Wr,1,3,"park-order",4),t.qZA(),t.TgZ(5,"div",1),t.YNc(6,Xr,1,4,"pos-receipt-a4",5),t.YNc(7,ts,1,4,"POS-bill-receipt-A4",5),t.YNc(8,es,1,5,"pos-receipt",6),t.qZA()),2&e&&(t.Q6J("ngIf",n.AppConfig),t.xp6(3),t.Q6J("ngIf",n.parkMini),t.xp6(1),t.Q6J("ngIf",n.parkMini),t.xp6(2),t.Q6J("ngIf",n.receiptTemplate&&1==n.printMode&&!n.isPrintBIll),t.xp6(1),t.Q6J("ngIf",n.receiptTemplate&&1==n.printMode&&n.isPrintBIll),t.xp6(1),t.Q6J("ngIf",n.receiptTemplate&&2==n.printMode))},dependencies:[g.O5,Ne.g,Lt.Y,Vt.t,Yr],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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.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}.park-action[_ngcontent-%COMP%]{display:none}}.park-action[_ngcontent-%COMP%]{position:fixed;top:55%;transform:translateY(-50%);right:0}.park-action.fullscreen-button-right[_ngcontent-%COMP%]{right:0}.park-action[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{width:68px;height:64px;cursor:pointer;outline:none;text-align:center;font-weight:700;font-family:Roboto Slab,serif;text-transform:uppercase;list-style:none;background-color:#89b03e;color:#fff;padding-top:23px;display:block}.park-action[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:nth-child(odd){border:1px solid #51632e}.park-action[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:nth-child(even){color:#545454;text-shadow:0 1px 0 white;background-color:#f4f4f4;font-weight:700;border-left:1px solid #a6a6a6;border-right:1px solid #a6a6a6}.park-action[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:last-child{border-bottom:1px solid #a6a6a6}@media (max-width: 575.98px){.park-action[_ngcontent-%COMP%]{z-index:1000}}.park[_ngcontent-%COMP%] .mat-tab-body-content{overflow:hidden!important;padding-top:15px}"]}),o})();var Ze=p(44591),os=p(34915),Je=p(64425);function is(o,r){1&o&&(t.ynx(0),t.TgZ(1,"div",3)(2,"h4",4),t._uU(3," For use this feature you must register first!"),t._UZ(4,"br"),t._uU(5," Click the link below "),t.qZA()(),t.TgZ(6,"a",5),t._uU(7,"more information"),t.qZA(),t._uU(8," > "),t.BQk())}function as(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",6)(1,"div",7)(2,"div",8)(3,"label",9),t._UZ(4,"i",10),t.qZA()(),t.TgZ(5,"span",11),t._uU(6),t.qZA(),t.TgZ(7,"div",12)(8,"button",13),t._uU(9,"Copy to Clipboard"),t.qZA()()()(),t.TgZ(10,"div",14)(11,"div",7)(12,"div",15)(13,"label",16),t._UZ(14,"i",17),t.qZA()(),t._UZ(15,"input",18),t.TgZ(16,"div",19)(17,"button",20),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.onSendViaWhatsApp())}),t._uU(18,"Send via WhatsApp"),t.qZA()()()()}if(2&o){const e=t.oxw();t.xp6(6),t.Oqu(e.data.link),t.xp6(2),t.Q6J("cdkCopyToClipboard",e.data.link),t.xp6(7),t.Q6J("formControl",e.whatsAppNumberCtrl),t.xp6(2),t.Q6J("disabled",e.whatsAppNumberCtrl.invalid)}}let Re=(()=>{class o{constructor(e,n,i){this._dialogRef=e,this._toast=n,this.data=i,this.modalConfig=new D.O}ngOnInit(){this.modalConfig.title="Midtrans Payment Link",this.modalConfig.hideFooter=!0,this.initWaNumberCtrl()}initWaNumberCtrl(){this.whatsAppNumberCtrl=new u.p4(null,[u.kI.pattern("^[0-9]*$"),u.kI.required])}close(){this._dialogRef.close()}onSendViaWhatsApp(){const e=this.whatsAppNumberCtrl.value;e?window.open("https://wa.me/"+e+"?text="+this.data.link,"_blank"):this._toast.error("Phone Number must be insert")}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.so),t.Y36(I._W),t.Y36(h.WI))},o.\u0275cmp=t.Xpm({type:o,selectors:[["POS-modal-generate-link"]],decls:5,vars:3,consts:[[3,"config","onOk","onCancel","onClose"],[4,"ngIf","ngIfElse"],["hasLink",""],[1,"input-group","mb-2",2,"width","350px"],[1,"fw-normal","d-block"],["href","https://midtrans.com/id/product/payment-link","target","_blank"],["ng-if","ctrl.Model.Configs.ConfigLink",1,"col-sm-12"],[1,"input-group","mb-3"],[1,"input-group-text",2,"width","38px"],["for","urlValue",1,"input-group-text"],[1,"fa-solid","fa-link"],[1,"border","ps-3","pt-2",2,"width","382px"],[2,"width","150px"],["id","btnCopyLink","type","button",1,"btn","btn-outline-secondary",2,"width","150px",3,"cdkCopyToClipboard"],[1,"col-sm-12"],[1,"input-group-text",2,"width","39px"],["for","phoneNumber",1,"input-group-text",2,"width","38px","display","flex","justify-content","center"],[1,"fa-solid","fa-mobile-alt"],["type","text","placeholder","Mobile Number (e.g. 6281500000000)","aria-label","Mobile Number (e.g. 6281500000000)",2,"width","381px",3,"formControl"],[2,"width","153px"],["id","btnSend","type","button",1,"btn","btn-outline-secondary",3,"disabled","click"]],template:function(e,n){if(1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return n.close()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),t.TgZ(1,"content"),t.YNc(2,is,9,0,"ng-container",1),t.YNc(3,as,19,4,"ng-template",null,2,t.W1O),t.qZA()()),2&e){const i=t.MAs(4);t.Q6J("config",n.modalConfig),t.xp6(2),t.Q6J("ngIf",null==n.data.link||""==n.data.link)("ngIfElse",i)}},dependencies:[g.O5,u.Fj,u.JJ,u.oH,y.M,Je.i3]}),o})();const rs=function(){return["/Print/TaxInvoice"]},qe=function(o){return{ID:o}};function ss(o,r){if(1&o&&(t.TgZ(0,"a",43),t._uU(1,"Tax"),t.qZA()),2&o){const e=t.oxw();t.Q6J("routerLink",t.DdM(2,rs))("queryParams",t.VKq(3,qe,e.completeData.ObjectID))}}const ls=function(o,r){return{ID:o,Template:r}};function cs(o,r){if(1&o&&(t.TgZ(0,"a",44),t._uU(1,"Delivery Order"),t.qZA()),2&o){const e=t.oxw();t.Q6J("queryParams",t.WLB(1,ls,e.completeData.OutDeliveryID,e.outletInfo.PrintTemplate.ID))}}const ds=function(o,r,e){return{InvoiceID:o,OutID:r,Template:e}};function ps(o,r){if(1&o&&(t.TgZ(0,"a",45),t._uU(1,"Invoice & Delivery Order"),t.qZA()),2&o){const e=t.oxw();t.Q6J("queryParams",t.kEZ(1,ds,e.completeData.ObjectID,e.completeData.OutDeliveryID,e.outletInfo.PrintTemplate.ID))}}function gs(o,r){if(1&o&&(t.TgZ(0,"a",46),t._uU(1,"Invoice (No Price)"),t.qZA()),2&o){const e=t.oxw();t.Q6J("href",e.getInvoicePrintURL(!0),t.LSH)}}const us=function(o){return{ID:o,Print:1,Printer:"Normal"}};function ms(o,r){if(1&o&&(t.TgZ(0,"a",47),t._uU(1,"Packing Slip"),t.qZA()),2&o){const e=t.oxw();t.Q6J("queryParams",t.VKq(1,us,e.completeData.OutDeliveryID))}}function _s(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",48)(1,"div",49),t._UZ(2,"i",50),t.qZA(),t.TgZ(3,"div",51)(4,"autocompleteV2",52),t.NdJ("onSelect",function(i){t.CHM(e);const a=t.oxw();return t.KtG(a.updateEmail(i))}),t.qZA()(),t.TgZ(5,"div",53)(6,"a",54),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.sendEmail())}),t._uU(7,"Send Receipt"),t.qZA()()()}if(2&o){const e=t.oxw();t.xp6(4),t.Q6J("inputTextValue",e.email)}}function hs(o,r){if(1&o&&(t.TgZ(0,"a",60),t._UZ(1,"i",61),t._uU(2,"Print Receipt "),t.qZA()),2&o){const e=t.oxw(3);t.Q6J("href",e.getInvoicePrintURL(!1),t.LSH)}}function fs(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"a",62),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(3);return t.KtG(i.print())}),t._UZ(1,"i",61),t._uU(2,"Print Receipt "),t.qZA()}}function Cs(o,r){if(1&o&&(t.TgZ(0,"div",57),t.YNc(1,hs,3,1,"a",58),t.YNc(2,fs,3,0,"a",59),t.qZA()),2&o){const e=t.oxw(2);t.xp6(1),t.Q6J("ngIf",e.completeData),t.xp6(1),t.Q6J("ngIf",!e.completeData)}}function bs(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",57)(1,"button",63),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.generateLink())}),t._UZ(2,"i",64),t._uU(3,"Generate Payment Link "),t.qZA()()}}function Ps(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",57)(1,"button",65),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(2);return t.KtG(i.verifyPaymentSettlement())}),t._UZ(2,"i",66),t._uU(3,"Verify Payment Settlement "),t.qZA()()}}function Ms(o,r){if(1&o&&(t.TgZ(0,"div",12)(1,"div",55),t.YNc(2,Cs,3,2,"div",56),t.YNc(3,bs,4,0,"div",56),t.YNc(4,Ps,4,0,"div",56),t.qZA()()),2&o){const e=t.oxw();t.xp6(2),t.Q6J("ngIf",!e.posStorage.Restriction.OrderReprintRestriction),t.xp6(1),t.Q6J("ngIf",1==e.completeData.PaymentStateID),t.xp6(1),t.Q6J("ngIf",e.isNotEmpty(e.paymentGatewayService.getTransactionId()))}}function ys(o,r){if(1&o&&(t.ynx(0),t.TgZ(1,"a",67),t._uU(2),t.qZA(),t.BQk()),2&o){const e=t.oxw();t.xp6(1),t.Q6J("queryParams",t.VKq(2,qe,e.completeData.ObjectID)),t.xp6(1),t.hij(" Invoice #",null==e.completeData?null:e.completeData.InvoiceNumber," ")}}function vs(o,r){if(1&o&&(t.TgZ(0,"span",68),t._uU(1),t.qZA()),2&o){const e=t.oxw();t.xp6(1),t.hij(" Invoice #",null==e.completeData?null:e.completeData.InvoiceNumber," ")}}function Os(o,r){if(1&o&&(t.TgZ(0,"div",2)(1,"div",70),t._uU(2),t.qZA(),t.TgZ(3,"div",71),t._uU(4),t.ALo(5,"number"),t.qZA()()),2&o){const e=r.$implicit;t.xp6(2),t.Oqu(e.Label),t.xp6(2),t.AsE(" ",e.CurrencySymbol," ",t.lcZ(5,3,e.Amount)," ")}}function xs(o,r){if(1&o&&(t.TgZ(0,"div",8),t.YNc(1,Os,6,5,"div",69),t.qZA()),2&o){const e=t.oxw();t.xp6(1),t.Q6J("ngForOf",e.itemSummary)}}function Ds(o,r){if(1&o&&(t.TgZ(0,"div",75)(1,"div",76),t._uU(2),t.qZA(),t.TgZ(3,"div",77),t._uU(4),t.ALo(5,"number"),t.qZA()()),2&o){const e=r.$implicit,n=r.index,i=t.oxw(2);t.xp6(1),t.Q6J("hidden",i.role.PriceVisibleRestriction),t.xp6(1),t.AsE(" ",e.Label,": ",e.CurrencySymbol," "),t.xp6(1),t.Q6J("hidden",i.role.PriceVisibleRestriction)("ngClass",n+1===i.amountSummary.length?"amount":""),t.xp6(1),t.hij(" ",t.lcZ(5,6,e.Amount)," ")}}function Ss(o,r){if(1&o&&(t.TgZ(0,"div",75)(1,"div",76),t._uU(2),t.qZA(),t.TgZ(3,"div",78),t._uU(4),t.ALo(5,"number"),t.qZA()()),2&o){const e=r.$implicit,n=t.oxw(2);t.xp6(1),t.Q6J("hidden",n.role.PriceVisibleRestriction),t.xp6(1),t.AsE(" ",e.Label,": ",e.CurrencySymbol," "),t.xp6(1),t.Q6J("hidden",n.role.PriceVisibleRestriction),t.xp6(1),t.hij(" ",t.lcZ(5,5,e.Amount)," ")}}function Ts(o,r){if(1&o&&(t.TgZ(0,"div",72),t.YNc(1,Ds,6,8,"div",73),t.TgZ(2,"div",74),t.YNc(3,Ss,6,7,"div",73),t.qZA()()),2&o){const e=t.oxw();t.xp6(1),t.Q6J("ngForOf",e.amountSummary),t.xp6(2),t.Q6J("ngForOf",e.paymentSummary)}}function Is(o,r){if(1&o&&(t.TgZ(0,"div",79)(1,"div",80)(2,"p",81),t._uU(3," INVALID AMOUNT CHARGE, CORRECT AMOUNT "),t.qZA(),t.TgZ(4,"P",82),t._uU(5),t.ALo(6,"number"),t.qZA()()()),2&o){const e=t.oxw();t.xp6(5),t.Oqu(t.lcZ(6,1,e.completeData.Final))}}function ks(o,r){if(1&o&&(t.TgZ(0,"div",83)(1,"div",34)(2,"h3",35),t._uU(3,"Point Balance"),t.qZA()(),t._UZ(4,"div",84),t.qZA()),2&o){const e=t.oxw();t.xp6(4),t.Q6J("innerHtml",e.completeData.LoyaltyPoint,t.oJD)}}function As(o,r){if(1&o&&t._UZ(0,"pos-receipt",88),2&o){const e=t.oxw(2);t.Q6J("data",e.receiptTemplate)("printTemplate",e.outletInfo.PrintTemplate)("config",e.posStorage.AppConfigJSON)("priceVisibleRestriction",e.role.PriceVisibleRestriction)("outletInfo",e.outletInfo)}}function ws(o,r){if(1&o&&t._UZ(0,"pos-receipt-a4",89),2&o){const e=t.oxw(2);t.Q6J("data",e.receiptTemplate)("printTemplate",e.outletInfo.PrintTemplate)("config",e.posStorage.AppConfigJSON)("workOrderMode",!1)("outletInfo",e.outletInfo)}}function Ns(o,r){if(1&o&&(t.TgZ(0,"div",85),t.YNc(1,As,1,5,"pos-receipt",86),t.YNc(2,ws,1,5,"pos-receipt-a4",87),t.qZA()),2&o){const e=t.oxw();t.xp6(1),t.Q6J("ngIf",e.receiptTemplate&&2==e.printMode),t.xp6(1),t.Q6J("ngIf",e.receiptTemplate&&1==e.printMode)}}const Zs=function(o){return{"bg-gradient-warning":o}};let Js=(()=>{class o{constructor(e,n,i,a,s,l,d,f,b,O,R,Q,z,it,ht,Dt,Xs,tl,el,nl,ol){this._posDataService=e,this._posService=n,this._orderProcessorService=i,this._OrderHttpService=a,this._PaymentHttpService=s,this._receiptService=l,this._outletService=d,this._toastr=f,this._onlineStatusService=b,this._matDialog=O,this.ref=R,this._signalBroadCast=Q,this._calculatorService=z,this._localDataService=it,this._userRoleService=ht,this._router=Dt,this._receiptCalculatorService=Xs,this.datePipe=tl,this.decimalPipe=el,this.paymentGatewayService=nl,this.paymentHttpService=ol,this.posData=new J.m,this.receiptTemplate=null,this.completeData=new os.u,this.printMode=2,this.outletInfo=new kt,this.role=new Y.Q,this.email="",this.editAfterDelivery=!1,this.finalAmountDifferent=!1,this.amountSummary=[],this.itemSummary=[],this.paymentSummary=[],this.isOnline=!1,this.destroy$=new T.x}handleF8(){this.newSale()}get posStorage(){return this._posService.Data}ngOnInit(){this.subscribeToObservableChanges()}subscribeToObservableChanges(){this._posDataService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.posData=e}),this._outletService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.outletInfo=e}),this._OrderHttpService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(()=>{this.itemSummary=this._receiptService.generateCartItemSummary(),this.amountSummary=this._receiptCalculatorService.generateAmountSummary(),this.paymentSummary=this._receiptService.generatePaymentSummary()}),this._orderProcessorService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.orderManager=e,this.posState=e.posState,this._OrderHttpService.Data&&(this.completeData=this._OrderHttpService.Data),this.checkOrderDateIsNow(),this.checkFinalAmountDifferent()}),this._onlineStatusService.getOnlineStatus$().pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.isOnline=e}),this._userRoleService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.role=e}),this._router.events.pipe((0,m.R)(this.destroy$)).subscribe(e=>{e instanceof S.OD&&(this._orderProcessorService.createNewTransactionInSameOutletRegister(),this._signalBroadCast.BroadcastStateToCustomerDisplay(_.IsNew))})}ngAfterViewInit(){this.posState==_.IsComplete&&(this.checkOrderNumber(),""==this.email&&null!=this.completeData.Contact&&this.isNotEmpty(this.completeData.Contact.Email)&&(this.email=this.completeData.Contact.Email),this.isOnline||this._toastr.warning(c.g7.submitLocally,"Info!"),this.printMode=this.outletInfo.PrintTemplate.PrintMode,this.print(),this.ref.detectChanges())}checkOrderDateIsNow(){let e=this.completeData.OrderTimeString,n=this.datePipe.transform(this.posData.Order.Date,"dd MMM yyyy");this.isOrderDateNow=e.includes(n)}checkFinalAmountDifferent(){if(this.posState==_.IsComplete){const n=this.completeData.Final;if(n-this._calculatorService.Data>this.posStorage.AppConfigJSON.ModuleSell.ToleranceAmount){this.finalAmountDifferent=!0;const l=this.decimalPipe.transform(n);setTimeout(()=>{this._toastr.warning(`Final Amount should be ${l}! Use Print Receipt to print the correct Receipt!`,"Invalid Amount charged",{timeOut:1e4})},500)}else this.finalAmountDifferent=!1}}checkOrderNumber(){this.completeData.InvoiceNumber!=this.posData.Order.Number&&(this._toastr.warning("Your invoice number is changed to "+this.completeData.InvoiceNumber,"Invoice Number Changed!"),this.posData.Order.Number=this.completeData.InvoiceNumber)}generateLink(){1==this.posStorage.AppConfigJSON.PaymentConfigLink&&this._matDialog.open(Re),this._PaymentHttpService.generateLink({InvoiceID:this.completeData.ObjectID}).subscribe({next:n=>{this._matDialog.open(Re,{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(_.IsNew),this._router.navigate([],{queryParams:{ID:null}})}catch(e){console.error(e),this._toastr.error(e,"Error redirecting to NEW mode")}}shelve(){const e=this._OrderHttpService.generatePOSDataForSubmission(this.posData);this._localDataService.syncOrder(e).subscribe(()=>{this.newSale()})}retrySubmit(){this._posDataService.pushNewValue(this.posData),this._posDataService.submitOrder(this.posStorage.AppConfigJSON).then(e=>{e.Success?(this._signalBroadCast.BroadcastStateToCustomerDisplay(_.IsComplete,e.ObjectID,e.LoyaltyPoint,this.posData.TotalPaidAmount-this._calculatorService.Data),this._posDataService.pushNewValue(this.posData),this._orderProcessorService.updatePosState(_.IsComplete,e)):(this._posDataService.pushNewValue(this.posData),this._orderProcessorService.updatePosState(_.IsComplete,e))})}getInvoicePrintURL(e){let i="";return e&&(i="&Print=1&Price=0"),c.gT.StringFormat("{0}?ID={1}&Template={2}{3}","/print/Invoice"+(2===this.outletInfo.PrintTemplate.PrintMode?"Mini":""),this.completeData.ObjectID,this.outletInfo.PrintTemplate.ID,i)}sendEmail(){null!=this.email&&0!=this.email.length||(this.email=document.getElementById("contactEmail").value,""!=this.email)?this._OrderHttpService.sendEmail(this.email,this.completeData.ObjectID).then(e=>{this._toastr.success(e,"Email sent!")}):this._toastr.error("Please enter email before sending receipt!","No email")}print(){this.isOnline||(this.printMode=2,this._toastr.info("Could not print in A4 format due to network connectivity","Can't Print A4 Format!")),2==this.printMode?this.printReceiptMini():1==this.printMode&&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:e=>{this.receiptTemplate=e.Data},error:e=>{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(e){return c.gT.IsNotEmpty(e)}updateEmail(e){this.email=e}verifyPaymentSettlement(){let e=new de;e.Amount=this.completeData.Final,e.TransactionID=this.paymentGatewayService.getTransactionId(),e.RegisterID=this._outletService.Data.RegisterID,e.Number=this.posData.Order.Number,this.paymentHttpService.VerifyPayment(e).pipe((0,m.R)(this.destroy$)).subscribe({next:n=>{this._toastr.success(n.Message,"QR Settlement")}})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(v),t.Y36(C),t.Y36(Z),t.Y36(N.D),t.Y36(zt),t.Y36(we),t.Y36(q),t.Y36(I._W),t.Y36(x.q),t.Y36(h.uw),t.Y36(t.sBO),t.Y36(dt),t.Y36(L),t.Y36(P.T),t.Y36(K),t.Y36(S.F0),t.Y36($t),t.Y36(g.uU),t.Y36(g.JJ),t.Y36(Zt),t.Y36(zt))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos-complete"]],hostBindings:function(e,n){1&e&&t.NdJ("keydown.F8",function(a){return n.handleF8(a)},!1,t.Jf7)},decls:58,vars:21,consts:[[1,"sell-complete"],[1,"container-fluid","pt-8"],[1,"row"],[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","title","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","title","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-footer bg-gradient-warning",4,"ngIf"],["class","card",4,"ngIf"],["class","print_containers",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-regular","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"],["class","col-auto my-6",4,"ngIf"],[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"],["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,"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"],[1,"border-top"],[1,"d-flex","justify-content-end",2,"line-height","30px"],[1,"text-end",3,"hidden"],[1,"text-end","w-50",3,"hidden","ngClass"],[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"],[1,"print_containers"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo",4,"ngIf"],[3,"data","printTemplate","config","workOrderMode","outletInfo",4,"ngIf"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo"],[3,"data","printTemplate","config","workOrderMode","outletInfo"]],template:function(e,n){if(1&e&&(t.TgZ(0,"section",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"div",4)(5,"div",5)(6,"div",6)(7,"h2"),t._UZ(8,"i",7),t._uU(9," Order Upload Fail! "),t.qZA()()(),t.TgZ(10,"div",8)(11,"div",9)(12,"div",10)(13,"button",11),t.NdJ("click",function(){return n.retrySubmit()}),t._uU(14," Retry Upload "),t.qZA()()()(),t.TgZ(15,"div",12)(16,"div",13)(17,"div",14)(18,"button",15),t.NdJ("click",function(){return n.shelve()}),t._UZ(19,"i",16),t._uU(20,"Save Offline "),t.qZA()()()()(),t.TgZ(21,"div",4)(22,"div",17)(23,"div",6)(24,"h2"),t._UZ(25,"i",18),t._uU(26," Sell Complete "),t.TgZ(27,"small",19),t._uU(28),t.qZA()(),t.TgZ(29,"div")(30,"div",20),t._UZ(31,"button",21),t.TgZ(32,"div",22),t.YNc(33,ss,2,5,"a",23),t.YNc(34,cs,2,4,"a",24),t.YNc(35,ps,2,5,"a",25),t.YNc(36,gs,2,1,"a",26),t.YNc(37,ms,2,3,"a",27),t.qZA()()()()(),t.TgZ(38,"div",8)(39,"div",28),t.YNc(40,_s,8,1,"div",29),t.TgZ(41,"div",9)(42,"div",30)(43,"button",31),t.NdJ("click",function(){return n.newSale()}),t._uU(44," New Sale (F8) "),t.qZA()()()()(),t.YNc(45,Ms,5,3,"div",32),t.qZA()(),t.TgZ(46,"div",33)(47,"div",4)(48,"div",34)(49,"h3",35),t.YNc(50,ys,3,4,"ng-container",36),t.YNc(51,vs,2,1,"ng-template",null,37,t.W1O),t.qZA()(),t.YNc(53,xs,2,1,"div",38),t.YNc(54,Ts,4,2,"div",39),t.YNc(55,Is,7,3,"div",40),t.qZA(),t.YNc(56,ks,5,1,"div",41),t.qZA()()()(),t.YNc(57,Ns,3,2,"div",42)),2&e){const i=t.MAs(52);t.xp6(4),t.Q6J("hidden",1==n.posState),t.xp6(17),t.Q6J("hidden",9==n.posState),t.xp6(1),t.Q6J("ngClass",t.VKq(19,Zs,!n.isOrderDateNow||n.completeData.PaymentStateID<3)),t.xp6(6),t.hij(" (",n.completeData.PaymentStateLabel,")"),t.xp6(5),t.Q6J("ngIf",n.completeData),t.xp6(1),t.Q6J("ngIf",n.completeData.OutDeliveryID),t.xp6(1),t.Q6J("ngIf",n.completeData.OutDeliveryID),t.xp6(1),t.Q6J("ngIf",n.completeData),t.xp6(1),t.Q6J("ngIf",n.completeData.OutDeliveryID),t.xp6(3),t.Q6J("ngIf",!n.role.EmailRestriction&&n.isOnline),t.xp6(5),t.Q6J("ngIf",n.isOnline),t.xp6(2),t.Q6J("hidden",9==n.posState),t.xp6(3),t.Q6J("ngIf",n.isOnline)("ngIfElse",i),t.xp6(3),t.Q6J("ngIf",n.itemSummary),t.xp6(1),t.Q6J("ngIf",!n.finalAmountDifferent),t.xp6(1),t.Q6J("ngIf",n.finalAmountDifferent),t.xp6(1),t.Q6J("ngIf",n.completeData.LoyaltyPoint),t.xp6(1),t.Q6J("ngIf",n.outletInfo)}},dependencies:[g.mk,g.sg,g.O5,S.yS,st.J,Vt.t,Lt.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-primary[_ngcontent-%COMP%]{color:#0976b4!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}.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}"]}),o})();function Rs(o,r){if(1&o&&t._UZ(0,"pos-header",4),2&o){const e=t.oxw();t.Q6J("isOnline",e.isOnline)}}function qs(o,r){1&o&&t._UZ(0,"pos-sidebutton")}function Fs(o,r){if(1&o&&(t.ynx(0),t._UZ(1,"pos-toolbar"),t.TgZ(2,"div",9)(3,"div",10),t._UZ(4,"pos-quick-key"),t.qZA(),t.TgZ(5,"div",11),t._UZ(6,"pos-cart"),t.qZA()(),t.YNc(7,qs,1,0,"pos-sidebutton",12),t.BQk()),2&o){const e=t.oxw(2);t.xp6(7),t.Q6J("ngIf",e.isOnline)}}function Qs(o,r){1&o&&(t.TgZ(0,"div"),t._UZ(1,"pos-complete"),t.qZA())}function Us(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div")(1,"h4",13),t._UZ(2,"i",14),t.TgZ(3,"span",15),t._uU(4,"Commission for order"),t.qZA(),t.TgZ(5,"a",16)(6,"small",17),t._uU(7),t.qZA()()(),t.TgZ(8,"commission-cart",18),t.NdJ("onSaved",function(){t.CHM(e);const i=t.oxw(3);return t.KtG(i.onCommissionSaved())})("onBack",function(){t.CHM(e);const i=t.oxw(3);return t.KtG(i.orderManager.CommissionID=null)}),t.qZA()()}if(2&o){const e=t.oxw(3);t.xp6(7),t.hij("#",null==e.submitOrderData?null:e.submitOrderData.InvoiceNumber,""),t.xp6(1),t.Q6J("soid",e.orderManager.CommissionID)("listSales",e.outletInfo.ListSales)}}function Es(o,r){if(1&o&&(t.YNc(0,Qs,2,0,"div",12),t.YNc(1,Us,9,3,"div",12)),2&o){const e=t.oxw(2);t.Q6J("ngIf",!e.orderManager.CommissionID),t.xp6(1),t.Q6J("ngIf",e.orderManager.CommissionID)}}function Ls(o,r){if(1&o&&(t.TgZ(0,"div",5),t.YNc(1,Fs,8,1,"ng-container",6),t.YNc(2,Es,2,2,"ng-template",null,7,t.W1O),t._UZ(4,"div",8),t.qZA()),2&o){const e=t.MAs(3),n=t.oxw();t.xp6(1),t.Q6J("ngIf",n.IsNotCompleteOrFailed())("ngIfElse",e)}}const Vs=[{path:"",component:(()=>{class o extends Yt.M{constructor(e,n,i,a,s,l,d,f,b,O,R,Q,z){super(i),this.dialogRef=e,this._posService=n,this._httpService=i,this._OrderHttpService=a,this._orderProcessorService=s,this._outletService=l,this._onlineStatusService=d,this._route=f,this._signalRClientService=b,this._toastr=O,this._paymentServiceGateway=R,this._numpadService=Q,this.locale=z,this.isOnline=!0,this.destroy$=new T.x,this.decimalPipe=new g.JJ(z)}ngOnInit(){this.menuData$.subscribe(()=>{this._posService.request().then(e=>{if(this.posHttpResponse=e,this.subscribeToObservableChanges(),this.checkClientTime(),this._route.snapshot.queryParamMap.has("ID")){const n=this._route.snapshot.queryParamMap.get("ID");this.editInvoice(n)}else this._outletService.setActiveRegisterFromOptions(e.Registers,e.UserName)}).catch(e=>{alert(e.Message)})})}onQRPaymentComplete(e){if(!c.gT.IsEmpty(e)){const n=JSON.parse(e);this._paymentServiceGateway.onQRPaymentComplete(n,this.posHttpResponse.AppConfigJSON).then(i=>{this.dialogRef.getDialogById("ModalPayment").close();const l=`IDR ${this.decimalPipe.transform(n.gross_amount)} received. Please verify in customer mobile app!`;this._toastr.success(l," QR Settlement"),this._orderProcessorService.updatePosState(_.IsComplete,i)}).catch(i=>{this._toastr.error(i.message,i.header?i.header:"Error")})}}editInvoice(e){this._orderProcessorService.updatePosState(_.IsEdit),this._OrderHttpService.GetInvoiceBySoID(e).pipe((0,m.R)(this.destroy$)).subscribe(n=>{this.invoiceNumberEdit=n.Invoice.Number,this._orderProcessorService.plainToClass(n),this.syncPageHeaderLabel(_.IsEdit)})}subscribeToObservableChanges(){this._onlineStatusService.getOnlineStatus$().pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.isOnline=e}),this._orderProcessorService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.orderManager=e,this.submitOrderData=this._OrderHttpService.Data,this.posState=e.posState,this.syncPageHeaderLabel(this.posState)}),this._outletService.Data$.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.outletInfo=e}),this._signalRClientService.OnPaymentReceived.pipe((0,m.R)(this.destroy$)).subscribe(e=>{this.onQRPaymentComplete(e)})}IsNotCompleteOrFailed(){let e;switch(this.posState){case _.IsComplete:case _.UploadOrderFail:e=!1;break;default:e=!0}return e}syncPageHeaderLabel(e){switch(e){case _.IsEdit:this.invoiceNumberEdit&&(this.menuData.H=`Editing Order#${this.invoiceNumberEdit}`);break;case _.IsComplete:this.menuData.H=c.gT.IsEmpty(this.orderManager.CommissionID)?"Order Complete":"New Sale Order";break;default:this.menuData.H="New Sale Order"}}onCommissionSaved(){this.orderManager.CommissionID=null}checkClientTime(){let e=new Date(this.posHttpResponse.ServerDateString),n=new Date;e.getDate()!==n.getDate()&&this._toastr.warning("Client date is not equal with Server Date",U.n.Warning)}ngOnDestroy(){this._numpadService.destroy(),this.destroy$.next(!0),this.destroy$.complete()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.uw),t.Y36(C),t.Y36(M.O),t.Y36(N.D),t.Y36(Z),t.Y36(q),t.Y36(x.q),t.Y36(S.gz),t.Y36(At.G),t.Y36(I._W),t.Y36(Zt),t.Y36(jt.u),t.Y36(t.soG))},o.\u0275cmp=t.Xpm({type:o,selectors:[["pos"]],features:[t.qOj],decls:6,vars:7,consts:[["rel","stylesheet","href","/Styles/Master/app_custom.css"],[3,"hideSearchDropdown","hideSearchBox","offline","pageData","hideMoreMenu"],[3,"isOnline",4,"ngIf"],["class","container-fluid",4,"ngIf"],[3,"isOnline"],[1,"container-fluid"],[4,"ngIf","ngIfElse"],["complete",""],[1,"simple-keyboard"],[1,"row","row","body","g-0","mt-4","justify-content-start"],[1,"col-auto","quickKey"],[1,"col-auto","cart"],[4,"ngIf"],[1,"text-link","my-8"],["aria-hidden","true",1,"fa-solid","fa-money-bill-alt"],[1,"text-primary","fw-bold","h4"],[1,"text-dark","fs-10","fst-italic"],[1,"text-muted"],[3,"soid","listSales","onSaved","onBack"]],template:function(e,n){1&e&&(t._UZ(0,"link",0),t.TgZ(1,"mainpanel-cmp",1)(2,"actions"),t.YNc(3,Rs,1,1,"pos-header",2),t.qZA(),t.TgZ(4,"content"),t.YNc(5,Ls,5,2,"div",3),t.qZA()()),2&e&&(t.xp6(1),t.Q6J("hideSearchDropdown",!0)("hideSearchBox",!0)("offline",!n.isOnline)("pageData",n.menuData)("hideMoreMenu",1==n.posState),t.xp6(2),t.Q6J("ngIf",n.posHttpResponse&&n.IsNotCompleteOrFailed()),t.xp6(2),t.Q6J("ngIf",n.posHttpResponse))},dependencies:[g.O5,Ln,co,Ta,Ua,Oe.p,ns,Ze.W,Js],styles:['@media print{.cashier[_ngcontent-%COMP%], pos-quick-key[_ngcontent-%COMP%], pos-header[_ngcontent-%COMP%], pos-toolbar[_ngcontent-%COMP%]{display:none}}.quickKey[_ngcontent-%COMP%]{margin-right:10px}.cashier[_ngcontent-%COMP%] [_ngcontent-%COMP%]::-webkit-input-placeholder{font-style:italic}.cashier[_ngcontent-%COMP%] [_ngcontent-%COMP%]:-moz-placeholder{font-style:italic}.cashier[_ngcontent-%COMP%] [_ngcontent-%COMP%]::-moz-placeholder{font-style:italic}.cashier[_ngcontent-%COMP%] [_ngcontent-%COMP%]:-ms-input-placeholder{font-style:italic}.cashier[_ngcontent-%COMP%] div.container-fluid[_ngcontent-%COMP%] div.row.body[_ngcontent-%COMP%] div.quickKey[_ngcontent-%COMP%]{width:420px;margin-right:10px}.cashier[_ngcontent-%COMP%] div.container-fluid[_ngcontent-%COMP%] div.row.body[_ngcontent-%COMP%] div.cart[_ngcontent-%COMP%]{width:570px}@media only screen and (max-width: 1280px){input[id=ContactID][_ngcontent-%COMP%]{width:135px}}@media only screen and (max-width: 1215px){input[id=ContactID][_ngcontent-%COMP%]{width:120px}}@media only screen and (max-width: 1185px){input[id=ContactID][_ngcontent-%COMP%]{width:140px}}.simple-keyboard[_ngcontent-%COMP%]{width:20vw;position:absolute;left:77%;top:30%;z-index:1200} .hg-theme-default .hg-button{height:70px!important;font-size:16px!important} .hg-button-bksp{width:21px} .hg-button[data-skbtn="{enter}"]{width:90px}']}),o})()},{path:"**",redirectTo:"",pathMatch:"full"}];let Ys=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=t.oAB({type:o}),o.\u0275inj=t.cJS({imports:[S.Bz.forChild(Vs),S.Bz]}),o})();var Hs=p(71948);let Gs=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=t.oAB({type:o}),o.\u0275inj=t.cJS({imports:[g.ez,y.d,Hs.Fk,u.u5,E.Nh,k.dr,pt.vV]}),o})();var ne=p(65131),Bs=p(10266),Fe=p(94673);let Ks=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=t.oAB({type:o}),o.\u0275inj=t.cJS({imports:[g.ez,gt.ZU,k.dr,u.u5,y.d,$.A0,ne.X,st.Q,Jt.q,Bs.AV,Fe.z]}),o})(),Qe=(()=>{class o{transform(e,n,...i){return e.filter(a=>!n.includes(a.ID))}}return o.\u0275fac=function(e){return new(e||o)},o.\u0275pipe=t.Yjl({name:"payment",type:o,pure:!0}),o})();var $s=p(12386);let zs=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=t.oAB({type:o}),o.\u0275inj=t.cJS({providers:[Qe],imports:[g.ez,$.A0,_t.Tx,u.u5,y.d,gt.ZU,E.Nh,k.dr,qt._t,ne.X,ho,$s.S,st.Q,pt.vV,Me._8,S.Bz,Jt.q,Xt.JX,Wt.O,Fe.z]}),o})(),js=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=t.oAB({type:o}),o.\u0275inj=t.cJS({imports:[g.ez,S.Bz,u.u5,$.A0,E.Nh,y.d,k.dr,Ne.I,Lt.o,Vt.e,ne.X,Hr]}),o})(),Ue=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=t.oAB({type:o}),o.\u0275inj=t.cJS({providers:[ye],imports:[g.ez,E.Nh,k.dr,S.Bz]}),o})(),Ws=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=t.oAB({type:o}),o.\u0275inj=t.cJS({providers:[Qe],imports:[g.ez,u.u5,u.UX,Ys,Gs,Ks,zs,Ue,Oe.R,Ue,k.dr,st.Q,Vt.e,Lt.o,js,Ze.$,y.d,Je.Iq]}),o})()},76359:(Ee,St,p)=>{p.d(St,{R:()=>lt,q:()=>j});var g=p(36895),S=p(94650),t=p(24006),T=p(67327),_=p(77579),m=p(78372),Yt=p(71884),c=p(54004),U=p(39300),h=p(82722);class H{constructor(){this._input$=new _.x,this._destroy$=new _.x,this._loading=!1,this._bufferSize=50,this.data=[]}onSearch(){this._input$.pipe((0,m.b)(200),(0,Yt.x)(),(0,c.U)(P=>(P&&(P=P.toLowerCase()),this.filterData(P))),(0,U.h)(P=>void 0!==P),(0,h.R)(this._destroy$)).subscribe(P=>{this._dataBuffer=P.slice(0,this._bufferSize)})}onClear(){this._dataBuffer=this._data.slice(0,this._bufferSize)}filterData(P){let C,M=-1;return this._data.filter(J=>(C=JSON.stringify(J).toLowerCase(),M=C.indexOf(P),-1!==M||null==P))}get input$(){return this._input$}get bufferData(){return this._dataBuffer}get loading(){return this._loading}set data(P){this._data=P||[],this._dataBuffer=this._data.slice(0,this._bufferSize),this.onSearch()}initSelectedValue(P,M){if(T.gT.IsNotEmpty(P)){let C=this._data.filter(N=>-1!==N[M].toString().toLowerCase().indexOf(P));this._dataBuffer=C.slice(0,this._bufferSize)}}set bufferSize(P){this._bufferSize=P}onScrollToEnd(){this.fetchMore()}fetchMore(){const P=this._dataBuffer.length,M=this._data.slice(P,this._bufferSize+P);this._loading=!0,setTimeout(()=>{this._loading=!1,this._dataBuffer=this._dataBuffer.concat(M)},200)}destroy(){this._destroy$.next(!0),this._destroy$.complete()}}var V=p(88796);let lt=(()=>{class x{constructor(){this.width="100%",this.clearable=!0,this.ngSelectInfiniteScroll=new H,this.selectedChange=new S.vpe}set items(M){this.ngSelectInfiniteScroll.data=M,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}get selected(){return this._selected}set selected(M){this._selected=M,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}onSelectChange(M){this.selectedChange.emit(M?M[this.bindValue]:null)}}return x.\u0275fac=function(M){return new(M||x)},x.\u0275cmp=S.Xpm({type:x,selectors:[["ng-select-infinite"]],inputs:{placeholder:"placeholder",bindValue:"bindValue",bindLabel:"bindLabel",width:"width",clearable:"clearable",parent:"parent",items:"items",selected:"selected"},outputs:{selectedChange:"selectedChange"},decls:1,vars:11,consts:[[3,"virtualScroll","typeahead","items","bindLabel","bindValue","placeholder","ngModel","clearable","appendTo","clear","scrollToEnd","change"]],template:function(M,C){1&M&&(S.TgZ(0,"ng-select",0),S.NdJ("clear",function(){return C.ngSelectInfiniteScroll.onClear()})("scrollToEnd",function(){return C.ngSelectInfiniteScroll.onScrollToEnd()})("change",function(J){return C.onSelectChange(J)}),S.qZA()),2&M&&(S.Udp("width",C.width),S.Q6J("virtualScroll",!0)("typeahead",C.ngSelectInfiniteScroll.input$)("items",C.ngSelectInfiniteScroll.bufferData)("bindLabel",C.bindLabel)("bindValue",C.bindValue)("placeholder",C.placeholder)("ngModel",C.selected)("clearable",C.clearable)("appendTo",C.parent))},dependencies:[V.w9,t.JJ,t.On]}),x})(),j=(()=>{class x{}return x.\u0275fac=function(M){return new(M||x)},x.\u0275mod=S.oAB({type:x}),x.\u0275inj=S.cJS({imports:[g.ez,V.A0,t.u5]}),x})()}}]);