dealpos 25.36.2 → 25.36.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{chunk-UBFPWZKK.js → chunk-2BJ64H7R.js} +1 -1
- package/browser/{chunk-MIUDUL5O.js → chunk-2LKOMKF7.js} +1 -1
- package/browser/{chunk-6WVUJYF7.js → chunk-2P7A5QSW.js} +1 -1
- package/browser/{chunk-WN5WLSWK.js → chunk-2WELHORE.js} +12 -12
- package/browser/{chunk-HTXNZ5OH.js → chunk-36TT3WJZ.js} +2 -2
- package/browser/{chunk-RTD4PUTS.js → chunk-3AEZZSNR.js} +1 -1
- package/browser/{chunk-VCINTCFP.js → chunk-3K4NHIJV.js} +1 -1
- package/browser/{chunk-NFTUD5LZ.js → chunk-4KJQEYIR.js} +1 -1
- package/browser/{chunk-3BWRE4P6.js → chunk-4OMZQ5HK.js} +1 -1
- package/browser/{chunk-4WIPVW4V.js → chunk-64PRCTR2.js} +1 -1
- package/browser/{chunk-446SIVDN.js → chunk-6Z7ZGTB4.js} +1 -1
- package/browser/{chunk-SEJO3YK3.js → chunk-7F6H3VFX.js} +1 -1
- package/browser/{chunk-55VMNRO2.js → chunk-7FRXJGU7.js} +1 -1
- package/browser/{chunk-FTG6OSPJ.js → chunk-7HX2ZEHC.js} +1 -1
- package/browser/{chunk-WYTXXYFH.js → chunk-A3OULNF5.js} +1 -1
- package/browser/{chunk-KKQ3PBCF.js → chunk-A4K4RDXW.js} +1 -1
- package/browser/{chunk-FWSWIKNJ.js → chunk-AOAAVKWR.js} +1 -1
- package/browser/{chunk-7DIY4CBI.js → chunk-C7EZEQZQ.js} +1 -1
- package/browser/{chunk-NQEHGV4G.js → chunk-CURXE4WR.js} +1 -1
- package/browser/{chunk-JHNH2AF7.js → chunk-DJHIHS3W.js} +1 -1
- package/browser/{chunk-M5255JXQ.js → chunk-DQXE767S.js} +1 -1
- package/browser/{chunk-ZDEUKETL.js → chunk-EIHAMJHD.js} +1 -1
- package/browser/{chunk-KI3VDGWO.js → chunk-GHYJCSNA.js} +1 -1
- package/browser/{chunk-72CYGG3F.js → chunk-GM7AHKLZ.js} +1 -1
- package/browser/{chunk-RPHXTGV4.js → chunk-HID7MO2S.js} +1 -1
- package/browser/{chunk-445MKY7P.js → chunk-I3JXGYPZ.js} +1 -1
- package/browser/{chunk-236T5WSU.js → chunk-IB3KMJOZ.js} +1 -1
- package/browser/{chunk-K3CBCNVT.js → chunk-IBTIOJOZ.js} +1 -1
- package/browser/{chunk-LEGX56U6.js → chunk-IPI25TWA.js} +1 -1
- package/browser/{chunk-5YNQL2WY.js → chunk-ITSEL53X.js} +1 -1
- package/browser/{chunk-JST7PLQM.js → chunk-JM6WDW37.js} +1 -1
- package/browser/{chunk-NKWIQ32C.js → chunk-JYTOIAQL.js} +1 -1
- package/browser/{chunk-STXBDXCJ.js → chunk-KRC5LE5H.js} +1 -1
- package/browser/{chunk-P6XHDVFD.js → chunk-L2GLJO5X.js} +1 -1
- package/browser/{chunk-LET3RO6U.js → chunk-LP2Z5VKX.js} +2 -2
- package/browser/{chunk-HNUM6CZZ.js → chunk-LQTBKFXH.js} +1 -1
- package/browser/{chunk-24BK4GZ2.js → chunk-LRSTQA5B.js} +1 -1
- package/browser/{chunk-UGTEWCC7.js → chunk-LVK7ESIU.js} +2 -2
- package/browser/{chunk-TMQHZ27I.js → chunk-M5PTO2R2.js} +1 -1
- package/browser/{chunk-75OXW5FF.js → chunk-N4OAT3FW.js} +1 -1
- package/browser/{chunk-5XPT5NMN.js → chunk-N7T6HUYA.js} +1 -1
- package/browser/{chunk-GPNQBF7Z.js → chunk-NFBE3ZMT.js} +1 -1
- package/browser/{chunk-CAHMIN3M.js → chunk-NH3OND33.js} +1 -1
- package/browser/{chunk-YCDAVU5S.js → chunk-NQ25BYIN.js} +1 -1
- package/browser/{chunk-XH75PP4O.js → chunk-NR54XPL4.js} +1 -1
- package/browser/{chunk-GWRTBYUS.js → chunk-NRWF3XBS.js} +1 -1
- package/browser/chunk-OG4QEJCU.js +1 -0
- package/browser/{chunk-RU6ZFZ7D.js → chunk-OLSVR34W.js} +1 -1
- package/browser/{chunk-AQUIB7DB.js → chunk-PTXDA5BK.js} +1 -1
- package/browser/{chunk-VWY6NDHT.js → chunk-PY6BNBHP.js} +1 -1
- package/browser/{chunk-OZAJEAR6.js → chunk-Q23EKNIO.js} +1 -1
- package/browser/{chunk-ADO2SKYQ.js → chunk-Q7GVJZBF.js} +1 -1
- package/browser/{chunk-GOS6KCY4.js → chunk-QYXTSGSR.js} +1 -1
- package/browser/{chunk-X33IUA3S.js → chunk-R3JXU6L4.js} +1 -1
- package/browser/{chunk-WWHY6YW5.js → chunk-RKIIOMW3.js} +1 -1
- package/browser/{chunk-XLVCNQHR.js → chunk-RQLTUOIG.js} +1 -1
- package/browser/{chunk-ZWSIMORT.js → chunk-RWHRX53O.js} +1 -1
- package/browser/{chunk-RDKRZMFS.js → chunk-TFRMAVDX.js} +1 -1
- package/browser/{chunk-JUFO6GHQ.js → chunk-UG37H4GU.js} +1 -1
- package/browser/{chunk-ND4SQ7JK.js → chunk-UJUI5ETY.js} +1 -1
- package/browser/{chunk-IRINITYM.js → chunk-UV6PSJXI.js} +1 -1
- package/browser/{chunk-OONLQN47.js → chunk-VP36G4HT.js} +1 -1
- package/browser/{chunk-K2ZWKEBA.js → chunk-WD3MA4MA.js} +1 -1
- package/browser/{chunk-AZU6HW5D.js → chunk-WSJHXTI4.js} +1 -1
- package/browser/{chunk-4E2SGUYD.js → chunk-WW5AU5JJ.js} +1 -1
- package/browser/{chunk-5DXZCDDX.js → chunk-X6IMSSTG.js} +2 -2
- package/browser/{chunk-GX4LLL35.js → chunk-XGHFDJFY.js} +1 -1
- package/browser/{chunk-EDH67DEI.js → chunk-XSZLLHRW.js} +1 -1
- package/browser/{chunk-4NZA4IG2.js → chunk-Y545FJCR.js} +1 -1
- package/browser/{chunk-5PMSCBJJ.js → chunk-YJSNPROE.js} +1 -1
- package/browser/{chunk-GWPSMBLW.js → chunk-YKXNLBIB.js} +2 -2
- package/browser/{chunk-MW7RJQ7L.js → chunk-YPF7BMPI.js} +1 -1
- package/browser/{chunk-ATIZNVIC.js → chunk-YUGYXJ5G.js} +1 -1
- package/browser/{chunk-AC66NWU7.js → chunk-YVBFA7MT.js} +1 -1
- package/browser/{chunk-INVGSUVG.js → chunk-ZY2QH5WA.js} +1 -1
- package/browser/{chunk-QWHALQ42.js → chunk-ZYVROOL4.js} +1 -1
- package/browser/index.html +2 -2
- package/browser/{main-SYCMIOD6.js → main-LFZKZ6WQ.js} +2 -2
- package/package.json +1 -1
- package/browser/chunk-A7VZLQPZ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as te}from"./chunk-KUUYZ5UQ.js";import{h as U,i as re}from"./chunk-AZU6HW5D.js";import"./chunk-RU6ZFZ7D.js";import{a as Q,b as H}from"./chunk-ATIZNVIC.js";import"./chunk-52EOLV7I.js";import"./chunk-5UL73W4S.js";import{D as A}from"./chunk-X6LIVARI.js";import"./chunk-CIBQBSM6.js";import{G as ie,O as ne}from"./chunk-5UCQBOD6.js";import"./chunk-D35OBUDE.js";import"./chunk-567HXZXC.js";import"./chunk-CGESXTHC.js";import"./chunk-2FWFPV5I.js";import"./chunk-TLOTIYIE.js";import"./chunk-P7HKWFZT.js";import"./chunk-75OXW5FF.js";import"./chunk-K3CBCNVT.js";import{d as ee}from"./chunk-AHCRE4GP.js";import"./chunk-STXBDXCJ.js";import{$a as o,Ac as C,Bc as b,Cc as X,Fc as P,Ib as n,Jb as i,Kb as h,Lb as I,Mb as D,Ob as O,Qb as y,Rb as m,Td as q,Vd as Z,Yc as k,Yd as R,Zc as L,d as w,da as u,db as x,dc as T,ec as r,ed as j,fc as v,gc as f,gd as B,hc as K,jd as Y,ka as M,kb as $,lb as N,ob as V,qb as d,va as g,vb as c,wa as S,zc as _}from"./chunk-DZT5XHBQ.js";import"./chunk-7DCB7DB2.js";function ue(t,a){if(t&1){let e=O();n(0,"a",19),y("click",function(){g(e);let l=m();return S(l.convertToCsv())}),h(1,"i",20),r(2," Export Fail"),i()}}function xe(t,a){if(t&1){let e=O();n(0,"a",21),y("click",function(){g(e);let l=m();return S(l.uploadOrders())}),h(1,"i",22),r(2," Send Transaction"),i()}}function ve(t,a){t&1&&(n(0,"th",23)(1,"i"),r(2,"Actions"),i()())}function ge(t,a){if(t&1&&(n(0,"span"),r(1),i()),t&2){let e=m().$implicit;o(),v(e==null||e.Variant==null?null:e.Variant.Name)}}function Se(t,a){if(t&1&&(n(0,"div",28),d(1,ge,2,1,"span",29),i()),t&2){let e=a.$implicit;o(),c("ngIf",e!=null)}}function he(t,a){if(t&1&&(n(0,"span"),r(1),i()),t&2){let e=m().$implicit;o(),f(" ",e==null?null:e.Quantity," ")}}function Oe(t,a){if(t&1&&(n(0,"div",30),d(1,he,2,1,"span",29),i()),t&2){let e=a.$implicit;o(),c("ngIf",e!=null)}}function ye(t,a){if(t&1&&(n(0,"span"),r(1),_(2,"number"),i()),t&2){let e=m().$implicit;o(),f(" ",C(2,1,e.Price)," ")}}function Ce(t,a){if(t&1&&(n(0,"div",30),d(1,ye,3,3,"span",29),i()),t&2){let e=a.$implicit;o(),c("ngIf",e!=null)}}function be(t,a){if(t&1&&(n(0,"span"),r(1),_(2,"number"),i()),t&2){let e=m().$implicit;o(),f(" ",C(2,1,e.Quantity*e.UnitQuantity*e.Price*(1-e.Discount/100)-e.DiscountAmount)," ")}}function Ee(t,a){if(t&1&&(n(0,"div",30),d(1,be,3,3,"span",29),i()),t&2){let e=a.$implicit;o(),c("ngIf",e!=null)}}function Ie(t,a){if(t&1){let e=O();n(0,"td",31)(1,"i",32),y("click",function(){g(e);let l=m().$implicit,p=m(2);return S(p.removeOrder(l))}),i()()}}function De(t,a){if(t&1&&(n(0,"tr")(1,"td"),r(2),i(),n(3,"td"),r(4),_(5,"date"),i(),n(6,"td"),d(7,Se,2,1,"div",25),i(),n(8,"td"),d(9,Oe,2,1,"div",26),i(),n(10,"td"),d(11,Ce,2,1,"div",26),i(),n(12,"td"),d(13,Ee,2,1,"div",26),i(),d(14,Ie,2,0,"td",27),i()),t&2){let e=a.$implicit,s=m(2);o(2),v(e.Order.Number),o(2),v(b(5,7,e.Order.Date,"dd MMM yyyy")),o(3),c("ngForOf",e.CartItems),o(2),c("ngForOf",e.CartItems),o(2),c("ngForOf",e.CartItems),o(2),c("ngForOf",e.CartItems),o(),c("ngIf",s.roleService.sell.Delete)}}function Te(t,a){if(t&1&&(I(0),d(1,De,15,10,"tr",24),D()),t&2){let e=m();o(),c("ngForOf",e.offlineOrders)}}function Pe(t,a){t&1&&(n(0,"td",33)(1,"h4",34),r(2,"There is no Offline Order"),i()())}function Fe(t,a){if(t&1&&(I(0),n(1,"span"),r(2),n(3,"strong"),r(4),i(),n(5,"strong"),r(6),_(7,"number"),i(),n(8,"strong"),r(9),_(10,"number"),i()(),D()),t&2){let e=m().$implicit;o(2),f("",e==null||e.Variant==null?null:e.Variant.Name," "),o(2),f(" ",e.Quantity+" x"," "),o(2),f(" ",C(7,4,e.Price)+" ="," "),o(3),f(" ",C(10,6,e.Quantity*e.UnitQuantity*e.Price*(1-e.Discount/100)-e.DiscountAmount)," ")}}function we(t,a){if(t&1&&(n(0,"div",40),d(1,Fe,11,8,"ng-container",29),i()),t&2){let e=a.$implicit;o(),c("ngIf",e!=null)}}function Me(t,a){if(t&1&&(n(0,"div",41),r(1),i()),t&2){let e=m().$implicit;o(),f(" ",e.Message," ")}}function $e(t,a){if(t&1){let e=O();I(0),n(1,"a",42),y("click",function(){g(e);let l=m().$implicit,p=m(2);return S(p.removeFailedOrder(l))}),h(2,"i",43),i(),D()}}function Ne(t,a){if(t&1){let e=O();n(0,"tr")(1,"td"),r(2),i(),n(3,"td"),r(4),_(5,"date"),i(),n(6,"td"),d(7,we,2,1,"div",35),i(),n(8,"td"),d(9,Me,2,1,"div",36),i(),n(10,"td",37)(11,"a",38),y("click",function(){let l=g(e).$implicit,p=m(2);return S(p.uploadFailedOrder(l))}),h(12,"i",39),i(),d(13,$e,3,0,"ng-container",29),i()()}if(t&2){let e=a.$implicit,s=m(2);o(2),v(e.Order.Number),o(2),v(b(5,5,e.Order.Date,"dd MMM yyyy")),o(3),c("ngForOf",e.CartItems),o(2),c("ngIf",e.Message),o(4),c("ngIf",s.roleService.sell.Delete)}}function Ve(t,a){if(t&1&&(I(0),d(1,Ne,14,8,"tr",24),D()),t&2){let e=m();o(),c("ngForOf",e.failedOrders)}}function ke(t,a){t&1&&(n(0,"td",44)(1,"h4",34),r(2,"There is no Failed Order"),i()())}var G=class t extends Q{constructor(e,s,l,p,E,F){super(e);this.httpService=s;this.localData=l;this.csvConverter=p;this.toastr=E;this.roleService=F;this.destroy$=new w,this.pageData={Header:"Offline Orders"}}pageData;offlineOrders=[];failedOrders=[];destroy$;ngOnInit(){this.menuData$.pipe(u(this.destroy$)).subscribe(()=>{this.getOfflineOrders(),this.getFailedOrders()})}removeOrder(e){this.localData.removeOrder(e.id).subscribe({next:()=>{this.toastr.success("Successfully removed order "+e.Order.Number,"Offline Order Deleted!"),this.getOfflineOrders()},error:s=>{this.toastr.warning("Failed to remove order "+e.Order.Number,"Failed to delete order!")}})}getOfflineOrders(){this.localData.findAllOrders().pipe(u(this.destroy$)).subscribe({next:e=>{this.offlineOrders=e},error:e=>{this.toastr.error(e.message,"Error!")}})}getFailedOrders(){this.localData.getFailedOrders().pipe(u(this.destroy$)).subscribe({next:e=>{this.failedOrders=e},error:e=>{this.toastr.error(e.message,"Error!")}})}uploadFailedOrder(e){this.localData.uploadFailedOrder(e).pipe(u(this.destroy$)).subscribe({next:()=>{this.toastr.success("Successfully uploaded order "+e.Order.Number,"Sync Successful!"),this.getFailedOrders()},error:()=>{this.toastr.error("Failed to sync failed order "+e.Order.Number,"Error!")}})}removeFailedOrder(e){this.localData.removeFailedOrder(e.id).pipe(u(this.destroy$)).subscribe({next:s=>{this.toastr.success("Success to remove failed offline order","Error!"),this.getFailedOrders()},error:s=>{this.toastr.error("Failed to remove failed offline order","Error!")}})}uploadOrders(){this.localData.uploadOrders().pipe(u(this.destroy$)).subscribe({next:e=>{e?this.getOfflineOrders():(this.getOfflineOrders(),this.getFailedOrders())},error:e=>{this.getOfflineOrders(),this.getFailedOrders()}})}convertToCsv(){this.csvConverter.convertToCSV(this.getExportData(),"Fail_Transaction.csv")}getExportData(){let e=[["Number","Date","Item","Qty","Price","Total"]];return this.failedOrders.forEach(s=>{s.Items.forEach(l=>{let p=s.Order.Number.toString(),E=s.Order.Date.toLocaleString(),F=l.Quantity.toString(),ae=l.Price.toString(),le=(l.Quantity*l.UnitQuantity*(l.Price*(1-l.Discount/100))-l.DiscountAmount).toString(),se=[p,E,l.Variant.Name,F,ae,le];e.push(se)})}),e}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(s){return new(s||t)(x(H),x(R),x(A),x(te),x(Z),x(ee))};static \u0275cmp=$({type:t,selectors:[["pos-orders"]],standalone:!1,features:[V],decls:54,vars:10,consts:[["noOrders",""],["noFailedOrders",""],[3,"pageData","hideSearchDropdown","hideSearchBox"],["matTooltipPosition","above","matTooltip","Export","class","btn btn-outline-secondary me-6",3,"click",4,"ngIf"],["value","Send Transaction","matTooltipPosition","above","matTooltip","Send Transaction","class","btn btn-outline-secondary",3,"click",4,"ngIf"],[1,"container-fluid"],[1,"row","mt-10","mb-12"],[1,"col-md"],[1,"table","mt-5"],[1,"thead-light","sticky-top-thead"],[1,"border-end",2,"width","130px"],[1,"border-end",2,"width","90px"],[1,"border-end"],[1,"border-end","text-end",2,"width","103px"],[1,"border-end","text-end",2,"width","200px"],["class","text-center","style","width: 90px",4,"ngIf"],[4,"ngIf","ngIfElse"],[1,"row","mt-12"],[1,"border-end",2,"width","102px"],["matTooltipPosition","above","matTooltip","Export",1,"btn","btn-outline-secondary","me-6",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],["value","Send Transaction","matTooltipPosition","above","matTooltip","Send Transaction",1,"btn","btn-outline-secondary",3,"click"],["aria-hidden","true",1,"fa","fa-paper-plane"],[1,"text-center",2,"width","90px"],[4,"ngFor","ngForOf"],["class","list-unstyled text-start",4,"ngFor","ngForOf"],["class","list-unstyled text-end",4,"ngFor","ngForOf"],["class","text-center text-danger",4,"ngIf"],[1,"list-unstyled","text-start"],[4,"ngIf"],[1,"list-unstyled","text-end"],[1,"text-center","text-danger"],[1,"fa-solid","fa-xmark","fa-2x","cursor-pointer",3,"click"],["colspan","7"],[1,"text-center","mt-2"],["class","list-inline text-start",4,"ngFor","ngForOf"],["class","text-danger",4,"ngIf"],[1,"d-flex","justify-content-center"],["matTooltipPosition","above","matTooltip","Sync",1,"ms-2","me-2","cursor-pointer",3,"click"],["aria-hidden","true",1,"fa-solid","fa-cloud-arrow-up","text-primary","fa-2x"],[1,"list-inline","text-start"],[1,"text-danger"],["matTooltipPosition","above","matTooltip","Remove",1,"ms-5","cursor-pointer",3,"click"],["aria-hidden","true",1,"fa-regular","fa-xmark-circle","text-primary","fa-2x"],["colSpan","5"]],template:function(s,l){if(s&1&&(n(0,"mainpanel-cmp",2)(1,"actions"),d(2,ue,3,0,"a",3)(3,xe,3,0,"a",4),i(),n(4,"content")(5,"div",5)(6,"div",6)(7,"div",7)(8,"h5"),r(9,"Offline Orders"),i(),n(10,"i"),r(11,"Waiting to be uploaded to the server!"),i(),n(12,"table",8)(13,"thead",9)(14,"tr")(15,"th",10),r(16,"Number"),i(),n(17,"th",11),r(18,"Date"),i(),n(19,"th",12),r(20,"item"),i(),n(21,"th",13),r(22," Qty "),i(),n(23,"th",14),r(24," Price "),i(),n(25,"th",14),r(26," Total "),i(),d(27,ve,3,0,"th",15),i()(),n(28,"tbody"),d(29,Te,2,1,"ng-container",16)(30,Pe,3,0,"ng-template",null,0,P),i()()()(),n(32,"div",17)(33,"div",7)(34,"h5"),r(35,"Synchronization Errors"),i(),n(36,"i"),r(37,"Exception occured when trying to upload these orders"),i(),n(38,"table",8)(39,"thead",9)(40,"tr")(41,"th",11),r(42,"Number"),i(),n(43,"th",11),r(44,"Date"),i(),n(45,"th",12),r(46,"item"),i(),n(47,"th",12),r(48,"Sync exception"),i(),h(49,"th",18),i()(),n(50,"tbody"),d(51,Ve,2,1,"ng-container",16)(52,ke,3,0,"ng-template",null,1,P),i()()()()()()()),s&2){let p=T(31),E=T(53);c("pageData",l.menuData)("hideSearchDropdown",!0)("hideSearchBox",!0),o(2),c("ngIf",(l.failedOrders==null?null:l.failedOrders.length)>0),o(),c("ngIf",l.offlineOrders.length>0),o(24),c("ngIf",l.roleService.sell.Delete),o(2),c("ngIf",l.offlineOrders.length>0)("ngIfElse",p),o(22),c("ngIf",l.failedOrders.length>0)("ngIfElse",E)}},dependencies:[k,L,U,B,j],styles:[".cursor-pointer[_ngcontent-%COMP%]{cursor:pointer}"]})};function Le(t,a){if(t&1&&(n(0,"div",5),h(1,"i",6),r(2),_(3,"date"),i()),t&2){let e=m();o(2),f(" ",b(3,1,e.LastSync,"dd MMM yyyy HH:mm:ss")," ")}}function je(t,a){if(t&1&&(n(0,"tr")(1,"td",15),r(2),i(),n(3,"td",16),r(4),i(),n(5,"td"),r(6),i(),n(7,"td",11),r(8),_(9,"number"),i()()),t&2){let e=a.$implicit,s=m(2);o(2),v(e.ID),o(2),v(e.Name),o(2),v(e.Code),o(2),K(" ",s.currency," ",b(9,5,e.UnitPrice,"1.0-4")," ")}}function Be(t,a){if(t&1&&(n(0,"table",7)(1,"thead",8)(2,"tr",9)(3,"th",10),r(4,"ID"),i(),n(5,"th",10),r(6,"Name"),i(),n(7,"th",10),r(8,"Code"),i(),n(9,"th",11),r(10,"Unit Price"),i()()(),n(11,"tbody"),d(12,je,10,8,"tr",12),_(13,"sortBy"),i(),n(14,"tfoot")(15,"tr",13)(16,"td",14)(17,"strong"),r(18),_(19,"number"),i()()()()()),t&2){let e=m();o(12),c("ngForOf",X(13,2,e.variantList,"asc","Name")),o(6),f("",C(19,6,e.variantList.length)," Product ")}}function Re(t,a){t&1&&(n(0,"h3",17),r(1,"Product has not been synced yet!"),i())}var z=class t extends Q{constructor(e,s,l){super(e);this.httpService=s;this._localDataService=l;this.destroy$=new w}variantList=[];OriginalList=[];LastSync;currency;destroy$;ngOnInit(){this.menuData$.subscribe(e=>{this.getVariants(),this.getSyncDate(),this.getCurrency()})}getVariants(){this._localDataService.findAllVariant().pipe(u(this.destroy$)).subscribe({next:e=>{this.OriginalList=e,this.variantList=this.OriginalList},error:e=>{console.error(e)}})}getSyncDate(){this._localDataService.getSyncTime().pipe(u(this.destroy$)).subscribe(e=>{this.LastSync=new Date(e.time)})}getCurrency(){this._localDataService.getPOSStorage().pipe(u(this.destroy$)).subscribe(e=>{e&&(this.currency=e.Currencies[0].Symbol)})}filterList(e){this.variantList=this.OriginalList.filter(s=>s.Name.includes(e))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(s){return new(s||t)(x(H),x(R),x(A))};static \u0275cmp=$({type:t,selectors:[["pos-products"]],standalone:!1,features:[V],decls:8,vars:5,consts:[["noProduct",""],[3,"textChange","pageData","hideSearchDropdown"],["class","h5",4,"ngIf"],[1,"container-fluid","mt-5"],["id","tableGrid","class","table",4,"ngIf","ngIfElse"],[1,"h5"],[1,"fa-solid","fa-sync-alt"],["id","tableGrid",1,"table"],[1,"thead-light","sticky-top-thead"],[1,"header"],[1,"text-start"],[1,"text-end"],[4,"ngFor","ngForOf"],[1,"table-footer"],["colspan","4",1,"text-start","empty-column"],[2,"max-width","100px"],[2,"max-width","300px"],[1,"text-center","mt-4"]],template:function(s,l){if(s&1){let p=O();n(0,"mainpanel-cmp",1),y("textChange",function(F){return g(p),S(l.filterList(F))}),n(1,"actions"),d(2,Le,4,4,"div",2),i(),n(3,"content")(4,"div",3),d(5,Be,20,8,"table",4)(6,Re,2,0,"ng-template",null,0,P),i()()()}if(s&2){let p=T(7);c("pageData",l.menuData)("hideSearchDropdown",!0),o(2),c("ngIf",l.LastSync),o(3),c("ngIf",l.variantList.length>0)("ngIfElse",p)}},dependencies:[k,L,U,B,j,ie],encapsulation:2})};var Qe=[{path:"Products",component:z},{path:"Orders",component:G},{path:"**",redirectTo:"Products",pathMatch:"full"}],W=class t{static \u0275fac=function(e){return new(e||t)};static \u0275mod=N({type:t});static \u0275inj=M({imports:[q.forChild(Qe),q]})};var oe=class t{static \u0275fac=function(e){return new(e||t)};static \u0275mod=N({type:t});static \u0275inj=M({imports:[Y,W,re,ne]})};export{oe as OfflineModule};
|
|
1
|
+
import{a as te}from"./chunk-KUUYZ5UQ.js";import{h as U,i as re}from"./chunk-WSJHXTI4.js";import"./chunk-OLSVR34W.js";import{a as Q,b as H}from"./chunk-YUGYXJ5G.js";import"./chunk-52EOLV7I.js";import"./chunk-5UL73W4S.js";import{D as A}from"./chunk-X6LIVARI.js";import"./chunk-CIBQBSM6.js";import{G as ie,O as ne}from"./chunk-5UCQBOD6.js";import"./chunk-D35OBUDE.js";import"./chunk-567HXZXC.js";import"./chunk-CGESXTHC.js";import"./chunk-2FWFPV5I.js";import"./chunk-TLOTIYIE.js";import"./chunk-P7HKWFZT.js";import"./chunk-N4OAT3FW.js";import"./chunk-IBTIOJOZ.js";import{d as ee}from"./chunk-AHCRE4GP.js";import"./chunk-KRC5LE5H.js";import{$a as o,Ac as C,Bc as b,Cc as X,Fc as P,Ib as n,Jb as i,Kb as h,Lb as I,Mb as D,Ob as O,Qb as y,Rb as m,Td as q,Vd as Z,Yc as k,Yd as R,Zc as L,d as w,da as u,db as x,dc as T,ec as r,ed as j,fc as v,gc as f,gd as B,hc as K,jd as Y,ka as M,kb as $,lb as N,ob as V,qb as d,va as g,vb as c,wa as S,zc as _}from"./chunk-DZT5XHBQ.js";import"./chunk-7DCB7DB2.js";function ue(t,a){if(t&1){let e=O();n(0,"a",19),y("click",function(){g(e);let l=m();return S(l.convertToCsv())}),h(1,"i",20),r(2," Export Fail"),i()}}function xe(t,a){if(t&1){let e=O();n(0,"a",21),y("click",function(){g(e);let l=m();return S(l.uploadOrders())}),h(1,"i",22),r(2," Send Transaction"),i()}}function ve(t,a){t&1&&(n(0,"th",23)(1,"i"),r(2,"Actions"),i()())}function ge(t,a){if(t&1&&(n(0,"span"),r(1),i()),t&2){let e=m().$implicit;o(),v(e==null||e.Variant==null?null:e.Variant.Name)}}function Se(t,a){if(t&1&&(n(0,"div",28),d(1,ge,2,1,"span",29),i()),t&2){let e=a.$implicit;o(),c("ngIf",e!=null)}}function he(t,a){if(t&1&&(n(0,"span"),r(1),i()),t&2){let e=m().$implicit;o(),f(" ",e==null?null:e.Quantity," ")}}function Oe(t,a){if(t&1&&(n(0,"div",30),d(1,he,2,1,"span",29),i()),t&2){let e=a.$implicit;o(),c("ngIf",e!=null)}}function ye(t,a){if(t&1&&(n(0,"span"),r(1),_(2,"number"),i()),t&2){let e=m().$implicit;o(),f(" ",C(2,1,e.Price)," ")}}function Ce(t,a){if(t&1&&(n(0,"div",30),d(1,ye,3,3,"span",29),i()),t&2){let e=a.$implicit;o(),c("ngIf",e!=null)}}function be(t,a){if(t&1&&(n(0,"span"),r(1),_(2,"number"),i()),t&2){let e=m().$implicit;o(),f(" ",C(2,1,e.Quantity*e.UnitQuantity*e.Price*(1-e.Discount/100)-e.DiscountAmount)," ")}}function Ee(t,a){if(t&1&&(n(0,"div",30),d(1,be,3,3,"span",29),i()),t&2){let e=a.$implicit;o(),c("ngIf",e!=null)}}function Ie(t,a){if(t&1){let e=O();n(0,"td",31)(1,"i",32),y("click",function(){g(e);let l=m().$implicit,p=m(2);return S(p.removeOrder(l))}),i()()}}function De(t,a){if(t&1&&(n(0,"tr")(1,"td"),r(2),i(),n(3,"td"),r(4),_(5,"date"),i(),n(6,"td"),d(7,Se,2,1,"div",25),i(),n(8,"td"),d(9,Oe,2,1,"div",26),i(),n(10,"td"),d(11,Ce,2,1,"div",26),i(),n(12,"td"),d(13,Ee,2,1,"div",26),i(),d(14,Ie,2,0,"td",27),i()),t&2){let e=a.$implicit,s=m(2);o(2),v(e.Order.Number),o(2),v(b(5,7,e.Order.Date,"dd MMM yyyy")),o(3),c("ngForOf",e.CartItems),o(2),c("ngForOf",e.CartItems),o(2),c("ngForOf",e.CartItems),o(2),c("ngForOf",e.CartItems),o(),c("ngIf",s.roleService.sell.Delete)}}function Te(t,a){if(t&1&&(I(0),d(1,De,15,10,"tr",24),D()),t&2){let e=m();o(),c("ngForOf",e.offlineOrders)}}function Pe(t,a){t&1&&(n(0,"td",33)(1,"h4",34),r(2,"There is no Offline Order"),i()())}function Fe(t,a){if(t&1&&(I(0),n(1,"span"),r(2),n(3,"strong"),r(4),i(),n(5,"strong"),r(6),_(7,"number"),i(),n(8,"strong"),r(9),_(10,"number"),i()(),D()),t&2){let e=m().$implicit;o(2),f("",e==null||e.Variant==null?null:e.Variant.Name," "),o(2),f(" ",e.Quantity+" x"," "),o(2),f(" ",C(7,4,e.Price)+" ="," "),o(3),f(" ",C(10,6,e.Quantity*e.UnitQuantity*e.Price*(1-e.Discount/100)-e.DiscountAmount)," ")}}function we(t,a){if(t&1&&(n(0,"div",40),d(1,Fe,11,8,"ng-container",29),i()),t&2){let e=a.$implicit;o(),c("ngIf",e!=null)}}function Me(t,a){if(t&1&&(n(0,"div",41),r(1),i()),t&2){let e=m().$implicit;o(),f(" ",e.Message," ")}}function $e(t,a){if(t&1){let e=O();I(0),n(1,"a",42),y("click",function(){g(e);let l=m().$implicit,p=m(2);return S(p.removeFailedOrder(l))}),h(2,"i",43),i(),D()}}function Ne(t,a){if(t&1){let e=O();n(0,"tr")(1,"td"),r(2),i(),n(3,"td"),r(4),_(5,"date"),i(),n(6,"td"),d(7,we,2,1,"div",35),i(),n(8,"td"),d(9,Me,2,1,"div",36),i(),n(10,"td",37)(11,"a",38),y("click",function(){let l=g(e).$implicit,p=m(2);return S(p.uploadFailedOrder(l))}),h(12,"i",39),i(),d(13,$e,3,0,"ng-container",29),i()()}if(t&2){let e=a.$implicit,s=m(2);o(2),v(e.Order.Number),o(2),v(b(5,5,e.Order.Date,"dd MMM yyyy")),o(3),c("ngForOf",e.CartItems),o(2),c("ngIf",e.Message),o(4),c("ngIf",s.roleService.sell.Delete)}}function Ve(t,a){if(t&1&&(I(0),d(1,Ne,14,8,"tr",24),D()),t&2){let e=m();o(),c("ngForOf",e.failedOrders)}}function ke(t,a){t&1&&(n(0,"td",44)(1,"h4",34),r(2,"There is no Failed Order"),i()())}var G=class t extends Q{constructor(e,s,l,p,E,F){super(e);this.httpService=s;this.localData=l;this.csvConverter=p;this.toastr=E;this.roleService=F;this.destroy$=new w,this.pageData={Header:"Offline Orders"}}pageData;offlineOrders=[];failedOrders=[];destroy$;ngOnInit(){this.menuData$.pipe(u(this.destroy$)).subscribe(()=>{this.getOfflineOrders(),this.getFailedOrders()})}removeOrder(e){this.localData.removeOrder(e.id).subscribe({next:()=>{this.toastr.success("Successfully removed order "+e.Order.Number,"Offline Order Deleted!"),this.getOfflineOrders()},error:s=>{this.toastr.warning("Failed to remove order "+e.Order.Number,"Failed to delete order!")}})}getOfflineOrders(){this.localData.findAllOrders().pipe(u(this.destroy$)).subscribe({next:e=>{this.offlineOrders=e},error:e=>{this.toastr.error(e.message,"Error!")}})}getFailedOrders(){this.localData.getFailedOrders().pipe(u(this.destroy$)).subscribe({next:e=>{this.failedOrders=e},error:e=>{this.toastr.error(e.message,"Error!")}})}uploadFailedOrder(e){this.localData.uploadFailedOrder(e).pipe(u(this.destroy$)).subscribe({next:()=>{this.toastr.success("Successfully uploaded order "+e.Order.Number,"Sync Successful!"),this.getFailedOrders()},error:()=>{this.toastr.error("Failed to sync failed order "+e.Order.Number,"Error!")}})}removeFailedOrder(e){this.localData.removeFailedOrder(e.id).pipe(u(this.destroy$)).subscribe({next:s=>{this.toastr.success("Success to remove failed offline order","Error!"),this.getFailedOrders()},error:s=>{this.toastr.error("Failed to remove failed offline order","Error!")}})}uploadOrders(){this.localData.uploadOrders().pipe(u(this.destroy$)).subscribe({next:e=>{e?this.getOfflineOrders():(this.getOfflineOrders(),this.getFailedOrders())},error:e=>{this.getOfflineOrders(),this.getFailedOrders()}})}convertToCsv(){this.csvConverter.convertToCSV(this.getExportData(),"Fail_Transaction.csv")}getExportData(){let e=[["Number","Date","Item","Qty","Price","Total"]];return this.failedOrders.forEach(s=>{s.Items.forEach(l=>{let p=s.Order.Number.toString(),E=s.Order.Date.toLocaleString(),F=l.Quantity.toString(),ae=l.Price.toString(),le=(l.Quantity*l.UnitQuantity*(l.Price*(1-l.Discount/100))-l.DiscountAmount).toString(),se=[p,E,l.Variant.Name,F,ae,le];e.push(se)})}),e}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(s){return new(s||t)(x(H),x(R),x(A),x(te),x(Z),x(ee))};static \u0275cmp=$({type:t,selectors:[["pos-orders"]],standalone:!1,features:[V],decls:54,vars:10,consts:[["noOrders",""],["noFailedOrders",""],[3,"pageData","hideSearchDropdown","hideSearchBox"],["matTooltipPosition","above","matTooltip","Export","class","btn btn-outline-secondary me-6",3,"click",4,"ngIf"],["value","Send Transaction","matTooltipPosition","above","matTooltip","Send Transaction","class","btn btn-outline-secondary",3,"click",4,"ngIf"],[1,"container-fluid"],[1,"row","mt-10","mb-12"],[1,"col-md"],[1,"table","mt-5"],[1,"thead-light","sticky-top-thead"],[1,"border-end",2,"width","130px"],[1,"border-end",2,"width","90px"],[1,"border-end"],[1,"border-end","text-end",2,"width","103px"],[1,"border-end","text-end",2,"width","200px"],["class","text-center","style","width: 90px",4,"ngIf"],[4,"ngIf","ngIfElse"],[1,"row","mt-12"],[1,"border-end",2,"width","102px"],["matTooltipPosition","above","matTooltip","Export",1,"btn","btn-outline-secondary","me-6",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],["value","Send Transaction","matTooltipPosition","above","matTooltip","Send Transaction",1,"btn","btn-outline-secondary",3,"click"],["aria-hidden","true",1,"fa","fa-paper-plane"],[1,"text-center",2,"width","90px"],[4,"ngFor","ngForOf"],["class","list-unstyled text-start",4,"ngFor","ngForOf"],["class","list-unstyled text-end",4,"ngFor","ngForOf"],["class","text-center text-danger",4,"ngIf"],[1,"list-unstyled","text-start"],[4,"ngIf"],[1,"list-unstyled","text-end"],[1,"text-center","text-danger"],[1,"fa-solid","fa-xmark","fa-2x","cursor-pointer",3,"click"],["colspan","7"],[1,"text-center","mt-2"],["class","list-inline text-start",4,"ngFor","ngForOf"],["class","text-danger",4,"ngIf"],[1,"d-flex","justify-content-center"],["matTooltipPosition","above","matTooltip","Sync",1,"ms-2","me-2","cursor-pointer",3,"click"],["aria-hidden","true",1,"fa-solid","fa-cloud-arrow-up","text-primary","fa-2x"],[1,"list-inline","text-start"],[1,"text-danger"],["matTooltipPosition","above","matTooltip","Remove",1,"ms-5","cursor-pointer",3,"click"],["aria-hidden","true",1,"fa-regular","fa-xmark-circle","text-primary","fa-2x"],["colSpan","5"]],template:function(s,l){if(s&1&&(n(0,"mainpanel-cmp",2)(1,"actions"),d(2,ue,3,0,"a",3)(3,xe,3,0,"a",4),i(),n(4,"content")(5,"div",5)(6,"div",6)(7,"div",7)(8,"h5"),r(9,"Offline Orders"),i(),n(10,"i"),r(11,"Waiting to be uploaded to the server!"),i(),n(12,"table",8)(13,"thead",9)(14,"tr")(15,"th",10),r(16,"Number"),i(),n(17,"th",11),r(18,"Date"),i(),n(19,"th",12),r(20,"item"),i(),n(21,"th",13),r(22," Qty "),i(),n(23,"th",14),r(24," Price "),i(),n(25,"th",14),r(26," Total "),i(),d(27,ve,3,0,"th",15),i()(),n(28,"tbody"),d(29,Te,2,1,"ng-container",16)(30,Pe,3,0,"ng-template",null,0,P),i()()()(),n(32,"div",17)(33,"div",7)(34,"h5"),r(35,"Synchronization Errors"),i(),n(36,"i"),r(37,"Exception occured when trying to upload these orders"),i(),n(38,"table",8)(39,"thead",9)(40,"tr")(41,"th",11),r(42,"Number"),i(),n(43,"th",11),r(44,"Date"),i(),n(45,"th",12),r(46,"item"),i(),n(47,"th",12),r(48,"Sync exception"),i(),h(49,"th",18),i()(),n(50,"tbody"),d(51,Ve,2,1,"ng-container",16)(52,ke,3,0,"ng-template",null,1,P),i()()()()()()()),s&2){let p=T(31),E=T(53);c("pageData",l.menuData)("hideSearchDropdown",!0)("hideSearchBox",!0),o(2),c("ngIf",(l.failedOrders==null?null:l.failedOrders.length)>0),o(),c("ngIf",l.offlineOrders.length>0),o(24),c("ngIf",l.roleService.sell.Delete),o(2),c("ngIf",l.offlineOrders.length>0)("ngIfElse",p),o(22),c("ngIf",l.failedOrders.length>0)("ngIfElse",E)}},dependencies:[k,L,U,B,j],styles:[".cursor-pointer[_ngcontent-%COMP%]{cursor:pointer}"]})};function Le(t,a){if(t&1&&(n(0,"div",5),h(1,"i",6),r(2),_(3,"date"),i()),t&2){let e=m();o(2),f(" ",b(3,1,e.LastSync,"dd MMM yyyy HH:mm:ss")," ")}}function je(t,a){if(t&1&&(n(0,"tr")(1,"td",15),r(2),i(),n(3,"td",16),r(4),i(),n(5,"td"),r(6),i(),n(7,"td",11),r(8),_(9,"number"),i()()),t&2){let e=a.$implicit,s=m(2);o(2),v(e.ID),o(2),v(e.Name),o(2),v(e.Code),o(2),K(" ",s.currency," ",b(9,5,e.UnitPrice,"1.0-4")," ")}}function Be(t,a){if(t&1&&(n(0,"table",7)(1,"thead",8)(2,"tr",9)(3,"th",10),r(4,"ID"),i(),n(5,"th",10),r(6,"Name"),i(),n(7,"th",10),r(8,"Code"),i(),n(9,"th",11),r(10,"Unit Price"),i()()(),n(11,"tbody"),d(12,je,10,8,"tr",12),_(13,"sortBy"),i(),n(14,"tfoot")(15,"tr",13)(16,"td",14)(17,"strong"),r(18),_(19,"number"),i()()()()()),t&2){let e=m();o(12),c("ngForOf",X(13,2,e.variantList,"asc","Name")),o(6),f("",C(19,6,e.variantList.length)," Product ")}}function Re(t,a){t&1&&(n(0,"h3",17),r(1,"Product has not been synced yet!"),i())}var z=class t extends Q{constructor(e,s,l){super(e);this.httpService=s;this._localDataService=l;this.destroy$=new w}variantList=[];OriginalList=[];LastSync;currency;destroy$;ngOnInit(){this.menuData$.subscribe(e=>{this.getVariants(),this.getSyncDate(),this.getCurrency()})}getVariants(){this._localDataService.findAllVariant().pipe(u(this.destroy$)).subscribe({next:e=>{this.OriginalList=e,this.variantList=this.OriginalList},error:e=>{console.error(e)}})}getSyncDate(){this._localDataService.getSyncTime().pipe(u(this.destroy$)).subscribe(e=>{this.LastSync=new Date(e.time)})}getCurrency(){this._localDataService.getPOSStorage().pipe(u(this.destroy$)).subscribe(e=>{e&&(this.currency=e.Currencies[0].Symbol)})}filterList(e){this.variantList=this.OriginalList.filter(s=>s.Name.includes(e))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(s){return new(s||t)(x(H),x(R),x(A))};static \u0275cmp=$({type:t,selectors:[["pos-products"]],standalone:!1,features:[V],decls:8,vars:5,consts:[["noProduct",""],[3,"textChange","pageData","hideSearchDropdown"],["class","h5",4,"ngIf"],[1,"container-fluid","mt-5"],["id","tableGrid","class","table",4,"ngIf","ngIfElse"],[1,"h5"],[1,"fa-solid","fa-sync-alt"],["id","tableGrid",1,"table"],[1,"thead-light","sticky-top-thead"],[1,"header"],[1,"text-start"],[1,"text-end"],[4,"ngFor","ngForOf"],[1,"table-footer"],["colspan","4",1,"text-start","empty-column"],[2,"max-width","100px"],[2,"max-width","300px"],[1,"text-center","mt-4"]],template:function(s,l){if(s&1){let p=O();n(0,"mainpanel-cmp",1),y("textChange",function(F){return g(p),S(l.filterList(F))}),n(1,"actions"),d(2,Le,4,4,"div",2),i(),n(3,"content")(4,"div",3),d(5,Be,20,8,"table",4)(6,Re,2,0,"ng-template",null,0,P),i()()()}if(s&2){let p=T(7);c("pageData",l.menuData)("hideSearchDropdown",!0),o(2),c("ngIf",l.LastSync),o(3),c("ngIf",l.variantList.length>0)("ngIfElse",p)}},dependencies:[k,L,U,B,j,ie],encapsulation:2})};var Qe=[{path:"Products",component:z},{path:"Orders",component:G},{path:"**",redirectTo:"Products",pathMatch:"full"}],W=class t{static \u0275fac=function(e){return new(e||t)};static \u0275mod=N({type:t});static \u0275inj=M({imports:[q.forChild(Qe),q]})};var oe=class t{static \u0275fac=function(e){return new(e||t)};static \u0275mod=N({type:t});static \u0275inj=M({imports:[Y,W,re,ne]})};export{oe as OfflineModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as kn}from"./chunk-NKWIQ32C.js";import{a as Tn}from"./chunk-4JAQKA6N.js";import"./chunk-IYORR7HN.js";import{a as In}from"./chunk-GSLPZSSX.js";import{a as mn}from"./chunk-TK5H65DN.js";import{a as hn,b as xn}from"./chunk-DILWG5FB.js";import{a as gn,b as fn,c as Cn,d as nt,e as bn}from"./chunk-CILKE53W.js";import"./chunk-THRGCK26.js";import"./chunk-2IT6TVBI.js";import{a as ct}from"./chunk-PUIYTAAZ.js";import{a as Mn,e as En,f as On}from"./chunk-SXVO2KX6.js";import{a as Dn}from"./chunk-S3FHQFMA.js";import"./chunk-6SK3XWNT.js";import{c as vn,d as it}from"./chunk-NRAL4DDE.js";import{a as yn}from"./chunk-P5PNY2PR.js";import"./chunk-SE7OFLAL.js";import"./chunk-TIN7QXDO.js";import"./chunk-5VAXIJEW.js";import"./chunk-Z32NRI5K.js";import"./chunk-JCT27TRG.js";import"./chunk-RSDCLKM5.js";import"./chunk-3RK6DDJD.js";import"./chunk-L2EDFSBR.js";import{a as wn}from"./chunk-SX7VXZQI.js";import{a as Sn}from"./chunk-5CTVOG3M.js";import{a as tt}from"./chunk-B5FODXLM.js";import"./chunk-I4MJUIXL.js";import{a as ln,b as sn}from"./chunk-MUCQWTKH.js";import{a as Pn}from"./chunk-CAMFGC4E.js";import"./chunk-A6YCCT6G.js";import"./chunk-UZKYLAUE.js";import{b as dn}from"./chunk-EW42TM43.js";import{a as ot,b as rt,c as at}from"./chunk-47MDCKEY.js";import{a as pn,b as un}from"./chunk-SEJO3YK3.js";import"./chunk-GSQJO7HP.js";import"./chunk-TEFNN3TY.js";import"./chunk-KG4DA565.js";import"./chunk-IUKQX4L5.js";import"./chunk-JKYTSC2D.js";import{a as _n}from"./chunk-TGAOY65D.js";import{c as cn}from"./chunk-HT35KHLT.js";import"./chunk-VQ7WKMGF.js";import"./chunk-MV3QRRW6.js";import{a as Kt,d as Yt,f as Xt,h as Zt}from"./chunk-6ZOGADBZ.js";import{a as ge,c as fe}from"./chunk-HA2GY7XU.js";import{i as an}from"./chunk-AZU6HW5D.js";import"./chunk-RU6ZFZ7D.js";import{a as en,b as tn}from"./chunk-ATIZNVIC.js";import"./chunk-52EOLV7I.js";import"./chunk-5UL73W4S.js";import{A as rn,q as Jt,u as ke,v as Ne,w as Ae,x as nn,z as on}from"./chunk-X6LIVARI.js";import{b as Ze,c as et}from"./chunk-CIBQBSM6.js";import{P as j}from"./chunk-5UCQBOD6.js";import{e as Te}from"./chunk-VMY3JQDA.js";import{a as F,b as U,e as Oe,f as we,g as oe}from"./chunk-D35OBUDE.js";import"./chunk-567HXZXC.js";import"./chunk-CGESXTHC.js";import{a as xe}from"./chunk-2FWFPV5I.js";import"./chunk-TLOTIYIE.js";import{D as ie,E as Ee,a as Xe,c as te,h as J,l as Pe,o as ne,r as Gt,s as Me}from"./chunk-P7HKWFZT.js";import"./chunk-75OXW5FF.js";import{a as zt}from"./chunk-K3CBCNVT.js";import{a as g,d as de}from"./chunk-AHCRE4GP.js";import"./chunk-STXBDXCJ.js";import{$a as l,$b as qt,Ac as _,Bc as Mt,D as kt,Db as He,E,Fa as A,Fc as le,I as Nt,Ib as r,Jb as a,Kb as D,Lb as y,M as At,Ma as V,Mb as h,Ob as N,Od as Ht,Pc as $,Q as Vt,Qb as d,Qd as ze,Rb as p,Rd as Je,S as Ft,Td as Ke,Ub as Pt,Va as Bt,Vd as Ye,W as Rt,Wa as qe,Wc as Z,Y as Se,Yc as ue,Yd as K,Za as $e,Zb as Lt,Zc as H,_b as Wt,aa as Y,cd as De,d as wt,db as X,dc as z,ec as s,fa as T,fb as Ut,fc as B,gc as S,gd as ee,hc as he,ja as k,jc as Q,jd as O,k as Tt,kb as M,kc as L,lc as W,na as u,o as Dt,ob as jt,pc as Ie,qb as v,qc as Ge,rc as q,sc as $t,t as pe,va as f,vb as m,wa as C,wb as Qt,zc as b}from"./chunk-DZT5XHBQ.js";import{a as R,b as It}from"./chunk-7DCB7DB2.js";var lt=class{AppConfigJSON;Currencies;CustomerPOTypes;Entities;Payments;Taxes;SalesPOTypes;EstimateOptions;Data};var Ve=class{CurrencyID;CustomerID;Date;Discount;DiscountAmount;EntityID;ID;Note;Number;SalesID;TaxTypeID;TypeID;constructor(){this.CustomerID=g.GuidEmpty,this.EntityID=g.GuidEmpty,this.ID=g.GuidEmpty,this.TaxTypeID=g.GuidEmpty,this.Discount=0,this.DiscountAmount=0,this.Date=new Date().toDateString()}};var re=class{Email;Key;Mobile;Name;Phone;Value;PricebookID};var st=class{ID;Index;Symbol;Name;ExchangeRate;ConversionSuggestion;ExchangeRateDate;ExchangeRateDateDisplay};var mt=class{ID;Name;DueDays;BlockDays;Description;PrintTemplateID;AccountID};var pt=class{DeliveryID;InvoiceID;InvoiceNumber;Message;OrderID;PaymentStateID;PaymentStateLabel;PrintMode;Success};var P=class o{estimateState=wn({loadForm:new lt,outlet:{Name:"",ID:g.GuidEmpty},order:new Ve,cartItems:[],customer:new re,tax:new mn,currency:new st,tag:new mt,discount:{discountAmount:0,discount:0},state:0,complete:new pt});loadForm=this.estimateState.select(e=>Object.freeze(e.loadForm()));order=this.estimateState.select(e=>Object.freeze(e.order()));outlet=this.estimateState.select(e=>Object.freeze(e.outlet()));cartItems=this.estimateState.select(e=>Object.freeze(e.cartItems()));customer=this.estimateState.select(e=>Object.freeze(e.customer()));tax=this.estimateState.select(e=>Object.freeze(e.tax()));currency=this.estimateState.select(e=>Object.freeze(e.currency()));tag=this.estimateState.select(e=>Object.freeze(e.tag()));discount=this.estimateState.select(e=>Object.freeze(e.discount()));state=this.estimateState.select(e=>Object.freeze(e.state()));complete=this.estimateState.select(e=>Object.freeze(e.complete()));updateLoadForm(e){this.estimateState.update("loadForm",e)}updateOutlet(e){this.estimateState.update("outlet",e)}updateOrder(e){this.estimateState.update("order",e)}updateCartItems(e){this.estimateState.update("cartItems",e)}updateCustomer(e){this.estimateState.update("customer",e)}updateTax(e){this.estimateState.update("tax",e)}updateCurrency(e){this.estimateState.update("currency",e)}updateTag(e){this.estimateState.update("tag",e)}updateDiscount(e){this.estimateState.update("discount",e)}updateState(e){this.estimateState.update("state",e)}updateComplete(e){this.estimateState.update("complete",e)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Ce=class{ID;Name;Code;Cost;ThumbnailUrl;CouponDiscount;Discount;DiscountAmount;EntityID;Expense;InventoryTypeID;LoyaltyPoint;Note;PromotionGift;Quantity;UnitQuantity;SalesID;VariantID;VariantUnitQuantity;isMaxInventory;UOM;UOMName;UnitCost;UnitPrice;TypeID;Storage;Taxable;Price;Serial;PriceBookID;Variant;PriceTypeID;PriceNote;get Total(){return this.Price*(this.Quantity*this.UnitQuantity)*((100-this.Discount)/100)}get getItemAfterDiscount(){let e=this.getDiscPercentagePerItem();return this.DiscountAmount<e?e-this.DiscountAmount:0}getDiscPercentagePerItem(){let e=this.UnitPrice;return this.Discount>0&&(e=(100-this.Discount)/100*this.UnitPrice),e}};var be=class o{constructor(){}generateCartItem(e){let t=new Ce;return t.Name=e.Name,t.ThumbnailUrl=e.ThumbnailUrl,t.Price=e.UnitPrice,t.UnitPrice=e.UnitPrice,t.UnitCost=e.UnitCost,t.UnitQuantity=e.UnitQuantity,t.Quantity=1,t.Code=e.Code,t.TypeID=e.TypeID,t.Discount=e.PriceDiscount,t.VariantUnitQuantity=e.VariantUnitQuantity,t.Storage=e.Storage,t.UOM=e.UOM,t.UOMName=e.UOMName,t.VariantID=e.ID,t.Taxable=e.Taxable,t.InventoryTypeID=e.TypeID,t.PriceTypeID=e.PriceTypeID,t.PriceNote=e.PriceNote,t.Variant=e,t}generateCartItemOnEdit(e){let t=new Ce;return t.ID=e.ID,t.Name=e.Variant?.Name,t.ThumbnailUrl=e.Variant?.ThumbnailUrl,t.Price=e.Price,t.UnitPrice=e.Price,t.UnitCost=e.Cost,t.UnitQuantity=e.Variant?.UnitQuantity,t.Quantity=e.Quantity,t.Code=e.Variant?.Code,t.TypeID=e.Variant?.TypeID,t.Discount=e.Discount,t.VariantUnitQuantity=e.Variant?.VariantUnitQuantity,t.Storage=e.Variant?.Storage,t.UOM=e.Variant?.UOM,t.UOMName=e.Variant?.UOMName,t.VariantID=e.VariantID,t.Taxable=e.Taxable,t.Note=e.Note,t.Serial=e.Serial,t.InventoryTypeID=e.InventoryTypeID,t.PriceTypeID=e.PriceTypeID,t.Variant=e.Variant,t.PriceNote=e.PriceNote,t}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Be=class o{httpService=u(K);storeService=u(P);factoryService=u(be);activatedRoute=u(Ht);getLoadForm$=this.activatedRoute.queryParams.pipe(Y(e=>this.httpService.post("/API/estimate/LoadForm",e)),T(e=>this.storeService.updateLoadForm(e)),T(e=>{g.IsNotEmpty(e.Data)?this.onEditOrder(e):(this.initDefaultCurrency(),this.initTag(),this.initTax())}),F());constructor(){this.getLoadForm$.subscribe()}onEditOrder(e){let t=e.Data,n=this.findTaxById(t.Order.TaxTypeID),i=this.findCurrencyById(t.Order.CurrencyID),c=this.findOutletById(t.Order.EntityID),x=this.findTagById(t.Order.TypeID),I=this.getCartItemsOnEdit(e);this.storeService.updateState(1),this.storeService.updateOrder(t.Order),this.storeService.updateCartItems(I),this.storeService.updateCustomer({Key:t.Order.CustomerID,Value:t.ContactName}),this.storeService.updateTax(n),this.storeService.updateCurrency(i),this.storeService.updateOutlet(c),this.storeService.updateDiscount({discount:t.Order.Discount,discountAmount:t.Order.DiscountAmount}),this.storeService.updateTag(x)}getCartItemsOnEdit(e){return e.Data.Items.map(i=>this.factoryService.generateCartItemOnEdit(i))}initDefaultCurrency(){let e=this.storeService.loadForm()?.AppConfigJSON?.CoreDefaults?.CurrencyID,t=this.storeService.loadForm()?.Currencies.find(n=>n.ID===e);this.storeService.updateCurrency(t)}initTag(){let e=this.storeService.loadForm()?.CustomerPOTypes;this.storeService.updateTag(e[0])}initTax(){let e=this.storeService.loadForm()?.Taxes;this.storeService.updateTax(e[0])}findTaxById(e){return(this.storeService.loadForm()?.Taxes).find(i=>i.ID===e)}findCurrencyById(e){return(this.storeService.loadForm()?.Currencies).find(i=>i.ID===e)}findOutletById(e){return(this.storeService.loadForm()?.Entities).find(i=>i.ID===e)}findTagById(e){return(this.storeService.loadForm()?.CustomerPOTypes).find(i=>i.ID===e)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Ue=class o{storeService=u(P);isOpenDialog$=U(this.storeService.loadForm).pipe(E(e=>g.IsNotEmpty(e.Entities)),pe(()=>{let e=!1,t=this.storeService.state(),n=this.storeService.outlet();return(t==0||t==1)&&(e=g.IsEmpty(n.ID)),e}));updateOutlet(e){this.storeService.updateOutlet(e)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac,providedIn:"root"})};var se=class o{storeService=u(P);httpService=u(K);router=u(ze);orderNumber$=U(this.storeService.outlet).pipe(E(e=>g.IsNotEmpty(e.ID)),Y(e=>{if(this.storeService.state()==0)return this.httpService.post(j.EstimateGenerateNumber,{ID:e.ID}).pipe(pe(t=>t.Number));{let t=this.storeService.order().Number;return Dt(t)}}),T(e=>{this.storeService.state()==0&&this.updateOrderNumber(e)}),F());salesPersons$=U(this.storeService.outlet).pipe(Y(e=>g.IsNotEmpty(e.ID)?this.httpService.get(j.GetSalesPersonByOutletId,[{key:"ID",value:e.ID}]):Dt([])),Se(1));updateTagOrder$=U(this.storeService.tag).pipe(T(e=>{let t=R({},this.storeService.order());t.TypeID=e.ID,this.storeService.updateOrder(t)}),F());updateCurrencyOrder$=U(this.storeService.currency).pipe(T(e=>{let t=R({},this.storeService.order());t.CurrencyID=e.ID,this.storeService.updateOrder(t)}),F());updateTaxOrder$=U(this.storeService.tax).pipe(T(e=>{let t=R({},this.storeService.order());t.TaxTypeID=e.ID,this.storeService.updateOrder(t)}),F());updateDiscountOrder$=U(this.storeService.discount).pipe(T(e=>{let t=R({},this.storeService.order());t.Discount=e.discount,t.DiscountAmount=e.discountAmount,this.storeService.updateOrder(t)}),F());updateCustomerOrder$=U(this.storeService.customer).pipe(T(e=>{let t=R({},this.storeService.order());t.CustomerID=e.Key,this.storeService.updateOrder(t)}),F());updateEntityId$=U(this.storeService.outlet).pipe(E(e=>g.IsNotEmpty(e.ID)),T(e=>{let t=R({},this.storeService.order());t.EntityID=e.ID,this.storeService.updateOrder(t)}),F());constructor(){this.updateTagOrder$.subscribe(),this.updateCurrencyOrder$.subscribe(),this.updateTaxOrder$.subscribe(),this.updateDiscountOrder$.subscribe(),this.updateCustomerOrder$.subscribe(),this.updateEntityId$.subscribe()}newOrder(){let e=this.storeService.loadForm(),t=this.getDefaultCurrency(),n=this.storeService.outlet();this.storeService.updateOrder(new Ve),this.storeService.updateCartItems([]),this.storeService.updateCustomer(new re),this.storeService.updateTax(R({},e.Taxes[0])),this.storeService.updateCurrency(R({},t)),this.storeService.updateTag(R({},e.CustomerPOTypes[0])),this.storeService.updateDiscount({discountAmount:0,discount:0}),this.storeService.updateOutlet(R({},n)),this.router.navigate([],{queryParams:{}}),this.storeService.updateState(0)}getDefaultCurrency(){let e=this.storeService.loadForm()?.AppConfigJSON?.CoreDefaults?.CurrencyID;return this.storeService.loadForm()?.Currencies.find(n=>n.ID===e)}updateOrderNumber(e){g.IsNotEmpty(e)&&this.storeService.order().Number!==e&&this.storeService.updateOrder(It(R({},this.storeService.order()),{Number:e}))}updateOrderDate(e){g.IsNotEmpty(e)&&this.storeService.order().Date!==e&&this.storeService.updateOrder(It(R({},this.storeService.order()),{Date:e}))}updateSalesPersonId(e){let t=R({},this.storeService.order());t.SalesID=e,this.storeService.updateOrder(t)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var je=class o{storeService=u(P);httpService=u(K);quickkeys$=U(this.storeService.outlet).pipe(E(e=>g.IsNotEmpty(e.ID)),Vt((e,t)=>e.ID===t.ID),Y(e=>this.httpService.get(j.GetQuickKeyByEntityID,[{key:"ID",value:e.ID}])),Se(1));static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Nn=o=>({"qtyBtn-disabled":o}),ut=class o{disabled=!1;decimalPlaces=4;max=1e15;min=-1e15;quantity;constructor(){}ngOnInit(){}incrementQty(){this.quantity<this.max&&(this.quantity++,this.onChange(this.quantity))}decrementQty(){this.quantity>this.min&&(this.quantity--,this.onChange(this.quantity))}quantityChange(){this.onChange(this.quantity)}onChange=e=>{};onTouched=()=>{};writeValue(e){g.IsEmpty(e)?this.quantity=0:this.quantity=e}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["POS-input-quantity"]],inputs:{disabled:"disabled",decimalPlaces:"decimalPlaces",max:"max",min:"min"},features:[Ie([{provide:Xe,multi:!0,useExisting:o}])],decls:6,vars:11,consts:[[1,"input-group"],["type","button","id","button-addon1",1,"btn","btn-outline-secondary","fw-bold","rounded-0","fs-2","border-end-0","py-4","qty-input","d-flex","align-items-center","qty_btn","justify-content-center",3,"click","ngClass","disabled"],["id","txtCartQuantity","type","text","autoNum","",1,"form-control","input-numpad","qty-input","text-center",3,"ngModelChange","ngModel","disabled","decimalPlaces"],["type","button","id","button-addon2",1,"btn","btn-outline-secondary","fw-bold","rounded-0","fs-5","border-start-0","py-4","qty-input","d-flex","align-items-center","qty_btn","justify-content-center",3,"click","ngClass","disabled"]],template:function(t,n){t&1&&(r(0,"div",0)(1,"button",1),d("click",function(){return n.decrementQty()}),s(2,"-"),a(),r(3,"input",2),W("ngModelChange",function(c){return L(n.quantity,c)||(n.quantity=c),c}),d("ngModelChange",function(){return n.quantityChange()}),a(),r(4,"button",3),d("click",function(){return n.incrementQty()}),s(5,"+"),a()()),t&2&&(l(),m("ngClass",q(7,Nn,n.disabled))("disabled",n.disabled),l(2),Q("ngModel",n.quantity),m("disabled",n.disabled)("decimalPlaces",n.decimalPlaces),l(),m("ngClass",q(9,Nn,n.disabled))("disabled",n.disabled))},dependencies:[O,Z,ie,te,J,ne,ge,fe],styles:[".qtyBtn-disabled[_ngcontent-%COMP%]{background-color:#e9ecef;color:#000!important}button.qty_btn[_ngcontent-%COMP%]{background:#eee;border:1px solid #ddd;width:36px}.qty-input[_ngcontent-%COMP%]{height:36px!important}"]})};var ve=class o{storeService=u(P);autoApplyPricebook(e){let t=e?.Variant?.PriceBook?e?.Variant?.PriceBook:[],n=this.storeService.customer(),i=this.findCustomerPricebook(t,n),c=this.sortAppliedPricebooks(t,e.Quantity);return c.length>0||g.IsNotEmpty(i)?g.IsNotEmpty(i)?e=this.applyPricebook(e,i):e=this.applyPricebook(e,c[0]):e.PriceTypeID===2&&(e=this.removePricebook(e)),e}findCustomerPricebook(e=[],t){let n;return g.IsNotEmpty(t)&&g.IsNotEmpty(t?.Key)&&(n=e.find(i=>i.ID==t.PricebookID)),n}applyCustomerPricebook(){let e=[],t=this.storeService.customer(),n=this.storeService.cartItems();return g.IsNotEmpty(t.PricebookID)&&n.forEach(i=>{let c=this.findCustomerPricebook(i.Variant.PriceBook,t);c&&(i=this.applyPricebook(i,c),e.push(i))}),e}removeCustomerPricebook(e){let t=[];return this.storeService.cartItems().forEach(i=>{this.findCustomerPricebook(i.Variant.PriceBook,e)&&(i=this.removePricebook(i),t.push(i))}),t}sortAppliedPricebooks(e=[],t){return e.sort((n,i)=>i.MinimumQuantity-n.MinimumQuantity).filter(n=>t>=n.MinimumQuantity&&n.MinimumQuantity!=0)}applyPricebook(e,t){let n=this.storeService.loadForm()?.AppConfigJSON?.ModuleSell?.Pricebook?.PricebookVisible;return e.Discount=t.PriceDiscount,e.UnitPrice=t.UnitPrice,e.PriceBookID=t.ID,e.Price=t.UnitPrice,e.PriceTypeID=2,e.PriceNote=t.Name,n?e.Note=t.Name:e.Note="",e}removePricebook(e){return e.Discount=e.Variant.PriceDiscount,e.UnitPrice=e.Variant.UnitPrice,e.PriceBookID=null,e.Price=e.Variant.UnitPrice,e.PriceTypeID=0,e.Note="",e.PriceNote="",e}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Ot=o=>({selected:o}),Un=()=>["/menu/Products/Catalog/Variants/Info"],jn=o=>({ID:o});function Qn(o,e){if(o&1){let t=N();y(0),r(1,"a",10),d("click",function(){f(t);let i=p();return C(i.tabState="PRODUCT")}),s(2," Product "),a(),h()}if(o&2){let t=p();l(),m("ngClass",q(1,Ot,t.tabState=="PRODUCT"))}}function Ln(o,e){if(o&1){let t=N();y(0),r(1,"a",11),d("click",function(){f(t);let i=p();return C(i.tabState="SERIAL")}),s(2," Serial "),a(),h()}if(o&2){let t=p();l(),m("ngClass",q(1,Ot,t.tabState=="SERIAL"))}}function Wn(o,e){if(o&1&&(y(0),r(1,"div",12)(2,"div",21),D(3,"POS-variant-autocomplete",22),a()(),h()),o&2){let t=p(2);l(3),m("formControl",t.variantSearchCtrl)}}function qn(o,e){if(o&1&&(r(0,"span"),s(1),a()),o&2){let t=p(2);l(),S("(",t.cartItem().UOMName,")")}}function $n(o,e){if(o&1){let t=N();r(0,"div",15)(1,"h6"),s(2,"Pricebook"),a(),r(3,"ng-select",23),W("ngModelChange",function(i){f(t);let c=p(2);return L(c.cartItem().PriceBookID,i)||(c.cartItem().PriceBookID=i),C(i)}),d("ngModelChange",function(i){f(t);let c=p(2);return C(c.onSelectPricebook(i))}),a()()}if(o&2){let t,n=p(2);l(3),m("items",(t=n.cartItem())==null||t.Variant==null?null:t.Variant.PriceBook),Q("ngModel",n.cartItem().PriceBookID)}}function Hn(o,e){if(o&1){let t=N();y(0),v(1,Wn,4,1,"ng-container",8),r(2,"div",12)(3,"div",13)(4,"h6"),s(5," Qty "),v(6,qn,2,1,"span",8),a(),r(7,"POS-input-quantity",14,0),W("ngModelChange",function(i){f(t);let c=p();return L(c.cartItem().Quantity,i)||(c.cartItem().Quantity=i),C(i)}),d("ngModelChange",function(){f(t);let i=p();return C(i.onQtyChange())}),a()(),r(9,"div",15)(10,"h6"),s(11,"Discount (%)"),a(),r(12,"input",16),W("ngModelChange",function(i){f(t);let c=p();return L(c.cartItem().Discount,i)||(c.cartItem().Discount=i),C(i)}),a()(),r(13,"div",15)(14,"h6"),s(15,"Price"),a(),r(16,"input",17,1),W("ngModelChange",function(i){f(t);let c=p();return L(c.cartItem().Price,i)||(c.cartItem().Price=i),C(i)}),a()(),v(18,$n,4,2,"div",15),a(),r(19,"div",18)(20,"div",19)(21,"POS-tinymce-editor",20),W("ngModelChange",function(i){f(t);let c=p();return L(c.cartItem().Note,i)||(c.cartItem().Note=i),C(i)}),a()()(),h()}if(o&2){let t,n=p();l(),m("ngIf",n.isEditState()==!1),l(5),m("ngIf",n.cartItem().UOMName),l(),Q("ngModel",n.cartItem().Quantity),m("decimalPlaces",n.isSerialItem()?0:4),l(5),Q("ngModel",n.cartItem().Discount),l(4),Q("ngModel",n.cartItem().Price),m("disabled",!(!(n.roleService==null||n.roleService.sell==null)&&n.roleService.sell.UnitPriceEditor)),l(2),He(((t=n.cartItem().Variant)==null||t.PriceBook==null?null:t.PriceBook.length)>0?18:-1),l(3),Q("ngModel",n.cartItem().Note)}}function Gn(o,e){o&1&&(y(0),D(1,"i",42),r(2,"h6"),s(3,"No Image"),a(),h())}function zn(o,e){if(o&1&&D(0,"img",43),o&2){let t=p(2);m("src",t.cartItem().ThumbnailUrl,qe)}}function Jn(o,e){if(o&1&&(y(0),r(1,"tr")(2,"td",44),s(3),b(4,"number"),a(),r(5,"td",44),s(6),b(7,"number"),a(),r(8,"td",44),s(9),b(10,"number"),a()(),h()),o&2){let t=e.ngIf;l(3),S(" ",_(4,3,t==null?null:t.OnHand)," "),l(3),S(" ",_(7,5,t==null?null:t.Allocated)," "),l(3),S(" ",_(10,7,(t==null?null:t.OnHand)-(t==null?null:t.Allocated))," ")}}function Kn(o,e){if(o&1){let t=N();r(0,"tr")(1,"th",39),s(2,"Cost"),a(),r(3,"td",45)(4,"input",46),W("ngModelChange",function(i){f(t);let c=p(2);return L(c.cartItem().UnitCost,i)||(c.cartItem().UnitCost=i),C(i)}),a()()()}if(o&2){let t,n=p(2);l(4),Q("ngModel",n.cartItem().UnitCost),m("readonly",!(!((t=n.appConfig())==null||t.ModuleSell==null)&&t.ModuleSell.Cost.Enabled))}}function Yn(o,e){if(o&1&&(r(0,"tr")(1,"th",39),s(2,"Content"),a(),r(3,"td",40)(4,"div",47),s(5),b(6,"number"),a()()()),o&2){let t,n=p(2);l(5),he(" ",(t=n.cartItem())==null?null:t.VariantUnitQuantity," (@",_(6,2,n.cartItem().Price/((t=n.cartItem())==null?null:t.VariantUnitQuantity)),")")}}function Xn(o,e){if(o&1&&(r(0,"div",37)(1,"table",48)(2,"thead")(3,"tr")(4,"th",49),s(5,"Storage Location"),a()()(),r(6,"tbody")(7,"tr")(8,"td"),s(9),a()()()()()),o&2){let t=p(2);l(9),S(" ",t.cartItem().Storage," ")}}function Zn(o,e){if(o&1&&(y(0),r(1,"div",24)(2,"div",25)(3,"a",26),v(4,Gn,4,0,"ng-container",27)(5,zn,1,1,"ng-template",null,2,le),a()(),r(7,"div",28)(8,"div",29)(9,"div",19)(10,"div",30),D(11,"i",31),r(12,"div",32),s(13,"Inventory"),a()(),r(14,"table",33)(15,"thead")(16,"tr")(17,"th",34),s(18,"On Hand"),a(),r(19,"th",34),s(20,"Allocated"),a(),r(21,"th",35),s(22,"Available"),a()()(),r(23,"tbody"),v(24,Jn,11,9,"ng-container",8),b(25,"async"),a()()()(),r(26,"div",36)(27,"div",37)(28,"table",38)(29,"thead"),v(30,Kn,5,2,"tr",8),r(31,"tr")(32,"th",39),s(33,"Price"),a(),r(34,"td",40),s(35),b(36,"number"),a()(),v(37,Yn,7,4,"tr",8),a()()(),v(38,Xn,10,1,"div",41),a()()(),h()),o&2){let t,n,i,c,x,I,ae=z(6),ce=p();l(3),m("routerLink",Ge(13,Un))("queryParams",q(14,jn,(t=ce.cartItem())==null?null:t.ID)),l(),m("ngIf",((n=ce.cartItem())==null?null:n.ThumbnailUrl)==null)("ngIfElse",ae),l(20),m("ngIf",_(25,9,ce.variantInventory$)),l(6),m("ngIf",((i=ce.appConfig())==null||i.ModuleSell==null?null:i.ModuleSell.Cost.Visible)&&ce.roleService.product.Cost),l(5),S(" ",_(36,11,(c=ce.cartItem())==null?null:c.Price)," "),l(2),m("ngIf",((x=ce.cartItem())==null?null:x.VariantUnitQuantity)>1),l(),m("ngIf",((I=ce.appConfig())==null||I.ModuleSell==null||I.ModuleSell.Grid==null?null:I.ModuleSell.Grid.StorageVisible)&&((I=ce.cartItem())==null?null:I.Storage))}}function ei(o,e){if(o&1){let t=N();y(0),r(1,"app-item-serial",50),d("cartItemChange",function(i){f(t);let c=p();return C(c.onSerialChanges(i))}),a(),h()}if(o&2){let t=p();l(),m("entityId",t.storeService.outlet().ID)("cartItem",t.cartItem())}}var Le=class o{constructor(e,t){this.data=e;this.dialogRef=t;this.cartItem=V(e),this.initVariantInventory(),this.initIsSerialItem(),this.initModalConfig(),this.initDialogState()}storeService=u(P);cartItemService=u(me);roleService=u(de);toastr=u(Ye);pricebookService=u(ve);modalConfig=new ke;tabState="CART";cartItem;appConfig=V(this.storeService.loadForm()?.AppConfigJSON);isSerialItem=V(!1);variantInventory$;isEditState=V(!1);showProductTab=V(!1);variantSearchCtrl=new Pe;getItemFromSearch$=this.variantSearchCtrl.valueChanges.pipe(E(e=>g.IsNotEmpty(e)),Y(e=>{if(e.type==="ID")return this.cartItemService.getItemByVariantId(e.str);if(e.type==="Code")return this.cartItemService.getItemByVariantByCode(e.str)}),T(e=>{this.cartItem.set(e),this.initModalTitle(),this.initProductTab(),this.initIsSerialItem(),this.initVariantInventory()}),F());ngOnInit(){this.isEditState()||this.getItemFromSearch$.subscribe()}initDialogState(){this.isEditState.set(g.IsNotEmpty(this.cartItem().VariantID)),this.initProductTab()}initVariantInventory(){this.variantInventory$=this.cartItemService.getVariantInventory(this.cartItem().VariantID).pipe(Se(1))}initProductTab(){this.showProductTab.set(g.IsNotEmpty(this.cartItem().VariantID))}initIsSerialItem(){this.isSerialItem.set(this.cartItem().TypeID==4)}initModalConfig(){this.initModalTitle(),this.modalConfig.customWidth="680px",this.modalConfig.noPadding=!0,this.modalConfig.bodyScrollable=!0}initModalTitle(){this.modalConfig.title=this.cartItem()?.Name??"Add Variant"}onSerialChanges(e){this.cartItem.set(e)}onQtyChange(){let e=this.pricebookService.autoApplyPricebook(this.cartItem());this.cartItem.set(e)}onSelectPricebook(e){let t;if(g.IsNotEmpty(e)){let i=this.cartItem().Variant.PriceBook.find(c=>c.ID===e);t=this.pricebookService.applyPricebook(this.cartItem(),i)}else t=this.pricebookService.removePricebook(this.cartItem());this.cartItem.set(t)}onCancel(){this.dialogRef.close()}onSave(){g.IsNotEmpty(this.cartItem().VariantID)&&g.IsNotEmpty(this.cartItem().Name)?this.dialogRef.close(this.cartItem()):this.toastr.warning("Please select a product","Warning")}static \u0275fac=function(t){return new(t||o)(X(we),X(Oe))};static \u0275cmp=M({type:o,selectors:[["app-dialog-item"]],decls:13,vars:9,consts:[["quantity",""],["price",""],["SHOW_IMAGE",""],[3,"onOk","onCancel","onClose","config"],[1,"mb-5"],[1,"container","w-100","h-100","mt-8"],[1,"row","border-bottom","mx-5"],["data-cy","input_sell",1,"btn","btn-link",3,"click","ngClass"],[4,"ngIf"],[1,"mx-8"],["data-cy","product",1,"btn","btn-link",3,"click","ngClass"],["data-cy","serial",1,"btn","btn-link",3,"click","ngClass"],[1,"row","mt-8"],[1,"col-auto","pe-0",2,"width","145px"],[3,"ngModelChange","ngModel","decimalPlaces"],[1,"col-auto","pe-0"],["type","text","percentage","","autoNum","",1,"form-control","input-cart",2,"width","100px",3,"ngModelChange","ngModel"],["id","inputPrice","type","text","autoNum","",1,"form-control","input-cart",2,"width","112px",3,"ngModelChange","ngModel","disabled"],[1,"row","my-6"],[1,"col-12"],["height","220px",3,"ngModelChange","ngModel"],[1,"col-12","px-0"],[3,"formControl"],["bindLabel","Name","bindValue","ID","placeholder","Pricebook","appendTo","body",2,"width","170px",3,"ngModelChange","items","ngModel"],[1,"row","my-8"],[1,"col-sm-4","d-flex","justify-content-center","flex-column","align-items-center","text-body-secondary"],["target","_blank",2,"color","inherit",3,"routerLink","queryParams"],[4,"ngIf","ngIfElse"],[1,"col-sm-8","inventory"],[1,"row","mb-8"],[1,"d-flex"],["aria-hidden","true",1,"fa-archive","fa-solid","fa-1x","pt-3","pe-2"],[2,"font-size","15px","font-family","'Roboto Slab'"],[1,"table","table-bordered","text-center","inventory-table"],[1,"table-light","py-6","border-end",2,"text-transform","none"],[1,"table-light","py-6",2,"text-transform","none"],[1,"row"],[1,"col-6"],[1,"table","table-bordered",2,"width","171px"],[1,"table-light",2,"text-transform","none"],[1,"pe-6","text-end"],["class","col-6",4,"ngIf"],["aria-hidden","true",1,"fa-solid","fa-image","fa-5x"],[1,"border","rounded",3,"src"],[1,"py-6"],[1,"p-0"],["type","text","autoNum","",1,"form-control","border-0","bg-white","text-end",3,"ngModelChange","ngModel","readonly"],["ngClass","ms-3"],[1,"table","table-bordered","text-center"],[1,"table-light"],[3,"cartItemChange","entityId","cartItem"]],template:function(t,n){t&1&&(r(0,"modal-material",3),d("onOk",function(){return n.onSave()})("onCancel",function(){return n.onCancel()})("onClose",function(){return n.onCancel()}),r(1,"content",4)(2,"div",5)(3,"div",6)(4,"div")(5,"a",7),d("click",function(){return n.tabState="CART"}),s(6," Cart "),a(),v(7,Qn,3,3,"ng-container",8)(8,Ln,3,3,"ng-container",8),a()(),r(9,"div",9),v(10,Hn,22,9,"ng-container",8)(11,Zn,39,16,"ng-container",8)(12,ei,2,2,"ng-container",8),a()()()()),t&2&&(m("config",n.modalConfig),l(5),m("ngClass",q(7,Ot,n.tabState=="CART")),l(2),m("ngIf",n.showProductTab()),l(),m("ngIf",n.isSerialItem()),l(2),m("ngIf",n.tabState=="CART"),l(),m("ngIf",n.tabState=="PRODUCT"),l(),m("ngIf",n.tabState=="SERIAL"))},dependencies:[O,Z,H,De,ee,Ae,Ne,yn,ie,te,J,ne,ge,fe,un,pn,Ke,Je,ct,Ee,Me,xn,hn,ut,Te],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.inventory-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .inventory-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{line-height:6px!important}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519}.input-cart[_ngcontent-%COMP%]{height:36px!important}"]})};var me=class o{httpService=u(K);storeService=u(P);factoryService=u(be);pricebookService=u(ve);dialog=u(oe);variantSearchCtrl=new Pe;viewContainerRef=u(Ut);selectedCustomer;cartItemEvent=new wt;onEditCartItems$=U(this.storeService.cartItems).pipe(E(()=>this.storeService.state()==1),pe(e=>({action:"INIT",items:e})),Ft());applyCustomerPricebook$=U(this.storeService.customer).pipe(T(e=>{this.onApplyCustomerPricebook(e)}),F());cartItems$=kt(this.onEditCartItems$,this.cartItemEvent.asObservable()).pipe(Rt((e,t)=>{let n=[];switch(t.action){case"INIT":n=t.items;break;case"ADD":n=this.addNewItem(e,t);break;case"UPDATE":n=this.updateItems(e,t);break;case"REMOVE":n=e.filter((i,c)=>t.index!==c);break;case"CLEAR":n=[];break;case"PURCHASE":n=this.updateItems(e,t);break;case"RETURN":n=this.updateItems(e,t);break;case"DROP":n=t.items;break}return this.storeService.updateCartItems(n),n},this.storeService.cartItems()));addCartItemBySearch$=this.variantSearchCtrl.valueChanges.pipe(E(e=>g.IsNotEmpty(e)),T(e=>{e.type==="ID"?this.addItemByVariantId(e.str):e.type==="Code"&&this.addItemByVariantCode(e.str)}),F());constructor(){this.addCartItemBySearch$.subscribe(),this.applyCustomerPricebook$.subscribe()}onApplyCustomerPricebook(e){let t=[],n=this.storeService.cartItems();g.IsNotEmpty(e.PricebookID)?(this.selectedCustomer=e,t=this.pricebookService.applyCustomerPricebook()):g.IsNotEmpty(this.selectedCustomer)&&(t=this.pricebookService.removeCustomerPricebook(this.selectedCustomer),this.selectedCustomer=null),n.forEach((i,c)=>{let x=t.find(I=>I.VariantID===i.VariantID);x&&this.updateCartItem({cartItem:x,index:c})})}onApplyPricebook(e){return this.pricebookService.autoApplyPricebook(e)}onOpenAddDialog(){this.dialog.open(Le,{data:new Ce,viewContainerRef:this.viewContainerRef}).afterClosed().pipe(E(e=>g.IsNotEmpty(e))).subscribe(e=>{this.cartItemEvent.next({item:e,action:"ADD",newRow:!0})})}onOpenEditDialog(e){this.dialog.open(Le,{data:R({},e.cartItem),viewContainerRef:this.viewContainerRef}).afterClosed().pipe(E(t=>g.IsNotEmpty(t))).subscribe(t=>{this.cartItemEvent.next({item:t,action:"UPDATE",index:e.index})})}onSelectQuickkeyItem(e){this.addItemByVariantId(e)}addNewItem(e,t){let n=[],i=e.find(c=>c.VariantID===t.item?.VariantID);return i?t.newRow?(t.item=this.onApplyPricebook(t.item),n=[...e,t.item]):(i.Quantity+=1,i=this.onApplyPricebook(i),n=[...e]):(t.item=this.onApplyPricebook(t.item),n=[...e,t.item]),n}updateItems(e,t){return e.map((i,c)=>c===t.index?cn(Ce,t.item):i)}onDropItems(e){this.cartItemEvent.next({action:"DROP",items:e})}addItemByVariantId(e){this.getItemByVariantId(e).pipe(T(t=>{this.cartItemEvent.next({item:t,action:"ADD",newRow:!1})})).subscribe()}addItemByVariantCode(e){this.getItemByVariantByCode(e).pipe(T(t=>{this.cartItemEvent.next({item:t,action:"ADD",newRow:!1})})).subscribe()}removeCartItem(e){this.cartItemEvent.next({action:"REMOVE",index:e.index})}updateCartItem(e){this.cartItemEvent.next({action:"UPDATE",item:e.cartItem,index:e.index})}clearCart(){this.dialog.open(Tn,{data:{title:"Clear Order Items",message:'<p class="h4">Are you sure you want to clear all order items?</p>',headerType:xe.Warning}}).afterClosed().pipe(E(e=>e)).subscribe(()=>{this.cartItemEvent.next({action:"CLEAR"})})}onPurchaseItem(e){this.cartItemEvent.next({action:"PURCHASE",item:e.cartItem,index:e.index})}onReturnItem(e){this.cartItemEvent.next({action:"RETURN",item:e.cartItem,index:e.index})}getItemByVariantId(e){return this.httpService.get(j.GetVariantByID,[{key:"ID",value:e},{key:"EntityID",value:this.storeService.outlet().ID}]).pipe(pe(t=>this.factoryService.generateCartItem(t)))}getItemByVariantByCode(e){return this.httpService.get(j.GetVariantByCode,[{key:"Code",value:e},{key:"EntityID",value:this.storeService.outlet().ID},{key:"Promotion",value:!0}]).pipe(pe(t=>this.factoryService.generateCartItem(t)))}getVariantInventory(e){return this.httpService.get(j.GetVariantStockByID,[{key:"EntityID",value:this.storeService.outlet().ID},{key:"ID",value:e}])}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};function ti(o,e){if(o&1&&(r(0,"td",29),s(1),a()),o&2){let t=p().index;l(),S(" ",t+1,". ")}}function ni(o,e){if(o&1&&(y(0),r(1,"div",30),D(2,"img",31),a(),h()),o&2){let t=p().$implicit;l(2),m("src",t.ThumbnailUrl,qe)}}function ii(o,e){o&1&&(r(0,"div",32),D(1,"i",33),a())}function oi(o,e){if(o&1&&D(0,"small",16),o&2){let t=p().$implicit;m("innerHtml",t.Note,Bt)}}function ri(o,e){if(o&1&&(y(0),r(1,"span",24),s(2),b(3,"number"),a(),h()),o&2){let t=p().$implicit;l(2),B(Mt(3,1,t.Quantity,"1.0-4"))}}function ai(o,e){if(o&1&&(y(0),r(1,"span",34),s(2,"x"),a(),r(3,"div",35)(4,"span",36),s(5),b(6,"number"),a()(),h()),o&2){let t=p().$implicit;l(5),B(_(6,1,t.UnitQuantity))}}function ci(o,e){if(o&1&&(y(0),r(1,"span",37),s(2),b(3,"number"),a(),h()),o&2){let t=p().$implicit;l(2),S("@",_(3,1,t.VariantUnitQuantity),"")}}function li(o,e){if(o&1&&(y(0),r(1,"small",38),s(2),a(),h()),o&2){let t=p().$implicit;l(2),B(t.UOM?t==null?null:t.UOMName:"")}}function si(o,e){if(o&1&&(y(0),r(1,"div",39),s(2),b(3,"number"),a(),h()),o&2){let t=p().$implicit;l(2),S(" ",Mt(3,1,t.Price,"1.0-4")," ")}}function mi(o,e){if(o&1){let t=N();y(0),r(1,"tr",9),d("contextmenu",function(i){let c=f(t),x=c.$implicit,I=c.index,ae=p(2);return C(ae.onContextMenu(i,x,I))}),v(2,ti,2,1,"td",10),r(3,"td",11),d("click",function(){let i=f(t),c=i.$implicit,x=i.index,I=p(2);return C(I.onEdit(c,x))}),r(4,"div",12),v(5,ni,3,1,"ng-container",3)(6,ii,2,0,"ng-template",null,2,le),r(8,"div",13)(9,"div"),s(10),a(),r(11,"span",14),s(12),a(),r(13,"div"),D(14,"app-serial-note",15),a(),v(15,oi,1,1,"small",16),a()()(),r(16,"td",17),d("click",function(){let i=f(t),c=i.$implicit,x=i.index,I=p(2);return C(I.onEdit(c,x))}),r(17,"div",18)(18,"div",19),v(19,ri,4,4,"ng-container",20)(20,ai,7,3,"ng-container",20)(21,ci,4,3,"ng-container",20)(22,li,3,1,"ng-container",20),a()()(),r(23,"td",21),d("click",function(){let i=f(t),c=i.$implicit,x=i.index,I=p(2);return C(I.onEdit(c,x))}),v(24,si,4,4,"ng-container",20),a(),r(25,"td",21),d("click",function(){let i=f(t),c=i.$implicit,x=i.index,I=p(2);return C(I.onEdit(c,x))}),r(26,"div",22),s(27),b(28,"number"),a()(),r(29,"td",23),d("click",function(){let i=f(t),c=i.$implicit,x=i.index,I=p(2);return C(I.onEdit(c,x))}),r(30,"div",18)(31,"div",24),s(32),b(33,"number"),a()()(),r(34,"td",25)(35,"div",26)(36,"span",27),d("click",function(){let i=f(t),c=i.$implicit,x=i.index,I=p(2);return C(I.onRemove(c,x))}),D(37,"i",28),a()()()(),h()}if(o&2){let t=e.$implicit,n=z(7),i=p(2);l(2),m("ngIf",i.appConfig==null?null:i.appConfig.ModuleSell.Grid.RowNumberVisible),l(3),m("ngIf",t.ThumbnailUrl)("ngIfElse",n),l(5),B(t.Name),l(2),B(t.Code),l(2),m("serials",t==null?null:t.Serial),l(),He(t.Note?15:-1),l(4),m("ngIf",t.Quantity!==1&&t.Quantity!==0||t.UnitQuantity>1||t.VariantUnitQuantity>1),l(),m("ngIf",t.UnitQuantity>1),l(),m("ngIf",t.VariantUnitQuantity>1),l(),m("ngIf",t.UOM&&(i.appConfig==null||i.appConfig.ModuleSell==null?null:i.appConfig.ModuleSell.Grid.UOMVisible)),l(2),m("ngIf",t.Price!==t.Total),l(3),S(" ",t.Discount?_(28,14,t.Discount*-1)+"%":""," "),l(5),S(" ",i.roleService.product!=null&&i.roleService.product.Price?_(33,16,t.Total):" - "," ")}}function pi(o,e){if(o&1){let t=N();y(0),r(1,"table",6)(2,"tbody",7),d("cdkDropListDropped",function(i){f(t);let c=p();return C(c.onDrop(i))}),v(3,mi,38,18,"ng-container",8),a()(),h()}if(o&2){let t=p();l(3),m("ngForOf",t.cartItems)}}function ui(o,e){o&1&&(r(0,"div",40)(1,"div",41)(2,"div",42)(3,"div",43)(4,"div",44),D(5,"i",45),a(),r(6,"div",46)(7,"span"),s(8,"Empty Cart"),a(),D(9,"br"),r(10,"span"),s(11,"Add products to the cart"),a(),D(12,"br"),r(13,"span"),s(14,"or scan barcode"),a()()()()()())}function di(o,e){if(o&1){let t=N();r(0,"button",47),d("click",function(){let i=f(t).item,c=p();return C(c.onReverse(i,!0))}),s(1,"Return"),a(),r(2,"button",47),d("click",function(){let i=f(t).item,c=p();return C(c.onReverse(i,!1))}),s(3,"Purchase"),a()}}var dt=class o{roleService=u(de);appConfig;cartItems=[];set _cartItems(e){e&&(this.cartItems=[...e])}onRemoveEvent=new A;onEditEvent=new A;onDropItems=new A;onReturnEvent=new A;onPurchaseEvent=new A;contextMenu;contextMenuPosition={x:"0px",y:"0px"};onContextMenu(e,t,n){e.preventDefault(),this.contextMenuPosition.x=e.clientX+"px",this.contextMenuPosition.y=e.clientY+"px",t.Index=n,this.contextMenu.menuData={item:t},this.contextMenu.openMenu()}onDrop(e){Kt(this.cartItems,e.previousIndex,e.currentIndex),this.onDropItems.emit(this.cartItems)}onEdit(e,t){this.onEditEvent.emit({cartItem:e,index:t})}onRemove(e,t){this.onRemoveEvent.emit({cartItem:e,index:t})}onReverse(e,t){let n=e.Index;t?(e.Quantity>0&&(e.Quantity=e.Quantity*-1),this.onReturnEvent.emit({cartItem:e,index:n})):(e.Quantity<0&&(e.Quantity=e.Quantity*-1),this.onPurchaseEvent.emit({cartItem:e,index:n}))}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["POS-cart-display"]],viewQuery:function(t,n){if(t&1&&Lt(nt,7),t&2){let i;Wt(i=qt())&&(n.contextMenu=i.first)}},inputs:{appConfig:"appConfig",_cartItems:[0,"cartItems","_cartItems"]},outputs:{onRemoveEvent:"onRemove",onEditEvent:"onEdit",onDropItems:"onDropItems",onReturnEvent:"onReturn",onPurchaseEvent:"onPurchase"},decls:7,vars:7,consts:[["EMPTY_CART",""],["contextMenu","matMenu"],["NO_IMAGE",""],[4,"ngIf","ngIfElse"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],["matMenuContent",""],[1,"table","table-borderless"],["cdkDropList","",3,"cdkDropListDropped"],[4,"ngFor","ngForOf"],["cdkDrag","",1,"border-bottom",3,"contextmenu"],["style","width: 10px",4,"ngIf"],[1,"pe-0",2,"width","50%",3,"click"],[1,"d-flex","align-items-center"],[1,"d-block","ms-4",2,"line-height","18px"],[1,"fw-normal","fs-6","text-muted"],[3,"serials"],["title","Note",1,"special-TinyMCE","m-0","fst-italic","d-block",3,"innerHtml"],[1,"px-0","text-end",2,"width","15%",3,"click"],[1,"d-flex","align-items-center","justify-content-end"],[1,"d-flex","text-end","fw-normal","align-items-center",2,"line-height","20px"],[4,"ngIf"],[3,"click"],[1,"fw-normal","fs-5","text-danger"],[1,"pe-0",3,"click"],[1,"fs-5"],[1,"mt-6","ps-0"],[1,"d-flex","justify-content-end","align-items-center"],["role","button","title","Delete Item",1,"fs-3","cursor-pointer",3,"click"],[1,"fa","fa-trash","text-danger","fs-4"],[2,"width","10px"],[1,"ratio","ratio-1x1",2,"width","55px"],[1,"item-image",3,"src"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],[1,"fs-6","me-1","ms-1"],[1,"d-flex","algin-items-center"],["title","Unit Quantity",1,"fs-5","me-1"],["title","Variant Unit Quantity",1,"fs-5"],["title","UOM",1,"ps-1","fs-5"],[1,"fs-5","text-end"],[1,"row","g-0","h-100"],[1,"col-12"],[1,"d-flex","justify-content-center","align-items-center","h-100"],[1,"row"],[1,"col-12","d-flex","justify-content-center"],[1,"fa-regular","fa-cart-arrow-up","text-secondary",2,"font-size","110px"],[1,"col-12","justify-content-center","text-center","mt-5","empty-cart-description","text-secondary","headings-font-family"],["mat-menu-item","",3,"click"]],template:function(t,n){if(t&1&&(v(0,pi,4,1,"ng-container",3)(1,ui,15,0,"ng-template",null,0,le),D(3,"div",4),r(4,"mat-menu",null,1),v(6,di,4,0,"ng-template",5),a()),t&2){let i=z(2),c=z(5);m("ngIf",n.cartItems.length>0)("ngIfElse",i),l(3),Qt("left",n.contextMenuPosition.x)("top",n.contextMenuPosition.y),m("matMenuTriggerFor",c)}},dependencies:[O,ue,H,ee,Zt,Xt,Yt,En,_n,bn,Cn,gn,fn,nt],styles:[".item-image[_ngcontent-%COMP%]{height:50px;width:56px;display:block;border:solid 1px #dddddd;border-radius:5px;object-fit:contain}.example-menu[_ngcontent-%COMP%]{display:inline-flex;flex-direction:column;min-width:180px;max-width:280px;background-color:#fff;padding:6px 0}.example-menu-item[_ngcontent-%COMP%]{background-color:transparent;cursor:pointer;border:none;-webkit-user-select:none;user-select:none;min-width:64px;line-height:36px;padding:0 16px;display:flex;align-items:center;flex-direction:row;flex:1}.example-menu-item[_ngcontent-%COMP%]:hover{background-color:#f5f5f5}.example-menu-item[_ngcontent-%COMP%]:active{background-color:#dcdcdc}.table[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:not(caption) > *[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{padding:12px 10px} .cdk-menu.cdk-menu-group.example-menu{box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.empty-cart-description[_ngcontent-%COMP%]{font-size:14px;font-weight:500;color:#c7c7c7}"]})};var fi=(o,e)=>({"text-danger":o,"text-custom-warning":e});function Ci(o,e){if(o&1&&(r(0,"mat-option",6)(1,"div",7)(2,"div",8)(3,"div"),s(4),a()()()()),o&2){let t=e.$implicit,n=p();m("value",t),l(2),m("ngClass",$t(4,fi,t.StateID==n.customerState.Suspended,t.StateID==n.customerState.WaitingForApproval))("title",t.StateID==n.customerState.Suspended?"Suspended":t.StateID==n.customerState.WaitingForApproval?"Waiting for Approval":""),l(2),B(t==null?null:t.Value)}}var gt=class o{httpService=u(K);customerCtrl=new Pe;customerFiltered$=this.customerCtrl.valueChanges.pipe(E(e=>typeof e=="string"&&e.length>=3),At(300),Y(e=>this.getCustomerSuggestion(e)));customerSelected$=this.customerCtrl.valueChanges.pipe(E(e=>typeof e!="string"),T(e=>{this.onChange(e)}));createNewCustomer=new A;clickInput=new A;customerState=In;constructor(){this.customerSelected$.pipe(F()).subscribe()}getCustomerSuggestion(e){return this.httpService.get(j.GetCustomerSuggestions,[{key:"count",value:100},{key:"prefix",value:e}])}displayFn(e){return e?.Value}onCreateCustomer(){this.createNewCustomer.emit()}onClickInputValue(){this.clickInput.emit()}onChange=e=>{};onTouched=()=>{};writeValue(e){this.customerCtrl.patchValue(e,{onlySelf:!0,emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["POS-customer-autocomplete"]],outputs:{createNewCustomer:"onCreateNewCustomer",clickInput:"onClickInput"},features:[Ie([{provide:Xe,multi:!0,useExisting:o}])],decls:7,vars:6,consts:[["auto","matAutocomplete"],[1,"d-flex","align-items-center","position-relative"],["matTooltipPosition","above","matTooltip","New Customer","role","button",1,"fa-light","fa-user-plus","position-absolute","cursor-pointer",2,"font-size","12px",3,"click"],["type","text","placeholder","Assign Customer",3,"click","formControl","matAutocomplete"],[3,"displayWith"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"ms-3","text-wrap","text-break",3,"ngClass","title"]],template:function(t,n){if(t&1){let i=N();r(0,"div",1)(1,"i",2),d("click",function(){return f(i),C(n.onCreateCustomer())}),a(),r(2,"input",3),d("click",function(){return f(i),C(n.onClickInputValue())}),a(),r(3,"mat-autocomplete",4,0),v(5,Ci,5,7,"mat-option",5),b(6,"async"),a()()}if(t&2){let i=z(4);l(2),m("formControl",n.customerCtrl)("matAutocomplete",i),l(),m("displayWith",n.displayFn),l(2),m("ngForOf",_(6,4,n.customerFiltered$))}},dependencies:[O,Z,ue,De,rn,nn,Jt,on,Ee,te,J,Me,et,Ze,it],styles:["input[_ngcontent-%COMP%]{width:100%;height:38px!important;border-radius:.375rem;border:1px solid #ced4da;padding-left:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i[_ngcontent-%COMP%]{font-size:16px;top:12px;left:11px}.text-custom-warning[_ngcontent-%COMP%]{color:#ff7a00d6}"]})};var We=class o{storeService=u(P);dialog=u(oe);httpService=u(K);createNewCustomer(){this.dialog.open(vn,{data:{options:this.storeService.loadForm()?.EstimateOptions,config:this.storeService.loadForm()?.AppConfigJSON?.ModuleContact,type:"customer",title:"New Customer Form"}}).afterClosed().pipe(E(e=>g.IsNotEmpty(e))).subscribe(e=>{let t=new re;t.Key=e.CustomerID,t.Value=e.ContactName,this.storeService.updateCustomer(t)})}onSelectCustomer(e){let t=this.storeService.outlet();this.httpService.get(j.GetCustomerPrivilegeByID,[{key:"ID",value:e.Key},{key:"EntityID",value:t.ID}]).pipe(Nt(()=>{let n=new re;return this.storeService.updateCustomer(n),Tt})).subscribe(n=>{let i=JSON.parse(JSON.stringify(e));i.PricebookID=n.PricebookID,this.storeService.updateCustomer(i)})}onDeleteCustomer(){g.IsNotEmpty(this.storeService?.customer()?.Key)&&this.dialog.open(Sn,{data:{title:"Re-assign customer",message:"Are you sure to re-assign the customer?"}}).afterClosed().pipe(E(e=>e)).subscribe(()=>{let e=new re;this.storeService.updateCustomer(e)})}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var ft=class o{clickEvent=new A;onClick(){this.clickEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["app-note-button"]],outputs:{clickEvent:"onClickEvent"},decls:2,vars:0,consts:[["type","button",1,"btn","btn-gray","w-100","fs-3","px-0","py-6","headings-font-family",3,"click"],[1,"fa-regular","fa-note-sticky","fa-xl"]],template:function(t,n){t&1&&(r(0,"button",0),d("click",function(){return n.onClick()}),D(1,"i",1),a())},dependencies:[O],styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"]})};function bi(o,e){if(o&1&&(r(0,"div"),s(1),b(2,"number"),a()),o&2){let t=p();l(),S(" ",_(2,1,t.totalAmount)," ")}}function _i(o,e){o&1&&s(0," - ")}var Ct=class o{payEvent=new A;totalItems=0;totalQuantity=0;totalAmount=0;rolePrice=!0;constructor(){}ngOnInit(){}onPay(){this.payEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["app-pay-button"]],inputs:{totalItems:"totalItems",totalQuantity:"totalQuantity",totalAmount:"totalAmount",rolePrice:"rolePrice"},outputs:{payEvent:"onPayEvent"},decls:11,vars:6,consts:[["HIDDENCOST",""],["type","button",1,"btn","btn-success","fs-1","py-4","w-100",3,"click"],[1,"d-flex","align-items-center","justify-content-between"],[1,"fs-6"],[4,"ngIf","ngIfElse"]],template:function(t,n){if(t&1){let i=N();r(0,"button",1),d("click",function(){return f(i),C(n.onPay())}),r(1,"div",2)(2,"div")(3,"span"),s(4,"Submit"),a(),r(5,"small",3),s(6),b(7,"number"),a()(),v(8,bi,3,3,"div",4)(9,_i,1,0,"ng-template",null,0,le),a()()}if(t&2){let i=z(10);l(6),he(" (",_(7,4,n.totalItems)," Items & ",n.totalQuantity," Qty) "),l(2),m("ngIf",n.rolePrice)("ngIfElse",i)}},dependencies:[O,H,ee],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0;position:relative;flex:1 1 auto;border-left:.1px solid #fff}"]})};var bt=class o{clickEvent=new A;onClick(){this.clickEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["app-discount-button"]],outputs:{clickEvent:"onClickEvent"},decls:2,vars:0,consts:[["type","button","matTooltip","Discount / Tax","matTooltipPosition","above",1,"btn","btn-success","fs-5",3,"click"],[1,"fa-light","fa-percent"]],template:function(t,n){t&1&&(r(0,"button",0),d("click",function(){return n.onClick()}),D(1,"i",1),a())},dependencies:[O,et,Ze],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;border-top-right-radius:0;border-bottom-right-radius:0;position:relative;flex:1 1 auto}"]})};var Re=class o{store=u(P);toastr=u(Ye);dialog=u(oe);updateState$=U(this.store.complete).pipe(E(e=>e.Success),T(()=>this.store.updateState(3)),F());constructor(){this.updateState$.subscribe()}onPay(){if(this.validatePayOrder()==!1)return;let t={Items:this.cartItemPreSubmission(),Order:R({},this.store.order())};this.dialog.open(kn,{data:{transactionData:t,api:j.SubmitEstimate}}).afterClosed().pipe(E(n=>g.IsNotEmpty(n))).subscribe(n=>{this.store.updateComplete(n)})}cartItemPreSubmission(){let e=JSON.parse(JSON.stringify(this.store.cartItems()));return e=e.map(t=>(delete t.Variant,t)),e}validatePayOrder(){let e=!0;return g.IsEmpty(this.store.outlet().ID)&&(this.toastr.error("Please select outlet before proceeding..",xe.Error),e=!1),g.IsEmpty(this.store.customer().Key)&&(this.toastr.warning("Please select a customer!",xe.Warning),e=!1),this.store.cartItems().length==0&&(this.toastr.error("You must have at least one item.",xe.Error),e=!1),g.IsEmpty(this.store.order().Number)&&(this.toastr.error("Number cannot be empty.",xe.Error),e=!1),e}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var _t=class o{constructor(e,t){this.dialogRef=t;this.discountAmount.set(e.discountAmount),this.discount.set(e.discount),this.tax=V(e.tax),this.currency=V(e.currency),this.taxes.set(e.taxes),this.initModalConfig()}modalConfig=new ke;discountAmount=V(0);discount=V(0);tax;discounts=V([0,0,0]);currency;taxes=V([]);initModalConfig(){this.modalConfig.title="Discount and Tax",this.modalConfig.customWidth="400px"}onClose(){this.dialogRef.close()}onSave(){this.dialogRef.close({discountAmount:this.discountAmount(),discount:this.discount(),tax:this.tax()})}onSelectTax(e){this.tax.set(e)}onDiscountCalculatorChange(e,t){let n=this.discounts();n[t]=e,this.discounts.set(n),this.calculateDiscountCalculator()}calculateDiscountCalculator(){let e=this.discounts(),t=100;e.forEach(i=>{i&&i>0&&(t=t*(100-i)/100)});let n=100-t;this.discount.set(n)}static \u0275fac=function(t){return new(t||o)(X(we),X(Oe))};static \u0275cmp=M({type:o,selectors:[["app-dialog-discount"]],decls:48,vars:10,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],["matTooltipPosition","above","matTooltip","Discount","tabTitle","Discount"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-3"],[1,"fw-bold","d-block"],[1,"col-9"],["type","text","data-cy","discount1","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],[1,"ms-1"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],["type","text","data-cy","discountamount","autoNum","",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],["matTooltipPosition","above","matTooltip","Tax","tabTitle","Tax"],["bindLabel","Label","appendTo","body","bindValue","ID","placeholder","Tax","data-cy","Tax",2,"width","150px",3,"change","clearable","ngModel","items"],["matTooltipPosition","above","matTooltip","Calculation","tabTitle","Calculator"],[1,"row","mt-6","g-0","d-flex","align-items-center","justify-content-start"],[1,"col-4"],[1,"col-8","ps-4"],["type","text","data-cy","discountCal1","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"mx-2"],["type","text","data-cy","discountCal2","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal3","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"]],template:function(t,n){if(t&1&&(r(0,"modal-material",0),d("keydown.F2",function(){return n.onSave()})("onOk",function(){return n.onSave()})("onCancel",function(){return n.onClose()})("onClose",function(){return n.onClose()}),r(1,"content")(2,"div",1)(3,"custom-tabs"),y(4),r(5,"tab",2)(6,"div",3)(7,"div",4)(8,"label",5),s(9,"Discount %"),a()(),r(10,"div",6)(11,"input",7),W("ngModelChange",function(c){return L(n.discount,c)||(n.discount=c),c}),a(),r(12,"span",8),s(13,"%"),a()()(),r(14,"div",9)(15,"div",4)(16,"label",5),s(17),a()(),r(18,"div",6)(19,"input",10),W("ngModelChange",function(c){return L(n.discountAmount,c)||(n.discountAmount=c),c}),a()()()(),h(),y(20),r(21,"tab",11)(22,"div",3)(23,"div",4)(24,"label",5),s(25,"Tax"),a()(),r(26,"div",6)(27,"ng-select",12),d("change",function(c){return n.onSelectTax(c)}),a()()()(),h(),y(28),r(29,"tab",13)(30,"div",14)(31,"div",15)(32,"label",5),s(33,"Discount Calculator"),a()(),r(34,"div",16)(35,"input",17),d("ngModelChange",function(c){return n.onDiscountCalculatorChange(c,0)}),a(),r(36,"span"),s(37," %"),a(),r(38,"span",18),s(39,"+"),a(),r(40,"input",19),d("ngModelChange",function(c){return n.onDiscountCalculatorChange(c,1)}),a(),r(41,"span"),s(42," %"),a(),r(43,"span",18),s(44,"+"),a(),r(45,"input",20),d("ngModelChange",function(c){return n.onDiscountCalculatorChange(c,2)}),a(),r(46,"span"),s(47," %"),a()()()(),h(),a()()()()),t&2){let i;m("config",n.modalConfig),l(11),Q("ngModel",n.discount),l(6),S("Discount ",(i=n.currency())==null?null:i.Symbol,""),l(2),Q("ngModel",n.discountAmount),l(8),m("clearable",!1)("ngModel",n.tax().ID)("items",n.taxes()),l(8),m("ngModel",n.discounts[0]),l(5),m("ngModel",n.discounts[1]),l(5),m("ngModel",n.discounts[2])}},dependencies:[O,Ae,Ne,ot,at,rt,ie,te,J,ne,Te,ge,fe],encapsulation:2})};var ye=class o{storeService=u(P);totalItemsQty=$(()=>this.storeService.cartItems().reduce((n,i)=>n+i.Quantity,0));totalItemsAmount=$(()=>this.storeService.cartItems().reduce((n,i)=>n+i.Total,0));taxAmount=$(()=>{let e=this.storeService.tax(),t=0;return e.Rate>0&&(e.CalculationTypeID==1?t=this.calculateTaxInclude(e):t=this.calculateTaxAdd(e)),t});totalAmount=$(()=>{let e=this.storeService.tax(),t=this.storeService.order().DiscountAmount,n=this.storeService.order().Discount,i=this.totalItemsAmount(),c=this.calculatePercentagDisc(n,i),x=i-t-c;return e.CalculationTypeID==0&&(x=x+this.taxAmount()),x});discountPercentageAmount=$(()=>{let e=this.storeService.order().Discount,t=this.totalItemsAmount();return this.calculatePercentagDisc(e,t)});calculateTaxInclude(e){let t=this.grossTotalTaxable();return e.Rate/(100+e.Rate)*t}calculateTaxAdd(e){let t=this.grossTotalTaxable();return e.Rate/100*t}grossTotalTaxable(){let e=this.taxableItems(),t=this.calculateTaxableItemsPrice(),n=this.storeService.discount();if(e.length!==0){let i=this.calculateDiscountTaxableItem();t=t*(100-n.discount)/100,t=t-i}return t}calculateDiscountTaxableItem(){let e=this.taxableItems(),t=this.totalItemsAmount(),n=this.storeService.discount().discountAmount,i=0,c=0,x=0,I=0;for(let ae of e)i=ae.getItemAfterDiscount/t,c=i*n,I=c*ae.Quantity,x+=I;return x}calculatePercentagDisc(e,t){return e/100*t}calculateTaxableItemsPrice(){return this.taxableItems().filter(n=>n.Taxable).reduce((n,i)=>n+i.Total,0)}taxableItems(){return this.storeService.cartItems().filter(t=>t.Taxable)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var hi=o=>({selected:o});function xi(o,e){if(o&1){let t=N();r(0,"div",12)(1,"span",13),s(2,"@"),a(),r(3,"input",14),W("ngModelChange",function(i){f(t);let c=p();return L(c.currency().ExchangeRate,i)||(c.currency().ExchangeRate=i),C(i)}),a()()}if(o&2){let t=p();l(3),Q("ngModel",t.currency().ExchangeRate)}}function Si(o,e){if(o&1){let t=N();r(0,"div",15)(1,"label",16)(2,"input",17),d("ngModelChange",function(){let i=f(t).$implicit,c=p();return C(c.onChangeTag(i.ID))}),a(),s(3),a()()}if(o&2){let t,n=e.$implicit,i=e.index,c=p();l(),Pt("for","potype-"+i),m("ngClass",q(5,hi,((t=c.tag())==null?null:t.ID)==n.ID)),l(),Pt("id","potype-"+i),m("ngModel",c.tag().ID),l(),S(" ",n.Name," ")}}var vt=class o{constructor(e,t){this.dialogRef=t;this.initModalConfig(),this.currencies.set(e.currencies),this.tags.set(e.tags),this.tag=V(e.tag),this.currency=V(e.currency),this.defaultCurrencyId=V(e.defaultCurrencyId)}modalConfig=new ke;currencies=V([]);tags=V([]);tag;currency;defaultCurrencyId;initModalConfig(){this.modalConfig.title="Order Note",this.modalConfig.customWidth="700px"}onChangeCurrency(e){let t=this.currencies()?.find(n=>n.ID===e);this.currency.set(t)}onChangeTag(e){let t=this.tags()?.find(n=>n.ID===e);this.tag.set(t)}onClose(){this.dialogRef.close()}onSave(){this.dialogRef.close({currency:this.currency(),tag:this.tag()})}static \u0275fac=function(t){return new(t||o)(X(we),X(Oe))};static \u0275cmp=M({type:o,selectors:[["app-dialog-note"]],decls:16,vars:6,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],["matTooltipPosition","above","matTooltip","Currency","tabTitle","Currency"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],[1,"row","ms-4"],[1,"ps-0","col-sm-4"],["bindLabel","Name","bindValue","ID","placeholder","Currency","appendTo","body",3,"ngModelChange","items","clearable","ngModel"],["class","col-sm-4 d-flex",4,"ngIf"],["matTooltipPosition","above","matTooltip","Tag","tabTitle","Tag"],[1,"row"],[1,"col-12"],["class","rad-btn",4,"ngFor","ngForOf"],[1,"col-sm-4","d-flex"],[1,"pt-4"],["type","text","autoNum","",1,"border","border-light",3,"ngModelChange","ngModel"],[1,"rad-btn"],[3,"for","ngClass"],["type","radio",3,"ngModelChange","ngModel","id"]],template:function(t,n){if(t&1&&(r(0,"modal-material",0),d("keydown.F2",function(){return n.onSave()})("onOk",function(){return n.onSave()})("onCancel",function(){return n.onClose()})("onClose",function(){return n.onClose()}),r(1,"content")(2,"div",1)(3,"custom-tabs"),y(4),r(5,"tab",2)(6,"div",3)(7,"div",4)(8,"div",5)(9,"ng-select",6),d("ngModelChange",function(c){return n.onChangeCurrency(c)}),a()(),v(10,xi,4,1,"div",7),a()()(),h(),y(11),r(12,"tab",8)(13,"div",9)(14,"div",10),v(15,Si,4,7,"div",11),a()()(),h(),a()()()()),t&2){let i;m("config",n.modalConfig),l(9),m("items",n.currencies())("clearable",!1)("ngModel",n.currency().ID),l(),m("ngIf",((i=n.currency())==null?null:i.ID)!=n.defaultCurrencyId()),l(5),m("ngForOf",n.tags())}},dependencies:[O,Z,ue,H,Ae,Ne,ot,at,rt,ie,te,Gt,J,ne,Te,ge,fe],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.rad-btn[_ngcontent-%COMP%]{position:relative;display:inline-block}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #dddddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label.selected[_ngcontent-%COMP%]{background:#dcdcdc;border:1px solid #dcdcdc}"]})};var yt=class o{onClickEvent=new A;constructor(){}ngOnInit(){}onClick(){this.onClickEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["app-clear-button"]],outputs:{onClickEvent:"onClickEvent"},decls:3,vars:0,consts:[["type","button",1,"btn","btn-gray","w-100","fs-3","px-0","py-6","headings-font-family",3,"click"]],template:function(t,n){t&1&&(r(0,"button",0),d("click",function(){return n.onClick()}),r(1,"span"),s(2,"Clear"),a()())},styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"]})};function Ii(o,e){if(o&1&&(y(0),r(1,"tr")(2,"th",12),s(3,"Amount"),a(),r(4,"td",13),s(5),b(6,"number"),a()(),h()),o&2){let t=p();l(5),B(_(6,1,t.calculationService==null?null:t.calculationService.totalItemsAmount()))}}function Di(o,e){if(o&1&&(r(0,"tr")(1,"th",12),s(2),a(),r(3,"td",14),s(4),b(5,"number"),a()()),o&2){let t=p(2);l(2),S("Discount ",t.storeService==null?null:t.storeService.discount().discount,"%"),l(2),S(" ",_(5,2,t.calculationService.discountPercentageAmount()*-1),"")}}function Pi(o,e){if(o&1&&(r(0,"tr")(1,"th",12),s(2),a(),r(3,"td",14),s(4),b(5,"number"),a()()),o&2){let t,n,i=p(2);l(2),S("Discount ",(t=i.storeService.currency())==null?null:t.Symbol,""),l(2),S(" ",_(5,2,((n=i.storeService.discount())==null?null:n.discountAmount)*-1),"")}}function Mi(o,e){if(o&1&&(r(0,"tr")(1,"th",12),s(2),a(),r(3,"td",13),s(4),b(5,"number"),a()()),o&2){let t,n=p(2);l(2),B((t=n.storeService.tax())==null?null:t.Label),l(2),B(_(5,2,n.calculationService.taxAmount()))}}function Ei(o,e){if(o&1&&(y(0),v(1,Di,6,4,"tr",3)(2,Pi,6,4,"tr",3)(3,Mi,6,4,"tr",3),h()),o&2){let t,n,i=p();l(),m("ngIf",i.storeService.discount().discount!=0),l(),m("ngIf",((t=i.storeService.discount())==null?null:t.discountAmount)!=0),l(),m("ngIf",((n=i.storeService.tax())==null?null:n.Rate)!=0)}}var ht=class o{storeService=u(P);orderService=u(se);roleService=u(de);payService=u(Re);calculationService=u(ye);cartService=u(me);dialog=u(oe);taxCalculationType=tt;totalItemsQty=$(()=>this.storeService.cartItems()?.length);isShowAmount=$(()=>this.storeService?.tax()?.CalculationTypeID==0&&this.storeService?.tax()?.Rate||this.storeService.discount()?.discount!=0||this.storeService.discount()?.discountAmount!=0);onOpenDialogNote(){this.dialog.open(vt,{data:{tags:this.storeService.loadForm().CustomerPOTypes,currencies:this.storeService.loadForm().Currencies,currency:this.storeService.currency(),tag:this.storeService.tag(),defaultCurrencyId:this.storeService.loadForm()?.AppConfigJSON?.CoreDefaults?.CurrencyID}}).afterClosed().pipe(E(e=>g.IsNotEmpty(e))).subscribe(e=>{this.storeService.updateCurrency(e.currency),this.storeService.updateTag(e.tag)})}onOpenDialogDiscount(){this.dialog.open(_t,{data:{discountAmount:this.storeService.order().DiscountAmount,discount:this.storeService.order().Discount,tax:this.storeService.tax(),currency:this.storeService.currency(),taxes:this.storeService.loadForm().Taxes}}).afterClosed().pipe(E(e=>g.IsNotEmpty(e))).subscribe(e=>{this.storeService.updateDiscount({discountAmount:e.discountAmount,discount:e.discount}),this.storeService.updateTax(e.tax)})}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["POS-cart-action"]],decls:13,vars:6,consts:[[1,"row","g-0","px-5","justify-content-end"],[1,"col-6",2,"padding-right","15px"],[1,"table","table-borderless"],[4,"ngIf"],[1,"row","g-0","pb-6","px-5"],[1,"col-5","d-flex","justify-content-between","pe-5",2,"column-gap","12px"],[2,"flex-grow","1",3,"onClickEvent"],[2,"flex-grow","3",3,"onClickEvent"],[1,"col-7"],[1,"btn-group","w-100"],[1,"d-inline-flex",3,"onClickEvent"],[1,"d-inline-flex","w-100",3,"onPayEvent","rolePrice","totalQuantity","totalItems","totalAmount"],[1,"text-start"],[1,"text-end","fs-5"],[1,"text-end","fs-5","text-danger"]],template:function(t,n){t&1&&(r(0,"div",0)(1,"div",1)(2,"table",2),v(3,Ii,7,3,"ng-container",3)(4,Ei,4,3,"ng-container",3),a()()(),r(5,"div",4)(6,"div",5)(7,"app-note-button",6),d("onClickEvent",function(){return n.onOpenDialogNote()}),a(),r(8,"app-clear-button",7),d("onClickEvent",function(){return n.cartService.clearCart()}),a()(),r(9,"div",8)(10,"div",9)(11,"app-discount-button",10),d("onClickEvent",function(){return n.onOpenDialogDiscount()}),a(),r(12,"app-pay-button",11),d("onPayEvent",function(){return n.payService.onPay()}),a()()()()),t&2&&(l(3),m("ngIf",n.isShowAmount()),l(),m("ngIf",n.calculationService.totalItemsQty()>0),l(8),m("rolePrice",n.roleService.product.Price)("totalQuantity",n.calculationService.totalItemsQty())("totalItems",n.totalItemsQty())("totalAmount",n.calculationService.totalAmount()))},dependencies:[O,H,ee,bt,ft,Ct,yt],encapsulation:2})};var Fn=o=>({ID:o}),Oi=()=>["/menu/Orders/Orders/Estimate/Info"],wi=o=>({"border-top":o});function Ti(o,e){if(o&1&&(y(0),r(1,"div",28)(2,"div",29),s(3),a(),r(4,"div",29),s(5),b(6,"number"),a()(),h()),o&2){let t=e.$implicit;l(3),B(t.Name),l(2),S("",_(6,2,t.Total)," ")}}function ki(o,e){if(o&1&&(y(0),r(1,"div",30)(2,"div",31),s(3),a(),r(4,"div",31),s(5),b(6,"number"),a()(),h()),o&2){let t,n=p();l(3),S("Amount: ",(t=n.storeService.currency())==null?null:t.Symbol,""),l(2),B(_(6,2,n.calculationService.totalItemsAmount()))}}function Ni(o,e){if(o&1&&(r(0,"div",32)(1,"div",31),s(2),b(3,"number"),a(),r(4,"div",33),s(5),b(6,"number"),a()()),o&2){let t,n=p();l(2),he("","Discount "+_(3,3,(t=n.storeService.discount())==null?null:t.discount)+" %",": ",(t=n.storeService.currency())==null?null:t.Symbol,""),l(3),B(_(6,5,n.calculationService.discountPercentageAmount()*-1))}}function Ai(o,e){if(o&1&&(r(0,"div",32)(1,"div",31),s(2),a(),r(3,"div",33),s(4),b(5,"number"),a()()),o&2){let t,n,i=p();l(2),S("Discount: ",(t=i.storeService.currency())==null?null:t.Symbol,""),l(2),S("",_(5,2,((n=i.storeService.discount())==null?null:n.discountAmount)*-1)," ")}}function Vi(o,e){if(o&1&&(r(0,"div",32)(1,"div",31),s(2),a(),r(3,"div",31),s(4),b(5,"number"),a()()),o&2){let t,n=p();l(2),he("",(t=n.storeService.tax())==null?null:t.Label,": ",(t=n.storeService.currency())==null?null:t.Symbol,""),l(2),B(_(5,3,n.calculationService.taxAmount()))}}var xt=class o{orderService=u(se);calculationService=u(ye);storeService=u(P);isShowAmount=$(()=>this.storeService?.tax()?.CalculationTypeID==0&&this.storeService?.tax()?.Rate||this.storeService.discount()?.discount!=0||this.storeService.discount()?.discountAmount!=0);handleF8(){this.orderService.newOrder()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["POS-complete"]],hostBindings:function(t,n){t&1&&d("keydown.F8",function(c){return n.handleF8(c)},!1,$e)},decls:40,vars:21,consts:[[1,"pt-7",2,"border-bottom","1px solid rgba(0, 0, 0, 0.1)"],[1,"ps-7","fw-normal","pb-9"],[1,"order-complete"],[1,"container-fluid","pt-8"],[1,"row"],[1,"col-8"],[1,"card"],[1,"card-header",2,"padding-bottom","15px"],[1,"fw-normal",2,"font-size","32px"],[1,"fa-solid","fa-check","me-3"],[1,"card-body"],[1,"row",2,"height","115px"],[1,"col","text-center","my-auto"],[1,"btn","btn-success","w-50",2,"font-size","20px",3,"click"],[1,"card-footer"],[1,"d-flex","justify-content-between","my-6"],["target","_blank","routerLink","/print/Estimate",1,"btn","bg-light-gray","btn-secondary",3,"queryParams"],[1,"fa-solid","fa-print","me-2"],[1,"col-4"],[1,"card-header","bg-light-gray",2,"padding-bottom","15px"],[1,"fst-italic"],["target","_blank",3,"routerLink","queryParams"],[1,"card-body","py-4"],[4,"ngFor","ngForOf"],[4,"ngIf"],["class","row justify-content-end pb-2",4,"ngIf"],[1,"row","justify-content-end","pt-4",3,"ngClass"],[1,"col-4","text-end","h5"],[1,"row","justify-content-between","border-bottom","py-2"],[1,"col","text-end"],[1,"row","justify-content-end","mt-2","pb-2"],[1,"col-4","text-end"],[1,"row","justify-content-end","pb-2"],[1,"col-4","text-end","text-danger"]],template:function(t,n){if(t&1&&(r(0,"div",0)(1,"h1",1),s(2,"Estimate"),a()(),r(3,"section",2)(4,"div",3)(5,"div",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"h1",8),D(10,"i",9),s(11,"Order Complete "),a()(),r(12,"div",10)(13,"div",11)(14,"div",12)(15,"a",13),d("click",function(){return n.orderService.newOrder()}),s(16,"New Order (F8)"),a()()()(),r(17,"div",14)(18,"div",15)(19,"a",16),D(20,"i",17),s(21,"Print Receipt"),a()()()()(),r(22,"div",18)(23,"div",6)(24,"div",19)(25,"h3",20)(26,"a",21),s(27),a()()(),r(28,"div",22),v(29,Ti,7,4,"ng-container",23)(30,ki,7,4,"ng-container",24)(31,Ni,7,7,"div",25)(32,Ai,6,4,"div",25)(33,Vi,6,5,"div",25),r(34,"div",26)(35,"div",27),s(36),a(),r(37,"div",27),s(38),b(39,"number"),a()()()()()()()()),t&2){let i,c,x,I,ae;l(19),m("queryParams",q(14,Fn,n.storeService.complete().OrderID)),l(7),m("routerLink",Ge(16,Oi))("queryParams",q(17,Fn,n.storeService.complete().OrderID)),l(),S("Estimate #",(i=n.storeService.complete())==null?null:i.InvoiceNumber,""),l(2),m("ngForOf",n.storeService.cartItems()),l(),m("ngIf",n.isShowAmount()),l(),m("ngIf",((c=n.storeService.discount())==null?null:c.discount)>0),l(),m("ngIf",((x=n.storeService.discount())==null?null:x.discountAmount)>0),l(),m("ngIf",((I=n.storeService.tax())==null?null:I.Rate)>0),l(),m("ngClass",q(19,wi,n.isShowAmount())),l(2),S("Total: ",(ae=n.storeService.currency())==null?null:ae.Symbol,""),l(2),B(_(39,12,n.calculationService.totalAmount()))}},dependencies:[O,Z,ue,H,ee,Ke,Je,an],styles:[".order-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%]{border-bottom:1px solid rgba(0,0,0,.125);padding-bottom:.9375rem}.order-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:2rem}.order-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%] .container[_ngcontent-%COMP%]{max-width:500px;margin-top:30px;margin-bottom:30px}"]})};var St=class o{route=u(ze);dialog=u(oe);addItem=new A;handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.onAddItem()}onAddItem(){this.addItem.emit()}redirectToPrevious(){this.route.navigate(["/menu/Estimate/V1"])}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["POS-more-action"]],hostBindings:function(t,n){t&1&&d("keydown.F4",function(c){return n.handleF8(c)},!1,$e)},outputs:{addItem:"onAddItem"},decls:14,vars:0,consts:[["id","moreMenu","data-bs-toggle","dropdown",1,"d-flex","align-items-center","cursor-pointer"],[1,"me-2"],[1,"fa-solid","fa-caret-down","fa-lg"],[1,"fs-6","headings-font-family","pb-1"],[1,"h-100","d-flex","align-items-center","justify-content-between"],["aria-labelledby","moreMenu",1,"dropdown-menu","more-actions"],[1,"d-flex"],[1,"dropdown-header","text-dark","col"],[1,"h5","mb-4"],[1,"dropdown-divider","m-0"],[1,"cursor-pointer",3,"click"],["icon","fa-circle-plus fa-solid","label","Add New"]],template:function(t,n){t&1&&(r(0,"span",0)(1,"span",1),D(2,"i",2),a(),r(3,"span",3),s(4,"More Actions"),a()(),r(5,"div",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"div",8),s(10,"Item"),a(),D(11,"div",9),r(12,"li",10),d("click",function(){return n.onAddItem()}),D(13,"POS-dropdown-item-more-action",11),a()()()()())},dependencies:[O,On],encapsulation:2})};function Fi(o,e){o&1&&(y(0),D(1,"POS-complete"),h())}function Ri(o,e){if(o&1){let t=N();r(0,"div",3)(1,"div",4)(2,"div",5)(3,"div",6)(4,"div",7)(5,"POS-select-outlet-form",8),b(6,"async"),d("ngModelChange",function(i){f(t);let c=p();return C(c.outletService.updateOutlet(i))}),a()(),r(7,"POS-invoice-number-form",9),b(8,"async"),d("ngModelChange",function(i){f(t);let c=p();return C(c.orderService.updateOrderNumber(i))}),a(),r(9,"POS-invoice-date",10),d("ngModelChange",function(i){f(t);let c=p();return C(c.orderService.updateOrderDate(i))}),a()()(),r(10,"div",11)(11,"div",12)(12,"div",13)(13,"POS-more-action",14),d("onAddItem",function(){f(t);let i=p();return C(i.cartItemService.onOpenAddDialog())}),a()(),r(14,"div",15)(15,"ng-select-infinite",16,1),b(17,"async"),d("selectedChange",function(i){f(t);let c=p();return C(c.orderService.updateSalesPersonId(i))}),a()()()()(),r(18,"div",17)(19,"div",18)(20,"POS-quick-key",19),b(21,"async"),d("onSelectVariant",function(i){f(t);let c=p();return C(c.cartItemService.onSelectQuickkeyItem(i))}),a()(),r(22,"div",20)(23,"div",21)(24,"div",22),D(25,"POS-variant-autocomplete",23),a(),r(26,"div",15)(27,"POS-customer-autocomplete",24),d("onCreateNewCustomer",function(){f(t);let i=p();return C(i.customerService.createNewCustomer())})("ngModelChange",function(i){f(t);let c=p();return C(c.customerService.onSelectCustomer(i))})("onClickInput",function(){f(t);let i=p();return C(i.customerService.onDeleteCustomer())}),a()()(),r(28,"POS-cart-display",25),b(29,"async"),d("onRemove",function(i){f(t);let c=p();return C(c.cartItemService.removeCartItem(i))})("onEdit",function(i){f(t);let c=p();return C(c.cartItemService.onOpenEditDialog(i))})("onDropItems",function(i){f(t);let c=p();return C(c.cartItemService.onDropItems(i))})("onPurchase",function(i){f(t);let c=p();return C(c.cartItemService.onPurchaseItem(i))})("onReturn",function(i){f(t);let c=p();return C(c.cartItemService.onReturnItem(i))}),a(),D(30,"POS-cart-action"),a()()()}if(o&2){let t,n=p();l(5),m("ngModel",n.storeService.outlet())("outlets",n.storeService.loadForm().Entities)("isOpenAfterLoad",_(6,18,n.outletService.isOpenDialog$)),l(2),m("ngModel",_(8,20,n.orderService.orderNumber$))("isEdit",n.isEditOrder()),l(2),m("ngModel",n.storeService.order().Date)("disabled",!(!(n.role==null||n.role.global==null)&&n.role.global.Date))("tooltip",!(n.role==null||n.role.global==null)&&n.role.global.Date?"":"Date role is required"),l(6),m("clearable",!0)("optionTitle",!0)("items",_(17,22,n.orderService.salesPersons$))("selected",n.storeService.order().SalesID),l(5),m("quickKey",_(21,24,n.quickkeyService.quickkeys$))("outletID",n.storeService.outlet().ID),l(5),m("formControl",n.cartItemService.variantSearchCtrl),l(2),m("ngModel",n.storeService.customer()),l(),m("cartItems",_(29,26,n.cartItemService.cartItems$))("appConfig",(t=n.storeService.loadForm())==null?null:t.AppConfigJSON)}}var Rn=class o extends en{loadFormService=u(Be);storeService=u(P);role=u(de);outletService=u(Ue);orderService=u(se);quickkeyService=u(je);cartItemService=u(me);customerService=u(We);intercomService=u(zt);isCompleteOrder=$(()=>this.storeService.state()==3);isEditOrder=$(()=>this.storeService.state()==1);constructor(e){super(e),this.menuData$.subscribe(),this.intercomService.hideLauncher()}ngOnDestroy(){this.intercomService.showLauncher()}static \u0275fac=function(t){return new(t||o)(X(tn))};static \u0275cmp=M({type:o,selectors:[["POS-estimate-v2"]],features:[Ie([P,Be,Ue,se,je,me,We,Re,ye,be,ve]),jt],decls:3,vars:2,consts:[["NOT_COMPLETE",""],["ngSelectInfinite",""],[4,"ngIf","ngIfElse"],[1,"container-fluid"],[1,"row","header","border-bottom"],[1,"col-5","border-end"],[1,"left-toolbar-container","h-100","d-flex","align-items-center","justify-content-between"],[1,"d-flex"],[3,"ngModelChange","ngModel","outlets","isOpenAfterLoad"],["transactionType","Estimate",3,"ngModelChange","ngModel","isEdit"],[3,"ngModelChange","ngModel","disabled","tooltip"],[1,"col-7","d-flex","align-items-center"],[1,"row","flex-grow-1"],[1,"col-lg-7","col-5","d-flex","align-items-center"],[3,"onAddItem"],[1,"col-5","ps-0"],["bindValue","ID","bindLabel","Name","placeholder","Assign Sales Person",1,"sales-person","select-max-width",3,"selectedChange","clearable","optionTitle","items","selected"],[1,"row","content"],[1,"col-5","border-end","pt-1"],[3,"onSelectVariant","quickKey","outletID"],[1,"col-7","pt-5","px-0","d-flex","flex-column"],[1,"row","w-100","ms-0"],[1,"col-7","px-0"],[3,"formControl"],[3,"onCreateNewCustomer","ngModelChange","onClickInput","ngModel"],[1,"cart-display",3,"onRemove","onEdit","onDropItems","onPurchase","onReturn","cartItems","appConfig"]],template:function(t,n){if(t&1&&v(0,Fi,2,0,"ng-container",2)(1,Ri,31,28,"ng-template",null,0,le),t&2){let i=z(2);m("ngIf",n.isCompleteOrder())("ngIfElse",i)}},dependencies:[O,H,De,Dn,Ee,J,Me,Pn,ie,ne,dn,sn,ln,Mn,dt,gt,it,ct,ht,xt,St],styles:["ng-select-infinite.sales-person.select-max-width>ng-select{padding-right:10px;height:38px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{font-size:.75rem;border:.5px solid #d7d7d7;padding-right:6px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-arrow-wrapper{width:12px;padding-bottom:2px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-value-container{padding-left:6px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{min-height:38px!important;height:38px!important;border:none} ng-select-infinite.sales-person.select-max-width.offline>.ng-select.ng-select-single .ng-select-container{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input{padding-left:5px!important} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input>input{padding-top:5px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single>ng-dropdown-panel.ng-dropdown-panel{font-size:.75rem;width:95%!important} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-focused .ng-select-container{box-shadow:none!important;border-color:transparent!important}.left-toolbar-container[_ngcontent-%COMP%]{position:relative}.left-toolbar-container[_ngcontent-%COMP%] POS-invoice-number-form[_ngcontent-%COMP%]{position:absolute;top:34px;left:28px}.header[_ngcontent-%COMP%]{min-height:60px}.content[_ngcontent-%COMP%]{min-height:calc(100vh - 60px)}.supplier-more-menu[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.cart-display[_ngcontent-%COMP%]{flex-grow:1;height:0px;overflow-y:auto}input[_ngcontent-%COMP%]{width:100%;height:38px!important;border:0;border-bottom:1px solid #ced4da;padding-left:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i[_ngcontent-%COMP%]{font-size:16px;top:10.6px;left:13px}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]{transition:.4s}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(1){-webkit-transform:rotate(-45deg) translate(-8px,4px);transform:rotate(-45deg) translate(-8px,4px)}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(2){opacity:0}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(3){-webkit-transform:rotate(45deg) translate(-5px,0px);transform:rotate(45deg) translate(-5px)}.mobile-button[_ngcontent-%COMP%]{display:none}@media (max-width: 990px){.mobile-button[_ngcontent-%COMP%]{display:block}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.more-actions[_ngcontent-%COMP%] div.d-flex[_ngcontent-%COMP%]{width:30rem}"]})};export{Rn as EstimateV2Component};
|
|
1
|
+
import{a as kn}from"./chunk-JYTOIAQL.js";import{a as Tn}from"./chunk-4JAQKA6N.js";import"./chunk-IYORR7HN.js";import{a as In}from"./chunk-GSLPZSSX.js";import{a as mn}from"./chunk-TK5H65DN.js";import{a as hn,b as xn}from"./chunk-DILWG5FB.js";import{a as gn,b as fn,c as Cn,d as nt,e as bn}from"./chunk-CILKE53W.js";import"./chunk-THRGCK26.js";import"./chunk-2IT6TVBI.js";import{a as ct}from"./chunk-PUIYTAAZ.js";import{a as Mn,e as En,f as On}from"./chunk-SXVO2KX6.js";import{a as Dn}from"./chunk-S3FHQFMA.js";import"./chunk-6SK3XWNT.js";import{c as vn,d as it}from"./chunk-NRAL4DDE.js";import{a as yn}from"./chunk-P5PNY2PR.js";import"./chunk-SE7OFLAL.js";import"./chunk-TIN7QXDO.js";import"./chunk-5VAXIJEW.js";import"./chunk-Z32NRI5K.js";import"./chunk-JCT27TRG.js";import"./chunk-RSDCLKM5.js";import"./chunk-3RK6DDJD.js";import"./chunk-L2EDFSBR.js";import{a as wn}from"./chunk-SX7VXZQI.js";import{a as Sn}from"./chunk-5CTVOG3M.js";import{a as tt}from"./chunk-B5FODXLM.js";import"./chunk-I4MJUIXL.js";import{a as ln,b as sn}from"./chunk-MUCQWTKH.js";import{a as Pn}from"./chunk-CAMFGC4E.js";import"./chunk-A6YCCT6G.js";import"./chunk-UZKYLAUE.js";import{b as dn}from"./chunk-EW42TM43.js";import{a as ot,b as rt,c as at}from"./chunk-47MDCKEY.js";import{a as pn,b as un}from"./chunk-7F6H3VFX.js";import"./chunk-GSQJO7HP.js";import"./chunk-TEFNN3TY.js";import"./chunk-KG4DA565.js";import"./chunk-IUKQX4L5.js";import"./chunk-JKYTSC2D.js";import{a as _n}from"./chunk-TGAOY65D.js";import{c as cn}from"./chunk-HT35KHLT.js";import"./chunk-VQ7WKMGF.js";import"./chunk-MV3QRRW6.js";import{a as Kt,d as Yt,f as Xt,h as Zt}from"./chunk-6ZOGADBZ.js";import{a as ge,c as fe}from"./chunk-HA2GY7XU.js";import{i as an}from"./chunk-WSJHXTI4.js";import"./chunk-OLSVR34W.js";import{a as en,b as tn}from"./chunk-YUGYXJ5G.js";import"./chunk-52EOLV7I.js";import"./chunk-5UL73W4S.js";import{A as rn,q as Jt,u as ke,v as Ne,w as Ae,x as nn,z as on}from"./chunk-X6LIVARI.js";import{b as Ze,c as et}from"./chunk-CIBQBSM6.js";import{P as j}from"./chunk-5UCQBOD6.js";import{e as Te}from"./chunk-VMY3JQDA.js";import{a as F,b as U,e as Oe,f as we,g as oe}from"./chunk-D35OBUDE.js";import"./chunk-567HXZXC.js";import"./chunk-CGESXTHC.js";import{a as xe}from"./chunk-2FWFPV5I.js";import"./chunk-TLOTIYIE.js";import{D as ie,E as Ee,a as Xe,c as te,h as J,l as Pe,o as ne,r as Gt,s as Me}from"./chunk-P7HKWFZT.js";import"./chunk-N4OAT3FW.js";import{a as zt}from"./chunk-IBTIOJOZ.js";import{a as g,d as de}from"./chunk-AHCRE4GP.js";import"./chunk-KRC5LE5H.js";import{$a as l,$b as qt,Ac as _,Bc as Mt,D as kt,Db as He,E,Fa as A,Fc as le,I as Nt,Ib as r,Jb as a,Kb as D,Lb as y,M as At,Ma as V,Mb as h,Ob as N,Od as Ht,Pc as $,Q as Vt,Qb as d,Qd as ze,Rb as p,Rd as Je,S as Ft,Td as Ke,Ub as Pt,Va as Bt,Vd as Ye,W as Rt,Wa as qe,Wc as Z,Y as Se,Yc as ue,Yd as K,Za as $e,Zb as Lt,Zc as H,_b as Wt,aa as Y,cd as De,d as wt,db as X,dc as z,ec as s,fa as T,fb as Ut,fc as B,gc as S,gd as ee,hc as he,ja as k,jc as Q,jd as O,k as Tt,kb as M,kc as L,lc as W,na as u,o as Dt,ob as jt,pc as Ie,qb as v,qc as Ge,rc as q,sc as $t,t as pe,va as f,vb as m,wa as C,wb as Qt,zc as b}from"./chunk-DZT5XHBQ.js";import{a as R,b as It}from"./chunk-7DCB7DB2.js";var lt=class{AppConfigJSON;Currencies;CustomerPOTypes;Entities;Payments;Taxes;SalesPOTypes;EstimateOptions;Data};var Ve=class{CurrencyID;CustomerID;Date;Discount;DiscountAmount;EntityID;ID;Note;Number;SalesID;TaxTypeID;TypeID;constructor(){this.CustomerID=g.GuidEmpty,this.EntityID=g.GuidEmpty,this.ID=g.GuidEmpty,this.TaxTypeID=g.GuidEmpty,this.Discount=0,this.DiscountAmount=0,this.Date=new Date().toDateString()}};var re=class{Email;Key;Mobile;Name;Phone;Value;PricebookID};var st=class{ID;Index;Symbol;Name;ExchangeRate;ConversionSuggestion;ExchangeRateDate;ExchangeRateDateDisplay};var mt=class{ID;Name;DueDays;BlockDays;Description;PrintTemplateID;AccountID};var pt=class{DeliveryID;InvoiceID;InvoiceNumber;Message;OrderID;PaymentStateID;PaymentStateLabel;PrintMode;Success};var P=class o{estimateState=wn({loadForm:new lt,outlet:{Name:"",ID:g.GuidEmpty},order:new Ve,cartItems:[],customer:new re,tax:new mn,currency:new st,tag:new mt,discount:{discountAmount:0,discount:0},state:0,complete:new pt});loadForm=this.estimateState.select(e=>Object.freeze(e.loadForm()));order=this.estimateState.select(e=>Object.freeze(e.order()));outlet=this.estimateState.select(e=>Object.freeze(e.outlet()));cartItems=this.estimateState.select(e=>Object.freeze(e.cartItems()));customer=this.estimateState.select(e=>Object.freeze(e.customer()));tax=this.estimateState.select(e=>Object.freeze(e.tax()));currency=this.estimateState.select(e=>Object.freeze(e.currency()));tag=this.estimateState.select(e=>Object.freeze(e.tag()));discount=this.estimateState.select(e=>Object.freeze(e.discount()));state=this.estimateState.select(e=>Object.freeze(e.state()));complete=this.estimateState.select(e=>Object.freeze(e.complete()));updateLoadForm(e){this.estimateState.update("loadForm",e)}updateOutlet(e){this.estimateState.update("outlet",e)}updateOrder(e){this.estimateState.update("order",e)}updateCartItems(e){this.estimateState.update("cartItems",e)}updateCustomer(e){this.estimateState.update("customer",e)}updateTax(e){this.estimateState.update("tax",e)}updateCurrency(e){this.estimateState.update("currency",e)}updateTag(e){this.estimateState.update("tag",e)}updateDiscount(e){this.estimateState.update("discount",e)}updateState(e){this.estimateState.update("state",e)}updateComplete(e){this.estimateState.update("complete",e)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Ce=class{ID;Name;Code;Cost;ThumbnailUrl;CouponDiscount;Discount;DiscountAmount;EntityID;Expense;InventoryTypeID;LoyaltyPoint;Note;PromotionGift;Quantity;UnitQuantity;SalesID;VariantID;VariantUnitQuantity;isMaxInventory;UOM;UOMName;UnitCost;UnitPrice;TypeID;Storage;Taxable;Price;Serial;PriceBookID;Variant;PriceTypeID;PriceNote;get Total(){return this.Price*(this.Quantity*this.UnitQuantity)*((100-this.Discount)/100)}get getItemAfterDiscount(){let e=this.getDiscPercentagePerItem();return this.DiscountAmount<e?e-this.DiscountAmount:0}getDiscPercentagePerItem(){let e=this.UnitPrice;return this.Discount>0&&(e=(100-this.Discount)/100*this.UnitPrice),e}};var be=class o{constructor(){}generateCartItem(e){let t=new Ce;return t.Name=e.Name,t.ThumbnailUrl=e.ThumbnailUrl,t.Price=e.UnitPrice,t.UnitPrice=e.UnitPrice,t.UnitCost=e.UnitCost,t.UnitQuantity=e.UnitQuantity,t.Quantity=1,t.Code=e.Code,t.TypeID=e.TypeID,t.Discount=e.PriceDiscount,t.VariantUnitQuantity=e.VariantUnitQuantity,t.Storage=e.Storage,t.UOM=e.UOM,t.UOMName=e.UOMName,t.VariantID=e.ID,t.Taxable=e.Taxable,t.InventoryTypeID=e.TypeID,t.PriceTypeID=e.PriceTypeID,t.PriceNote=e.PriceNote,t.Variant=e,t}generateCartItemOnEdit(e){let t=new Ce;return t.ID=e.ID,t.Name=e.Variant?.Name,t.ThumbnailUrl=e.Variant?.ThumbnailUrl,t.Price=e.Price,t.UnitPrice=e.Price,t.UnitCost=e.Cost,t.UnitQuantity=e.Variant?.UnitQuantity,t.Quantity=e.Quantity,t.Code=e.Variant?.Code,t.TypeID=e.Variant?.TypeID,t.Discount=e.Discount,t.VariantUnitQuantity=e.Variant?.VariantUnitQuantity,t.Storage=e.Variant?.Storage,t.UOM=e.Variant?.UOM,t.UOMName=e.Variant?.UOMName,t.VariantID=e.VariantID,t.Taxable=e.Taxable,t.Note=e.Note,t.Serial=e.Serial,t.InventoryTypeID=e.InventoryTypeID,t.PriceTypeID=e.PriceTypeID,t.Variant=e.Variant,t.PriceNote=e.PriceNote,t}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Be=class o{httpService=u(K);storeService=u(P);factoryService=u(be);activatedRoute=u(Ht);getLoadForm$=this.activatedRoute.queryParams.pipe(Y(e=>this.httpService.post("/API/estimate/LoadForm",e)),T(e=>this.storeService.updateLoadForm(e)),T(e=>{g.IsNotEmpty(e.Data)?this.onEditOrder(e):(this.initDefaultCurrency(),this.initTag(),this.initTax())}),F());constructor(){this.getLoadForm$.subscribe()}onEditOrder(e){let t=e.Data,n=this.findTaxById(t.Order.TaxTypeID),i=this.findCurrencyById(t.Order.CurrencyID),c=this.findOutletById(t.Order.EntityID),x=this.findTagById(t.Order.TypeID),I=this.getCartItemsOnEdit(e);this.storeService.updateState(1),this.storeService.updateOrder(t.Order),this.storeService.updateCartItems(I),this.storeService.updateCustomer({Key:t.Order.CustomerID,Value:t.ContactName}),this.storeService.updateTax(n),this.storeService.updateCurrency(i),this.storeService.updateOutlet(c),this.storeService.updateDiscount({discount:t.Order.Discount,discountAmount:t.Order.DiscountAmount}),this.storeService.updateTag(x)}getCartItemsOnEdit(e){return e.Data.Items.map(i=>this.factoryService.generateCartItemOnEdit(i))}initDefaultCurrency(){let e=this.storeService.loadForm()?.AppConfigJSON?.CoreDefaults?.CurrencyID,t=this.storeService.loadForm()?.Currencies.find(n=>n.ID===e);this.storeService.updateCurrency(t)}initTag(){let e=this.storeService.loadForm()?.CustomerPOTypes;this.storeService.updateTag(e[0])}initTax(){let e=this.storeService.loadForm()?.Taxes;this.storeService.updateTax(e[0])}findTaxById(e){return(this.storeService.loadForm()?.Taxes).find(i=>i.ID===e)}findCurrencyById(e){return(this.storeService.loadForm()?.Currencies).find(i=>i.ID===e)}findOutletById(e){return(this.storeService.loadForm()?.Entities).find(i=>i.ID===e)}findTagById(e){return(this.storeService.loadForm()?.CustomerPOTypes).find(i=>i.ID===e)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Ue=class o{storeService=u(P);isOpenDialog$=U(this.storeService.loadForm).pipe(E(e=>g.IsNotEmpty(e.Entities)),pe(()=>{let e=!1,t=this.storeService.state(),n=this.storeService.outlet();return(t==0||t==1)&&(e=g.IsEmpty(n.ID)),e}));updateOutlet(e){this.storeService.updateOutlet(e)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac,providedIn:"root"})};var se=class o{storeService=u(P);httpService=u(K);router=u(ze);orderNumber$=U(this.storeService.outlet).pipe(E(e=>g.IsNotEmpty(e.ID)),Y(e=>{if(this.storeService.state()==0)return this.httpService.post(j.EstimateGenerateNumber,{ID:e.ID}).pipe(pe(t=>t.Number));{let t=this.storeService.order().Number;return Dt(t)}}),T(e=>{this.storeService.state()==0&&this.updateOrderNumber(e)}),F());salesPersons$=U(this.storeService.outlet).pipe(Y(e=>g.IsNotEmpty(e.ID)?this.httpService.get(j.GetSalesPersonByOutletId,[{key:"ID",value:e.ID}]):Dt([])),Se(1));updateTagOrder$=U(this.storeService.tag).pipe(T(e=>{let t=R({},this.storeService.order());t.TypeID=e.ID,this.storeService.updateOrder(t)}),F());updateCurrencyOrder$=U(this.storeService.currency).pipe(T(e=>{let t=R({},this.storeService.order());t.CurrencyID=e.ID,this.storeService.updateOrder(t)}),F());updateTaxOrder$=U(this.storeService.tax).pipe(T(e=>{let t=R({},this.storeService.order());t.TaxTypeID=e.ID,this.storeService.updateOrder(t)}),F());updateDiscountOrder$=U(this.storeService.discount).pipe(T(e=>{let t=R({},this.storeService.order());t.Discount=e.discount,t.DiscountAmount=e.discountAmount,this.storeService.updateOrder(t)}),F());updateCustomerOrder$=U(this.storeService.customer).pipe(T(e=>{let t=R({},this.storeService.order());t.CustomerID=e.Key,this.storeService.updateOrder(t)}),F());updateEntityId$=U(this.storeService.outlet).pipe(E(e=>g.IsNotEmpty(e.ID)),T(e=>{let t=R({},this.storeService.order());t.EntityID=e.ID,this.storeService.updateOrder(t)}),F());constructor(){this.updateTagOrder$.subscribe(),this.updateCurrencyOrder$.subscribe(),this.updateTaxOrder$.subscribe(),this.updateDiscountOrder$.subscribe(),this.updateCustomerOrder$.subscribe(),this.updateEntityId$.subscribe()}newOrder(){let e=this.storeService.loadForm(),t=this.getDefaultCurrency(),n=this.storeService.outlet();this.storeService.updateOrder(new Ve),this.storeService.updateCartItems([]),this.storeService.updateCustomer(new re),this.storeService.updateTax(R({},e.Taxes[0])),this.storeService.updateCurrency(R({},t)),this.storeService.updateTag(R({},e.CustomerPOTypes[0])),this.storeService.updateDiscount({discountAmount:0,discount:0}),this.storeService.updateOutlet(R({},n)),this.router.navigate([],{queryParams:{}}),this.storeService.updateState(0)}getDefaultCurrency(){let e=this.storeService.loadForm()?.AppConfigJSON?.CoreDefaults?.CurrencyID;return this.storeService.loadForm()?.Currencies.find(n=>n.ID===e)}updateOrderNumber(e){g.IsNotEmpty(e)&&this.storeService.order().Number!==e&&this.storeService.updateOrder(It(R({},this.storeService.order()),{Number:e}))}updateOrderDate(e){g.IsNotEmpty(e)&&this.storeService.order().Date!==e&&this.storeService.updateOrder(It(R({},this.storeService.order()),{Date:e}))}updateSalesPersonId(e){let t=R({},this.storeService.order());t.SalesID=e,this.storeService.updateOrder(t)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var je=class o{storeService=u(P);httpService=u(K);quickkeys$=U(this.storeService.outlet).pipe(E(e=>g.IsNotEmpty(e.ID)),Vt((e,t)=>e.ID===t.ID),Y(e=>this.httpService.get(j.GetQuickKeyByEntityID,[{key:"ID",value:e.ID}])),Se(1));static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Nn=o=>({"qtyBtn-disabled":o}),ut=class o{disabled=!1;decimalPlaces=4;max=1e15;min=-1e15;quantity;constructor(){}ngOnInit(){}incrementQty(){this.quantity<this.max&&(this.quantity++,this.onChange(this.quantity))}decrementQty(){this.quantity>this.min&&(this.quantity--,this.onChange(this.quantity))}quantityChange(){this.onChange(this.quantity)}onChange=e=>{};onTouched=()=>{};writeValue(e){g.IsEmpty(e)?this.quantity=0:this.quantity=e}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["POS-input-quantity"]],inputs:{disabled:"disabled",decimalPlaces:"decimalPlaces",max:"max",min:"min"},features:[Ie([{provide:Xe,multi:!0,useExisting:o}])],decls:6,vars:11,consts:[[1,"input-group"],["type","button","id","button-addon1",1,"btn","btn-outline-secondary","fw-bold","rounded-0","fs-2","border-end-0","py-4","qty-input","d-flex","align-items-center","qty_btn","justify-content-center",3,"click","ngClass","disabled"],["id","txtCartQuantity","type","text","autoNum","",1,"form-control","input-numpad","qty-input","text-center",3,"ngModelChange","ngModel","disabled","decimalPlaces"],["type","button","id","button-addon2",1,"btn","btn-outline-secondary","fw-bold","rounded-0","fs-5","border-start-0","py-4","qty-input","d-flex","align-items-center","qty_btn","justify-content-center",3,"click","ngClass","disabled"]],template:function(t,n){t&1&&(r(0,"div",0)(1,"button",1),d("click",function(){return n.decrementQty()}),s(2,"-"),a(),r(3,"input",2),W("ngModelChange",function(c){return L(n.quantity,c)||(n.quantity=c),c}),d("ngModelChange",function(){return n.quantityChange()}),a(),r(4,"button",3),d("click",function(){return n.incrementQty()}),s(5,"+"),a()()),t&2&&(l(),m("ngClass",q(7,Nn,n.disabled))("disabled",n.disabled),l(2),Q("ngModel",n.quantity),m("disabled",n.disabled)("decimalPlaces",n.decimalPlaces),l(),m("ngClass",q(9,Nn,n.disabled))("disabled",n.disabled))},dependencies:[O,Z,ie,te,J,ne,ge,fe],styles:[".qtyBtn-disabled[_ngcontent-%COMP%]{background-color:#e9ecef;color:#000!important}button.qty_btn[_ngcontent-%COMP%]{background:#eee;border:1px solid #ddd;width:36px}.qty-input[_ngcontent-%COMP%]{height:36px!important}"]})};var ve=class o{storeService=u(P);autoApplyPricebook(e){let t=e?.Variant?.PriceBook?e?.Variant?.PriceBook:[],n=this.storeService.customer(),i=this.findCustomerPricebook(t,n),c=this.sortAppliedPricebooks(t,e.Quantity);return c.length>0||g.IsNotEmpty(i)?g.IsNotEmpty(i)?e=this.applyPricebook(e,i):e=this.applyPricebook(e,c[0]):e.PriceTypeID===2&&(e=this.removePricebook(e)),e}findCustomerPricebook(e=[],t){let n;return g.IsNotEmpty(t)&&g.IsNotEmpty(t?.Key)&&(n=e.find(i=>i.ID==t.PricebookID)),n}applyCustomerPricebook(){let e=[],t=this.storeService.customer(),n=this.storeService.cartItems();return g.IsNotEmpty(t.PricebookID)&&n.forEach(i=>{let c=this.findCustomerPricebook(i.Variant.PriceBook,t);c&&(i=this.applyPricebook(i,c),e.push(i))}),e}removeCustomerPricebook(e){let t=[];return this.storeService.cartItems().forEach(i=>{this.findCustomerPricebook(i.Variant.PriceBook,e)&&(i=this.removePricebook(i),t.push(i))}),t}sortAppliedPricebooks(e=[],t){return e.sort((n,i)=>i.MinimumQuantity-n.MinimumQuantity).filter(n=>t>=n.MinimumQuantity&&n.MinimumQuantity!=0)}applyPricebook(e,t){let n=this.storeService.loadForm()?.AppConfigJSON?.ModuleSell?.Pricebook?.PricebookVisible;return e.Discount=t.PriceDiscount,e.UnitPrice=t.UnitPrice,e.PriceBookID=t.ID,e.Price=t.UnitPrice,e.PriceTypeID=2,e.PriceNote=t.Name,n?e.Note=t.Name:e.Note="",e}removePricebook(e){return e.Discount=e.Variant.PriceDiscount,e.UnitPrice=e.Variant.UnitPrice,e.PriceBookID=null,e.Price=e.Variant.UnitPrice,e.PriceTypeID=0,e.Note="",e.PriceNote="",e}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var Ot=o=>({selected:o}),Un=()=>["/menu/Products/Catalog/Variants/Info"],jn=o=>({ID:o});function Qn(o,e){if(o&1){let t=N();y(0),r(1,"a",10),d("click",function(){f(t);let i=p();return C(i.tabState="PRODUCT")}),s(2," Product "),a(),h()}if(o&2){let t=p();l(),m("ngClass",q(1,Ot,t.tabState=="PRODUCT"))}}function Ln(o,e){if(o&1){let t=N();y(0),r(1,"a",11),d("click",function(){f(t);let i=p();return C(i.tabState="SERIAL")}),s(2," Serial "),a(),h()}if(o&2){let t=p();l(),m("ngClass",q(1,Ot,t.tabState=="SERIAL"))}}function Wn(o,e){if(o&1&&(y(0),r(1,"div",12)(2,"div",21),D(3,"POS-variant-autocomplete",22),a()(),h()),o&2){let t=p(2);l(3),m("formControl",t.variantSearchCtrl)}}function qn(o,e){if(o&1&&(r(0,"span"),s(1),a()),o&2){let t=p(2);l(),S("(",t.cartItem().UOMName,")")}}function $n(o,e){if(o&1){let t=N();r(0,"div",15)(1,"h6"),s(2,"Pricebook"),a(),r(3,"ng-select",23),W("ngModelChange",function(i){f(t);let c=p(2);return L(c.cartItem().PriceBookID,i)||(c.cartItem().PriceBookID=i),C(i)}),d("ngModelChange",function(i){f(t);let c=p(2);return C(c.onSelectPricebook(i))}),a()()}if(o&2){let t,n=p(2);l(3),m("items",(t=n.cartItem())==null||t.Variant==null?null:t.Variant.PriceBook),Q("ngModel",n.cartItem().PriceBookID)}}function Hn(o,e){if(o&1){let t=N();y(0),v(1,Wn,4,1,"ng-container",8),r(2,"div",12)(3,"div",13)(4,"h6"),s(5," Qty "),v(6,qn,2,1,"span",8),a(),r(7,"POS-input-quantity",14,0),W("ngModelChange",function(i){f(t);let c=p();return L(c.cartItem().Quantity,i)||(c.cartItem().Quantity=i),C(i)}),d("ngModelChange",function(){f(t);let i=p();return C(i.onQtyChange())}),a()(),r(9,"div",15)(10,"h6"),s(11,"Discount (%)"),a(),r(12,"input",16),W("ngModelChange",function(i){f(t);let c=p();return L(c.cartItem().Discount,i)||(c.cartItem().Discount=i),C(i)}),a()(),r(13,"div",15)(14,"h6"),s(15,"Price"),a(),r(16,"input",17,1),W("ngModelChange",function(i){f(t);let c=p();return L(c.cartItem().Price,i)||(c.cartItem().Price=i),C(i)}),a()(),v(18,$n,4,2,"div",15),a(),r(19,"div",18)(20,"div",19)(21,"POS-tinymce-editor",20),W("ngModelChange",function(i){f(t);let c=p();return L(c.cartItem().Note,i)||(c.cartItem().Note=i),C(i)}),a()()(),h()}if(o&2){let t,n=p();l(),m("ngIf",n.isEditState()==!1),l(5),m("ngIf",n.cartItem().UOMName),l(),Q("ngModel",n.cartItem().Quantity),m("decimalPlaces",n.isSerialItem()?0:4),l(5),Q("ngModel",n.cartItem().Discount),l(4),Q("ngModel",n.cartItem().Price),m("disabled",!(!(n.roleService==null||n.roleService.sell==null)&&n.roleService.sell.UnitPriceEditor)),l(2),He(((t=n.cartItem().Variant)==null||t.PriceBook==null?null:t.PriceBook.length)>0?18:-1),l(3),Q("ngModel",n.cartItem().Note)}}function Gn(o,e){o&1&&(y(0),D(1,"i",42),r(2,"h6"),s(3,"No Image"),a(),h())}function zn(o,e){if(o&1&&D(0,"img",43),o&2){let t=p(2);m("src",t.cartItem().ThumbnailUrl,qe)}}function Jn(o,e){if(o&1&&(y(0),r(1,"tr")(2,"td",44),s(3),b(4,"number"),a(),r(5,"td",44),s(6),b(7,"number"),a(),r(8,"td",44),s(9),b(10,"number"),a()(),h()),o&2){let t=e.ngIf;l(3),S(" ",_(4,3,t==null?null:t.OnHand)," "),l(3),S(" ",_(7,5,t==null?null:t.Allocated)," "),l(3),S(" ",_(10,7,(t==null?null:t.OnHand)-(t==null?null:t.Allocated))," ")}}function Kn(o,e){if(o&1){let t=N();r(0,"tr")(1,"th",39),s(2,"Cost"),a(),r(3,"td",45)(4,"input",46),W("ngModelChange",function(i){f(t);let c=p(2);return L(c.cartItem().UnitCost,i)||(c.cartItem().UnitCost=i),C(i)}),a()()()}if(o&2){let t,n=p(2);l(4),Q("ngModel",n.cartItem().UnitCost),m("readonly",!(!((t=n.appConfig())==null||t.ModuleSell==null)&&t.ModuleSell.Cost.Enabled))}}function Yn(o,e){if(o&1&&(r(0,"tr")(1,"th",39),s(2,"Content"),a(),r(3,"td",40)(4,"div",47),s(5),b(6,"number"),a()()()),o&2){let t,n=p(2);l(5),he(" ",(t=n.cartItem())==null?null:t.VariantUnitQuantity," (@",_(6,2,n.cartItem().Price/((t=n.cartItem())==null?null:t.VariantUnitQuantity)),")")}}function Xn(o,e){if(o&1&&(r(0,"div",37)(1,"table",48)(2,"thead")(3,"tr")(4,"th",49),s(5,"Storage Location"),a()()(),r(6,"tbody")(7,"tr")(8,"td"),s(9),a()()()()()),o&2){let t=p(2);l(9),S(" ",t.cartItem().Storage," ")}}function Zn(o,e){if(o&1&&(y(0),r(1,"div",24)(2,"div",25)(3,"a",26),v(4,Gn,4,0,"ng-container",27)(5,zn,1,1,"ng-template",null,2,le),a()(),r(7,"div",28)(8,"div",29)(9,"div",19)(10,"div",30),D(11,"i",31),r(12,"div",32),s(13,"Inventory"),a()(),r(14,"table",33)(15,"thead")(16,"tr")(17,"th",34),s(18,"On Hand"),a(),r(19,"th",34),s(20,"Allocated"),a(),r(21,"th",35),s(22,"Available"),a()()(),r(23,"tbody"),v(24,Jn,11,9,"ng-container",8),b(25,"async"),a()()()(),r(26,"div",36)(27,"div",37)(28,"table",38)(29,"thead"),v(30,Kn,5,2,"tr",8),r(31,"tr")(32,"th",39),s(33,"Price"),a(),r(34,"td",40),s(35),b(36,"number"),a()(),v(37,Yn,7,4,"tr",8),a()()(),v(38,Xn,10,1,"div",41),a()()(),h()),o&2){let t,n,i,c,x,I,ae=z(6),ce=p();l(3),m("routerLink",Ge(13,Un))("queryParams",q(14,jn,(t=ce.cartItem())==null?null:t.ID)),l(),m("ngIf",((n=ce.cartItem())==null?null:n.ThumbnailUrl)==null)("ngIfElse",ae),l(20),m("ngIf",_(25,9,ce.variantInventory$)),l(6),m("ngIf",((i=ce.appConfig())==null||i.ModuleSell==null?null:i.ModuleSell.Cost.Visible)&&ce.roleService.product.Cost),l(5),S(" ",_(36,11,(c=ce.cartItem())==null?null:c.Price)," "),l(2),m("ngIf",((x=ce.cartItem())==null?null:x.VariantUnitQuantity)>1),l(),m("ngIf",((I=ce.appConfig())==null||I.ModuleSell==null||I.ModuleSell.Grid==null?null:I.ModuleSell.Grid.StorageVisible)&&((I=ce.cartItem())==null?null:I.Storage))}}function ei(o,e){if(o&1){let t=N();y(0),r(1,"app-item-serial",50),d("cartItemChange",function(i){f(t);let c=p();return C(c.onSerialChanges(i))}),a(),h()}if(o&2){let t=p();l(),m("entityId",t.storeService.outlet().ID)("cartItem",t.cartItem())}}var Le=class o{constructor(e,t){this.data=e;this.dialogRef=t;this.cartItem=V(e),this.initVariantInventory(),this.initIsSerialItem(),this.initModalConfig(),this.initDialogState()}storeService=u(P);cartItemService=u(me);roleService=u(de);toastr=u(Ye);pricebookService=u(ve);modalConfig=new ke;tabState="CART";cartItem;appConfig=V(this.storeService.loadForm()?.AppConfigJSON);isSerialItem=V(!1);variantInventory$;isEditState=V(!1);showProductTab=V(!1);variantSearchCtrl=new Pe;getItemFromSearch$=this.variantSearchCtrl.valueChanges.pipe(E(e=>g.IsNotEmpty(e)),Y(e=>{if(e.type==="ID")return this.cartItemService.getItemByVariantId(e.str);if(e.type==="Code")return this.cartItemService.getItemByVariantByCode(e.str)}),T(e=>{this.cartItem.set(e),this.initModalTitle(),this.initProductTab(),this.initIsSerialItem(),this.initVariantInventory()}),F());ngOnInit(){this.isEditState()||this.getItemFromSearch$.subscribe()}initDialogState(){this.isEditState.set(g.IsNotEmpty(this.cartItem().VariantID)),this.initProductTab()}initVariantInventory(){this.variantInventory$=this.cartItemService.getVariantInventory(this.cartItem().VariantID).pipe(Se(1))}initProductTab(){this.showProductTab.set(g.IsNotEmpty(this.cartItem().VariantID))}initIsSerialItem(){this.isSerialItem.set(this.cartItem().TypeID==4)}initModalConfig(){this.initModalTitle(),this.modalConfig.customWidth="680px",this.modalConfig.noPadding=!0,this.modalConfig.bodyScrollable=!0}initModalTitle(){this.modalConfig.title=this.cartItem()?.Name??"Add Variant"}onSerialChanges(e){this.cartItem.set(e)}onQtyChange(){let e=this.pricebookService.autoApplyPricebook(this.cartItem());this.cartItem.set(e)}onSelectPricebook(e){let t;if(g.IsNotEmpty(e)){let i=this.cartItem().Variant.PriceBook.find(c=>c.ID===e);t=this.pricebookService.applyPricebook(this.cartItem(),i)}else t=this.pricebookService.removePricebook(this.cartItem());this.cartItem.set(t)}onCancel(){this.dialogRef.close()}onSave(){g.IsNotEmpty(this.cartItem().VariantID)&&g.IsNotEmpty(this.cartItem().Name)?this.dialogRef.close(this.cartItem()):this.toastr.warning("Please select a product","Warning")}static \u0275fac=function(t){return new(t||o)(X(we),X(Oe))};static \u0275cmp=M({type:o,selectors:[["app-dialog-item"]],decls:13,vars:9,consts:[["quantity",""],["price",""],["SHOW_IMAGE",""],[3,"onOk","onCancel","onClose","config"],[1,"mb-5"],[1,"container","w-100","h-100","mt-8"],[1,"row","border-bottom","mx-5"],["data-cy","input_sell",1,"btn","btn-link",3,"click","ngClass"],[4,"ngIf"],[1,"mx-8"],["data-cy","product",1,"btn","btn-link",3,"click","ngClass"],["data-cy","serial",1,"btn","btn-link",3,"click","ngClass"],[1,"row","mt-8"],[1,"col-auto","pe-0",2,"width","145px"],[3,"ngModelChange","ngModel","decimalPlaces"],[1,"col-auto","pe-0"],["type","text","percentage","","autoNum","",1,"form-control","input-cart",2,"width","100px",3,"ngModelChange","ngModel"],["id","inputPrice","type","text","autoNum","",1,"form-control","input-cart",2,"width","112px",3,"ngModelChange","ngModel","disabled"],[1,"row","my-6"],[1,"col-12"],["height","220px",3,"ngModelChange","ngModel"],[1,"col-12","px-0"],[3,"formControl"],["bindLabel","Name","bindValue","ID","placeholder","Pricebook","appendTo","body",2,"width","170px",3,"ngModelChange","items","ngModel"],[1,"row","my-8"],[1,"col-sm-4","d-flex","justify-content-center","flex-column","align-items-center","text-body-secondary"],["target","_blank",2,"color","inherit",3,"routerLink","queryParams"],[4,"ngIf","ngIfElse"],[1,"col-sm-8","inventory"],[1,"row","mb-8"],[1,"d-flex"],["aria-hidden","true",1,"fa-archive","fa-solid","fa-1x","pt-3","pe-2"],[2,"font-size","15px","font-family","'Roboto Slab'"],[1,"table","table-bordered","text-center","inventory-table"],[1,"table-light","py-6","border-end",2,"text-transform","none"],[1,"table-light","py-6",2,"text-transform","none"],[1,"row"],[1,"col-6"],[1,"table","table-bordered",2,"width","171px"],[1,"table-light",2,"text-transform","none"],[1,"pe-6","text-end"],["class","col-6",4,"ngIf"],["aria-hidden","true",1,"fa-solid","fa-image","fa-5x"],[1,"border","rounded",3,"src"],[1,"py-6"],[1,"p-0"],["type","text","autoNum","",1,"form-control","border-0","bg-white","text-end",3,"ngModelChange","ngModel","readonly"],["ngClass","ms-3"],[1,"table","table-bordered","text-center"],[1,"table-light"],[3,"cartItemChange","entityId","cartItem"]],template:function(t,n){t&1&&(r(0,"modal-material",3),d("onOk",function(){return n.onSave()})("onCancel",function(){return n.onCancel()})("onClose",function(){return n.onCancel()}),r(1,"content",4)(2,"div",5)(3,"div",6)(4,"div")(5,"a",7),d("click",function(){return n.tabState="CART"}),s(6," Cart "),a(),v(7,Qn,3,3,"ng-container",8)(8,Ln,3,3,"ng-container",8),a()(),r(9,"div",9),v(10,Hn,22,9,"ng-container",8)(11,Zn,39,16,"ng-container",8)(12,ei,2,2,"ng-container",8),a()()()()),t&2&&(m("config",n.modalConfig),l(5),m("ngClass",q(7,Ot,n.tabState=="CART")),l(2),m("ngIf",n.showProductTab()),l(),m("ngIf",n.isSerialItem()),l(2),m("ngIf",n.tabState=="CART"),l(),m("ngIf",n.tabState=="PRODUCT"),l(),m("ngIf",n.tabState=="SERIAL"))},dependencies:[O,Z,H,De,ee,Ae,Ne,yn,ie,te,J,ne,ge,fe,un,pn,Ke,Je,ct,Ee,Me,xn,hn,ut,Te],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.inventory-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .inventory-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{line-height:6px!important}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519}.input-cart[_ngcontent-%COMP%]{height:36px!important}"]})};var me=class o{httpService=u(K);storeService=u(P);factoryService=u(be);pricebookService=u(ve);dialog=u(oe);variantSearchCtrl=new Pe;viewContainerRef=u(Ut);selectedCustomer;cartItemEvent=new wt;onEditCartItems$=U(this.storeService.cartItems).pipe(E(()=>this.storeService.state()==1),pe(e=>({action:"INIT",items:e})),Ft());applyCustomerPricebook$=U(this.storeService.customer).pipe(T(e=>{this.onApplyCustomerPricebook(e)}),F());cartItems$=kt(this.onEditCartItems$,this.cartItemEvent.asObservable()).pipe(Rt((e,t)=>{let n=[];switch(t.action){case"INIT":n=t.items;break;case"ADD":n=this.addNewItem(e,t);break;case"UPDATE":n=this.updateItems(e,t);break;case"REMOVE":n=e.filter((i,c)=>t.index!==c);break;case"CLEAR":n=[];break;case"PURCHASE":n=this.updateItems(e,t);break;case"RETURN":n=this.updateItems(e,t);break;case"DROP":n=t.items;break}return this.storeService.updateCartItems(n),n},this.storeService.cartItems()));addCartItemBySearch$=this.variantSearchCtrl.valueChanges.pipe(E(e=>g.IsNotEmpty(e)),T(e=>{e.type==="ID"?this.addItemByVariantId(e.str):e.type==="Code"&&this.addItemByVariantCode(e.str)}),F());constructor(){this.addCartItemBySearch$.subscribe(),this.applyCustomerPricebook$.subscribe()}onApplyCustomerPricebook(e){let t=[],n=this.storeService.cartItems();g.IsNotEmpty(e.PricebookID)?(this.selectedCustomer=e,t=this.pricebookService.applyCustomerPricebook()):g.IsNotEmpty(this.selectedCustomer)&&(t=this.pricebookService.removeCustomerPricebook(this.selectedCustomer),this.selectedCustomer=null),n.forEach((i,c)=>{let x=t.find(I=>I.VariantID===i.VariantID);x&&this.updateCartItem({cartItem:x,index:c})})}onApplyPricebook(e){return this.pricebookService.autoApplyPricebook(e)}onOpenAddDialog(){this.dialog.open(Le,{data:new Ce,viewContainerRef:this.viewContainerRef}).afterClosed().pipe(E(e=>g.IsNotEmpty(e))).subscribe(e=>{this.cartItemEvent.next({item:e,action:"ADD",newRow:!0})})}onOpenEditDialog(e){this.dialog.open(Le,{data:R({},e.cartItem),viewContainerRef:this.viewContainerRef}).afterClosed().pipe(E(t=>g.IsNotEmpty(t))).subscribe(t=>{this.cartItemEvent.next({item:t,action:"UPDATE",index:e.index})})}onSelectQuickkeyItem(e){this.addItemByVariantId(e)}addNewItem(e,t){let n=[],i=e.find(c=>c.VariantID===t.item?.VariantID);return i?t.newRow?(t.item=this.onApplyPricebook(t.item),n=[...e,t.item]):(i.Quantity+=1,i=this.onApplyPricebook(i),n=[...e]):(t.item=this.onApplyPricebook(t.item),n=[...e,t.item]),n}updateItems(e,t){return e.map((i,c)=>c===t.index?cn(Ce,t.item):i)}onDropItems(e){this.cartItemEvent.next({action:"DROP",items:e})}addItemByVariantId(e){this.getItemByVariantId(e).pipe(T(t=>{this.cartItemEvent.next({item:t,action:"ADD",newRow:!1})})).subscribe()}addItemByVariantCode(e){this.getItemByVariantByCode(e).pipe(T(t=>{this.cartItemEvent.next({item:t,action:"ADD",newRow:!1})})).subscribe()}removeCartItem(e){this.cartItemEvent.next({action:"REMOVE",index:e.index})}updateCartItem(e){this.cartItemEvent.next({action:"UPDATE",item:e.cartItem,index:e.index})}clearCart(){this.dialog.open(Tn,{data:{title:"Clear Order Items",message:'<p class="h4">Are you sure you want to clear all order items?</p>',headerType:xe.Warning}}).afterClosed().pipe(E(e=>e)).subscribe(()=>{this.cartItemEvent.next({action:"CLEAR"})})}onPurchaseItem(e){this.cartItemEvent.next({action:"PURCHASE",item:e.cartItem,index:e.index})}onReturnItem(e){this.cartItemEvent.next({action:"RETURN",item:e.cartItem,index:e.index})}getItemByVariantId(e){return this.httpService.get(j.GetVariantByID,[{key:"ID",value:e},{key:"EntityID",value:this.storeService.outlet().ID}]).pipe(pe(t=>this.factoryService.generateCartItem(t)))}getItemByVariantByCode(e){return this.httpService.get(j.GetVariantByCode,[{key:"Code",value:e},{key:"EntityID",value:this.storeService.outlet().ID},{key:"Promotion",value:!0}]).pipe(pe(t=>this.factoryService.generateCartItem(t)))}getVariantInventory(e){return this.httpService.get(j.GetVariantStockByID,[{key:"EntityID",value:this.storeService.outlet().ID},{key:"ID",value:e}])}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};function ti(o,e){if(o&1&&(r(0,"td",29),s(1),a()),o&2){let t=p().index;l(),S(" ",t+1,". ")}}function ni(o,e){if(o&1&&(y(0),r(1,"div",30),D(2,"img",31),a(),h()),o&2){let t=p().$implicit;l(2),m("src",t.ThumbnailUrl,qe)}}function ii(o,e){o&1&&(r(0,"div",32),D(1,"i",33),a())}function oi(o,e){if(o&1&&D(0,"small",16),o&2){let t=p().$implicit;m("innerHtml",t.Note,Bt)}}function ri(o,e){if(o&1&&(y(0),r(1,"span",24),s(2),b(3,"number"),a(),h()),o&2){let t=p().$implicit;l(2),B(Mt(3,1,t.Quantity,"1.0-4"))}}function ai(o,e){if(o&1&&(y(0),r(1,"span",34),s(2,"x"),a(),r(3,"div",35)(4,"span",36),s(5),b(6,"number"),a()(),h()),o&2){let t=p().$implicit;l(5),B(_(6,1,t.UnitQuantity))}}function ci(o,e){if(o&1&&(y(0),r(1,"span",37),s(2),b(3,"number"),a(),h()),o&2){let t=p().$implicit;l(2),S("@",_(3,1,t.VariantUnitQuantity),"")}}function li(o,e){if(o&1&&(y(0),r(1,"small",38),s(2),a(),h()),o&2){let t=p().$implicit;l(2),B(t.UOM?t==null?null:t.UOMName:"")}}function si(o,e){if(o&1&&(y(0),r(1,"div",39),s(2),b(3,"number"),a(),h()),o&2){let t=p().$implicit;l(2),S(" ",Mt(3,1,t.Price,"1.0-4")," ")}}function mi(o,e){if(o&1){let t=N();y(0),r(1,"tr",9),d("contextmenu",function(i){let c=f(t),x=c.$implicit,I=c.index,ae=p(2);return C(ae.onContextMenu(i,x,I))}),v(2,ti,2,1,"td",10),r(3,"td",11),d("click",function(){let i=f(t),c=i.$implicit,x=i.index,I=p(2);return C(I.onEdit(c,x))}),r(4,"div",12),v(5,ni,3,1,"ng-container",3)(6,ii,2,0,"ng-template",null,2,le),r(8,"div",13)(9,"div"),s(10),a(),r(11,"span",14),s(12),a(),r(13,"div"),D(14,"app-serial-note",15),a(),v(15,oi,1,1,"small",16),a()()(),r(16,"td",17),d("click",function(){let i=f(t),c=i.$implicit,x=i.index,I=p(2);return C(I.onEdit(c,x))}),r(17,"div",18)(18,"div",19),v(19,ri,4,4,"ng-container",20)(20,ai,7,3,"ng-container",20)(21,ci,4,3,"ng-container",20)(22,li,3,1,"ng-container",20),a()()(),r(23,"td",21),d("click",function(){let i=f(t),c=i.$implicit,x=i.index,I=p(2);return C(I.onEdit(c,x))}),v(24,si,4,4,"ng-container",20),a(),r(25,"td",21),d("click",function(){let i=f(t),c=i.$implicit,x=i.index,I=p(2);return C(I.onEdit(c,x))}),r(26,"div",22),s(27),b(28,"number"),a()(),r(29,"td",23),d("click",function(){let i=f(t),c=i.$implicit,x=i.index,I=p(2);return C(I.onEdit(c,x))}),r(30,"div",18)(31,"div",24),s(32),b(33,"number"),a()()(),r(34,"td",25)(35,"div",26)(36,"span",27),d("click",function(){let i=f(t),c=i.$implicit,x=i.index,I=p(2);return C(I.onRemove(c,x))}),D(37,"i",28),a()()()(),h()}if(o&2){let t=e.$implicit,n=z(7),i=p(2);l(2),m("ngIf",i.appConfig==null?null:i.appConfig.ModuleSell.Grid.RowNumberVisible),l(3),m("ngIf",t.ThumbnailUrl)("ngIfElse",n),l(5),B(t.Name),l(2),B(t.Code),l(2),m("serials",t==null?null:t.Serial),l(),He(t.Note?15:-1),l(4),m("ngIf",t.Quantity!==1&&t.Quantity!==0||t.UnitQuantity>1||t.VariantUnitQuantity>1),l(),m("ngIf",t.UnitQuantity>1),l(),m("ngIf",t.VariantUnitQuantity>1),l(),m("ngIf",t.UOM&&(i.appConfig==null||i.appConfig.ModuleSell==null?null:i.appConfig.ModuleSell.Grid.UOMVisible)),l(2),m("ngIf",t.Price!==t.Total),l(3),S(" ",t.Discount?_(28,14,t.Discount*-1)+"%":""," "),l(5),S(" ",i.roleService.product!=null&&i.roleService.product.Price?_(33,16,t.Total):" - "," ")}}function pi(o,e){if(o&1){let t=N();y(0),r(1,"table",6)(2,"tbody",7),d("cdkDropListDropped",function(i){f(t);let c=p();return C(c.onDrop(i))}),v(3,mi,38,18,"ng-container",8),a()(),h()}if(o&2){let t=p();l(3),m("ngForOf",t.cartItems)}}function ui(o,e){o&1&&(r(0,"div",40)(1,"div",41)(2,"div",42)(3,"div",43)(4,"div",44),D(5,"i",45),a(),r(6,"div",46)(7,"span"),s(8,"Empty Cart"),a(),D(9,"br"),r(10,"span"),s(11,"Add products to the cart"),a(),D(12,"br"),r(13,"span"),s(14,"or scan barcode"),a()()()()()())}function di(o,e){if(o&1){let t=N();r(0,"button",47),d("click",function(){let i=f(t).item,c=p();return C(c.onReverse(i,!0))}),s(1,"Return"),a(),r(2,"button",47),d("click",function(){let i=f(t).item,c=p();return C(c.onReverse(i,!1))}),s(3,"Purchase"),a()}}var dt=class o{roleService=u(de);appConfig;cartItems=[];set _cartItems(e){e&&(this.cartItems=[...e])}onRemoveEvent=new A;onEditEvent=new A;onDropItems=new A;onReturnEvent=new A;onPurchaseEvent=new A;contextMenu;contextMenuPosition={x:"0px",y:"0px"};onContextMenu(e,t,n){e.preventDefault(),this.contextMenuPosition.x=e.clientX+"px",this.contextMenuPosition.y=e.clientY+"px",t.Index=n,this.contextMenu.menuData={item:t},this.contextMenu.openMenu()}onDrop(e){Kt(this.cartItems,e.previousIndex,e.currentIndex),this.onDropItems.emit(this.cartItems)}onEdit(e,t){this.onEditEvent.emit({cartItem:e,index:t})}onRemove(e,t){this.onRemoveEvent.emit({cartItem:e,index:t})}onReverse(e,t){let n=e.Index;t?(e.Quantity>0&&(e.Quantity=e.Quantity*-1),this.onReturnEvent.emit({cartItem:e,index:n})):(e.Quantity<0&&(e.Quantity=e.Quantity*-1),this.onPurchaseEvent.emit({cartItem:e,index:n}))}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["POS-cart-display"]],viewQuery:function(t,n){if(t&1&&Lt(nt,7),t&2){let i;Wt(i=qt())&&(n.contextMenu=i.first)}},inputs:{appConfig:"appConfig",_cartItems:[0,"cartItems","_cartItems"]},outputs:{onRemoveEvent:"onRemove",onEditEvent:"onEdit",onDropItems:"onDropItems",onReturnEvent:"onReturn",onPurchaseEvent:"onPurchase"},decls:7,vars:7,consts:[["EMPTY_CART",""],["contextMenu","matMenu"],["NO_IMAGE",""],[4,"ngIf","ngIfElse"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],["matMenuContent",""],[1,"table","table-borderless"],["cdkDropList","",3,"cdkDropListDropped"],[4,"ngFor","ngForOf"],["cdkDrag","",1,"border-bottom",3,"contextmenu"],["style","width: 10px",4,"ngIf"],[1,"pe-0",2,"width","50%",3,"click"],[1,"d-flex","align-items-center"],[1,"d-block","ms-4",2,"line-height","18px"],[1,"fw-normal","fs-6","text-muted"],[3,"serials"],["title","Note",1,"special-TinyMCE","m-0","fst-italic","d-block",3,"innerHtml"],[1,"px-0","text-end",2,"width","15%",3,"click"],[1,"d-flex","align-items-center","justify-content-end"],[1,"d-flex","text-end","fw-normal","align-items-center",2,"line-height","20px"],[4,"ngIf"],[3,"click"],[1,"fw-normal","fs-5","text-danger"],[1,"pe-0",3,"click"],[1,"fs-5"],[1,"mt-6","ps-0"],[1,"d-flex","justify-content-end","align-items-center"],["role","button","title","Delete Item",1,"fs-3","cursor-pointer",3,"click"],[1,"fa","fa-trash","text-danger","fs-4"],[2,"width","10px"],[1,"ratio","ratio-1x1",2,"width","55px"],[1,"item-image",3,"src"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],[1,"fs-6","me-1","ms-1"],[1,"d-flex","algin-items-center"],["title","Unit Quantity",1,"fs-5","me-1"],["title","Variant Unit Quantity",1,"fs-5"],["title","UOM",1,"ps-1","fs-5"],[1,"fs-5","text-end"],[1,"row","g-0","h-100"],[1,"col-12"],[1,"d-flex","justify-content-center","align-items-center","h-100"],[1,"row"],[1,"col-12","d-flex","justify-content-center"],[1,"fa-regular","fa-cart-arrow-up","text-secondary",2,"font-size","110px"],[1,"col-12","justify-content-center","text-center","mt-5","empty-cart-description","text-secondary","headings-font-family"],["mat-menu-item","",3,"click"]],template:function(t,n){if(t&1&&(v(0,pi,4,1,"ng-container",3)(1,ui,15,0,"ng-template",null,0,le),D(3,"div",4),r(4,"mat-menu",null,1),v(6,di,4,0,"ng-template",5),a()),t&2){let i=z(2),c=z(5);m("ngIf",n.cartItems.length>0)("ngIfElse",i),l(3),Qt("left",n.contextMenuPosition.x)("top",n.contextMenuPosition.y),m("matMenuTriggerFor",c)}},dependencies:[O,ue,H,ee,Zt,Xt,Yt,En,_n,bn,Cn,gn,fn,nt],styles:[".item-image[_ngcontent-%COMP%]{height:50px;width:56px;display:block;border:solid 1px #dddddd;border-radius:5px;object-fit:contain}.example-menu[_ngcontent-%COMP%]{display:inline-flex;flex-direction:column;min-width:180px;max-width:280px;background-color:#fff;padding:6px 0}.example-menu-item[_ngcontent-%COMP%]{background-color:transparent;cursor:pointer;border:none;-webkit-user-select:none;user-select:none;min-width:64px;line-height:36px;padding:0 16px;display:flex;align-items:center;flex-direction:row;flex:1}.example-menu-item[_ngcontent-%COMP%]:hover{background-color:#f5f5f5}.example-menu-item[_ngcontent-%COMP%]:active{background-color:#dcdcdc}.table[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:not(caption) > *[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{padding:12px 10px} .cdk-menu.cdk-menu-group.example-menu{box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.empty-cart-description[_ngcontent-%COMP%]{font-size:14px;font-weight:500;color:#c7c7c7}"]})};var fi=(o,e)=>({"text-danger":o,"text-custom-warning":e});function Ci(o,e){if(o&1&&(r(0,"mat-option",6)(1,"div",7)(2,"div",8)(3,"div"),s(4),a()()()()),o&2){let t=e.$implicit,n=p();m("value",t),l(2),m("ngClass",$t(4,fi,t.StateID==n.customerState.Suspended,t.StateID==n.customerState.WaitingForApproval))("title",t.StateID==n.customerState.Suspended?"Suspended":t.StateID==n.customerState.WaitingForApproval?"Waiting for Approval":""),l(2),B(t==null?null:t.Value)}}var gt=class o{httpService=u(K);customerCtrl=new Pe;customerFiltered$=this.customerCtrl.valueChanges.pipe(E(e=>typeof e=="string"&&e.length>=3),At(300),Y(e=>this.getCustomerSuggestion(e)));customerSelected$=this.customerCtrl.valueChanges.pipe(E(e=>typeof e!="string"),T(e=>{this.onChange(e)}));createNewCustomer=new A;clickInput=new A;customerState=In;constructor(){this.customerSelected$.pipe(F()).subscribe()}getCustomerSuggestion(e){return this.httpService.get(j.GetCustomerSuggestions,[{key:"count",value:100},{key:"prefix",value:e}])}displayFn(e){return e?.Value}onCreateCustomer(){this.createNewCustomer.emit()}onClickInputValue(){this.clickInput.emit()}onChange=e=>{};onTouched=()=>{};writeValue(e){this.customerCtrl.patchValue(e,{onlySelf:!0,emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["POS-customer-autocomplete"]],outputs:{createNewCustomer:"onCreateNewCustomer",clickInput:"onClickInput"},features:[Ie([{provide:Xe,multi:!0,useExisting:o}])],decls:7,vars:6,consts:[["auto","matAutocomplete"],[1,"d-flex","align-items-center","position-relative"],["matTooltipPosition","above","matTooltip","New Customer","role","button",1,"fa-light","fa-user-plus","position-absolute","cursor-pointer",2,"font-size","12px",3,"click"],["type","text","placeholder","Assign Customer",3,"click","formControl","matAutocomplete"],[3,"displayWith"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"ms-3","text-wrap","text-break",3,"ngClass","title"]],template:function(t,n){if(t&1){let i=N();r(0,"div",1)(1,"i",2),d("click",function(){return f(i),C(n.onCreateCustomer())}),a(),r(2,"input",3),d("click",function(){return f(i),C(n.onClickInputValue())}),a(),r(3,"mat-autocomplete",4,0),v(5,Ci,5,7,"mat-option",5),b(6,"async"),a()()}if(t&2){let i=z(4);l(2),m("formControl",n.customerCtrl)("matAutocomplete",i),l(),m("displayWith",n.displayFn),l(2),m("ngForOf",_(6,4,n.customerFiltered$))}},dependencies:[O,Z,ue,De,rn,nn,Jt,on,Ee,te,J,Me,et,Ze,it],styles:["input[_ngcontent-%COMP%]{width:100%;height:38px!important;border-radius:.375rem;border:1px solid #ced4da;padding-left:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i[_ngcontent-%COMP%]{font-size:16px;top:12px;left:11px}.text-custom-warning[_ngcontent-%COMP%]{color:#ff7a00d6}"]})};var We=class o{storeService=u(P);dialog=u(oe);httpService=u(K);createNewCustomer(){this.dialog.open(vn,{data:{options:this.storeService.loadForm()?.EstimateOptions,config:this.storeService.loadForm()?.AppConfigJSON?.ModuleContact,type:"customer",title:"New Customer Form"}}).afterClosed().pipe(E(e=>g.IsNotEmpty(e))).subscribe(e=>{let t=new re;t.Key=e.CustomerID,t.Value=e.ContactName,this.storeService.updateCustomer(t)})}onSelectCustomer(e){let t=this.storeService.outlet();this.httpService.get(j.GetCustomerPrivilegeByID,[{key:"ID",value:e.Key},{key:"EntityID",value:t.ID}]).pipe(Nt(()=>{let n=new re;return this.storeService.updateCustomer(n),Tt})).subscribe(n=>{let i=JSON.parse(JSON.stringify(e));i.PricebookID=n.PricebookID,this.storeService.updateCustomer(i)})}onDeleteCustomer(){g.IsNotEmpty(this.storeService?.customer()?.Key)&&this.dialog.open(Sn,{data:{title:"Re-assign customer",message:"Are you sure to re-assign the customer?"}}).afterClosed().pipe(E(e=>e)).subscribe(()=>{let e=new re;this.storeService.updateCustomer(e)})}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var ft=class o{clickEvent=new A;onClick(){this.clickEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["app-note-button"]],outputs:{clickEvent:"onClickEvent"},decls:2,vars:0,consts:[["type","button",1,"btn","btn-gray","w-100","fs-3","px-0","py-6","headings-font-family",3,"click"],[1,"fa-regular","fa-note-sticky","fa-xl"]],template:function(t,n){t&1&&(r(0,"button",0),d("click",function(){return n.onClick()}),D(1,"i",1),a())},dependencies:[O],styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"]})};function bi(o,e){if(o&1&&(r(0,"div"),s(1),b(2,"number"),a()),o&2){let t=p();l(),S(" ",_(2,1,t.totalAmount)," ")}}function _i(o,e){o&1&&s(0," - ")}var Ct=class o{payEvent=new A;totalItems=0;totalQuantity=0;totalAmount=0;rolePrice=!0;constructor(){}ngOnInit(){}onPay(){this.payEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["app-pay-button"]],inputs:{totalItems:"totalItems",totalQuantity:"totalQuantity",totalAmount:"totalAmount",rolePrice:"rolePrice"},outputs:{payEvent:"onPayEvent"},decls:11,vars:6,consts:[["HIDDENCOST",""],["type","button",1,"btn","btn-success","fs-1","py-4","w-100",3,"click"],[1,"d-flex","align-items-center","justify-content-between"],[1,"fs-6"],[4,"ngIf","ngIfElse"]],template:function(t,n){if(t&1){let i=N();r(0,"button",1),d("click",function(){return f(i),C(n.onPay())}),r(1,"div",2)(2,"div")(3,"span"),s(4,"Submit"),a(),r(5,"small",3),s(6),b(7,"number"),a()(),v(8,bi,3,3,"div",4)(9,_i,1,0,"ng-template",null,0,le),a()()}if(t&2){let i=z(10);l(6),he(" (",_(7,4,n.totalItems)," Items & ",n.totalQuantity," Qty) "),l(2),m("ngIf",n.rolePrice)("ngIfElse",i)}},dependencies:[O,H,ee],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0;position:relative;flex:1 1 auto;border-left:.1px solid #fff}"]})};var bt=class o{clickEvent=new A;onClick(){this.clickEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["app-discount-button"]],outputs:{clickEvent:"onClickEvent"},decls:2,vars:0,consts:[["type","button","matTooltip","Discount / Tax","matTooltipPosition","above",1,"btn","btn-success","fs-5",3,"click"],[1,"fa-light","fa-percent"]],template:function(t,n){t&1&&(r(0,"button",0),d("click",function(){return n.onClick()}),D(1,"i",1),a())},dependencies:[O,et,Ze],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;border-top-right-radius:0;border-bottom-right-radius:0;position:relative;flex:1 1 auto}"]})};var Re=class o{store=u(P);toastr=u(Ye);dialog=u(oe);updateState$=U(this.store.complete).pipe(E(e=>e.Success),T(()=>this.store.updateState(3)),F());constructor(){this.updateState$.subscribe()}onPay(){if(this.validatePayOrder()==!1)return;let t={Items:this.cartItemPreSubmission(),Order:R({},this.store.order())};this.dialog.open(kn,{data:{transactionData:t,api:j.SubmitEstimate}}).afterClosed().pipe(E(n=>g.IsNotEmpty(n))).subscribe(n=>{this.store.updateComplete(n)})}cartItemPreSubmission(){let e=JSON.parse(JSON.stringify(this.store.cartItems()));return e=e.map(t=>(delete t.Variant,t)),e}validatePayOrder(){let e=!0;return g.IsEmpty(this.store.outlet().ID)&&(this.toastr.error("Please select outlet before proceeding..",xe.Error),e=!1),g.IsEmpty(this.store.customer().Key)&&(this.toastr.warning("Please select a customer!",xe.Warning),e=!1),this.store.cartItems().length==0&&(this.toastr.error("You must have at least one item.",xe.Error),e=!1),g.IsEmpty(this.store.order().Number)&&(this.toastr.error("Number cannot be empty.",xe.Error),e=!1),e}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var _t=class o{constructor(e,t){this.dialogRef=t;this.discountAmount.set(e.discountAmount),this.discount.set(e.discount),this.tax=V(e.tax),this.currency=V(e.currency),this.taxes.set(e.taxes),this.initModalConfig()}modalConfig=new ke;discountAmount=V(0);discount=V(0);tax;discounts=V([0,0,0]);currency;taxes=V([]);initModalConfig(){this.modalConfig.title="Discount and Tax",this.modalConfig.customWidth="400px"}onClose(){this.dialogRef.close()}onSave(){this.dialogRef.close({discountAmount:this.discountAmount(),discount:this.discount(),tax:this.tax()})}onSelectTax(e){this.tax.set(e)}onDiscountCalculatorChange(e,t){let n=this.discounts();n[t]=e,this.discounts.set(n),this.calculateDiscountCalculator()}calculateDiscountCalculator(){let e=this.discounts(),t=100;e.forEach(i=>{i&&i>0&&(t=t*(100-i)/100)});let n=100-t;this.discount.set(n)}static \u0275fac=function(t){return new(t||o)(X(we),X(Oe))};static \u0275cmp=M({type:o,selectors:[["app-dialog-discount"]],decls:48,vars:10,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],["matTooltipPosition","above","matTooltip","Discount","tabTitle","Discount"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-3"],[1,"fw-bold","d-block"],[1,"col-9"],["type","text","data-cy","discount1","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],[1,"ms-1"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],["type","text","data-cy","discountamount","autoNum","",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],["matTooltipPosition","above","matTooltip","Tax","tabTitle","Tax"],["bindLabel","Label","appendTo","body","bindValue","ID","placeholder","Tax","data-cy","Tax",2,"width","150px",3,"change","clearable","ngModel","items"],["matTooltipPosition","above","matTooltip","Calculation","tabTitle","Calculator"],[1,"row","mt-6","g-0","d-flex","align-items-center","justify-content-start"],[1,"col-4"],[1,"col-8","ps-4"],["type","text","data-cy","discountCal1","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"mx-2"],["type","text","data-cy","discountCal2","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal3","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"]],template:function(t,n){if(t&1&&(r(0,"modal-material",0),d("keydown.F2",function(){return n.onSave()})("onOk",function(){return n.onSave()})("onCancel",function(){return n.onClose()})("onClose",function(){return n.onClose()}),r(1,"content")(2,"div",1)(3,"custom-tabs"),y(4),r(5,"tab",2)(6,"div",3)(7,"div",4)(8,"label",5),s(9,"Discount %"),a()(),r(10,"div",6)(11,"input",7),W("ngModelChange",function(c){return L(n.discount,c)||(n.discount=c),c}),a(),r(12,"span",8),s(13,"%"),a()()(),r(14,"div",9)(15,"div",4)(16,"label",5),s(17),a()(),r(18,"div",6)(19,"input",10),W("ngModelChange",function(c){return L(n.discountAmount,c)||(n.discountAmount=c),c}),a()()()(),h(),y(20),r(21,"tab",11)(22,"div",3)(23,"div",4)(24,"label",5),s(25,"Tax"),a()(),r(26,"div",6)(27,"ng-select",12),d("change",function(c){return n.onSelectTax(c)}),a()()()(),h(),y(28),r(29,"tab",13)(30,"div",14)(31,"div",15)(32,"label",5),s(33,"Discount Calculator"),a()(),r(34,"div",16)(35,"input",17),d("ngModelChange",function(c){return n.onDiscountCalculatorChange(c,0)}),a(),r(36,"span"),s(37," %"),a(),r(38,"span",18),s(39,"+"),a(),r(40,"input",19),d("ngModelChange",function(c){return n.onDiscountCalculatorChange(c,1)}),a(),r(41,"span"),s(42," %"),a(),r(43,"span",18),s(44,"+"),a(),r(45,"input",20),d("ngModelChange",function(c){return n.onDiscountCalculatorChange(c,2)}),a(),r(46,"span"),s(47," %"),a()()()(),h(),a()()()()),t&2){let i;m("config",n.modalConfig),l(11),Q("ngModel",n.discount),l(6),S("Discount ",(i=n.currency())==null?null:i.Symbol,""),l(2),Q("ngModel",n.discountAmount),l(8),m("clearable",!1)("ngModel",n.tax().ID)("items",n.taxes()),l(8),m("ngModel",n.discounts[0]),l(5),m("ngModel",n.discounts[1]),l(5),m("ngModel",n.discounts[2])}},dependencies:[O,Ae,Ne,ot,at,rt,ie,te,J,ne,Te,ge,fe],encapsulation:2})};var ye=class o{storeService=u(P);totalItemsQty=$(()=>this.storeService.cartItems().reduce((n,i)=>n+i.Quantity,0));totalItemsAmount=$(()=>this.storeService.cartItems().reduce((n,i)=>n+i.Total,0));taxAmount=$(()=>{let e=this.storeService.tax(),t=0;return e.Rate>0&&(e.CalculationTypeID==1?t=this.calculateTaxInclude(e):t=this.calculateTaxAdd(e)),t});totalAmount=$(()=>{let e=this.storeService.tax(),t=this.storeService.order().DiscountAmount,n=this.storeService.order().Discount,i=this.totalItemsAmount(),c=this.calculatePercentagDisc(n,i),x=i-t-c;return e.CalculationTypeID==0&&(x=x+this.taxAmount()),x});discountPercentageAmount=$(()=>{let e=this.storeService.order().Discount,t=this.totalItemsAmount();return this.calculatePercentagDisc(e,t)});calculateTaxInclude(e){let t=this.grossTotalTaxable();return e.Rate/(100+e.Rate)*t}calculateTaxAdd(e){let t=this.grossTotalTaxable();return e.Rate/100*t}grossTotalTaxable(){let e=this.taxableItems(),t=this.calculateTaxableItemsPrice(),n=this.storeService.discount();if(e.length!==0){let i=this.calculateDiscountTaxableItem();t=t*(100-n.discount)/100,t=t-i}return t}calculateDiscountTaxableItem(){let e=this.taxableItems(),t=this.totalItemsAmount(),n=this.storeService.discount().discountAmount,i=0,c=0,x=0,I=0;for(let ae of e)i=ae.getItemAfterDiscount/t,c=i*n,I=c*ae.Quantity,x+=I;return x}calculatePercentagDisc(e,t){return e/100*t}calculateTaxableItemsPrice(){return this.taxableItems().filter(n=>n.Taxable).reduce((n,i)=>n+i.Total,0)}taxableItems(){return this.storeService.cartItems().filter(t=>t.Taxable)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=k({token:o,factory:o.\u0275fac})};var hi=o=>({selected:o});function xi(o,e){if(o&1){let t=N();r(0,"div",12)(1,"span",13),s(2,"@"),a(),r(3,"input",14),W("ngModelChange",function(i){f(t);let c=p();return L(c.currency().ExchangeRate,i)||(c.currency().ExchangeRate=i),C(i)}),a()()}if(o&2){let t=p();l(3),Q("ngModel",t.currency().ExchangeRate)}}function Si(o,e){if(o&1){let t=N();r(0,"div",15)(1,"label",16)(2,"input",17),d("ngModelChange",function(){let i=f(t).$implicit,c=p();return C(c.onChangeTag(i.ID))}),a(),s(3),a()()}if(o&2){let t,n=e.$implicit,i=e.index,c=p();l(),Pt("for","potype-"+i),m("ngClass",q(5,hi,((t=c.tag())==null?null:t.ID)==n.ID)),l(),Pt("id","potype-"+i),m("ngModel",c.tag().ID),l(),S(" ",n.Name," ")}}var vt=class o{constructor(e,t){this.dialogRef=t;this.initModalConfig(),this.currencies.set(e.currencies),this.tags.set(e.tags),this.tag=V(e.tag),this.currency=V(e.currency),this.defaultCurrencyId=V(e.defaultCurrencyId)}modalConfig=new ke;currencies=V([]);tags=V([]);tag;currency;defaultCurrencyId;initModalConfig(){this.modalConfig.title="Order Note",this.modalConfig.customWidth="700px"}onChangeCurrency(e){let t=this.currencies()?.find(n=>n.ID===e);this.currency.set(t)}onChangeTag(e){let t=this.tags()?.find(n=>n.ID===e);this.tag.set(t)}onClose(){this.dialogRef.close()}onSave(){this.dialogRef.close({currency:this.currency(),tag:this.tag()})}static \u0275fac=function(t){return new(t||o)(X(we),X(Oe))};static \u0275cmp=M({type:o,selectors:[["app-dialog-note"]],decls:16,vars:6,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],["matTooltipPosition","above","matTooltip","Currency","tabTitle","Currency"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],[1,"row","ms-4"],[1,"ps-0","col-sm-4"],["bindLabel","Name","bindValue","ID","placeholder","Currency","appendTo","body",3,"ngModelChange","items","clearable","ngModel"],["class","col-sm-4 d-flex",4,"ngIf"],["matTooltipPosition","above","matTooltip","Tag","tabTitle","Tag"],[1,"row"],[1,"col-12"],["class","rad-btn",4,"ngFor","ngForOf"],[1,"col-sm-4","d-flex"],[1,"pt-4"],["type","text","autoNum","",1,"border","border-light",3,"ngModelChange","ngModel"],[1,"rad-btn"],[3,"for","ngClass"],["type","radio",3,"ngModelChange","ngModel","id"]],template:function(t,n){if(t&1&&(r(0,"modal-material",0),d("keydown.F2",function(){return n.onSave()})("onOk",function(){return n.onSave()})("onCancel",function(){return n.onClose()})("onClose",function(){return n.onClose()}),r(1,"content")(2,"div",1)(3,"custom-tabs"),y(4),r(5,"tab",2)(6,"div",3)(7,"div",4)(8,"div",5)(9,"ng-select",6),d("ngModelChange",function(c){return n.onChangeCurrency(c)}),a()(),v(10,xi,4,1,"div",7),a()()(),h(),y(11),r(12,"tab",8)(13,"div",9)(14,"div",10),v(15,Si,4,7,"div",11),a()()(),h(),a()()()()),t&2){let i;m("config",n.modalConfig),l(9),m("items",n.currencies())("clearable",!1)("ngModel",n.currency().ID),l(),m("ngIf",((i=n.currency())==null?null:i.ID)!=n.defaultCurrencyId()),l(5),m("ngForOf",n.tags())}},dependencies:[O,Z,ue,H,Ae,Ne,ot,at,rt,ie,te,Gt,J,ne,Te,ge,fe],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.rad-btn[_ngcontent-%COMP%]{position:relative;display:inline-block}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #dddddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label.selected[_ngcontent-%COMP%]{background:#dcdcdc;border:1px solid #dcdcdc}"]})};var yt=class o{onClickEvent=new A;constructor(){}ngOnInit(){}onClick(){this.onClickEvent.emit()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["app-clear-button"]],outputs:{onClickEvent:"onClickEvent"},decls:3,vars:0,consts:[["type","button",1,"btn","btn-gray","w-100","fs-3","px-0","py-6","headings-font-family",3,"click"]],template:function(t,n){t&1&&(r(0,"button",0),d("click",function(){return n.onClick()}),r(1,"span"),s(2,"Clear"),a()())},styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"]})};function Ii(o,e){if(o&1&&(y(0),r(1,"tr")(2,"th",12),s(3,"Amount"),a(),r(4,"td",13),s(5),b(6,"number"),a()(),h()),o&2){let t=p();l(5),B(_(6,1,t.calculationService==null?null:t.calculationService.totalItemsAmount()))}}function Di(o,e){if(o&1&&(r(0,"tr")(1,"th",12),s(2),a(),r(3,"td",14),s(4),b(5,"number"),a()()),o&2){let t=p(2);l(2),S("Discount ",t.storeService==null?null:t.storeService.discount().discount,"%"),l(2),S(" ",_(5,2,t.calculationService.discountPercentageAmount()*-1),"")}}function Pi(o,e){if(o&1&&(r(0,"tr")(1,"th",12),s(2),a(),r(3,"td",14),s(4),b(5,"number"),a()()),o&2){let t,n,i=p(2);l(2),S("Discount ",(t=i.storeService.currency())==null?null:t.Symbol,""),l(2),S(" ",_(5,2,((n=i.storeService.discount())==null?null:n.discountAmount)*-1),"")}}function Mi(o,e){if(o&1&&(r(0,"tr")(1,"th",12),s(2),a(),r(3,"td",13),s(4),b(5,"number"),a()()),o&2){let t,n=p(2);l(2),B((t=n.storeService.tax())==null?null:t.Label),l(2),B(_(5,2,n.calculationService.taxAmount()))}}function Ei(o,e){if(o&1&&(y(0),v(1,Di,6,4,"tr",3)(2,Pi,6,4,"tr",3)(3,Mi,6,4,"tr",3),h()),o&2){let t,n,i=p();l(),m("ngIf",i.storeService.discount().discount!=0),l(),m("ngIf",((t=i.storeService.discount())==null?null:t.discountAmount)!=0),l(),m("ngIf",((n=i.storeService.tax())==null?null:n.Rate)!=0)}}var ht=class o{storeService=u(P);orderService=u(se);roleService=u(de);payService=u(Re);calculationService=u(ye);cartService=u(me);dialog=u(oe);taxCalculationType=tt;totalItemsQty=$(()=>this.storeService.cartItems()?.length);isShowAmount=$(()=>this.storeService?.tax()?.CalculationTypeID==0&&this.storeService?.tax()?.Rate||this.storeService.discount()?.discount!=0||this.storeService.discount()?.discountAmount!=0);onOpenDialogNote(){this.dialog.open(vt,{data:{tags:this.storeService.loadForm().CustomerPOTypes,currencies:this.storeService.loadForm().Currencies,currency:this.storeService.currency(),tag:this.storeService.tag(),defaultCurrencyId:this.storeService.loadForm()?.AppConfigJSON?.CoreDefaults?.CurrencyID}}).afterClosed().pipe(E(e=>g.IsNotEmpty(e))).subscribe(e=>{this.storeService.updateCurrency(e.currency),this.storeService.updateTag(e.tag)})}onOpenDialogDiscount(){this.dialog.open(_t,{data:{discountAmount:this.storeService.order().DiscountAmount,discount:this.storeService.order().Discount,tax:this.storeService.tax(),currency:this.storeService.currency(),taxes:this.storeService.loadForm().Taxes}}).afterClosed().pipe(E(e=>g.IsNotEmpty(e))).subscribe(e=>{this.storeService.updateDiscount({discountAmount:e.discountAmount,discount:e.discount}),this.storeService.updateTax(e.tax)})}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["POS-cart-action"]],decls:13,vars:6,consts:[[1,"row","g-0","px-5","justify-content-end"],[1,"col-6",2,"padding-right","15px"],[1,"table","table-borderless"],[4,"ngIf"],[1,"row","g-0","pb-6","px-5"],[1,"col-5","d-flex","justify-content-between","pe-5",2,"column-gap","12px"],[2,"flex-grow","1",3,"onClickEvent"],[2,"flex-grow","3",3,"onClickEvent"],[1,"col-7"],[1,"btn-group","w-100"],[1,"d-inline-flex",3,"onClickEvent"],[1,"d-inline-flex","w-100",3,"onPayEvent","rolePrice","totalQuantity","totalItems","totalAmount"],[1,"text-start"],[1,"text-end","fs-5"],[1,"text-end","fs-5","text-danger"]],template:function(t,n){t&1&&(r(0,"div",0)(1,"div",1)(2,"table",2),v(3,Ii,7,3,"ng-container",3)(4,Ei,4,3,"ng-container",3),a()()(),r(5,"div",4)(6,"div",5)(7,"app-note-button",6),d("onClickEvent",function(){return n.onOpenDialogNote()}),a(),r(8,"app-clear-button",7),d("onClickEvent",function(){return n.cartService.clearCart()}),a()(),r(9,"div",8)(10,"div",9)(11,"app-discount-button",10),d("onClickEvent",function(){return n.onOpenDialogDiscount()}),a(),r(12,"app-pay-button",11),d("onPayEvent",function(){return n.payService.onPay()}),a()()()()),t&2&&(l(3),m("ngIf",n.isShowAmount()),l(),m("ngIf",n.calculationService.totalItemsQty()>0),l(8),m("rolePrice",n.roleService.product.Price)("totalQuantity",n.calculationService.totalItemsQty())("totalItems",n.totalItemsQty())("totalAmount",n.calculationService.totalAmount()))},dependencies:[O,H,ee,bt,ft,Ct,yt],encapsulation:2})};var Fn=o=>({ID:o}),Oi=()=>["/menu/Orders/Orders/Estimate/Info"],wi=o=>({"border-top":o});function Ti(o,e){if(o&1&&(y(0),r(1,"div",28)(2,"div",29),s(3),a(),r(4,"div",29),s(5),b(6,"number"),a()(),h()),o&2){let t=e.$implicit;l(3),B(t.Name),l(2),S("",_(6,2,t.Total)," ")}}function ki(o,e){if(o&1&&(y(0),r(1,"div",30)(2,"div",31),s(3),a(),r(4,"div",31),s(5),b(6,"number"),a()(),h()),o&2){let t,n=p();l(3),S("Amount: ",(t=n.storeService.currency())==null?null:t.Symbol,""),l(2),B(_(6,2,n.calculationService.totalItemsAmount()))}}function Ni(o,e){if(o&1&&(r(0,"div",32)(1,"div",31),s(2),b(3,"number"),a(),r(4,"div",33),s(5),b(6,"number"),a()()),o&2){let t,n=p();l(2),he("","Discount "+_(3,3,(t=n.storeService.discount())==null?null:t.discount)+" %",": ",(t=n.storeService.currency())==null?null:t.Symbol,""),l(3),B(_(6,5,n.calculationService.discountPercentageAmount()*-1))}}function Ai(o,e){if(o&1&&(r(0,"div",32)(1,"div",31),s(2),a(),r(3,"div",33),s(4),b(5,"number"),a()()),o&2){let t,n,i=p();l(2),S("Discount: ",(t=i.storeService.currency())==null?null:t.Symbol,""),l(2),S("",_(5,2,((n=i.storeService.discount())==null?null:n.discountAmount)*-1)," ")}}function Vi(o,e){if(o&1&&(r(0,"div",32)(1,"div",31),s(2),a(),r(3,"div",31),s(4),b(5,"number"),a()()),o&2){let t,n=p();l(2),he("",(t=n.storeService.tax())==null?null:t.Label,": ",(t=n.storeService.currency())==null?null:t.Symbol,""),l(2),B(_(5,3,n.calculationService.taxAmount()))}}var xt=class o{orderService=u(se);calculationService=u(ye);storeService=u(P);isShowAmount=$(()=>this.storeService?.tax()?.CalculationTypeID==0&&this.storeService?.tax()?.Rate||this.storeService.discount()?.discount!=0||this.storeService.discount()?.discountAmount!=0);handleF8(){this.orderService.newOrder()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["POS-complete"]],hostBindings:function(t,n){t&1&&d("keydown.F8",function(c){return n.handleF8(c)},!1,$e)},decls:40,vars:21,consts:[[1,"pt-7",2,"border-bottom","1px solid rgba(0, 0, 0, 0.1)"],[1,"ps-7","fw-normal","pb-9"],[1,"order-complete"],[1,"container-fluid","pt-8"],[1,"row"],[1,"col-8"],[1,"card"],[1,"card-header",2,"padding-bottom","15px"],[1,"fw-normal",2,"font-size","32px"],[1,"fa-solid","fa-check","me-3"],[1,"card-body"],[1,"row",2,"height","115px"],[1,"col","text-center","my-auto"],[1,"btn","btn-success","w-50",2,"font-size","20px",3,"click"],[1,"card-footer"],[1,"d-flex","justify-content-between","my-6"],["target","_blank","routerLink","/print/Estimate",1,"btn","bg-light-gray","btn-secondary",3,"queryParams"],[1,"fa-solid","fa-print","me-2"],[1,"col-4"],[1,"card-header","bg-light-gray",2,"padding-bottom","15px"],[1,"fst-italic"],["target","_blank",3,"routerLink","queryParams"],[1,"card-body","py-4"],[4,"ngFor","ngForOf"],[4,"ngIf"],["class","row justify-content-end pb-2",4,"ngIf"],[1,"row","justify-content-end","pt-4",3,"ngClass"],[1,"col-4","text-end","h5"],[1,"row","justify-content-between","border-bottom","py-2"],[1,"col","text-end"],[1,"row","justify-content-end","mt-2","pb-2"],[1,"col-4","text-end"],[1,"row","justify-content-end","pb-2"],[1,"col-4","text-end","text-danger"]],template:function(t,n){if(t&1&&(r(0,"div",0)(1,"h1",1),s(2,"Estimate"),a()(),r(3,"section",2)(4,"div",3)(5,"div",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"h1",8),D(10,"i",9),s(11,"Order Complete "),a()(),r(12,"div",10)(13,"div",11)(14,"div",12)(15,"a",13),d("click",function(){return n.orderService.newOrder()}),s(16,"New Order (F8)"),a()()()(),r(17,"div",14)(18,"div",15)(19,"a",16),D(20,"i",17),s(21,"Print Receipt"),a()()()()(),r(22,"div",18)(23,"div",6)(24,"div",19)(25,"h3",20)(26,"a",21),s(27),a()()(),r(28,"div",22),v(29,Ti,7,4,"ng-container",23)(30,ki,7,4,"ng-container",24)(31,Ni,7,7,"div",25)(32,Ai,6,4,"div",25)(33,Vi,6,5,"div",25),r(34,"div",26)(35,"div",27),s(36),a(),r(37,"div",27),s(38),b(39,"number"),a()()()()()()()()),t&2){let i,c,x,I,ae;l(19),m("queryParams",q(14,Fn,n.storeService.complete().OrderID)),l(7),m("routerLink",Ge(16,Oi))("queryParams",q(17,Fn,n.storeService.complete().OrderID)),l(),S("Estimate #",(i=n.storeService.complete())==null?null:i.InvoiceNumber,""),l(2),m("ngForOf",n.storeService.cartItems()),l(),m("ngIf",n.isShowAmount()),l(),m("ngIf",((c=n.storeService.discount())==null?null:c.discount)>0),l(),m("ngIf",((x=n.storeService.discount())==null?null:x.discountAmount)>0),l(),m("ngIf",((I=n.storeService.tax())==null?null:I.Rate)>0),l(),m("ngClass",q(19,wi,n.isShowAmount())),l(2),S("Total: ",(ae=n.storeService.currency())==null?null:ae.Symbol,""),l(2),B(_(39,12,n.calculationService.totalAmount()))}},dependencies:[O,Z,ue,H,ee,Ke,Je,an],styles:[".order-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%]{border-bottom:1px solid rgba(0,0,0,.125);padding-bottom:.9375rem}.order-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:2rem}.order-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%] .container[_ngcontent-%COMP%]{max-width:500px;margin-top:30px;margin-bottom:30px}"]})};var St=class o{route=u(ze);dialog=u(oe);addItem=new A;handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.onAddItem()}onAddItem(){this.addItem.emit()}redirectToPrevious(){this.route.navigate(["/menu/Estimate/V1"])}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=M({type:o,selectors:[["POS-more-action"]],hostBindings:function(t,n){t&1&&d("keydown.F4",function(c){return n.handleF8(c)},!1,$e)},outputs:{addItem:"onAddItem"},decls:14,vars:0,consts:[["id","moreMenu","data-bs-toggle","dropdown",1,"d-flex","align-items-center","cursor-pointer"],[1,"me-2"],[1,"fa-solid","fa-caret-down","fa-lg"],[1,"fs-6","headings-font-family","pb-1"],[1,"h-100","d-flex","align-items-center","justify-content-between"],["aria-labelledby","moreMenu",1,"dropdown-menu","more-actions"],[1,"d-flex"],[1,"dropdown-header","text-dark","col"],[1,"h5","mb-4"],[1,"dropdown-divider","m-0"],[1,"cursor-pointer",3,"click"],["icon","fa-circle-plus fa-solid","label","Add New"]],template:function(t,n){t&1&&(r(0,"span",0)(1,"span",1),D(2,"i",2),a(),r(3,"span",3),s(4,"More Actions"),a()(),r(5,"div",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"div",8),s(10,"Item"),a(),D(11,"div",9),r(12,"li",10),d("click",function(){return n.onAddItem()}),D(13,"POS-dropdown-item-more-action",11),a()()()()())},dependencies:[O,On],encapsulation:2})};function Fi(o,e){o&1&&(y(0),D(1,"POS-complete"),h())}function Ri(o,e){if(o&1){let t=N();r(0,"div",3)(1,"div",4)(2,"div",5)(3,"div",6)(4,"div",7)(5,"POS-select-outlet-form",8),b(6,"async"),d("ngModelChange",function(i){f(t);let c=p();return C(c.outletService.updateOutlet(i))}),a()(),r(7,"POS-invoice-number-form",9),b(8,"async"),d("ngModelChange",function(i){f(t);let c=p();return C(c.orderService.updateOrderNumber(i))}),a(),r(9,"POS-invoice-date",10),d("ngModelChange",function(i){f(t);let c=p();return C(c.orderService.updateOrderDate(i))}),a()()(),r(10,"div",11)(11,"div",12)(12,"div",13)(13,"POS-more-action",14),d("onAddItem",function(){f(t);let i=p();return C(i.cartItemService.onOpenAddDialog())}),a()(),r(14,"div",15)(15,"ng-select-infinite",16,1),b(17,"async"),d("selectedChange",function(i){f(t);let c=p();return C(c.orderService.updateSalesPersonId(i))}),a()()()()(),r(18,"div",17)(19,"div",18)(20,"POS-quick-key",19),b(21,"async"),d("onSelectVariant",function(i){f(t);let c=p();return C(c.cartItemService.onSelectQuickkeyItem(i))}),a()(),r(22,"div",20)(23,"div",21)(24,"div",22),D(25,"POS-variant-autocomplete",23),a(),r(26,"div",15)(27,"POS-customer-autocomplete",24),d("onCreateNewCustomer",function(){f(t);let i=p();return C(i.customerService.createNewCustomer())})("ngModelChange",function(i){f(t);let c=p();return C(c.customerService.onSelectCustomer(i))})("onClickInput",function(){f(t);let i=p();return C(i.customerService.onDeleteCustomer())}),a()()(),r(28,"POS-cart-display",25),b(29,"async"),d("onRemove",function(i){f(t);let c=p();return C(c.cartItemService.removeCartItem(i))})("onEdit",function(i){f(t);let c=p();return C(c.cartItemService.onOpenEditDialog(i))})("onDropItems",function(i){f(t);let c=p();return C(c.cartItemService.onDropItems(i))})("onPurchase",function(i){f(t);let c=p();return C(c.cartItemService.onPurchaseItem(i))})("onReturn",function(i){f(t);let c=p();return C(c.cartItemService.onReturnItem(i))}),a(),D(30,"POS-cart-action"),a()()()}if(o&2){let t,n=p();l(5),m("ngModel",n.storeService.outlet())("outlets",n.storeService.loadForm().Entities)("isOpenAfterLoad",_(6,18,n.outletService.isOpenDialog$)),l(2),m("ngModel",_(8,20,n.orderService.orderNumber$))("isEdit",n.isEditOrder()),l(2),m("ngModel",n.storeService.order().Date)("disabled",!(!(n.role==null||n.role.global==null)&&n.role.global.Date))("tooltip",!(n.role==null||n.role.global==null)&&n.role.global.Date?"":"Date role is required"),l(6),m("clearable",!0)("optionTitle",!0)("items",_(17,22,n.orderService.salesPersons$))("selected",n.storeService.order().SalesID),l(5),m("quickKey",_(21,24,n.quickkeyService.quickkeys$))("outletID",n.storeService.outlet().ID),l(5),m("formControl",n.cartItemService.variantSearchCtrl),l(2),m("ngModel",n.storeService.customer()),l(),m("cartItems",_(29,26,n.cartItemService.cartItems$))("appConfig",(t=n.storeService.loadForm())==null?null:t.AppConfigJSON)}}var Rn=class o extends en{loadFormService=u(Be);storeService=u(P);role=u(de);outletService=u(Ue);orderService=u(se);quickkeyService=u(je);cartItemService=u(me);customerService=u(We);intercomService=u(zt);isCompleteOrder=$(()=>this.storeService.state()==3);isEditOrder=$(()=>this.storeService.state()==1);constructor(e){super(e),this.menuData$.subscribe(),this.intercomService.hideLauncher()}ngOnDestroy(){this.intercomService.showLauncher()}static \u0275fac=function(t){return new(t||o)(X(tn))};static \u0275cmp=M({type:o,selectors:[["POS-estimate-v2"]],features:[Ie([P,Be,Ue,se,je,me,We,Re,ye,be,ve]),jt],decls:3,vars:2,consts:[["NOT_COMPLETE",""],["ngSelectInfinite",""],[4,"ngIf","ngIfElse"],[1,"container-fluid"],[1,"row","header","border-bottom"],[1,"col-5","border-end"],[1,"left-toolbar-container","h-100","d-flex","align-items-center","justify-content-between"],[1,"d-flex"],[3,"ngModelChange","ngModel","outlets","isOpenAfterLoad"],["transactionType","Estimate",3,"ngModelChange","ngModel","isEdit"],[3,"ngModelChange","ngModel","disabled","tooltip"],[1,"col-7","d-flex","align-items-center"],[1,"row","flex-grow-1"],[1,"col-lg-7","col-5","d-flex","align-items-center"],[3,"onAddItem"],[1,"col-5","ps-0"],["bindValue","ID","bindLabel","Name","placeholder","Assign Sales Person",1,"sales-person","select-max-width",3,"selectedChange","clearable","optionTitle","items","selected"],[1,"row","content"],[1,"col-5","border-end","pt-1"],[3,"onSelectVariant","quickKey","outletID"],[1,"col-7","pt-5","px-0","d-flex","flex-column"],[1,"row","w-100","ms-0"],[1,"col-7","px-0"],[3,"formControl"],[3,"onCreateNewCustomer","ngModelChange","onClickInput","ngModel"],[1,"cart-display",3,"onRemove","onEdit","onDropItems","onPurchase","onReturn","cartItems","appConfig"]],template:function(t,n){if(t&1&&v(0,Fi,2,0,"ng-container",2)(1,Ri,31,28,"ng-template",null,0,le),t&2){let i=z(2);m("ngIf",n.isCompleteOrder())("ngIfElse",i)}},dependencies:[O,H,De,Dn,Ee,J,Me,Pn,ie,ne,dn,sn,ln,Mn,dt,gt,it,ct,ht,xt,St],styles:["ng-select-infinite.sales-person.select-max-width>ng-select{padding-right:10px;height:38px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{font-size:.75rem;border:.5px solid #d7d7d7;padding-right:6px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-arrow-wrapper{width:12px;padding-bottom:2px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-value-container{padding-left:6px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{min-height:38px!important;height:38px!important;border:none} ng-select-infinite.sales-person.select-max-width.offline>.ng-select.ng-select-single .ng-select-container{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input{padding-left:5px!important} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input>input{padding-top:5px} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single>ng-dropdown-panel.ng-dropdown-panel{font-size:.75rem;width:95%!important} ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-focused .ng-select-container{box-shadow:none!important;border-color:transparent!important}.left-toolbar-container[_ngcontent-%COMP%]{position:relative}.left-toolbar-container[_ngcontent-%COMP%] POS-invoice-number-form[_ngcontent-%COMP%]{position:absolute;top:34px;left:28px}.header[_ngcontent-%COMP%]{min-height:60px}.content[_ngcontent-%COMP%]{min-height:calc(100vh - 60px)}.supplier-more-menu[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.cart-display[_ngcontent-%COMP%]{flex-grow:1;height:0px;overflow-y:auto}input[_ngcontent-%COMP%]{width:100%;height:38px!important;border:0;border-bottom:1px solid #ced4da;padding-left:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i[_ngcontent-%COMP%]{font-size:16px;top:10.6px;left:13px}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]{transition:.4s}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(1){-webkit-transform:rotate(-45deg) translate(-8px,4px);transform:rotate(-45deg) translate(-8px,4px)}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(2){opacity:0}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(3){-webkit-transform:rotate(45deg) translate(-5px,0px);transform:rotate(45deg) translate(-5px)}.mobile-button[_ngcontent-%COMP%]{display:none}@media (max-width: 990px){.mobile-button[_ngcontent-%COMP%]{display:block}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.more-actions[_ngcontent-%COMP%] div.d-flex[_ngcontent-%COMP%]{width:30rem}"]})};export{Rn as EstimateV2Component};
|