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C,KAAK8C,mBAAqB,CAC/G,CAEDE,sBACEhD,KAAK8C,mBAAqB9C,KAAK8C,qBAAuB9C,KAAKsB,gBAAgBM,OAAOC,OAAS,EAAI7B,KAAK8C,mBAAqB9C,KAAK8C,mBAAqB,CACpJ,CAEDG,cACEjD,KAAKO,WAAW2C,aACjB,+CA9FUvD,GAAkBD,2JAAlBC,EAAkBwD,i/BDf/BzD,sCAAuB,UAAvBA,CAAuB,UAAvBA,CAAuB,OAAvBA,CAAuB,YAISA,iCAAQA,2BAAQA,sBACxCA,sCAGFA,6BAEFA,iDAuCFA,2BAEAA,kDA6CFA,kCA5FgDA,kFACPA,gGAKtBA,0EAyCFA,kwICpCJC,CAAb,qBCJA,MAAMyD,GAAiB,CACrB,CACEC,KAAM,GACNC,UAAW3D,KAiBR,IAAM4D,GAAb,MAAM,MAAOA,EACX3D,cAAgB,+CADL2D,EAAe,iDAAfA,wDAJA,CACTC,KACDC,SARCC,eACAC,IACAC,cAAsBR,IACtBS,KACAC,QAMSP,CAAb,gECnBS,IAAMQ,EAAb,MAAM,MAAOA,EACXnE,YACUoE,EACAC,EACAnE,GAFAE,mBACAA,qBACAA,sBAGVA,WAAkB,EAFd,CAISkE,eAAWC,GACtBnE,KAAKmE,MAAQA,CACd,CAED9D,WACEL,KAAKF,eAAeU,eAAeI,UAAWD,IAExCA,GACFA,EAAOI,aACPf,KAAKmE,MAAMC,SAASzD,EAAOI,YAAYsD,OAEvCrE,KAAKiE,cAAcK,QACnBtE,KAAKiE,cAAcM,mBAAmBvE,KAAKgE,cAEzChE,KAAKiE,cAAcK,OAAnB,EAGP,+CA1BUP,GAAgBrE,oLAAhBqE,EAAgBZ,oEAAhBY,CAAb","names":["i0","DashboardComponent","constructor","tabTitleService","ssoAuthService","dashboardService","this","DateTime","Date","setZone","toISO","ngOnInit","setTabTitle","ssoAuthSub","currentRpUser$","pipe","filter","rpUser","subscribe","_this","userRoleId","currentRole","id","userFirstName","firstName","resp","getDashboardConfig","toPromise","dashboardConfig","JSON","parse","config","value","dashboardSettings","phases","length","forEach","phase","index","phaseStartDate","phaseEndDate","luxonPhaseStartDate","luxonPhaseEndDate","phaseDateDiffInSeconds","diff","toObject","seconds","nowDiffToPhaseEndDateInSeconds","phaseProgress","Math","round","nowISO","selectedPhaseIndex","navigateToPrevPhase","navigateToNextPhase","ngOnDestroy","unsubscribe","selectors","routes","path","component","DashboardModule","DashboardService","imports","CommonModule","SharedModule","RouterModule","WidgetsModule","MatTabsModule","HasRoleDirective","templateRef","viewContainer","appHasRole","roles","includes","name","clear","createEmbeddedView"],"sourceRoot":"webpack:///","sources":["./src/app/dashboard/dashboard.component.html","./src/app/dashboard/dashboard.component.ts","./src/app/dashboard/dashboard.module.ts","./src/app/shared/directives/has-role.directive.ts"],"sourcesContent":["
\r\n
\r\n
\r\n

\r\n Welcome {{userFirstName}}!\r\n \r\n settings\r\n \r\n

