text: !function(){function e(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,c=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(n=(u=a.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(o){c=!0,i=o}finally{try{n||null==a.return||a.return()}finally{if(c)throw i}}return r}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=s(e);if(t){var c=s(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return o(this,r)}}function o(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{"/SgV":function(e,t,r){"use strict";r.d(t,"b",function(){return c}),r.d(t,"d",function(){return i}),r.d(t,"c",function(){return u}),r.d(t,"a",function(){return a}),r.d(t,"e",function(){return o});var n=r("l7P3"),c=Object(n.n)("[Purchase] Load Purchases"),i=Object(n.n)("[Purchase] Load Purchases Success",Object(n.s)()),u=Object(n.n)("[Purchase] Load Purchases Failure",Object(n.s)()),a=Object(n.n)("[Purchase] Delete Purchase",Object(n.s)()),o=Object(n.n)("[Purchase] Delete Purchase",Object(n.s)())},"0WHi":function(e,t,r){"use strict";r.d(t,"a",function(){return u}),r.d(t,"b",function(){return a});var n=r("l7P3"),c=r("eY9e"),i=Object(n.o)(c.b),u=Object(n.q)(i,function(e){var t;return null===(t=Object.values(e||{}))||void 0===t?void 0:t.filter(function(e){return 0!==e.id})}),a=function(e){var t=e.id;return Object(n.q)(i,function(e){return e[t]})}},HW8q:function(e,t,n){"use strict";n.d(t,"a",function(){return w});var u=n("3Pt+"),o=n("nPLa"),s=n("vkgz"),l=n("1G5W"),b=n("/SgV"),d=n("sEf6"),p=n("+Kmi"),f=n("fXoL"),h=n("l7P3"),m=n("mkJD"),v=n("2qjx"),y=n("ChtM"),g=n("gWX1"),S=n("ZOsW"),O=n("ofXK"),j=n("dZIy"),P=n("QlUG");function I(e,t){if(1&e&&(f.Sb(0,"ng-option",31),f.Ac(1),f.cc(2,"titlecase"),f.Rb()),2&e){var r=t.$implicit;f.hc("value",r.id),f.Ab(1),f.Cc(" ",f.dc(2,2,r.name)," ")}}function R(e,t){if(1&e){var r=f.Tb();f.Sb(0,"li",34),f.Zb("click",function(){f.tc(r);var e=t.$implicit;return f.bc(2).purchaseCurrency.setValue(e)}),f.Sb(1,"span",35),f.Ac(2),f.Rb(),f.Rb()}if(2&e){var n=t.$implicit;f.Ab(2),f.Bc(n)}}function A(e,t){if(1&e&&(f.Sb(0,"ul",32),f.yc(1,R,3,1,"li",33),f.cc(2,"async"),f.Rb()),2&e){var r=f.bc();f.Ab(1),f.hc("ngForOf",f.dc(2,1,r.currencies$))}}function _(e,t){1&e&&f.Nb(0,"i",36)}function k(e,t){1&e&&f.Nb(0,"i",37)}var w=function(){var e=function(e){i(n,e);var t=a(n);function n(e,c,i,a,o,s){var l;return r(this,n),(l=t.call(this)).store=e,l.fb=c,l.purchaseService=i,l.productsService=a,l.currencyService=o,l.sellerService=s,l.currencies$=l.currencyService.loadCurrencies$,l.sellers$=l.sellerService.loadSellers$,l.purchaseForm=l.fb.group({id:[0],productId:[null,[u.v.required]],quantityPurchased:[1,[u.v.required]],unitPrice:[null,[u.v.required]],sellerId:[0],purchaseCurrency:["KES",[u.v.required]],purchaseDate:[null,[u.v.required]]}),l.products$=l.productsService.loadProducts$,l}return c(n,[{key:"ngOnInit",value:function(){var e=this;this.purchase$=this.purchaseService.getPurchaseWithId(this.id).pipe(Object(s.a)(function(t){return e.purchaseForm.patchValue(t)})),this.store.dispatch(Object(o.b)()),this.purchase$.subscribe()}},{key:"closeModal",value:function(){this.itemForm=this.purchaseForm,this.closeFormDialog()&&this.store.dispatch(Object(o.a)())}},{key:"purchaseFormSubmit",value:function(){var e=this;this.purchaseForm.valid&&(this.submitInProgressSubject$.next(!0),this.purchaseService.savePurchase(this.purchaseForm.value).pipe(Object(l.a)(this.destroyed$)).subscribe({next:function(t){e.submitInProgressSubject$.next(!1),e.store.dispatch(Object(o.a)()),e.store.dispatch(Object(b.e)({data:t}))},error:function(){return e.submitInProgressSubject$.next(!1)}}))}},{key:"purchaseCurrency",get:function(){return this.purchaseForm.get("purchaseCurrency")}}]),n}(Object(p.a)(Object(d.a)()));return e.\u0275fac=function(t){return new(t||e)(f.Mb(h.h),f.Mb(u.d),f.Mb(m.a),f.Mb(v.a),f.Mb(y.a),f.Mb(g.a))},e.\u0275cmp=f.Gb({type:e,selectors:[["app-purchase-maintenance"]],inputs:{id:"id"},features:[f.xb],decls:50,vars:16,consts:[[1,"bg-dark"],[3,"formGroup","submit"],[1,"card"],[1,"card-header"],[1,"card-body"],[1,"d-flex","flex-wrap"],[1,"col-lg-6","mt-3"],["for","product",1,"control-label"],["placeholder","Choose a Product","id","product","formControlName","productId"],["role","option",3,"value",4,"ngFor","ngForOf"],["for","seller",1,"control-label"],["placeholder","Choose a Seller","id","seller","bindLabel","name","bindValue","id","formControlName","sellerId",3,"items"],["for","purchaseBuyingPrice",1,"control-label"],[1,"input-group","mb-3"],[1,"input-group-prepend"],["dropdown","",1,"btn-group"],["type","button",1,"btn","bg-light","text-dark"],["id","button-split","type","button","dropdownToggle","","aria-controls","dropdown-split",1,"btn","bg-light","text-dark","dropdown-toggle","dropdown-toggle-split"],[1,"caret"],[1,"sr-only"],["id","dropdown-split","class","dropdown-menu","role","menu","aria-labelledby","button-split",4,"dropdownMenu"],["placeholder","Enter Price e.g 50.00","id","purchaseBuyingPrice","formControlName","unitPrice","type","number",1,"form-control"],["label","Quantity","placeholder","Enter Quantity eg 50","id","quantityPurchased","formControlName","quantityPurchased"],["for","purchaseDate"],["id","purchaseDate","type","date","formControlName","purchaseDate",1,"form-control"],[1,"card-footer","d-flex","justify-content-between"],[1,"btn","btn-success",3,"disabled"],["class","icon-ok",4,"ngIf"],["class","icon-spin3 animate-spin",4,"ngIf"],["type","button",1,"btn","btn-secondary",3,"click"],[1,"icon-cancel"],["role","option",3,"value"],["id","dropdown-split","role","menu","aria-labelledby","button-split",1,"dropdown-menu"],["role","menuitem",3,"click",4,"ngFor","ngForOf"],["role","menuitem",3,"click"],[1,"dropdown-item"],[1,"icon-ok"],[1,"icon-spin3","animate-spin"]],template:function(e,t){1&e&&(f.Sb(0,"section",0),f.Sb(1,"form",1),f.Zb("submit",function(){return t.purchaseFormSubmit()}),f.Sb(2,"section",2),f.Sb(3,"section",3),f.Sb(4,"h2"),f.Ac(5),f.Rb(),f.Rb(),f.Sb(6,"section",4),f.Sb(7,"section",5),f.Sb(8,"section",6),f.Sb(9,"label",7),f.Ac(10,"Product"),f.Rb(),f.Sb(11,"ng-select",8),f.yc(12,I,3,4,"ng-option",9),f.cc(13,"async"),f.Rb(),f.Rb(),f.Sb(14,"section",6),f.Sb(15,"label",10),f.Ac(16,"Seller"),f.Rb(),f.Nb(17,"ng-select",11),f.cc(18,"async"),f.Rb(),f.Sb(19,"section",6),f.Sb(20,"label",12),f.Ac(21,"Unit Price"),f.Rb(),f.Sb(22,"div",13),f.Sb(23,"div",14),f.Sb(24,"div",15),f.Sb(25,"button",16),f.Ac(26),f.Rb(),f.Sb(27,"button",17),f.Nb(28,"span",18),f.Sb(29,"span",19),f.Ac(30,"Change Currency"),f.Rb(),f.Rb(),f.yc(31,A,3,3,"ul",20),f.Rb(),f.Rb(),f.Nb(32,"input",21),f.Rb(),f.Rb(),f.Sb(33,"section",6),f.Nb(34,"app-input",22),f.Rb(),f.Sb(35,"section",6),f.Sb(36,"label",23),f.Ac(37,"Purchase Date"),f.Rb(),f.Sb(38,"section"),f.Nb(39,"input",24),f.Rb(),f.Rb(),f.Rb(),f.Rb(),f.Sb(40,"section",25),f.Sb(41,"button",26),f.Ac(42," Save "),f.yc(43,_,1,0,"i",27),f.cc(44,"async"),f.yc(45,k,1,0,"i",28),f.cc(46,"async"),f.Rb(),f.Sb(47,"button",29),f.Zb("click",function(){return t.closeModal()}),f.Nb(48,"span",30),f.Ac(49,"Cancel"),f.Rb(),f.Rb(),f.Rb(),f.Rb(),f.Rb()),2&e&&(f.Ab(1),f.hc("formGroup",t.purchaseForm),f.Ab(4),f.Cc("",0===t.id?"New":"Edit"," Purchase"),f.Ab(7),f.hc("ngForOf",f.dc(13,8,t.products$)),f.Ab(5),f.hc("items",f.dc(18,10,t.sellers$)),f.Ab(9),f.Bc(t.purchaseCurrency.value),f.Ab(15),f.hc("disabled",t.purchaseForm.invalid||!t.purchaseForm.dirty),f.Ab(2),f.hc("ngIf",t.purchaseForm.valid&&!1===f.dc(44,12,t.submitInProgressAction$)),f.Ab(2),f.hc("ngIf",f.dc(46,14,t.submitInProgressAction$)))},directives:[u.x,u.n,u.h,S.a,u.m,u.g,O.m,j.a,j.d,j.b,u.b,u.q,P.a,O.n,S.c],pipes:[O.b,O.u],styles:[""]}),e}()},RTvA:function(e,t,n){"use strict";n.d(t,"a",function(){return v});var i=n("3Pt+"),u=n("l7P3"),a=n("nPLa"),o=n("z1kL"),s=n("GJmQ"),l=n("/SgV"),b=n("fXoL"),d=n("mkJD"),p=n("ofXK");function f(e,t){if(1&e&&(b.Sb(0,"section"),b.Sb(1,"table",15),b.Sb(2,"thead"),b.Sb(3,"tr"),b.Sb(4,"th"),b.Ac(5,"Purchase ID"),b.Rb(),b.Sb(6,"th"),b.Ac(7,"Purchase Name"),b.Rb(),b.Sb(8,"th"),b.Ac(9,"Quantity"),b.Rb(),b.Rb(),b.Sb(10,"tr"),b.Sb(11,"td"),b.Ac(12),b.Rb(),b.Sb(13,"td"),b.Ac(14),b.Rb(),b.Sb(15,"td"),b.Ac(16),b.cc(17,"currency"),b.Rb(),b.Rb(),b.Rb(),b.Rb(),b.Rb()),2&e){var r=t.ngIf;b.Ab(12),b.Cc("#",r.id,""),b.Ab(2),b.Bc(r.productName),b.Ab(2),b.Dc("",r.quantityPurchased," units @ ",b.ec(17,4,r.unitPrice,r.purchaseCurrency+" "),"")}}function h(e,t){1&e&&b.Nb(0,"i",16)}function m(e,t){1&e&&b.Nb(0,"i",17)}var v=function(){var e=function(){function e(t,n,c){r(this,e),this.store=t,this.purchaseService=n,this.fb=c,this.purchaseForm=this.fb.group({id:[""]}),this.componentIsActive=!0,this.validateId=function(e){return function(t){return t.value==="#"+e?null:{idMismatch:"Id Mismatch"}}}}return c(e,[{key:"ngOnInit",value:function(){var e,t=this;this.store.dispatch(Object(a.b)()),this.purchase$=this.store.pipe(Object(u.t)(Object(o.b)({id:this.id})),Object(s.a)(function(){return t.componentIsActive})),null===(e=this.purchaseForm.get("id"))||void 0===e||e.setValidators([i.v.required,this.validateId(this.id)])}},{key:"closeModal",value:function(){this.store.dispatch(Object(a.a)())}},{key:"purchaseFormSubmit",value:function(){var e=this;this.purchaseForm.valid&&(this.isSubmitting=!0,this.purchaseService.deletePurchase(this.id).pipe(Object(s.a)(function(){return e.componentIsActive})).subscribe({next:function(){e.isSubmitting=!1,e.closeModal(),e.store.dispatch(Object(l.a)({data:{id:e.id}}))},error:function(){return e.isSubmitting=!1}}))}},{key:"ngOnDestroy",value:function(){this.componentIsActive=!1}}]),e}();return e.\u0275fac=function(t){return new(t||e)(b.Mb(u.h),b.Mb(d.a),b.Mb(i.d))},e.\u0275cmp=b.Gb({type:e,selectors:[["app-delete-purchase-confirmation"]],inputs:{id:"id"},decls:21,vars:7,consts:[[1,"bg-dark"],[3,"formGroup","submit"],[1,"card"],[1,"card-header"],[4,"ngIf"],[1,"col-lg-12","mt-3","mb-2","d-flex"],["for","idConfirmation",1,"col-lg-6"],[1,"col-lg-6"],["id","idConfirmation","type","text","formControlName","id","placeholder","e.g #1234",1,"form-control"],[1,"card-footer","d-flex","justify-content-between"],[1,"btn","btn-danger",3,"disabled"],["class","icon-trash",4,"ngIf"],["class","icon-spin3 animate-spin",4,"ngIf"],["type","button",1,"btn","btn-secondary",3,"click"],[1,"icon-cancel"],[1,"table","table-dark"],[1,"icon-trash"],[1,"icon-spin3","animate-spin"]],template:function(e,t){1&e&&(b.Sb(0,"section",0),b.Sb(1,"form",1),b.Zb("submit",function(){return t.purchaseFormSubmit()}),b.Sb(2,"section",2),b.Sb(3,"section",3),b.Sb(4,"h2"),b.Ac(5,"Delete Purchase Confirmation"),b.Rb(),b.Rb(),b.yc(6,f,18,7,"section",4),b.cc(7,"async"),b.Sb(8,"section",5),b.Sb(9,"label",6),b.Ac(10,"Please Enter Purchase Id To Confirm Deletion"),b.Rb(),b.Sb(11,"section",7),b.Nb(12,"input",8),b.Rb(),b.Rb(),b.Sb(13,"section",9),b.Sb(14,"button",10),b.Ac(15," Delete Purchase "),b.yc(16,h,1,0,"i",11),b.yc(17,m,1,0,"i",12),b.Rb(),b.Sb(18,"button",13),b.Zb("click",function(){return t.closeModal()}),b.Nb(19,"span",14),b.Ac(20,"Cancel"),b.Rb(),b.Rb(),b.Rb(),b.Rb(),b.Rb()),2&e&&(b.Ab(1),b.hc("formGroup",t.purchaseForm),b.Ab(5),b.hc("ngIf",b.dc(7,5,t.purchase$)),b.Ab(8),b.hc("disabled",t.purchaseForm.invalid||!t.purchaseForm.dirty),b.Ab(2),b.hc("ngIf",t.purchaseForm.valid&&!t.isSubmitting),b.Ab(1),b.hc("ngIf",t.isSubmitting))},directives:[i.x,i.n,i.h,p.n,i.b,i.m,i.g],pipes:[p.b,p.d],styles:[""]}),e}()},ckED:function(e,t,r){"use strict";r.d(t,"a",function(){return i}),r.d(t,"b",function(){return a});var n=r("l7P3"),c=r("/SgV"),i="purchases",u={0:{id:0,productId:null,productName:"",quantityPurchased:null,unitPrice:null,sellerId:null,sellerName:"",purchaseCurrency:"KES",purchaseDate:(new Date).toISOString().substring(0,10)}},a=Object(n.p)(u,Object(n.r)(c.b,function(e){return e}),Object(n.r)(c.d,function(e,t){var r={};return t.data.forEach(function(e){r[e.id]=e}),Object.assign({},r)}),Object(n.r)(c.c,function(e){return e}),Object(n.r)(c.a,function(e,t){var r=Object.assign({},e);return delete r[t.data.id],r}),Object(n.r)(c.e,function(e,t){return Object.assign(Object.assign({},e),(r={},n=t.data.id,c=t.data,n in r?Object.defineProperty(r,n,{value:c,enumerable:!0,configurable:!0,writable:!0}):r[n]=c,r));var r,n,c}))},e6Kq:function(t,n,u){"use strict";u.d(n,"a",function(){return o});var o=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return function e(){r(this,e)}}();return function(t){i(u,t);var n=a(u);function u(){return r(this,u),n.apply(this,arguments)}return c(u,[{key:"getDate",value:function(t){t.setHours(-t.getTimezoneOffset()/60,0,0);var r=e(t.toISOString().split("-"),3),n=r[0],c=r[1],i=r[2];return"".concat(n,"-").concat(c,"-").concat(i.substr(0,2))}}]),u}(t)}},eY9e:function(e,t,r){"use strict";r.d(t,"b",function(){return i}),r.d(t,"a",function(){return u});var n=r("l7P3"),c=r("m8bv"),i="sellers",u=Object(n.p)({0:{id:0,name:"",description:""}},Object(n.r)(c.b,function(e){return e}),Object(n.r)(c.d,function(e,t){var r={};return t.data.forEach(function(e){r[e.id]=e}),Object.assign(Object.assign({},e),r)}),Object(n.r)(c.c,function(e){return e}),Object(n.r)(c.a,function(e,t){var r=Object.assign({},e);return delete r[t.data.id],r}))},gWX1:function(e,t,n){"use strict";n.d(t,"a",function(){return d});var i=n("l7P3"),u=n("lJxs"),a=n("vkgz"),o=n("m8bv"),s=n("0WHi"),l=n("fXoL"),b=n("tk/3"),d=function(){var e=function(){function e(t,n){var c=this;r(this,e),this.store=t,this.http=n,this.sellersLoaded=!1,this.sellers$=this.http.get("api/sellers").pipe(Object(u.a)(function(e){return e.map(function(e){return{id:e.id,name:e.name,description:e.description}})}),Object(a.a)(function(){return c.sellersLoaded=!0})),this.loadSellers$=this.store.pipe(Object(i.t)(s.a),Object(a.a)(function(e){return e.length<1&&!c.sellersLoaded?c.store.dispatch(Object(o.b)()):""}))}return c(e,[{key:"deleteSeller",value:function(e){return this.http.delete("api/sellers/".concat(e))}},{key:"saveSeller",value:function(e){var t="api/sellers/".concat(e.id);return 0===e.id?(t="api/sellers",this.http.post(t,{description:e.description,name:e.name}).pipe(Object(u.a)(function(e){return e.data}),Object(u.a)(function(e){return{id:e.id,name:e.name,description:e.description}}))):this.http.post(t,{_method:"PATCH",description:e.description,name:e.name}).pipe(Object(u.a)(function(e){return e.data}),Object(u.a)(function(e){return{id:e.id,name:e.name,description:e.description}}))}}]),e}();return e.\u0275fac=function(t){return new(t||e)(l.Wb(i.h),l.Wb(b.b))},e.\u0275prov=l.Ib({token:e,factory:e.\u0275fac,providedIn:"root"}),e}()},m8bv:function(e,t,r){"use strict";r.d(t,"b",function(){return c}),r.d(t,"d",function(){return i}),r.d(t,"c",function(){return u}),r.d(t,"a",function(){return a});var n=r("l7P3"),c=Object(n.n)("[Seller] Load Sellers"),i=Object(n.n)("[Seller] Load Sellers Success",Object(n.s)()),u=Object(n.n)("[Seller] Load Sellers Failure",Object(n.s)()),a=Object(n.n)("[Seller] Delete Seller",Object(n.s)())},mkJD:function(e,t,n){"use strict";n.d(t,"a",function(){return h});var u=n("l7P3"),o=n("/SgV"),s=n("lJxs"),l=n("vkgz"),b=n("z1kL"),d=n("e6Kq"),p=n("fXoL"),f=n("tk/3"),h=function(){var e=function(e){i(n,e);var t=a(n);function n(e,c){var i;return r(this,n),(i=t.call(this)).store=e,i.http=c,i.url="api/purchases",i.purchaseDates$=i.http.get("".concat(i.url,"/?purchase_dates=true")),i.purchasesLoaded=!1,i.purchases$=i.http.get(i.url).pipe(Object(s.a)(function(e){return e.map(function(e){return{id:e.id,productId:e.product_id,productName:e.product_name,quantityPurchased:e.quantity,sellerId:e.seller_id,sellerName:e.seller_name,unitPrice:e.unit_price,purchaseCurrency:e.currency,purchaseDate:e.purchase_date}})}),Object(l.a)(function(){return i.purchasesLoaded=!0})),i.loadPurchases$=i.store.pipe(Object(u.t)(b.a),Object(l.a)(function(e){return e.length<1&&!i.purchasesLoaded?i.store.dispatch(Object(o.b)()):""})),i.getPurchasesForDate$=function(e){return i.http.get("".concat(i.url,"/?purchase_date=").concat(i.getDate(e))).pipe(Object(s.a)(i.mappedPurchases))},i.mappedPurchase=function(e){return{id:e.id,productId:e.product_id,productName:e.product_name,quantityPurchased:e.quantity,sellerId:e.seller_id,sellerName:e.seller_name,unitPrice:e.unit_price,purchaseCurrency:e.currency,purchaseDate:e.purchase_date}},i.mappedPurchases=function(e){return e.map(function(e){return{id:e.id,productId:e.product_id,productName:e.product_name,quantityPurchased:e.quantity,sellerId:e.seller_id,sellerName:e.seller_name,unitPrice:e.unit_price,purchaseCurrency:e.currency,purchaseDate:e.purchase_date}})},i.getPurchaseWithId=function(e){return i.http.get("".concat(i.url,"/").concat(e)).pipe(Object(s.a)(i.mappedPurchase))},i}return c(n,[{key:"deletePurchase",value:function(e){return this.http.delete("".concat(this.url,"/").concat(e))}},{key:"savePurchase",value:function(e){var t="".concat(this.url,"/").concat(e.id);return 0===e.id?(t="api/purchases",this.http.post(t,{product_id:e.productId,quantity:e.quantityPurchased,seller_id:e.sellerId,unit_price:e.unitPrice,currency:e.purchaseCurrency,purchase_date:e.purchaseDate}).pipe(Object(s.a)(function(e){return e.data}),Object(s.a)(function(e){return{id:e.id,productId:e.product_id,productName:e.product_name,quantityPurchased:e.quantity,sellerId:e.seller_id,sellerName:e.seller_name,unitPrice:e.unit_price,purchaseCurrency:e.currency,purchaseDate:e.purchase_date}}))):this.http.post(t,{_method:"PATCH",product_id:e.productId,quantity:e.quantityPurchased,seller_id:e.sellerId,unit_price:e.unitPrice,currency:e.purchaseCurrency,purchase_date:e.purchaseDate}).pipe(Object(s.a)(function(e){return e.data}),Object(s.a)(function(e){return{id:e.id,productId:e.product_id,productName:e.product_name,quantityPurchased:e.quantity,sellerId:e.seller_id,sellerName:e.seller_name,unitPrice:e.unit_price,purchaseCurrency:e.currency,purchaseDate:e.purchase_date}}))}}]),n}(Object(d.a)());return e.\u0275fac=function(t){return new(t||e)(p.Wb(u.h),p.Wb(f.b))},e.\u0275prov=p.Ib({token:e,factory:e.\u0275fac,providedIn:"root"}),e}()},x6dL:function(e,t,n){"use strict";n.d(t,"a",function(){return y});var c,i,u=n("ofXK"),a=n("l7P3"),o=n("9jGm"),s=n("bOdf"),l=n("lJxs"),b=n("JIr8"),d=n("LRne"),p=n("m8bv"),f=n("fXoL"),h=n("gWX1"),m=((c=function e(t,n){var c=this;r(this,e),this.actions$=t,this.sellerService=n,this.loadSellers$=Object(o.c)(function(){return c.actions$.pipe(Object(o.d)(p.b),Object(s.a)(function(){return c.sellerService.sellers$.pipe(Object(l.a)(function(e){return p.d({data:e})}),Object(b.a)(function(e){return Object(d.a)(p.c({error:e}))}))}))})}).\u0275fac=function(e){return new(e||c)(f.Wb(o.a),f.Wb(h.a))},c.\u0275prov=f.Ib({token:c,factory:c.\u0275fac}),c),v=n("eY9e"),y=((i=function e(){r(this,e)}).\u0275mod=f.Kb({type:i}),i.\u0275inj=f.Jb({factory:function(e){return new(e||i)},imports:[[u.c,a.j.forFeature(v.b,v.a),o.b.forFeature([m])]]}),i)},z1kL:function(e,t,r){"use strict";r.d(t,"a",function(){return u}),r.d(t,"b",function(){return a});var n=r("l7P3"),c=r("ckED"),i=Object(n.o)(c.a),u=Object(n.q)(i,function(e){var t;return null===(t=Object.values(e||{}))||void 0===t?void 0:t.filter(function(e){return 0!==e.id})}),a=function(e){var t=e.id;return Object(n.q)(i,function(e){return e[t]})}}}])}();