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);
|
console.log('Parent received:', msg);
|
||||||
if (msg == 'close') {
|
if (msg == 'close') {
|
||||||
this.closeDialog();
|
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>
|
[id]="event()?.id"></app-create-event-form>
|
||||||
|
|||||||
@ -21,8 +21,10 @@ export class SingleEventDashboardEventEdit {
|
|||||||
|
|
||||||
protected readonly SvgIcons = SvgIcons;
|
protected readonly SvgIcons = SvgIcons;
|
||||||
|
|
||||||
protected triggerAction() {
|
/**
|
||||||
|
* proxy to ready event from form to parent
|
||||||
this.onAction()('close')
|
*/
|
||||||
|
protected triggerAction(action: string) {
|
||||||
|
this.onAction()(action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
(onAction)="onCardAction(card.action)"
|
(onAction)="onCardAction(card.action)"
|
||||||
|
|
||||||
></app-single-event-dashboard-card>
|
></app-single-event-dashboard-card>
|
||||||
<!-- [customClasses]="'flex-[50_1_0] w-50' "-->
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -106,7 +106,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<div class="card-actions justify-end mt-6">
|
<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">
|
<button type="submit" class="btn btn-primary" [disabled]="form.invalid">
|
||||||
{{ isEditMode ? 'Mentés' : 'Létrezhozás' }}
|
{{ isEditMode ? 'Mentés' : 'Létrezhozás' }}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export type FrequencyOption = {
|
|||||||
export class CreateEventForm implements OnInit {
|
export class CreateEventForm implements OnInit {
|
||||||
form: FormGroup;
|
form: FormGroup;
|
||||||
isEditMode = false;
|
isEditMode = false;
|
||||||
ready = output<void>();
|
ready = output<string>();
|
||||||
id = input<number | undefined>();
|
id = input<number | undefined>();
|
||||||
date = input<Date | undefined>();
|
date = input<Date | undefined>();
|
||||||
eventTypes = signal<EventType[]>([]);
|
eventTypes = signal<EventType[]>([]);
|
||||||
@ -248,8 +248,13 @@ export class CreateEventForm implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
action$.subscribe({
|
action$.subscribe({
|
||||||
next: () => this.router.navigate(['/calendar']),
|
next: () => {
|
||||||
error: (err) => console.error('Failed to save event', err),
|
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() {
|
doReady() {
|
||||||
this.ready.emit();
|
this.ready.emit('close');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user