add calendar dashboard edit
This commit is contained in:
parent
f740c11685
commit
cacc04a217
@ -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();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
(onAction)="onCardAction(card.action)"
|
||||
|
||||
></app-single-event-dashboard-card>
|
||||
<!-- [customClasses]="'flex-[50_1_0] w-50' "-->
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user