admin-users-edit.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. <template lang='pug'>
  2. v-container(fluid, grid-list-lg)
  3. v-layout(row, wrap)
  4. v-flex(xs12)
  5. .admin-header
  6. img.animated.fadeInUp(src='/svg/icon-male-user.svg', alt='Edit User', style='width: 80px;')
  7. .admin-header-title
  8. .headline.blue--text.text--darken-2.animated.fadeInLeft Edit User
  9. .subtitle-1.grey--text.animated.fadeInLeft.wait-p2s {{user.name}}
  10. v-spacer
  11. .caption.grey--text.animated.fadeInRight.wait-p5s ID #[strong {{user.id}}]
  12. v-divider.animated.fadeInRight.wait-p3s.ml-3(vertical)
  13. v-btn.ml-3.animated.fadeInDown.wait-p2s(color='grey', large, outlined, to='/users')
  14. v-icon mdi-arrow-left
  15. v-dialog(v-model='deleteUserDialog', max-width='500', v-if='user.id !== currentUserId && !user.isSystem')
  16. template(v-slot:activator='{ on }')
  17. v-btn.ml-3.animated.fadeInDown.wait-p1s(color='red', large, outlined, v-on='on', disabled)
  18. v-icon(color='red') mdi-trash-can-outline
  19. v-card
  20. .dialog-header.is-red Delete User?
  21. v-card-text Are you sure you want to delete user #[strong {{ user.name }}]?
  22. v-card-actions
  23. v-spacer
  24. v-btn(text, @click='deleteUserDialog = false') Cancel
  25. v-btn(color='red', dark, @click='deleteUser') Delete
  26. v-btn.ml-3.animated.fadeInDown(color='primary', large, depressed, @click='updateUser')
  27. v-icon(left) mdi-check
  28. span Update User
  29. v-flex(xs6)
  30. v-card.animated.fadeInUp
  31. v-toolbar(color='primary', dense, dark, flat)
  32. v-icon.mr-2 mdi-information-variant
  33. span Basic Info
  34. v-list.py-0(two-line, dense)
  35. v-list-item
  36. v-list-item-avatar(size='32')
  37. v-icon mdi-email-variant
  38. v-list-item-content
  39. v-list-item-title Email
  40. v-list-item-subtitle {{ user.email }}
  41. v-list-item-action(v-if='!user.isSystem')
  42. v-menu(
  43. v-model='editPop.email'
  44. :close-on-content-click='false'
  45. min-width='350'
  46. left
  47. )
  48. template(v-slot:activator='{ on }')
  49. v-btn(icon, color='grey', x-small, v-on='on', @click='focusField(`iptEmail`)')
  50. v-icon mdi-pencil
  51. v-card
  52. v-text-field(
  53. ref='iptEmail'
  54. v-model='user.email'
  55. label='Email'
  56. solo
  57. hide-details
  58. append-icon='mdi-check'
  59. @click:append='editPop.email = false'
  60. @keydown.enter='editPop.email = false'
  61. @keydown.esc='editPop.email = false'
  62. )
  63. v-divider
  64. v-list-item
  65. v-list-item-avatar(size='32')
  66. v-icon mdi-account
  67. v-list-item-content
  68. v-list-item-title Display Name
  69. v-list-item-subtitle {{ user.name }}
  70. v-list-item-action
  71. v-menu(
  72. v-model='editPop.name'
  73. :close-on-content-click='false'
  74. min-width='350'
  75. left
  76. )
  77. template(v-slot:activator='{ on }')
  78. v-btn(icon, color='grey', x-small, v-on='on', @click='focusField(`iptDisplayName`)')
  79. v-icon mdi-pencil
  80. v-card
  81. v-text-field(
  82. ref='iptDisplayName'
  83. v-model='user.name'
  84. label='Display Name'
  85. solo
  86. hide-details
  87. append-icon='mdi-check'
  88. @click:append='editPop.name = false'
  89. @keydown.enter='editPop.name = false'
  90. @keydown.esc='editPop.name = false'
  91. )
  92. v-card.mt-3.animated.fadeInUp.wait-p2s(v-if='!user.isSystem')
  93. v-toolbar(color='primary', dense, dark, flat)
  94. v-icon.mr-2 mdi-lock-outline
  95. span Authentication
  96. v-list.py-0(two-line, dense)
  97. v-list-item
  98. v-list-item-avatar(size='32')
  99. v-icon mdi-domain
  100. v-list-item-content
  101. v-list-item-title Provider
  102. v-list-item-subtitle {{ user.providerKey }}
  103. //- v-list-item-action
  104. //- v-img(src='https://static.requarks.io/logo/wikijs.svg', alt='', contain, max-height='32', position='center right')
  105. template(v-if='user.providerKey === `local`')
  106. v-divider
  107. v-list-item
  108. v-list-item-avatar(size='32')
  109. v-icon mdi-textbox-password
  110. v-list-item-content
  111. v-list-item-title Password
  112. v-list-item-subtitle &bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;
  113. v-list-item-action
  114. v-menu(
  115. v-model='editPop.newPassword'
  116. :close-on-content-click='false'
  117. min-width='350'
  118. left
  119. )
  120. template(v-slot:activator='{ on: menu }')
  121. v-tooltip(top)
  122. template(v-slot:activator='{ on: tooltip }')
  123. v-btn(icon, color='grey', x-small, v-on='{ ...menu, ...tooltip }', @click='focusField(`iptNewPassword`)')
  124. v-icon mdi-cached
  125. span Change Password
  126. v-card
  127. v-text-field(
  128. ref='iptNewPassword'
  129. v-model='newPassword'
  130. label='New Password'
  131. solo
  132. hide-details
  133. append-icon='mdi-check'
  134. type='password'
  135. @click:append='editPop.newPassword = false'
  136. @keydown.enter='editPop.newPassword = false'
  137. @keydown.esc='editPop.newPassword = false'
  138. )
  139. v-list-item-action
  140. v-tooltip(top)
  141. template(v-slot:activator='{ on }')
  142. v-btn(icon, color='grey', x-small, v-on='on', disabled)
  143. v-icon mdi-email
  144. span Send Password Reset Email
  145. v-divider
  146. v-list-item
  147. v-list-item-avatar(size='32')
  148. v-icon mdi-two-factor-authentication
  149. v-list-item-content
  150. v-list-item-title Two Factor Authentication (2FA)
  151. v-list-item-subtitle.red--text Inactive
  152. v-list-item-action
  153. v-tooltip(top)
  154. template(v-slot:activator='{ on }')
  155. v-btn(icon, color='grey', x-small, v-on='on', disabled)
  156. v-icon mdi-power
  157. span Toggle 2FA
  158. template(v-if='user.providerId')
  159. v-divider
  160. v-list-item
  161. v-list-item-avatar(size='32')
  162. v-icon mdi-account
  163. v-list-item-content
  164. v-list-item-title Provider Id
  165. v-list-item-subtitle {{ user.providerId }}
  166. v-card.mt-3.animated.fadeInUp.wait-p4s
  167. v-toolbar(color='primary', dense, dark, flat)
  168. v-icon.mr-2 mdi-account-group
  169. span User Groups
  170. v-list(dense)
  171. template(v-for='(group, idx) in user.groups')
  172. v-list-item(:key='`group-` + group.id')
  173. v-list-item-avatar(size='32')
  174. v-icon mdi-account-group-outline
  175. v-list-item-content
  176. v-list-item-title {{group.name}}
  177. v-list-item-action(v-if='!user.isSystem')
  178. v-btn(icon, color='red', x-small, @click='unassignGroup(group.id)')
  179. v-icon mdi-close
  180. v-divider(v-if='idx < user.groups.length - 1')
  181. v-alert.mx-3(v-if='user.groups.length < 1', outlined, color='grey darken-1', icon='mdi-alert')
  182. .caption This user is not assigned to any group yet. You must assign at least 1 group to a user.
  183. v-card-chin(v-if='!user.isSystem')
  184. v-spacer
  185. v-select(
  186. ref='iptAssignGroup'
  187. :items='groups'
  188. v-model='newGroup'
  189. label='Select Group...'
  190. item-value='id'
  191. item-text='name'
  192. item-disabled='isSystem'
  193. solo
  194. flat
  195. dense
  196. hide-details
  197. @keydown.esc='editPop.assignGroup = false'
  198. style='max-width: 300px;'
  199. )
  200. v-btn.ml-2.px-4(depressed, color='primary', height='48', @click='assignGroup', :disabled='newGroup === 0')
  201. v-icon(left) mdi-clipboard-account-outline
  202. span Assign
  203. v-flex(xs6)
  204. v-card.animated.fadeInUp.wait-p2s
  205. v-toolbar(color='primary', dense, dark, flat)
  206. v-icon.mr-2 mdi-account-badge-outline
  207. span Extended Metadata
  208. v-list.py-0(two-line, dense)
  209. v-list-item
  210. v-list-item-avatar(size='32')
  211. v-icon mdi-map-marker
  212. v-list-item-content
  213. v-list-item-title Location
  214. v-list-item-subtitle {{ user.location }}
  215. v-list-item-action
  216. v-menu(
  217. v-model='editPop.location'
  218. :close-on-content-click='false'
  219. min-width='350'
  220. left
  221. )
  222. template(v-slot:activator='{ on }')
  223. v-btn(icon, color='grey', x-small, v-on='on', @click='focusField(`iptLocation`)')
  224. v-icon mdi-pencil
  225. v-card
  226. v-text-field(
  227. ref='iptLocation'
  228. v-model='user.location'
  229. label='Location'
  230. solo
  231. hide-details
  232. append-icon='mdi-check'
  233. @click:append='editPop.location = false'
  234. @keydown.enter='editPop.location = false'
  235. @keydown.esc='editPop.location = false'
  236. )
  237. v-divider
  238. v-list-item
  239. v-list-item-avatar(size='32')
  240. v-icon mdi-account-badge-horizontal-outline
  241. v-list-item-content
  242. v-list-item-title Job Title
  243. v-list-item-subtitle {{ user.jobTitle }}
  244. v-list-item-action
  245. v-menu(
  246. v-model='editPop.jobTitle'
  247. :close-on-content-click='false'
  248. min-width='350'
  249. left
  250. )
  251. template(v-slot:activator='{ on }')
  252. v-btn(icon, color='grey', x-small, v-on='on', @click='focusField(`iptJobTitle`)')
  253. v-icon mdi-pencil
  254. v-card
  255. v-text-field(
  256. ref='iptJobTitle'
  257. v-model='user.jobTitle'
  258. label='Job Title'
  259. solo
  260. hide-details
  261. append-icon='mdi-check'
  262. @click:append='editPop.jobTitle = false'
  263. @keydown.enter='editPop.jobTitle = false'
  264. @keydown.esc='editPop.jobTitle = false'
  265. )
  266. v-divider
  267. v-list-item
  268. v-list-item-avatar(size='32')
  269. v-icon mdi-map-clock-outline
  270. v-list-item-content
  271. v-list-item-title Timezone
  272. v-list-item-subtitle {{ user.timezone }}
  273. v-list-item-action
  274. v-menu(
  275. v-model='editPop.timezone'
  276. :close-on-content-click='false'
  277. min-width='350'
  278. left
  279. )
  280. template(v-slot:activator='{ on }')
  281. v-btn(icon, color='grey', x-small, v-on='on', @click='focusField(`iptTimezone`)')
  282. v-icon mdi-pencil
  283. v-card
  284. v-select(
  285. ref='iptTimezone'
  286. :items='timezones'
  287. v-model='user.timezone'
  288. label='Timezone'
  289. solo
  290. dense
  291. hide-details
  292. append-icon='mdi-check'
  293. @click:append='editPop.timezone = false'
  294. @keydown.enter='editPop.timezone = false'
  295. @keydown.esc='editPop.timezone = false'
  296. )
  297. v-card.mt-3.animated.fadeInUp.wait-p4s
  298. v-toolbar(color='primary', dense, dark, flat)
  299. v-icon.mr-2 mdi-file-document-box-multiple-outline
  300. span Content
  301. v-card-text
  302. em.caption.grey--text Coming soon
  303. </template>
  304. <script>
  305. import _ from 'lodash'
  306. import { get } from 'vuex-pathify'
  307. import userQuery from 'gql/admin/users/users-query-single.gql'
  308. import groupsQuery from 'gql/admin/users/users-query-groups.gql'
  309. import updateUserMutation from 'gql/admin/users/users-mutation-update.gql'
  310. export default {
  311. data() {
  312. return {
  313. deleteUserDialog: false,
  314. editPop: {
  315. email: false,
  316. name: false,
  317. pwd: false,
  318. location: false,
  319. jobTitle: false,
  320. timezone: false,
  321. newPassword: false,
  322. assignGroup: false
  323. },
  324. newGroup: 0,
  325. newPassword: '',
  326. user: {
  327. email: '',
  328. name: '',
  329. location: '',
  330. jobTitle: '',
  331. timezone: '',
  332. groups: []
  333. },
  334. timezones: [
  335. { text: '(GMT-11:00) Niue', value: 'Pacific/Niue' },
  336. { text: '(GMT-11:00) Pago Pago', value: 'Pacific/Pago_Pago' },
  337. { text: '(GMT-10:00) Hawaii Time', value: 'Pacific/Honolulu' },
  338. { text: '(GMT-10:00) Rarotonga', value: 'Pacific/Rarotonga' },
  339. { text: '(GMT-10:00) Tahiti', value: 'Pacific/Tahiti' },
  340. { text: '(GMT-09:30) Marquesas', value: 'Pacific/Marquesas' },
  341. { text: '(GMT-09:00) Alaska Time', value: 'America/Anchorage' },
  342. { text: '(GMT-09:00) Gambier', value: 'Pacific/Gambier' },
  343. { text: '(GMT-08:00) Pacific Time', value: 'America/Los_Angeles' },
  344. { text: '(GMT-08:00) Pacific Time - Tijuana', value: 'America/Tijuana' },
  345. { text: '(GMT-08:00) Pacific Time - Vancouver', value: 'America/Vancouver' },
  346. { text: '(GMT-08:00) Pacific Time - Whitehorse', value: 'America/Whitehorse' },
  347. { text: '(GMT-08:00) Pitcairn', value: 'Pacific/Pitcairn' },
  348. { text: '(GMT-07:00) Mountain Time', value: 'America/Denver' },
  349. { text: '(GMT-07:00) Mountain Time - Arizona', value: 'America/Phoenix' },
  350. { text: '(GMT-07:00) Mountain Time - Chihuahua, Mazatlan', value: 'America/Mazatlan' },
  351. { text: '(GMT-07:00) Mountain Time - Dawson Creek', value: 'America/Dawson_Creek' },
  352. { text: '(GMT-07:00) Mountain Time - Edmonton', value: 'America/Edmonton' },
  353. { text: '(GMT-07:00) Mountain Time - Hermosillo', value: 'America/Hermosillo' },
  354. { text: '(GMT-07:00) Mountain Time - Yellowknife', value: 'America/Yellowknife' },
  355. { text: '(GMT-06:00) Belize', value: 'America/Belize' },
  356. { text: '(GMT-06:00) Central Time', value: 'America/Chicago' },
  357. { text: '(GMT-06:00) Central Time - Mexico City', value: 'America/Mexico_City' },
  358. { text: '(GMT-06:00) Central Time - Regina', value: 'America/Regina' },
  359. { text: '(GMT-06:00) Central Time - Tegucigalpa', value: 'America/Tegucigalpa' },
  360. { text: '(GMT-06:00) Central Time - Winnipeg', value: 'America/Winnipeg' },
  361. { text: '(GMT-06:00) Costa Rica', value: 'America/Costa_Rica' },
  362. { text: '(GMT-06:00) El Salvador', value: 'America/El_Salvador' },
  363. { text: '(GMT-06:00) Galapagos', value: 'Pacific/Galapagos' },
  364. { text: '(GMT-06:00) Guatemala', value: 'America/Guatemala' },
  365. { text: '(GMT-06:00) Managua', value: 'America/Managua' },
  366. { text: '(GMT-05:00) America Cancun', value: 'America/Cancun' },
  367. { text: '(GMT-05:00) Bogota', value: 'America/Bogota' },
  368. { text: '(GMT-05:00) Easter Island', value: 'Pacific/Easter' },
  369. { text: '(GMT-05:00) Eastern Time', value: 'America/New_York' },
  370. { text: '(GMT-05:00) Eastern Time - Iqaluit', value: 'America/Iqaluit' },
  371. { text: '(GMT-05:00) Eastern Time - Toronto', value: 'America/Toronto' },
  372. { text: '(GMT-05:00) Guayaquil', value: 'America/Guayaquil' },
  373. { text: '(GMT-05:00) Havana', value: 'America/Havana' },
  374. { text: '(GMT-05:00) Jamaica', value: 'America/Jamaica' },
  375. { text: '(GMT-05:00) Lima', value: 'America/Lima' },
  376. { text: '(GMT-05:00) Nassau', value: 'America/Nassau' },
  377. { text: '(GMT-05:00) Panama', value: 'America/Panama' },
  378. { text: '(GMT-05:00) Port-au-Prince', value: 'America/Port-au-Prince' },
  379. { text: '(GMT-05:00) Rio Branco', value: 'America/Rio_Branco' },
  380. { text: '(GMT-04:00) Atlantic Time - Halifax', value: 'America/Halifax' },
  381. { text: '(GMT-04:00) Barbados', value: 'America/Barbados' },
  382. { text: '(GMT-04:00) Bermuda', value: 'Atlantic/Bermuda' },
  383. { text: '(GMT-04:00) Boa Vista', value: 'America/Boa_Vista' },
  384. { text: '(GMT-04:00) Caracas', value: 'America/Caracas' },
  385. { text: '(GMT-04:00) Curacao', value: 'America/Curacao' },
  386. { text: '(GMT-04:00) Grand Turk', value: 'America/Grand_Turk' },
  387. { text: '(GMT-04:00) Guyana', value: 'America/Guyana' },
  388. { text: '(GMT-04:00) La Paz', value: 'America/La_Paz' },
  389. { text: '(GMT-04:00) Manaus', value: 'America/Manaus' },
  390. { text: '(GMT-04:00) Martinique', value: 'America/Martinique' },
  391. { text: '(GMT-04:00) Port of Spain', value: 'America/Port_of_Spain' },
  392. { text: '(GMT-04:00) Porto Velho', value: 'America/Porto_Velho' },
  393. { text: '(GMT-04:00) Puerto Rico', value: 'America/Puerto_Rico' },
  394. { text: '(GMT-04:00) Santo Domingo', value: 'America/Santo_Domingo' },
  395. { text: '(GMT-04:00) Thule', value: 'America/Thule' },
  396. { text: '(GMT-03:30) Newfoundland Time - St. Johns', value: 'America/St_Johns' },
  397. { text: '(GMT-03:00) Araguaina', value: 'America/Araguaina' },
  398. { text: '(GMT-03:00) Asuncion', value: 'America/Asuncion' },
  399. { text: '(GMT-03:00) Belem', value: 'America/Belem' },
  400. { text: '(GMT-03:00) Buenos Aires', value: 'America/Argentina/Buenos_Aires' },
  401. { text: '(GMT-03:00) Campo Grande', value: 'America/Campo_Grande' },
  402. { text: '(GMT-03:00) Cayenne', value: 'America/Cayenne' },
  403. { text: '(GMT-03:00) Cuiaba', value: 'America/Cuiaba' },
  404. { text: '(GMT-03:00) Fortaleza', value: 'America/Fortaleza' },
  405. { text: '(GMT-03:00) Godthab', value: 'America/Godthab' },
  406. { text: '(GMT-03:00) Maceio', value: 'America/Maceio' },
  407. { text: '(GMT-03:00) Miquelon', value: 'America/Miquelon' },
  408. { text: '(GMT-03:00) Montevideo', value: 'America/Montevideo' },
  409. { text: '(GMT-03:00) Palmer', value: 'Antarctica/Palmer' },
  410. { text: '(GMT-03:00) Paramaribo', value: 'America/Paramaribo' },
  411. { text: '(GMT-03:00) Punta Arenas', value: 'America/Punta_Arenas' },
  412. { text: '(GMT-03:00) Recife', value: 'America/Recife' },
  413. { text: '(GMT-03:00) Rothera', value: 'Antarctica/Rothera' },
  414. { text: '(GMT-03:00) Salvador', value: 'America/Bahia' },
  415. { text: '(GMT-03:00) Santiago', value: 'America/Santiago' },
  416. { text: '(GMT-03:00) Stanley', value: 'Atlantic/Stanley' },
  417. { text: '(GMT-02:00) Noronha', value: 'America/Noronha' },
  418. { text: '(GMT-02:00) Sao Paulo', value: 'America/Sao_Paulo' },
  419. { text: '(GMT-02:00) South Georgia', value: 'Atlantic/South_Georgia' },
  420. { text: '(GMT-01:00) Azores', value: 'Atlantic/Azores' },
  421. { text: '(GMT-01:00) Cape Verde', value: 'Atlantic/Cape_Verde' },
  422. { text: '(GMT-01:00) Scoresbysund', value: 'America/Scoresbysund' },
  423. { text: '(GMT+00:00) Abidjan', value: 'Africa/Abidjan' },
  424. { text: '(GMT+00:00) Accra', value: 'Africa/Accra' },
  425. { text: '(GMT+00:00) Bissau', value: 'Africa/Bissau' },
  426. { text: '(GMT+00:00) Canary Islands', value: 'Atlantic/Canary' },
  427. { text: '(GMT+00:00) Casablanca', value: 'Africa/Casablanca' },
  428. { text: '(GMT+00:00) Danmarkshavn', value: 'America/Danmarkshavn' },
  429. { text: '(GMT+00:00) Dublin', value: 'Europe/Dublin' },
  430. { text: '(GMT+00:00) El Aaiun', value: 'Africa/El_Aaiun' },
  431. { text: '(GMT+00:00) Faeroe', value: 'Atlantic/Faroe' },
  432. { text: '(GMT+00:00) GMT (no daylight saving)', value: 'Etc/GMT' },
  433. { text: '(GMT+00:00) Lisbon', value: 'Europe/Lisbon' },
  434. { text: '(GMT+00:00) London', value: 'Europe/London' },
  435. { text: '(GMT+00:00) Monrovia', value: 'Africa/Monrovia' },
  436. { text: '(GMT+00:00) Reykjavik', value: 'Atlantic/Reykjavik' },
  437. { text: '(GMT+01:00) Algiers', value: 'Africa/Algiers' },
  438. { text: '(GMT+01:00) Amsterdam', value: 'Europe/Amsterdam' },
  439. { text: '(GMT+01:00) Andorra', value: 'Europe/Andorra' },
  440. { text: '(GMT+01:00) Berlin', value: 'Europe/Berlin' },
  441. { text: '(GMT+01:00) Brussels', value: 'Europe/Brussels' },
  442. { text: '(GMT+01:00) Budapest', value: 'Europe/Budapest' },
  443. { text: '(GMT+01:00) Central European Time - Belgrade', value: 'Europe/Belgrade' },
  444. { text: '(GMT+01:00) Central European Time - Prague', value: 'Europe/Prague' },
  445. { text: '(GMT+01:00) Ceuta', value: 'Africa/Ceuta' },
  446. { text: '(GMT+01:00) Copenhagen', value: 'Europe/Copenhagen' },
  447. { text: '(GMT+01:00) Gibraltar', value: 'Europe/Gibraltar' },
  448. { text: '(GMT+01:00) Lagos', value: 'Africa/Lagos' },
  449. { text: '(GMT+01:00) Luxembourg', value: 'Europe/Luxembourg' },
  450. { text: '(GMT+01:00) Madrid', value: 'Europe/Madrid' },
  451. { text: '(GMT+01:00) Malta', value: 'Europe/Malta' },
  452. { text: '(GMT+01:00) Monaco', value: 'Europe/Monaco' },
  453. { text: '(GMT+01:00) Ndjamena', value: 'Africa/Ndjamena' },
  454. { text: '(GMT+01:00) Oslo', value: 'Europe/Oslo' },
  455. { text: '(GMT+01:00) Paris', value: 'Europe/Paris' },
  456. { text: '(GMT+01:00) Rome', value: 'Europe/Rome' },
  457. { text: '(GMT+01:00) Stockholm', value: 'Europe/Stockholm' },
  458. { text: '(GMT+01:00) Tirane', value: 'Europe/Tirane' },
  459. { text: '(GMT+01:00) Tunis', value: 'Africa/Tunis' },
  460. { text: '(GMT+01:00) Vienna', value: 'Europe/Vienna' },
  461. { text: '(GMT+01:00) Warsaw', value: 'Europe/Warsaw' },
  462. { text: '(GMT+01:00) Zurich', value: 'Europe/Zurich' },
  463. { text: '(GMT+02:00) Amman', value: 'Asia/Amman' },
  464. { text: '(GMT+02:00) Athens', value: 'Europe/Athens' },
  465. { text: '(GMT+02:00) Beirut', value: 'Asia/Beirut' },
  466. { text: '(GMT+02:00) Bucharest', value: 'Europe/Bucharest' },
  467. { text: '(GMT+02:00) Cairo', value: 'Africa/Cairo' },
  468. { text: '(GMT+02:00) Chisinau', value: 'Europe/Chisinau' },
  469. { text: '(GMT+02:00) Damascus', value: 'Asia/Damascus' },
  470. { text: '(GMT+02:00) Gaza', value: 'Asia/Gaza' },
  471. { text: '(GMT+02:00) Helsinki', value: 'Europe/Helsinki' },
  472. { text: '(GMT+02:00) Jerusalem', value: 'Asia/Jerusalem' },
  473. { text: '(GMT+02:00) Johannesburg', value: 'Africa/Johannesburg' },
  474. { text: '(GMT+02:00) Khartoum', value: 'Africa/Khartoum' },
  475. { text: '(GMT+02:00) Kiev', value: 'Europe/Kiev' },
  476. { text: '(GMT+02:00) Maputo', value: 'Africa/Maputo' },
  477. { text: '(GMT+02:00) Moscow-01 - Kaliningrad', value: 'Europe/Kaliningrad' },
  478. { text: '(GMT+02:00) Nicosia', value: 'Asia/Nicosia' },
  479. { text: '(GMT+02:00) Riga', value: 'Europe/Riga' },
  480. { text: '(GMT+02:00) Sofia', value: 'Europe/Sofia' },
  481. { text: '(GMT+02:00) Tallinn', value: 'Europe/Tallinn' },
  482. { text: '(GMT+02:00) Tripoli', value: 'Africa/Tripoli' },
  483. { text: '(GMT+02:00) Vilnius', value: 'Europe/Vilnius' },
  484. { text: '(GMT+02:00) Windhoek', value: 'Africa/Windhoek' },
  485. { text: '(GMT+03:00) Baghdad', value: 'Asia/Baghdad' },
  486. { text: '(GMT+03:00) Istanbul', value: 'Europe/Istanbul' },
  487. { text: '(GMT+03:00) Minsk', value: 'Europe/Minsk' },
  488. { text: '(GMT+03:00) Moscow+00 - Moscow', value: 'Europe/Moscow' },
  489. { text: '(GMT+03:00) Nairobi', value: 'Africa/Nairobi' },
  490. { text: '(GMT+03:00) Qatar', value: 'Asia/Qatar' },
  491. { text: '(GMT+03:00) Riyadh', value: 'Asia/Riyadh' },
  492. { text: '(GMT+03:00) Syowa', value: 'Antarctica/Syowa' },
  493. { text: '(GMT+03:30) Tehran', value: 'Asia/Tehran' },
  494. { text: '(GMT+04:00) Baku', value: 'Asia/Baku' },
  495. { text: '(GMT+04:00) Dubai', value: 'Asia/Dubai' },
  496. { text: '(GMT+04:00) Mahe', value: 'Indian/Mahe' },
  497. { text: '(GMT+04:00) Mauritius', value: 'Indian/Mauritius' },
  498. { text: '(GMT+04:00) Moscow+01 - Samara', value: 'Europe/Samara' },
  499. { text: '(GMT+04:00) Reunion', value: 'Indian/Reunion' },
  500. { text: '(GMT+04:00) Tbilisi', value: 'Asia/Tbilisi' },
  501. { text: '(GMT+04:00) Yerevan', value: 'Asia/Yerevan' },
  502. { text: '(GMT+04:30) Kabul', value: 'Asia/Kabul' },
  503. { text: '(GMT+05:00) Aqtau', value: 'Asia/Aqtau' },
  504. { text: '(GMT+05:00) Aqtobe', value: 'Asia/Aqtobe' },
  505. { text: '(GMT+05:00) Ashgabat', value: 'Asia/Ashgabat' },
  506. { text: '(GMT+05:00) Dushanbe', value: 'Asia/Dushanbe' },
  507. { text: '(GMT+05:00) Karachi', value: 'Asia/Karachi' },
  508. { text: '(GMT+05:00) Kerguelen', value: 'Indian/Kerguelen' },
  509. { text: '(GMT+05:00) Maldives', value: 'Indian/Maldives' },
  510. { text: '(GMT+05:00) Mawson', value: 'Antarctica/Mawson' },
  511. { text: '(GMT+05:00) Moscow+02 - Yekaterinburg', value: 'Asia/Yekaterinburg' },
  512. { text: '(GMT+05:00) Tashkent', value: 'Asia/Tashkent' },
  513. { text: '(GMT+05:30) Colombo', value: 'Asia/Colombo' },
  514. { text: '(GMT+05:30) India Standard Time', value: 'Asia/Kolkata' },
  515. { text: '(GMT+05:45) Kathmandu', value: 'Asia/Kathmandu' },
  516. { text: '(GMT+06:00) Almaty', value: 'Asia/Almaty' },
  517. { text: '(GMT+06:00) Bishkek', value: 'Asia/Bishkek' },
  518. { text: '(GMT+06:00) Chagos', value: 'Indian/Chagos' },
  519. { text: '(GMT+06:00) Dhaka', value: 'Asia/Dhaka' },
  520. { text: '(GMT+06:00) Moscow+03 - Omsk', value: 'Asia/Omsk' },
  521. { text: '(GMT+06:00) Thimphu', value: 'Asia/Thimphu' },
  522. { text: '(GMT+06:00) Vostok', value: 'Antarctica/Vostok' },
  523. { text: '(GMT+06:30) Cocos', value: 'Indian/Cocos' },
  524. { text: '(GMT+06:30) Rangoon', value: 'Asia/Yangon' },
  525. { text: '(GMT+07:00) Bangkok', value: 'Asia/Bangkok' },
  526. { text: '(GMT+07:00) Christmas', value: 'Indian/Christmas' },
  527. { text: '(GMT+07:00) Davis', value: 'Antarctica/Davis' },
  528. { text: '(GMT+07:00) Hanoi', value: 'Asia/Saigon' },
  529. { text: '(GMT+07:00) Hovd', value: 'Asia/Hovd' },
  530. { text: '(GMT+07:00) Jakarta', value: 'Asia/Jakarta' },
  531. { text: '(GMT+07:00) Moscow+04 - Krasnoyarsk', value: 'Asia/Krasnoyarsk' },
  532. { text: '(GMT+08:00) Brunei', value: 'Asia/Brunei' },
  533. { text: '(GMT+08:00) China Time - Beijing', value: 'Asia/Shanghai' },
  534. { text: '(GMT+08:00) Choibalsan', value: 'Asia/Choibalsan' },
  535. { text: '(GMT+08:00) Hong Kong', value: 'Asia/Hong_Kong' },
  536. { text: '(GMT+08:00) Kuala Lumpur', value: 'Asia/Kuala_Lumpur' },
  537. { text: '(GMT+08:00) Macau', value: 'Asia/Macau' },
  538. { text: '(GMT+08:00) Makassar', value: 'Asia/Makassar' },
  539. { text: '(GMT+08:00) Manila', value: 'Asia/Manila' },
  540. { text: '(GMT+08:00) Moscow+05 - Irkutsk', value: 'Asia/Irkutsk' },
  541. { text: '(GMT+08:00) Singapore', value: 'Asia/Singapore' },
  542. { text: '(GMT+08:00) Taipei', value: 'Asia/Taipei' },
  543. { text: '(GMT+08:00) Ulaanbaatar', value: 'Asia/Ulaanbaatar' },
  544. { text: '(GMT+08:00) Western Time - Perth', value: 'Australia/Perth' },
  545. { text: '(GMT+08:30) Pyongyang', value: 'Asia/Pyongyang' },
  546. { text: '(GMT+09:00) Dili', value: 'Asia/Dili' },
  547. { text: '(GMT+09:00) Jayapura', value: 'Asia/Jayapura' },
  548. { text: '(GMT+09:00) Moscow+06 - Yakutsk', value: 'Asia/Yakutsk' },
  549. { text: '(GMT+09:00) Palau', value: 'Pacific/Palau' },
  550. { text: '(GMT+09:00) Seoul', value: 'Asia/Seoul' },
  551. { text: '(GMT+09:00) Tokyo', value: 'Asia/Tokyo' },
  552. { text: '(GMT+09:30) Central Time - Darwin', value: 'Australia/Darwin' },
  553. { text: '(GMT+10:00) Dumont D\'Urville', value: 'Antarctica/DumontDUrville' },
  554. { text: '(GMT+10:00) Eastern Time - Brisbane', value: 'Australia/Brisbane' },
  555. { text: '(GMT+10:00) Guam', value: 'Pacific/Guam' },
  556. { text: '(GMT+10:00) Moscow+07 - Vladivostok', value: 'Asia/Vladivostok' },
  557. { text: '(GMT+10:00) Port Moresby', value: 'Pacific/Port_Moresby' },
  558. { text: '(GMT+10:00) Truk', value: 'Pacific/Chuuk' },
  559. { text: '(GMT+10:30) Central Time - Adelaide', value: 'Australia/Adelaide' },
  560. { text: '(GMT+11:00) Casey', value: 'Antarctica/Casey' },
  561. { text: '(GMT+11:00) Eastern Time - Hobart', value: 'Australia/Hobart' },
  562. { text: '(GMT+11:00) Eastern Time - Melbourne, Sydney', value: 'Australia/Sydney' },
  563. { text: '(GMT+11:00) Efate', value: 'Pacific/Efate' },
  564. { text: '(GMT+11:00) Guadalcanal', value: 'Pacific/Guadalcanal' },
  565. { text: '(GMT+11:00) Kosrae', value: 'Pacific/Kosrae' },
  566. { text: '(GMT+11:00) Moscow+08 - Magadan', value: 'Asia/Magadan' },
  567. { text: '(GMT+11:00) Norfolk', value: 'Pacific/Norfolk' },
  568. { text: '(GMT+11:00) Noumea', value: 'Pacific/Noumea' },
  569. { text: '(GMT+11:00) Ponape', value: 'Pacific/Pohnpei' },
  570. { text: '(GMT+12:00) Funafuti', value: 'Pacific/Funafuti' },
  571. { text: '(GMT+12:00) Kwajalein', value: 'Pacific/Kwajalein' },
  572. { text: '(GMT+12:00) Majuro', value: 'Pacific/Majuro' },
  573. { text: '(GMT+12:00) Moscow+09 - Petropavlovsk-Kamchatskiy', value: 'Asia/Kamchatka' },
  574. { text: '(GMT+12:00) Nauru', value: 'Pacific/Nauru' },
  575. { text: '(GMT+12:00) Tarawa', value: 'Pacific/Tarawa' },
  576. { text: '(GMT+12:00) Wake', value: 'Pacific/Wake' },
  577. { text: '(GMT+12:00) Wallis', value: 'Pacific/Wallis' },
  578. { text: '(GMT+13:00) Auckland', value: 'Pacific/Auckland' },
  579. { text: '(GMT+13:00) Enderbury', value: 'Pacific/Enderbury' },
  580. { text: '(GMT+13:00) Fakaofo', value: 'Pacific/Fakaofo' },
  581. { text: '(GMT+13:00) Fiji', value: 'Pacific/Fiji' },
  582. { text: '(GMT+13:00) Tongatapu', value: 'Pacific/Tongatapu' },
  583. { text: '(GMT+14:00) Apia', value: 'Pacific/Apia' },
  584. { text: '(GMT+14:00) Kiritimati', value: 'Pacific/Kiritimati' }
  585. ]
  586. }
  587. },
  588. computed: {
  589. currentUserId: get('user/id')
  590. },
  591. methods: {
  592. deleteUser() {},
  593. async updateUser() {
  594. this.$store.commit(`loadingStart`, 'admin-users-update')
  595. const resp = await this.$apollo.mutate({
  596. mutation: updateUserMutation,
  597. variables: {
  598. id: this.user.id,
  599. email: this.user.email,
  600. name: this.user.name,
  601. newPassword: this.newPassword,
  602. groups: _.map(this.user.groups, 'id'),
  603. location: this.user.location,
  604. jobTitle: this.user.jobTitle,
  605. timezone: this.user.timezone
  606. }
  607. })
  608. if (_.get(resp, 'data.users.update.responseResult.succeeded', false)) {
  609. this.$store.commit('showNotification', {
  610. style: 'success',
  611. message: 'User updated successfully.',
  612. icon: 'check'
  613. })
  614. this.$router.push('/users')
  615. } else {
  616. this.$store.commit('showNotification', {
  617. style: 'red',
  618. message: _.get(resp, 'data.users.update.responseResult.message', 'An unexpected error occured.'),
  619. icon: 'warning'
  620. })
  621. }
  622. this.$store.commit(`loadingStop`, 'admin-users-update')
  623. },
  624. focusField (ipt) {
  625. this.$nextTick(() => {
  626. _.delay(() => {
  627. this.$refs[ipt].focus()
  628. }, 200)
  629. })
  630. },
  631. assignGroup() {
  632. if (_.some(this.user.groups, ['id', this.newGroup])) {
  633. this.$store.commit('showNotification', {
  634. message: 'User is already assigned to this group!',
  635. style: 'error',
  636. icon: 'alert'
  637. })
  638. } else {
  639. this.user.groups.push(_.find(this.groups, ['id', this.newGroup]))
  640. this.newGroup = 0
  641. }
  642. },
  643. unassignGroup(gid) {
  644. this.user.groups = _.reject(this.user.groups, ['id', gid])
  645. }
  646. },
  647. apollo: {
  648. user: {
  649. query: userQuery,
  650. variables() {
  651. return {
  652. id: _.toSafeInteger(this.$route.params.id)
  653. }
  654. },
  655. fetchPolicy: 'network-only',
  656. update: (data) => data.users.single,
  657. watchLoading (isLoading) {
  658. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-users-refresh')
  659. }
  660. },
  661. groups: {
  662. query: groupsQuery,
  663. fetchPolicy: 'network-only',
  664. update: (data) => data.groups.list,
  665. watchLoading (isLoading) {
  666. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-groups-refresh')
  667. }
  668. }
  669. }
  670. }
  671. </script>
  672. <style lang='scss'>
  673. </style>