-een gebruiker kan meerdere bedrijven hebben
-manier van afspraken maken veranderd in de backend ivm meerdere bedrijven gebruiker -email is aangepast op bedrijf en gebruiker -dropdown voor instellingen toegevoegd
This commit is contained in:
@@ -19,24 +19,27 @@
|
||||
[tuiObscuredEnabled]="open"
|
||||
(click)="onClick()"
|
||||
(tuiActiveZoneChange)="onActiveZone($event)"
|
||||
(tuiObscured)="onObscured($event)"
|
||||
>
|
||||
(tuiObscured)="onObscured($event)">
|
||||
<tui-avatar src="{{getInitials()}}"/>
|
||||
<ng-template #dropdownContent>
|
||||
<div class="dropdown">
|
||||
<h3>{{ fullName }}</h3>
|
||||
<button
|
||||
size="m"
|
||||
tuiButton
|
||||
type="button"
|
||||
id="uitloggen"
|
||||
(click)="logout()"
|
||||
>
|
||||
Uitloggen
|
||||
</button>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
|
||||
|
||||
</button>
|
||||
<ng-template #dropdownContent>
|
||||
<div class="dropdown">
|
||||
<h3>{{ fullName }}</h3>
|
||||
<h4>{{ currentCompany.name }}</h4>
|
||||
|
||||
<button
|
||||
size="m"
|
||||
tuiButton
|
||||
type="button"
|
||||
id="uitloggen"
|
||||
(click)="logout()">
|
||||
Uitloggen
|
||||
</button>
|
||||
</div>
|
||||
</ng-template>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
.navbar {
|
||||
background-color: #f8f9fa;
|
||||
display: flex
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
ul {
|
||||
@@ -48,11 +49,12 @@ tui-avatar {
|
||||
line-height: 1.25rem;
|
||||
padding: 0.25rem 0.75rem;
|
||||
margin-left: 4px;
|
||||
margin-right: 4px;
|
||||
margin-right: 20px;
|
||||
margin-bottom: 8px;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
.t-content {
|
||||
ui-scrollbar.t-scroll.ng-tns-c452864359-10._native-hidden {
|
||||
margin-right: 24px;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import {Router, RouterLink, RouterLinkActive, RouterModule} from '@angular/router';
|
||||
import {TuiAvatar, TuiChevron,} from '@taiga-ui/kit';
|
||||
import {AuthService} from '../../services/auth.service';
|
||||
import {User} from '../../models/user';
|
||||
import {TuiButton, TuiDropdown} from '@taiga-ui/core';
|
||||
import {TuiActiveZone, TuiObscured} from '@taiga-ui/cdk';
|
||||
import {environment} from '../../../environments/environment';
|
||||
import {Company} from '../../models/company';
|
||||
import {CompanyService} from '../../services/company.service';
|
||||
import {TuiSelectModule} from '@taiga-ui/legacy';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
imports: [TuiAvatar, RouterModule, FormsModule, RouterLink, RouterLinkActive, TuiDropdown, TuiObscured, TuiActiveZone, TuiButton, TuiChevron],
|
||||
imports: [TuiAvatar, RouterModule, FormsModule, RouterLink, RouterLinkActive, TuiDropdown, TuiObscured, TuiActiveZone, TuiButton, TuiChevron, TuiSelectModule, ReactiveFormsModule],
|
||||
templateUrl: './home.component.html',
|
||||
styleUrl: './home.component.scss'
|
||||
})
|
||||
export class HomeComponent implements OnInit {
|
||||
user: User
|
||||
fullName: string
|
||||
companies: Company[]
|
||||
|
||||
getInitials(): string {
|
||||
this.user = this.authService.getUserInfo();
|
||||
@@ -39,17 +44,29 @@ export class HomeComponent implements OnInit {
|
||||
this.open = active && this.open;
|
||||
}
|
||||
|
||||
constructor(private authService: AuthService, private router: Router) {
|
||||
constructor(private authService: AuthService, private router: Router, private companyService: CompanyService) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (!this.authService.isAuthenticated()) {
|
||||
this.router.navigate(['login']);
|
||||
} else {
|
||||
this.companyService.getCompanies().subscribe(
|
||||
response => {
|
||||
this.companies = response
|
||||
this.authService.setCurrentCompany(response[0])
|
||||
console.log(this.companies)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.authService.logout();
|
||||
this.router.navigate(['login']);
|
||||
}
|
||||
|
||||
protected readonly environment = environment;
|
||||
currentCompany: Company;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user