small improvements:

- add colorview component
 - improve generic action column
 - improve generic table
 - improve event-type-table.component.ts
 - add headerText to admin layout
This commit is contained in:
Schneider Roland
2025-11-21 21:14:00 +01:00
parent b047ecc589
commit 008b644bb1
14 changed files with 116 additions and 23 deletions

View File

@@ -3,9 +3,9 @@
<!-- Generated by the CLI -->
<div class="p-4 md:p-8 space-y-6">
<div class="flex justify-between items-center">
<h1 class="text-3xl font-bold">EventTypes (Generic Table)</h1>
<h1 class="text-3xl font-bold">Esemény típusok</h1>
<a routerLink="/event-type/new" class="btn btn-primary">Create New</a>
</div>
<app-generic-table [config]="tableConfig"></app-generic-table>
</div>
</div>

View File

@@ -15,6 +15,7 @@ import {
import { EventTypeService } from '../../services/event-type.service';
import { BehaviorSubject } from 'rxjs';
import { SvgIcons } from '../../../../svg-icons';
import { ColorView } from '../../../../components/color-view/color-view';
@Component({
selector: 'app-event-type-table',
@@ -60,42 +61,52 @@ export class EventTypeTableComponent implements OnInit {
{
attribute: 'name',
headerCell: true,
valueCell: true,
valueCell: {
styleClass: ctx => 'w-[1%]',
value: item => item?.name,
},
},
{
attribute: 'description',
headerCell: true,
valueCell: {
styleClass: ctx => 'w-auto',
value: item => item?.description,
},
},
{
attribute: 'color',
headerCell: true,
valueCell: true,
valueCell: {
styleClass: ctx => 'w-[1%]',
value: item => item?.color,
component: ColorView,
componentInputs: item => {
return { color: item?.color };
}
},
},
{
attribute: 'actions',
headerCell: { value: 'Actions' },
valueCell: {
styleClass: ctx => 'w-[1%]',
component: GenericActionColumn,
componentInputs: item => ({
item: item,
actions: [
{ action: 'view', text: false, handler: actionHandler, svgIcon: SvgIcons.heroDocument },
{ action: 'view', title: 'Részletek', text: false, handler: actionHandler, svgIcon: SvgIcons.heroDocument },
{
action: 'edit', text: false,
action: 'edit', title: 'Szerkesztés', text: false,
svgIcon: SvgIcons.heroCog6Tooth,
handler: actionHandler,
},
{ action: 'delete', text: false, handler: actionHandler, svgIcon: SvgIcons.heroTrash },
{ action: 'delete', title: 'Törlés', text: false, handler: actionHandler, svgIcon: SvgIcons.heroTrash },
] as ActionDefinition<EventType>[],
}),
},
},
] as ColumnDefinition<EventType>[],
tableCssClass: 'event-type-table-container',
tableCssClass: 'event-type-table-container w-full',
};
}