import{a as X}from"./chunk-H2ESAGHH.js";import{a as Y,b as q,c as Q}from"./chunk-4E77YVK7.js";import"./chunk-DQKZHRZN.js";import"./chunk-7EAWKBIV.js";import"./chunk-V64RF3DS.js";import{$b as g,Fc as A,Ic as B,Tc as W,Uc as z,na as s,nd as K,pd as J}from"./chunk-ATD4AEXQ.js";import{$a as E,$c as U,Bb as u,Ia as k,Ka as a,Kc as R,Oa as m,Ob as T,Pb as O,Qb as h,Rb as L,Sb as G,Ta as f,Ua as I,Z as x,bd as $,da as F,ed as P,fb as _,fc as N,gc as j,gd as V,id as H,ja as C,k as y,ka as b,lb as D,mb as v,nb as c,ob as r,pb as d,qb as w,xb as M,zb as p}from"./chunk-BXH3QC5E.js";var ee=(()=>{class i{class="abs-dashboard-tile";tileConfig;tileClick=new E;tileClicked(){this.tileClick.emit(this.tileConfig.path)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=f({type:i,selectors:[["abs-dashboard-tile"]],hostVars:2,hostBindings:function(t,o){t&2&&O(o.class)},inputs:{tileConfig:"tileConfig"},outputs:{tileClick:"tileClick"},standalone:!1,decls:6,vars:6,consts:[["mat-button","",1,"tile-button",3,"click"],[1,"tile-block"],["aria-hidden","false",1,"tile-icon",3,"svgIcon"],[1,"tile-bottom-left-text"]],template:function(t,o){t&1&&(r(0,"button",0),p("click",function(){return o.tileClicked()}),r(1,"div",1),w(2,"mat-icon",2),r(3,"span",3),h(4),N(5,"translate"),d()()()),t&2&&(_("data-cy",o.tileConfig.dataCyTag),a(2),c("svgIcon",o.tileConfig.svgIcon),_("aria-label",o.tileConfig.ariaLabel),a(2),L(j(5,4,o.tileConfig.title)))},dependencies:[K,W,U],encapsulation:2})}return i})();var re=(i,l)=>l.menuGroupID;function ne(i,l){return this.trackDialogKey(l,i)}function ae(i,l){if(i&1){let e=M();r(0,"mat-grid-tile",5)(1,"abs-dashboard-tile",6),p("tileClick",function(o){C(e);let n=u(2);return b(n.openDialog(o))}),d()()}if(i&2){let e=l.$implicit,t=u(2);T(t.getStyle(e)),a(),c("tileConfig",t.getTileConfigForDialog(e))}}function se(i,l){if(i&1){let e=M();r(0,"mat-grid-list",2),p("resize",function(o){C(e);let n=u();return b(n.onResize(o))},k),r(1,"div",3),h(2),d(),D(3,ae,2,3,"mat-grid-tile",4,ne,!0),d()}if(i&2){let e=l.$implicit,t=u();T(t.getGridListStyle()),c("cols",t.numberOfColumns),a(2),G(" ",e.menuGroupDescription," "),a(),v(e.dialogs)}}var le=3,te=254,ie=16,S=(()=>{class i{router;route;menusManager;dialogTilesService;numberOfColumns=le;menuGroupsList;tiles;destroySubject=new y;constructor(e,t,o,n){this.router=e,this.route=t,this.menusManager=o,this.dialogTilesService=n}ngOnInit(){this.menusManager.getSelectedMenu().pipe(x(this.destroySubject)).subscribe(e=>{g.isNullOrUndefined(e)||(this.menuGroupsList=e.menuGroups,this.tiles=this.dialogTilesService.getDialogsTiles(),this.computeNumberOfColumns(window.innerWidth),this.goToSingleDialog(this.menuGroupsList))})}ngOnDestroy(){this.destroySubject.next(),this.destroySubject.complete()}goToSingleDialog(e){let t=this.router.lastSuccessfulNavigation?.previousNavigation?.finalUrl?.toString(),o=g.isNullOrUndefined(t)||t.includes(`${s.Login.path}/${s.Auth.path}`)||t.includes(`${s.MainPanel.path}/${s.Dashboard.path}`);e.length===1&&e[0].dialogs.length===1&&o&&this.openDialog(this.tiles.find(n=>n.dialogCode===e[0].dialogs[0].dialogCode).path)}computeGridListWidth(){return this.numberOfColumns*te+(this.numberOfColumns-1)*ie}computeNumberOfColumns(e){this.numberOfColumns=Math.min(Math.trunc(e/(te+ie)),this.tiles.length)}getGridListStyle(){return`width: ${this.computeGridListWidth()}px;`}openDialog(e){this.router.navigate([s.MainPanel.path,e]).catch(g.EMPTY_REJECTION_HANDLER)}onResize(e){this.computeNumberOfColumns(e.target.innerWidth)}getTileConfigForDialog(e){let t=this.tiles.find(o=>o.dialogCode===e.dialogCode);return g.isNullOrUndefined(t)?new A:t}getStyle(e){return e.readOnly?"background-image: url(assets/dashboard/images/disabled-dashboard-tile.svg)":"background-image: url(assets/dashboard/images/dashboard-tile.svg)"}trackDialogKey(e,t){return`${e.dialogCode}_${t}`}static \u0275fac=function(t){return new(t||i)(m(V),m(P),m(X),m(B))};static \u0275cmp=f({type:i,selectors:[["abs-dashboard-frame"]],standalone:!1,decls:3,vars:0,consts:[[1,"tile-container"],["rowHeight","254px","gutterSize","16px",1,"abs-grid-list",3,"cols","style"],["rowHeight","254px","gutterSize","16px",1,"abs-grid-list",3,"resize","cols"],[1,"text-separator"],[1,"abs-grid-tile",3,"style"],[1,"abs-grid-tile"],[3,"tileClick","tileConfig"]],template:function(t,o){t&1&&(r(0,"div",0),D(1,se,5,4,"mat-grid-list",1,re),d()),t&2&&(a(),v(o.menuGroupsList))},dependencies:[q,Y,ee],encapsulation:2})}return i})();var de=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=I({type:i});static \u0275inj=F({imports:[R,J,Q,$,H.forChild([{path:"",component:S,data:{title:s.Dashboard.title}}]),z]})}return i})();export{de as DashboardFeatureModule,S as DashboardFrameComponent};
