improve exception saving
This commit is contained in:
@@ -57,7 +57,7 @@ export class SingleEventDashboardEventActivation {
|
||||
this.calendarService.applyException(eventId, payload ).subscribe(
|
||||
{
|
||||
next: () => {
|
||||
this.onAction()('close');
|
||||
this.onAction()('save-event-success');
|
||||
},
|
||||
error: err => {
|
||||
alert('Failed to change event');
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
}
|
||||
|
||||
<div class="flex gap-2 mt-3">
|
||||
<rs-daisy-button variant="error">
|
||||
<rs-daisy-button variant="error" (click)="doDelete()">
|
||||
<span [outerHTML]="SvgIcons.heroTrash | safeHtml"></span>
|
||||
Törlés
|
||||
</rs-daisy-button>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Component, effect, input, output } from '@angular/core';
|
||||
import { Component, effect, inject, input, output } from '@angular/core';
|
||||
import { CalendarEventDto } from '../../../models/events-in-range-dto.model';
|
||||
import { DetailView, DetailViewConfig } from '../../../../../components/detail-view/detail-view';
|
||||
import { SvgIcons } from '../../../../../svg-icons';
|
||||
import { SafeHtmlPipe } from '../../../../../pipes/safe-html-pipe';
|
||||
import { Button } from '@rschneider/ng-daisyui';
|
||||
import { CalendarService } from '../../../services/calendar.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-single-event-dashboard-event-delete',
|
||||
@@ -18,6 +19,7 @@ import { Button } from '@rschneider/ng-daisyui';
|
||||
})
|
||||
export class SingleEventDashboardEventDelete {
|
||||
|
||||
calendarService = inject(CalendarService);
|
||||
event = input<CalendarEventDto>();
|
||||
// Define an input that expects a function
|
||||
onAction = input.required<(msg: string) => void>();
|
||||
@@ -59,6 +61,16 @@ export class SingleEventDashboardEventDelete {
|
||||
this.onAction()('close');
|
||||
}
|
||||
|
||||
doDelete() {
|
||||
this.calendarService.deleteEvent(this.event()!.id).subscribe(
|
||||
{
|
||||
next: ( ) => {
|
||||
this.onAction()('save-event-success');
|
||||
}
|
||||
}
|
||||
)
|
||||
// Call the function passed from the parent
|
||||
}
|
||||
|
||||
protected readonly SvgIcons = SvgIcons;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ export class SingleEventDashboardEventEdit {
|
||||
* proxy to ready event from form to parent
|
||||
*/
|
||||
protected triggerAction(action: string) {
|
||||
console.info("event details dashboard", action)
|
||||
this.onAction()(action)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user