admin-users-create.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template lang="pug">
  2. v-dialog(v-model='isShown', max-width='550')
  3. v-card
  4. .dialog-header.is-short New Local User
  5. v-card-text
  6. v-text-field.md2(
  7. solo
  8. flat
  9. background-color='grey lighten-4'
  10. prepend-icon='email'
  11. v-model='email'
  12. label='Email Address'
  13. ref='emailInput'
  14. )
  15. v-text-field.md2(
  16. solo
  17. flat
  18. background-color='grey lighten-4'
  19. prepend-icon='person'
  20. v-model='name'
  21. label='Name'
  22. )
  23. v-text-field.md2(
  24. solo
  25. flat
  26. background-color='grey lighten-4'
  27. prepend-icon='lock'
  28. append-icon='casino'
  29. v-model='password'
  30. label='Password'
  31. counter='255'
  32. @click:append='generatePwd'
  33. )
  34. v-text-field.md2(
  35. solo
  36. flat
  37. background-color='grey lighten-4'
  38. prepend-icon='title'
  39. v-model='jobTitle'
  40. label='Job Title'
  41. counter='255'
  42. hint='Optional'
  43. persistent-hint
  44. )
  45. v-text-field.md2(
  46. solo
  47. flat
  48. background-color='grey lighten-4'
  49. prepend-icon='public'
  50. v-model='location'
  51. label='Location'
  52. counter='255'
  53. hint='Optional'
  54. persistent-hint
  55. )
  56. v-card-chin
  57. v-spacer
  58. v-btn(flat, @click='isShown = false') Cancel
  59. v-btn(color='primary', @click='createUser') Create
  60. </template>
  61. <script>
  62. import uuidv4 from 'uuid/v4'
  63. export default {
  64. props: {
  65. value: {
  66. type: Boolean,
  67. default: false
  68. }
  69. },
  70. data() {
  71. return {
  72. email: '',
  73. name: '',
  74. password: '',
  75. jobTitle: '',
  76. location: ''
  77. }
  78. },
  79. computed: {
  80. isShown: {
  81. get() { return this.value },
  82. set(val) { this.$emit('input', val) }
  83. }
  84. },
  85. watch: {
  86. value(newValue, oldValue) {
  87. if (newValue) {
  88. this.$nextTick(() => {
  89. this.$refs.emailInput.focus()
  90. })
  91. }
  92. }
  93. },
  94. methods: {
  95. async createUser() {
  96. },
  97. generatePwd() {
  98. this.password = uuidv4().slice(-12)
  99. }
  100. }
  101. }
  102. </script>