fix betreft afspraken
All checks were successful
Docker Image CI / build-and-push (push) Successful in 1m4s
Docker Image CI / deploy (push) Successful in 30s
Docker Image CI / notify-failure (push) Has been skipped

This commit is contained in:
2025-04-18 23:30:16 +02:00
parent 781723fddf
commit 524aa879de
9 changed files with 50 additions and 33 deletions

View File

@@ -1,7 +1,6 @@
import {Component, inject, OnInit} from '@angular/core';
import {CommonModule, NgFor, NgIf} from '@angular/common';
import {TuiAlertService, TuiButton, TuiCalendar, tuiDateFormatProvider, TuiIcon} from '@taiga-ui/core';
import {Appointment} from '../../models/appointment';
import {ModalComponent} from '../../components/modal/modal.component';
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
import {
@@ -19,6 +18,7 @@ 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 {DropdownContentComponent} from '../../components/dropdown-content/dropdown-content.component';
import {AppointmentDto} from '../../models/appointment-dto';
@Component({
selector: 'app-agenda',
@@ -40,12 +40,12 @@ export class AgendaComponent implements OnInit {
}
timeSlots: number[] = Array.from({length: 24}, (_, i) => i); // 24 uren
appointments: Appointment[] = [];
appointments: AppointmentDto[] = [];
showNewItem = false
today = new Date()
selectedDate = new Date()
waiting: boolean = false;
selectedAppointment: Appointment;
selectedAppointment: AppointmentDto;
protected value: TuiDay | null = null;
showCalendar: boolean = false;
open = false
@@ -151,7 +151,7 @@ export class AgendaComponent implements OnInit {
})
}
getInlineStyles(appointment: Appointment): { [key: string]: string } {
getInlineStyles(appointment: AppointmentDto): { [key: string]: string } {
return {
'--duration': `${appointment.durationInMinutes}`,
'--start-minute': `${appointment.startMinute}`,
@@ -164,13 +164,13 @@ export class AgendaComponent implements OnInit {
return `${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`;
}
getAppointmentHeight(appointment: Appointment): number {
getAppointmentHeight(appointment: AppointmentDto): number {
const startInMinutes = (appointment.startHour * 60) + appointment.startMinute;
const endInMinutes = (appointment.endHour * 60) + appointment.endMinute;
return (endInMinutes - startInMinutes); // 50px per uur
}
selectAppointment(appointment: Appointment) {
selectAppointment(appointment: AppointmentDto) {
this.selectedAppointment = appointment;
}
@@ -193,7 +193,7 @@ export class AgendaComponent implements OnInit {
this.resetForms()
}
appointmentIsDeleted(appointment: Appointment) {
appointmentIsDeleted(appointment: AppointmentDto) {
this.selectedAppointment = undefined;
this.alerts
.open(`Afspraak <strong>${appointment.title}</strong> is verwijderd.`)
@@ -201,7 +201,7 @@ export class AgendaComponent implements OnInit {
this.getAppointmentsByDate(this.selectedDate);
}
appointmentIsEdited($event: Appointment) {
appointmentIsEdited($event: AppointmentDto) {
this.getAppointmentsByDate(this.selectedDate);
}

View File

@@ -28,7 +28,7 @@
<ng-template #dropdownContent>
<div class="dropdown">
<h3>{{ fullName }}</h3>
<h4>{{ currentCompany.name }}</h4>
<h4>{{ userService.currentCompany.name }}</h4>
<button
size="m"

View File

@@ -6,7 +6,6 @@ import {AuthService} from '../../services/auth.service';
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 {TuiSelectModule} from '@taiga-ui/legacy';
import {UserService} from '../../services/user.service';
import {AppUserDto, CompanyDTO} from '../../models/app-user-dto';
@@ -21,7 +20,6 @@ export class HomeComponent implements OnInit {
user: AppUserDto;
fullName: string
companies: CompanyDTO[];
currentCompany: CompanyDTO;
getInitials(): string {
this.user = this.userService.userValue
@@ -45,7 +43,7 @@ export class HomeComponent implements OnInit {
this.open = active && this.open;
}
constructor(private authService: AuthService, private router: Router, private userService: UserService) {
constructor(private authService: AuthService, private router: Router, protected userService: UserService) {
}
ngOnInit(): void {
@@ -53,7 +51,7 @@ export class HomeComponent implements OnInit {
this.router.navigate(['login']);
} else {
this.companies = this.userService.userValue.companies.map(a => a.company)
this.currentCompany = this.companies[0];
this.userService.currentCompany = this.companies[0];
}
}