Skip to content
This repository was archived by the owner on Nov 19, 2021. It is now read-only.

Commit 1d76ef5

Browse files
committed
Add frontend for event reservations info
1 parent d92ef78 commit 1d76ef5

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed

pages/admin/event/events/index.vue

+11
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@
3131
</v-icon>
3232
Pristupnici eventima
3333
</v-btn>
34+
35+
<v-btn
36+
class="ml-3"
37+
color="secondary"
38+
:to="{ name: 'PageAdminEventsWorkshopEmails' }"
39+
>
40+
<v-icon left>
41+
mdi-email-multiple
42+
</v-icon>
43+
Workshop emailovi
44+
</v-btn>
3445
</v-col>
3546
</v-row>
3647

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<template>
2+
<app-max-width-container>
3+
<v-row>
4+
<v-col>
5+
<h1>Workshop emailovi</h1>
6+
</v-col>
7+
</v-row>
8+
9+
<v-row>
10+
<v-col>
11+
<v-btn
12+
:to="{ name: 'PageAdminEventsIndex' }"
13+
exact
14+
>
15+
<v-icon left>
16+
mdi-arrow-left
17+
</v-icon>
18+
Back
19+
</v-btn>
20+
</v-col>
21+
</v-row>
22+
23+
<v-row>
24+
<v-col
25+
v-for="{id, title, company, users, maxParticipants} in events"
26+
:key="id"
27+
28+
cols="6"
29+
sm="4"
30+
>
31+
<v-expansion-panels class="pa-1 pt-3" popout>
32+
<v-expansion-panel>
33+
<v-expansion-panel-header>
34+
[{{ company }}]
35+
<br>
36+
{{ title }}
37+
<br>
38+
({{ users.length }} / {{ maxParticipants }})
39+
</v-expansion-panel-header>
40+
41+
<v-expansion-panel-content
42+
class="pa-3"
43+
style="white-space: break-spaces;"
44+
v-text="users.join(',\n')"
45+
/>
46+
</v-expansion-panel>
47+
</v-expansion-panels>
48+
</v-col>
49+
</v-row>
50+
</app-max-width-container>
51+
</template>
52+
53+
<router>
54+
name: PageAdminEventsWorkshopEmails
55+
</router>
56+
57+
<script>
58+
import map from "lodash/fp/map";
59+
import AppMaxWidthContainer from "~/components/AppMaxWidthContainer";
60+
import {
61+
EventType,
62+
getParticipantCapacityFor,
63+
} from "~/components/student/event-status";
64+
65+
export default {
66+
components: {
67+
AppMaxWidthContainer,
68+
},
69+
70+
async asyncData({ store }) {
71+
const workshopParticipants = getParticipantCapacityFor(EventType.workshop);
72+
73+
/**
74+
* @type {Array<FormattedEvent>}
75+
*/
76+
const rawEvents = await store.dispatch("companies/fetchEventReservationsFor", { type: "workshop" });
77+
78+
return {
79+
events: map(
80+
/**
81+
* @param event {FormattedEvent}
82+
*/
83+
(event) => ({
84+
...event,
85+
users: map(({ name, email }) => `${ name } <${ email }>`)(event.users),
86+
maxParticipants: workshopParticipants,
87+
}),
88+
)(rawEvents),
89+
};
90+
},
91+
};
92+
</script>

store/companies.js

+6
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,10 @@ export const actions = {
148148

149149
return fixParticipantEvents(data);
150150
},
151+
152+
async fetchEventReservationsFor(_context, { type }) {
153+
const { data } = await this.$api.$get(`/companies/event-info/${ type }/reservations`).catch((e) => e);
154+
155+
return data;
156+
},
151157
};

0 commit comments

Comments
 (0)