This commit is contained in:
les
2019-09-11 19:12:24 +02:00
parent 93baf01a55
commit 2fe956d117
65 changed files with 762 additions and 721 deletions

View File

@@ -16,43 +16,42 @@
template(slot-scope='data')
el-button(size='mini'
type='success'
@click='place = data.row') {{$t('common.edit')}}
@click='place = data.row') {{$t('common.edit')}}
client-only
el-pagination(:page-size='perPage' :currentPage.sync='placePage' :total='places.length')
</template>
<script>
import { mapState, mapActions } from 'vuex'
export default {
data () {
return {
data () {
return {
perPage: 10,
placePage: 0,
place: { name: '', address: '', id: null}
place: { name: '', address: '', id: null }
}
},
computed: {
...mapState(['places']),
paginatedPlaces () {
return this.places.slice((this.placePage-1) * this.perPage,
return this.places.slice((this.placePage - 1) * this.perPage,
this.placePage * this.perPage)
},
}
},
methods: {
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
},
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
},
async savePlace () {
const place = await this.$axios.$put('/place', this.place)
},
}
}
}
</script>

View File

@@ -55,16 +55,16 @@ export default {
userPage: 1,
new_user: {
email: '',
is_admin: false,
is_admin: false
},
users_: this.users
}
},
computed: {
paginatedUsers () {
return this.users_.slice((this.userPage-1) * this.perPage,
return this.users_.slice((this.userPage - 1) * this.perPage,
this.userPage * this.perPage)
},
}
},
methods: {
async delete_user (user) {
@@ -74,25 +74,25 @@ export default {
cancelButtonText: this.$t('common.cancel'),
type: 'error'
})
.then( () => this.$axios.delete(`/user/${user.id}`) )
.then( () => {
.then(() => this.$axios.delete(`/user/${user.id}`))
.then(() => {
Message({
showClose: true,
type: 'success',
message: this.$t('admin.user_remove_ok')
})
this.users_ = this.users_.filter(u => u.id!==user.id)
this.users_ = this.users_.filter(u => u.id !== user.id)
})
},
async toggle(user) {
async toggle (user) {
user.is_active = !user.is_active
this.$axios.$put('/user', user)
},
async toggleAdmin(user) {
async toggleAdmin (user) {
try {
user.is_admin = !user.is_admin
await this.$axios.$put('/user', user)
} catch(e) {
} catch (e) {
console.error(e)
}
},
@@ -114,7 +114,7 @@ export default {
message: this.$t(e)
})
}
},
}
}
}
</script>