add event-cancel dialog

This commit is contained in:
Schneider Roland 2025-11-29 20:10:28 +01:00
parent 9d6e5bb7a3
commit a043d64229
9 changed files with 113 additions and 38 deletions

View File

@ -27,6 +27,9 @@ import { CommonModule, JsonPipe, NgComponentOutlet } from '@angular/common';
import { import {
SingleEventDashboardEventDelete SingleEventDashboardEventDelete
} from './single-event-dashboard-event-delete/single-event-dashboard-event-delete'; } from './single-event-dashboard-event-delete/single-event-dashboard-event-delete';
import {
SingleEventDashboardEventCancel
} from './single-event-dashboard-event-cancel/single-event-dashboard-event-cancel';
@Component({ @Component({
selector: 'app-calendar-view', selector: 'app-calendar-view',
@ -101,6 +104,22 @@ export class CalendarView implements OnInit, AfterViewInit {
}, },
componentOutputs: () => injector componentOutputs: () => injector
},
{
component: SingleEventDashboardEventCancel,
isRendered: () => this.workflow() == 'event-cancel',
// isRendered: () => true,
closeClick: () => this.closeDialog(),
modalBoxStyleClass: 'max-w-none w-2xl',
componentInputs: () => {
return {
'event': this.selectedEvent(),
'onAction': this.handleAction
}
},
componentOutputs: () => injector
} }
] ]
} }
@ -188,6 +207,10 @@ export class CalendarView implements OnInit, AfterViewInit {
this.workflow.set('event-delete'); this.workflow.set('event-delete');
break; break;
case 'event_cancel':
console.info("event cancel clicked");
this.workflow.set('event-cancel');
break;
} }
} }

View File

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SingleEventDashboarEventDetailsView } from './single-event-dashboar-event-details-view';
describe('SingleEventDashboarEventDetailsView', () => {
let component: SingleEventDashboarEventDetailsView;
let fixture: ComponentFixture<SingleEventDashboarEventDetailsView>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SingleEventDashboarEventDetailsView]
})
.compileComponents();
fixture = TestBed.createComponent(SingleEventDashboarEventDetailsView);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,11 +0,0 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-single-event-dashboar-event-details-view',
imports: [],
templateUrl: './single-event-dashboar-event-details-view.html',
styleUrl: './single-event-dashboar-event-details-view.css',
})
export class SingleEventDashboarEventDetailsView {
}

View File

@ -1 +1,12 @@
<p>single-event-dashboard-event-cancel works!</p> <h2 class="text-2xl">Esemény lemondása</h2>
<app-single-event-dashboard-event-details-view [event]="event()"></app-single-event-dashboard-event-details-view>
<div class="flex gap-2 mt-3">
<rs-daisy-button variant="error">
<span [outerHTML]="SvgIcons.heroTrash | safeHtml"></span>
Törlés
</rs-daisy-button>
<rs-daisy-button variant="primary" (click)="triggerAction()">
<span [outerHTML]="SvgIcons.heroXcircle | safeHtml"></span>
Mégsem
</rs-daisy-button>
</div>

View File

@ -1,11 +1,31 @@
import { Component } from '@angular/core'; import { Component, input } from '@angular/core';
import { CalendarEventDto } from '../../../models/events-in-range-dto.model';
import {
SingleEventDashboardEventDetailsView
} from '../single-event-dashboard-event-details-view/single-event-dashboard-event-details-view';
import { Button } from '@rschneider/ng-daisyui';
import { SvgIcons } from '../../../../../svg-icons';
import { SafeHtmlPipe } from '../../../../../pipes/safe-html-pipe';
@Component({ @Component({
selector: 'app-single-event-dashboard-event-cancel', selector: 'app-single-event-dashboard-event-cancel',
imports: [], imports: [
SingleEventDashboardEventDetailsView,
Button,
SafeHtmlPipe,
],
templateUrl: './single-event-dashboard-event-cancel.html', templateUrl: './single-event-dashboard-event-cancel.html',
styleUrl: './single-event-dashboard-event-cancel.css', styleUrl: './single-event-dashboard-event-cancel.css',
}) })
export class SingleEventDashboardEventCancel { export class SingleEventDashboardEventCancel {
event = input<CalendarEventDto>();
onAction = input.required<(msg: string) => void>();
protected readonly SvgIcons = SvgIcons;
protected triggerAction() {
this.onAction()('close')
}
} }

View File

@ -0,0 +1,5 @@
@if (config) {
<app-detail-view
[config]="config"
></app-detail-view>
}

View File

@ -0,0 +1,51 @@
import { Component, effect, input } from '@angular/core';
import { CalendarEventDto } from '../../../models/events-in-range-dto.model';
import { DetailView, DetailViewConfig } from '../../../../../components/detail-view/detail-view';
import { SafeHtmlPipe } from '../../../../../pipes/safe-html-pipe';
@Component({
selector: 'app-single-event-dashboard-event-details-view',
imports: [
DetailView,
SafeHtmlPipe,
],
templateUrl: './single-event-dashboard-event-details-view.html',
styleUrl: './single-event-dashboard-event-details-view.css',
})
export class SingleEventDashboardEventDetailsView {
event = input<CalendarEventDto>();
config: DetailViewConfig<CalendarEventDto> | undefined;
constructor() {
effect(() => {
this.config = {
data: this.event()!,
rows: [{
attribute: 'id',
getTitle: 'Esemény azonosító',
},
{
attribute: 'title',
getTitle: 'Esemény neve',
},
{
attribute: 'startTime',
getTitle: 'Kezdési időpont',
format: 'datetime',
},
{
attribute: 'eventType',
getTitle: 'Esemény típusa',
getValue: obj => obj.eventType.name,
},
],
};
});
}
}