add calendar dashboard edit

This commit is contained in:
Schneider Roland 2025-12-04 07:07:43 +01:00
parent f740c11685
commit cacc04a217
6 changed files with 19 additions and 10 deletions

View File

@ -206,6 +206,9 @@ export class CalendarView {
console.log('Parent received:', msg);
if (msg == 'close') {
this.closeDialog();
} else if ( msg == 'save-event-success'){
this.closeDialog();
this.calendarComponent?.getApi().refetchEvents();
}
};

View File

@ -1,3 +1,3 @@
<app-create-event-form (ready)="onAction()" [date]="selectedDate()"
<app-create-event-form (ready)="triggerAction($event)" [date]="selectedDate()"
[id]="event()?.id"></app-create-event-form>

View File

@ -21,8 +21,10 @@ export class SingleEventDashboardEventEdit {
protected readonly SvgIcons = SvgIcons;
protected triggerAction() {
this.onAction()('close')
/**
* proxy to ready event from form to parent
*/
protected triggerAction(action: string) {
this.onAction()(action)
}
}

View File

@ -18,7 +18,6 @@
(onAction)="onCardAction(card.action)"
></app-single-event-dashboard-card>
<!-- [customClasses]="'flex-[50_1_0] w-50' "-->
}
</div>

View File

@ -106,7 +106,7 @@
}
<div class="card-actions justify-end mt-6">
<a routerLink="/events" class="btn btn-ghost" (click)="doReady()">Mégse</a>
<a class="btn btn-ghost" (click)="doReady()">Mégse</a>
<button type="submit" class="btn btn-primary" [disabled]="form.invalid">
{{ isEditMode ? 'Mentés' : 'Létrezhozás' }}
</button>

View File

@ -28,7 +28,7 @@ export type FrequencyOption = {
export class CreateEventForm implements OnInit {
form: FormGroup;
isEditMode = false;
ready = output<void>();
ready = output<string>();
id = input<number | undefined>();
date = input<Date | undefined>();
eventTypes = signal<EventType[]>([]);
@ -248,8 +248,13 @@ export class CreateEventForm implements OnInit {
}
action$.subscribe({
next: () => this.router.navigate(['/calendar']),
error: (err) => console.error('Failed to save event', err),
next: () => {
this.ready.emit('save-event-success');
},
error: (err) =>{
console.error('Failed to save event', err);
this.ready.emit('save-event-failed');
}
});
}
@ -306,6 +311,6 @@ export class CreateEventForm implements OnInit {
}
doReady() {
this.ready.emit();
this.ready.emit('close');
}
}