|
| 1 | +<template lang='pug'> |
| 2 | + v-card(flat) |
| 3 | + v-card(flat, tile, :color='$vuetify.dark ? "grey darken-4" : "grey lighten-5"').pa-3.pt-4 |
| 4 | + .admin-header-icon: v-icon(size='80', color='grey lighten-2') insert_drive_file |
| 5 | + .headline.blue--text.text--darken-2 Pages |
| 6 | + .subheading.grey--text Manage pages |
| 7 | + v-card |
| 8 | + v-card-title |
| 9 | + v-btn(color='primary', dark, slot='activator') |
| 10 | + v-icon(left) add |
| 11 | + | New Page |
| 12 | + v-btn(icon, @click='refresh') |
| 13 | + v-icon.grey--text refresh |
| 14 | + v-spacer |
| 15 | + v-text-field(solo, append-icon='search', label='Search', single-line, hide-details, v-model='search') |
| 16 | + v-data-table( |
| 17 | + :items='groups' |
| 18 | + :headers='headers' |
| 19 | + :search='search' |
| 20 | + :pagination.sync='pagination' |
| 21 | + :rows-per-page-items='[15]' |
| 22 | + hide-actions |
| 23 | + ) |
| 24 | + template(slot='items', slot-scope='props') |
| 25 | + tr.is-clickable(:active='props.selected', @click='$router.push("/e/" + props.item.id)') |
| 26 | + td.text-xs-right {{ props.item.id }} |
| 27 | + td {{ props.item.name }} |
| 28 | + td {{ props.item.userCount }} |
| 29 | + td {{ props.item.createdAt | moment('calendar') }} |
| 30 | + td {{ props.item.updatedAt | moment('calendar') }} |
| 31 | + template(slot='no-data') |
| 32 | + v-alert.ma-3(icon='warning', :value='true', outline) No pages to display. |
| 33 | + .text-xs-center.py-2(v-if='groups.length > 15') |
| 34 | + v-pagination(v-model='pagination.page', :length='pages') |
| 35 | +</template> |
| 36 | + |
| 37 | +<script> |
| 38 | +
|
| 39 | +export default { |
| 40 | + data() { |
| 41 | + return { |
| 42 | + selectedGroup: {}, |
| 43 | + pagination: {}, |
| 44 | + groups: [], |
| 45 | + headers: [ |
| 46 | + { text: 'ID', value: 'id', width: 50, align: 'right' }, |
| 47 | + { text: 'Title', value: 'title' }, |
| 48 | + { text: 'Path', value: 'path' }, |
| 49 | + { text: 'Created', value: 'createdAt', width: 250 }, |
| 50 | + { text: 'Last Updated', value: 'updatedAt', width: 250 } |
| 51 | + ], |
| 52 | + search: '' |
| 53 | + } |
| 54 | + }, |
| 55 | + computed: { |
| 56 | + pages () { |
| 57 | + if (this.pagination.rowsPerPage == null || this.pagination.totalItems == null) { |
| 58 | + return 0 |
| 59 | + } |
| 60 | +
|
| 61 | + return Math.ceil(this.pagination.totalItems / this.pagination.rowsPerPage) |
| 62 | + } |
| 63 | + }, |
| 64 | + methods: { |
| 65 | + async refresh() { |
| 66 | + // await this.$apollo.queries.groups.refetch() |
| 67 | + this.$store.commit('showNotification', { |
| 68 | + message: 'Pages have been refreshed.', |
| 69 | + style: 'success', |
| 70 | + icon: 'cached' |
| 71 | + }) |
| 72 | + } |
| 73 | + } |
| 74 | +} |
| 75 | +</script> |
| 76 | + |
| 77 | +<style lang='scss'> |
| 78 | +
|
| 79 | +</style> |
0 commit comments