AdminClassroomInfoOfUser.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968
  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 class="q-mb-md q-pa-sm">
  12. <q-linear-progress v-show="ownerInfo.loading"
  13. indeterminate />
  14. <div class="row items-center justify-center">
  15. <div class="col-md-1">
  16. <q-img :src="ownerInfo.picture" />
  17. </div>
  18. <div class="col-md-11">
  19. <div class="row items-center">
  20. <div class="col-md-4">
  21. {{ ownerInfo.gender === 'MALE' ? 'آقای' : 'خانم' }}
  22. {{ ownerInfo.fullname() }}
  23. <br>
  24. کد ملی:
  25. {{ ownerInfo.national_code }}
  26. </div>
  27. <div class="col-md-4">
  28. تلفن همراه جهت تماس:
  29. {{ ownerInfo.mobile_number }}
  30. <br>
  31. ایمیل:
  32. {{ ownerInfo.email }}
  33. </div>
  34. <div class="col-md-4">
  35. <q-btn color="primary"
  36. :to="{ name: 'Admin.User.Show', params: { id: ownerId }}"
  37. target="_blank">
  38. مشاهده پروفایل
  39. </q-btn>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </q-card>
  45. <q-card>
  46. <q-tabs v-model="tab"
  47. dense
  48. class="text-grey"
  49. active-color="primary"
  50. indicator-color="primary"
  51. align="justify"
  52. narrow-indicator>
  53. <q-tab name="classroomInfo"
  54. label="اطلاعات دوره آموزشی" />
  55. <q-tab v-if="canShowOtherTabsOfClassroom"
  56. name="educations"
  57. label="جدول آموزشی" />
  58. <q-tab v-if="canShowOtherTabsOfClassroom"
  59. name="team"
  60. label="گروه" />
  61. <q-tab v-if="canShowOtherTabsOfClassroom"
  62. name="tests"
  63. label="آزمون" />
  64. <q-tab v-if="canShowOtherTabsOfClassroom"
  65. name="projects"
  66. label="پروژه" />
  67. <q-tab v-if="canShowOtherTabsOfClassroom && classroom.live_streaming_url"
  68. name="live_streaming_url"
  69. label="بخش آنلاین" />
  70. </q-tabs>
  71. <q-separator />
  72. <q-tab-panels v-model="tab"
  73. animated>
  74. <q-tab-panel name="classroomInfo">
  75. <div v-if="mounted && classroom.user_register_info.transcript_sheet_info.status"
  76. class="bg-light-green-1 q-pa-md q-mb-md">
  77. <div class="row q-col-gutter-md">
  78. <div class="col-md-6 col-12">
  79. نمره حضور و غیاب: {{ classroom.user_register_info.transcript_sheet_info.attendance_score }}
  80. <br>
  81. نمره آزمون: {{ classroom.user_register_info.transcript_sheet_info.highest_test_score }}
  82. <br>
  83. نمره نهایی: {{ classroom.user_register_info.transcript_sheet_info.final_score }}
  84. </div>
  85. <div class="col-md-6 col-12">
  86. وضعیت نهایی: {{ getTranscriptSheetStatus(classroom.user_register_info.transcript_sheet_info) }}
  87. <br>
  88. <q-badge :color="classroom.user_register_info.transcript_sheet_info.is_sent_by_post ? 'green' : 'red'"
  89. outline>
  90. <template v-if="classroom.user_register_info.transcript_sheet_info.is_sent_by_post">
  91. ارسال شده با پست
  92. </template>
  93. <template v-else>
  94. پست نشده است
  95. </template>
  96. </q-badge>
  97. <br>
  98. <a v-if="classroom.user_register_info.transcript_sheet_info.certification"
  99. :href="classroom.user_register_info.transcript_sheet_info.certification"
  100. target="_blank">
  101. <q-btn outline
  102. color="primary">
  103. دانلود مدرک
  104. </q-btn>
  105. </a>
  106. </div>
  107. </div>
  108. </div>
  109. <show-classroom-info v-if="classroom.id"
  110. :options="{ profileMode: true }"
  111. :classroom="classroom"
  112. @onDrop="getClassroom" />
  113. <q-skeleton v-else
  114. type="circle"
  115. size="100px"
  116. class="q-mt-md" />
  117. </q-tab-panel>
  118. <q-tab-panel name="educations"
  119. class="q-pa-none">
  120. <entity-index v-if="mounted"
  121. ref="entityIndex"
  122. v-model:value="sessionsInputs"
  123. title="لیست جلسات"
  124. :api="sessionsApi"
  125. :table="sessionsTable"
  126. :table-keys="sessionsTableKeys"
  127. :table-grid-size="$q.screen.lt.sm"
  128. :show-expand-button="false"
  129. :show-reload-button="false"
  130. :show-search-button="false">
  131. <template #entity-index-table-cell="{inputData}">
  132. <template v-if="inputData.col.name === 'number'">
  133. {{ inputData.rowNumber }}
  134. </template>
  135. <template v-else-if="inputData.col.name === 'action'">
  136. <q-btn size="md"
  137. color="primary"
  138. label="جزییات"
  139. :to="{name: 'Admin.Session.UserClass', params: {session_id: inputData.props.row.id, user_id: $route.params.user_id}}" />
  140. </template>
  141. <template v-else>
  142. {{ inputData.col.value }}
  143. </template>
  144. </template>
  145. <template #entity-index-table-item-cell="{inputData}">
  146. <entity-index-grid-item :input-data="inputData">
  147. <template #col="{col, row}">
  148. <template v-if="col.name === 'number'">
  149. {{ inputData.rowNumber }}
  150. </template>
  151. <template v-else-if="col.name === 'action'">
  152. <q-btn size="md"
  153. color="primary"
  154. label="جزییات"
  155. :to="{name: 'UserPanel.Profile.SessionInfo', params: {id: row.id}}" />
  156. </template>
  157. </template>
  158. </entity-index-grid-item>
  159. </template>
  160. </entity-index>
  161. </q-tab-panel>
  162. <q-tab-panel name="team"
  163. class="q-pa-none">
  164. <entity-index v-if="mounted"
  165. ref="teamsList"
  166. v-model:value="teamsListInputs"
  167. title="لیست گروه ها"
  168. :api="teamsListApi"
  169. :table="teamsListTable"
  170. :table-keys="teamsListTableKeys"
  171. :show-search-button="false"
  172. :show-reload-button="false"
  173. :show-expand-button="false">
  174. <template v-slot:entity-index-table-cell="{inputData}">
  175. <template v-if="inputData.col.name === 'number'">
  176. {{ inputData.rowNumber }}
  177. </template>
  178. <template v-else-if="inputData.col.name === 'action'">
  179. <div class="action-column-entity-index">
  180. <q-btn size="md"
  181. color="primary"
  182. :flat="inputData.props.row.join_status !== 'ENABLED'"
  183. :disable="inputData.props.row.join_status !== 'ENABLED'"
  184. :label="getTeamJoinStatusLabel(inputData.props.row)"
  185. class="q-mr-md"
  186. :loading="joinTeamLoading"
  187. @click="joinTeam(inputData.props.row)" />
  188. </div>
  189. </template>
  190. <template v-else>
  191. {{ inputData.col.value }}
  192. </template>
  193. </template>
  194. </entity-index>
  195. <q-skeleton v-else
  196. type="rect"
  197. height="200px" />
  198. </q-tab-panel>
  199. <q-tab-panel name="tests"
  200. class="q-pa-none">
  201. <entity-index v-if="mounted"
  202. ref="entityIndex"
  203. v-model:value="testListInputs"
  204. title="آزمون ها"
  205. :api="testListApi"
  206. :table="testListTable"
  207. :table-keys="testListTableKeys"
  208. :table-grid-size="$q.screen.lt.sm"
  209. :show-expand-button="false"
  210. :show-reload-button="false"
  211. :show-search-button="false">
  212. <template #entity-index-table-cell="{inputData}">
  213. <template v-if="inputData.col.name === 'number'">
  214. {{ inputData.rowNumber }}
  215. </template>
  216. <template v-else-if="inputData.col.name === 'action'">
  217. <q-btn v-if="inputData.props.row.is_enabled_attending"
  218. size="md"
  219. color="primary"
  220. label="شرکت در آزمون"
  221. :to="{name: 'UserPanel.Test.AnswerBook.Confirmation', params: {test_id: inputData.props.row.test, answer_book_id: inputData.props.row.id}}" />
  222. <q-btn v-if="inputData.props.row.is_enabled_continuing"
  223. size="md"
  224. color="primary"
  225. label="ادامه آزمون"
  226. @click="showParticipateTypeDialog(inputData.props.row.test, inputData.props.row.id)" />
  227. <q-btn v-if="inputData.props.row.is_enabled_objecting"
  228. size="md"
  229. color="primary"
  230. label="ثبت اعتراض"
  231. :to="{name: 'UserPanel.Test.AnswerBook.Show', params: {test_id: inputData.props.row.test, answer_book_id: inputData.props.row.id}, query: { send_objection: 1}}" />
  232. <q-btn v-if="inputData.props.row.is_enabled_viewing"
  233. size="md"
  234. color="primary"
  235. label="مشاهده"
  236. :to="{name: 'UserPanel.Test.AnswerBook.Show', params: {test_id: inputData.props.row.test, answer_book_id: inputData.props.row.id}}" />
  237. </template>
  238. <template v-else>
  239. {{ inputData.col.value }}
  240. </template>
  241. </template>
  242. <template #entity-index-table-item-cell="{inputData}">
  243. <entity-index-grid-item :input-data="inputData">
  244. <template #col="{col, row}">
  245. <template v-if="col.name === 'number'">
  246. {{ inputData.rowNumber }}
  247. </template>
  248. <template v-else-if="col.name === 'action'">
  249. <q-btn v-if="row.is_enabled_attending"
  250. size="md"
  251. color="primary"
  252. label="شرکت در آزمون"
  253. :to="{name: 'UserPanel.Test.AnswerBook.Confirmation', params: {test_id: row.test, answer_book_id: row.id}}" />
  254. <q-btn v-if="row.is_enabled_continuing"
  255. size="md"
  256. color="primary"
  257. label="ادامه آزمون"
  258. @click="showParticipateTypeDialog(row.test, row.id)" />
  259. <q-btn v-if="row.is_enabled_objecting"
  260. size="md"
  261. color="primary"
  262. label="ثبت اعتراض"
  263. :to="{name: 'UserPanel.Test.AnswerBook.Show', params: {test_id: row.test, answer_book_id: row.id}, query: { send_objection: 1}}" />
  264. <q-btn v-if="row.is_enabled_viewing"
  265. size="md"
  266. color="primary"
  267. label="مشاهده"
  268. :to="{name: 'UserPanel.Test.AnswerBook.Show', params: {test_id: row.test, answer_book_id: row.id}}" />
  269. </template>
  270. </template>
  271. </entity-index-grid-item>
  272. </template>
  273. </entity-index>
  274. <q-skeleton v-else
  275. type="rect"
  276. height="200px" />
  277. <q-dialog v-model="participateTypeDialog">
  278. <q-card>
  279. <q-card-actions>
  280. نحوه پاسخ به آزمون
  281. </q-card-actions>
  282. <q-separator />
  283. <q-card-actions>
  284. <div>
  285. اندیشه جوی عزیز لطفا نحوه پاسخ به سوالات آزمون را مشخص کنید
  286. </div>
  287. <div>
  288. <q-radio v-model="participateType"
  289. val="UserPanel.Test.AnswerBook.Participate.AllQuestions"
  290. label="مایلم پاسخ سوالات را به صورت یک فایل جامع بارگذاری کنم" />
  291. <q-radio v-model="participateType"
  292. val="UserPanel.Test.AnswerBook.Participate.SingleQuestion"
  293. label="مایلم پاسخ سوالات را به صورت جداگانه ذیل همان سوال وارد کنم" />
  294. </div>
  295. </q-card-actions>
  296. <q-card-actions>
  297. <q-btn v-close-popup
  298. outline
  299. label="انصراف از آزمون"
  300. color="red" />
  301. <q-btn :disable="!participateType"
  302. label="تایید و شروع آزمون"
  303. color="primary"
  304. @click="startTest" />
  305. </q-card-actions>
  306. </q-card>
  307. </q-dialog>
  308. </q-tab-panel>
  309. <q-tab-panel name="projects"
  310. class="q-pa-none">
  311. <entity-index v-if="mounted"
  312. ref="projectList"
  313. v-model:value="projectListInputs"
  314. title="لیست پروژه ها"
  315. :api="projectListApi"
  316. :table="projectListTable"
  317. :table-keys="projectListTableKeys"
  318. :show-search-button="false"
  319. :show-reload-button="false"
  320. :show-expand-button="false">
  321. <template v-slot:entity-index-table-cell="{inputData}">
  322. <template v-if="inputData.col.name === 'number'">
  323. {{ inputData.rowNumber }}
  324. </template>
  325. <template v-else-if="inputData.col.name === 'actions'">
  326. <div class="action-column-entity-index">
  327. <q-btn size="md"
  328. color="primary"
  329. label="جزییات"
  330. :to="{name: 'Admin.Classroom.Project.UserInfo', params: {classroom_id: classroomId, project_id: inputData.props.row.id, user_id: $route.params.user_id}}"
  331. class="q-mr-md" />
  332. </div>
  333. </template>
  334. <template v-else>
  335. {{ inputData.col.value }}
  336. </template>
  337. </template>
  338. </entity-index>
  339. <q-skeleton v-else
  340. type="rect"
  341. height="200px" />
  342. </q-tab-panel>
  343. <q-tab-panel v-if="classroom.live_streaming_url"
  344. name="live_streaming_url">
  345. <q-btn class="full-width q-mb-lg"
  346. color="primary"
  347. @click="goToLiveStreamUrl">
  348. رفتن به کلاس
  349. </q-btn>
  350. <q-banner>
  351. <div class="q-mb-md">
  352. نام کاربری اسکای روم:
  353. {{ user.national_code }}
  354. </div>
  355. <div>
  356. کلمه عبور اسکای روم:
  357. 1234
  358. </div>
  359. </q-banner>
  360. <iframe :src="classroom.live_streaming_url"
  361. title="W3Schools Free Online Web Tutorials"
  362. style="height: 80vh"
  363. class="full-width" />
  364. </q-tab-panel>
  365. </q-tab-panels>
  366. </q-card>
  367. </template>
  368. <script>
  369. import { EntityIndex } from 'quasar-crud'
  370. import { Team } from 'src/models/Team.js'
  371. import { Test } from 'src/models/Test.js'
  372. import Enums from 'src/assets/Enums/Enums.js'
  373. import { mixinAuth } from 'src/mixin/Mixins.js'
  374. import ShamsiDate from 'src/assets/ShamsiDate.js'
  375. import { APIGateway } from 'src/api/APIGateway.js'
  376. import { Classroom } from 'src/models/Classroom.js'
  377. import { AnswerBook } from 'src/models/AnswerBook.js'
  378. import { FormBuilderAssist } from 'quasar-form-builder'
  379. import ShowClassroomInfo from './components/ShowClassroomInfo.vue'
  380. import EntityIndexGridItem from 'src/components/EntityIndexGridItem.vue'
  381. import { RegistrationList } from 'src/models/Registration.js'
  382. import Breadcrumbs from 'src/components/Widgets/Breadcrumbs/Breadcrumbs.vue'
  383. import { ProjectAttendanceSheets } from 'src/models/ProjectAttendanceSheets.js'
  384. import { SessionAttendanceSheets } from 'src/models/SessionAttendanceSheets.js'
  385. import { TranscriptSheet } from 'src/models/TranscriptSheet'
  386. import { User } from 'src/models/User'
  387. export default {
  388. name: 'UserPanel.Profile.ClassroomInfo',
  389. components: {
  390. EntityIndex,
  391. Breadcrumbs,
  392. ShowClassroomInfo,
  393. EntityIndexGridItem
  394. },
  395. mixins: [mixinAuth],
  396. data () {
  397. const userId = this.$route.params.user_id
  398. const classroomId = this.$route.params.classroom_id
  399. return {
  400. mounted: false,
  401. ownerInfo: new User(),
  402. selectedTest: {
  403. testId: null,
  404. answerBookId: null
  405. },
  406. participateTypeDialog: false,
  407. participateType: null,
  408. tab: 'classroomInfo',
  409. inputs: [],
  410. sessionsInputs: [
  411. { type: 'hidden', name: 'owner', value: userId },
  412. { type: 'hidden', name: 'classroom', value: classroomId }
  413. ],
  414. api: APIGateway.classroom.get(classroomId),
  415. sessionsApi: APIGateway.session.APIAdresses.attendanceSheets,
  416. classroom: new Classroom(),
  417. table: {
  418. columns: [
  419. {
  420. name: 'number',
  421. required: true,
  422. label: 'شماره',
  423. align: 'left',
  424. field: () => ''
  425. },
  426. {
  427. name: 'id',
  428. required: true,
  429. label: 'شناسه',
  430. align: 'left',
  431. field: row => row.id
  432. },
  433. {
  434. name: 'title',
  435. required: true,
  436. label: 'عنوان',
  437. align: 'left',
  438. field: row => row.title
  439. },
  440. {
  441. name: 'title',
  442. required: true,
  443. label: 'زمان شروع',
  444. align: 'left',
  445. field: row => row.beginning_time ? ShamsiDate.getDateTime(row.beginning_time) : '-'
  446. },
  447. {
  448. name: 'title',
  449. required: true,
  450. label: 'زمان پایان',
  451. align: 'left',
  452. field: row => row.ending_time ? ShamsiDate.getDateTime(row.ending_time) : '-'
  453. },
  454. {
  455. name: 'action',
  456. required: true,
  457. label: 'جزییات',
  458. align: 'left',
  459. field: ''
  460. }
  461. ]
  462. },
  463. sessionsTable: {
  464. columns: [
  465. {
  466. name: 'number',
  467. required: true,
  468. label: 'شماره',
  469. align: 'left',
  470. field: () => ''
  471. },
  472. {
  473. name: 'id',
  474. required: true,
  475. label: 'شناسه',
  476. align: 'left',
  477. field: row => row.id
  478. },
  479. {
  480. name: 'title',
  481. required: true,
  482. label: 'عنوان',
  483. align: 'left',
  484. field: row => row.title
  485. },
  486. {
  487. name: 'title',
  488. required: true,
  489. label: 'زمان شروع',
  490. align: 'left',
  491. field: row => row.beginning_time ? ShamsiDate.getDateTime(row.beginning_time) : '-'
  492. },
  493. {
  494. name: 'title',
  495. required: true,
  496. label: 'زمان پایان',
  497. align: 'left',
  498. field: row => row.ending_time ? ShamsiDate.getDateTime(row.ending_time) : '-'
  499. },
  500. {
  501. name: 'assignment_status',
  502. required: true,
  503. label: 'وضعیت تکلیف',
  504. align: 'left',
  505. field: row => (new SessionAttendanceSheets(this.getCurrentUserAttendanceSheet(row))).assignment_status_info.label
  506. },
  507. {
  508. name: 'attendance_status',
  509. required: true,
  510. label: 'وضعیت حضور و غیاب',
  511. align: 'left',
  512. field: row => (new SessionAttendanceSheets(this.getCurrentUserAttendanceSheet(row))).attendance_status_info.label
  513. },
  514. {
  515. name: 'action',
  516. required: true,
  517. label: 'جزییات',
  518. align: 'left',
  519. field: ''
  520. }
  521. ]
  522. },
  523. sessionsTableKeys: {
  524. data: 'results',
  525. total: 'count',
  526. currentPage: 'current',
  527. perPage: 'per_page',
  528. pageKey: 'page'
  529. },
  530. tableKeys: {
  531. data: 'results',
  532. total: 'count',
  533. currentPage: 'current',
  534. perPage: 'per_page',
  535. pageKey: 'page'
  536. },
  537. projectListInputs: [
  538. { type: 'hidden', name: 'owner', value: userId },
  539. { type: 'hidden', name: 'classroom', value: classroomId }
  540. ],
  541. // projectListApi: APIGateway.projectAttendanceSheets.APIAdresses.base,
  542. projectListApi: APIGateway.project.APIAdresses.attendanceSheetsList,
  543. projectListTable: {
  544. columns: [
  545. {
  546. name: 'number',
  547. required: true,
  548. label: 'شماره',
  549. align: 'left',
  550. field: () => ''
  551. },
  552. {
  553. name: 'id',
  554. required: true,
  555. label: 'شناسه',
  556. align: 'left',
  557. field: row => row.id
  558. },
  559. {
  560. name: 'title',
  561. required: true,
  562. label: 'عنوان پروژه',
  563. align: 'left',
  564. field: row => row.title
  565. },
  566. {
  567. name: 'creation_time',
  568. required: true,
  569. label: 'زمان شروع',
  570. align: 'left',
  571. field: row => row?.beginning_doing_period ? ShamsiDate.getDateTime(row.beginning_doing_period) : '-'
  572. },
  573. {
  574. name: 'creation_time',
  575. required: true,
  576. label: 'زمان پایان',
  577. align: 'left',
  578. field: row => row?.ending_doing_period ? ShamsiDate.getDateTime(row.ending_doing_period) : '-'
  579. },
  580. {
  581. name: 'status',
  582. required: true,
  583. label: 'وضعیت',
  584. align: 'left',
  585. field: row => (new ProjectAttendanceSheets(this.getProjectAttendanceSheets(row))).answer_status_info.label
  586. },
  587. {
  588. name: 'actions',
  589. required: true,
  590. label: 'عملیات',
  591. align: 'left',
  592. field: ''
  593. }
  594. ]
  595. },
  596. projectListTableKeys: {
  597. data: 'results',
  598. total: 'count',
  599. currentPage: 'current',
  600. perPage: 'per_page',
  601. pageKey: 'page'
  602. },
  603. registrations: new RegistrationList(),
  604. joinTeamLoading: false,
  605. teamsListInputs: [
  606. { type: 'hidden', name: 'owner', value: userId },
  607. { type: 'hidden', name: 'classroom', value: classroomId }
  608. ],
  609. teamsListApi: APIGateway.team.APIAdresses.classroomTeamsWithJoinStatus,
  610. teamsListTable: {
  611. columns: [
  612. {
  613. name: 'number',
  614. required: true,
  615. label: 'شماره',
  616. align: 'left',
  617. field: () => ''
  618. },
  619. {
  620. name: 'id',
  621. required: true,
  622. label: 'شناسه',
  623. align: 'left',
  624. field: row => row.id
  625. },
  626. {
  627. name: 'title',
  628. required: true,
  629. label: 'عنوان گروه',
  630. align: 'left',
  631. field: row => row.title
  632. },
  633. {
  634. name: 'leader_info',
  635. required: true,
  636. label: 'سرگروه',
  637. align: 'left',
  638. field: row => row.leader_info?.firstname + ' ' + row.leader_info?.lastname
  639. },
  640. {
  641. name: 'used_capacity',
  642. required: true,
  643. label: 'ظرفیت استفاده شده',
  644. align: 'left',
  645. field: row => row.used_capacity
  646. },
  647. {
  648. name: 'capacity',
  649. required: true,
  650. label: 'ظرفیت',
  651. align: 'left',
  652. field: row => row.capacity
  653. },
  654. {
  655. name: 'action',
  656. required: true,
  657. label: ' ',
  658. align: 'left',
  659. field: ''
  660. }
  661. ],
  662. data: []
  663. },
  664. teamsListTableKeys: {
  665. data: 'results',
  666. total: 'count',
  667. currentPage: 'current',
  668. perPage: 'per_page',
  669. pageKey: 'page'
  670. },
  671. testListInputs: [
  672. { type: 'hidden', name: 'owner', value: userId },
  673. { type: 'hidden', name: 'test__classroom', value: classroomId }
  674. ],
  675. testListApi: APIGateway.answerBook.APIAdresses.base,
  676. testListTable: {
  677. columns: [
  678. {
  679. name: 'number',
  680. required: true,
  681. label: 'شماره',
  682. align: 'left',
  683. field: () => ''
  684. },
  685. {
  686. name: 'id',
  687. required: true,
  688. label: 'شناسه',
  689. align: 'left',
  690. field: row => row.id
  691. },
  692. {
  693. name: 'id',
  694. required: true,
  695. label: 'شناسه آزمون',
  696. align: 'left',
  697. field: row => row.test_info.id
  698. },
  699. {
  700. name: 'title',
  701. required: true,
  702. label: 'عنوان آزمون',
  703. align: 'left',
  704. field: row => row.test_info?.title
  705. },
  706. {
  707. name: 'start_time',
  708. required: true,
  709. label: 'زمان شروع',
  710. align: 'left',
  711. field: row => row.test_info?.start_time ? ShamsiDate.getDateTime(row.test_info.start_time) : '-'
  712. },
  713. {
  714. name: 'end_time',
  715. required: true,
  716. label: 'زمان پایان',
  717. align: 'left',
  718. field: row => row.test_info?.end_time ? ShamsiDate.getDateTime(row.test_info.end_time) : '-'
  719. },
  720. {
  721. name: 'duration_deadline',
  722. required: true,
  723. label: 'مدت آزمون(دقیقه)',
  724. align: 'left',
  725. field: row => row.test_info.duration_deadline
  726. },
  727. {
  728. name: 'test_questions.length',
  729. required: true,
  730. label: 'تعداد سوالات',
  731. align: 'left',
  732. field: row => row.test_info?.test_questions_length
  733. },
  734. {
  735. name: 'grade',
  736. required: true,
  737. label: 'نمره نهایی',
  738. align: 'left',
  739. field: row => (row.status === 'GRADED' || row.status === 'OBJECTED' || row.status === 'FINALIZED') ? row.total_score : ''
  740. },
  741. {
  742. name: 'test_info_status',
  743. required: true,
  744. label: 'وضعیت آزمون',
  745. align: 'left',
  746. field: row => (new Test(row.test_info)).status_info.label
  747. },
  748. {
  749. name: 'result_status',
  750. required: true,
  751. label: 'وضعیت تصحیح',
  752. align: 'left',
  753. field: row => (new AnswerBook(row)).status_info.label
  754. },
  755. {
  756. name: 'action',
  757. required: true,
  758. label: 'عملیات',
  759. align: 'left',
  760. field: ''
  761. }
  762. ]
  763. },
  764. testListTableKeys: {
  765. data: 'results',
  766. total: 'count',
  767. currentPage: 'current',
  768. perPage: 'per_page',
  769. pageKey: 'page'
  770. }
  771. }
  772. },
  773. computed: {
  774. ownerId () {
  775. return this.$route.params.user_id
  776. },
  777. classroomId () {
  778. return this.$route.params.classroom_id
  779. },
  780. canShowOtherTabsOfClassroom () {
  781. return !this.classroom.user_register_info.loading && (this.classroom.user_register_info.status === 'REGISTERED' || this.classroom.user_register_info.status === 'ENROLLED')
  782. },
  783. selectedCategoryId () {
  784. return FormBuilderAssist.getInputsByName(this.inputs, 'category')?.value
  785. }
  786. },
  787. watch: {
  788. selectedCategoryId () {
  789. this.setInputValue('unit', null)
  790. this.getUnits(this.selectedCategoryId)
  791. }
  792. },
  793. mounted () {
  794. this.$store.commit('Test/updateAnswerBook', null)
  795. this.getUserInfo()
  796. this.getClassroom()
  797. this.mounted = true
  798. FormBuilderAssist.setAttributeByName(this.testListInputs, 'owner', 'value', this.user.id)
  799. },
  800. methods: {
  801. getClassroom () {
  802. this.classroom.loading = true
  803. APIGateway.classroom.getClassroomAndCorrespondingRegistration(this.classroomId, this.ownerId)
  804. .then((classroom) => {
  805. this.classroom = new Classroom(classroom)
  806. if (!this.classroom.user_register_info.id) {
  807. this.getRegistrationInfo()
  808. }
  809. this.onloadnClassroom()
  810. })
  811. .finally(() => {
  812. this.classroom.loading = false
  813. })
  814. },
  815. getUserInfo () {
  816. this.ownerInfo.loading = true
  817. APIGateway.user.get({ data: { id: this.ownerId } })
  818. .then((user) => {
  819. this.ownerInfo = new User(user)
  820. })
  821. .finally(() => {
  822. this.ownerInfo.loading = false
  823. })
  824. },
  825. showParticipateTypeDialog (testId, answerBookId) {
  826. this.$store.commit('Test/updateAnswerBook', null)
  827. this.selectedTest.testId = testId
  828. this.selectedTest.answerBookId = answerBookId
  829. this.participateTypeDialog = true
  830. },
  831. startTest () {
  832. this.$store.commit('Test/updateAnswerBook', null)
  833. this.$router.push({ name: this.participateType, params: { test_id: this.selectedTest.testId, answer_book_id: this.selectedTest.answerBookId, question_number: 1 } })
  834. },
  835. getTeamJoinStatusLabel (team) {
  836. if (team.join_status === 'ENABLED') {
  837. return 'عضو شوید'
  838. }
  839. return (new Team(team)).join_status_info.label
  840. },
  841. joinTeam (team) {
  842. this.joinTeamLoading = true
  843. APIGateway.team.register(team.id)
  844. .then(() => {
  845. this.joinTeamLoading = false
  846. this.$refs.teamsList.search()
  847. })
  848. .catch(() => {
  849. this.joinTeamLoading = false
  850. this.$refs.teamsList.search()
  851. })
  852. },
  853. getRegistrationInfo () {
  854. this.registrations.loading = true
  855. this.classroom.user_register_info.loading = true
  856. APIGateway.registration.index({ classroom: this.classroomId })
  857. .then(({ list }) => {
  858. this.registrations = new RegistrationList(list)
  859. if (this.registrations.list.length > 0) {
  860. this.classroom.user_register_info = this.registrations.list[0]
  861. }
  862. this.registrations.loading = false
  863. this.classroom.user_register_info.loading = false
  864. this.onloadnClassroom()
  865. })
  866. .catch(() => {
  867. this.registrations.loading = false
  868. this.classroom.user_register_info.loading = false
  869. })
  870. },
  871. getCurrentUserAttendanceSheet (session) {
  872. if (!session?.session_attendance_sheets || session.session_attendance_sheets.length === 0) {
  873. return null
  874. }
  875. return session.session_attendance_sheets[0]
  876. },
  877. getProjectAttendanceSheets (project) {
  878. if (!project?.project_attendance_sheets || project.project_attendance_sheets.length === 0) {
  879. return null
  880. }
  881. return project.project_attendance_sheets[0]
  882. },
  883. goToLiveStreamUrl () {
  884. window.open(this.classroom.live_streaming_url, '_blank')
  885. },
  886. onloadnClassroom () {
  887. this.$store.commit('AppLayout/updateBreadcrumbs', {
  888. visible: true,
  889. loading: false,
  890. path: [
  891. {
  892. label: 'دوره های من',
  893. to: { name: 'UserPanel.Profile.AllClassrooms' }
  894. },
  895. {
  896. label: this.classroom.title,
  897. to: { name: 'UserPanel.Profile.ClassroomInfo', params: { id: this.classroom.id } }
  898. }
  899. ]
  900. })
  901. },
  902. search () {
  903. this.$refs.entityIndex.search()
  904. },
  905. getClassroomHoldingTypeTitle (type) {
  906. const target = Enums.classroomHoldingTypes.find(item => item.value === type)
  907. if (!target) {
  908. return '-'
  909. }
  910. return target.label
  911. },
  912. getClassroomStatusTitle (type) {
  913. const target = Enums.classroomStatuses.find(item => item.value === type)
  914. if (!target) {
  915. return '-'
  916. }
  917. return target.label
  918. },
  919. getInvoiceStatusTitle (type) {
  920. const target = Enums.invoiceStatus.find(item => item.value === type)
  921. if (!target) {
  922. return '-'
  923. }
  924. return target.label
  925. },
  926. loadInputDataOptions () {
  927. this.getCategories()
  928. this.getUnits()
  929. },
  930. setInputValue (name, value) {
  931. const inputIndex = this.inputs.findIndex(input => input.name === name)
  932. this.inputs[inputIndex].value = value
  933. },
  934. getSelectOptions (result, value, label) {
  935. return result.map(item => {
  936. return {
  937. value: item[value],
  938. label: item[label]
  939. }
  940. })
  941. },
  942. loadSelectOptions (name, value) {
  943. const inputIndex = this.inputs.findIndex(input => input.name === name)
  944. this.inputs[inputIndex].options = value
  945. },
  946. getTranscriptSheetStatus (transcriptSheet) {
  947. return new TranscriptSheet(transcriptSheet).status_info.label
  948. }
  949. }
  950. }
  951. </script>