LeaderTeamShow.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="LeaderTeamShow"
  3. :style="localOptions.style">
  4. <div class="flex justify-end">
  5. <q-btn flat
  6. color="grey"
  7. @click="$router.go(-1)">
  8. بازگشت
  9. >
  10. </q-btn>
  11. </div>
  12. <entity-show v-if="mounted"
  13. ref="entityShow"
  14. v-model:value="inputs"
  15. title="اطلاعات گروه"
  16. :api="api"
  17. :entity-id-key="entityIdKey"
  18. :entity-param-key="entityParamKey"
  19. :show-close-button="false"
  20. :show-edit-button="false"
  21. :show-expand-button="false"
  22. :show-save-button="false"
  23. :show-reload-button="false"
  24. :redirect-after-edit="false"
  25. :show-index-button="false"
  26. :after-load-input-data="afterLoadInputData" />
  27. <q-separator class="q-my-lg" />
  28. <entity-index v-if="mounted"
  29. ref="teamRegistrationList"
  30. v-model:value="teamRegistrationListInputs"
  31. title="لیست اعضای گروه"
  32. :api="teamRegistrationListApi"
  33. :table="teamRegistrationListTable"
  34. :table-keys="teamRegistrationListTableKeys"
  35. :show-search-button="false"
  36. :show-reload-button="false"
  37. :show-expand-button="false">
  38. <template v-slot:entity-index-table-cell="{inputData}">
  39. <template v-if="inputData.col.name === 'number'">
  40. {{ inputData.rowNumber }}
  41. </template>
  42. <template v-else-if="inputData.col.name === 'actions'">
  43. <div class="action-column-entity-index">
  44. <!-- <delete-btn @click="showConfirmRemoveDialog(inputData.props.row, 'id', getRemoveMessage(inputData.props.row))" />-->
  45. </div>
  46. </template>
  47. <template v-else>
  48. {{ inputData.col.value }}
  49. </template>
  50. </template>
  51. </entity-index>
  52. </div>
  53. </template>
  54. <script>
  55. import { mixinWidget } from 'src/mixin/Mixins.js'
  56. import { APIGateway } from 'src/api/APIGateway.js'
  57. import { EntityShow, EntityIndex } from 'quasar-crud'
  58. export default {
  59. name: 'LeaderTeamShow',
  60. components: {
  61. EntityShow,
  62. EntityIndex
  63. },
  64. mixins: [mixinWidget],
  65. data () {
  66. const teamId = this.$route.params.team_id
  67. return {
  68. mounted: false,
  69. entityLoading: true,
  70. api: APIGateway.team.APIAdresses.byId(teamId),
  71. entityIdKey: 'id',
  72. entityParamKey: 'id',
  73. inputs: [
  74. { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان گروه', placeholder: ' ', col: 'col-md-3 col-12' },
  75. { type: 'input', name: 'capacity', responseKey: 'capacity', label: 'ظرفیت', placeholder: ' ', col: 'col-md-3 col-12' },
  76. { type: 'input', name: 'used_capacity', responseKey: 'used_capacity', label: 'ظرفیت استفاده شده', placeholder: ' ', col: 'col-md-3 col-12' },
  77. { type: 'separator', name: 'space', size: '0', col: 'col-12' },
  78. { type: 'inputEditor', name: 'description', responseKey: 'description', label: 'توضیحات', col: 'col-12' }
  79. ],
  80. teamRegistrationListInputs: [
  81. { type: 'hidden', name: 'team', value: teamId }
  82. ],
  83. teamRegistrationListApi: APIGateway.teamRegistrations.APIAdresses.base,
  84. teamRegistrationListTable: {
  85. columns: [
  86. {
  87. name: 'number',
  88. required: true,
  89. label: 'شماره',
  90. align: 'left',
  91. field: () => ''
  92. },
  93. {
  94. name: 'id',
  95. required: true,
  96. label: 'شناسه',
  97. align: 'left',
  98. field: row => row.registration_info.owner_info.id
  99. },
  100. {
  101. name: 'title',
  102. required: true,
  103. label: 'جنسیت',
  104. align: 'left',
  105. field: row => (row.registration_info.owner_info.gender === 1) ? 'مذکر' : ((row.registration_info.owner_info.gender === 2) ? 'مونث' : '-')
  106. },
  107. {
  108. name: 'creation_time',
  109. required: true,
  110. label: 'نام و نام خانوادگی',
  111. align: 'left',
  112. field: row => row.registration_info.owner_info.firstname + ' ' + row.registration_info.owner_info.lastname
  113. },
  114. {
  115. name: 'creation_time',
  116. required: true,
  117. label: 'کدملی',
  118. align: 'left',
  119. field: row => row.registration_info.owner_info.national_code
  120. },
  121. {
  122. name: 'creation_time',
  123. required: true,
  124. label: 'شماره تلفن',
  125. align: 'left',
  126. field: row => row.registration_info.owner_info.mobile_number
  127. },
  128. {
  129. name: 'creation_time',
  130. required: true,
  131. label: 'دانشگاه',
  132. align: 'left',
  133. field: row => row.registration_info.owner_info.last_academy_name
  134. },
  135. {
  136. name: 'creation_time',
  137. required: true,
  138. label: 'شهر',
  139. align: 'left',
  140. field: row => row.registration_info.owner_info.living_city
  141. },
  142. {
  143. name: 'actions',
  144. required: true,
  145. label: 'عملیات',
  146. align: 'left',
  147. field: ''
  148. }
  149. ]
  150. },
  151. teamRegistrationListTableKeys: {
  152. data: 'results',
  153. total: 'count',
  154. currentPage: 'current',
  155. perPage: 'per_page',
  156. pageKey: 'page'
  157. }
  158. }
  159. },
  160. mounted() {
  161. this.mounted = true
  162. },
  163. methods: {
  164. onConfirmedSelectedRegistrations (data) {
  165. const registrations = data.map(item => item.id)
  166. this.addNewLeaderLoading = true
  167. APIGateway.team.appendRegistrations({ teamId: this.$route.params.team_id, registrations })
  168. .then(() => {
  169. this.$refs.teamRegistrationList.search()
  170. this.addNewLeaderLoading = false
  171. })
  172. .catch(() => {
  173. this.addNewLeaderLoading = false
  174. })
  175. },
  176. afterLoadInputData () {
  177. this.entityLoading = false
  178. },
  179. getRemoveMessage (row) {
  180. return 'آیا از حذف ' + row.registration_info.owner_info.firstname + ' ' + row.registration_info.owner_info.lastname + ' اطمینان دارید؟'
  181. }
  182. }
  183. }
  184. </script>
  185. <style scoped lang="scss">
  186. .LeaderTeamShow {
  187. .title {
  188. font-style: normal;
  189. font-weight: 700;
  190. font-size: 24px;
  191. line-height: 140%;
  192. color: #424242;
  193. margin-bottom: 27px;
  194. display: flex;
  195. flex-flow: row;
  196. position: relative;
  197. .static-title {
  198. }
  199. .dynamic-title {
  200. }
  201. .back-action {
  202. position: absolute;
  203. right: 0;
  204. top: 0;
  205. }
  206. }
  207. :deep(.form) {
  208. padding: 24px;
  209. }
  210. }
  211. </style>