Skip to content

Commit

Permalink
fix(statutory): add views for missing and without fee memberlists (#1852
Browse files Browse the repository at this point in the history
)

Co-authored-by: WikiRik <[email protected]>
  • Loading branch information
WikiRik and WikiRik authored Sep 11, 2023
1 parent a574182 commit 526e8c7
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/router/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,22 @@ module.exports = [
label: 'List members lists'
}
},
{
name: 'oms.statutory.memberslist.list.missing',
path: '/statutory/:id/memberslist/list/missing',
component: 'statutory/ListMissingMembersLists',
meta: {
label: 'List missing members lists'
}
},
{
name: 'oms.statutory.memberslist.list.without_fee',
path: '/statutory/:id/memberslist/list/without_fee',
component: 'statutory/ListWithoutFeeMembersLists',
meta: {
label: 'List members lists without fee'
}
},
{
name: 'oms.statutory.massmailer',
path: '/statutory/:id/massmailer',
Expand Down
78 changes: 78 additions & 0 deletions src/views/statutory/ListMissingMembersLists.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<template>
<div class="tile is-ancestor">
<div class="tile is-parent is-vertical">
<article class="tile is-child">
<h4 class="title">List all missing memberslists for {{ event.name }}</h4>

<b-table
:data="memberslists"
:loading="isLoading">
<template slot-scope="props">
<b-table-column field="body_name" label="Body name" sortable>
<router-link :to="{ name: 'oms.bodies.view', params: { id: props.row.body_id } }">
{{ props.row.body ? props.row.body.name : 'Loading...' }}
</router-link>
</b-table-column>

<b-table-column field="type" label="Type" sortable>
{{ props.row.type | capitalize }}
</b-table-column>
</template>

<template slot="empty">
<empty-table-stub />
</template>
</b-table>
</article>
</div>
</div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
name: 'ListMissingMembersLists',
data () {
return {
event: { name: 'event that is still loading...' },
memberslists: [],
isLoading: false
}
},
computed: mapGetters(['services']),
mounted () {
this.isLoading = true
let memberslists
this.axios.get(this.services['statutory'] + '/events/' + this.$route.params.id).then((response) => {
this.event = response.data.data
this.can = response.data.data.permissions
return this.axios.get(this.services['statutory'] + '/events/' + this.$route.params.id + '/memberslists/missing')
}).then((response) => {
memberslists = response.data.data
return this.axios.get(this.services['core'] + '/bodies/')
}).then((response) => {
for (const memberslist of memberslists) {
const body = response.data.data.find(bodyFromList => bodyFromList.id === memberslist.id)
memberslist.expanded = false
if (body) {
memberslist.body = body
memberslist.body_name = body.name
}
}
this.memberslists = memberslists
this.isLoading = false
})
.catch((err) => {
this.isLoading = false
this.$root.showError('Could not fetch members lists', err)
})
}
}
</script>
78 changes: 78 additions & 0 deletions src/views/statutory/ListWithoutFeeMembersLists.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<template>
<div class="tile is-ancestor">
<div class="tile is-parent is-vertical">
<article class="tile is-child">
<h4 class="title">List all memberslists without fee for {{ event.name }}</h4>

<b-table
:data="memberslists"
:loading="isLoading">
<template slot-scope="props">
<b-table-column field="body_name" label="Body name" sortable>
<router-link :to="{ name: 'oms.bodies.view', params: { id: props.row.body_id } }">
{{ props.row.body ? props.row.body.name : 'Loading...' }}
</router-link>
</b-table-column>

<b-table-column field="type" label="Type" sortable>
{{ props.row.type | capitalize }}
</b-table-column>
</template>

<template slot="empty">
<empty-table-stub />
</template>
</b-table>
</article>
</div>
</div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
name: 'ListWithoutFeeMembersLists',
data () {
return {
event: { name: 'event that is still loading...' },
memberslists: [],
isLoading: false
}
},
computed: mapGetters(['services']),
mounted () {
this.isLoading = true
let memberslists
this.axios.get(this.services['statutory'] + '/events/' + this.$route.params.id).then((response) => {
this.event = response.data.data
this.can = response.data.data.permissions
return this.axios.get(this.services['statutory'] + '/events/' + this.$route.params.id + '/memberslists/without_fee')
}).then((response) => {
memberslists = response.data.data
return this.axios.get(this.services['core'] + '/bodies/')
}).then((response) => {
for (const memberslist of memberslists) {
const body = response.data.data.find(bodyFromList => bodyFromList.id === memberslist.id)
memberslist.expanded = false
if (body) {
memberslist.body = body
memberslist.body_name = body.name
}
}
this.memberslists = memberslists
this.isLoading = false
})
.catch((err) => {
this.isLoading = false
this.$root.showError('Could not fetch members lists', err)
})
}
}
</script>
14 changes: 14 additions & 0 deletions src/views/statutory/Single.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@
</router-link>
</div>

<div class="field is-grouped" v-if="can.see_memberslist.global && this.event.type === 'agora'">
<router-link :to="{ name: 'oms.statutory.memberslist.list.missing', params: { id: event.url || event.id } }" class="button is-fullwidth">
<span>See missing members lists</span>
<span class="icon"><font-awesome-icon icon="users" /></span>
</router-link>
</div>

<div class="field is-grouped" v-if="can.see_memberslist.global && this.event.type === 'agora'">
<router-link :to="{ name: 'oms.statutory.memberslist.list.without_fee', params: { id: event.url || event.id } }" class="button is-fullwidth">
<span>See members lists without fee</span>
<span class="icon"><font-awesome-icon icon="users" /></span>
</router-link>
</div>

<div class="field is-grouped" v-if="can.use_massmailer">
<router-link :to="{ name: 'oms.statutory.massmailer', params: { id: event.url || event.id } }" class="button is-fullwidth">
<span>Mass mailer</span>
Expand Down

0 comments on commit 526e8c7

Please sign in to comment.