create booking

This commit is contained in:
Schneider Roland
2025-12-14 22:11:42 +01:00
parent e86b356baf
commit 056b9f6c80
35 changed files with 2496 additions and 14 deletions

View File

@@ -1,12 +1,12 @@
import { Component, inject, input } from '@angular/core';
import { CalendarEventDto } from '../../../models/events-in-range-dto.model';
import { EventBusService } from '../../../../../services/event-bus.service';
import { CalendarService, CalendarCreateBookingDto } from '../../../../../../api';
import { FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
import { EventType } from '../../../../../../types';
import {
SingleEventDashboardEventDetailsView
} from '../single-event-dashboard-event-details-view/single-event-dashboard-event-details-view';
import { CalendarService } from '../../../services/calendar.service';
@Component({
selector: 'app-single-event-booking-create',
@@ -22,7 +22,7 @@ export class SingleEventBookingCreate {
calendarService = inject(CalendarService);
eventBus = inject(EventBusService);
fb = inject(FormBuilder);
event = input<CalendarEventDto>();
event = input.required<CalendarEventDto>();
form: FormGroup;
constructor() {
@@ -33,8 +33,20 @@ export class SingleEventBookingCreate {
}
protected onSubmit() {
// this.calendarService.b
this.eventBus.emit(EventType.CALENDAR_VIEW_EVENT_SAVED,'');
const formValue = this.form.value;
console.log(formValue);
return this.calendarService.calendarControllerCreateBooking(this.event().id!,{
notes: formValue.notes,
reservedSeatsCount: formValue.slotCount,
occurrenceStartTime: new Date(this.event()?.startTime!)
}as CalendarCreateBookingDto)
.subscribe(
{
next: _ => {
this.eventBus.emit(EventType.CALENDAR_VIEW_EVENT_SAVED,'');
}
}
)
}