gancio-upstream/components/admin/Places.vue

55 lines
1.3 KiB
Vue
Raw Normal View History

2019-07-27 22:07:08 +02:00
<template lang='pug'>
2020-07-25 21:41:22 +02:00
v-container
v-subheader(v-html="$t('admin.place_description')")
2019-09-13 10:15:23 +02:00
2020-07-28 12:24:39 +02:00
v-dialog
v-form.mb-2
//- el-form-item(:label="$t('common.name')")
//- el-input.mr-1(:placeholder='$t("common.name")' v-model='place.name')
v-text-field(
:label="$t('common.name')"
v-model='place.name'
:placeholder='$t("common.name")')
2019-09-11 19:12:24 +02:00
2020-07-28 12:24:39 +02:00
v-text-field(
:label="$t('common.address')"
v-model='place.address'
:placeholder='$t("common.address")')
v-btn(@click='savePlace') {{$t('common.save')}}
2020-07-25 21:41:22 +02:00
v-data-table(
2020-07-28 12:24:39 +02:00
@click:row='selectPlace'
:headers='headers'
2020-07-25 21:41:22 +02:00
:items='places')
2019-07-27 22:07:08 +02:00
</template>
<script>
import { mapState } from 'vuex'
2019-07-27 22:07:08 +02:00
export default {
2019-09-11 19:12:24 +02:00
data () {
return {
2020-07-28 12:24:39 +02:00
place: { name: '', address: '', id: null },
headers: [
{ value: 'name', text: 'Name' }
]
2019-07-27 22:07:08 +02:00
}
},
2020-07-25 21:41:22 +02:00
computed: mapState(['places']),
2019-07-27 22:07:08 +02:00
methods: {
2020-07-28 12:24:39 +02:00
selectPlace (item) {
// if (items.length === 0) {
// this.place.name = this.place.address = ''
// return
// }
// const item = items[0]
2019-09-11 19:12:24 +02:00
this.place.name = item.name
this.place.address = item.address
this.place.id = item.id
},
2019-07-27 22:07:08 +02:00
async savePlace () {
2020-07-25 21:41:22 +02:00
await this.$axios.$put('/place', this.place)
2019-09-11 19:12:24 +02:00
}
2019-07-27 22:07:08 +02:00
}
}
</script>