mirror of
https://framagit.org/les/gancio.git
synced 2025-02-01 00:52:01 +01:00
create places components for /admin ref #28
This commit is contained in:
parent
75e8c1757b
commit
30cb96f49f
2 changed files with 8 additions and 42 deletions
|
@ -33,10 +33,10 @@ div
|
||||||
@click='delete_user(data.row)') {{$t('admin.delete_user')}}
|
@click='delete_user(data.row)') {{$t('admin.delete_user')}}
|
||||||
div(v-else)
|
div(v-else)
|
||||||
span {{$t('common.me')}}
|
span {{$t('common.me')}}
|
||||||
|
|
||||||
no-ssr
|
no-ssr
|
||||||
el-pagination(:page-size='perPage' :currentPage.sync='userPage' :total='users_.length')
|
el-pagination(:page-size='perPage' :currentPage.sync='userPage' :total='users_.length')
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { Message, MessageBox } from 'element-ui'
|
import { Message, MessageBox } from 'element-ui'
|
||||||
|
@ -109,7 +109,7 @@ export default {
|
||||||
message: this.$t('user.error_create') + e
|
message: this.$t('user.error_create') + e
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -18,20 +18,7 @@
|
||||||
template(slot='label')
|
template(slot='label')
|
||||||
v-icon(name='map-marker-alt')
|
v-icon(name='map-marker-alt')
|
||||||
span.ml-1 {{$t('common.places')}}
|
span.ml-1 {{$t('common.places')}}
|
||||||
p(v-html="$t('admin.place_description')")
|
Places
|
||||||
el-form.mb-2(:inline='true' label-width='120px')
|
|
||||||
el-form-item(:label="$t('common.name')")
|
|
||||||
el-input.mr-1(:placeholder='$t("common.name")' v-model='place.name')
|
|
||||||
el-form-item(:label="$t('common.address')")
|
|
||||||
el-input.mr-1(:placeholder='$t("common.address")' v-model='place.address')
|
|
||||||
el-button(variant='primary' @click='savePlace') {{$t('common.save')}}
|
|
||||||
el-table(:data='paginatedPlaces' small @current-change="val => place=val")
|
|
||||||
el-table-column(:label="$t('common.name')")
|
|
||||||
template(slot-scope='data') {{data.row.name}}
|
|
||||||
el-table-column(:label="$t('common.address')")
|
|
||||||
template(slot-scope='data') {{data.row.address}}
|
|
||||||
no-ssr
|
|
||||||
el-pagination(:page-size='perPage' :currentPage.sync='placePage' :total='places.length')
|
|
||||||
|
|
||||||
//- EVENTS
|
//- EVENTS
|
||||||
el-tab-pane.pt-1
|
el-tab-pane.pt-1
|
||||||
|
@ -88,22 +75,19 @@
|
||||||
import { mapState, mapActions } from 'vuex'
|
import { mapState, mapActions } from 'vuex'
|
||||||
import { Message, MessageBox } from 'element-ui'
|
import { Message, MessageBox } from 'element-ui'
|
||||||
import Users from '../components/admin/Users'
|
import Users from '../components/admin/Users'
|
||||||
|
import Places from '../components/admin/Places'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Admin',
|
name: 'Admin',
|
||||||
components: { Users },
|
components: { Users, Places },
|
||||||
middleware: ['auth'],
|
middleware: ['auth'],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
perPage: 10,
|
perPage: 10,
|
||||||
userFields: ['email', 'action'],
|
|
||||||
placeFields: ['name', 'address'],
|
|
||||||
placePage: 1,
|
|
||||||
eventPage: 1,
|
eventPage: 1,
|
||||||
tagPage: 1,
|
tagPage: 1,
|
||||||
tagFields: ['tag', 'color'],
|
tagFields: ['tag', 'color'],
|
||||||
description: '',
|
description: '',
|
||||||
place: {name: '', address: '' },
|
|
||||||
tag: {name: '', color: ''},
|
tag: {name: '', color: ''},
|
||||||
events: [],
|
events: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@ -129,7 +113,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['tags', 'places', 'settings']),
|
...mapState(['tags', 'settings']),
|
||||||
allow_registration: {
|
allow_registration: {
|
||||||
get () { return this.settings.allow_registration },
|
get () { return this.settings.allow_registration },
|
||||||
set (value) { this.setSetting({ key: 'allow_registration', value }) }
|
set (value) { this.setSetting({ key: 'allow_registration', value }) }
|
||||||
|
@ -158,30 +142,12 @@ export default {
|
||||||
return this.tags.slice((this.tagPage-1) * this.perPage,
|
return this.tags.slice((this.tagPage-1) * this.perPage,
|
||||||
this.tagPage * this.perPage)
|
this.tagPage * this.perPage)
|
||||||
},
|
},
|
||||||
|
|
||||||
paginatedPlaces () {
|
|
||||||
return this.places.slice((this.placePage-1) * this.perPage,
|
|
||||||
this.placePage * this.perPage)
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['setSetting']),
|
...mapActions(['setSetting']),
|
||||||
placeSelected (items) {
|
|
||||||
if (items.length === 0 ) {
|
|
||||||
this.place.name = this.place.address = ''
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const item = items[0]
|
|
||||||
this.place.name = item.name
|
|
||||||
this.place.address = item.address
|
|
||||||
this.place.id = item.id
|
|
||||||
},
|
|
||||||
tagSelected (tag) {
|
tagSelected (tag) {
|
||||||
this.tag = { color: tag.color, tag: tag.tag }
|
this.tag = { color: tag.color, tag: tag.tag }
|
||||||
},
|
},
|
||||||
async savePlace () {
|
|
||||||
const place = await this.$axios.$put('/place', this.place)
|
|
||||||
},
|
|
||||||
preview (id) {
|
preview (id) {
|
||||||
this.$router.push(`/event/${id}`)
|
this.$router.push(`/event/${id}`)
|
||||||
},
|
},
|
||||||
|
@ -207,4 +173,4 @@ export default {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue