admin-users.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template lang='pug'>
  2. v-container(fluid, fill-height, grid-list-lg)
  3. v-layout(row wrap)
  4. v-flex(xs12)
  5. .headline.blue--text.text--darken-2 Users
  6. .subheading.grey--text Manage users
  7. v-card.mt-3.elevation-1
  8. v-card-title
  9. v-btn() New User
  10. v-btn() Authorize User
  11. v-spacer
  12. v-text-field(append-icon='search', label='Search', single-line, hide-details, v-model='search')
  13. v-data-table(
  14. v-model='selected'
  15. :items='items',
  16. :headers='headers',
  17. :search='search',
  18. :pagination.sync='pagination',
  19. select-all,
  20. hide-actions
  21. )
  22. template(slot='items', slot-scope='props')
  23. tr(:active='props.selected', @click='props.selected = !props.selected')
  24. td
  25. v-checkbox(hide-details, :input-value='props.selected')
  26. td.text-xs-right {{ props.item.id }}
  27. td {{ props.item.email }}
  28. td {{ props.item.name }}
  29. td {{ props.item.provider }}
  30. template(slot='no-data')
  31. v-alert(icon='warning', :value='true') No users to display!
  32. .text-xs-center.py-2
  33. v-pagination(v-model='pagination.page', :length='pages')
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. selected: [],
  40. pagination: {},
  41. items: [
  42. { id: 1, email: 'user@test.com', name: 'John Doe', provider: 'local' }
  43. ],
  44. headers: [
  45. {
  46. text: 'ID',
  47. align: 'right',
  48. value: 'id',
  49. width: 80
  50. },
  51. { text: 'Email', value: 'email' },
  52. { text: 'Name', value: 'name' },
  53. { text: 'Provider', value: 'provider' },
  54. { text: 'Created On', value: 'createdOn' },
  55. { text: 'Updated On', value: 'updatedOn' },
  56. { text: 'Actions', value: 'actions', sortable: false }
  57. ],
  58. search: ''
  59. }
  60. },
  61. computed: {
  62. pages () {
  63. if (this.pagination.rowsPerPage == null || this.pagination.totalItems == null) {
  64. return 0
  65. }
  66. return Math.ceil(this.pagination.totalItems / this.pagination.rowsPerPage)
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang='scss'>
  72. </style>