po poprawkach
This commit is contained in:
@@ -44,7 +44,7 @@ public class Event implements Serializable {
|
|||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "event")
|
@OneToMany(fetch = FetchType.EAGER, mappedBy = "event")
|
||||||
@JsonIgnoreProperties(value = { "user", "event" }, allowSetters = true)
|
@JsonIgnoreProperties(value = { "event" }, allowSetters = true)
|
||||||
private Set<Registration> registrations = new HashSet<>();
|
private Set<Registration> registrations = new HashSet<>();
|
||||||
|
|
||||||
// jhipster-needle-entity-add-field - JHipster will add fields here
|
// jhipster-needle-entity-add-field - JHipster will add fields here
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class Registration implements Serializable {
|
|||||||
@Column(name = "comment")
|
@Column(name = "comment")
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.EAGER)
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
|||||||
@@ -21,13 +21,13 @@
|
|||||||
<b-nav-item to="/" exact>
|
<b-nav-item to="/" exact>
|
||||||
<span>
|
<span>
|
||||||
<font-awesome-icon icon="home" />
|
<font-awesome-icon icon="home" />
|
||||||
<span>Current Event</span>
|
<span>Aktualne wydarzenie</span>
|
||||||
</span>
|
</span>
|
||||||
</b-nav-item>
|
</b-nav-item>
|
||||||
<b-nav-item to="/event" exact>
|
<b-nav-item to="/event" exact>
|
||||||
<span>
|
<span>
|
||||||
<font-awesome-icon icon="th-list" />
|
<font-awesome-icon icon="th-list" />
|
||||||
<span>All Events</span>
|
<span>Wszystkie wydarzenia</span>
|
||||||
</span>
|
</span>
|
||||||
</b-nav-item>
|
</b-nav-item>
|
||||||
<!-- <b-nav-item-dropdown right id="entity-menu" v-if="authenticated" active-class="active" class="pointer" data-cy="entity">-->
|
<!-- <b-nav-item-dropdown right id="entity-menu" v-if="authenticated" active-class="active" class="pointer" data-cy="entity">-->
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import { type IEvent } from '@/shared/model/event.model';
|
|||||||
import { useAlertService } from '@/shared/alert/alert.service';
|
import { useAlertService } from '@/shared/alert/alert.service';
|
||||||
import { useDateFormat } from '@/shared/composables';
|
import { useDateFormat } from '@/shared/composables';
|
||||||
import type { IRegistration } from '@/shared/model/registration.model';
|
import type { IRegistration } from '@/shared/model/registration.model';
|
||||||
|
import RegistrationService from '@/entities/registration/registration.service';
|
||||||
|
import UserService from '@/entities/user/user.service';
|
||||||
|
import type AccountService from '@/account/account.service';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
compatConfig: { MODE: 3 },
|
compatConfig: { MODE: 3 },
|
||||||
@@ -17,6 +20,9 @@ export default defineComponent({
|
|||||||
const { formatDateShort } = useDateFormat();
|
const { formatDateShort } = useDateFormat();
|
||||||
const dataUtils = useDataUtils();
|
const dataUtils = useDataUtils();
|
||||||
|
|
||||||
|
const registrationService = inject('registrationService', () => new RegistrationService());
|
||||||
|
const accountService = inject<AccountService>('accountService');
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
@@ -54,15 +60,72 @@ export default defineComponent({
|
|||||||
return sortedAndIndexedRegistrations.value[index].active ? activeCount + 1 : '';
|
return sortedAndIndexedRegistrations.value[index].active ? activeCount + 1 : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const hasAnyAuthorityValues: Ref<any> = ref({});
|
||||||
|
const removeId: Ref<number> = ref(null);
|
||||||
|
const removeEntity = ref<any>(null);
|
||||||
|
const prepareRemove = (instance: IRegistration) => {
|
||||||
|
removeId.value = instance.id;
|
||||||
|
removeEntity.value.show();
|
||||||
|
};
|
||||||
|
const closeDialog = () => {
|
||||||
|
removeEntity.value.hide();
|
||||||
|
};
|
||||||
|
const removeRegistration = async () => {
|
||||||
|
try {
|
||||||
|
await registrationService().delete(removeId.value);
|
||||||
|
var eventId = removeEntity.value.id;
|
||||||
|
const message = `A Registration is deleted with identifier ${removeId.value}`;
|
||||||
|
alertService.showInfo(message, { variant: 'danger' });
|
||||||
|
removeId.value = null;
|
||||||
|
await retrieveEvent(event.value.id);
|
||||||
|
// console.log('asdfdsa' , event.value.id);
|
||||||
|
// const res = await eventService().find(eventId);
|
||||||
|
// event.value = res;
|
||||||
|
// sortedAndIndexedRegistrations.value = res.registrations;
|
||||||
|
// sortedAndIndexedRegistrations.value = res.registrations.sort(
|
||||||
|
// (a, b) => new Date(a.dateTime).getTime() - new Date(b.dateTime).getTime(),
|
||||||
|
// );
|
||||||
|
closeDialog();
|
||||||
|
} catch (error) {
|
||||||
|
alertService.showHttpError(error.response);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const userService = inject('userService', () => new UserService());
|
||||||
|
// const loggedUser: Ref<IUser> = ref(new User());
|
||||||
|
const currentUserId = ref('');
|
||||||
|
userService()
|
||||||
|
.fetchAccountDetails()
|
||||||
|
.then(account => {
|
||||||
|
currentUserId.value = `${account.id}`;
|
||||||
|
});
|
||||||
|
|
||||||
// console.log('asdfasdf', sortedAndIndexedRegistrations())
|
// console.log('asdfasdf', sortedAndIndexedRegistrations())
|
||||||
return {
|
return {
|
||||||
|
currentUserId,
|
||||||
alertService,
|
alertService,
|
||||||
|
hasAnyAuthorityValues,
|
||||||
|
accountService,
|
||||||
event,
|
event,
|
||||||
...dataUtils,
|
...dataUtils,
|
||||||
formatDateShort,
|
formatDateShort,
|
||||||
previousState,
|
previousState,
|
||||||
sortedAndIndexedRegistrations,
|
sortedAndIndexedRegistrations,
|
||||||
getRegistrationIndex,
|
getRegistrationIndex,
|
||||||
|
removeId,
|
||||||
|
removeEntity,
|
||||||
|
prepareRemove,
|
||||||
|
closeDialog,
|
||||||
|
removeRegistration,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
hasAnyAuthority(authorities: any): boolean {
|
||||||
|
this.accountService.hasAnyAuthorityAndCheckAuth(authorities).then(value => {
|
||||||
|
if (this.hasAnyAuthorityValues[authorities] !== value) {
|
||||||
|
this.hasAnyAuthorityValues = { ...this.hasAnyAuthorityValues, [authorities]: value };
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return this.hasAnyAuthorityValues[authorities] ?? false;
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,34 +2,34 @@
|
|||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<div v-if="event">
|
<div v-if="event">
|
||||||
<h2 class="jh-entity-heading" data-cy="eventDetailsHeading"><span>Event</span> {{ event.id }}</h2>
|
<!-- <h2 class="jh-entity-heading" data-cy="eventDetailsHeading"><span>Event</span> {{ event.id }}</h2>-->
|
||||||
<dl class="row jh-entity-details">
|
<dl class="row jh-entity-details">
|
||||||
<dt>
|
<dt>
|
||||||
<span>Name</span>
|
<span>Nazwa</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<span>{{ event.name }}</span>
|
<span>{{ event.name }}</span>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<span>Date</span>
|
<span>Data</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<span>{{ event.date }}</span>
|
<span>{{ event.date }}</span>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<span>Players Limit</span>
|
<span>Limit graczy</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<span>{{ event.playersLimit }}</span>
|
<span>{{ event.playersLimit }}</span>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<span>Cost</span>
|
<span>Koszt do podziału</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<span>{{ event.cost }}</span>
|
<span>{{ event.cost }}</span>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<span>Comment</span>
|
<span>Komentarz</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<span>{{ event.comment }}</span>
|
<span>{{ event.comment }}</span>
|
||||||
@@ -45,10 +45,10 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col"><span>#</span></th>
|
<th scope="col"><span>#</span></th>
|
||||||
<th scope="col"><span>Date Time</span></th>
|
<th scope="col"><span>Czas zapisu</span></th>
|
||||||
<th scope="col"><span>Player Name</span></th>
|
<th scope="col"><span>Gracz</span></th>
|
||||||
<th scope="col"><span>Comment</span></th>
|
<th scope="col"><span>Komentarz</span></th>
|
||||||
<th scope="col"><span>Active</span></th>
|
<!-- <th scope="col"><span>Active</span></th>-->
|
||||||
<th scope="col"></th>
|
<th scope="col"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -59,9 +59,22 @@
|
|||||||
{{ getRegistrationIndex(index) }}
|
{{ getRegistrationIndex(index) }}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ formatDateShort(registration.dateTime) || '' }}</td>
|
<td>{{ formatDateShort(registration.dateTime) || '' }}</td>
|
||||||
<td>{{ registration.playerName }}</td>
|
<td>
|
||||||
|
{{ registration.playerName }}
|
||||||
|
<b-button
|
||||||
|
@click="prepareRemove(registration)"
|
||||||
|
variant="danger"
|
||||||
|
class="btn btn-sm"
|
||||||
|
data-cy="entityDeleteButton"
|
||||||
|
v-if="(registration.id && registration.user?.id == currentUserId) || hasAnyAuthority('ROLE_ADMIN')"
|
||||||
|
v-b-modal.removeEntity
|
||||||
|
>
|
||||||
|
<font-awesome-icon icon="times"></font-awesome-icon>
|
||||||
|
<span class="d-none d-md-inline">Delete</span>
|
||||||
|
</b-button>
|
||||||
|
</td>
|
||||||
<td>{{ registration.comment }}</td>
|
<td>{{ registration.comment }}</td>
|
||||||
<td>{{ registration.active }}</td>
|
<!-- <td>{{ registration.active }}</td>-->
|
||||||
|
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
@@ -75,16 +88,16 @@
|
|||||||
<span class="d-none d-md-inline">View</span>
|
<span class="d-none d-md-inline">View</span>
|
||||||
</button>
|
</button>
|
||||||
</router-link>
|
</router-link>
|
||||||
<!-- <b-button-->
|
<!-- <b-button-->
|
||||||
<!-- @click="prepareRemove(registration)"-->
|
<!-- @click="prepareRemove(registration)"-->
|
||||||
<!-- variant="danger"-->
|
<!-- variant="danger"-->
|
||||||
<!-- class="btn btn-sm"-->
|
<!-- class="btn btn-sm"-->
|
||||||
<!-- data-cy="entityDeleteButton"-->
|
<!-- data-cy="entityDeleteButton"-->
|
||||||
<!-- v-b-modal.removeEntity-->
|
<!-- v-b-modal.removeEntity-->
|
||||||
<!-- >-->
|
<!-- >-->
|
||||||
<!-- <font-awesome-icon icon="times"></font-awesome-icon>-->
|
<!-- <font-awesome-icon icon="times"></font-awesome-icon>-->
|
||||||
<!-- <span class="d-none d-md-inline">Delete</span>-->
|
<!-- <span class="d-none d-md-inline">Delete</span>-->
|
||||||
<!-- </b-button>-->
|
<!-- </b-button>-->
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<h2 id="page-heading" data-cy="EventHeading">
|
<h2 id="page-heading" data-cy="EventHeading">
|
||||||
<span id="event-heading">Events</span>
|
<span id="event-heading">Wydarzenia</span>
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
<button class="btn btn-info mr-2" @click="handleSyncList" :disabled="isFetching">
|
<button class="btn btn-info mr-2" @click="handleSyncList" :disabled="isFetching">
|
||||||
<font-awesome-icon icon="sync" :spin="isFetching"></font-awesome-icon> <span>Refresh list</span>
|
<font-awesome-icon icon="sync" :spin="isFetching"></font-awesome-icon> <span>Odśwież listę</span>
|
||||||
</button>
|
</button>
|
||||||
<router-link :to="{ name: 'EventCreate' }" custom v-slot="{ navigate }" v-if="hasAnyAuthority('ROLE_ADMIN')">
|
<router-link :to="{ name: 'EventCreate' }" custom v-slot="{ navigate }" v-if="hasAnyAuthority('ROLE_ADMIN')">
|
||||||
<button
|
<button
|
||||||
@@ -14,25 +14,25 @@
|
|||||||
class="btn btn-primary jh-create-entity create-event"
|
class="btn btn-primary jh-create-entity create-event"
|
||||||
>
|
>
|
||||||
<font-awesome-icon icon="plus"></font-awesome-icon>
|
<font-awesome-icon icon="plus"></font-awesome-icon>
|
||||||
<span>Create a new Event</span>
|
<span>Utwórz nowe wydarzenie</span>
|
||||||
</button>
|
</button>
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</h2>
|
</h2>
|
||||||
<br />
|
<br />
|
||||||
<div class="alert alert-warning" v-if="!isFetching && events && events.length === 0">
|
<div class="alert alert-warning" v-if="!isFetching && events && events.length === 0">
|
||||||
<span>No Events found</span>
|
<span>Brak wydarzeń</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-responsive" v-if="events && events.length > 0">
|
<div class="table-responsive" v-if="events && events.length > 0">
|
||||||
<table class="table table-striped" aria-describedby="events">
|
<table class="table table-striped" aria-describedby="events">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><span>ID</span></th>
|
<th scope="row"><span>ID</span></th>
|
||||||
<th scope="row"><span>Name</span></th>
|
<th scope="row"><span>Nazwa</span></th>
|
||||||
<th scope="row"><span>Date</span></th>
|
<th scope="row"><span>Data</span></th>
|
||||||
<th scope="row"><span>Players Limit</span></th>
|
<th scope="row"><span>Limit graczy</span></th>
|
||||||
<th scope="row"><span>Cost</span></th>
|
<th scope="row"><span>Koszt</span></th>
|
||||||
<th scope="row"><span>Comment</span></th>
|
<th scope="row"><span>Komentarz</span></th>
|
||||||
<th scope="row"></th>
|
<th scope="row"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@@ -12,12 +12,12 @@
|
|||||||
<dd>
|
<dd>
|
||||||
<span v-if="registration.dateTime">{{ formatDateLong(registration.dateTime) }}</span>
|
<span v-if="registration.dateTime">{{ formatDateLong(registration.dateTime) }}</span>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<!-- <dt>-->
|
||||||
<span>Aktywna</span>
|
<!-- <span>Aktywna</span>-->
|
||||||
</dt>
|
<!-- </dt>-->
|
||||||
<dd>
|
<!-- <dd>-->
|
||||||
<span>{{ registration.active }}</span>
|
<!-- <span>{{ registration.active }}</span>-->
|
||||||
</dd>
|
<!-- </dd>-->
|
||||||
<dt>
|
<dt>
|
||||||
<span>Imię i Nazwisko gracza</span>
|
<span>Imię i Nazwisko gracza</span>
|
||||||
</dt>
|
</dt>
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
<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> <span>Back</span>
|
<font-awesome-icon icon="arrow-left"></font-awesome-icon> <span>Back</span>
|
||||||
</button>
|
</button>
|
||||||
<router-link
|
<!-- <router-link
|
||||||
v-if="registration.id && registration.user?.id == currentUserId"
|
v-if="registration.id && registration.user?.id == currentUserId"
|
||||||
:to="{ name: 'RegistrationEdit', params: { registrationId: registration.id } }"
|
:to="{ name: 'RegistrationEdit', params: { registrationId: registration.id } }"
|
||||||
custom
|
custom
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<button @click="navigate" class="btn btn-primary">
|
<button @click="navigate" class="btn btn-primary">
|
||||||
<font-awesome-icon icon="pencil-alt"></font-awesome-icon> <span>Edit</span>
|
<font-awesome-icon icon="pencil-alt"></font-awesome-icon> <span>Edit</span>
|
||||||
</button>
|
</button>
|
||||||
</router-link>
|
</router-link>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,20 +2,18 @@
|
|||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<form name="editForm" novalidate @submit.prevent="save()">
|
<form name="editForm" novalidate @submit.prevent="save()">
|
||||||
<h2 id="sasiedziApp.registration.home.createOrEditLabel" data-cy="RegistrationCreateUpdateHeading">
|
<h2 id="sasiedziApp.registration.home.createOrEditLabel" data-cy="RegistrationCreateUpdateHeading">Rejestracja na wydarzenie</h2>
|
||||||
Create or edit a Registration
|
|
||||||
</h2>
|
|
||||||
<div>
|
<div>
|
||||||
<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">Wydarzenie</label>
|
||||||
<input type="text" class="form-control" id="registration-event" name="eventName" :value="eventName" disabled />
|
<input type="text" class="form-control" id="registration-event" name="eventName" :value="eventName" disabled />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-control-label" for="registration-user">User</label>
|
<label class="form-control-label" for="registration-user">Płacący</label>
|
||||||
<input type="text" class="form-control" id="registration-user" name="userName" :value="currentUserFullName" disabled />
|
<input type="text" class="form-control" id="registration-user" name="userName" :value="currentUserFullName" disabled />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-control-label" for="registration-playerName">Player Name</label>
|
<label class="form-control-label" for="registration-playerName">Grający</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
@@ -25,7 +23,7 @@
|
|||||||
v-model="v$.playerName.$model"
|
v-model="v$.playerName.$model"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<!-- <div class="form-group">
|
||||||
<label class="form-control-label" for="registration-dateTime">Reservation Time</label>
|
<label class="form-control-label" for="registration-dateTime">Reservation Time</label>
|
||||||
<input
|
<input
|
||||||
type="datetime-local"
|
type="datetime-local"
|
||||||
@@ -35,8 +33,8 @@
|
|||||||
:value="currentDateTime"
|
:value="currentDateTime"
|
||||||
disabled
|
disabled
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>-->
|
||||||
<div class="form-group">
|
<!-- <div class="form-group">
|
||||||
<label class="form-control-label" for="registration-active">Active</label>
|
<label class="form-control-label" for="registration-active">Active</label>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -51,9 +49,9 @@
|
|||||||
<div v-if="v$.active.$anyDirty && v$.active.$invalid">
|
<div v-if="v$.active.$anyDirty && v$.active.$invalid">
|
||||||
<small class="form-text text-danger" v-for="error of v$.active.$errors" :key="error.$uid">{{ error.$message }}</small>
|
<small class="form-text text-danger" v-for="error of v$.active.$errors" :key="error.$uid">{{ error.$message }}</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>-->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-control-label" for="registration-comment">Comment</label>
|
<label class="form-control-label" for="registration-comment">Komentarz</label>
|
||||||
<textarea
|
<textarea
|
||||||
class="form-control"
|
class="form-control"
|
||||||
name="comment"
|
name="comment"
|
||||||
|
|||||||
Reference in New Issue
Block a user