This commit is contained in:
2024-11-05 20:03:49 +01:00
parent c2bf40c1a4
commit 40d0459de7
6 changed files with 28 additions and 7 deletions
@@ -39,11 +39,11 @@ public class Event implements Serializable {
@Column(name = "cost", precision = 21, scale = 2) @Column(name = "cost", precision = 21, scale = 2)
private BigDecimal cost; private BigDecimal cost;
@Lob // @Lob
@Column(name = "comment") @Column(name = "comment")
private String comment; private String comment;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "event") @OneToMany(fetch = FetchType.EAGER, mappedBy = "event")
@JsonIgnoreProperties(value = { "user", "event" }, allowSetters = true) @JsonIgnoreProperties(value = { "user", "event" }, allowSetters = true)
private Set<Registration> registrations = new HashSet<>(); private Set<Registration> registrations = new HashSet<>();
@@ -33,7 +33,7 @@ public class Registration implements Serializable {
@Column(name = "player_name") @Column(name = "player_name")
private String playerName; private String playerName;
@Lob // @Lob
@Column(name = "comment") @Column(name = "comment")
private String comment; private String comment;
@@ -35,6 +35,21 @@
<span>{{ event.comment }}</span> <span>{{ event.comment }}</span>
</dd> </dd>
</dl> </dl>
<!-- Dodajemy sekcję dla rejestracji -->
<h3>Rejestracje</h3>
<ul>
<li v-for="registration in event.registrations" :key="registration.id">
{{ registration.playerName }}
<!-- lub inne pola, które chcesz pokazać -->
</li>
</ul>
<router-link :to="{ name: 'RegistrationCreateForEvent', params: { eventId: event.id } }" custom v-slot="{ navigate }">
<button @click="navigate" class="btn btn-primary">
<font-awesome-icon icon="plus"></font-awesome-icon>&nbsp;<span>Dodaj Rejestrację</span>
</button>
</router-link>
<button type="submit" @click.prevent="previousState()" class="btn btn-info" data-cy="entityDetailsBackButton"> <button type="submit" @click.prevent="previousState()" class="btn btn-info" data-cy="entityDetailsBackButton">
<font-awesome-icon icon="arrow-left"></font-awesome-icon>&nbsp;<span>Back</span> <font-awesome-icon icon="arrow-left"></font-awesome-icon>&nbsp;<span>Back</span>
</button> </button>
@@ -84,11 +84,12 @@
<div class="form-group"> <div class="form-group">
<label class="form-control-label" for="registration-event">Event</label> <label class="form-control-label" for="registration-event">Event</label>
<select class="form-control" id="registration-event" data-cy="event" name="event" v-model="registration.event"> <select class="form-control" id="registration-event" data-cy="event" name="event" v-model="registration.event">
<option :value="null"></option> <option :value="null">Please select an event</option>
<option <option
:value="registration.event && eventOption.id === registration.event.id ? registration.event : eventOption" :value="eventOption.id === eventId ? eventOption : registration.event"
v-for="eventOption in events" v-for="eventOption in events"
:key="eventOption.id" :key="eventOption.id"
:selected="eventOption.id === eventId"
> >
{{ eventOption.name }} {{ eventOption.name }}
</option> </option>
+3 -2
View File
@@ -76,10 +76,11 @@ export default {
meta: { authorities: [Authority.USER] }, meta: { authorities: [Authority.USER] },
}, },
{ {
path: 'registration/new', path: 'registration/new/:eventId?',
name: 'RegistrationCreate', name: 'RegistrationCreateForEvent',
component: RegistrationUpdate, component: RegistrationUpdate,
meta: { authorities: [Authority.USER] }, meta: { authorities: [Authority.USER] },
props: true,
}, },
{ {
path: 'registration/:registrationId/edit', path: 'registration/:registrationId/edit',
@@ -1,3 +1,5 @@
import type { IRegistration } from '@/shared/model/registration.model';
export interface IEvent { export interface IEvent {
id?: number; id?: number;
name?: string; name?: string;
@@ -5,6 +7,7 @@ export interface IEvent {
playersLimit?: number | null; playersLimit?: number | null;
cost?: number | null; cost?: number | null;
comment?: string | null; comment?: string | null;
registrations?: IRegistration[];
} }
export class Event implements IEvent { export class Event implements IEvent {
@@ -15,5 +18,6 @@ export class Event implements IEvent {
public playersLimit?: number | null, public playersLimit?: number | null,
public cost?: number | null, public cost?: number | null,
public comment?: string | null, public comment?: string | null,
public registrations?: IRegistration[],
) {} ) {}
} }