update (end of the main panel feature I think)

This commit is contained in:
Matthieu Bessat 2020-07-15 15:21:53 +02:00
parent 4791bd8037
commit 79a24f6ae7
15 changed files with 814 additions and 71 deletions

View file

@ -6,9 +6,9 @@
dark
flat
>
<v-toolbar-title>Gestion de l'association We Robot</v-toolbar-title>
<v-toolbar-title>{{ $store.state.delegateAdminName }}</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn outlined>
<v-btn outlined class="mr-3">
Publier
</v-btn>
<v-btn icon @click="logout()">
@ -45,7 +45,7 @@
</v-toolbar>
<v-container fluid>
<v-row class="justify-center">
<v-col cols="12" sm="12" md="8">
<v-col cols="12" sm="12" md="8" lg="7" xl="5">
<router-view></router-view>
<div class="mt-3 d-flex justify-end">
<v-btn color="success" :loading="isSaving" @click="save()">Sauvegarder</v-btn>
@ -66,7 +66,7 @@
<p>
Vous n'êtes pas encore connecté à l'interface de modification de votre association, veuillez copier-coller la clée qui vous a été envoyé par e-mail dans la boîte ci-dessous.
</p>
<v-text-field
<v-text-field
v-on:keydown.enter="submitForm()"
autofocus
label="Clée"
@ -99,11 +99,13 @@ export default {
created () {
this.init()
},
watch: {
$route (to, from) {
this.selectRoute(to)
}
},
mounted () {
const path = this.$route.path.split('/')
const name = path[path.length - 1]
const routes = ['', 'gallery', 'presentation', 'schedule', 'pricing', 'contact']
this.tab = routes.indexOf(name)
this.selectRoute(this.$route)
/**
* this is very ugly I kown
*/
@ -121,6 +123,12 @@ export default {
// }, 3000)
},
methods: {
selectRoute (route) {
const path = route.path.split('/')
const name = path[path.length - 1]
const routes = ['', 'gallery', 'presentation', 'schedule', 'pricing', 'contact']
this.tab = routes.indexOf(name)
},
init () {
this.enabled = false
@ -154,8 +162,15 @@ export default {
clearTimeout(this.loadingHandle)
this.loading = false
this.enabled = true
const organization = res.data.data
const organization = res.data.data.organization
const tags = res.data.data.tags
if (organization.proposedVersion.tag !== undefined && organization.proposedVersion.tag !== null) {
organization.proposedVersion.tag = organization.proposedVersion.tag._id
}
this.$store.commit('SET_DELEGATE_ADMIN_NAME', organization.adminName)
this.$store.commit('SET_DELEGATE_EMAIL', organization.email)
this.$store.commit('SET_DATA', organization.proposedVersion)
this.$store.commit('SET_TAGS', tags)
this.$nextTick(() => {
setTimeout(this.$refs.tabs.callSlider, 200)
setTimeout(this.$refs.tabs.callSlider, 400)
@ -185,6 +200,16 @@ export default {
delete i._id
return i
})
data.schedule = data.schedule.map(i => {
delete i._id
if (Array.isArray(i.when) && i.when.length > 0) {
i.when = i.when.map(w => {
delete w._id
return w
})
}
return i
})
this.$apitator.put('/delegate', data, { withAuth: true }).then(() => {
this.isSaving = false
this.$store.commit('ADD_ALERT', {