EventInfo.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <template>
  2. <breadcrumbs style="margin-top: 29px; margin-bottom: 19px;" />
  3. <div class="flex justify-end">
  4. <q-btn flat
  5. color="grey"
  6. @click="$router.go(-1)">
  7. بازگشت
  8. >
  9. </q-btn>
  10. </div>
  11. <q-card>
  12. <q-tabs v-model="tab"
  13. dense
  14. class="text-grey"
  15. active-color="primary"
  16. indicator-color="primary"
  17. align="justify"
  18. narrow-indicator>
  19. <q-tab name="eventInfo"
  20. label="اطلاعات دوره آموزشی" />
  21. <q-tab name="educations"
  22. label="جدول آموزشی" />
  23. <q-tab name="movies1"
  24. label="آزمون" />
  25. <q-tab name="projects"
  26. label="پروژه" />
  27. <q-tab v-if="event.live_streaming_url"
  28. name="live_streaming_url"
  29. label="بخش آنلاین" />
  30. </q-tabs>
  31. <q-separator />
  32. <q-tab-panels v-model="tab"
  33. animated>
  34. <q-tab-panel name="eventInfo">
  35. <show-event-info v-if="mounted"
  36. :options="{ profileMode: true }"
  37. @onloadn="onloadnEvent" />
  38. </q-tab-panel>
  39. <q-tab-panel name="educations"
  40. class="q-pa-none">
  41. <entity-index v-if="mounted"
  42. ref="entityIndex"
  43. v-model:value="sessionsInputs"
  44. title="لیست جلسات"
  45. :api="sessionsApi"
  46. :table="sessionsTable"
  47. :table-keys="sessionsTableKeys"
  48. :table-grid-size="$q.screen.lt.sm"
  49. :show-expand-button="false"
  50. :show-reload-button="false"
  51. :show-search-button="false">
  52. <template #entity-index-table-cell="{inputData}">
  53. <template v-if="inputData.col.name === 'number'">
  54. {{ inputData.rowNumber }}
  55. </template>
  56. <template v-else-if="inputData.col.name === 'action'">
  57. <q-btn size="md"
  58. color="primary"
  59. label="جزییات"
  60. :to="{name: 'UserPanel.Profile.SessionInfo', params: {id: inputData.props.row.id}}" />
  61. </template>
  62. <template v-else>
  63. {{ inputData.col.value }}
  64. </template>
  65. </template>
  66. <template #entity-index-table-item-cell="{inputData}">
  67. <entity-index-grid-item :input-data="inputData">
  68. <template #col="{col, row}">
  69. <template v-if="col.name === 'number'">
  70. {{ inputData.rowNumber }}
  71. </template>
  72. <template v-else-if="col.name === 'action'">
  73. <q-btn size="md"
  74. color="primary"
  75. label="جزییات"
  76. :to="{name: 'UserPanel.Profile.SessionInfo', params: {id: row.id}}" />
  77. </template>
  78. </template>
  79. </entity-index-grid-item>
  80. </template>
  81. </entity-index>
  82. </q-tab-panel>
  83. <q-tab-panel name="movies1">
  84. آزمون
  85. </q-tab-panel>
  86. <q-tab-panel name="projects"
  87. class="q-pa-none">
  88. <entity-index v-if="mounted"
  89. ref="projectList"
  90. v-model:value="projectListInputs"
  91. title="لیست پروژه ها"
  92. :api="projectListApi"
  93. :table="projectListTable"
  94. :table-keys="projectListTableKeys"
  95. :show-search-button="false"
  96. :show-reload-button="false"
  97. :show-expand-button="false">
  98. <template v-slot:entity-index-table-cell="{inputData}">
  99. <template v-if="inputData.col.name === 'number'">
  100. {{ inputData.rowNumber }}
  101. </template>
  102. <template v-else-if="inputData.col.name === 'actions'">
  103. <div class="action-column-entity-index">
  104. <q-btn size="md"
  105. color="primary"
  106. label="جزییات"
  107. :to="{name: 'UserPanel.Profile.Event.Project.Show', params: {event_id: $route.params.id, project_id: inputData.props.row.id}}"
  108. class="q-mr-md" />
  109. </div>
  110. </template>
  111. <template v-else>
  112. {{ inputData.col.value }}
  113. </template>
  114. </template>
  115. </entity-index>
  116. <q-skeleton v-else
  117. type="rect"
  118. height="200px" />
  119. </q-tab-panel>
  120. <q-tab-panel v-if="event.live_streaming_url"
  121. name="live_streaming_url">
  122. <q-btn class="full-width q-mb-lg"
  123. color="primary"
  124. @click="goToLiveStreamUrl">
  125. رفتن به کلاس
  126. </q-btn>
  127. <q-banner>
  128. <div class="q-mb-md">
  129. نام کاربری اسکای روم:
  130. {{ user.national_code }}
  131. </div>
  132. <div>
  133. کلمه عبور اسکای روم:
  134. 1234
  135. </div>
  136. </q-banner>
  137. <iframe :src="event.live_streaming_url"
  138. title="W3Schools Free Online Web Tutorials"
  139. style="height: 80vh"
  140. class="full-width" />
  141. </q-tab-panel>
  142. </q-tab-panels>
  143. </q-card>
  144. </template>
  145. <script>
  146. import { EntityIndex } from 'quasar-crud'
  147. import { Event } from 'src/models/Event.js'
  148. import Enums from 'src/assets/Enums/Enums.js'
  149. import { Invoice } from 'src/models/Invoice.js'
  150. import { mixinAuth } from 'src/mixin/Mixins.js'
  151. import ShamsiDate from 'src/assets/ShamsiDate.js'
  152. import { APIGateway } from 'src/api/APIGateway.js'
  153. import { FormBuilderAssist } from 'quasar-form-builder'
  154. import EntityIndexGridItem from 'src/components/EntityIndexGridItem.vue'
  155. import Breadcrumbs from 'src/components/Widgets/Breadcrumbs/Breadcrumbs.vue'
  156. import { ProjectAttendanceSheets } from 'src/models/ProjectAttendanceSheets.js'
  157. import { SessionAttendanceSheets } from 'src/models/SessionAttendanceSheets.js'
  158. import ShowEventInfo from 'src/components/Widgets/Event/ShowEventInfo/ShowEventInfo.vue'
  159. export default {
  160. name: 'UserPanel.Profile.EventInfo',
  161. components: {
  162. EntityIndex,
  163. Breadcrumbs,
  164. ShowEventInfo,
  165. EntityIndexGridItem
  166. },
  167. mixins: [mixinAuth],
  168. data () {
  169. const eventId = this.$route.params.id
  170. // const userId = this.$store.getters['Auth/user'].id
  171. return {
  172. mounted: false,
  173. tab: 'eventInfo',
  174. inputs: [],
  175. sessionsInputs: [
  176. { type: 'hidden', name: 'event', value: eventId }
  177. ],
  178. api: APIGateway.event.get(eventId),
  179. sessionsApi: APIGateway.session.APIAdresses.attendanceSheets,
  180. event: new Event(),
  181. table: {
  182. columns: [
  183. {
  184. name: 'number',
  185. required: true,
  186. label: 'شماره',
  187. align: 'left',
  188. field: () => ''
  189. },
  190. {
  191. name: 'id',
  192. required: true,
  193. label: 'شناسه',
  194. align: 'left',
  195. field: row => row.id
  196. },
  197. {
  198. name: 'title',
  199. required: true,
  200. label: 'عنوان',
  201. align: 'left',
  202. field: row => row.title
  203. },
  204. {
  205. name: 'title',
  206. required: true,
  207. label: 'زمان شروع',
  208. align: 'left',
  209. field: row => row.beginning_time ? ShamsiDate.getDateTime(row.beginning_time) : '-'
  210. },
  211. {
  212. name: 'title',
  213. required: true,
  214. label: 'زمان پایان',
  215. align: 'left',
  216. field: row => row.ending_time ? ShamsiDate.getDateTime(row.ending_time) : '-'
  217. },
  218. {
  219. name: 'action',
  220. required: true,
  221. label: 'جزییات',
  222. align: 'left',
  223. field: ''
  224. }
  225. ]
  226. },
  227. sessionsTable: {
  228. columns: [
  229. {
  230. name: 'number',
  231. required: true,
  232. label: 'شماره',
  233. align: 'left',
  234. field: () => ''
  235. },
  236. {
  237. name: 'id',
  238. required: true,
  239. label: 'شناسه',
  240. align: 'left',
  241. field: row => row.id
  242. },
  243. {
  244. name: 'title',
  245. required: true,
  246. label: 'عنوان',
  247. align: 'left',
  248. field: row => row.title
  249. },
  250. {
  251. name: 'title',
  252. required: true,
  253. label: 'زمان شروع',
  254. align: 'left',
  255. field: row => row.beginning_time ? ShamsiDate.getDateTime(row.beginning_time) : '-'
  256. },
  257. {
  258. name: 'title',
  259. required: true,
  260. label: 'زمان پایان',
  261. align: 'left',
  262. field: row => row.ending_time ? ShamsiDate.getDateTime(row.ending_time) : '-'
  263. },
  264. {
  265. name: 'assignment_status',
  266. required: true,
  267. label: 'وضعیت تکلیف',
  268. align: 'left',
  269. field: row => (new SessionAttendanceSheets(this.getCurrentUserAttendanceSheet(row))).assignment_status_info.label
  270. },
  271. {
  272. name: 'attendance_status',
  273. required: true,
  274. label: 'وضعیت حضور و غیاب',
  275. align: 'left',
  276. field: row => (new SessionAttendanceSheets(this.getCurrentUserAttendanceSheet(row))).attendance_status_info.label
  277. },
  278. {
  279. name: 'action',
  280. required: true,
  281. label: 'جزییات',
  282. align: 'left',
  283. field: ''
  284. }
  285. ]
  286. },
  287. sessionsTableKeys: {
  288. data: 'results',
  289. total: 'count',
  290. currentPage: 'current',
  291. perPage: 'per_page',
  292. pageKey: 'page'
  293. },
  294. tableKeys: {
  295. data: 'results',
  296. total: 'count',
  297. currentPage: 'current',
  298. perPage: 'per_page',
  299. pageKey: 'page'
  300. },
  301. projectListInputs: [
  302. { type: 'hidden', name: 'event', value: eventId }
  303. // { type: 'hidden', name: 'owner', value: userId }
  304. ],
  305. // projectListApi: APIGateway.projectAttendanceSheets.APIAdresses.base,
  306. projectListApi: APIGateway.project.APIAdresses.attendanceSheetsList,
  307. projectListTable: {
  308. columns: [
  309. {
  310. name: 'number',
  311. required: true,
  312. label: 'شماره',
  313. align: 'left',
  314. field: () => ''
  315. },
  316. {
  317. name: 'id',
  318. required: true,
  319. label: 'شناسه',
  320. align: 'left',
  321. field: row => row.id
  322. },
  323. {
  324. name: 'title',
  325. required: true,
  326. label: 'عنوان پروژه',
  327. align: 'left',
  328. field: row => row.title
  329. },
  330. {
  331. name: 'creation_time',
  332. required: true,
  333. label: 'زمان شروع',
  334. align: 'left',
  335. field: row => row?.beginning_doing_period ? ShamsiDate.getDateTime(row.beginning_doing_period) : '-'
  336. },
  337. {
  338. name: 'creation_time',
  339. required: true,
  340. label: 'زمان پایان',
  341. align: 'left',
  342. field: row => row?.ending_doing_period ? ShamsiDate.getDateTime(row.ending_doing_period) : '-'
  343. },
  344. {
  345. name: 'status',
  346. required: true,
  347. label: 'وضعیت',
  348. align: 'left',
  349. field: row => (new ProjectAttendanceSheets(this.getProjectAttendanceSheets(row))).answer_status_info.label
  350. },
  351. {
  352. name: 'actions',
  353. required: true,
  354. label: 'عملیات',
  355. align: 'left',
  356. field: ''
  357. }
  358. ]
  359. },
  360. projectListTableKeys: {
  361. data: 'results',
  362. total: 'count',
  363. currentPage: 'current',
  364. perPage: 'per_page',
  365. pageKey: 'page'
  366. }
  367. }
  368. },
  369. computed: {
  370. selectedCategoryId () {
  371. return FormBuilderAssist.getInputsByName(this.inputs, 'category')?.value
  372. }
  373. },
  374. watch: {
  375. selectedCategoryId () {
  376. this.setInputValue('unit', null)
  377. this.getUnits(this.selectedCategoryId)
  378. }
  379. },
  380. mounted () {
  381. this.mounted = true
  382. },
  383. methods: {
  384. getCurrentUserAttendanceSheet (session) {
  385. if (!session?.session_attendance_sheets || session.session_attendance_sheets.length === 0) {
  386. return null
  387. }
  388. return session.session_attendance_sheets[0]
  389. },
  390. getProjectAttendanceSheets (project) {
  391. if (!project?.project_attendance_sheets || project.project_attendance_sheets.length === 0) {
  392. return null
  393. }
  394. return project.project_attendance_sheets[0]
  395. },
  396. goToLiveStreamUrl () {
  397. window.open(this.event.live_streaming_url, '_blank')
  398. },
  399. onloadnEvent (event) {
  400. this.event = new Event(event)
  401. this.$store.commit('AppLayout/updateBreadcrumbs', {
  402. visible: true,
  403. loading: false,
  404. path: [
  405. {
  406. label: 'رویدادهای من',
  407. to: { name: 'UserPanel.Profile.AllEvents' }
  408. },
  409. {
  410. label: this.event.title,
  411. to: { name: 'UserPanel.Profile.EventInfo', params: { id: this.event.id } }
  412. }
  413. ]
  414. })
  415. },
  416. search () {
  417. this.$refs.entityIndex.search()
  418. },
  419. getEventHoldingTypeTitle (type) {
  420. const target = Enums.eventHoldingTypes.find(item => item.value === type)
  421. if (!target) {
  422. return '-'
  423. }
  424. return target.label
  425. },
  426. getEventStatusTitle (type) {
  427. const target = (new Event()).statusEnums.find(item => item.value === type)
  428. if (!target) {
  429. return '-'
  430. }
  431. return target.label
  432. },
  433. getInvoiceStatusTitle (type) {
  434. const target = (new Invoice()).statusEnums.find(item => item.value === type)
  435. if (!target) {
  436. return '-'
  437. }
  438. return target.label
  439. },
  440. loadInputDataOptions () {
  441. this.getCategories()
  442. this.getUnits()
  443. },
  444. setInputValue (name, value) {
  445. const inputIndex = this.inputs.findIndex(input => input.name === name)
  446. this.inputs[inputIndex].value = value
  447. },
  448. getSelectOptions (result, value, label) {
  449. return result.map(item => {
  450. return {
  451. value: item[value],
  452. label: item[label]
  453. }
  454. })
  455. },
  456. loadSelectOptions (name, value) {
  457. const inputIndex = this.inputs.findIndex(input => input.name === name)
  458. this.inputs[inputIndex].options = value
  459. }
  460. }
  461. }
  462. </script>