feat: Add max slot count to event type entity, migration, and admin form.

This commit is contained in:
Schneider Roland
2026-01-02 13:11:26 +01:00
parent df35b8991d
commit be029ee054
5 changed files with 48 additions and 19 deletions

View File

@@ -10,15 +10,22 @@
<form [formGroup]="form" (ngSubmit)="onSubmit()" class="space-y-4 mt-4">
<div class="form-control"><label class="label"><span class="label-text">Esemény típus neve</span></label>
<input type="text" formControlName="name" class="input input-bordered w-full" /></div>
<div class="form-control"><label class="label"><span class="label-text">Esemény típus neve</span></label>
<input type="text" formControlName="name" class="input input-bordered w-full" />
</div>
<div class="form-control"><label class="label"><span class="label-text">Leírás</span></label>
<input type="text" formControlName="description" class="input input-bordered w-full" /></div>
<div class="form-control"><label class="label"><span class="label-text">Leírás</span></label>
<input type="text" formControlName="description" class="input input-bordered w-full" />
</div>
<div class="form-control"><label class="label"><span class="label-text">Szín</span></label>
<input type="color" formControlName="color" class="input input-bordered w-full" colorspace="display-p3"
alpha /></div>
<div class="form-control"><label class="label"><span class="label-text">Szín</span></label>
<input type="color" formControlName="color" class="input input-bordered w-full" colorspace="display-p3"
alpha />
</div>
<div class="form-control"><label class="label"><span class="label-text">Maximális slot szám</span></label>
<input type="number" formControlName="max_slot_count" class="input input-bordered w-full" />
</div>
<div class="card-actions justify-end mt-6">
<a routerLink="/event-type" class="btn btn-ghost">Cancel</a>
@@ -29,4 +36,4 @@
</form>
</div>
</div>
</div>
</div>

View File

@@ -33,7 +33,7 @@ export class EventTypeFormComponent implements OnInit {
isEditMode = false;
id: number | null = null;
private numericFields = [];
private numericFields = ['max_slot_count'];
constructor(
private fb: FormBuilder,
@@ -43,9 +43,10 @@ export class EventTypeFormComponent implements OnInit {
private cdr: ChangeDetectorRef
) {
this.form = this.fb.group({
name: [null],
description: [null],
color: [null]
name: [null],
description: [null],
color: [null],
max_slot_count: [null]
});
}
@@ -89,15 +90,15 @@ export class EventTypeFormComponent implements OnInit {
const payload = { ...this.form.value };
for (const field of this.numericFields) {
if (payload[field] != null && payload[field] !== '') {
payload[field] = parseFloat(payload[field]);
}
}
for (const field of this.numericFields) {
if (payload[field] != null && payload[field] !== '') {
payload[field] = parseFloat(payload[field]);
}
}
let action$: Observable<EventType>;
if (this.isEditMode && this.id) {
if (this.isEditMode && this.id) {
action$ = this.eventTypeService.update(this.id, payload);
} else {
action$ = this.eventTypeService.create(payload);

View File

@@ -6,6 +6,7 @@ export interface EventType {
name: string;
description: string;
color: string;
max_slot_count?: number;
}
export interface PaginatedResponse<T> {