1import{a as qt}from"./chunk-BJEJFIRT.js";import{a as Fi,b as Ze,k as Qi,l as qi,m as Ui}from"./chunk-JCT6PWLQ.js";import"./chunk-OQXM7UJJ.js";import{b as de}from"./chunk-EQ7GNPUY.js";import"./chunk-73LOAU5Y.js";import{$ as Ri,Aa as jt,Ba as We,Ca as zt,Ha as ct,I as Oi,Ia as pt,Ja as ji,Sa as Je,Ta as zi,Tb as Yi,Ua as Xe,W as Rt,fb as et,h as pe,i as Vt,jb as Qt,m as Ot,na as L,oa as M,s as Ai,w as Vi}from"./chunk-JQAS4NFY.js";import{a as Be,b as Ae}from"./chunk-O3U3CUHU.js";import{a as it,b as lt,c as J,d as Ni,e as Ce}from"./chunk-PBIYNNKO.js";import{a as Pi}from"./chunk-BPR56HGA.js";import{$a as x,$b as c,$c as Se,Ad as Ft,Ae as ie,Af as gt,Bb as yi,Bc as wi,Bd as Ti,Bi as Ye,Cd as Ii,Ce as Di,Ch as W,Ci as Ke,Dh as oe,Eb as l,Ed as bi,Ee as G,Ei as $i,Fb as v,Fh as se,Fi as Hi,Gb as u,H as gi,Hb as ee,Hd as be,He as ae,Ib as xi,Id as Ei,Ie as st,J as Tt,Jd as fe,Ka as _i,Kd as rt,Ld as ki,Md as ti,N as It,Ne as ke,Oa as n,Ob as $,Pd as ii,Pi as $t,Q as Ci,Qh as le,Qi as Ht,R as P,Rh as ce,Sh as ge,Si as Gt,Ta as _,Te as De,U as E,Ub as D,Uh as Fe,V as k,Va as q,Vb as N,Wa as Et,We as Le,Xb as B,Xc as Dt,Xd as ve,Yb as nt,Yh as Mi,_b as s,_c as Lt,_e as Me,_h as Pe,ad as we,ai as Pt,bf as ne,cd as Mt,cf as re,ci as Nt,db as S,dc as b,df as Y,di as Bi,ef as K,fb as w,fd as he,fi as R,gi as j,hb as kt,hi as Ne,ib as ft,id as Bt,if as Li,ii as Ve,jb as vt,ji as Oe,k as X,kb as d,ki as $e,l as Q,lb as r,mb as o,mi as He,nb as g,ni as Ge,oc as xe,pb as T,pc as Si,pd as Te,pi as Re,pj as Gi,qb as I,qd as Ie,qe as Ee,qi as je,re as ot,s as wt,sb as A,si as ze,tb as C,tc as ue,ti as Qe,ub as f,vi as qe,wa as bt,wb as Z,xb as V,xe as te,yb as O,
1ye as U,yi as At,zb as ye,zi as Ue}from"./chunk-5O24QCRC.js";function la(t,m){t&1&&(r(0,"button",2),l(1),s(2,"translate"),o()),t&2&&(n(),v(c(2,1,"keywords.products")))}function ca(t,m){t&1&&(r(0,"button",3),l(1),s(2,"translate"),o()),t&2&&(n(),v(c(2,1,"keywords.services")))}function pa(t,m){t&1&&(r(0,"button",4),l(1),s(2,"translate"),o()),t&2&&(n(),v(c(2,1,"keywords.composites")))}function ma(t,m){t&1&&(r(0,"button",5),l(1),s(2,"translate"),o()),t&2&&(n(),v(c(2,1,"keywords.estimates")))}var Wi=(()=>{class t{constructor(e,a,i,p){this._clinicService=e,this._router=a,this._headerService=i,this._authService=p,this.hideClinicDropdown=!1,this.skipLinks=["catalogue"],this.allSubscriptions=new Q}ngOnInit(){this.allSubscriptions.add(this._clinicService.$clinicObservable.subscribe(e=>{this.clinicId=e.clinicID,this.createHeaderForm(e)},e=>console.log("catalogue",e))),this.allSubscriptions.add(this._router.events.pipe(gi(e=>e instanceof bi)).subscribe(()=>{this.createHeaderForm(this.clinic)})),this.canViewProducts$=this._authService.isFlagClaimTrue(M.products,L.c_viewProducts),this.canViewComposites$=this._authService.isFlagClaimTrue(M.composites,L.c_viewComposites),this.canViewEstimates$=this._authService.isFlagClaimTrue(M.estimates,L.c_viewEstimates)}ngOnDestroy(){this.allSubscriptions.unsubscribe(),this._headerService.reset()}createHeaderForm(e){if(!e)return;let a=[];e.clinicPhones.length>0&&a.push({label:"phone",type:"phone",value:e.clinicPhones[0]?.phone,hasMultipleValues:e.clinicPhones.length>1,valueList:e.clinicPhones.length>1?e.clinicPhones.map(p=>p.phone):void 0}),e.clinicEmails.length>0&&a.push({label:"emailAddress",type:"email",value:e.clinicEmails[0]?.emailAddress,hasMultipleValues:e.clinicEmails.length>1,valueList:e.clinicEmails.length>1?e.clinicEmails.map(p=>p.emailAddress):void 0}),e.clinicAddresses.length>0&&a.push({label:"address",type:"address",value:e.clinicAddresses[0]?.formattedAddress,hasMultipleValues:e.clinicAddresses.length>1,valueList:e.clinicAddresses.length>1?e.clinicAddresses.map(p=>p?.formattedAddress):void 0});let i={title:e.clinicName,info:a,showHeaderInfoFor:"clinic"};this._headerService.updateValue(i)}static{this.\u0275fac=function(a){return new(a||t)(_(W),_(fe),_(Ai),_(ve))}}static{this.\u0275cmp=q({type:t,selectors:[["app-catalogue"]],standalone:!1,decls:12,vars:12,consts:[["mat-tab-nav-bar","",1,"marginBettwenCardsDashboard","mt-30"],["fxLayout","row","fxLayoutGap","5px"],["mat-raised-button","","id","inventory-manager","routerLink","manager","routerLinkActive","mat-tab-link-active",1,"primary-button","extra-long-large"],["mat-raised-button","","id","services","routerLink","services","routerLinkActive","mat-tab-link-active",1,"primary-button","extra-long-large"],["mat-raised-button","","id","composites","routerLink","composites","routerLinkActive","mat-tab-link-active",1,"primary-button","extra-long-large"],["mat-raised-button","","id","estimates","routerLink","estimates","routerLinkActive","mat-tab-link-active",1,"primary-button","extra-long-large"],[1,"marginBettwenCardsDashboard"]],template:function(a,i){a&1&&(r(0,"nav",0)(1,"div",1),S(2,la,3,3,"button",2),s(3,"async"),S(4,ca,3,3,"button",3),s(5,"async"),S(6,pa,3,3,"button",4),s(7,"async"),S(8,ma,3,3,"button",5),s(9,"async"),o()(),r(10,"div",6),g(11,"router-outlet"),o()),a&2&&(n(2),w(c(3,4,i.canViewProducts$)?2:-1),n(2),w(c(5,6,i.canViewProducts$)?4:-1),n(2),w(c(7,8,i.canViewComposites$)?6:-1),n(2),w(c(9,10,i.canViewEstimates$)?8:-1))},dependencies:[Ei,rt,ki,K,Y,ot,$i,ue,U],encapsulation:2})}}return t})();var ha=["categoryDropdown"],fa=["taxDropdown"],Ji=()=>({"max-width-150":!0}),va=t=>({"mb-5":t}),ga=t=>({invisible:t}),Ca=t=>({"blurry-table":t}),_a=()=>[5,10,25,100],Xi=()=>({"max-width-150":!1}),ya=()=>({"pt-30":!0}),xa=t=>({"disable-pointer-events":t}),Wt=(t,m,e)=>[t,m,"symbol","1.2-2",e],Sa=t=>({"blurry-bttn":t}),wa=(t,m)=>m.key;function Ta(t,m){if(t&1&&(r(0,"span"),l(1),o()),t&2){let e=f(2);n(),v(e.getSelectedCategoryName())}}function Ia(t,m){if(t&1&&(r(0,"span"),l(1),s(2,"translate"),o()),t&2){let e,a=f(2);n(),xi("",c(2,3,"keywords.selected"),": ",((e=a.filterFormGroup.get("category").value)==null?null:e.length)||0,"/",(a.productCategoryList==null?null:a.productCategoryList.length)||0)}}function ba(t,m){if(t&1&&(r(0,"mat-option",68),l(1),o()),t&2){let e=m.$implicit;d("value",e.key)("matTooltip",e.value),n(),u(" ",e.value," ")}}function Ea(t,m){if(t&1){let e=A();r(0,"mat-icon",70),s(1,"translate"),C("click",function(i){E(e);let p=f(2);return i.stopPropagation(),k(p.clearCategorySelection())}),l(2,"cancel"),o()}t&2&&d("matTooltip",c(1,1,"keywords.clear"))}function ka(t,m){if(t&1){let e=A();r(0,"mat-form-field",8)(1,"mat-label"),l(2),s(3,"translate"),o(),r(4,"mat-select",67,2),C("selectionChange",function(i){E(e);let p=f();return k(p.onSelectedProductCategory(i))}),r(6,"mat-select-trigger"),S(7,Ta,2,1,"span")(8,Ia,3,5,"span"),o(),ft(9,ba,2,3,"mat-option",68,wa),o(),S(11,Ea,3,3,"mat-icon",69),o()}if(t&2){let e,a,i=f();
1d("ngClass.gt-sm",D(6,Xi)),n(2),v(c(3,4,"keywords.selectCategory")),n(5),w((((e=i.filterFormGroup.get("category").value)==null?null:e.length)||0)===1?7:(((e=i.filterFormGroup.get("category").value)==null?null:e.length)||0)>1?8:-1),n(2),vt(i.productCategoryList),n(2),w((((a=i.filterFormGroup.get("category").value)==null?null:a.length)||0)>0?11:-1)}}function Da(t,m){if(t&1){let e=A();r(0,"smartnet-dropdown",71,3),s(2,"translate"),C("on-select",function(i){E(e);let p=f();return k(p.onSelectedProductCategory(i))}),o()}if(t&2){let e=f();d("ngClass.gt-sm",D(6,Xi))("itemList",e.productCategoryList)("placeholder",c(2,4,"keywords.selectCategory"))("isMultiple",!1)}}function La(t,m){if(t&1&&(r(0,"mat-option",14),l(1),o()),t&2){let e=m.$implicit;d("value",e.key),n(),u(" ",e.value," ")}}function Ma(t,m){t&1&&g(0,"div",22)}function Ba(t,m){if(t&1&&(r(0,"div",23),l(1),s(2,"translate"),o()),t&2){let e=f();n(),ee(" ",e.productCount," ",c(2,2,"keywords.productList")," ")}}function Fa(t,m){if(t&1&&(r(0,"div",26),g(1,"div",72),r(2,"div",73),l(3),s(4,"translate"),o()()),t&2){let e=f();d("ngClass.gt-xs",D(5,ya)),n(3),ee("",e.productCount," ",c(4,3,"keywords.productList"))}}function Pa(t,m){t&1&&(r(0,"th",74),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.position")),n(2),u(" ",c(3,4,"keywords.#")," "))}function Na(t,m){if(t&1&&(r(0,"td",75)(1,"div",76),l(2),s(3,"translate"),o(),r(4,"div",77),l(5),o()()),t&2){let e=m.index,a=f();n(2),u(" ",c(3,2,"keywords.#")," "),n(3),v(a.getIndexOfItem(e))}}function Aa(t,m){t&1&&(r(0,"th",80),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"keywords.productImage")," "))}function Va(t,m){t&1&&(r(0,"div",84),g(1,"mat-progress-spinner",85),o())}function Oa(t,m){if(t&1){let e=A();r(0,"td",81)(1,"div",76),l(2),s(3,"translate"),o(),r(4,"div",82),s(5,"translate"),r(6,"img",83),C("click",function(i){let p=E(e).$implicit,h=f(2);return k(h.chooseImage(i,p))})("error",function(i){let p=E(e).$implicit,h=f(2);return k(h.onImageError(i,p))}),o(),S(7,Va,2,0,"div",84),o()()}if(t&2){let e=m.$implicit,a=f(2);n(2),u(" ",c(3,7,"keywords.productImage")," "),n(2),d("matTooltip",$(c(5,9,"keywords.uploadImage"))),n(2),yi("uploading",e.isImageUploading),d("src",a.getProductImage(e),_i),n(),w(e.isImageUploading?7:-1)}}function $a(t,m){t&1&&(T(0,42),x(1,Aa,3,3,"th",78)(2,Oa,8,11,"td",79),I())}function Ha(t,m){t&1&&(r(0,"th",86),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.productName")),n(2),u(" ",c(3,4,"keywords.productName")," "))}function Ga(t,m){if(t&1){let e=A();r(0,"td",87)(1,"div",76),l(2),s(3,"translate"),o(),r(4,"div",88)(5,"a",89),s(6,"async"),C("click",function(){let i=E(e).$implicit,p=f();return k(p.addEditProduct(i))}),l(7),o()()()}if(t&2){let e=m.$implicit,a=f();d("matTooltip",$(e.productName)),n(2),u(" ",c(3,5,"keywords.productName")," "),n(3),d("ngClass",N(9,xa,!c(6,7,a.canEditProducts$))),n(2),u(" ",e.productName," ")}}function Ra(t,m){t&1&&(r(0,"th",86),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.category")),n(2),u(" ",c(3,4,"keywords.category")," "))}function ja(t,m){if(t&1&&(r(0,"td",90)(1,"div",76),l(2),s(3,"translate"),o(),r(4,"div",77),l(5),o()()),t&2){let e=m.$implicit,a=f();d("matTooltip",a.getCategoryTooltip(e)),n(2),u(" ",c(3,3,"keywords.category")," "),n(3),u(" ",a.getCategoryDisplay(e)," ")}}function za(t,m){t&1&&(r(0,"th",74),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.form")),n(2),u(" ",c(3,4,"keywords.form")," "))}function Qa(t,m){if(t&1&&(r(0,"td",90)(1,"div",76),l(2),s(3,"translate"),o(),r(4,"div",77),l(5),o()()),t&2){let e=m.$implicit;d("matTooltip",$(e.productFormName)),n(2),u(" ",c(3,4,"keywords.form")," "),n(3),u(" ",e.productFormName," ")}}function qa(t,m){t&1&&(r(0,"th",91),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.totalPrice")),n(2),v(c(3,4,"keywords.totalPrice")))}function Ua(t,m){if(t&1&&(r(0,"td",92),s(1,"currency"),r(2,"div",76),l(3),s(4,"translate"),o(),r(5,"div",77),l(6),s(7,"currency"),o()()),t&2){let e=m.$implicit,a=f();d("matTooltip",$(b(1,4,B(18,Wt,e.totalPrice,a.selectedClinic==null?null:a.selectedClinic.currencyName,a.selectedClinic==null?null:a.selectedClinic.cultureName)))),n(3),u(" ",c(4,10,"keywords.totalPrice")," "),n(3),u(" ",b(7,12,B(22,Wt,e.totalPrice,a.selectedClinic==null?null:a.selectedClinic.currencyName,a.selectedClinic==null?null:a.selectedClinic.cultureName))," ")}}function Ya(t,m){t&1&&(r(0,"th",91),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.professionalFeePrice")),n(2),u(" ",c(3,4,"keywords.fee")," "))}function Ka(t,m){if(t&1&&(r(0,"td",92),s(1,"currency"),r(2,"div",76),l(3),s(4,"translate"),o(),r(5,"div",77),l(6),s(7,"currency"),o()()),t&2){let e=m.$implicit,a=f();d("matTooltip",$(b(1,4,B(18,Wt,e.professionalFeePrice,a.selectedClinic==null?null:a.selectedClinic.currencyName,a.selectedClinic==null?null:a.selectedClinic.cultureName)))),n(3),u(" ",c(4,10,"keywords.fee")," "),n(3),u(" ",b(7,12,B(22,Wt,e.professionalFeePrice,a.selectedClinic==null?null:a.selectedClinic.currencyName,a.selectedClinic==null?null:a.selectedClinic.cultureName))," ")}}function Wa(t,m){t&1&&(r(0,"th",93),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.markupPercent")),n(2),u(" ",c(3,4,"keywords.markupPercent")," "))}function Ja(t,m){if(t&1&&(r(0,"td",92)(1,"div",76),l(2),s(3,"translate"),o(),r(4,"div",77),l(5),o()()),t&2){let e=m.$implicit;d("matTooltip",$(e.markup)),n(2),u(" ",c(3,4,"keywords.markupPercent")," "),n(3),u(" ",e.markup," % ")}}function Xa(t,m){t&1&&(r(0,"th",93),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.tax")),n(2),u(" ",c(3,4,"keywords.tax")))}function Za(t,m){if(t&1&&(r(0,"td",92)(1,"div",76),l(2),s(3,"translate"),o(),r(4,"div",77),l(5),o()()),t&2){let e=m.$implicit;d("matTooltip",$(e.taxName?e.taxName+" ("+e.taxValue+"%)":"")),n(2),u(" ",c(3,4,"keywords.tax")," "),n(3),u(" ",e.taxName?e.taxName+" ("+e.taxValue+"%)":""," ")}}function en(t,m){t&1&&(r(0,"th",94),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.reminder")),n(2),u(" ",c(3,4,"keywords.reminder")," "))}function tn(t,m){t&1&&g(0,"i",96)}function an(t,m){if(t&1&&(r(0,"td",95)(1,"div",76),l(2),s(3,"translate"),o(),r(4,"div",77),S(5,tn,1,0,"i",96),o()()),t&2){let e=m.$implicit;n(2),u(" ",c(3,2,"keywords.reminder")," "),n(3),w(e.reminder?5:-1)}}function nn(t,m){t&1&&(r(0,"th",97),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"ke
1ywords.status")))}function rn(t,m){if(t&1&&(r(0,"td",75)(1,"div",76),l(2),s(3,"translate"),o(),r(4,"div",77),l(5),s(6,"translate"),o()()),t&2){let e=m.$implicit;n(2),u(" ",c(3,2,"keywords.status")," "),n(3),u(" ",c(6,4,e.statusTypeName)," ")}}function on(t,m){t&1&&(r(0,"th",98),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"keywords.actions")))}function sn(t,m){if(t&1){let e=A();r(0,"td",75)(1,"div",76),l(2),s(3,"translate"),o(),r(4,"div",77)(5,"div")(6,"div",99)(7,"button",100),s(8,"translate"),s(9,"async"),C("click",function(){let i=E(e).$implicit,p=f();return k(p.addEditProduct(i))}),r(10,"i",101),l(11,"edit"),o()(),r(12,"button",102),s(13,"translate"),s(14,"async"),C("click",function(){let i=E(e).$implicit,p=f();return k(p.deleteProduct(i))}),r(15,"mat-icon",103),l(16,"delete_outline"),o()()()()()()}if(t&2){let e=f();n(2),u(" ",c(3,6,"keywords.actions")," "),n(4),d("ngClass",N(16,Sa,e.showLoadingIndicator)),n(),d("matTooltip",c(8,8,"keywords.edit"))("disabled",!c(9,10,e.canEditProducts$)),n(5),d("matTooltip",c(13,12,"keywords.delete"))("disabled",!c(14,14,e.canDeleteProducts$))}}function ln(t,m){t&1&&g(0,"tr",104)}function cn(t,m){t&1&&g(0,"tr",105)}var Zi=(()=>{class t{get statusTypes(){return this._enumeratorsService.statusType}get showProductImage(){return this._clinicService.hasFeature("ProductImage")}setFilterFormCachedParamIDs(){this.FF_CACHE.filterFormGroupID=this._filterFormsCacheService.getFilterFormID()}setCachedData(){this.setFilterFormCachedParamIDs(),this._filterFormsCacheService.patchFilterFormValue(this.FF_CACHE.filterFormGroupID,this.filterFormGroup)}cacheFilterForm(){this._filterFormsCacheService.saveFilterFormValue(this.FF_CACHE.filterFormGroupID,this.filterFormGroup)}constructor(){this.showLoadingIndicator=!0,this.productList=[],this.productCategoryList=[],this.taxList=[],this.allSubscriptions=new Q,this.folderName=ii.folderName,this.isPawsquad=ii.isPawsquad,this.displayedInventoryManagerColumns=["position","productName","categoryName","productFormName","totalPrice","professionalFeePrice","markup","tax","reminder","statusType","actionButtons"],this.filterFormGroup=new Mt({searchText:new he(""),category:new he(this.isPawsquad?null:[]),clinicTaxID:new he(null),statusType:new he(1)}),this.FF_CACHE={filterFormGroupID:""},this.dialog=P(ke),this._inventoryService=P(Ni),this._clinicTaxService=P(We),this._productCategoryService=P(ji),this._clinicService=P(W),this._snackBarTemplate=P(ie),this._authService=P(ve),this._translateService=P(te),this._enumeratorsService=P(Be),this._updateImageService=P(Vi),this._filterFormsCacheService=P(Qt),this._servicesManager=P(Ce);for(let e=0;e<this._inventoryService.noInitElements;e++)this.productList.push(new Fi)}ngOnInit(){let e=this._translateService.instant("keywords.productCategories"),a=this._translateService.instant("keywords.taxService");this.path=`${Di.apiEndpoint}`,this.allSubscriptions.add(this._inventoryService.$paginParamsObservable.subscribe(i=>{this.paging=i,this.startPos=(i.pageNumber-1)*i.pageSize+1,this.productCount=i.totalCount})),this.allSubscriptions.add(this._clinicService.$clinicObservable.subscribe(i=>{this.displayedInventoryManagerColumns=this.showProductImage?["position","productImage","productName","categoryName","productFormName","totalPrice","professionalFeePrice","markup","tax","reminder","statusType","actionButtons"]:["position","productName","categoryName","productFormName","totalPrice","professionalFeePrice","markup","tax","reminder","statusType","actionButtons"],this.clinicId=i.clinicID,this.selectedClinic=i,this.clinicId&&(this.setCachedData(),this._clinicTaxService.getList(null,this.clinicId).then(p=>{p.map(h=>{this.taxList.push({key:h.clinicTaxID,value:h.taxName})})}).catch(p=>{this._snackBarTemplate.errorSnackBarGet(a,p)}),this._productCategoryService.getList(null,this.clinicId).then(p=>{p.map(h=>{this.productCategoryList.push({key:h.categoryID,value:h.categoryName})})}).catch(p=>{this._snackBarTemplate.errorSnackBarGet(e,p)})),this.fetchProducts()})),this.allSubscriptions.add(this.paginator.page.subscribe(i=>{this.paging.pageNumber=i.pageIndex+1,this.paging.pageSize=i.pageSize,this.fetchProducts()})),this.allSubscriptions.add(this.sort.sortChange.subscribe(i=>{this.sortParams=new et,i.active=="categoryName"&&(i.active="productCategory.categoryName"),this.sortParams.sort=i.active+" "+i.direction,this.paging.pageNumber=1,this.fetchProducts()})),this.productList||this.fetchProducts(),this.canCreateProducts$=this._authService.isFlagClaimTrue(M.products,L.c_createProducts),this.canEditProducts$=this._authService.isFlagClaimTrue(M.products,L.c_editProducts),this.canDeleteProducts$=this._authService.isFlagClaimTrue(M.products,L.c_deleteProducts)}fetchProducts(){return X(this,null,function*(){this.showLoadingIndicator=!0;let e=this.filterFormGroup.getRawValue(),a=this.createProductSearch(e),i=new G;i.pagingParams=this.paging,i.search=a,i.sort=this.sortParams;let p=this._translateService.instant("keywords.listOfProducts"),h=yield this._inventoryService.getList(i,this.clinicId).catch(y=>
1{this.productList=[],this.productCount=0,this._snackBarTemplate.errorSnackBarGet(p,y)});h&&(this.productList=h,this.productList.forEach(y=>{y.statusTypeName=this.mapStatusTypeToName(y.statusType),y.totalPrice=this.calculateProductTotalPrice(y)})),this.cacheFilterForm(),this.showLoadingIndicator=!1})}calculateProductTotalPrice(e){let a=e?.price??0,i=e?.professionalFeePrice??0,p=e?.taxValue??0,h=e?.markup??0;return this._servicesManager.getTotalPrice(Number(a)+Number(i),h,p)}refreshPaging(){this.paging.pageNumber=1}createProductSearch(e=this.filterFormGroup.getRawValue()){let a=new lt,i=e.searchText?.trim()??"",p=e.category;return i.length>2?a.searchText=i:i.length>=1&&this._snackBarTemplate.errorSnackBar(this._translateService.instant("keywords.youMustEnterAtLeast3Characters")),e.clinicTaxID&&(a.clinicTaxID=e.clinicTaxID),p&&(!Array.isArray(p)||p.length>0)&&(this.isPawsquad?a.categoryID=Array.isArray(p)?p[0]:p:a.categoryIDs=Array.isArray(p)?p:[p]),a.statusType=e.statusType,a}onSelectedProductCategory(e){this.filterFormGroup.get("category").setValue(e.value),this.refreshPaging(),this.fetchProducts()}getSelectedCategoryName(){let e=this.filterFormGroup.get("category").value;if(!e||!e.length)return"";let a=Array.isArray(e)?e[0]:e;return this.productCategoryList.find(i=>i.key===a)?.value||""}clearCategorySelection(){this.filterFormGroup.get("category").setValue(this.isPawsquad?null:[]),this.fetchProducts()}onSelectedTax(e){this.filterFormGroup.get("clinicTaxID").setValue(e.value),this.refreshPaging(),this.fetchProducts()}getIndexOfItem(e){return this.startPos+e}export(e){let a=this.createProductSearch(),i=new G;i.pagingParams=this.paging,i.search=a,i.sort=this.sortParams,this._inventoryService.export(i,e.toString(),this.clinicId)}deleteProduct(e){let a=this._translateService.instant("keywords.areYouSureYouWantToDeleteProduct1VALUE",{value:e.productName}),i=this._translateService.instant("keywords.deleteSelectedProduct"),p=this._translateService.instant("keywords.product");this.dialog.open(Ae,{width:"500px",data:{title:i,text:a,confirmAction:()=>{this.showLoadingIndicator=!0,this._inventoryService.delete(this.clinicId,e.productID).then(()=>{this.productList.length>1?(this.productList=this.productList.filter(h=>h.productID!=e.productID),this.productCount--,this.paging.totalCount--,this.showLoadingIndicator=!1):(this.paging.pageNumber=1,this.fetchProducts()),this._snackBarTemplate.successSnackBarDelete(p)}).catch(h=>{this._snackBarTemplate.errorSnackBarDelete(p,h),this.showLoadingIndicator=!1})}}})}addEditProduct(e){this.dialog.open(Qi,{width:"95vw",maxWidth:"1280px",maxHeight:"90vh",data:{productID:e?.productID,confirmAction:a=>{a.statusTypeName=this.mapStatusTypeToName(a.statusType),e?this.productList=this.productList.map(i=>i.productID==e.productID?a:i):a&&this.fetchProducts()}}})}mapStatusTypeToName(e){switch(e){case gt.Draft:return"keywords.draft";case gt.Active:return"keywords.active";case gt.StandBy:return"keywords.standBy";case gt.Pasive:return"keywords.passive"}}onSearch(e){this.filterFormGroup.patchValue({searchText:e.target.value.trim(),statusType:1}),this.refreshPaging(),this.fetchProducts()}onClear(){this.filterFormGroup.patchValue({searchText:"",category:this.isPawsquad?null:[]}),this.refreshPaging(),this.fetchProducts()}chooseImage(e,a){return X(this,null,function*(){e.stopPropagation();var i;i=this.dialog.open(Oi,{width:"700px",panelClass:"custom-dialog-container",data:{item:a}}),i.afterClosed().subscribe(p=>{p&&(this.productImageName=p.imageName,this.updateProductImage(p,a))})})}updateProductImage(e,a){return X(this,null,function*(){a.isImageUploading=!0;let i=`/clinics/${this.clinicId}/products/${a.productID}/productimage`,p={profileImage:e,imageFileName:this.productImageName},h=this._translateService.instant("keywords.imageUploadSuccess"),y=this._translateService.instant("keywords.imageUploadError");this._updateImageService.update(i,p).then(F=>{let H=F?.documentDataID,z=H+F?.documentExtension;H&&(a.productImage=z,a.newImage=!0),a.isImageUploading=!1,this._snackBarTemplate.successSnack(h)}).catch(F=>{this._snackBarTemplate.errorSnackBar(y),a.isImageUploading=!1})})}getProductImage(e){return e.productImage?e.productImage.toString().indexOf("http")===-1?`${this.path}/images/thumbs/33/33/${e.productImage}`:e.productImage:`../../../../assets/images/${this.folderName}/product_image.png`}onImageError(e,a){if(a.newImage)return;let i=e.target;i.src=`../../../assets/images/${this.folderName}/not_found.png`}getCategoryDisplay(e){if(this.isPawsquad)return e.categoryName;if(e.categoryNames&&e.categoryNames.length>0){let a=e.categoryNames.join(", "),i=20;return a.length>i?a.substring(0,i)+"...":a}return e.categoryName||""}getCategoryTooltip(e){return this.isPawsquad?e.categoryName:e.categoryNames&&e.categoryNames.length>0?e.categoryNames.join(", "):e.categoryName||""}clearFilters(){this.filterFormGroup.reset({searchText:"",category:this.isPawsquad?null:[],clinicTaxID:null,
vendor: 5,518 bytes, line 1
1statusType:1}),this.searchBar.clearSearchFilter(),this.refreshPaging(),this.fetchProducts()}ngOnDestroy(){this.allSubscriptions.unsubscribe()}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275cmp=q({type:t,selectors:[["app-inventory-manager"]],viewQuery:function(a,i){if(a&1&&Z(R,7)(j,7)(pe,5)(ha,5)(fa,5),a&2){let p;V(p=O())&&(i.paginator=p.first),V(p=O())&&(i.sort=p.first),V(p=O())&&(i.searchBar=p.first),V(p=O())&&(i.categoryDropdown=p.first),V(p=O())&&(i.taxDropdown=p.first)}},standalone:!1,decls:105,vars:71,consts:[["taxDropdown",""],["menu","matMenu"],["matCategory",""],["categoryDropdown",""],[1,"mat-card-2"],[1,"cont-position","m-0"],["fxLayout","row","fxLayout.lt-md","column","fxLayoutAlign","start center","fxLayoutAlign.lt-md","start stretch","fxLayoutGap","10px",1,"header-filter-margin",3,"formGroup"],[1,"width-res",3,"keydown.enter","on-clear","preselectedValue","customPlaceholder"],["fxFlex","none","appearance","outline",1,"width-res","category-filter-dropdown",3,"ngClass.gt-sm"],["fxFlex","none","controlName","category",1,"width-res","category-filter-dropdown",3,"ngClass.gt-sm","itemList","placeholder","isMultiple"],["fxFlex","","controlName","clinicTaxID","panelClass","tax-filter-panel",1,"width-res",3,"on-select","ngClass.gt-sm","itemList","placeholder","form"],["ngClass.xs","w-100","fxFlex.xs","","appearance","outline",3,"ngClass.gt-sm"],["formControlName","statusType",3,"selectionChange"],[1,"clearOption",3,"value"],[3,"value"],["fxLayout","row","fxLayoutAlign","end center"],[1,"pointer","clear-icon","hover-cancel",3,"click","matTooltip"],[1,"flex-cell"],["fxLayout","row","fxLayoutAlign","space-between center",1,"mat-table-header"],["fxLayout","row","fxFlex.xs","60"],["fxHide.gt-xs","","fxLayout","column",1,"mb-20"],[3,"ngClass"],[1,"divider","ml-20"],[1,"light-gray-text","table-responsive-header"],["fxHide.gt-xs","",1,"flex-cell"],["fxHide.xs",""],["fxLayout","row",3,"ngClass.gt-xs"],["fxLayout","column","fxFlex.xs","40"],["fxLayout","row","fxLayoutAlign","center center"],["mat-icon-button","",1,"primary-button","light-buttons",3,"click","matTooltip","disabled"],["mat-icon-button","","color","primary",1,"mat-icon-refresh",3,"click","matTooltip"],[1,"gray-icon","material-icons","hover-refresh"],["mat-icon-button","","color","primary",1,"mat-icon-refresh",3,"matTooltip","matMenuTriggerFor"],["mat-menu-item","",1,"drop-text",3,"click"],[1,"border"],["fxLayout","column","fxLayoutAlign","center center","fxLayoutAlign.md","start start","fxLayoutAlign.lg","start start",1,"auto-scroll"],[1,"position-absolute",3,"ngClass"],["mode","indeterminate","diameter","64",1,"loading-indicator"],["fxFill","fill","mat-table","","matSort","",3,"dataSource","ngClass"],["matColumnDef","position"],["mat-header-cell","","class","table-title",3,"matTooltip",4,"matHeaderCellDef"],["mat-cell","","class","default",4,"matCellDef"],["matColumnDef","productImage"],["matColumnDef","productName"],["mat-header-cell","","class","table-title","mat-sort-header","","start","desc",3,"matTooltip",4,"matHeaderCellDef"],["mat-cell","","class","default product-name-cell",3,"matTooltip",4,"matCellDef"],["matColumnDef","categoryName"],["mat-cell","","class","default",3,"matTooltip",4,"matCellDef"],["matColumnDef","productFormName"],["matColumnDef","totalPrice"],["mat-header-cell","","class","table-title text-only-right",3,"matTooltip",4,"matHeaderCellDef"],["mat-cell","","class","default text-only-right",3,"matTooltip",4,"matCellDef"],["matColumnDef","professionalFeePrice"],["matColumnDef","markup"],["mat-header-cell","","class","table-title text-only-right","start","desc",3,"matTooltip",4,"matHeaderCellDef"],["matColumnDef","tax"],["matColumnDef","reminder"],["mat-header-cell","","class","table-title text-center",3,"matTooltip",4,"matHeaderCellDef"],["mat-cell","","class","default text-center",4,"matCellDef"],["matColumnDef","statusType"],["mat-header-cell","","mat-sort-header","","start","desc","disableClear","true","class","table-title",4,"matHeaderCellDef"],["matColumnDef","actionButtons"],["mat-header-cell","","class","table-title text-center",4,"matHeaderCellDef"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["fxLayout","row","fxLayoutAlign","start center",1,"mt-15"],["showFirstLastButtons","true",3,"length","pageIndex","pageSize","pageSizeOptions"],["formControlName","category","multiple","","panelClass","rooms-select-panel",3,"selectionChange"],[3,"value","matTooltip"],["matSuffix","",1,"clear-select-icon",3,"matTooltip"],["matSuffix","",1,"clear-select-icon",3,"click","matTooltip"],["fxFlex","none","controlName","category",1,"width-res","category-filter-dropdown",3,"on-select","ngClass.gt-sm","itemList","placeholder","isMultiple"],[1,"vertical-divider-dashboard"],["fxHide.xs","",1,"light-gray-text"],["mat-header-cell","",1,"table-title",3,"matTooltip"],["mat-cell","",1,"default"],[1,"mat-cell-header"],[1,"mat-cell-value"],["mat-header-cell","","class","table-title",4,"matHeaderCellDef"],["mat-cell","","class","default pointer",4,"matCellDef"],["mat-header-cell","",1,"table-title"],["mat-cell","",1,"default","pointer"],[1,"mat-cell-value","image-wrapper",3,"matTooltip"],[1,"employee-image",3,"click","error","src"],[1,"image-spinner"],["mode","indeterminate","diameter","28"],["mat-header-cell","","mat-sort-header","","start","desc",1,"table-title",3,"matTooltip"],["mat-cell","",1,"default","product-name-cell",3,"matTooltip"],[1,"mat-cell-value","product-name-value"],[1,"curs
1or-pointer-edit",3,"click","ngClass"],["mat-cell","",1,"default",3,"matTooltip"],["mat-header-cell","",1,"table-title","text-only-right",3,"matTooltip"],["mat-cell","",1,"default","text-only-right",3,"matTooltip"],["mat-header-cell","","start","desc",1,"table-title","text-only-right",3,"matTooltip"],["mat-header-cell","",1,"table-title","text-center",3,"matTooltip"],["mat-cell","",1,"default","text-center"],["aria-hidden","true",1,"fa","fa-bell"],["mat-header-cell","","mat-sort-header","","start","desc","disableClear","true",1,"table-title"],["mat-header-cell","",1,"table-title","text-center"],["fxLayout","row","fxLayoutAlign","center center",3,"ngClass"],["mat-icon-button","","color","primary",3,"click","matTooltip","disabled"],[1,"gray-icon","material-icons","hover-edit"],["mat-icon-button","","color","warn",3,"click","matTooltip","disabled"],[1,"gray-icon","hover-delete","m-0"],["mat-header-row",""],["mat-row",""]],template:function(a,i){if(a&1){let p=A();r(0,"mat-card",4)(1,"div",5)(2,"div",6)(3,"app-search-bar",7),s(4,"translate"),C("keydown.enter",function(y){return i.onSearch(y)})("on-clear",function(){return i.onClear()}),o(),S(5,ka,12,7,"mat-form-field",8)(6,Da,3,7,"smartnet-dropdown",9),r(7,"smartnet-dropdown",10,0),s(9,"translate"),C("on-select",function(y){return i.onSelectedTax(y)}),o(),r(10,"mat-form-field",11)(11,"mat-label"),l(12),s(13,"translate"),o(),r(14,"mat-select",12),C("selectionChange",function(){return E(p),i.refreshPaging(),k(i.fetchProducts())}),r(15,"mat-option",13),l(16),s(17,"translate"),o(),ft(18,La,2,2,"mat-option",14,kt),o()(),r(20,"div",15)(21,"mat-icon",16),s(22,"translate"),C("click",function(){return i.clearFilters()}),l(23,"cancel"),o()(),g(24,"div",17),o()(),r(25,"div",18)(26,"div",19)(27,"div",20)(28,"h2",21),l(29),s(30,"translate"),o(),S(31,Ma,1,0,"div",22),S(32,Ba,3,4,"div",23),o(),g(33,"div",24),r(34,"h2",25),l(35),s(36,"translate"),o(),S(37,Fa,5,6,"div",26),o(),r(38,"div",27)(39,"div",28)(40,"button",29),s(41,"translate"),s(42,"async"),C("click",function(){return i.addEditProduct()}),r(43,"mat-icon"),l(44,"add"),o()(),r(45,"button",30),s(46,"translate"),C("click",function(){return i.fetchProducts()}),r(47,"i",31),l(48,"refresh"),o()(),r(49,"button",32),s(50,"translate"),r(51,"i",31),l(52,"more_horiz"),o()(),r(53,"mat-menu",null,1)(55,"button",33),C("click",function(){return i.export(1)}),l(56),s(57,"translate"),o(),r(58,"button",33),C("click",function(){return i.export(0)}),l(59),s(60,"translate"),o()()()()(),r(61,"mat-card-content",34)(62,"div",35)(63,"div",36),g(64,"mat-progress-spinner",37),o(),r(65,"table",38),T(66,39),x(67,Pa,4,6,"th",40)(68,Na,6,4,"td",41),I(),S(69,$a,3,0,"ng-container",42),T(70,43),x(71,Ha,4,6,"th",44)(72,Ga,8,11,"td",45),I(),T(73,46),x(74,Ra,4,6,"th",44)(75,ja,6,5,"td",47),I(),T(76,48),x(77,za,4,6,"th",40)(78,Qa,6,6,"td",47),I(),T(79,49),x(80,qa,4,6,"th",50)(81,Ua,8,26,"td",51),I(),T(82,52),x(83,Ya,4,6,"th",50)(84,Ka,8,26,"td",51),I(),T(85,53),x(86,Wa,4,6,"th",54)(87,Ja,6,6,"td",51),I(),T(88,55),x(89,Xa,4,6,"th",54)(90,Za,6,6,"td",51),I(),T(91,56),x(92,en,4,6,"th",57)(93,an,6,4,"td",58),I(),T(94,59),x(95,nn,3,3,"th",60)(96,rn,7,6,"td",41),I(),T(97,61),x(98,on,3,3,"th",62)(99,sn,17,18,"td",41),I(),x(100,ln,1,0,"tr",63)(101,cn,1,0,"tr",64),o()()(),r(102,"div",65)(103,"div",17),g(104,"mat-paginator",66),o()()()}if(a&2){let p,h=ye(54);n(2),d("formGroup",i.filterFormGroup),n(),d("preselectedValue",(p=i.filterFormGroup.get("searchText"))==null?null:p.value)("customPlaceholder",c(4,36,"keywords.searchInventory")),n(2),w(i.isPawsquad?6:5),n(2),d("ngClass.gt-sm",D(62,Ji))("itemList",i.taxList)("placeholder",c(9,38,"keywords.selectTax"))("form",i.filterFormGroup),n(3),d("ngClass.gt-sm",D(63,Ji)),n(2),v(c(13,40,"keywords.statusType")),n(3),d("value",null),n(),v(c(17,42,"keywords.showAll")),n(2),vt(i.statusTypes),n(3),d("matTooltip",c(22,44,"keywords.clearFilters")),n(7),d("ngClass",N(64,va,i.productC
1ount&&i.productCount>0)),n(),u(" ",c(30,46,"keywords.productList")," "),n(2),w(i.productCount&&i.productCount>0?31:-1),n(),w(i.productCount&&i.productCount>0?32:-1),n(3),u(" ",c(36,48,"keywords.productList")," "),n(2),w(i.productCount&&i.productCount>0?37:-1),n(3),d("matTooltip",c(41,50,"keywords.add"))("disabled",!c(42,52,i.canCreateProducts$)),n(5),d("matTooltip",c(46,54,"keywords.refresh")),n(4),d("matTooltip",c(50,56,"keywords.export"))("matMenuTriggerFor",h),n(7),u(" ",c(57,58,"keywords.exportPDF")," "),n(3),u(" ",c(60,60,"keywords.exportExcel")," "),n(4),d("ngClass",N(66,ga,!i.showLoadingIndicator)),n(2),d("dataSource",i.productList)("ngClass",N(68,Ca,i.showLoadingIndicator)),n(4),w(i.showProductImage?69:-1),n(31),d("matHeaderRowDef",i.displayedInventoryManagerColumns),n(),d("matRowDefColumns",i.displayedInventoryManagerColumns),n(3),d("length",i.paging.totalCount)("pageIndex",i.paging.pageNumber-1)("pageSize",i.paging.pageSize)("pageSizeOptions",D(70,_a))}},dependencies:[xe,Se,we,K,Y,re,Me,ne,ge,ce,Ie,Te,pe,Vt,Ee,Ye,Ue,Ke,Pe,Fe,Mi,De,oe,se,Nt,Bi,Pt,Le,R,Ve,$e,je,He,Oe,ze,Ge,Re,Qe,qe,le,j,Ne,ue,ae,U],styles:["@media(max-width:959px){.width-res[_ngcontent-%COMP%], .max-width-150[_ngcontent-%COMP%]{width:100%!important}} .category-filter-dropdown .clear-select-icon.mat-icon{cursor:pointer;color:var(--medium-gray)!important;font-size:18px!important;width:18px!important;height:18px!important;line-height:18px!important;margin-left:10px!important;margin-right:4px!important} .category-filter-dropdown .clear-select-icon.mat-icon:hover{color:#555!important}@media(min-width:959px)and (max-width:1370px){.auto-scroll[_ngcontent-%COMP%]{overflow-x:auto}.mb-res[_ngcontent-%COMP%]{margin-bottom:10px!important}}.product-name-cell[_ngcontent-%COMP%], .product-name-value[_ngcontent-%COMP%]{min-width:0}.product-name-value[_ngcontent-%COMP%]{white-space:normal;overflow-wrap:anywhere}@media(min-width:1441px){.mat-column-productName[_ngcontent-%COMP%]{width:20%}}
1.category-filter-dropdown[_ngcontent-%COMP%]{min-width:200px!important;max-width:210px!important} .category-filter-dropdown .mat-mdc-select-panel{min-width:max-content!important;max-width:none!important;width:auto!important} .tax-filter-panel.mat-mdc-select-panel{min-width:max-content!important;max-width:none!important;width:auto!important} .tax-filter-panel.mat-mdc-select-panel .mat-mdc-option .mdc-list-item__primary-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis} .rooms-select-panel{min-width:max-content!important} .rooms-select-panel .mat-mdc-option .mdc-list-item__primary-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}"]})}}return t})();var me=class extends Pi{};var ht=class{constructor(){this.compositeTemplateName="compositeTemplateName",this.isEstimate=!1}};var mn=t=>({"mb-5":t}),dn=t=>({invisible:t}),un=t=>({"blurry-table":t}),hn=()=>[5,10,25,100],fn=()=>({"pt-30":!0}),vn=t=>({"link-disabled":t}),ea=(t,m,e,a)=>[t,m,e,"1.2-2",a],gn=t=>({"blurry-bttn":t});function Cn(t,m){t&1&&g(0,"div",9)}function _n(t,m){if(t&1&&(r(0,"div",10),l(1),s(2,"translate"),o()),t&2){let e=f();n(),ee(" ",e.compositesCount," ",c(2,2,"keywords.composites")," ")}}function yn(t,m){if(t&1&&(r(0,"div",13),g(1,"div",40),r(2,"div",41),l(3),s(4,"translate"),o()()),t&2){let e=f();d("ngClass.gt-xs",D(5,fn)),n(3),ee("",e.compositesCount," ",c(4,3,"keywords.composites"))}}function xn(t,m){t&1&&(r(0,"th",42),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.position")),n(2),u(" ",c(3,4,"keywords.position")," "))}function Sn(t,m){if(t&1&&(r(0,"td",43)(1,"div",44),l(2),s(3,"translate"),o(),r(4,"div",45),l(5),o()()),t&2){let e=m.index,a=f();n(2),u(" ",c(3,2,"keywords.position")," "),n(3),v(a.getIndexOfItem(e))}}function wn(t,m){t&1&&(r(0,"th",46),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.compositeTemplateName")),n(2),u(" ",c(3,4,"keywords.compositeTemplateName")," "))}function Tn(t,m){if(t&1){let e=A();r(0,"td",47)(1,"div",48),l(2),s(3,"translate"),o(),r(4,"div",45)(5,"a",49),C("click",function(){let i=E(e).$implicit,p=f();return k(p.canEditComposites&&p.addEditComposite(i))}),l(6),o()()()}if(t&2){let e=m.$implicit,a=f();d("matTooltip",$(e.compositeTemplateName)),n(2),u(" ",c(3,5,"keywords.compositeTemplateName")," "),n(3),d("ngClass",N(7,vn,!a.canEditComposites)),n(),u(" ",e.compositeTemplateName," ")}}function In(t,m){t&1&&(r(0,"th",50),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.total")),n(2),u(" ",c(3,4,"keywords.total")," "))}function bn(t,m){if(t&1&&(r(0,"td",51),s(1,"currency"),r(2,"div",44),l(3),s(4,"translate"),o(),r(5,"div",45),l(6),s(7,"currency"),o()()),t&2){let e=m.$implicit,a=f();d("matTooltip",$(b(1,4,nt(18,ea,e.total,a.selectedClinic.currencyName,a.selectedClinic.currencySymbol,a.selectedClinic.cultureName)))),n(3),u(" ",c(4,10,"keywords.total")," "),n(3),u(" ",b(7,12,nt(23,ea,e.total,a.selectedClinic==null?null:a.selectedClinic.currencyName,a.selectedClinic==null?null:a.selectedClinic.currencySymbol,a.selectedClinic==null?null:a.selectedClinic.cultureName))," ")}}function En(t,m){t&1&&(r(0,"th",52),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"keywords.actionButtons")," "))}function kn(t,m){if(t&1){let e=A();r(0,"td",43)(1,"div",44),l(2),s(3,"translate"),o(),r(4,"div",45)(5,"div")(6,"div",53)(7,"button",54),s(8,"translate"),s(9,"async"),C("click",function(){let i=E(e).$implicit,p=f();return k(p.addEditComposite(i))}),r(10,"i",55),l(11,"edit"),o()(),r(12,"button",56),s(13,"translate"),s(14,"async"),C("click",function(){let i=E(e).$implicit,p=f();return k(p.deleteComposite(i))}),r(15,"mat-icon",57),l(16,"delete_outline"),o()()()()()()}if(t&2){let e=f();n(2),u(" ",c(3,6,"keywords.actionButtons")," "),n(4),d("ngClass",N(16,gn,e.showLoadingIndicator)),n(),d("matTooltip",c(8,8,"keywords.edit"))("disabled",!c(9,10,e.canEditComposites$)),n(5),d("matTooltip",c(13,12,"keywords.delete"))("disabled",!c(14,14,e.canDeleteComposites$))}}function Dn(t,m){t&1&&g(0,"tr",58)}function Ln(t,m){t&1&&g(0,"tr",59)}var ta=(()=>{class t{constructor(e,a,i,p,h,y,F,H){this._router=e,this._ar=a,this._compositeService=i,this._clinicService=p,this.dialog=h,this._snackBarTemplate=y,this._translateService=F,this._authService=H,this.displayedComposites=["position","compositeName","total","actionButtons"],this.showLoadingIndicator=!0,this.allSubscriptions=new Q,this.compositesList=[],this.searchByName="",this.canEditComposites=!1;for(let z=0;z<i.noInitElements;z++)this.compositesList.push(new ht);this.getKeywords()}ngOnInit(){this.canCreateComposites$=this._authService.isFlagClaimTrue(M.composites,L.c_createComposites),this.canEditComposites$=this._authService.isFlagClaimTrue(M.composites,L.c_editComposites),this.canDeleteComposites$=this._authService.isFlagClaimTrue(M.composites,L.c_deleteComposites),this.canEditComposites$.subscribe(e=>this.canEditComposites=e),this.allSubscriptions.add(this._compositeService.$paginParamsObservable.subscribe(e=>{this.paging=e,this.startPos=(e.pageNumber-1)*e.pageSize+1,this.compositesCount=e.totalCount})),this.paging.pageNumber=1,this.startPos=1,this.allSubscriptions.add(this._clinicService.$clinicObservable.subscribe(e=>{this.clinicID=e.clinicID,this.selectedClinic=e,this.fetchComposites(this.paging,this.searchByName)})),this.allSubscriptions.add(this.paginator.page.subscribe(e=>{this.paging.pageNumber=e.pageIndex+1,this.paging.pageSize=e.pageSize,this.fetchComposites(this.paging,this.searchByName)})),this.allSubscriptions.add(this.sort.sortChange.subscribe(e=>{this.sortParams=new et,this.sortParams.sort=e.active+" "+e.direction,this.paging.pageNumber=1,this.fetchComposites(this.paging,this.searchByName)}))}
1getKeywords(){this._translateService.get(["keywords.composites","keywords.listOfComposites","keywords.deleteSelectedItem"]).subscribe(e=>{this.compositesTranslate=e["keywords.composites"],this.listOfCompositesTranslate=e["keywords.listOfComposites"],this.deleteSelectedItemTranslate=e["keywords.deleteSelectedItem"]})}fetchComposites(e,a,i=!1){this.showLoadingIndicator=!0;let p=new me;a&&a!==""&&(p.searchText=a),p.isEstimate=i;let h=new G;return h.pagingParams=e,h.search=p,h.sort=this.sortParams,this._compositeService.getList(h,this.clinicID).then(y=>{this.compositesList=y??[],this.showLoadingIndicator=!1}).catch(y=>{this.compositesList=[],this.compositesCount=0,this._snackBarTemplate.errorSnackBarGet(this.listOfCompositesTranslate,y)})}export(e){let a=new me;this.searchByName&&this.searchByName!==""&&(a.searchText=this.searchByName),a.isEstimate=!1;let i=new G;i.pagingParams=this.paging,i.search=a,i.sort=this.sortParams,this._compositeService.export(i,e.toString(),this.clinicID)}addEditComposite(e){e?this._router.navigate(["modify-composite-details"],{queryParams:{id:e.compositeID,name:e.compositeTemplateName},relativeTo:this._ar}):this._router.navigate(["create-composite-details"],{relativeTo:this._ar})}deleteComposite(e){let a=this._translateService.instant("keywords.areYouSureYouWantToDeleteComposite1VALUE",{value:e.compositeTemplateName});this.dialog.open(Ae,{width:"500px",data:{title:this.deleteSelectedItemTranslate,text:a,confirmAction:()=>{this.showLoadingIndicator=!0,this._compositeService.delete(this.clinicID,e.compositeID).then(()=>{this.compositesList.length>1?(this.compositesList=this.compositesList.filter(i=>i.compositeID!=e.compositeID),this.compositesCount--,this.paging.totalCount--,this.showLoadingIndicator=!1):(this.paging.pageNumber=1,this.fetchComposites(this.paging,this.searchByName)),this._snackBarTemplate.successSnackBarDelete(this.compositesTranslate)}).catch(i=>{this._snackBarTemplate.errorSnackBarDelete(this.compositesTranslate,i),this.showLoadingIndicator=!1})}}})}onSearch(e){this.searchByName=e.target.value.trim(),this.fetchComposites(this.paging,this.searchByName)}onClear(){this.searchByName="",this.fetchComposites(this.paging,this.searchByName)}getIndexOfItem(e){return this.startPos+e}ngOnDestroy(){this.allSubscriptions.unsubscribe()}static{this.\u0275fac=function(a){return new(a||t)(_(fe),_(be),_(Ze),_(W),_(ke),_(ie),_(te),_(ve))}}static{this.\u0275cmp=q({type:t,selectors:[["app-composites"]],viewQuery:function(a,i){if(a&1&&Z(R,7)(j,7),a&2){let p;V(p=O())&&(i.paginator=p.first),V(p=O())&&(i.sort=p.first)}},standalone:!1,decls:62,vars:48,consts:[["menu","matMenu"],[1,"mat-card-2"],["fxLayout","row","fxLayoutAlign","space-between center","fxLayoutGap","10px",1,"header-filter-margin"],[3,"keydown.enter","on-clear","customPlaceholder"],[1,"flex-cell"],["fxLayout","row","fxLayoutAlign","space-between center",1,"mat-table-header"],["fxLayout","row","fxFlex.xs","60"],["fxHide.gt-xs","","fxLayout","column",1,"mb-20"],[3,"ngClass"],[1,"divider","ml-20"],[1,"light-gray-text","table-responsive-header"],["fxHide.gt-xs","",1,"flex-cell"],["fxHide.xs",""],["fxLayout","row",3,"ngClass.gt-xs"],["fxLayout","column","fxFlex.xs","40"],["fxLayout","row","fxLayoutAlign","center center"],["mat-icon-button","",1,"primary-button","light-buttons",3,"click","matTooltip","disabled"],["mat-icon-button","","color","primary",1,"mat-icon-refresh",3,"click","matTooltip"],[1,"gray-icon","material-icons","hover-refresh"],["mat-icon-button","","color","primary",1,"mat-icon-refresh",3,"matTooltip","matMenuTriggerFor"],["mat-menu-item","",1,"drop-text",3,"click"],["fxLayout","column","fxLayoutAlign","center center"],[1,"position-absolute",3,"ngClass"],["mode","indeterminate","diameter","64",1,"loading-indicator"],["fxFill","fill","mat-table","","matSort","",3,"dataSource","ngClass"],["matColumnDef","position"],["mat-header-cell","","class","table-title",3,"matTooltip",4,"matHeaderCellDef"],["mat-cell","","class","default",4,"matCellDef"],["matColumnDef","compositeName"],["mat-header-cell","","class","table-title","mat-sort-header","","start","desc",3,"matTooltip",4,"matHeaderCellDef"],["mat-cell","","class","default",3,"matTooltip",4,"matCellDef"],["matColumnDef","total"],["mat-header-cell","","class","table-title text-only-right",3,"matTooltip",4,"matHeaderCellDef"],["mat-cell","","class","default text-only-right",3,"matTooltip",4,"matCellDef"],["matColumnDef","actionButtons"],["mat-header-cell","","class","table-title text-center",4,"matHeaderCellDef"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["fxLayout","row","fxLayoutAlign","start center",1,"mt-15"],["showFirstLastButtons","true",3,"length","pageIndex","pageSize","pageSizeOptions"],[1,"vertical-divider-dashboard"],["fxHide.xs","",1,"light-gray-text"],["mat-header-cell","",1,"table-title",3,"matTooltip"],["mat-cell","",1,"default"],[1,"mat-cell-header"],[1,"mat-cell-value"],["mat-header-cell","","mat-sort-header","","start","desc",1,"table-title",3,"matTooltip"],["mat-cell","",1,"default",3,"matTooltip"],[1,"mat-cell-header","break-text"],[1,"curs
1or-pointer-edit",3,"click","ngClass"],["mat-header-cell","",1,"table-title","text-only-right",3,"matTooltip"],["mat-cell","",1,"default","text-only-right",3,"matTooltip"],["mat-header-cell","",1,"table-title","text-center"],["fxLayout","row","fxLayoutAlign","center center",3,"ngClass"],["mat-icon-button","","color","primary",3,"click","matTooltip","disabled"],[1,"gray-icon","material-icons","hover-edit"],["mat-icon-button","","color","warn",3,"click","matTooltip","disabled"],[1,"gray-icon","hover-delete","m-0"],["mat-header-row",""],["mat-row",""]],template:function(a,i){if(a&1&&(r(0,"mat-card",1)(1,"div",2)(2,"app-search-bar",3),s(3,"translate"),C("keydown.enter",function(h){return i.onSearch(h)})("on-clear",function(){return i.onClear()}),o(),g(4,"div",4),o(),r(5,"div",5)(6,"div",6)(7,"div",7)(8,"h2",8),l(9),s(10,"translate"),o(),S(11,Cn,1,0,"div",9),S(12,_n,3,4,"div",10),o(),g(13,"div",11),r(14,"h2",12),l(15),s(16,"translate"),o(),S(17,yn,5,6,"div",13),o(),r(18,"div",14)(19,"div",15)(20,"button",16),s(21,"translate"),s(22,"async"),C("click",function(){return i.addEditComposite()}),r(23,"mat-icon"),l(24,"add"),o()(),r(25,"button",17),s(26,"translate"),C("click",function(){return i.fetchComposites(i.paging,i.searchByName)}),r(27,"i",18),l(28,"refresh"),o()(),r(29,"button",19),s(30,"translate"),r(31,"i",18),l(32,"more_horiz"),o()(),r(33,"mat-menu",null,0)(35,"button",20),C("click",function(){return i.export(1)}),l(36),s(37,"translate"),o(),r(38,"button",20),C("click",function(){return i.export(0)}),l(39),s(40,"translate"),o()()()()(),r(41,"mat-card-content",21)(42,"div",22),g(43,"mat-progress-spinner",23),o(),r(44,"table",24),T(45,25),x(46,xn,4,6,"th",26)(47,Sn,6,4,"td",27),I(),T(48,28),x(49,wn,4,6,"th",29)(50,Tn,7,9,"td",30),I(),T(51,31),x(52,In,4,6,"th",32)(53,bn,8,28,"td",33),I(),T(54,34),x(55,En,3,3,"th",35)(56,kn,17,18,"td",27),I(),x(57,Dn,1,0,"tr",36)(58,Ln,1,0,"tr",37),o()(),r(59,"div",38)(60,"div",4),g(61,"mat-paginator",39),o()()()),a&2){let p=ye(34);n(2),d("customPlaceholder",c(3,23,"keywords.searchComposites")),n(6),d("ngClass",N(41,mn,i.compositesCount&&i.compositesCount>0)),n(),u(" ",c(10,25,"keywords.composites")," "),n(2),w(i.compositesCount&&i.compositesCount>0?11:-1),n(),w(i.compositesCount&&i.compositesCount>0?12:-1),n(3),u(" ",c(16,27,"keywords.composites")," "),n(2),w(i.compositesCount&&i.compositesCount>0?17:-1),n(3),d("matTooltip",c(21,29,"keywords.add"))("disabled",!c(22,31,i.canCreateComposites$)),n(5),d("matTooltip",c(26,33,"keywords.refresh")),n(4),d("matTooltip",c(30,35,"keywords.export"))("matMenuTriggerFor",p),n(7),u(" ",c(37,37,"keywords.exportPDF")," "),n(3),u(" ",c(40,39,"keywords.exportExcel")," "),n(3),d("ngClass",N(43,dn,!i.showLoadingIndicator)),n(2),d("dataSource",i.compositesList)("ngClass",N(45,un,i.showLoadingIndicator)),n(13),d("matHeaderRowDef",i.displayedComposites),n(),d("matRowDefColumns",i.displayedComposites),n(3),d("length",i.paging.totalCount)("pageIndex",i.paging.pageNumber-1)("pageSize",i.paging.pageSize)("pageSizeOptions",D(47,hn))}},dependencies:[xe,K,Y,re,Me,ne,ge,ce,pe,Ee,Ye,Ue,Ke,De,oe,se,Le,R,Ve,$e,je,He,Oe,ze,Ge,Re,Qe,qe,le,j,Ne,ue,ae,U],styles:[".link-disabled[_ngcontent-%COMP%]{opacity:.5;cursor:default}"]})}}return t})();var Mn=t=>({"mb-5":t}),Bn=t=>({invisible:t}),Fn=t=>({"blurry-table":t}),Pn=()=>[5,10,25,100],Nn=()=>({"pt-30":!0}),An=t=>({"link-disabled":t}),ia=(t,m,e,a)=>[t,m,e,"1.2-2",a],Vn=t=>({"blurry-bttn":t});function On(t,m){t&1&&g(0,"div",9)}function $n(t,m){if(t&1&&(r(0,"div",10),l(1),s(2,"translate"),o()),t&2){let e=f();n(),ee(" ",e.estimateCount," ",c(2,2,"keywords.estimates")," ")}}function Hn(t,m){if(t&1&&(r(0,"div",13),g(1,"div",40),r(2,"div",41),l(3),s(4,"translate"),o()()),t&2){let e=f();d("ngClass.gt-xs",D(5,Nn)),n(3),ee("",e.estimateCount," ",c(4,3,"keywords.estimates"))}}function Gn(t,m){t&1&&(r(0,"th",42),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"keywords.position")," "))}function Rn(t,m){if(t&1&&(r(0,"td",43)(1,"div",44),l(2),s(3,"translate"),o(),r(4,"div",45),l(5),o()()),t&2){let e=m.index,a=f();n(2),u(" ",c(3,2,"keywords.position")," "),n(3),v(a.getIndexOfItem(e))}}function jn(t,m){t&1&&(r(0,"th",46),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.estimateTemplateName")),n(2),u(" ",c(3,4,"keywords.estimateTemplateName")," "))}function zn(t,m){if(t&1){let e=A();r(0,"td",47)(1,"div",48),l(2),s(3,"translate"),o(),r(4,"div",45)(5,"a",49),C("click",function(){let i=E(e).$implicit,p=f();return k(p.canEditEstimates&&p.addEditEstimates(i))}),l(6),o()()()}if(t&2){let e=m.$implicit,a=f();d("matTooltip",$(e.compositeTemplateName)),n(2),u(" ",c(3,5,"keywords.estimateTemplateName")," "),n(3),d("ngClass",N(7,An,!a.canEditEstimates)
1),n(),u(" ",e.compositeTemplateName," ")}}function Qn(t,m){t&1&&(r(0,"th",50),s(1,"translate"),l(2),s(3,"translate"),o()),t&2&&(d("matTooltip",c(1,2,"keywords.total")),n(2),u(" ",c(3,4,"keywords.total")," "))}function qn(t,m){if(t&1&&(r(0,"td",51),s(1,"currency"),r(2,"div",44),l(3),s(4,"translate"),o(),r(5,"div",45),l(6),s(7,"currency"),o()()),t&2){let e=m.$implicit,a=f();d("matTooltip",$(b(1,4,nt(18,ia,e.total,a.selectedClinic.currencyName,a.selectedClinic.currencySymbol,a.selectedClinic.cultureName)))),n(3),u(" ",c(4,10,"keywords.total")," "),n(3),u(" ",b(7,12,nt(23,ia,e.total,a.selectedClinic==null?null:a.selectedClinic.currencyName,a.selectedClinic==null?null:a.selectedClinic.currencySymbol,a.selectedClinic==null?null:a.selectedClinic.cultureName))," ")}}function Un(t,m){t&1&&(r(0,"th",52),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"keywords.actionButtons")," "))}function Yn(t,m){if(t&1){let e=A();r(0,"td",43)(1,"div",44),l(2),s(3,"translate"),o(),r(4,"div",45)(5,"div")(6,"div",53)(7,"button",54),s(8,"translate"),s(9,"async"),C("click",function(){let i=E(e).$implicit,p=f();return k(p.addEditEstimates(i))}),r(10,"i",55),l(11,"edit"),o()(),r(12,"button",56),s(13,"translate"),s(14,"async"),C("click",function(){let i=E(e).$implicit,p=f();return k(p.deleteComposite(i))}),r(15,"mat-icon",57),l(16,"delete_outline"),o()()()()()()}if(t&2){let e=f();n(2),u(" ",c(3,6,"keywords.actionButtons")," "),n(4),d("ngClass",N(16,Vn,e.showLoadingIndicator)),n(),d("matTooltip",c(8,8,"keywords.edit"))("disabled",!c(9,10,e.canEditEstimates$)),n(5),d("matTooltip",c(13,12,"keywords.delete"))("disabled",!c(14,14,e.canDeleteEstimates$))}}function Kn(t,m){t&1&&g(0,"tr",58)}function Wn(t,m){t&1&&g(0,"tr",59)}var na=(()=>{class t{constructor(e,a,i,p,h,y,F,H,z){this._router=e,this._compositeService=a,this._clinicService=i,this.dialog=p,this._snackBarTemplate=h,this._servicesManager=y,this._ar=F,this._translateService=H,this._authService=z,this.displayEstimate=["position","compositeName","total","actionButtons"],this.showLoadingIndicator=!0,this.estimateList=[],this.searchByName="",this.selectedClinic=new qt,this.allSubscriptions=new Q,this.canEditEstimates=!1;for(let at=0;at<a.noInitElements;at++)this.estimateList.push(new ht)}ngOnInit(){this.canCreateEstimates$=this._authService.isFlagClaimTrue(M.estimates,L.c_createEstimates),this.canEditEstimates$=this._authService.isFlagClaimTrue(M.estimates,L.c_editEstimates),this.canDeleteEstimates$=this._authService.isFlagClaimTrue(M.estimates,L.c_deleteEstimates),this.canEditEstimates$.subscribe(e=>this.canEditEstimates=e),this.allSubscriptions.add(this._compositeService.$paginParamsObservable.subscribe(e=>{this.paging=e,this.startPos=(e.pageNumber-1)*e.pageSize+1,this.estimateCount=e.totalCount})),this.paging.pageNumber=1,this.startPos=1,this.allSubscriptions.add(this._clinicService.$clinicObservable.subscribe(e=>{this.clinicID=e.clinicID,this.selectedClinic=e,this.fetchEstimates()})),this.allSubscriptions.add(this.paginator.page.subscribe(e=>{this.paging.pageNumber=e.pageIndex+1,this.paging.pageSize=e.pageSize,this.fetchEstimates()})),this.allSubscriptions.add(this.sort.sortChange.subscribe(e=>{this.sortParams=new et,this.sortParams.sort=e.active+" "+e.direction,this.paging.pageNumber=1,this.fetchEstimates()}))}getIndexOfItem(e){return this.startPos+e}fetchEstimates(){this.showLoadingIndicator=!0;let e=new me;this.searchByName&&this.searchByName!==""&&(e.searchText=this.searchByName),e.isEstimate=!0;let a=new G;a.pagingParams=this.paging,a.search=e,a.sort=this.sortParams,this._compositeService.getList(a,this.clinicID).then(i=>{this.estimateList=i??[],this.showLoadingIndicator=!1}).catch(i=>{this.estimateList=[],this.estimateCount=0,this._snackBarTemplate.errorSnackBarGet("List of estimates",i)})}export(e){let a=new me;this.searchByName&&this.searchByName!==""&&(a.searchText=this.searchByName),a.isEstimate=!0;let i=new G;i.pagingParams=this.paging,i.search=a,i.sort=this.sortParams,this._compositeService.export(i,e.toString(),this.clinicID)}setSubTotalPrice(e,a){return this._servicesManager.getTotalPrice(e.price,e.markup,a,e.quantity,e.discount)}addEditEstimates(e){e?this._router.navigate(["modify-estimates-details"],{queryParams:{id:e.compositeID,name:e.compositeTemplateName},relativeTo:this._ar}):this._router.navigate(["create-estimates-details"],{relativeTo:this._ar})}deleteComposite(e){let a=this._translateService.instant("keywords.estimate"),i=this._translateService.instant("keywords.deleteSelectedEstimate"),p=this._translateService.instant("keywords.areYouSureYouWantToDeleteEstimate1VALUE",{value:e.compositeTemplateName});this.dialog.open(Ae,{width:"500px",data:{title:i,text:p,confirmAction:()=>{this._compositeService.delete(this.clinicID,e.compositeID).then(()=>{this.fetchEstimates(),this._snackBarTemplate.successSnackBarDelete(a)}).catch(h=>{this._snackBarTemplate.errorSnackBarDelete(a,h)})}}})}onSearch(e){this.searchByName=e.target.value.trim(),this.fetchEstimates()}onClear(){this.searchByName="",this.fetchEstimates()}ngOnDestroy(){this.allSubscriptions.unsubscribe()}static{this.\u0275fac=function(a){return new(a||t)(_(fe),_(Ze),_(W),_(ke),_(ie),_(Ce),_(be),_(te),_(ve))}}static{this.\u0275cmp=q({type:t,selectors:[["app-estimates"]],viewQuery:function(a,i){if(a&1&&Z(R,7)(j,7),a&2){let p;V(p=O())&&(i.paginator=p.first),V(p=O())&&(i.sort=p.first)}},standalone:!1,decls:62,vars:48,consts:[["menu","matMenu"],[1,"mat-card-2"],["fxLayout","row","fxLayoutAlign","space-between center","fxLayoutGap","10px",1,"header-filter-margin"],[3,"keydown.enter","on-clear","customPlaceholder"],[1,"flex-cell"],["fxLayout","row","fxLayoutAlign","space-between center",1,"mat-table-header"],["fxLayout","row","fxFlex.xs","60"],["fxHide.gt-xs","","fxLayout","column",1,"mb-20"],[3,"ngClass"],[1,"divi
1der","ml-20"],[1,"light-gray-text","table-responsive-header"],["fxHide.gt-xs","",1,"flex-cell"],["fxHide.xs",""],["fxLayout","row",3,"ngClass.gt-xs"],["fxLayout","column","fxFlex.xs","40"],["fxLayout","row","fxLayoutAlign","center center"],["mat-icon-button","",1,"primary-button","light-buttons",3,"click","matTooltip","disabled"],["mat-icon-button","","color","primary",1,"mat-icon-refresh",3,"click","matTooltip"],[1,"gray-icon","material-icons","hover-refresh"],["mat-icon-button","","color","primary",1,"mat-icon-refresh",3,"matTooltip","matMenuTriggerFor"],["mat-menu-item","",1,"drop-text",3,"click"],["fxLayout","column","fxLayoutAlign","center center"],[1,"position-absolute",3,"ngClass"],["mode","indeterminate","diameter","64",1,"loading-indicator"],["fxFill","fill","mat-table","","matSort","",3,"dataSource","ngClass"],["matColumnDef","position"],["mat-header-cell","","class","table-title",4,"matHeaderCellDef"],["mat-cell","","class","default",4,"matCellDef"],["matColumnDef","compositeName"],["mat-header-cell","","mat-sort-header","","start","desc","class","table-title",3,"matTooltip",4,"matHeaderCellDef"],["mat-cell","","class","default",3,"matTooltip",4,"matCellDef"],["matColumnDef","total"],["mat-header-cell","","class","table-title text-only-right",3,"matTooltip",4,"matHeaderCellDef"],["mat-cell","","class","default text-only-right",3,"matTooltip",4,"matCellDef"],["matColumnDef","actionButtons"],["mat-header-cell","","class","table-title text-center",4,"matHeaderCellDef"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["fxLayout","row","fxLayoutAlign","start center",1,"mt-15"],["showFirstLastButtons","true",3,"length","pageIndex","pageSize","pageSizeOptions"],[1,"vertical-divider-dashboard"],["fxHide.xs","",1,"light-gray-text"],["mat-header-cell","",1,"table-title"],["mat-cell","",1,"default"],[1,"mat-cell-header"],[1,"mat-cell-value"],["mat-header-cell","","mat-sort-header","","start","desc",1,"table-title",3,"matTooltip"],["mat-cell","",1,"default",3,"matTooltip"],[1,"mat-cell-header","break-text"],[1,"cursor-pointer-edit",3,"click","ngClass"],["mat-header-cell","",1,"table-title","text-only-right",3,"matTooltip"],["mat-cell","",1,"default","text-only-right",3,"matTooltip"],["mat-header-cell","",1,"table-title","text-center"],["fxLayout","row","fxLayoutAlign","center center",3,"ngClass"],["mat-icon-button","","color","primary",3,"click","matTooltip","disabled"],[1,"gray-icon","material-icons","hover-edit"],["mat-icon-button","","color","warn",3,"click","matTooltip","disabled"],[1,"gray-icon","hover-delete","m-0"],["mat-header-row",""],["mat-row",""]],template:function(a,i){if(a&1&&(r(0,"mat-card",1)(1,"div",2)(2,"app-search-bar",3),s(3,"translate"),C("keydown.enter",function(h){return i.onSearch(h)})("on-clear",function(){return i.onClear()}),o(),g(4,"div",4),o(),r(5,"div",5)(6,"div",6)(7,"div",7)(8,"h2",8),l(9),s(10,"translate"),o(),S(11,On,1,0,"div",9),S(12,$n,3,4,"div",10),o(),g(13,"div",11),r(14,"h2",12),l(15),s(16,"translate"),o(),S(17,Hn,5,6,"div",13),o(),r(18,"div",14)(19,"div",15)(20,"button",16),s(21,"translate"),s(22,"async"),C("click",function(){return i.addEditEstimates()}),r(23,"mat-icon"),l(24,"add"),o()(),r(25,"button",17),s(26,"translate"),C("click",function(){return i.fetchEstimates()}),r(27,"i",18),l(28,"refresh"),o()(),r(29,"button",19),s(30,"translate"),r(31,"i",18),l(32,"more_horiz"),o()(),r(33,"mat-menu",null,0)(35,"button",20),C("click",function(){return i.export(1)}),l(36),s(37,"translate"),o(),r(38,"button",20),C("click",function(){return i.export(0)}),l(39),s(40,"translate"),o()()()()(),r(41,"mat-card-content",21)(42,"div",22),g(43,"mat-progress-spinner",23),o(),r(44,"table",24),T(45,25),x(46,Gn,3,3,"th",26)(47,Rn,6,4,"td",27),I(),T(48,28),x(49,jn,4,6,"th",29)(50,zn,7,9,"td",30),I(),T(51,31),x(52,Qn,4,6,"th",32)(53,qn,8,28,"td",33),I(),T(54,34),x(55,Un,3,3,"th",35)(56,Yn,17,18,"td",27),I(),x(57,Kn,1,0,"tr",36)(58,Wn,1,0,"tr",37),o()(),r(59,"div",38)(60,"div",4),g(61,"mat-paginator",39),o()()()),a&2){let p=ye(34);n(2),d("customPlaceholder",c(3,23,"keywords.searchEstimates")),n(6),d("ngClass",N(41,Mn,i.estimateCount&&i.estimateCount>0)),n(),u(" ",c(10,25,"keywords.estimates")," "),n(2),w(i.estimateCount&&i.estimateCount>0?11:-1),n(),w(i.estimateCount&&i.estimateCount>0?12:-1),n(3),u(" ",c(16,27,"keywords.estimates")," "),n(2),w(i.estimateCount&&i.estimateCount>0?17:-1),n(3),d("matTooltip",c(21,29,"keywords.add"))("disabled",!c(22,31,i.canCreateEstimates$)),n(5),d("matTooltip",c(26,33,"keywords.refresh")),n(4),d("matTooltip",c(30,35,"keywords.export"))("matMenuTriggerFor",p),n(7),u(" ",c(37,37,"keywords.exportPDF")," "),n(3),u(" ",c(40,39,"keywords.exportExcel")," "),n(3),d("ngClass",N(43,Bn,!i.showLoadingIndicator)),n(2),d("dataSource",i.estimateList)("ngClass",N(45,Fn,i.showLoadingIndicator)),n(13),d("matHeaderRowDef",i.displayEstimate),n(),d("matRowDefColumns",i.displayEstimate),n(3),d("length",i.paging.totalCount)("pageIndex",i.paging.pageNumber-1)("pageSize",i.paging.pageSize)("pageSizeOptions",D(47,Pn))}},dependencies:[xe,K,Y,re,Me,ne,ge,ce,pe,Ee,Ye,Ue,Ke,De,oe,se,Le,R,
1Ve,$e,je,He,Oe,ze,Ge,Re,Qe,qe,le,j,Ne,ue,ae,U],styles:[".link-disabled[_ngcontent-%COMP%]{opacity:.5;cursor:default}"]})}}return t})();var hi=()=>({"max-width-150":!0}),Jn=t=>({"mb-5":t}),Xn=t=>({invisible:t}),Zn=t=>({"blurry-table":t}),er=()=>({"pt-30":!0}),tr=t=>({"disable-pointer-events":t}),Jt=(t,m,e)=>[t,m,"symbol","1.2-2",e],ir=t=>({"blurry-bttn":t});function ar(t,m){if(t&1&&(r(0,"mat-option",13),l(1),o()),t&2){let e=m.$implicit;d("value",e.key),n(),v(e.value)}}function nr(t,m){if(t&1&&(r(0,"mat-option",13),l(1),o()),t&2){let e=m.$implicit;d("value",e.key),n(),u(" ",e.value," ")}}function rr(t,m){t&1&&g(0,"div",21)}function or(t,m){if(t&1&&(r(0,"div",22),l(1),s(2,"translate"),o()),t&2){let e=f();n(),ee(" ",e.servicesCount," ",c(2,2,"keywords.services")," ")}}function sr(t,m){if(t&1&&(r(0,"div",25),g(1,"div",61),r(2,"div",62),l(3),s(4,"translate"),o()()),t&2){let e=f();d("ngClass.gt-xs",D(5,er)),n(3),ee("",e.servicesCount," ",c(4,3,"keywords.services"))}}function lr(t,m){t&1&&(r(0,"th",63),l(1),s(2,"translate"),o()),t&2&&(n(),v(c(2,1,"keywords.number")))}function cr(t,m){if(t&1&&(r(0,"td",64)(1,"div",65),l(2),s(3,"translate"),o(),r(4,"div",66),l(5),o()()),t&2){let e=m.index,a=f();n(2),v(c(3,2,"keywords.number")),n(3),v(a.getIndexOfItem(e))}}function pr(t,m){t&1&&(r(0,"th",67),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"keywords.name")))}function mr(t,m){if(t&1){let e=A();r(0,"td",68)(1,"div",65),l(2),s(3,"translate"),o(),r(4,"div",66)(5,"a",69),s(6,"async"),C("click",function(){let i=E(e).$implicit,p=f();return k(p.addEditService(i))}),l(7),o()()()}if(t&2){let e=m.$implicit,a=f();d("matTooltip",$(e.serviceName)),n(2),u(" ",c(3,5,"keywords.name")," "),n(3),d("ngClass",N(9,tr,!c(6,7,a.canEditProducts$))),n(2),u(" ",e.serviceName," ")}}function dr(t,m){t&1&&(r(0,"th",67),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"keywords.category")))}function ur(t,m){if(t&1&&(r(0,"td",68)(1,"div",65),l(2),s(3,"translate"),o(),r(4,"div",66),l(5),o()()),t&2){let e=m.$implicit;d("matTooltip",$(e.categoryName)),n(2),u(" ",c(3,4,"keywords.category")," "),n(3),u(" ",e.categoryName," ")}}function hr(t,m){t&1&&(r(0,"th",70),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"keywords.net")))}function fr(t,m){if(t&1&&(r(0,"td",71),s(1,"currency"),r(2,"div",65),l(3),s(4,"translate"),o(),r(5,"div",66),l(6),s(7,"currency"),o()()),t&2){let e=m.$implicit,a=f();d("matTooltip",$(b(1,4,B(18,Jt,e.price,a.selectedClinic==null?null:a.selectedClinic.currencyName,a.selectedClinic==null?null:a.selectedClinic.cultureName)))),n(3),u(" ",c(4,10,"keywords.net")," "),n(3),u(" ",b(7,12,B(22,Jt,e.price,a.selectedClinic==null?null:a.selectedClinic.currencyName,a.selectedClinic==null?null:a.selectedClinic.cultureName))," ")}}function vr(t,m){t&1&&(r(0,"th",70),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"keywords.tax")))}function gr(t,m){if(t&1&&(r(0,"td",71)(1,"div",65),l(2),s(3,"translate"),o(),r(4,"div",66),l(5),o()()),t&2){let e=m.$implicit;d("matTooltip",$(e.taxName?e.taxName+" ("+e.taxValue+"%)":"")),n(2),u(" ",c(3,4,"keywords.tax")," "),n(3),u(" ",e.taxName?e.taxName+" ("+e.taxValue+"%)":""," ")}}function Cr(t,m){t&1&&(r(0,"th",72),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"keywords.totalPrice")))}function _r(t,m){if(t&1&&(r(0,"td",71),s(1,"currency"),r(2,"div",65),l(3),s(4,"translate"),o(),r(5,"div",66),l(6),s(7,"currency"),o()()),t&2){let e=m.$implicit,a=f();d("matTooltip",$(b(1,4,B(18,Jt,a.getTotalPrice(e),a.selectedClinic==null?null:a.selectedClinic.currencyName,a.selectedClinic==null?null:a.selectedClinic.cultureName)))),n(3),u(" ",c(4,10,"keywords.totalPrice")," "),n(3),u(" ",b(7,12,B(22,Jt,a.getTotalPrice(e),a.selectedClinic==null?null:a.selectedClinic.currencyName,a.selectedClinic==null?null:a.selectedClinic.cultureName))," ")}}function yr(t,m){t&1&&(r(0,"th",73),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"keywords.reminder")))}function xr(t,m){t&1&&g(0,"i",75)}function Sr(t,m){if(t&1&&(r(0,"td",74)(1,"div",65),l(2),s(3,"translate"),o(),r(4,"div",66),S(5,xr,1,0,"i",75),o()()),t&2){let e=m.$implicit;n(2),u(" ",c(3,2,"keywords.reminder")," "),n(3),w(e.reminder?5:-1)}}function wr(t,m){t&1&&(r(0,"th",76),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"ke
1ywords.statusType")))}function Tr(t,m){if(t&1&&(r(0,"td",64)(1,"div",65),l(2),s(3,"translate"),o(),r(4,"div",66),l(5),s(6,"translate"),o()()),t&2){let e=m.$implicit;n(2),u(" ",c(3,2,"keywords.statusType")," "),n(3),u(" ",c(6,4,e.statusTypeName)," ")}}function Ir(t,m){t&1&&(r(0,"th",73),l(1),s(2,"translate"),o()),t&2&&(n(),u(" ",c(2,1,"keywords.actionButtons")))}function br(t,m){if(t&1){let e=A();r(0,"td",64)(1,"div",65),l(2),s(3,"translate"),o(),r(4,"div",66)(5,"div")(6,"div",77)(7,"button",78),s(8,"translate"),s(9,"async"),C("click",function(){let i=E(e).$implicit,p=f();return k(p.addEditService(i))}),r(10,"i",79),l(11,"edit"),o()(),r(12,"button",80),s(13,"translate"),s(14,"async"),C("click",function(){let i=E(e).$implicit,p=f();return k(p.deleteService(i))}),r(15,"mat-icon",81),l(16,"delete_outline"),o()()()()()()}if(t&2){let e=f();n(2),u(" ",c(3,6,"keywords.actionButtons")," "),n(4),d("ngClass",N(16,ir,e.showLoadingIndicator)),n(),d("matTooltip",c(8,8,"keywords.edit"))("disabled",!c(9,10,e.canEditProducts$)),n(5),d("matTooltip",c(13,12,"keywords.delete"))("disabled",!c(14,14,e.canDeleteProducts$))}}function Er(t,m){t&1&&g(0,"tr",82)}function kr(t,m){t&1&&g(0,"tr",83)}var ra=(()=>{class t{discardPageSizeFromFullCatalogueLoad(){!this.paging||this.pageSizeOptions.includes(this.paging.pageSize)||(this.paging.pageSize=10)}get statusTypes(){return this._enumeratorsService.statusType}setFilterFormCachedParamIDs(){this.FF_CACHE.filterFormGroupID=this._filterFormsCacheService.getFilterFormID()}setCachedData(){this.setFilterFormCachedParamIDs(),this._filterFormsCacheService.patchFilterFormValue(this.FF_CACHE.filterFormGroupID,this.filterFormGroup)}cacheFilterForm(){this._filterFormsCacheService.saveFilterFormValue(this.FF_CACHE.filterFormGroupID,this.filterFormGroup)}constructor(){this.pageSizeOptions=[5,10,25,100],this.filterFormGroup=new Mt({searchText:new he(""),categoryID:new he(null),taxID:new he(null),statusType:new he(J.Active)}),this.displayedColumns=["position","productName","categoryName","price","taxName","totalPrice","reminder","statusType","actionButtons"],this.services=[],this.allSubscriptions=new Q,this.showLoadingIndicator=!0,this.serviceCategoryList=[],this.taxList=[],this.FF_CACHE={filterFormGroupID:""},this.dialog=P(ke),this._servicesManager=P(Ce),this._clinicService=P(W),this._snackBarTemplate=P(ie),this._clinicTaxService=P(We),this._serviceCategoriesService=P(qi),this._authService=P(ve),this._translateService=P(te),this._enumeratorsService=P(Be),this._filterFormsCacheService=P(Qt);for(let e=0;e<this._servicesManager.noInitElements;e++)this.services.push(new zi);this.getKeywords()}ngOnInit(){this.allSubscriptions.add(this._servicesManager.$paginParamsObservable.subscribe(e=>{this.paging=e,this.startPos=(e.pageNumber-1)*e.pageSize+1,this.servicesCount=e.totalCount})),this.paging.pageNumber=1,this.startPos=1,this.discardPageSizeFromFullCatalogueLoad(),this.allSubscriptions.add(this._clinicService.$clinicObservable.subscribe(e=>{this.clinicID=e.clinicID,this.selectedClinic=e,this.setCachedData(),this.clinicID&&(this._clinicTaxService.getList(null,this.clinicID).then(a=>{a.map(i=>{this.taxList.push({key:i.clinicTaxID,value:i.taxName})})}).catch(a=>{this._snackBarTemplate.errorSnackBarGet(this.taxServiceTranslate,a)}),this._serviceCategoriesService.getList(null,this.clinicID).then(a=>{a.map(i=>{this.serviceCategoryList.push({key:i.categoryID,value:i.categoryName})})}).catch(a=>{this._snackBarTemplate.errorSnackBarGet(this.serviceCategoryTranslate,a)})),this.fetchServices()})),this.allSubscriptions.add(this.paginator.page.subscribe(e=>{this.paging.pageNumber=e.pageIndex+1,this.paging.pageSize=e.pageSize,this.fetchServices()})),this.allSubscriptions.add(this.sort.sortChange.subscribe(e=>{this.sortParams=new et,e.active=="categoryName"&&(e.active="productCategory.categoryName"),this.sortParams.sort=e.active+" "+e.direction,this.paging.pageNumber=1,this.fetchServices()})),this.canCreateProducts$=this._authService.isFlagClaimTrue(M.products,L.c_createProducts),this.canEditProducts$=this._authService.isFlagClaimTrue(M.products,L.c_editProducts),this.canDeleteProducts$=this._authService.isFlagClaimTrue(M.products,L.c_deleteProducts)}getKeywords(){this._translateService.get(["keywords.service","keywords.taxService","keywords.serviceCategory","keywords.listOfServices","keywords.deleteSelectedService"]).subscribe(e=>{this.serviceTranslate=e["keywords.service"],this.taxServiceTranslate=e["keywords.taxService"],this.serviceCategoryTranslate=e["keywords.serviceCategory"],this.listOfServicesTranslate=e["keywords.listOfServices"],this.deleteSelectedServiceTranslate=e["keywords.deleteSelectedService"]})}fetchServices(){return X(this,null,function*(){this.showLoadingIndicator=!0,this.cacheFilterForm();let{searchText:e,taxID:a,categoryID:i,statusType:p}=this.filterFormGroup.getRawValue(),h=new it,y=e?.trim()??"";y.length>2?h.searchText=y:y.length>=1&&this._snackBarTemplate.errorSnackBar(this._translateService.instant("keywords.youMustEnterAtLeast3Characters")),a&&(h.clinicTaxID=a),i&&(h.categoryID=i),h.statusType=p;let F=new G;F.pagingParams=this.paging,F.search=h,F.sort=this.sortParams;let H=yield this._servicesManager.getList(F,this.clinicID).catch(z=>{this.services=[],this.servicesCount=0,this._snackBarTemplate.errorSnackBarGet(this.listOfServicesTranslate,z)});
1H&&(this.services=H,this.services.forEach(z=>{z.statusTypeName=this.mapStatusTypeToName(z.statusType)})),this.showLoadingIndicator=!1})}refreshPaging(){this.paging.pageNumber=1}export(e){let{searchText:a,taxID:i,categoryID:p,statusType:h}=this.filterFormGroup.getRawValue(),y=new it,F=a?.trim()??"";F&&(y.searchText=F),i&&(y.clinicTaxID=i),p&&(y.categoryID=p),y.statusType=h;let H=new G;H.pagingParams=this.paging,H.search=y,H.sort=this.sortParams,this._servicesManager.export(H,e.toString(),this.clinicID)}getTotalPrice(e){return this._servicesManager.getTotalPrice(e.price,e.markup,e.taxValue)}getIndexOfItem(e){return this.startPos+e}deleteService(e){let a=this._translateService.instant("keywords.areYouSureYouWantToDeleteService1VALUE",{value:e.serviceName});this.dialog.open(Ae,{width:"500px",data:{title:this.deleteSelectedServiceTranslate,text:a,confirmAction:()=>{this.showLoadingIndicator=!0,this._servicesManager.delete(this.clinicID,e.serviceID).then(()=>{this.services.length>1?(this.services=this.services.filter(i=>i.serviceID!=e.serviceID),this.servicesCount--,this.paging.totalCount--,this.showLoadingIndicator=!1):(this.paging.pageNumber=1,this.fetchServices()),this._snackBarTemplate.successSnackBarDelete(this.serviceTranslate)}).catch(i=>{this._snackBarTemplate.errorSnackBarDelete(this.serviceTranslate,i),this.showLoadingIndicator=!1})}}})}addEditService(e){this.dialog.open(Ui,{width:"1500px",data:{serviceID:e?e.productID?e.productID:e.serviceID:null,confirmAction:a=>{e?this.services=this.services.map(i=>i.serviceID==e.serviceID?a:i):a&&this.fetchServices()}}})}mapStatusTypeToName(e){switch(e){case J.Draft:return"keywords.draft";case J.Active:return"keywords.active";case J.StandBy:return"keywords.standBy";case J.Pasive:return"keywords.passive"}}onSearch(e){this.filterFormGroup.patchValue({searchText:e.target.value.trim()}),this.refreshPaging(),this.fetchServices()}onClear(){this.filterFormGroup.patchValue({searchText:""}),this.refreshPaging(),this.fetchServices()}ngOnDestroy(){this.allSubscriptions.unsubscribe()}onSelectedTax(e){this.filterFormGroup.patchValue({taxID:e.value??null}),this.refreshPaging(),this.fetchServices()}onSelectedServiceCategory(e){this.filterFormGroup.patchValue({categoryID:e??null}),this.refreshPaging(),this.fetchServices()}onSelectedStatusType(){this.refreshPaging(),this.fetchServices()}clearFilters(){this.filterFormGroup.reset({searchText:"",categoryID:null,taxID:null,statusType:J.Active}),this.searchBar.clearSearchFilter(),this.refreshPaging(),this.fetchServices()}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275cmp=q({type:t,selectors:[["app-services"]],viewQuery:function(a,i){if(a&1&&Z(R,7)(j,7)(pe,5),a&2){let p;V(p=O())&&(i.paginator=p.first),V(p=O())&&(i.sort=p.first),V(p=O())&&(i.searchBar=p.first)}},standalone:!1,decls:105,vars:78,consts:[["taxDropdown",""],["menu","matMenu"],[1,"mat-card-2"],[1,"cont-position","m-0"],["fxLayout","row","fxLayout.lt-md","column","fxLayoutAlign","start center","fxLayoutGap","10px",1,"header-filter-margin",3,"formGroup"],[1,"width-res",3,"keydown.enter","on-clear","preselectedValue","customPlaceholder"],["fxFlex","","appearance","outline",1,"width-res","category-filter-dropdown",3,"ngClass.gt-sm"],["formControlName","categoryID",3,"selectionChange"],[1,"clearOption",3,"value"],[3,"value",4,"ngFor","ngForOf"],["fxFlex","","controlName","taxID","panelClass","tax-filter-panel",1,"width-res",3,"on-select","ngClass.gt-sm","itemList","placeholder","form"],["ngClass.lt-md","w-100","fxFlex.lt-md","","appearance","outline",3,"ngClass.gt-sm"],["formControlName","statusType",3,"selectionChange"],[3,"value"],["fxLayout","row","fxLayoutAlign","end center"],[1,"pointer","clear-icon","hover-cancel",3,"click","matTooltip"],[1,"flex-cell"],["fxLayout","row","fxLayoutAlign","space-between center",1,"mat-table-header"],["fxLayout","row","fxFlex.xs","60"],["fxHide.gt-xs","","fxLayout","column",1,"mb-20"],[3,"ngClass"],[1,"divider","ml-20"],[1,"light-gray-text","table-responsive-header"],["fxHide.gt-xs","",1,"flex-cell"],["fxHide.xs",""],["fxLayout","row",3,"ngClass.gt-xs"],["fxLayout","column","fxFlex.xs","40"],["fxLayout","row","fxLayoutAlign","center center"],["mat-icon-button","",1,"primary-button","light-buttons",3,"click","matTooltip","disabled"],["mat-icon-button","","color","primary",1,"mat-icon-refresh",3,"click","matTooltip"],[1,"gray-icon","material-icons","hover-refresh"],["mat-icon-button","","color","primary",1,"mat-icon-refresh",3,"matTooltip","matMenuTriggerFor"],["mat-menu-item","",1,"drop-text",3,"click"],[1,"border"],["fxLayout","column","fxLayoutAlign","center center","fxLayoutAlign.md","start start",1,"auto-scroll"],[1,"position-absolute",3,"ngClass"],["mode","indeterminate","diameter","64",1,"loading-indicator"],["fxFill","fill","mat-table","","matSort","",3,"dataSource","ngClass"],["matColumnDef","position"],["mat-header-cell","","class","table-title",4,"matHeaderCellDef"],["mat-cell","","class","default",4,"matCellDef"],["matColumnDef","productName"],["mat-header-cell","","class","table-title","mat-sort-header","","start","desc",4,"matHeaderCellDef"],["mat-cell","","class","default",3,"matTooltip",4,"matCellDef"],["matColumnDef","categoryName"],["matColumnDef","price"],["mat-header-cell","","class","table-title text-only-right","start","desc",4,"matHeaderCellDef"],["mat-cell","","class","default text-only-right",3,"matTooltip",4,"matCellDef"],["matColumnDef","taxName"],["matColumnDef","totalPrice"],["mat-header-cell","","class","table-title text-only-right",4,"matHeaderCellDef"],["matColumnDef","reminder"],["mat-header-cell","","class","table-title text-center",4,"matHeaderCellDef"],["mat-cell","","class","default text-center",4,"matCellDef"],["matColumnDef","statusType"],["mat-header-cell","","mat-sort-header","","start","desc","disableClear","true","class","table-title",4,"matHeaderCellDef"],["matColumnDef","actionButtons"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["fxLayout","row","fxLayoutAlign","start center",1,"mt-15"],["showFirstLastButtons","true",3,"length","pageIndex","pageSize","pageSizeOptions"],[1,"vertical-divider-dashboard"],["fxHide.xs","",1,"light-gray-text"],["mat-header-cell","",1,"table-title"],["mat-cell","",1,"default"],[1,"mat-cell-header"],[1,"mat-cell-value"],["mat-header-cell","","mat-sort-header","","start","desc",1,"table-title"],["mat-cell","",1,"default",3,"matTooltip"],[1,"curs
1or-pointer-edit",3,"click","ngClass"],["mat-header-cell","","start","desc",1,"table-title","text-only-right"],["mat-cell","",1,"default","text-only-right",3,"matTooltip"],["mat-header-cell","",1,"table-title","text-only-right"],["mat-header-cell","",1,"table-title","text-center"],["mat-cell","",1,"default","text-center"],["aria-hidden","true",1,"fa","fa-bell"],["mat-header-cell","","mat-sort-header","","start","desc","disableClear","true",1,"table-title"],["fxLayout","row","fxLayoutAlign","center center",3,"ngClass"],["mat-icon-button","","color","primary",3,"click","matTooltip","disabled"],[1,"gray-icon","material-icons","hover-edit"],["mat-icon-button","","color","warn",3,"click","matTooltip","disabled"],[1,"gray-icon","hover-delete","m-0"],["mat-header-row",""],["mat-row",""]],template:function(a,i){if(a&1&&(r(0,"mat-card",2)(1,"div",3)(2,"div",4)(3,"app-search-bar",5),s(4,"translate"),C("keydown.enter",function(h){return i.onSearch(h)})("on-clear",function(){return i.onClear()}),o(),r(5,"mat-form-field",6)(6,"mat-label"),l(7),s(8,"translate"),o(),r(9,"mat-select",7),C("selectionChange",function(h){return i.onSelectedServiceCategory(h.value)}),r(10,"mat-option",8),l(11),s(12,"translate"),o(),x(13,ar,2,2,"mat-option",9),o()(),r(14,"smartnet-dropdown",10,0),s(16,"translate"),C("on-select",function(h){return i.onSelectedTax(h)}),o(),r(17,"mat-form-field",11)(18,"mat-label"),l(19),s(20,"translate"),o(),r(21,"mat-select",12),C("selectionChange",function(){return i.onSelectedStatusType()}),r(22,"mat-option",8),l(23),s(24,"translate"),o(),ft(25,nr,2,2,"mat-option",13,kt),o()(),r(27,"div",14)(28,"mat-icon",15),s(29,"translate"),C("click",function(){return i.clearFilters()}),l(30,"cancel"),o()(),g(31,"div",16),o()(),r(32,"div",17)(33,"div",18)(34,"div",19)(35,"h2",20),l(36),s(37,"translate"),o(),S(38,rr,1,0,"div",21),S(39,or,3,4,"div",22),o(),g(40,"div",23),r(41,"h2",24),l(42),s(43,"translate"),o(),S(44,sr,5,6,"div",25),o(),r(45,"div",26)(46,"div",27)(47,"button",28),s(48,"translate"),s(49,"async"),C("click",function(){return i.addEditService()}),r(50,"mat-icon"),l(51,"add"),o()(),r(52,"button",29),s(53,"translate"),C("click",function(){return i.fetchServices()}),r(54,"i",30),l(55,"refresh"),o()(),r(56,"button",31),s(57,"translate"),r(58,"i",30),l(59,"more_horiz"),o()(),r(60,"mat-menu",null,1)(62,"button",32),C("click",function(){return i.export(1)}),l(63),s(64,"translate"),o(),r(65,"button",32),C("click",function(){return i.export(0)}),l(66),s(67,"translate"),o()()()()(),r(68,"mat-card-content",33)(69,"div",34)(70,"div",35),g(71,"mat-progress-spinner",36),o(),r(72,"table",37),T(73,38),x(74,lr,3,3,"th",39)(75,cr,6,4,"td",40),I(),T(76,41),x(77,pr,3,3,"th",42)(78,mr,8,11,"td",43),I(),T(79,44),x(80,dr,3,3,"th",42)(81,ur,6,6,"td",43),I(),T(82,45),x(83,hr,3,3,"th",46)(84,fr,8,26,"td",47),I(),T(85,48),x(86,vr,3,3,"th",46)(87,gr,6,6,"td",47),I(),T(88,49),x(89,Cr,3,3,"th",50)(90,_r,8,26,"td",47),I(),T(91,51),x(92,yr,3,3,"th",52)(93,Sr,6,4,"td",53),I(),T(94,54),x(95,wr,3,3,"th",55)(96,Tr,7,6,"td",40),I(),T(97,56),x(98,Ir,3,3,"th",52)(99,br,17,18,"td",40),I(),x(100,Er,1,0,"tr",57)(101,kr,1,0,"tr",58),o()()(),r(102,"div",59)(103,"div",16),g(104,"mat-paginator",60),o()()()),a&2){let p,h=ye(61);n(2),d("formGroup",i.filterFormGroup),n(),d("preselectedValue",(p=i.filterFormGroup.get("searchText"))==null?null:p.value)("customPlaceholder",c(4,39,"keywords.searchServices")),n(2),d("ngClass.gt-sm",D(69,hi)),n(2),v(c(8,41,"keywords.selectCategory")),n(3),d("value",null),n(),v(c(12,43,"keywords.clearFilter")),n(2),d("ngForOf",i.serviceCategoryList),n(),d("ngClass.gt-sm",D(70,hi))("itemList",i.taxList)("placeholder",c(16,45,"keywords.selectTax"))("form",i.filterFormGroup),n(3),d("ngClass.gt-sm",D(71,hi)),n(2),v(c(20,47,"keywords.statusType")),n(3),d("value",null),n(),v(c(24,49,"keywords.showAll")),n(2),vt(i.statusTypes),n(3),d("matTooltip",c(29,51,"keywords.clearFilters")),n(7),d("ngClass",N(72,Jn,i.servicesCount&&i.servicesCount>0)),n(),u(" ",c(37,53,"keywords.services")," "),n(2),w(i.servicesCount&&i.servicesCount>0?38:-1),n(),w(i.servicesCount&&i.servicesCount>0?39:-1),n(3),u(" ",c(43,55,"keywords.services")," "),n(2),w(i.servicesCount&&i.servicesCount>0?44:-1),n(3),d("matTooltip",c(48,57,"keywords.add"))("disabled",!c(49,59,i.canCreateProducts$)),n(5),d("matTooltip",c(53,61,"keywords.refresh")),n(4),d("matTooltip",c(57,63,"keywords.export"))("matMenuTriggerFor",h),n(7),u(" ",c(64,65,"keywords.exportPDF")," "),n(3),u(" ",c(67,67,"keywords.exportExcel")," "),n(4),d("ngClass",N(74,Xn,!i.showLoadingIndicator)),n(2),d("dataSource",i.services)("ngClass",N(76,Zn,i.showLoadingIndicator)),n(28),d("matHeaderRowDef",i.displayedColumns),n(),d("matRowDefColumns",i.displayedColumns),n(3),d("length",i.paging.totalCount)("pageIndex",i.paging.pageNumber-1)("pageSize",i.paging.pageSize)("pageSizeOptions",i.pageSizeOptions)}},dependencies:[xe,Si,Se,we,K,Y,re,Me,ne,ge,ce,Ie,Te,pe,Vt,Ee,Ye,Ue,Ke,Pe,Fe,De,oe,se,Nt,Pt,Le,R,Ve,$e,je,He,Oe,ze,Ge,Re,Qe,qe,le,j,Ne,ue,ae,U],styles:["@media(max-width:959px){.width-res[_ngcontent-%COMP%]{width:100%!important}max-width-150[_ngcontent-%COMP%]{width:100%!important}}@media(min-width:959px)and (max-width:1279px){.auto-scroll[_ngcontent-%COMP%]{overflow-x:auto}.mb-res[_ngcontent-%COMP%]{margin-bottom:10px!important}}
1.category-filter-dropdown[_ngcontent-%COMP%]{min-width:200px!important;max-width:210px!important}"]})}}return t})();var $r=()=>({"mr-40":!0}),Hr=()=>({"ml-90":!0}),Gr=()=>({"mr-10":!0}),St=(t,m,e)=>[t,m,"symbol","1.2-2",e],Rr=()=>({"ml-90":!0,"mr-40":!0});function jr(t,m){t&1&&g(0,"mat-progress-spinner",0)}function zr(t,m){if(t&1){let e=A();r(0,"div",23)(1,"button",24)(2,"span",25),g(3,"i",26),o(),r(4,"span"),l(5),s(6,"translate"),o()(),g(7,"div",27),r(8,"button",28),C("click",function(){E(e);let i=f(2);return k(i.saveComposite())}),l(9),s(10,"translate"),o()()}t&2&&(n(5),v(c(6,2,"keywords.cancel")),n(4),u(" ",c(10,4,"keywords.save")," "))}function Qr(t,m){if(t&1){let e=A();r(0,"mat-card",1)(1,"form",2)(2,"mat-card-content",3)(3,"div",4)(4,"div",4)(5,"div",5)(6,"mat-form-field",6)(7,"mat-label"),l(8),s(9,"translate"),r(10,"span",7),l(11,"*"),o()(),g(12,"input",8),o()()(),r(13,"div",9),l(14),s(15,"translate"),o(),r(16,"product-manager",10),C("itemListChanged",function(i){E(e);let p=f();return k(p.selectedProductList=i)}),o(),r(17,"div",9),l(18),s(19,"translate"),o(),r(20,"service-manager",10),C("itemListChanged",function(i){E(e);let p=f();return k(p.selectedServiceList=i)}),o(),g(21,"div",11),r(22,"mat-expansion-panel",12)(23,"mat-expansion-panel-header",13)(24,"mat-panel-title",14),l(25),s(26,"translate"),o(),r(27,"div",15)(28,"div",16)(29,"b",17),l(30),s(31,"translate"),o(),r(32,"b"),l(33),s(34,"currency"),o()(),g(35,"div",18),o()(),r(36,"div",19)(37,"div",20)(38,"div",21)(39,"span"),l(40),s(41,"translate"),o(),r(42,"span"),l(43),s(44,"currency"),o()(),r(45,"div",21)(46,"span"),l(47),s(48,"translate"),o(),r(49,"span"),l(50),s(51,"currency"),o()(),r(52,"div",21)(53,"span"),l(54),s(55,"translate"),o(),r(56,"span"),l(57),s(58,"currency"),o()(),r(59,"div",22)(60,"b"),l(61),s(62,"translate"),o(),r(63,"b"),l(64),s(65,"currency"),o()()()()(),S(66,zr,11,6,"div",23),o()()()()}if(t&2){let e=f();n(),d("formGroup",e.compositeForm),n(7),v(c(9,23,"keywords.compositeName")),n(6),v(c(15,25,"keywords.addProducts")),n(2),d("data",e.productManagerData),n(2),v(c(19,27,"keywords.addService")),n(2),d("data",e.serviceManagerData),n(2),d("expanded",!1),n(),d("ngClass.gt-md",D(71,$r)),n(2),u(" ",c(26,29,"keywords.totals")," "),n(3),d("ngClass.gt-md",D(72,Hr)),n(),d("ngClass.lt-md",D(73,Gr)),n(),v(c(31,31,"keywords.total")),n(3),v(b(34,33,B(74,St,e.total,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(4),d("ngClass.gt-md",D(78,Rr)),n(3),u("",c(41,39,"keywords.subtotal"),":"),n(3),v(b(44,41,B(79,St,e.subtotal,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(4),u("",c(48,47,"keywords.tax"),":"),n(3),v(b(51,49,B(83,St,e.tax,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(4),u("",c(55,55,"keywords.discount"),":"),n(3),v(b(58,57,B(87,St,e.discount,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(4),v(c(62,63,"keywords.totalCaps")),n(3),v(b(65,65,B(91,St,e.total,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(2),w(e.showLoadingIndicator?-1:66)}}var fi=(()=>{class t{get productTypes(){return this.enumeratorsService.productType}constructor(e,a,i,p,h,y,F,H,z,at,Xt,Zt,ei){this._compositeService=e,this._clinicService=a,this._servicesManager=i,this._productService=p,this.enumeratorsService=h,this._fb=y,this._ar=F,this._router=H,this.queryParamsService=z,this._snackBarTemplate=at,this._taxService=Xt,this._professionalFeeService=Zt,this._translateService=ei,this.showLoadingIndicator=!1,this.allSubscriptions=new Q,this.taxList=[],this.professionalFeeList=[],this.selectedClinic=new qt,this.selectedProductList=[],this.selectedServiceList=[],this.getKeywords()}ngOnInit(){this.showLoadingIndicator=!0,this.compositeId=this._ar.snapshot.queryParams.id;let e=this._ar.snapshot.queryParams.name;if(this.createForm(e),!this._router.url.includes("create-composite-details")&&this.queryParamsService.verifyQueryParams(this.compositeId,e))return;let a=this.allSubscriptions.add(this._clinicService.$clinicObservable.pipe(bt(i=>{this.clinicID=i.clinicID,this.selectedClinic=i;let p=new G,h=new lt;h.statusType=J.Active,p.search=h;let y=new G,F=new it;return F.statusType=J.Active,y.search=F,Tt(this._taxService.getList(null,this.clinicID),this._professionalFeeService.getList(null,this.clinicID),this._productService.getList(p,this.clinicID),this._servicesManager.getList(y,this.clinicID),this.compositeId?this.fetchCompositeProducts(null):wt({compositeProducts:[]}))})).subscribe(i=>{this.taxList=i[0],this.professionalFeeList=i[1],this.productList=i[2],this.serviceList=i[3],this.showLoadingIndicator=!1,setTimeout(()=>{this.productManager.form.updateValueAndValidity({emitEvent:!0}),this.serviceManager.form.updateValueAndValidity({emitEvent:!0}
1),i[4].compositeProducts.forEach(p=>{p.productType==0?this.productManager.addItem(p,!1):this.serviceManager.addItem(p,!1)})})},i=>console.log("composite details component",i)));this.allSubscriptions.add(a)}getKeywords(){this._translateService.get(["keywords.composites","keywords.youNeedToSaveAllProductsAndServicesFirst","keywords.atLeastOneProductAndServiceNeedsToBeSelected"]).subscribe(e=>{this.compositesTranslate=e["keywords.composites"],this.youNeedToSaveAllProductsAndServicesFirstTranslate=e["keywords.youNeedToSaveAllProductsAndServicesFirst"],this.atLeastOneProductAndServiceNeedsToBeSelectedTranslate=e["keywords.atLeastOneProductAndServiceNeedsToBeSelected"]})}fetchCompositeProducts(e,a=!1){return X(this,null,function*(){let i=new me;e&&e!==""&&isNaN(+e)&&(i.searchText=e),i.isEstimate=a;try{return yield this._compositeService.get(this.clinicID,this.compositeId)}catch(p){console.log("composite product details component",p)}})}createForm(e){this.compositeForm=this._fb.group({compositeName:[e,[Lt.required]],services:[],products:[],isEstimate:[!1]})}setSubTotalPrice(e,a,i,p){return p?this._servicesManager.getTotalPrice(i.price,i.markup,i.tax?i.tax.taxValue:0,e,a):this._servicesManager.getTotalPrice(i.price,i.markup,0,e,a)}canSave(){return this.compositeForm.invalid?(this.compositeForm.markAllAsTouched(),st(),!1):this.isAddingOrEditingProductsOrServices()?this.selectedProductList.length+this.selectedServiceList.length<2?(this._snackBarTemplate.errorSnackBar(this.atLeastOneProductAndServiceNeedsToBeSelectedTranslate),st(),!1):!0:(this.productManager?.focusOnSave(),this.serviceManager?.focusOnSave(),this._snackBarTemplate.errorSnackBar(this.youNeedToSaveAllProductsAndServicesFirstTranslate),!1)}saveComposite(){return X(this,null,function*(){if(!this.canSave())return;let e={compositeName:this.compositeForm.value.compositeName,isEstimate:this.compositeForm.value.isEstimate,compositeProducts:this.compositeProducts};this.compositeId?this._compositeService.update(e,this.clinicID,this.compositeId).then(()=>{this._snackBarTemplate.successSnackBarUpdate(this.compositesTranslate),this._router.navigate(["catalogue/composites"])}).catch(a=>{this._snackBarTemplate.errorSnackBarUpdate(this.compositesTranslate,a)}):this._compositeService.create(e,this.clinicID).then(()=>{this._snackBarTemplate.successSnackBarCreate(this.compositesTranslate),this._router.navigate(["catalogue/composites"])}).catch(a=>{this._snackBarTemplate.errorSnackBarCreate(this.compositesTranslate,a)})})}isAddingOrEditingProductsOrServices(){let e=!this.productManager?.isAddingOrEditing||!0,a=!this.serviceManager?.isAddingOrEditing||!0;return e&&a}get compositeProducts(){return this.selectedProductList=this.selectedProductList?.map(e=>(e.productType=0,e))??[],this.selectedServiceList=this.selectedServiceList?.map(e=>(e.productType=1,e))??[],this.selectedProductList?.concat(this.selectedServiceList??[])??[]}get productManagerData(){return{itemList:this.productList,taxList:this.taxList,professionalFeeList:this.professionalFeeList,editType:pt.Default,itemManagerType:ct.Composite}}get serviceManagerData(){return{itemList:this.serviceList,taxList:this.taxList,editType:pt.Default,itemManagerType:ct.Composite}}get total(){return(this.productManager?.total??0)+(this.serviceManager?.total??0)}get subtotal(){return(this.productManager?.subtotal??0)+(this.serviceManager?.subtotal??0)}get tax(){return(this.productManager?.tax??0)+(this.serviceManager?.tax??0)}get discount(){return(this.productManager?.discount??0)+(this.serviceManager?.discount??0)}ngOnDestroy(){this.allSubscriptions.unsubscribe()}static{this.\u0275fac=function(a){return new(a||t)(_(Ze),_(W),_(Ce),_(jt),_(Be),_(Ft),_(be),_(fe),_(Ot),_(ie),_(We),_(zt),_(te))}}static{this.\u0275cmp=q({type:t,selectors:[["app-composite-details"]],viewQuery:function(a,i){if(a&1&&Z(Je,5)(Xe,5),a&2){let p;V(p=O())&&(i.productManager=p.first),V(p=O())&&(i.serviceManager=p.first)}},standalone:!1,decls:2,vars:2,consts:[["mode","indeterminate","diameter","64",1,"loading-indicator"],[1,"mat-card-2"],[3,"formGroup"],[1,"card-padding"],["fxLayout","column"],[1,"form-group","mt-30"],["appearance","outline","AutofocusInput",""],[1,"asterix"],["matInput","","type","text","name","compositeName","formControlName","compositeName"],[1,"card-title","p-0","pt-20","mb-10"],[3,"itemListChanged","data"],[1,"divi
1der","mt-20","mb-20"],[1,"no-box-shadow","mb-20",3,"expanded"],[1,"mat-expansion-panel-header-small","pl-0","pr-5",3,"ngClass.gt-md"],[1,"card-title","p-0"],["fxLayout","row","fxLayoutAlign","end"],["fxLayout","row","fxFlex","170px","fxFlex.lt-md","100","fxLayoutAlign","space-between",3,"ngClass.gt-md"],[3,"ngClass.lt-md"],["fxFlex","37px"],["fxLayout","row","fxLayoutAlign","end",1,"mr-50"],["fxLayout","column","fxFlex","170px","fxFlex.lt-md","100",3,"ngClass.gt-md"],["fxLayout","row","fxLayoutAlign","space-between"],["fxLayout","row","fxLayoutAlign","space-between",1,"mt-10"],["fxLayout","row","fxLayoutAlign","end center","fxLayoutGap","10"],["type","button","mat-raised-button","","type","button","routerLink","../",1,"secondary-button","large-long"],[1,"plus-sign"],[1,"fas","fa-cancel"],[1,"flex-cell"],["mat-stroked-button","","type","button",1,"primary-button","large-long",3,"click"]],template:function(a,i){a&1&&(S(0,jr,1,0,"mat-progress-spinner",0),S(1,Qr,67,95,"mat-card",1)),a&2&&(w(i.showLoadingIndicator?0:-1),n(),w(i.showLoadingIndicator?-1:1))},dependencies:[Bt,Dt,Se,we,rt,K,Y,re,ne,ce,Ie,Te,Je,Xe,ot,Pe,Fe,oe,se,At,le,$t,Ht,Gt,Rt,ae,U],encapsulation:2})}}return t})();var qr=()=>({"mr-40":!0}),_e=(t,m,e)=>[t,m,"symbol","1.2-2",e],oa=()=>({"ml-10":!0}),Ur=()=>({"ml-90":!0}),Yr=()=>({"mr-50":!0}),Kr=()=>({"ml-90":!0,"mr-40":!0});function Wr(t,m){t&1&&g(0,"mat-progress-spinner",1)}function Jr(t,m){if(t&1){let e=A();r(0,"div",23)(1,"button",24)(2,"span",25),g(3,"i",26),o(),r(4,"span"),l(5),s(6,"translate"),o()(),g(7,"div",27),r(8,"button",28),C("click",function(){E(e);let i=f(2);return k(i.saveEstimates())}),l(9),s(10,"translate"),o()()}t&2&&(n(5),v(c(6,2,"keywords.cancel")),n(4),u(" ",c(10,4,"keywords.save")," "))}function Xr(t,m){if(t&1){let e=A();r(0,"div",2)(1,"div",2)(2,"div",3)(3,"mat-form-field",4)(4,"mat-label"),l(5),s(6,"translate"),r(7,"span",5),l(8,"*"),o()(),g(9,"input",6),o()()(),r(10,"div",7),l(11),s(12,"translate"),o(),r(13,"product-manager",8),C("itemListChanged",function(i){E(e);let p=f();return k(p.selectedProductList=i)}),o(),r(14,"div",7),l(15),s(16,"translate"),o(),r(17,"service-manager",8),C("itemListChanged",function(i){E(e);let p=f();return k(p.selectedServiceList=i)}),o(),g(18,"div",9),r(19,"div",10)(20,"b"),l(21),s(22,"translate"),o()(),r(23,"mat-expansion-panel",11)(24,"mat-expansion-panel-header",12)(25,"mat-panel-title",13),l(26),s(27,"translate"),o(),r(28,"div",14)(29,"div",15)(30,"b"),l(31),s(32,"translate"),o(),r(33,"b"),l(34),s(35,"currency"),o()(),r(36,"div",16)(37,"b"),l(38),s(39,"translate"),o(),r(40,"b"),l(41),s(42,"currency"),o()(),g(43,"div",17),o()(),r(44,"div",18)(45,"div",19)(46,"div",20)(47,"span"),l(48),s(49,"translate"),o(),r(50,"span"),l(51),s(52,"currency"),o()(),r(53,"div",20)(54,"span"),l(55),s(56,"translate"),o(),r(57,"span"),l(58),s(59,"currency"),o()(),r(60,"div",20)(61,"span"),l(62),s(63,"translate"),o(),r(64,"span"),l(65),s(66,"currency"),o()(),r(67,"div",21)(68,"b"),l(69),s(70,"translate"),o(),r(71,"b"),l(72),s(73,"currency"),o()()(),r(74,"div",22)(75,"div",20)(76,"span"),l(77),s(78,"translate"),o(),r(79,"span"),l(80),s(81,"currency"),o()(),r(82,"div",20)(83,"span"),l(84),s(85,"translate"),o(),r(86,"span"),l(87),s(88,"currency"),o()(),r(89,"div",20)(90,"span"),l(91),s(92,"translate"),o(),r(93,"span"),l(94),s(95,"currency"),o()(),r(96,"div",21)(97,"b"),l(98),s(99,"translate"),o(),r(100,"b"),l(101),s(102,"currency"),o()()()()(),S(103,Jr,11,6,"div",23),o()}if(t&2){let e=f();n(5),v(c(6,35,"keywords.estimatesName")),n(6),v(c(12,37,"keywords.addProducts")),n(2),d("data",e.productManagerData),n(2),v(c(16,39,"keywords.addService")),n(2),d("data",e.serviceManagerData),n(4),u(" ",c(22,41,"keywords.totals")),n(2),d("expanded",!1),n(),d("ngClass.gt-xs",D(125,qr)),n(2),u(" ",c(27,43,"keywords.totals")," "),n(5),v(c(32,45,"keywords.low")),n(3),v(b(35,47,B(126,_e,e.totalLow,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(2),d("ngClass.xs",D(130,oa))("ngClass.gt-xs",D(131,Ur)),n(2),v(c(39,53,"keywords.high")),n(3),v(b(42,55,B(132,_e,e.total,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(3),d("ngClass.gt-xs",D(136,Yr)),n(4),u("",c(49,61,"keywords.lowSubtotal"),":"),n(3),v(b(52,63,B(137,_e,e.subtotalLow,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(4),u("",c(56,69,"keywords.lowTax"),":"),n(3),v(b(59,71,B(141,_e,e.taxLow,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(4),u("",c(63,77,"keywords.lowDiscount"),":"),n(3),v(b(66,79,B(145,_e,e.discountLow,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(4),v(c(70,85,"keywords.totalCaps")),n(3),v(b(73,87,B(149,_e,e.totalLow,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(2),d("ngClass.xs",D(153,oa))("ngClass.gt-xs",D(154,Kr)),n(3),u("",c(78,93,"keywords.subtotal"),":"),n(3),v(b(81,95,B(155,_e,e.subtotal,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(4),u("",c(85,101,"keywords.tax"),":"),n(3),v(b(88,103,B(159,_e,e.tax,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(4),u("",c(92,109,"keywords.discount"),":"),n(3),v(b(95,111,B(163,_e,e.discount,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(4),v(c(99,117,"keywords.totalCaps")),n(3),v(b(102,119,B(167,_e,e.total,e.selectedClinic==null?null:e.selectedClinic.currencyName,e.selectedClinic==null?null:e.selectedClinic.cultureName))),n(2),w(e.showLoadingIndicator?-1:103)}}var vi=(()=>{class t{constructor(e,a,i,p,h,y,F,H,z,at,Xt,Zt,ei){this._estimateService=e,this._clinicService=a,this._fb=i,this._taxService=p,this._professionalFeeService=h,this._servicesManager=y,this._productService=F,this.queryParamsService=H,this._ar=z,this._snackBarTemplate=at,this._router=Xt,this.enumeratorsService=Zt,this._translateService=ei,this.showLoadingIndicator=!1,this.taxList=[],this.professionalFeeList=[],this.allSubscriptions=new Q}ngOnInit(){this.showLoadingIndicator=!0,this.estimatesId=this._ar.snapshot.queryParams.id;let e=this._ar.snapshot.queryParams.name;if(this.createForm(e),!this._router.url.includes("create-estimates-details")&&this.queryParamsService.verifyQueryParams(this.estimatesId,e))return;let a=this._clinicService.$clinicObservable.pipe(bt(i=>{this.clinicID=i.clinicID,this.selectedClinic=i;let p=new G,h=new lt;h.statusType=J.Active,p.search=h;let y=new G,F=new it;return F.statusType=J.Active,y.search=F,Tt(this._taxService.getList(null,this.clinicID),this._professionalFeeService.getList(null,this.clinicID),this._productService.getList(p,this.clinicID),this._servicesManager.getList(y,this.clinicID),this.estimatesId?this.fetchEstimateProducts(null):wt({compositeProducts:[]}))})).subscribe(i=>{this.taxList=i[0],this.professionalFeeList=i[1],this.productList=i[2],this.serviceList=i[3],this.showLoadingIndicator=!1,setTimeout(()=>{this.productManager.form.updateValueAndValidity({emitEvent:!0}),this.serviceManager.form.updateValueAndValidity({emitEvent:!0}
1),i[4].compositeProducts.forEach(p=>{p.productType==0?this.productManager.addItem(p,!1):this.serviceManager.addItem(p,!1)})})},i=>console.log("estimates details component",i));this.allSubscriptions.add(a)}getKeywords(){this._translateService.get(["keywords.estimates","keywords.composites","keywords.youNeedToSaveAllProductsAndServicesFirst","keywords.atLeastOneProductAndServiceNeedsToBeSelected"]).subscribe(e=>{this.estimatesTranslate=e["keywords.estimates"],this.compositesTranslate=e["keywords.composites"],this.youNeedToSaveAllProductsAndServicesFirstTranslate=e["keywords.youNeedToSaveAllProductsAndServicesFirst"],this.atLeastOneProductAndServiceNeedsToBeSelectedTranslate=e["keywords.atLeastOneProductAndServiceNeedsToBeSelected"]})}fetchEstimateProducts(e,a=!0){return X(this,null,function*(){this.showLoadingIndicator=!0;let i=new me;return e&&e!==""&&isNaN(+e)&&(i.searchText=e),i.isEstimate=a,yield this._estimateService.get(this.clinicID,this.estimatesId).catch(p=>(console.log("estimate product details component",p),null))})}createForm(e){this.estimatesForm=this._fb.group({estimateName:[e,[Lt.required]],services:[],products:[],isEstimate:[!0]})}canSave(){return this.estimatesForm.invalid?(this.estimatesForm.markAllAsTouched(),st(),!1):this.isAddingOrEditingProductsOrServices()?this.selectedProductList===void 0||this.selectedServiceList===void 0||this.selectedProductList.length+this.selectedServiceList.length<2?(this._snackBarTemplate.errorSnackBar("At least one product and service needs to be selected."),st(),!1):!0:(this._snackBarTemplate.errorSnackBar("You need to save all products and services first"),this.productManager?.focusOnSave(),this.serviceManager?.focusOnSave(),!1)}saveEstimates(){return X(this,null,function*(){if(!this.canSave())return;let e={compositeName:this.estimatesForm.value.estimateName,isEstimate:this.estimatesForm.value.isEstimate,compositeProducts:this.estimatesProducts};this.estimatesId?yield this._estimateService.update(e,this.clinicID,this.estimatesId).then(()=>{this._snackBarTemplate.successSnackBarUpdate("Estimates"),this._router.navigate(["catalogue/estimates"])}).catch(a=>{this._snackBarTemplate.errorSnackBarUpdate("Estimates",a)}):yield this._estimateService.create(e,this.clinicID).then(()=>{this._snackBarTemplate.successSnackBarCreate("Composites"),this._router.navigate(["catalogue/estimates"])}).catch(a=>{this._snackBarTemplate.errorSnackBarCreate("Composites",a)})})}isAddingOrEditingProductsOrServices(){let e=!this.productManager?.isAddingOrEditing||!0,a=!this.serviceManager?.isAddingOrEditing||!0;return e&&a}get estimatesProducts(){return this.selectedProductList=this.selectedProductList?.map(e=>(e.productType=0,e))??[],this.selectedServiceList=this.selectedServiceList?.map(e=>(e.productType=1,e))??[],this.selectedProductList?.concat(this.selectedServiceList??[])??[]}get productManagerData(){return{taxList:this.taxList,professionalFeeList:this.professionalFeeList,editType:pt.Default,itemList:this.productList,itemManagerType:ct.Estimate}}get serviceManagerData(){return{taxList:this.taxList,editType:pt.Default,itemList:this.serviceList,itemManagerType:ct.Estimate}}get total(){return(this.productManager?.total??0)+(this.serviceManager?.total??0)}get subtotal(){return(this.productManager?.subtotal??0)+(this.serviceManager?.subtotal??0)}get tax(){return(this.productManager?.tax??0)+(this.serviceManager?.tax??0)}get discount(){return(this.productManager?.discount??0)+(this.serviceManager?.discount??0)}get subtotalLow(){return(this.productManager?.subtotalLow??0)+(this.serviceManager?.subtotalLow??0)}get taxLow(){return(this.productManager?.taxLow??0)+(this.serviceManager?.taxLow??0)}get discountLow(){return(this.productManager?.discountLow??0)+(this.serviceManager?.discountLow??0)}get totalLow(){return(this.productManager?.totalLow??0)+(this.serviceManager?.totalLow??0)}ngOnDestroy(){this.allSubscriptions.unsubscribe()}static{this.\u0275fac=function(a){return new(a||t)(_(Ze),_(W),_(Ft),_(We),_(zt),_(Ce),_(jt),_(Ot),_(be),_(ie),_(fe),_(Be),_(te))}}static{this.\u0275cmp=q({type:t,selectors:[["app-estimates-details"]],viewQuery:function(a,i){if(a&1&&Z(Je,5)(Xe,5),a&2){let p;V(p=O())&&(i.productManager=p.first),V(p=O())&&(i.serviceManager=p.first)}},standalone:!1,decls:5,vars:3,consts:[[3,"formGroup"],["mode","indeterminate","diameter","64",1,"loading-indicator"],["fxLayout","column"],["fxFlex","50",1,"form-group"],["appearance","outline","AutofocusInput",""],[1,"asterix"],["matInput","","type","text","name","estimateName","formControlName","estimateName"],[1,"card-title","p-0","pt-20","mb-10"],[3,"itemListChanged","data"],[1,"divi
1der","mt-20","mb-20"],["fxHide.gt-xs",""],[1,"no-box-shadow","mb-20",3,"expanded"],[1,"mat-expansion-panel-header-small","pl-0","pr-5",3,"ngClass.gt-xs"],["fxHide.xs","",1,"card-title","p-0"],["fxLayout","row","fxLayoutAlign","end"],["fxLayout","row","fxFlex","170px","fxFlex.xs","140px","fxLayoutAlign","space-between"],["fxLayout","row","fxFlex","170px","fxFlex.xs","140px","fxLayoutAlign","space-between",3,"ngClass.xs","ngClass.gt-xs"],["fxHide.xs","","fxFlex","37px"],["fxLayout","row","fxLayoutAlign","end","fxLayoutAlign.xs","start",3,"ngClass.gt-xs"],["fxLayout","column","fxFlex","170px","fxFlex.xs","140px"],["fxLayout","row","fxLayoutAlign","space-between"],["fxLayout","row","fxLayoutAlign","space-between",1,"mt-10"],["fxLayout","column","fxFlex","170px","fxFlex.xs","140px",3,"ngClass.xs","ngClass.gt-xs"],["fxLayout","row","fxLayoutAlign","end center","fxLayoutGap","10"],["type","button","mat-raised-button","","routerLink","../",1,"secondary-button","large-long"],[1,"plus-sign"],[1,"fas","fa-cancel"],[1,"flex-cell"],["mat-stroked-button","","type","button",1,"primary-button","large-long",3,"click"]],template:function(a,i){a&1&&(r(0,"mat-card")(1,"form",0)(2,"mat-card-content"),S(3,Wr,1,0,"mat-progress-spinner",1),S(4,Xr,104,171,"div",2),o()()()),a&2&&(n(),d("formGroup",i.estimatesForm),n(2),w(i.showLoadingIndicator?3:-1),n(),w(i.showLoadingIndicator?-1:4))},dependencies:[Bt,Dt,Se,we,rt,K,Y,re,ne,ge,ce,Ie,Te,Je,Xe,ot,Pe,Fe,oe,se,At,le,$t,Ht,Gt,Rt,ae,U],encapsulation:2})}}return t})();var Zr=[{path:"",component:Wi,children:[{path:"",redirectTo:"manager",pathMatch:"full",data:{localStorageProperty:null,isActiveRoute:!1,breadcrumb:"Breadcrumb.inventoryManager"}},{path:"manager",component:Zi,canActivate:[de],data:{localStorageProperty:null,isActiveRoute:!1,breadcrumb:"Breadcrumb.products",userClaims:[{group:M.products,typeName:L.c_viewProducts}]}},{path:"services",component:ra,canActivate:[de],data:{localStorageProperty:null,isActiveRoute:!1,breadcrumb:"Breadcrumb.services",userClaims:[{group:M.products,typeName:L.c_viewProducts}]}},{path:"composites",canActivate:[de],canActivateChild:[de],data:{localStorageProperty:null,isActiveRoute:!0,breadcrumb:"Breadcrumb.composites",userClaims:[{group:M.composites,typeName:L.c_viewComposites}]},children:[{path:"",component:ta},{path:"create-composite-details",canActivate:[de],component:fi,data:{localStorageProperty:null,isActiveRoute:!1,userClaims:[{group:M.composites,typeName:L.c_createComposites}],breadcrumb:"Breadcrumb.createCompositeDetails"}},{path:"modify-composite-details",canActivate:[de],component:fi,data:{localStorageProperty:null,isActiveRoute:!1,userClaims:[{group:M.composites,typeName:L.c_editComposites}],breadcrumb:"Breadcrumb.editCompositeDetails"}}]},{path:"estimates",canActivate:[de],canActivateChild:[de],data:{localStorageProperty:null,isActiveRoute:!0,breadcrumb:"Breadcrumb.estimates",userClaims:[{group:M.estimates,typeName:L.c_viewEstimates}]},children:[{path:"",component:na},{path:"create-estimates-details",canActivate:[de],component:vi,data:{localStorageProperty:null,isActiveRoute:!1,breadcrumb:"Breadcrumb.createEstimatesDetails",userClaims:[{group:M.estimates,typeName:L.c_createEstimates}]}},{path:"modify-estimates-details",canActivate:[de],component:vi,data:{localStorageProperty:null,isActiveRoute:!1,breadcrumb:"Breadcrumb.modifyEstimatesDetails",userClaims:[{group:M.estimates,typeName:L.c_editEstimates}]}}]}]}],sa=(()=>{class t{static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275mod=Et({type:t})}static{this.\u0275inj=It({imports:[ti.forChild(Zr),ti]})}}return t})();var Jl=(()=>{class t{constructor(e){e.loadAndMerge("portal/catalogue")}static{this.\u0275fac=function(a){return new(a||t)(Ci(Li))}}static{this.\u0275mod=Et({type:t})}static{this.\u0275inj=It({imports:[wi,Ti,sa,Hi,Ii,Yi,Gi,Ri]})}}return t})();export{Jl as CatalogueModule};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.