text: (window.webpackJsonp=window.webpackJsonp||[]).push([[15],{"3m2K":function(e,t,n){"use strict";n.r(t),n.d(t,"PosModule",(function(){return H}));var i=n("ofXK"),l=n("tyNb"),r=n("fXoL");let a=(()=>{class e{}return e.\u0275fac=function(t){return new(t||e)},e.\u0275cmp=r["\u0275\u0275defineComponent"]({type:e,selectors:[["ngx-components"]],decls:1,vars:0,template:function(e,t){1&e&&r["\u0275\u0275element"](0,"router-outlet")},directives:[l.h],encapsulation:2}),e})();var s=n("tk/3"),c=n("++O1"),o=n("FJAD"),d=n("/h6P");let m=(()=>{class e{constructor(e,t){this.http=e,this.pds=t,this.posServiceUrl=c.a.startupStrings.posServiceUrl}getAvailableItems(e=""){let t=(new s.f).set("searchPhase",e);return this.http.get(this.posServiceUrl+"/grn-available-items/search-items",{params:t})}getItemGRNDetails(e){return this.http.get(this.posServiceUrl+"/grn-available-items/"+e)}getUnitMappers(){return this.http.get(this.posServiceUrl+"/units-mappers")}isDiscountApplicable(e,t,n){return!!((e.discountStatus=o.a.ACTIVE)&&(null==e.discountStartDate||null==e.discountStartDate||e.discountStartDate<=new Date)&&(null==e.discountEndDate||null==e.discountEndDate||e.discountEndDate>new Date)&&(null==e.minAmountToQualify||null==e.minAmountToQualify||0==e.minAmountToQualify||t>this.getMappedQty(e.minAmountToQualify,n,e.discountQualifyCheckUnit)))}isMinAmountAchieved(e,t,n,i){return e>this.getMappedQty(i,t,n)}getMappedQty(e,t,n){if(t.unitsId==n.unitsId)return e;this.pds.currentUnitMappers.subscribe(i=>{if(i&&i.length>0){let l=i.filter(e=>e.baseUnits.unitsId==n.unitsId&&e.mappedUnit.unitsId==t.unitsId);if(l&&1==l.length)return e/l[0].qtyOfMappedUnitForBase;{let l=i.filter(e=>e.baseUnits.unitsId==t.unitsId&&e.mappedUnit.unitsId==n.unitsId);return l&&1==l.length?e*l[0].qtyOfMappedUnitForBase:0}}})}}return e.\u0275fac=function(t){return new(t||e)(r["\u0275\u0275inject"](s.b),r["\u0275\u0275inject"](d.a))},e.\u0275prov=r["\u0275\u0275defineInjectable"]({token:e,factory:e.\u0275fac,providedIn:"root"}),e})();var p=n("aceb"),u=n("3Pt+");function h(e,t){1&e&&(r["\u0275\u0275elementStart"](0,"th"),r["\u0275\u0275text"](1," Buying Price "),r["\u0275\u0275elementEnd"]())}function g(e,t){1&e&&(r["\u0275\u0275elementStart"](0,"th"),r["\u0275\u0275text"](1," Selling Price "),r["\u0275\u0275elementEnd"]())}function f(e,t){1&e&&(r["\u0275\u0275elementStart"](0,"th"),r["\u0275\u0275text"](1," Discounts "),r["\u0275\u0275elementEnd"]())}function S(e,t){if(1&e&&(r["\u0275\u0275elementStart"](0,"td"),r["\u0275\u0275text"](1),r["\u0275\u0275pipe"](2,"currency"),r["\u0275\u0275elementEnd"]()),2&e){const e=r["\u0275\u0275nextContext"]().$implicit;r["\u0275\u0275advance"](1),r["\u0275\u0275textInterpolate2"](" ",r["\u0275\u0275pipeBind4"](2,2,null==e?null:e.grnItemPerUnitBuyingPrice,"LKR","symbol","1.2-2"),"/",null==e.buyingUnit?null:e.buyingUnit.unitsCode," ")}}function y(e,t){if(1&e&&(r["\u0275\u0275elementStart"](0,"td"),r["\u0275\u0275text"](1),r["\u0275\u0275pipe"](2,"currency"),r["\u0275\u0275elementEnd"]()),2&e){const e=r["\u0275\u0275nextContext"]().$implicit;r["\u0275\u0275advance"](1),r["\u0275\u0275textInterpolate2"](" ",r["\u0275\u0275pipeBind4"](2,2,null==e||null==e.grnItemPrice?null:e.grnItemPrice.pricePerUnit,"LKR","symbol","1.2-2"),"/",null==e.grnItemPrice||null==e.grnItemPrice.grnItemPriceMeasuredUnit?null:e.grnItemPrice.grnItemPriceMeasuredUnit.unitsCode," ")}}function x(e,t){if(1&e){const e=r["\u0275\u0275getCurrentView"]();r["\u0275\u0275elementStart"](0,"div"),r["\u0275\u0275elementStart"](1,"nb-checkbox",13),r["\u0275\u0275listener"]("change",(function(n){r["\u0275\u0275restoreView"](e);const i=t.$implicit,l=r["\u0275\u0275nextContext"](2).$implicit;return r["\u0275\u0275nextContext"]().selectUnSelect(l,i,n)})),r["\u0275\u0275text"](2),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"]()}if(2&e){const e=t.$implicit,n=r["\u0275\u0275nextContext"](2).$implicit,i=r["\u0275\u0275nextContext"]();r["\u0275\u0275advance"](1),r["\u0275\u0275propertyInterpolate1"]("id","discount-",e.discountId,""),r["\u0275\u0275property"]("value",i.isSelected(n,e)),r["\u0275\u0275advance"](1),r["\u0275\u0275textInterpolate"](e.discountDetail)}}function I(e,t){if(1&e&&(r["\u0275\u0275elementStart"](0,"td"),r["\u0275\u0275template"](1,x,3,3,"div",12),r["\u0275\u0275elementEnd"]()),2&e){const e=r["\u0275\u0275nextContext"]().$implicit;r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("ngForOf",null==e?null:e.grnItemDiscounts)}}function b(e,t){if(1&e){const e=r["\u0275\u0275getCurrentView"]();r["\u0275\u0275elementStart"](0,"tr",11),r["\u0275\u0275listener"]("click",(function(n){r["\u0275\u0275restoreView"](e);const i=t.index;return r["\u0275\u0275nextContext"]().grnSelected(i,n)})),r["\u0275\u0275elementStart"](1,"td"),r["\u0275\u0275text"](2),r["\u0275\u0275elementEnd"](),r["\u0275\u0275template"](3,S,3,7,"td",1),r["\u0275\u0275template"](4,y,3,7,"td",1),r["\u0275\u0275elementStart"](5,"td"),r["\u0275\u0275text"](6),r["\u0275\u0275pipe"](7,"number"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](8,"td"),r["\u0275\u0275text"](9),r["\u0275\u0275pipe"](10,"number"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](11,"td"),r["\u0275\u0275text"](12),r["\u0275\u0275pipe"](13,"number"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275template"](14,I,2,1,"td",1),r["\u0275\u0275elementEnd"]()}if(2&e){const e=t.$implicit,n=t.index,i=r["\u0275\u0275nextContext"]();r["\u0275\u0275classProp"]("active",i.isGrnSelected(n)),r["\u0275\u0275advance"](2),r["\u0275\u0275textInterpolate1"](" ",null==e.grn?null:e.grn.grnCreatedDate," "),r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("ngIf",i.posClientConfig.showBuyingPriceInPopUp),r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("ngIf",i.itemDetail.itemIsSoledBatchWise),r["\u0275\u0275advance"](2),r["\u0275\u0275textInterpolate2"](" ",r["\u0275\u0275pipeBind2"](7,12,e.grnItemQty,"1.2-2")," ",null==e.buyingUnit?null:e.buyingUnit.unitsCode," "),r["\u0275\u0275advance"](3),r["\u0275\u0275textInterpolate2"](" ",r["\u0275\u0275pipeBind2"](10,15,e.soldQty,"1.2-2")," ",null==e.buyingUnit?null:e.buyingUnit.unitsCode," "),r["\u0275\u0275advance"](3),r["\u0275\u0275textInterpolate2"](" ",r["\u0275\u0275pipeBind2"](13,18,e.availableQty,"1.2-2")," ",null==e.buyingUnit?null:e.buyingUnit.unitsCode," "),r["\u0275\u0275advance"](2),r["\u0275\u0275property"]("ngIf",i.itemDetail.itemIsSoledBatchWise)}}function v(e,t){if(1&e){const e=r["\u0275\u0275getCurrentView"]();r["\u0275\u0275elementStart"](0,"div",4),r["\u0275\u0275elementStart"](1,"label",14),r["\u0275\u0275text"](2,"Selling Price"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](3,"input",15),r["\u0275\u0275listener"]("ngModelChange",(function(t){return r["\u0275\u0275restoreView"](e),r["\u0275\u0275nextContext"]().sellingPrice=t})),r["\u0275\u0275elementEnd"](),r["\u0275\u0275text"](4),r["\u0275\u0275elementEnd"]()}if(2&e){const e=r["\u0275\u0275nextContext"]();r["\u0275\u0275advance"](3),r["\u0275\u0275property"]("ngModel",e.sellingPrice),r["\u0275\u0275advance"](1),r["\u0275\u0275textInterpolate1"]("/",null==e.itemDetail.itemPrice||null==e.itemDetail.itemPrice.priceMeasuredUnit?null:e.itemDetail.itemPrice.priceMeasuredUnit.unitsCode," ")}}function C(e,t){if(1&e){const e=r["\u0275\u0275getCurrentView"]();r["\u0275\u0275elementStart"](0,"div"),r["\u0275\u0275elementStart"](1,"nb-checkbox",13),r["\u0275\u0275listener"]("change",(function(){r["\u0275\u0275restoreView"](e);const n=t.$implicit;return r["\u0275\u0275nextContext"](2).selectUnSelectItemDiscount(n)})),r["\u0275\u0275text"](2),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"]()}if(2&e){const e=t.$implicit,n=r["\u0275\u0275nextContext"](2);r["\u0275\u0275advance"](1),r["\u0275\u0275propertyInterpolate1"]("id","discount-",e.discountId,""),r["\u0275\u0275property"]("value",n.isSelectedItemDiscount(e)),r["\u0275\u0275advance"](1),r["\u0275\u0275textInterpolate"](n.discount.discountDetail)}}function E(e,t){if(1&e&&(r["\u0275\u0275elementStart"](0,"div",4),r["\u0275\u0275template"](1,C,3,3,"div",12),r["\u0275\u0275elementEnd"]()),2&e){const e=r["\u0275\u0275nextContext"]();r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("ngForOf",e.itemDetail.itemDiscount)}}function D(e,t){if(1&e&&(r["\u0275\u0275elementStart"](0,"nb-option",7),r["\u0275\u0275text"](1),r["\u0275\u0275elementEnd"]()),2&e){const e=t.$implicit;r["\u0275\u0275property"]("value",e),r["\u0275\u0275advance"](1),r["\u0275\u0275textInterpolate"](e.unitsCode)}}let M=(()=>{class e{constructor(e,t,n){this.ref=e,this.posServie=t,this.pds=n,this.selectedGrn=[0],this.discounts=new Map,this.qty=1,this.grnSelected=function(e,t){"td"==t.target.localName&&(console.log(t),this.isGrnSelected(e)?this.selectedGrn.splice(this.selectedGrn.indexOf(e),1):this.selectedGrn.push(e))}}ngOnInit(){var e;console.log(this.itemDetail),this.sellingPrice=null===(e=this.itemDetail.itemPrice)||void 0===e?void 0:e.pricePerUnit,this.itemDetail.grnItemAvailableDtos.forEach(e=>{let t=[...e.grnItemDiscounts];this.discounts.set(e.grnItemId,t)}),this.units=[...this.itemDetail.sellableUnits],this.sellingUnit=this.units[0],this.pds.currentPosClientConfig.subscribe(e=>{this.posClientConfig=e}),this.itemDiscounts=[...this.itemDetail.itemDiscount]}cancel(){this.ref.close()}submit(){let e;e={discounts:this.discounts,preferedGrnIndex:this.selectedGrn,qty:this.qty,unit:this.sellingUnit},this.ref.close(e)}selectUnSelect(e,t,n){console.log(n),n.stopPropagation(),this.isSelected(e,t)?this.discounts.get(e.grnItemId).splice(this.discounts.get(e.grnItemId).indexOf(t),1):this.discounts.get(e.grnItemId).push(t)}isSelected(e,t){return this.discounts.get(e.grnItemId).find(e=>e.discountsId==t.discountsId)}isGrnSelected(e){return-1!=this.selectedGrn.indexOf(e)}QtyOrUnitChange(){console.log(this.qty+"  "+this.sellingUnit.unitsCode),(this.qty<0||null==this.sellingUnit)&&(this.sellingUnit=this.units[0],this.qty=1),this.canPurchaseItem(this.qty,this.sellingUnit,this.itemDetail.grnItemsSummary)||(this.qty=this.itemDetail.grnItemsSummary.itemAvailableQty,this.sellingUnit=this.units.find(e=>e.unitsId==this.itemDetail.grnItemsSummary.unitDto.unitsId)[0]),this.grnSelected&&this.grnSelected.length>1&&this.grnSelected.sort((e,t)=>e-t),this.generateSalesItem()}generateSalesItem(){}canPurchaseItem(e,t,n){return e<=this.posServie.getMappedQty(n.itemAvailableQty,t,n.unitDto)}selectUnSelectItemDiscount(e){this.isSelectedItemDiscount(e)?this.itemDiscounts.splice(this.itemDiscounts.indexOf(e),1):this.itemDiscounts.push(e)}isSelectedItemDiscount(e){return!!(this.itemDiscounts&&this.itemDiscounts.length>0)&&this.itemDiscounts.find(t=>t.discountsId==e.discountsId)}}return e.\u0275fac=function(t){return new(t||e)(r["\u0275\u0275directiveInject"](p.V),r["\u0275\u0275directiveInject"](m),r["\u0275\u0275directiveInject"](d.a))},e.\u0275cmp=r["\u0275\u0275defineComponent"]({type:e,selectors:[["ngx-sales-item-conf"]],inputs:{itemDetail:"itemDetail"},decls:33,vars:15,consts:[[1,"table","table-hover"],[4,"ngIf"],[3,"active","click",4,"ngFor","ngForOf"],["class","form-inline",4,"ngIf"],[1,"form-inline"],["type","number","nbInput","","placeholder","QTY",3,"ngModel","ngModelChange"],[3,"selected","selectedChange"],[3,"value"],[3,"value",4,"ngFor","ngForOf"],["nbButton","","status","danger",1,"cancel",3,"click"],["nbButton","","status","success",3,"click"],[3,"click"],[4,"ngFor","ngForOf"],["status","success",3,"id","value","change"],["for","SellingPrice",1,"label","form-control-label"],["type","email","nbInput","","id","SellingPrice",3,"ngModel","ngModelChange"]],template:function(e,t){1&e&&(r["\u0275\u0275elementStart"](0,"nb-card"),r["\u0275\u0275elementStart"](1,"nb-card-header"),r["\u0275\u0275text"](2),r["\u0275\u0275pipe"](3,"uppercase"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](4,"nb-card-body"),r["\u0275\u0275elementStart"](5,"table",0),r["\u0275\u0275elementStart"](6,"tr"),r["\u0275\u0275elementStart"](7,"th"),r["\u0275\u0275text"](8," GRN-Date "),r["\u0275\u0275elementEnd"](),r["\u0275\u0275template"](9,h,2,0,"th",1),r["\u0275\u0275template"](10,g,2,0,"th",1),r["\u0275\u0275elementStart"](11,"th"),r["\u0275\u0275text"](12," Total QTY "),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](13,"th"),r["\u0275\u0275text"](14," Sold "),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](15,"th"),r["\u0275\u0275text"](16," Balance QTY "),r["\u0275\u0275elementEnd"](),r["\u0275\u0275template"](17,f,2,0,"th",1),r["\u0275\u0275elementEnd"](),r["\u0275\u0275template"](18,b,15,21,"tr",2),r["\u0275\u0275elementEnd"](),r["\u0275\u0275template"](19,v,5,2,"div",3),r["\u0275\u0275template"](20,E,2,1,"div",3),r["\u0275\u0275elementStart"](21,"div",4),r["\u0275\u0275elementStart"](22,"input",5),r["\u0275\u0275listener"]("ngModelChange",(function(e){return t.qty=e}))("ngModelChange",(function(){return t.QtyOrUnitChange()})),r["\u0275\u0275elementEnd"](),r["\u0275\u0275text"](23," Selling Unit "),r["\u0275\u0275elementStart"](24,"nb-select",6),r["\u0275\u0275listener"]("selectedChange",(function(e){return t.sellingUnit=e}))("selectedChange",(function(){return t.QtyOrUnitChange()})),r["\u0275\u0275elementStart"](25,"nb-option",7),r["\u0275\u0275text"](26,"Select"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275template"](27,D,2,2,"nb-option",8),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](28,"nb-card-footer"),r["\u0275\u0275elementStart"](29,"button",9),r["\u0275\u0275listener"]("click",(function(){return t.cancel()})),r["\u0275\u0275text"](30,"Cancel"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](31,"button",10),r["\u0275\u0275listener"]("click",(function(){return t.submit()})),r["\u0275\u0275text"](32,"Submit"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"]()),2&e&&(r["\u0275\u0275advance"](2),r["\u0275\u0275textInterpolate3"]("",r["\u0275\u0275pipeBind1"](3,13,t.itemDetail.itemName)," - QTY :",null==t.itemDetail.grnItemsSummary?null:t.itemDetail.grnItemsSummary.itemAvailableQty," ",null==t.itemDetail.grnItemsSummary||null==t.itemDetail.grnItemsSummary.unitDto?null:t.itemDetail.grnItemsSummary.unitDto.unitsCode,""),r["\u0275\u0275advance"](7),r["\u0275\u0275property"]("ngIf",t.posClientConfig.showBuyingPriceInPopUp),r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("ngIf",t.itemDetail.itemIsSoledBatchWise),r["\u0275\u0275advance"](7),r["\u0275\u0275property"]("ngIf",t.itemDetail.itemIsSoledBatchWise),r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("ngForOf",t.itemDetail.grnItemAvailableDtos),r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("ngIf",!t.itemDetail.itemIsSoledBatchWise),r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("ngIf",!t.itemDetail.itemIsSoledBatchWise&&t.itemDetail.itemDiscount&&t.itemDetail.itemDiscount.length>0),r["\u0275\u0275advance"](2),r["\u0275\u0275property"]("ngModel",t.qty),r["\u0275\u0275advance"](2),r["\u0275\u0275property"]("selected",t.sellingUnit),r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("value",void 0),r["\u0275\u0275advance"](2),r["\u0275\u0275property"]("ngForOf",t.units))},directives:[p.C,p.F,p.B,i.o,i.n,u.s,p.fb,u.b,u.n,u.q,p.Kb,p.vb,p.D,p.p,p.L],pipes:[i.x,i.g,i.d],styles:[".nb-theme-corporate   [_nghost-%COMP%]   nb-card[_ngcontent-%COMP%], .nb-theme-cosmic   [_nghost-%COMP%]   nb-card[_ngcontent-%COMP%], .nb-theme-dark   [_nghost-%COMP%]   nb-card[_ngcontent-%COMP%], .nb-theme-default   [_nghost-%COMP%]   nb-card[_ngcontent-%COMP%]{max-width:600px;max-height:500px}.table[_ngcontent-%COMP%]   tr.active[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{background-color:#484848!important;color:#fff}"]}),e})();var w=n("Kj3r"),O=n("/uUt"),P=n("lJxs"),k=n("vkgz"),U=n("eIep"),B=n("nYR2"),F=n("1kSV");function V(e,t){if(1&e){const e=r["\u0275\u0275getCurrentView"]();r["\u0275\u0275elementStart"](0,"input",8,9),r["\u0275\u0275listener"]("ngModelChange",(function(t){return r["\u0275\u0275restoreView"](e),r["\u0275\u0275nextContext"]().selectedValue=t}))("keyup.enter",(function(t){return r["\u0275\u0275restoreView"](e),r["\u0275\u0275nextContext"]().searchByEnter(t)}))("selectItem",(function(t){return r["\u0275\u0275restoreView"](e),r["\u0275\u0275nextContext"]().selectItem(t)})),r["\u0275\u0275elementEnd"]()}if(2&e){const e=r["\u0275\u0275nextContext"]();r["\u0275\u0275propertyInterpolate"]("placeholder",e.placeHolder),r["\u0275\u0275property"]("ngModel",e.selectedValue)("ngbTypeahead",e.typeAheadSearch)("resultFormatter",e.formatMatches)("inputFormatter",e.formatMatches)}}function A(e,t){if(1&e){const e=r["\u0275\u0275getCurrentView"]();r["\u0275\u0275elementStart"](0,"input",10,11),r["\u0275\u0275listener"]("ngModelChange",(function(t){return r["\u0275\u0275restoreView"](e),r["\u0275\u0275nextContext"]().selectedValue=t}))("keyup.enter",(function(t){return r["\u0275\u0275restoreView"](e),r["\u0275\u0275nextContext"]().searchByEnter(t)}))("selectItem",(function(t){return r["\u0275\u0275restoreView"](e),r["\u0275\u0275nextContext"]().selectItem(t)})),r["\u0275\u0275elementEnd"]()}if(2&e){const e=r["\u0275\u0275nextContext"]();r["\u0275\u0275propertyInterpolate"]("placeholder",e.placeHolder),r["\u0275\u0275property"]("ngModel",e.selectedValue)}}function j(e,t){if(1&e){const e=r["\u0275\u0275getCurrentView"]();r["\u0275\u0275elementStart"](0,"span",12),r["\u0275\u0275listener"]("click",(function(){return r["\u0275\u0275restoreView"](e),r["\u0275\u0275nextContext"]().search()})),r["\u0275\u0275elementStart"](1,"i",13),r["\u0275\u0275text"](2,"search"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"]()}}function T(e,t){if(1&e){const e=r["\u0275\u0275getCurrentView"]();r["\u0275\u0275elementStart"](0,"span",12),r["\u0275\u0275listener"]("click",(function(){return r["\u0275\u0275restoreView"](e),r["\u0275\u0275nextContext"]().clear()})),r["\u0275\u0275elementStart"](1,"i",13),r["\u0275\u0275text"](2,"clear"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"]()}}function Q(e,t){1&e&&(r["\u0275\u0275elementStart"](0,"div",14),r["\u0275\u0275element"](1,"i",15),r["\u0275\u0275elementEnd"]())}function R(e,t){if(1&e){const e=r["\u0275\u0275getCurrentView"]();r["\u0275\u0275elementStart"](0,"div",16),r["\u0275\u0275elementStart"](1,"a"),r["\u0275\u0275elementStart"](2,"span",17),r["\u0275\u0275listener"]("click",(function(){return r["\u0275\u0275restoreView"](e),r["\u0275\u0275nextContext"]().clear()})),r["\u0275\u0275text"](3,"CLEAR SEARCH "),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"]()}}let _=(()=>{class e{constructor(){this.valueChanged=new r.EventEmitter,this.searchType="",this.clearSearch=!1,this.searchPerformed=!1,this.useCallBackFn=!1,this.noResult="No Results",this.formatMatches=e=>e[this.displayField]||e,this.typeAheadSearch=e=>this.selectSearchFunc(e),this.selectSearchFunc=e=>this.listOfValues&&0!=this.listOfValues.length?this.mapSearch(e):this.mapSearchCallBackFn(e),this.mapSearch=e=>{e.pipe(Object(w.a)(300),Object(O.a)(),Object(P.a)(e=>e.length<2?[]:this.listOfValues.filter(t=>t.toLowerCase().indexOf(e.toLowerCase())>-1).slice(0,10)))},this.mapSearchCallBackFn=e=>e.pipe(Object(w.a)(300),Object(O.a)(),Object(k.a)(()=>this.searching=!0),Object(U.a)(e=>e.length<2?[]:this.callBackFn(e)),Object(k.a)(e=>{this.searching=!1,e.length<1&&e.push({[this.displayField]:this.noResult})}),Object(B.a)(()=>this.searching=!1))}ngOnInit(){this.listOfValues||(this.useCallBackFn=!0),this.clearSearch&&this.clear()}selectItem(e){e.item[this.displayField]!==this.noResult?(this.searchPerformed=!0,this.valueChanged.emit(e.item)):(e.preventDefaults(),this.selectedValue=null,e.item=null)}clear(){this.searchPerformed=!1,this.selectedValue=null,this.valueChanged.emit(this.selectedValue)}search(){this.valueChanged.emit(this.selectedValue)}searchByEnter(){this.valueChanged.emit(this.selectedValue)}}return e.\u0275fac=function(t){return new(t||e)},e.\u0275cmp=r["\u0275\u0275defineComponent"]({type:e,selectors:[["app-search-bar"]],inputs:{placeHolder:"placeHolder",listOfValues:"listOfValues",displayField:"displayField",callBackFn:"callBackFn",searchType:"searchType",clearSearch:"clearSearch"},outputs:{valueChanged:"valueChanged"},decls:9,vars:6,consts:[[1,"row"],[1,"col-md-9","col-9","m-0"],[1,"search-bar-input-wrapper",2,"display","inline-block"],["class","form-control search-bar-text","id","searchText","name","searchBarInput","type","text","style","display: inline-block;",3,"ngModel","ngbTypeahead","resultFormatter","inputFormatter","placeholder","ngModelChange","keyup.enter","selectItem",4,"ngIf"],["class","form-control search-bar-text","id","searchText","name","seachBarInputText","type","text",3,"ngModel","placeholder","ngModelChange","keyup.enter","selectItem",4,"ngIf"],["class","action-button p-0 m-0 hand-cursor",3,"click",4,"ngIf"],["class","col-md-1 col-1 p-0 m-0",4,"ngIf"],["class","col-lg-3",4,"ngIf"],["id","searchText","name","searchBarInput","type","text",1,"form-control","search-bar-text",2,"display","inline-block",3,"ngModel","ngbTypeahead","resultFormatter","inputFormatter","placeholder","ngModelChange","keyup.enter","selectItem"],["seachBarInput",""],["id","searchText","name","seachBarInputText","type","text",1,"form-control","search-bar-text",3,"ngModel","placeholder","ngModelChange","keyup.enter","selectItem"],["seachBarInputText",""],[1,"action-button","p-0","m-0","hand-cursor",3,"click"],[1,"material-icons"],[1,"col-md-1","col-1","p-0","m-0"],[1,"center-right-img","fas","fa-circle-notch","fa-spin"],[1,"col-lg-3"],[1,"clear-search",3,"click"]],template:function(e,t){1&e&&(r["\u0275\u0275elementStart"](0,"div",0),r["\u0275\u0275elementStart"](1,"div",1),r["\u0275\u0275elementStart"](2,"div",2),r["\u0275\u0275template"](3,V,2,5,"input",3),r["\u0275\u0275template"](4,A,2,2,"input",4),r["\u0275\u0275template"](5,j,3,0,"span",5),r["\u0275\u0275template"](6,T,3,0,"span",5),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275template"](7,Q,2,0,"div",6),r["\u0275\u0275template"](8,R,4,0,"div",7),r["\u0275\u0275elementEnd"]()),2&e&&(r["\u0275\u0275advance"](3),r["\u0275\u0275property"]("ngIf",t.callBackFn),r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("ngIf",!t.callBackFn),r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("ngIf",!t.useCallBackFn),r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("ngIf",t.useCallBackFn&&t.searchPerformed),r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("ngIf",t.useCallBackFn&&t.searching),r["\u0275\u0275advance"](1),r["\u0275\u0275property"]("ngIf",t.clearSearch&&null!=t.selectedValue&&""!=t.selectedValue))},directives:[i.o,u.b,F.b,u.n,u.q],styles:[".dropdown-menu.show[_ngcontent-%COMP%]{display:contents}"]}),e})();function G(e,t){if(1&e){const e=r["\u0275\u0275getCurrentView"]();r["\u0275\u0275elementStart"](0,"app-data-pagination",8),r["\u0275\u0275listener"]("paginationChanged",(function(t){return r["\u0275\u0275restoreView"](e),r["\u0275\u0275nextContext"]().paginationChanged(t)})),r["\u0275\u0275elementEnd"]()}if(2&e){const e=r["\u0275\u0275nextContext"]();r["\u0275\u0275property"]("pageSize",e.pageSize)("collectionSize",e.totalElements)("showSizeSelection",!0)}}const z=[{path:"",component:a,children:[{path:"inventry",component:(()=>{class e{constructor(e,t,n){this.dialogService=e,this.posServie=t,this.pds=n,this.starRate=2,this.heartRate=4,this.radioGroupValue="This is value 2",this.itemSearchFunction=e=>this.posServie.getAvailableItems(e),this.pageSize=15,this.totalElements=150}ngOnInit(){this.pds.currentUnitMappers.subscribe(e=>{this.unitMappers=e})}searchByText(e){console.log("Returned"+event),this.posServie.getItemGRNDetails(e.itemId).subscribe(e=>{this.dialogService.open(M,{context:{itemDetail:e},closeOnBackdropClick:!1}).onClose.subscribe(t=>{console.log(t),this.prepareInvoiceItemAndAdd(e,t)})})}prepareInvoiceItemAndAdd(e,t){this.getGRNItems(e,t)}getGRNItems(e,t){}paginationChanged(e){this.pageSize=e.pageSize||this.pageSize}}return e.\u0275fac=function(t){return new(t||e)(r["\u0275\u0275directiveInject"](p.W),r["\u0275\u0275directiveInject"](m),r["\u0275\u0275directiveInject"](d.a))},e.\u0275cmp=r["\u0275\u0275defineComponent"]({type:e,selectors:[["ngx-inventry"]],decls:55,vars:4,consts:[[1,"row"],[1,"col-md-12"],[1,"inline-form-card"],[1,"form-inline"],[3,"placeHolder","displayField","callBackFn","valueChanged"],["type","text","nbInput","","fullWidth","","placeholder","Email"],["type","submit","nbButton","","status","primary"],[3,"pageSize","collectionSize","showSizeSelection","paginationChanged",4,"ngIf"],[3,"pageSize","collectionSize","showSizeSelection","paginationChanged"]],template:function(e,t){1&e&&(r["\u0275\u0275elementStart"](0,"div",0),r["\u0275\u0275elementStart"](1,"div",1),r["\u0275\u0275elementStart"](2,"nb-card",2),r["\u0275\u0275elementStart"](3,"nb-card-header"),r["\u0275\u0275text"](4,"Inline form"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](5,"nb-card-body"),r["\u0275\u0275elementStart"](6,"form",3),r["\u0275\u0275elementStart"](7,"app-search-bar",4),r["\u0275\u0275listener"]("valueChanged",(function(e){return t.searchByText(e)})),r["\u0275\u0275elementEnd"](),r["\u0275\u0275element"](8,"input",5),r["\u0275\u0275elementStart"](9,"nb-checkbox"),r["\u0275\u0275text"](10,"Remember me"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](11,"button",6),r["\u0275\u0275text"](12,"Submit"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](13,"div",0),r["\u0275\u0275elementStart"](14,"div",1),r["\u0275\u0275elementStart"](15,"nb-card",2),r["\u0275\u0275elementStart"](16,"nb-card-header"),r["\u0275\u0275text"](17,"Inline form"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](18,"nb-card-body"),r["\u0275\u0275elementStart"](19,"table"),r["\u0275\u0275elementStart"](20,"tr"),r["\u0275\u0275elementStart"](21,"td"),r["\u0275\u0275text"](22,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](23,"td"),r["\u0275\u0275text"](24,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](25,"td"),r["\u0275\u0275text"](26,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](27,"td"),r["\u0275\u0275text"](28,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](29,"td"),r["\u0275\u0275text"](30,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](31,"td"),r["\u0275\u0275text"](32,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](33,"td"),r["\u0275\u0275text"](34,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](35,"td"),r["\u0275\u0275text"](36,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](37,"tr"),r["\u0275\u0275elementStart"](38,"td"),r["\u0275\u0275text"](39,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](40,"td"),r["\u0275\u0275text"](41,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](42,"td"),r["\u0275\u0275text"](43,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](44,"td"),r["\u0275\u0275text"](45,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](46,"td"),r["\u0275\u0275text"](47,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](48,"td"),r["\u0275\u0275text"](49,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](50,"td"),r["\u0275\u0275text"](51,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementStart"](52,"td"),r["\u0275\u0275text"](53,"Apple"),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275template"](54,G,1,3,"app-data-pagination",7),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"](),r["\u0275\u0275elementEnd"]()),2&e&&(r["\u0275\u0275advance"](7),r["\u0275\u0275property"]("placeHolder","SearchItems")("displayField","itemName")("callBackFn",t.itemSearchFunction.bind(t)),r["\u0275\u0275advance"](47),r["\u0275\u0275property"]("ngIf",t.totalElements>0))},directives:[p.C,p.F,p.B,u.z,u.o,u.p,_,p.fb,p.L,p.p,i.o],styles:["nb-checkbox[_ngcontent-%COMP%]{margin-bottom:1rem}.form-inline[_ngcontent-%COMP%]   [fullWidth][_ngcontent-%COMP%]{flex:1}.form-inline[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{margin:0 1.5rem 1.5rem 0}nb-card.inline-form-card[_ngcontent-%COMP%]   nb-card-body[_ngcontent-%COMP%]{padding-bottom:0}"]}),e})()},{path:"grn",component:(()=>{class e{constructor(){}ngOnInit(){}}return e.\u0275fac=function(t){return new(t||e)},e.\u0275cmp=r["\u0275\u0275defineComponent"]({type:e,selectors:[["ngx-grn"]],decls:2,vars:0,template:function(e,t){1&e&&(r["\u0275\u0275elementStart"](0,"p"),r["\u0275\u0275text"](1,"grn works!"),r["\u0275\u0275elementEnd"]())},styles:[""]}),e})()},{path:"stock",component:(()=>{class e{constructor(){}ngOnInit(){}}return e.\u0275fac=function(t){return new(t||e)},e.\u0275cmp=r["\u0275\u0275defineComponent"]({type:e,selectors:[["ngx-stock"]],decls:2,vars:0,template:function(e,t){1&e&&(r["\u0275\u0275elementStart"](0,"p"),r["\u0275\u0275text"](1,"stock works!"),r["\u0275\u0275elementEnd"]())},styles:[""]}),e})()},{path:"report",component:(()=>{class e{constructor(){}ngOnInit(){}}return e.\u0275fac=function(t){return new(t||e)},e.\u0275cmp=r["\u0275\u0275defineComponent"]({type:e,selectors:[["ngx-reports"]],decls:2,vars:0,template:function(e,t){1&e&&(r["\u0275\u0275elementStart"](0,"p"),r["\u0275\u0275text"](1,"reports works!"),r["\u0275\u0275elementEnd"]())},styles:[""]}),e})()}]}];let q=(()=>{class e{}return e.\u0275mod=r["\u0275\u0275defineNgModule"]({type:e}),e.\u0275inj=r["\u0275\u0275defineInjector"]({factory:function(t){return new(t||e)},imports:[[l.g.forChild(z)],l.g]}),e})(),N=(()=>{class e{}return e.\u0275mod=r["\u0275\u0275defineNgModule"]({type:e}),e.\u0275inj=r["\u0275\u0275defineInjector"]({factory:function(t){return new(t||e)},imports:[[i.c,u.u,u.h,F.c]]}),e})(),$=(()=>{class e{}return e.\u0275mod=r["\u0275\u0275defineNgModule"]({type:e}),e.\u0275inj=r["\u0275\u0275defineInjector"]({factory:function(t){return new(t||e)},imports:[[i.c,F.a,u.u,u.h]]}),e})();var W=n("vTDv"),L=n("R0rY");let H=(()=>{class e{}return e.\u0275mod=r["\u0275\u0275defineNgModule"]({type:e}),e.\u0275inj=r["\u0275\u0275defineInjector"]({factory:function(t){return new(t||e)},imports:[[i.c,q,p.m,p.q,p.G,p.M,p.T,p.db,p.gb,p.Db,p.Mb,p.yc,N,$,u.h,W.a,L.a,p.U.forChild(),p.zc.forChild(),p.G,p.M,p.dc,p.yb,p.q,p.gb,p.Mb,p.jc]]}),e})()}}]);