classroomInfo.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <breadcrumbs style="margin-top: 29px; margin-bottom: 19px;" />
  3. <q-card>
  4. <q-tabs v-model="tab"
  5. dense
  6. class="text-grey"
  7. active-color="primary"
  8. indicator-color="primary"
  9. align="justify"
  10. narrow-indicator>
  11. <q-tab name="classroomInfo"
  12. label="اطلاعات دوره آموزشی" />
  13. <q-tab name="educations"
  14. label="جدول آموزشی" />
  15. <q-tab name="movies1"
  16. label="آزمون" />
  17. <q-tab name="movies2"
  18. label="پروژه" />
  19. <q-tab name="movies3"
  20. label="بخش آنلاین" />
  21. </q-tabs>
  22. <q-separator />
  23. <q-tab-panels v-model="tab"
  24. animated>
  25. <q-tab-panel name="classroomInfo">
  26. <show-classroom-info :options="{ profileMode: true }"
  27. @onloadn="onloadnClassroom" />
  28. </q-tab-panel>
  29. <q-tab-panel name="educations">
  30. <entity-index v-if="mounted"
  31. ref="entityIndex"
  32. v-model:value="inputs"
  33. title="لیست جلسات"
  34. :api="api"
  35. :table="table"
  36. :table-keys="tableKeys"
  37. :table-grid-size="$q.screen.lt.sm"
  38. :show-expand-button="false"
  39. :show-reload-button="false"
  40. :show-search-button="false">
  41. <template #entity-index-table-cell="{inputData}">
  42. <template v-if="inputData.col.name === 'action'">
  43. <q-btn size="md"
  44. color="primary"
  45. label="جزییات"
  46. :to="{name: 'UserPanel.Profile.SessionInfo', params: {id: inputData.props.row.id}}" />
  47. </template>
  48. <template v-else>
  49. {{ inputData.col.value }}
  50. </template>
  51. </template>
  52. <template #entity-index-table-item-cell="{inputData}">
  53. <entity-index-grid-item :input-data="inputData">
  54. <template #col="{col, row}">
  55. <template v-if="col.name === 'action'">
  56. <q-btn size="md"
  57. color="primary"
  58. label="جزییات"
  59. :to="{name: 'UserPanel.Profile.SessionInfo', params: {id: row.id}}" />
  60. </template>
  61. </template>
  62. </entity-index-grid-item>
  63. </template>
  64. </entity-index>
  65. </q-tab-panel>
  66. <q-tab-panel name="movies1">
  67. آزمون
  68. </q-tab-panel>
  69. <q-tab-panel name="movies2">
  70. پروژه
  71. </q-tab-panel>
  72. <q-tab-panel name="movies3">
  73. بخش آنلاین
  74. </q-tab-panel>
  75. </q-tab-panels>
  76. </q-card>
  77. </template>
  78. <script>
  79. import { EntityIndex } from 'quasar-crud'
  80. import Enums from 'src/assets/Enums/Enums.js'
  81. import ShamsiDate from 'src/assets/ShamsiDate.js'
  82. import { APIGateway } from 'src/api/APIGateway.js'
  83. import { Classroom } from 'src/models/Classroom.js'
  84. import EntityIndexGridItem from 'src/components/EntityIndexGridItem.vue'
  85. import Breadcrumbs from 'src/components/Widgets/Breadcrumbs/Breadcrumbs.vue'
  86. import ShowClassroomInfo from 'src/components/Widgets/Other/ShowClassroomInfo/ShowClassroomInfo.vue'
  87. export default {
  88. name: 'UserPanel.Profile.ClassroomInfo',
  89. components: {
  90. EntityIndex,
  91. Breadcrumbs,
  92. ShowClassroomInfo,
  93. EntityIndexGridItem
  94. },
  95. data () {
  96. return {
  97. mounted: false,
  98. tab: 'classroomInfo',
  99. inputs: [],
  100. api: null,
  101. classroom: new Classroom(),
  102. table: {
  103. columns: [
  104. {
  105. name: 'id',
  106. required: true,
  107. label: 'شماره',
  108. align: 'left',
  109. field: row => row.id
  110. },
  111. {
  112. name: 'title',
  113. required: true,
  114. label: 'عنوان',
  115. align: 'left',
  116. field: row => row.title
  117. },
  118. {
  119. name: 'title',
  120. required: true,
  121. label: 'زمان شروع',
  122. align: 'left',
  123. field: row => row.starting_time ? ShamsiDate.getDateTime(row.starting_time) : '-'
  124. },
  125. {
  126. name: 'title',
  127. required: true,
  128. label: 'زمان پایان',
  129. align: 'left',
  130. field: row => row.ending_time ? ShamsiDate.getDateTime(row.ending_time) : '-'
  131. },
  132. {
  133. name: 'action',
  134. required: true,
  135. label: 'جزییات',
  136. align: 'left',
  137. field: ''
  138. }
  139. ],
  140. data: []
  141. },
  142. tableKeys: {
  143. data: 'sessions_info',
  144. total: 'count',
  145. currentPage: 'current',
  146. perPage: 'per_page',
  147. pageKey: 'page'
  148. }
  149. }
  150. },
  151. computed: {
  152. selectedCategoryId () {
  153. return this.getInputValue('category')
  154. }
  155. },
  156. watch: {
  157. selectedCategoryId () {
  158. this.setInputValue('unit', null)
  159. this.getUnits(this.selectedCategoryId)
  160. }
  161. },
  162. mounted () {
  163. this.api = APIGateway.classroom.APIAdresses.byId(this.$route.params.id)
  164. this.mounted = true
  165. },
  166. methods: {
  167. onloadnClassroom (classroom) {
  168. this.classroom = new Classroom(classroom)
  169. this.$store.commit('AppLayout/updateBreadcrumbs', {
  170. visible: true,
  171. loading: false,
  172. path: [
  173. {
  174. label: 'دوره های من',
  175. to: { name: 'UserPanel.Profile.AllClassrooms' }
  176. },
  177. {
  178. label: this.classroom.title,
  179. to: { name: 'UserPanel.Profile.ClassroomInfo', params: { id: this.classroom.id } }
  180. }
  181. ]
  182. })
  183. },
  184. search () {
  185. this.$refs.entityIndex.search()
  186. },
  187. getClassroomHoldingTypeTitle (type) {
  188. const target = Enums.classroomHoldingTypes.find(item => item.value === type)
  189. if (!target) {
  190. return '-'
  191. }
  192. return target.label
  193. },
  194. getClassroomStatusTitle (type) {
  195. const target = Enums.classroomStatuses.find(item => item.value === type)
  196. if (!target) {
  197. return '-'
  198. }
  199. return target.label
  200. },
  201. getInvoiceStatusTitle (type) {
  202. const target = Enums.invoiceStatus.find(item => item.value === type)
  203. if (!target) {
  204. return '-'
  205. }
  206. return target.label
  207. },
  208. loadInputDataOptions () {
  209. this.getCategories()
  210. this.getUnits()
  211. },
  212. getInputValue (name) {
  213. const inputIndex = this.inputs.findIndex(input => input.name === name)
  214. if (!this.inputs[inputIndex]) {
  215. return null
  216. }
  217. return this.inputs[inputIndex].value
  218. },
  219. setInputValue (name, value) {
  220. const inputIndex = this.inputs.findIndex(input => input.name === name)
  221. this.inputs[inputIndex].value = value
  222. },
  223. getSelectOptions (result, value, label) {
  224. return result.map(item => {
  225. return {
  226. value: item[value],
  227. label: item[label]
  228. }
  229. })
  230. },
  231. loadSelectOptions (name, value) {
  232. const inputIndex = this.inputs.findIndex(input => input.name === name)
  233. this.inputs[inputIndex].options = value
  234. }
  235. }
  236. }
  237. </script>