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.

agentsUserManagementPage.vue 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <!-- eslint-disable max-len -->
  3. <div class="container">
  4. <br />
  5. <br />
  6. <div class="row">
  7. <div class="col-md-12 col-lg-8">
  8. <div class="title-box-d">
  9. <h1 class="title-d" style="text-align:left; font-size: 250%">Agent Management</h1>
  10. </div>
  11. </div>
  12. </div>
  13. <div class="row">
  14. <div class="col-md-2 offset-1">
  15. <button
  16. @click="routerGoTo('/status/userManagementPage')"
  17. type="button"
  18. class="btn btn-b-n"
  19. >Private Users</button>
  20. </div>
  21. <div class="col-md-2 offset-2">
  22. <button type="button" class="btn btn-b-n">Agents</button>
  23. </div>
  24. <div class="col-md-2 offset-2">
  25. <button type="button" class="btn btn-b-n">New Agent</button>
  26. </div>
  27. </div>
  28. <br />
  29. <br />
  30. <div class="container">
  31. <table class="table table-bordered">
  32. <thead>
  33. <tr>
  34. <th>
  35. <b>ID</b>
  36. </th>
  37. <th>
  38. <b>Name</b>
  39. </th>
  40. <th>
  41. <b>Surname</b>
  42. </th>
  43. <th>
  44. <b>Cell Number</b>
  45. </th>
  46. <th>
  47. <b>Telephone Number</b>
  48. </th>
  49. <th>
  50. <b>Email</b>
  51. </th>
  52. <th>
  53. <b>Role</b>
  54. </th>
  55. <th>
  56. <b>Reset Password</b>
  57. </th>
  58. <th></th>
  59. <th></th>
  60. </tr>
  61. </thead>
  62. <tbody>
  63. <tr>
  64. <td colspan="10">
  65. <h5>Agents</h5>
  66. </td>
  67. </tr>
  68. <tr v-for="(item, i) in agents" :key="i">
  69. <td>{{ item.id }}</td>
  70. <td>{{ item.name }}</td>
  71. <td>{{ item.surname }}</td>
  72. <td>{{ item.cellNumber }}</td>
  73. <td>{{ item.telephone }}</td>
  74. <td>{{ item.email }}</td>
  75. <td v-if="item.user">{{ item.user.role }}</td>
  76. <td v-else></td>
  77. <td></td>
  78. <td>
  79. <button
  80. type="button"
  81. @click="Edit(item)"
  82. class="btn"
  83. style="margin:2px; color: #60CBEB"
  84. >Edit</button>
  85. </td>
  86. <td>
  87. <button
  88. type="button"
  89. class="btn"
  90. style="width: 85px; height:40px; color:#60CBEB"
  91. >Delete</button>
  92. </td>
  93. </tr>
  94. </tbody>
  95. </table>
  96. </div>
  97. <br />
  98. </div>
  99. </template>
  100. <script>
  101. import { mapState, mapActions } from 'vuex';
  102. import axios from 'axios';
  103. export default {
  104. name: 'agentManagementPage',
  105. data() {
  106. return {};
  107. },
  108. methods: {
  109. ...mapActions('register', ['getAgents']),
  110. addNewAgent({ commit }) {
  111. axios
  112. .post('/api/agent')
  113. .then(result => commit('saveAgent', result.data))
  114. .catch(console.error);
  115. },
  116. routerGoTo(goTo) {
  117. this.$router.push(goTo);
  118. },
  119. },
  120. mounted() {
  121. this.getAgents();
  122. },
  123. computed: {
  124. ...mapState('register', ['agents']),
  125. },
  126. };
  127. </script>
  128. <style>
  129. </style>