-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:
@@ -12,12 +12,12 @@
|
||||
<h1 class="date" id="geselecteerdeDatum" (click)="toggleCalendar()">{{ getDate() }}
|
||||
<tui-icon
|
||||
*ngIf="!showCalendar"
|
||||
icon="@tui.chevron-down"
|
||||
[style.color]="'var(--tui-background-accent-1)'"/>
|
||||
icon="@tui.chevron-down"
|
||||
[style.color]="'var(--tui-background-accent-1)'"/>
|
||||
<tui-icon
|
||||
*ngIf="showCalendar"
|
||||
icon="@tui.chevron-up"
|
||||
[style.color]="'var(--tui-background-accent-1)'"/>
|
||||
icon="@tui.chevron-up"
|
||||
[style.color]="'var(--tui-background-accent-1)'"/>
|
||||
</h1>
|
||||
<button
|
||||
appearance="primary"
|
||||
@@ -52,7 +52,7 @@
|
||||
size="m"
|
||||
tuiButton
|
||||
id="afspraakMaken"
|
||||
(click)="isModalOpen = true"
|
||||
(click)="showNewItem = true"
|
||||
type="button">
|
||||
<tui-icon
|
||||
icon="@tui.plus"
|
||||
@@ -60,6 +60,23 @@
|
||||
/>
|
||||
Afspraak maken
|
||||
</button>
|
||||
<button
|
||||
appearance="secondary"
|
||||
size="m"
|
||||
tuiButton
|
||||
id="instellingen"
|
||||
(click)="openSettings()"
|
||||
[tuiDropdown]="dropdownContent"
|
||||
[tuiDropdownManual]="open"
|
||||
type="button">
|
||||
<tui-icon
|
||||
icon="@tui.settings"
|
||||
[style.height.rem]="1">
|
||||
</tui-icon>
|
||||
</button>
|
||||
<ng-template #dropdownContent>
|
||||
<div class="dropdown">But there is nothing to choose...</div>
|
||||
</ng-template>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="agenda-container">
|
||||
@@ -88,7 +105,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<app-modal title="Nieuwe afspraak" (close)="closeNewItemModal()" *ngIf="isModalOpen">
|
||||
<app-modal title="Nieuwe afspraak" (close)="closeNewItemModal()" *ngIf="showNewItem">
|
||||
<app-new-item [appointments]="appointments" [appointmentForm]="appointmentForm"
|
||||
(appointmentAddedEvent)="registerAppointment($event)"></app-new-item>
|
||||
</app-modal>
|
||||
|
||||
@@ -11,20 +11,21 @@ import {
|
||||
TuiTextareaModule,
|
||||
TuiTextfieldControllerModule
|
||||
} from '@taiga-ui/legacy';
|
||||
import {TuiDay, TuiTime} from '@taiga-ui/cdk';
|
||||
import {TuiDay, TuiMonth, TuiTime} from '@taiga-ui/cdk';
|
||||
import {AppointmentService} from '../../services/appointment.service';
|
||||
import {DetailsComponent} from '../../components/details/details.component';
|
||||
import {DateFormatter} from '../../utils/date-formatter';
|
||||
import {WeekDay} from '../../models/week-day';
|
||||
import {NewItemComponent} from '../../components/new-item/new-item.component';
|
||||
import {timeAfterStartValidator} from '../../models/validators/time-after-start-validator';
|
||||
import {TuiChevron} from '@taiga-ui/kit';
|
||||
|
||||
@Component({
|
||||
selector: 'app-agenda',
|
||||
imports: [NgFor,
|
||||
TuiButton, CommonModule, NgIf, ModalComponent, ReactiveFormsModule,
|
||||
TuiInputTimeModule, TuiTextfieldControllerModule,
|
||||
TuiInputModule, TuiTextareaModule, TuiInputDateModule, TuiIcon, DetailsComponent, TuiCalendar, NewItemComponent],
|
||||
TuiInputModule, TuiTextareaModule, TuiInputDateModule, TuiIcon, DetailsComponent, TuiCalendar, NewItemComponent, TuiChevron],
|
||||
templateUrl: './agenda.component.html',
|
||||
providers: [tuiDateFormatProvider({separator: '-'}), AppointmentService],
|
||||
styleUrl: './agenda.component.scss'
|
||||
@@ -40,13 +41,14 @@ export class AgendaComponent implements OnInit {
|
||||
|
||||
timeSlots: number[] = Array.from({length: 24}, (_, i) => i); // 24 uren
|
||||
appointments: Appointment[] = [];
|
||||
isModalOpen = false
|
||||
showNewItem = false
|
||||
today = new Date()
|
||||
selectedDate = new Date()
|
||||
waiting: boolean = false;
|
||||
selectedAppointment: Appointment;
|
||||
protected value: TuiDay | null = null;
|
||||
showCalendar: boolean = false;
|
||||
open = false
|
||||
|
||||
private readonly alerts = inject(TuiAlertService);
|
||||
protected appointmentForm = new FormGroup({
|
||||
@@ -60,7 +62,7 @@ export class AgendaComponent implements OnInit {
|
||||
registerAppointment(title: string): void {
|
||||
this.getAppointmentsByDate(this.selectedDate);
|
||||
this.waiting = false
|
||||
this.isModalOpen = false
|
||||
this.showNewItem = false
|
||||
this.showNotification(title)
|
||||
this.resetForms()
|
||||
}
|
||||
@@ -187,7 +189,7 @@ export class AgendaComponent implements OnInit {
|
||||
}
|
||||
|
||||
closeNewItemModal() {
|
||||
this.isModalOpen = false
|
||||
this.showNewItem = false
|
||||
this.resetForms()
|
||||
}
|
||||
|
||||
@@ -202,5 +204,35 @@ export class AgendaComponent implements OnInit {
|
||||
appointmentIsEdited($event: Appointment) {
|
||||
this.getAppointmentsByDate(this.selectedDate);
|
||||
}
|
||||
|
||||
protected firstMonth = TuiMonth.currentLocal().append({month: -1});
|
||||
|
||||
protected middleMonth = TuiMonth.currentLocal();
|
||||
|
||||
protected lastMonth = TuiMonth.currentLocal().append({month: 2});
|
||||
|
||||
protected hoveredItem: TuiDay | null = null;
|
||||
|
||||
protected onMonthChangeFirst(month: TuiMonth): void {
|
||||
this.firstMonth = month.append({month: -1});
|
||||
this.middleMonth = month
|
||||
this.lastMonth = month.append({month: 2});
|
||||
}
|
||||
|
||||
protected onMonthChangeMiddle(month: TuiMonth): void {
|
||||
this.firstMonth = month.append({month: -1});
|
||||
this.middleMonth = month;
|
||||
this.lastMonth = month.append({month: 1});
|
||||
}
|
||||
|
||||
protected onMonthChangeLast(month: TuiMonth): void {
|
||||
this.firstMonth = month.append({month: -2});
|
||||
this.middleMonth = month.append({month: -1});
|
||||
this.lastMonth = month;
|
||||
}
|
||||
|
||||
openSettings() {
|
||||
this.open = !this.open
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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