show.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. <template>
  2. <q-card class="AdminClassroomShow">
  3. <q-tabs v-model="tab"
  4. dense
  5. class="text-grey"
  6. active-color="primary"
  7. indicator-color="primary"
  8. align="justify"
  9. narrow-indicator>
  10. <q-tab name="classroomInfo"
  11. label="مشخصات" />
  12. <q-tab name="educations"
  13. label="لیست جلسات" />
  14. <q-tab name="movies1"
  15. label="پروژه‌ها" />
  16. <q-tab name="movies2"
  17. label="آزمون" />
  18. <q-tab name="members"
  19. label="اندیشه جویان" />
  20. <q-tab name="live_streaming_url"
  21. label="بخش آنلاین" />
  22. </q-tabs>
  23. <q-separator />
  24. <q-tab-panels v-model="tab"
  25. animated>
  26. <q-tab-panel name="classroomInfo"
  27. class="q-pa-none">
  28. <q-linear-progress v-if="unitsLoading"
  29. indeterminate />
  30. <entity-edit v-if="mounted"
  31. ref="classroomEntityEdit"
  32. :key="classroomEntityEditKey"
  33. v-model:value="inputs"
  34. title="مشخصات دوره آموزشی"
  35. :api="api"
  36. :entity-id-key="entityIdKey"
  37. :entity-param-key="entityParamKey"
  38. :show-route-name="showRouteName"
  39. :show-close-button="false"
  40. :show-edit-button="false"
  41. :show-expand-button="false"
  42. :show-save-button="false"
  43. :show-reload-button="false"
  44. :after-load-input-data="afterLoadInputData">
  45. <template #after-form-builder>
  46. <div class="flex justify-end">
  47. <q-btn color="primary"
  48. label="بروزرسانی اطلاعات"
  49. @click="updateClassroom" />
  50. </div>
  51. </template>
  52. </entity-edit>
  53. <q-skeleton v-else
  54. type="rect"
  55. height="200px" />
  56. </q-tab-panel>
  57. <q-tab-panel name="educations"
  58. class="q-pa-none">
  59. <entity-index v-if="mounted"
  60. v-model:value="sessionListInputs"
  61. title="لیست جلسات"
  62. :api="sessionListApi"
  63. :table="sessionListTable"
  64. :table-keys="sessionListTableKeys"
  65. :show-search-button="false"
  66. :show-reload-button="false"
  67. :show-expand-button="false">
  68. <template v-slot:entity-index-table-cell="{inputData, showConfirmRemoveDialog}">
  69. <template v-if="inputData.col.name === 'actions'">
  70. <div class="action-column-entity-index">
  71. <q-btn size="md"
  72. color="primary"
  73. label="جزییات"
  74. :to="{name: 'Admin.Session.Show', params: {id: inputData.props.row.id}}"
  75. class="q-mr-md" />
  76. <delete-btn @click="showConfirmRemoveDialog(inputData.props.row, 'id', getRemoveMessage(inputData.props.row))" />
  77. </div>
  78. </template>
  79. <template v-else>
  80. {{ inputData.col.value }}
  81. </template>
  82. </template>
  83. </entity-index>
  84. <q-skeleton v-else
  85. type="rect"
  86. height="200px" />
  87. </q-tab-panel>
  88. <q-tab-panel name="movies1">
  89. پروژه‌ها
  90. </q-tab-panel>
  91. <q-tab-panel name="movies2">
  92. آزمون
  93. </q-tab-panel>
  94. <q-tab-panel name="members"
  95. class="q-pa-none">
  96. <entity-index v-if="mounted"
  97. ref="membersList"
  98. v-model:value="membersListInputs"
  99. title="لیست کاربران"
  100. :api="membersListApi"
  101. :table="membersListTable"
  102. :table-keys="membersListTableKeys"
  103. :show-search-button="false"
  104. :show-reload-button="false"
  105. :show-expand-button="false">
  106. <template v-slot:entity-index-table-cell="{inputData, showConfirmRemoveDialog}">
  107. <template v-if="inputData.col.name === 'actions'">
  108. <div class="action-column-entity-index">
  109. <q-btn size="md"
  110. color="primary"
  111. outline
  112. label="سابقه آموزشی"
  113. class="q-mr-md" />
  114. <!-- :to="{name: 'Admin.Session.Show', params: {id: inputData.props.row.id}}"-->
  115. <delete-btn @click="showConfirmRemoveDialog(inputData.props.row, 'id', getRemoveMessage(inputData.props.row))" />
  116. </div>
  117. </template>
  118. <template v-else>
  119. {{ inputData.col.value }}
  120. </template>
  121. </template>
  122. </entity-index>
  123. <q-skeleton v-else
  124. type="rect"
  125. height="200px" />
  126. </q-tab-panel>
  127. <q-tab-panel name="live_streaming_url">
  128. <q-btn class="full-width q-mb-lg"
  129. color="primary"
  130. @click="goToLiveStreamUrl">
  131. رفتن به کلاس
  132. </q-btn>
  133. <iframe :src="classroom.live_streaming_url"
  134. title="W3Schools Free Online Web Tutorials"
  135. style="height: 80vh"
  136. class="full-width" />
  137. </q-tab-panel>
  138. </q-tab-panels>
  139. </q-card>
  140. </template>
  141. <script>
  142. import { shallowRef } from 'vue'
  143. import Enums from 'src/assets/Enums/Enums.js'
  144. import ShamsiDate from 'src/assets/ShamsiDate.js'
  145. import { APIGateway } from 'src/api/APIGateway.js'
  146. import { Classroom } from 'src/models/Classroom.js'
  147. import { EntityEdit, EntityIndex } from 'quasar-crud'
  148. import { FormBuilderAssist } from 'quasar-form-builder'
  149. import BtnControl from 'src/components/Control/btn.vue'
  150. import DeleteBtn from 'src/components/Control/DeleteBtn.vue'
  151. const BtnControlComp = shallowRef(BtnControl)
  152. export default {
  153. name: 'Admin.Classroom.Show',
  154. components: {
  155. EntityEdit,
  156. EntityIndex,
  157. DeleteBtn
  158. },
  159. data () {
  160. return {
  161. mounted: false,
  162. unitsLoading: false,
  163. classroomEntityEditKey: Date.now(),
  164. tab: 'classroomInfo',
  165. api: null,
  166. entityIdKey: 'id',
  167. entityParamKey: 'id',
  168. showRouteName: 'Admin.Classroom.Show',
  169. inputs: [
  170. { type: 'separator', name: 'space', label: 'مشخصات دوره', className: 'custom-separator', col: 'col-12' },
  171. { type: 'file', name: 'thumbnail', responseKey: 'thumbnail', label: 'آپلود عکس دوره', col: 'col-md-3 col-12' },
  172. { type: 'separator', name: 'space', size: '0', col: 'col-md-12' },
  173. { type: 'select', name: 'category', responseKey: 'unit_info.category_info.id', options: [], value: null, placeholder: ' ', label: 'دسته بندی', col: 'col-md-3 col-12' },
  174. { type: 'select', name: 'unit', responseKey: 'unit', options: [], value: null, placeholder: ' ', label: 'درس', col: 'col-md-3 col-12' },
  175. { type: 'select', name: 'holding_type', responseKey: 'holding_type', options: Enums.classroomHoldingTypes, value: null, placeholder: ' ', label: 'نوع برگزاری', col: 'col-md-3 col-12' },
  176. { type: 'input', name: 'price', responseKey: 'price', placeholder: ' ', label: 'هزینه برگزاری', col: 'col-md-3 col-12' },
  177. { type: 'input', name: 'live_streaming_url', responseKey: 'live_streaming_url', placeholder: ' ', label: 'لینک مکان مجازی دوره', col: 'col-12' },
  178. { type: 'inputEditor', name: 'classroom_address', responseKey: 'classroom_address', placeholder: ' ', label: 'آدرس مکان فیزیکی دوره', col: 'col-12' },
  179. {
  180. type: 'select',
  181. name: 'holding_year',
  182. responseKey: 'holding_year',
  183. options: [1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410],
  184. value: null,
  185. label: 'انتخاب سال دوره',
  186. placeholder: ' ',
  187. col: 'col-md-3'
  188. },
  189. {
  190. type: 'select',
  191. name: 'holding_month',
  192. responseKey: 'holding_month',
  193. options: [
  194. 'فروردین',
  195. 'اردیبهشت',
  196. 'خرداد',
  197. 'تیر',
  198. 'مرداد',
  199. 'شهریور',
  200. 'مهر',
  201. 'آبان',
  202. 'آذر',
  203. 'دی',
  204. 'بهمن',
  205. 'اسفند'
  206. ],
  207. value: null,
  208. label: 'انتخاب ماه دوره',
  209. placeholder: ' ',
  210. col: 'col-md-3'
  211. },
  212. { type: 'input', name: 'sessions_frequency', responseKey: 'sessions_frequency', placeholder: ' ', label: 'دوره تناوب', col: 'col-12' },
  213. { type: 'select', name: 'professor', responseKey: 'professor', options: [], value: null, placeholder: ' ', label: 'استاد دوره', col: 'col-md-3 col-12' },
  214. { type: 'separator', name: 'space', label: 'مشخصات اندیشه جو', className: 'custom-separator', col: 'col-12' },
  215. { type: 'select', name: 'audience_status_wwwww', responseKey: 'audience_status_wwwww', options: [], placeholder: ' ', label: 'وضعیت(؟)', col: 'col-md-3 col-12' },
  216. { type: 'select', name: 'category', responseKey: 'category', options: [], placeholder: ' ', label: 'مجموعه(؟)', col: 'col-md-3 col-12' },
  217. { type: 'select', name: 'audience_gender_type', responseKey: 'audience_gender_type', options: Enums.classroomGenders, placeholder: ' ', label: 'جنسیت', col: 'col-md-3 col-12' },
  218. { type: 'select', name: 'audience_bashgah_wwwww', responseKey: 'audience_bashgah_wwwww', options: [], placeholder: ' ', label: 'باشگاه(؟)', col: 'col-md-3 col-12' },
  219. { type: 'separator', name: 'space', label: 'تنظیمات دوره', className: 'custom-separator', col: 'col-12' },
  220. { type: 'input', name: 'capacity', responseKey: 'capacity', placeholder: ' ', label: 'ظرفیت گروه درسی', col: 'col-md-3 col-12' },
  221. { type: 'input', name: 'allowed_absence_count', responseKey: 'allowed_absence_count', placeholder: ' ', label: 'تعداد مجاز غیبت', col: 'col-md-3 col-12' },
  222. { type: 'input', name: 'effective_absence_coefficient', responseKey: 'effective_absence_coefficient', placeholder: ' ', label: 'ضریب نمره حضور و غیاب', col: 'col-md-3 col-12' },
  223. { type: 'input', name: 'mandatory_assignment_count', responseKey: 'mandatory_assignment_count', placeholder: ' ', label: 'تعداد تکالیف اجباری', col: 'col-md-3 col-12' },
  224. { type: 'input', name: 'special_passing_mark', responseKey: 'special_passing_mark', placeholder: ' ', label: 'نمره قبولی مشروطی ها', col: 'col-md-3 col-12' },
  225. { type: 'input', name: 'minimum_conditional_passing_mark', responseKey: 'minimum_conditional_passing_mark', placeholder: ' ', label: 'نمره قبولی مشروط', col: 'col-md-3 col-12' },
  226. { type: 'input', name: 'minimum_clean_passing_mark', responseKey: 'minimum_clean_passing_mark', placeholder: ' ', label: 'نمره قبولی', col: 'col-md-3 col-12' },
  227. { type: 'separator', name: 'space', label: 'ثبت نام و حذف و اضافه', className: 'custom-separator', col: 'col-12' },
  228. { type: 'dateTime', name: 'beginning_enrollment_period', responseKey: 'beginning_enrollment_period', placeholder: ' ', label: 'تاریخ شروع پیش ثبت نام', col: 'col-md-6 col-12' },
  229. { type: 'dateTime', name: 'ending_enrollment_period', responseKey: 'ending_enrollment_period', placeholder: ' ', label: 'تاریخ پایان پیش ثبت نام', col: 'col-md-6 col-12' },
  230. { type: 'dateTime', name: 'beginning_registration_period', responseKey: 'beginning_registration_period', placeholder: ' ', label: 'تاریخ شروع ثبت نام', col: 'col-md-6 col-12' },
  231. { type: 'dateTime', name: 'ending_registration_period', responseKey: 'ending_registration_period', placeholder: ' ', label: 'تاریخ پایان ثبت نام', col: 'col-md-6 col-12' },
  232. { type: 'input', name: 'registration_period_refund_percent', responseKey: 'registration_period_refund_percent', placeholder: ' ', label: 'درصد برگشت هزینه انصراف در بازه ثبت نام', col: 'col-md-3 col-12' },
  233. { type: 'checkbox', name: 'allow_adding_on_registration_period', responseKey: 'allow_adding_on_registration_period', label: 'امکان اضافه کردن در بازه ثبت نام', col: 'col-md-3 col-12' },
  234. { type: 'checkbox', name: 'allow_dropping_on_registration_period', responseKey: 'allow_dropping_on_registration_period', label: 'امکان حذف ثبت نام در بازه ثبت نام', col: 'col-md-3 col-12' },
  235. { type: 'dateTime', name: 'beginning_drop_add_period', responseKey: 'beginning_drop_add_period', placeholder: ' ', label: 'تاریخ شروع حذف و اضافه', col: 'col-md-6 col-12' },
  236. { type: 'dateTime', name: 'ending_drop_add_period', responseKey: 'ending_drop_add_period', placeholder: ' ', label: 'تاریخ پایان حذف و اضافه', col: 'col-md-6 col-12' },
  237. { type: 'input', name: 'drop_add_period_refund_percent', responseKey: 'drop_add_period_refund_percent', placeholder: ' ', label: 'درصد برگشت هزینه انصراف در بازه حذف و اضافه', col: 'col-md-3 col-12' },
  238. { type: 'checkbox', name: 'allow_adding_on_drop_add_period', responseKey: 'allow_adding_on_drop_add_period', label: 'امکان اضافه شدن در بازه حذف و اضافه', col: 'col-md-3 col-12' },
  239. { type: 'checkbox', name: 'allow_dropping_on_drop_add_period', responseKey: 'allow_dropping_on_drop_add_period', label: 'امکان حذف در بازه حذف و اضافه', col: 'col-md-3 col-12' },
  240. { type: 'dateTime', name: 'publish_time', responseKey: 'publish_time', placeholder: ' ', label: 'تاریخ انتشار', col: 'col-md-6 col-12' },
  241. { type: 'separator', name: 'space', label: 'قوانین', className: 'custom-separator', col: 'col-12' },
  242. { type: 'inputEditor', name: 'rules', responseKey: 'rules', label: 'قوانین دوره آموزشی', col: 'col-12' },
  243. // -----------------------------------------------------------------------------------------------------------
  244. { type: 'separator', name: 'space', label: 'موارد زیر در طرح نبودند', className: 'custom-separator', col: 'col-12' },
  245. { type: 'select', name: 'audience_role', responseKey: 'audience_role', options: Enums.groups, placeholder: ' ', label: 'نقش', col: 'col-md-4 col-12' },
  246. { type: 'inputEditor', name: 'description', responseKey: 'description', label: '??توضیحات', col: 'col-12' },
  247. { type: 'hidden', name: 'id', responseKey: 'id', label: 'id', col: 'col-md-3 col-12' }
  248. ],
  249. classroom: new Classroom(),
  250. sessionListInputs: [
  251. { type: 'hidden', name: 'classroom', value: this.$route.params.id, label: 'نام دوره', col: 'col-12' }
  252. ],
  253. sessionListApi: APIGateway.session.APIAdresses.base,
  254. sessionListTable: {
  255. columns: [
  256. {
  257. name: 'id',
  258. required: true,
  259. label: 'شماره',
  260. align: 'left',
  261. field: row => row.id
  262. },
  263. {
  264. name: 'title',
  265. required: true,
  266. label: 'عنوان جلسه',
  267. align: 'left',
  268. field: row => row.title
  269. },
  270. {
  271. name: 'creation_time',
  272. required: true,
  273. label: 'زمان شروع جلسه',
  274. align: 'left',
  275. field: row => row.starting_time ? ShamsiDate.getDateTime(row.starting_time) : '-'
  276. },
  277. {
  278. name: 'last_modification_time',
  279. required: true,
  280. label: 'زمان پایان جلسه',
  281. align: 'left',
  282. field: row => row.ending_time ? ShamsiDate.getDateTime(row.ending_time) : '-'
  283. },
  284. {
  285. name: 'actions',
  286. required: true,
  287. label: 'عملیات',
  288. align: 'left',
  289. field: ''
  290. }
  291. ],
  292. data: []
  293. },
  294. sessionListTableKeys: {
  295. data: 'results',
  296. total: 'count',
  297. currentPage: 'current',
  298. perPage: 'per_page',
  299. pageKey: 'page'
  300. },
  301. membersListInputs: [
  302. { type: 'select', name: 'classroom', value: null, label: 'وضعیت', placeholder: ' ', col: 'col-md-3 col-12' },
  303. { type: BtnControlComp, name: 'btn', label: 'جستجو', placeholder: ' ', atClick: () => {}, col: 'col-md-2 col-12' }
  304. ],
  305. membersListApi: null,
  306. membersListTable: {
  307. columns: [
  308. {
  309. name: 'id',
  310. required: true,
  311. label: 'شماره',
  312. align: 'left',
  313. field: row => row.id
  314. },
  315. {
  316. name: 'owner_info.fullname',
  317. required: true,
  318. label: 'نام و نام خانوادگی',
  319. align: 'left',
  320. field: row => row.owner_info.firstname + ' ' + row.owner_info.lastname
  321. },
  322. {
  323. name: 'owner_info.fullname',
  324. required: true,
  325. label: 'کد ملی',
  326. align: 'left',
  327. field: row => row.owner_info.national_code
  328. },
  329. {
  330. name: 'is_project_done',
  331. required: true,
  332. label: 'پروژه',
  333. align: 'left',
  334. field: row => row.is_project_done
  335. },
  336. {
  337. name: 'done_assignment_count',
  338. required: true,
  339. label: 'تکالیف انجام شده',
  340. align: 'left',
  341. field: row => row.done_assignment_count
  342. },
  343. {
  344. name: 'is_allowed_absence_count',
  345. required: true,
  346. label: 'حضور و غیاب',
  347. align: 'left',
  348. field: row => row.is_allowed_absence_count // bool
  349. },
  350. {
  351. name: 'attendance_score',
  352. required: true,
  353. label: 'نمره حضور و غیاب',
  354. align: 'left',
  355. field: row => row.attendance_score
  356. },
  357. {
  358. name: 'final_test',
  359. required: true,
  360. label: 'آزمون',
  361. align: 'left',
  362. field: row => row.final_test // number - null
  363. },
  364. {
  365. name: 'final_status',
  366. required: true,
  367. label: 'وضعیت نهایی',
  368. align: 'left',
  369. field: row => row.final_status
  370. },
  371. {
  372. name: 'actions',
  373. required: true,
  374. label: 'سابقه آموزشی',
  375. align: 'left',
  376. field: ''
  377. }
  378. ],
  379. data: []
  380. },
  381. membersListTableKeys: {
  382. data: 'results',
  383. total: 'count',
  384. currentPage: 'current',
  385. perPage: 'per_page',
  386. pageKey: 'page'
  387. }
  388. }
  389. },
  390. computed: {
  391. selectedCategoryId () {
  392. return this.getInputValue('category')
  393. }
  394. },
  395. watch: {
  396. selectedCategoryId () {
  397. if (!this.mounted) {
  398. return
  399. }
  400. this.setInputValue('unit', null)
  401. this.getUnits(this.selectedCategoryId)
  402. }
  403. },
  404. mounted () {
  405. this.api = APIGateway.classroom.APIAdresses.byId(this.$route.params.id)
  406. this.membersListApi = APIGateway.classroom.APIAdresses.members(this.$route.params.id)
  407. this.preLoadData()
  408. .then(() => {
  409. this.mounted = true
  410. })
  411. .catch(() => {
  412. this.mounted = true
  413. })
  414. },
  415. methods: {
  416. setMembersListActionBtn () {
  417. FormBuilderAssist.setAttributeByName(this.membersListInputs, 'btn', 'atClick', this.searchMembersList)
  418. },
  419. searchMembersList () {
  420. this.$refs.membersList.search()
  421. },
  422. goToLiveStreamUrl () {
  423. window.open(this.classroom.live_streaming_url, '_blank')
  424. },
  425. afterLoadInputData (data) {
  426. this.classroom = new Classroom(data)
  427. // const gg = data.beginning_enrollment_period.replace('T', ' ')
  428. // this.setInputAttr('beginning_enrollment_period', 'value', gg)
  429. },
  430. setInputAttr (name, attr, value) {
  431. FormBuilderAssist.setAttributeByName(this.inputs, name, attr, value)
  432. // this.$refs.classroomEntityEdit.setInputAttributeByName(name, attr, value)
  433. },
  434. preLoadData () {
  435. return new Promise((resolve, reject) => {
  436. APIGateway.classroom.get(this.$route.params.id)
  437. .then((classroom) => {
  438. this.setInputAttr('category', 'value', classroom.unit_info.category_info.id)
  439. this.setInputAttr('unit', 'value', classroom.unit)
  440. this.beforeLoadInputData(classroom)
  441. .then((classroom) => {
  442. resolve()
  443. })
  444. .catch(() => {
  445. reject()
  446. })
  447. })
  448. .catch(() => {
  449. reject()
  450. })
  451. })
  452. },
  453. beforeLoadInputData (responseData) {
  454. return new Promise((resolve, reject) => {
  455. const promise1 = this.getProfessors()
  456. const promise2 = this.getCategories()
  457. const promise3 = this.getUnits(responseData.unit_info.category_info.id)
  458. this.$nextTick(() => {
  459. Promise.all([promise1, promise2, promise3])
  460. .then(() => {
  461. // this.setInputAttr('category', 'value', responseData.unit_info.category)
  462. // this.setInputAttr('unit', 'value', responseData.unit)
  463. this.classroomEntityEditKey = Date.now()
  464. resolve()
  465. })
  466. .catch(() => {
  467. reject()
  468. })
  469. })
  470. })
  471. },
  472. getProfessors () {
  473. return APIGateway.user.index({ per_page: 9999, role: 'professor' })
  474. .then((users) => {
  475. this.setInputAttr('professor', 'options', users.list.list.map(item => {
  476. return {
  477. value: item.id,
  478. label: this.getUserFullname(item)
  479. }
  480. }))
  481. })
  482. .catch(() => {})
  483. },
  484. getCategories () {
  485. return APIGateway.unitCategory.index({ per_page: 9999, type: 'DISCUSSION_CIRCLE' })
  486. .then((categories) => {
  487. this.setInputAttr('category', 'options', categories.list.list.map(item => {
  488. return {
  489. value: item.id,
  490. label: item.title
  491. }
  492. }))
  493. })
  494. .catch(() => {})
  495. },
  496. getUnits (selectedcategoryId) {
  497. if (!selectedcategoryId) {
  498. this.setInputAttr('unit', 'options', [])
  499. return
  500. }
  501. this.unitsLoading = true
  502. return APIGateway.unit.index({ per_page: 9999, category: selectedcategoryId })
  503. .then((units) => {
  504. this.setInputAttr('unit', 'options', units.list.list.map(item => {
  505. return {
  506. value: item.id,
  507. label: item.title
  508. }
  509. }))
  510. this.unitsLoading = false
  511. })
  512. .catch(() => {
  513. this.unitsLoading = false
  514. })
  515. },
  516. getUserFullname (user) {
  517. return user.firstname + ' ' + user.lastname
  518. },
  519. getSelectOptions (result, value, label) {
  520. return result.map(item => {
  521. return {
  522. value: item[value],
  523. label: item[label]
  524. }
  525. })
  526. },
  527. getInputValue (name) {
  528. const inputIndex = this.inputs.findIndex(input => input.name === name)
  529. return this.inputs[inputIndex].value
  530. },
  531. setInputValue (name, value) {
  532. const inputIndex = this.inputs.findIndex(input => input.name === name)
  533. this.inputs[inputIndex].value = value
  534. },
  535. loadSelectOptions (name, value, setNewInputData) {
  536. const inputIndex = this.inputs.findIndex(input => input.name === name)
  537. this.inputs[inputIndex].options = value
  538. if (typeof setNewInputData === 'function') {
  539. setNewInputData(this.inputs)
  540. }
  541. },
  542. updateClassroom () {
  543. this.$refs.classroomEntityEdit.editEntity()
  544. },
  545. getRemoveMessage (row) {
  546. return 'آیا از حذف ' + row.title + ' اطمینان دارید؟'
  547. }
  548. }
  549. }
  550. </script>
  551. <style lang="scss" scoped>
  552. .AdminClassroomShow {
  553. .action-column-entity-index {
  554. display: flex;
  555. align-items: center;
  556. justify-content: flex-start;
  557. }
  558. }
  559. </style>