34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { Component, inject, input, signal } from '@angular/core';
|
|
import { CalendarEventDto } from '../../../models/events-in-range-dto.model';
|
|
import { CreateEventForm, ReadyType } from '../../create-event-form/create-event-form';
|
|
import { EventBusService } from '../../../../../services/event-bus.service';
|
|
import { EventType } from '../../../../../../types';
|
|
|
|
@Component({
|
|
selector: 'app-single-event-dashboard-event-edit',
|
|
imports: [
|
|
CreateEventForm,
|
|
],
|
|
templateUrl: './single-event-dashboard-event-edit.html',
|
|
styleUrl: './single-event-dashboard-event-edit.css',
|
|
})
|
|
export class SingleEventDashboardEventEdit {
|
|
|
|
eventBus = inject(EventBusService);
|
|
selectedDate = signal<Date | undefined>(undefined);
|
|
event = input<CalendarEventDto>();
|
|
|
|
/**
|
|
* proxy to ready event from form to parent
|
|
*/
|
|
protected triggerAction(action: ReadyType) {
|
|
if (action == 'save-event-success') {
|
|
this.eventBus.emit(EventType.CALENDAR_VIEW_EVENT_SAVED, '');
|
|
} else if (action == 'save-event-failed') {
|
|
this.eventBus.emit(EventType.CALENDAR_VIEW_DIALOG_CLOSED, '');
|
|
} else {
|
|
this.eventBus.emit(EventType.CALENDAR_VIEW_EVENT_DASHBOARD, '');
|
|
}
|
|
}
|
|
}
|