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

Commit

Permalink
Add frontend for event reservations info
Browse files Browse the repository at this point in the history
  • Loading branch information
Allypost committed Apr 30, 2021
1 parent d92ef78 commit 1d76ef5
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pages/admin/event/events/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@
</v-icon>
Pristupnici eventima
</v-btn>

<v-btn
class="ml-3"
color="secondary"
:to="{ name: 'PageAdminEventsWorkshopEmails' }"
>
<v-icon left>
mdi-email-multiple
</v-icon>
Workshop emailovi
</v-btn>
</v-col>
</v-row>

Expand Down
92 changes: 92 additions & 0 deletions pages/admin/event/events/workshop-emails.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<template>
<app-max-width-container>
<v-row>
<v-col>
<h1>Workshop emailovi</h1>
</v-col>
</v-row>

<v-row>
<v-col>
<v-btn
:to="{ name: 'PageAdminEventsIndex' }"
exact
>
<v-icon left>
mdi-arrow-left
</v-icon>
Back
</v-btn>
</v-col>
</v-row>

<v-row>
<v-col
v-for="{id, title, company, users, maxParticipants} in events"
:key="id"

cols="6"
sm="4"
>
<v-expansion-panels class="pa-1 pt-3" popout>
<v-expansion-panel>
<v-expansion-panel-header>
[{{ company }}]
<br>
{{ title }}
<br>
({{ users.length }} / {{ maxParticipants }})
</v-expansion-panel-header>

<v-expansion-panel-content
class="pa-3"
style="white-space: break-spaces;"
v-text="users.join(',\n')"
/>
</v-expansion-panel>
</v-expansion-panels>
</v-col>
</v-row>
</app-max-width-container>
</template>

<router>
name: PageAdminEventsWorkshopEmails
</router>

<script>
import map from "lodash/fp/map";
import AppMaxWidthContainer from "~/components/AppMaxWidthContainer";
import {
EventType,
getParticipantCapacityFor,
} from "~/components/student/event-status";
export default {
components: {
AppMaxWidthContainer,
},
async asyncData({ store }) {
const workshopParticipants = getParticipantCapacityFor(EventType.workshop);
/**
* @type {Array<FormattedEvent>}
*/
const rawEvents = await store.dispatch("companies/fetchEventReservationsFor", { type: "workshop" });
return {
events: map(
/**
* @param event {FormattedEvent}
*/
(event) => ({
...event,
users: map(({ name, email }) => `${ name } <${ email }>`)(event.users),
maxParticipants: workshopParticipants,
}),
)(rawEvents),
};
},
};
</script>
6 changes: 6 additions & 0 deletions store/companies.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,10 @@ export const actions = {

return fixParticipantEvents(data);
},

async fetchEventReservationsFor(_context, { type }) {
const { data } = await this.$api.$get(`/companies/event-info/${ type }/reservations`).catch((e) => e);

return data;
},
};

0 comments on commit 1d76ef5

Please sign in to comment.