setttle
This commit is contained in:
@@ -10,6 +10,7 @@ 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';
|
||||
// import type EventService from '@/account/account.service';
|
||||
|
||||
export default defineComponent({
|
||||
compatConfig: { MODE: 3 },
|
||||
@@ -105,6 +106,7 @@ export default defineComponent({
|
||||
alertService,
|
||||
hasAnyAuthorityValues,
|
||||
accountService,
|
||||
eventService,
|
||||
event,
|
||||
...dataUtils,
|
||||
formatDateShort,
|
||||
@@ -127,5 +129,21 @@ export default defineComponent({
|
||||
});
|
||||
return this.hasAnyAuthorityValues[authorities] ?? false;
|
||||
},
|
||||
settle(): void {
|
||||
this.isSaving = true;
|
||||
if (this.event.id) {
|
||||
this.eventService()
|
||||
.settle(this.event)
|
||||
.then(param => {
|
||||
this.isSaving = false;
|
||||
// this.previousState();
|
||||
this.alertService.showInfo(`The event has been settled up`);
|
||||
})
|
||||
.catch(error => {
|
||||
this.isSaving = false;
|
||||
this.alertService.showHttpError(error.response);
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -40,6 +40,9 @@
|
||||
<font-awesome-icon icon="plus"></font-awesome-icon> <span>Dołącz do wydarzenia</span>
|
||||
</button>
|
||||
</router-link>
|
||||
<button class="btn btn-primary float-right" v-if="hasAnyAuthority('ROLE_ADMIN')" @click="settle()">
|
||||
<font-awesome-icon icon="sync"></font-awesome-icon> <span>Rozlicz wydarzenie</span>
|
||||
</button>
|
||||
<div class="table-responsive" v-if="event.registrations && event.registrations.length > 0">
|
||||
<table class="table table-striped" aria-describedby="event.registrations">
|
||||
<thead>
|
||||
|
||||
@@ -57,6 +57,19 @@ export default class EventService {
|
||||
});
|
||||
}
|
||||
|
||||
public settle(entity: IEvent): Promise<IEvent> {
|
||||
return new Promise<IEvent>((resolve, reject) => {
|
||||
axios
|
||||
.post(`${baseApiUrl}/${entity.id}/settle`, entity)
|
||||
.then(res => {
|
||||
resolve(res.data);
|
||||
})
|
||||
.catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public update(entity: IEvent): Promise<IEvent> {
|
||||
return new Promise<IEvent>((resolve, reject) => {
|
||||
axios
|
||||
|
||||
@@ -12,7 +12,7 @@ export const createRouter = () =>
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/event/1551/view',
|
||||
redirect: '/event/1/view',
|
||||
},
|
||||
{
|
||||
path: '/forbidden',
|
||||
|
||||
Reference in New Issue
Block a user