-
+
{{ appointment.title }}
- Notities
+ Notities
-
+
diff --git a/src/app/pages/agenda/agenda.component.ts b/src/app/pages/agenda/agenda.component.ts
index 7fdd6d8..c9ce8f5 100644
--- a/src/app/pages/agenda/agenda.component.ts
+++ b/src/app/pages/agenda/agenda.component.ts
@@ -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
+ }
}
diff --git a/src/app/pages/home/home.component.html b/src/app/pages/home/home.component.html
index 11fe3a4..5aaded3 100644
--- a/src/app/pages/home/home.component.html
+++ b/src/app/pages/home/home.component.html
@@ -19,24 +19,27 @@
[tuiObscuredEnabled]="open"
(click)="onClick()"
(tuiActiveZoneChange)="onActiveZone($event)"
- (tuiObscured)="onObscured($event)"
- >
+ (tuiObscured)="onObscured($event)">
-
-
-
{{ fullName }}
-
- Uitloggen
-
-
-
+
+
+
+
+
+
{{ fullName }}
+ {{ currentCompany.name }}
+
+
+ Uitloggen
+
+
+
diff --git a/src/app/pages/home/home.component.scss b/src/app/pages/home/home.component.scss
index 3b716e6..2ca785c 100644
--- a/src/app/pages/home/home.component.scss
+++ b/src/app/pages/home/home.component.scss
@@ -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;
}
diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts
index f4aa5e1..1d74e02 100644
--- a/src/app/pages/home/home.component.ts
+++ b/src/app/pages/home/home.component.ts
@@ -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;
}
diff --git a/src/app/services/appointment.service.ts b/src/app/services/appointment.service.ts
index e1cd15c..e917452 100644
--- a/src/app/services/appointment.service.ts
+++ b/src/app/services/appointment.service.ts
@@ -2,6 +2,7 @@ import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Appointment} from '../models/appointment';
import {environment} from '../../environments/environment';
+import {AuthService} from './auth.service';
@Injectable({
providedIn: 'root',
@@ -9,7 +10,7 @@ import {environment} from '../../environments/environment';
export class AppointmentService {
baseApi = `${environment.baseApi}/appointments`;
- constructor(private http: HttpClient) {
+ constructor(private http: HttpClient, private authService: AuthService) {
}
getAllAppointments() {
@@ -24,7 +25,8 @@ export class AppointmentService {
}
addAppointment(appointment: Appointment) {
- return this.http.post(`${this.baseApi}`, appointment);
+ let companyId = this.authService.getCurrentCompany().id
+ return this.http.post(`${this.baseApi}/${companyId}`, appointment);
}
deleteAppointment(appointment: Appointment) {
diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts
index dd88fed..f76a255 100644
--- a/src/app/services/auth.service.ts
+++ b/src/app/services/auth.service.ts
@@ -4,6 +4,7 @@ import {JwtHelperService} from '@auth0/angular-jwt';
import {Observable} from 'rxjs';
import {jwtDecode} from 'jwt-decode';
import {environment} from '../../environments/environment';
+import {Company} from '../models/company';
@Injectable({
providedIn: 'root',
@@ -11,6 +12,7 @@ import {environment} from '../../environments/environment';
export class AuthService {
baseApi = `${environment.baseApi}/auth/login`;
jwtHelper = new JwtHelperService();
+ currentCompany: Company;
constructor(private http: HttpClient) {
}
@@ -39,5 +41,15 @@ export class AuthService {
}
return null;
}
+
+ setCurrentCompany(company: Company): void {
+ this.currentCompany = company;
+ console.log(this.currentCompany);
+ }
+
+ getCurrentCompany(): Company {
+ console.log(this.currentCompany);
+ return this.currentCompany;
+ }
}
diff --git a/src/app/services/company.service.ts b/src/app/services/company.service.ts
new file mode 100644
index 0000000..30f6603
--- /dev/null
+++ b/src/app/services/company.service.ts
@@ -0,0 +1,19 @@
+import {Injectable} from '@angular/core';
+import {HttpClient} from '@angular/common/http';
+import {Observable} from 'rxjs';
+import {environment} from '../../environments/environment';
+import {Company} from '../models/company';
+
+@Injectable({
+ providedIn: 'root',
+})
+export class CompanyService {
+ baseApi = `${environment.baseApi}/company`;
+
+ constructor(private http: HttpClient) {
+ }
+
+ getCompanies(): Observable
{
+ return this.http.get(`${this.baseApi}`);
+ }
+}