You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

701 lines
35 KiB

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