\r\n
\r\n \r\n 0\">\r\n
\r\n
\r\n \r\n chevron_left\r\n \r\n \r\n chevron_right\r\n \r\n
\r\n
\r\n \r\n \r\n \r\n
\r\n
{{ phase.phaseTitle }}
\r\n {{ phase.phaseDateLabel }}\r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n \r\n","import { Component, OnInit, ViewEncapsulation } from \"@angular/core\";\r\nimport { TabTitleService } from \"../shared/services/tab-title.service\";\r\nimport { SsoAuthService } from \"../shared/services/sso-auth.service\";\r\nimport { Subscription } from \"rxjs\";\r\nimport { DashboardConfig } from \"../shared/model/dashboard-config.model\";\r\nimport { DashboardService } from \"../shared/services/dashboard.service\";\r\nimport { DateTime } from \"luxon\";\r\nimport { filter } from \"rxjs/operators\";\r\n\r\n@Component({\r\n selector: 'app-dashboard',\r\n templateUrl: './dashboard.component.html',\r\n styleUrls: ['./dashboard.component.scss'],\r\n encapsulation: ViewEncapsulation.None\r\n})\r\nexport class DashboardComponent implements OnInit {\r\n\r\n private ssoAuthSub: Subscription;\r\n private userRoleId: string = '';\r\n public userFirstName: string = '';\r\n\r\n public selectedPhaseIndex: number = 0;\r\n\r\n public dashboardConfig: DashboardConfig = null;\r\n\r\n nowISO: string = DateTime.fromJSDate(new Date()).setZone(\"UTC\").toISO();\r\n\r\n constructor(\r\n private tabTitleService: TabTitleService,\r\n private ssoAuthService: SsoAuthService,\r\n private dashboardService: DashboardService\r\n ) { }\r\n\r\n ngOnInit() {\r\n this.tabTitleService.setTabTitle('Dashboard');\r\n this.ssoAuthSub = this.ssoAuthService.currentRpUser$\r\n .pipe(\r\n filter(rpUser => !!rpUser)\r\n )\r\n .subscribe(async rpUser => {\r\n this.userRoleId = rpUser.currentRole.id;\r\n this.userFirstName = rpUser.firstName;\r\n\r\n // getting dashboard config for the current role of the user\r\n const resp: any = await this.dashboardService.getDashboardConfig(this.userRoleId).toPromise();\r\n // try catching if the config value coming from RP is JSON parsable\r\n try {\r\n this.dashboardConfig = JSON.parse(resp.config.value);\r\n } catch (e) {\r\n this.dashboardConfig = {\r\n dashboardSettings: '',\r\n phases: [],\r\n }\r\n };\r\n\r\n if (this.dashboardConfig.phases.length > 0) {\r\n this.dashboardConfig.phases.forEach((phase, index) => {\r\n // if we have both start and end date for a phase, we display a progress bar for it\r\n if (phase.phaseStartDate && phase.phaseEndDate) {\r\n const luxonPhaseStartDate = DateTime.fromISO(phase.phaseStartDate);\r\n const luxonPhaseEndDate = DateTime.fromISO(phase.phaseEndDate);\r\n // difference is negative number\r\n const phaseDateDiffInSeconds = luxonPhaseStartDate.diff(luxonPhaseEndDate, 'seconds').toObject().seconds;\r\n // difference is negative number if phase end date has not occured yet, otherwise it's positive\r\n const nowDiffToPhaseEndDateInSeconds = DateTime.fromJSDate(new Date()).setZone(\"UTC\").diff(luxonPhaseEndDate, 'seconds').toObject().seconds;\r\n\r\n if (nowDiffToPhaseEndDateInSeconds > 0) {\r\n // phase ended\r\n phase.phaseProgress = 100;\r\n } else if (nowDiffToPhaseEndDateInSeconds < phaseDateDiffInSeconds) {\r\n // phase hasn't started\r\n phase.phaseProgress = 0;\r\n } else {\r\n // phase is in progress\r\n // (1) phase progress in percentage is:\r\n // (2) the difference between the current time and the phase end date\r\n // (3) divided by the total difference between phase start and end date \r\n // (4) times 100 to get percentage difference between them\r\n // (5) however, since the now difference is declinining (because it's a negative number)\r\n // (6) we substract the given percentage from 100 to get the real percentage\r\n let phaseProgressInPercentage = 100 - ((nowDiffToPhaseEndDateInSeconds / phaseDateDiffInSeconds) * 100);\r\n phase.phaseProgress = Math.round(phaseProgressInPercentage * 1e2 ) / 1e2;\r\n }\r\n } else {\r\n // if we don't have start and end dates, the phase progress is null\r\n phase.phaseProgress = null;\r\n }\r\n\r\n // increase active phase index if current date has passed any phase end date\r\n if (index !== (this.dashboardConfig.phases.length - 1)) {\r\n if (phase.phaseEndDate < this.nowISO) {\r\n this.selectedPhaseIndex++;\r\n }\r\n }\r\n });\r\n };\r\n });\r\n }\r\n\r\n navigateToPrevPhase() {\r\n this.selectedPhaseIndex = this.selectedPhaseIndex === 0 ? this.selectedPhaseIndex : this.selectedPhaseIndex - 1;\r\n }\r\n\r\n navigateToNextPhase() {\r\n this.selectedPhaseIndex = this.selectedPhaseIndex === this.dashboardConfig.phases.length - 1 ? this.selectedPhaseIndex : this.selectedPhaseIndex + 1;\r\n }\r\n\r\n ngOnDestroy() {\r\n this.ssoAuthSub.unsubscribe();\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\n\r\nimport { RouterModule, Routes } from '@angular/router';\r\n\r\nimport { SharedModule } from '../shared/shared.module';\r\nimport { DashboardComponent } from './dashboard.component';\r\nimport { WidgetsModule } from '../widgets/widgets.module';\r\nimport { MatTabsModule } from '@angular/material/tabs';\r\nimport { DashboardService } from '../shared/services/dashboard.service';\r\n\r\nconst routes: Routes = [\r\n {\r\n path: \"\",\r\n component: DashboardComponent,\r\n },\r\n];\r\n\r\n@NgModule({\r\n declarations: [DashboardComponent],\r\n imports: [\r\n CommonModule,\r\n SharedModule,\r\n RouterModule.forChild(routes),\r\n WidgetsModule,\r\n MatTabsModule\r\n ],\r\n providers: [\r\n DashboardService\r\n ]\r\n})\r\nexport class DashboardModule {\r\n constructor() {}\r\n }\r\n","import {\r\n Directive,\r\n TemplateRef,\r\n ViewContainerRef,\r\n Input,\r\n OnInit,\r\n } from '@angular/core';\r\nimport { SsoAuthService } from '../services/sso-auth.service';\r\n \r\n @Directive({\r\n selector: '[appHasRole]',\r\n })\r\n export class HasRoleDirective implements OnInit {\r\n constructor(\r\n private templateRef: TemplateRef,\r\n private viewContainer: ViewContainerRef,\r\n private ssoAuthService: SsoAuthService\r\n ) {}\r\n \r\n roles: string[] = [];\r\n \r\n @Input() set appHasRole(roles: string[]) {\r\n this.roles = roles;\r\n }\r\n \r\n ngOnInit() {\r\n this.ssoAuthService.currentRpUser$.subscribe((rpUser) => {\r\n \r\n if (rpUser &&\r\n rpUser.currentRole &&\r\n this.roles.includes(rpUser.currentRole.name)) {\r\n\r\n this.viewContainer.clear();\r\n this.viewContainer.createEmbeddedView(this.templateRef);\r\n } else {\r\n this.viewContainer.clear();\r\n }\r\n })\r\n }\r\n }\r\n "],"x_google_ignoreList":[]}