Commit b9ec5bf6 authored by Tomáš Biloš's avatar Tomáš Biloš
Browse files

Merge branch 'fix/bottomnav' into 'main'

fix: Contextual bottom bar

See merge request !89
parents 7b43d51e b37c68a9
......@@ -26,7 +26,7 @@ const routes: Routes = [
component: AuthComponent,
canActivate: [AuthGuard],
children: [
{ path: '', component: HomeComponent, pathMatch: 'full' },
{ path: '', redirectTo: 'missions', pathMatch: 'full' },
{
path: 'agent/edit/:id',
component: EditAgentComponent,
......
......@@ -30,6 +30,11 @@
<mat-divider></mat-divider>
<mat-list-item mat-button routerLink="agent/{{ currentAgentId() }}">
<mat-icon matListIcon>account_circle</mat-icon>
<span>My profile</span>
</mat-list-item>
<mat-list-item mat-button routerLink="/" (click)="logOut()">
<mat-icon matListIcon>logout</mat-icon>
Logout
......@@ -54,14 +59,30 @@
<mat-icon class="material-icons">check_circle</mat-icon>
<span class="block leading-tight">Missions</span>
</button>
<button color="primary" mat-flat-button routerLink="/auth/agents" routerLinkActive="!font-bold">
<button color="primary" mat-flat-button routerLink="/auth/assignments" routerLinkActive="!font-bold"
*ngIf="hasRole(agentRole.ADMIN) || hasRole(agentRole.SUPERVISOR)">
<mat-icon class="material-icons">check_circle</mat-icon>
<span class="block leading-tight">Assignments</span>
</button>
<button color="primary" mat-flat-button routerLink="/auth/agents" routerLinkActive="!font-bold"
*ngIf="hasRole(agentRole.ADMIN) || hasRole(agentRole.SUPERVISOR)">
<mat-icon class="material-icons">face</mat-icon>
<span class="block leading-tight">Agents</span>
</button>
<button color="primary" mat-flat-button routerLink="/auth/countries" routerLinkActive="!font-bold">
<button color="primary" mat-flat-button routerLink="/auth/countries" routerLinkActive="!font-bold"
*ngIf="hasRole(agentRole.ADMIN) || hasRole(agentRole.SUPERVISOR)">
<mat-icon class="material-icons">flag</mat-icon>
<span class="block leading-tight !text-grey-400">Countries</span>
</button>
<button color="primary" mat-flat-button routerLink="agent/{{ currentAgentId() }}" routerLinkActive="!font-bold"
*ngIf="!hasRole(agentRole.ADMIN) && !hasRole(agentRole.SUPERVISOR)">
<mat-icon class="material-icons">account_circle</mat-icon>
<span class="block leading-tight">My profile</span>
</button>
</mat-toolbar>
</mat-drawer-container>
import { Component } from '@angular/core';
import { AuthService } from './auth.service';
import { AgentRole } from './roles.enum';
@Component({ selector: 'auth', templateUrl: './auth.component.html' })
export class AuthComponent {
......@@ -9,4 +10,13 @@ export class AuthComponent {
this.authService.removeAllCookies();
this.authService.logout();
}
agentRole = AgentRole;
hasRole(role: AgentRole) {
return this.authService.hasRole(role);
}
currentAgentId() {
return this.authService.getCurrentUser().id;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment