| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567 |
- <template>
- <q-card class="AdminClassroomShow">
- <q-tabs v-model="tab"
- dense
- class="text-grey"
- active-color="primary"
- indicator-color="primary"
- align="justify"
- narrow-indicator>
- <q-tab name="classroomInfo"
- label="مشخصات" />
- <q-tab name="educations"
- label="لیست جلسات" />
- <q-tab name="movies1"
- label="پروژهها" />
- <q-tab name="movies2"
- label="آزمون" />
- <q-tab name="members"
- label="اندیشه جویان" />
- <q-tab name="live_streaming_url"
- label="بخش آنلاین" />
- </q-tabs>
- <q-separator />
- <q-tab-panels v-model="tab"
- animated>
- <q-tab-panel name="classroomInfo"
- class="q-pa-none">
- <entity-edit v-if="mounted"
- ref="classroomEntityEdit"
- :key="classroomEntityEditKey"
- v-model:value="inputs"
- title="مشخصات دوره آموزشی"
- :api="api"
- :entity-id-key="entityIdKey"
- :entity-param-key="entityParamKey"
- :show-route-name="showRouteName"
- :show-close-button="false"
- :show-edit-button="false"
- :show-expand-button="false"
- :show-save-button="false"
- :show-reload-button="false"
- :after-load-input-data="afterLoadInputData">
- <template #after-form-builder>
- <div class="flex justify-end">
- <q-btn color="primary"
- label="بروزرسانی اطلاعات"
- @click="updateClassroom" />
- </div>
- </template>
- </entity-edit>
- <q-skeleton v-else
- type="rect"
- height="200px" />
- </q-tab-panel>
- <q-tab-panel name="educations"
- class="q-pa-none">
- <entity-index v-if="mounted"
- v-model:value="sessionListInputs"
- title="لیست جلسات"
- :api="sessionListApi"
- :table="sessionListTable"
- :table-keys="sessionListTableKeys"
- :show-search-button="false"
- :show-reload-button="false"
- :show-expand-button="false">
- <template v-slot:entity-index-table-cell="{inputData, showConfirmRemoveDialog}">
- <template v-if="inputData.col.name === 'actions'">
- <div class="action-column-entity-index">
- <q-btn size="md"
- color="primary"
- label="جزییات"
- :to="{name: 'Admin.Session.Show', params: {id: inputData.props.row.id}}"
- class="q-mr-md" />
- <delete-btn @click="showConfirmRemoveDialog(inputData.props.row, 'id', getRemoveMessage(inputData.props.row))" />
- </div>
- </template>
- <template v-else>
- {{ inputData.col.value }}
- </template>
- </template>
- </entity-index>
- <q-skeleton v-else
- type="rect"
- height="200px" />
- </q-tab-panel>
- <q-tab-panel name="movies1">
- پروژهها
- </q-tab-panel>
- <q-tab-panel name="movies2">
- آزمون
- </q-tab-panel>
- <q-tab-panel name="members"
- class="q-pa-none">
- <entity-index v-if="mounted"
- ref="membersList"
- v-model:value="membersListInputs"
- title="لیست کاربران"
- :api="membersListApi"
- :table="membersListTable"
- :table-keys="membersListTableKeys"
- :show-search-button="false"
- :show-reload-button="false"
- :show-expand-button="false">
- <template v-slot:entity-index-table-cell="{inputData, showConfirmRemoveDialog}">
- <template v-if="inputData.col.name === 'actions'">
- <div class="action-column-entity-index">
- <q-btn size="md"
- color="primary"
- outline
- label="سابقه آموزشی"
- class="q-mr-md" />
- <!-- :to="{name: 'Admin.Session.Show', params: {id: inputData.props.row.id}}"-->
- <delete-btn @click="showConfirmRemoveDialog(inputData.props.row, 'id', getRemoveMessage(inputData.props.row))" />
- </div>
- </template>
- <template v-else>
- {{ inputData.col.value }}
- </template>
- </template>
- </entity-index>
- <q-skeleton v-else
- type="rect"
- height="200px" />
- </q-tab-panel>
- <q-tab-panel name="live_streaming_url">
- <q-btn class="full-width q-mb-lg"
- color="primary"
- @click="goToLiveStreamUrl">
- رفتن به کلاس
- </q-btn>
- <iframe :src="classroom.live_streaming_url"
- title="W3Schools Free Online Web Tutorials"
- style="height: 80vh"
- class="full-width" />
- </q-tab-panel>
- </q-tab-panels>
- </q-card>
- </template>
- <script>
- import { shallowRef } from 'vue'
- import Enums from 'src/assets/Enums/Enums.js'
- import ShamsiDate from 'src/assets/ShamsiDate.js'
- import { APIGateway } from 'src/api/APIGateway.js'
- import { Classroom } from 'src/models/Classroom.js'
- import { EntityEdit, EntityIndex } from 'quasar-crud'
- import { FormBuilderAssist } from 'quasar-form-builder'
- import BtnControl from 'src/components/Control/btn.vue'
- import DeleteBtn from 'src/components/Control/DeleteBtn.vue'
- const BtnControlComp = shallowRef(BtnControl)
- export default {
- name: 'Admin.Classroom.Show',
- components: {
- EntityEdit,
- EntityIndex,
- DeleteBtn
- },
- data () {
- return {
- mounted: false,
- classroomEntityEditKey: Date.now(),
- tab: 'classroomInfo',
- api: null,
- entityIdKey: 'id',
- entityParamKey: 'id',
- showRouteName: 'Admin.Classroom.Show',
- inputs: [
- { type: 'separator', name: 'space', label: 'مشخصات دوره', className: 'custom-separator', col: 'col-12' },
- { type: 'file', name: 'thumbnail', responseKey: 'thumbnail', label: 'آپلود عکس دوره', col: 'col-md-3 col-12' },
- { type: 'separator', name: 'space', size: '0', col: 'col-md-12' },
- { type: 'select', name: 'category', responseKey: 'unit_info.category_info.id', options: [], value: null, placeholder: ' ', label: 'دسته بندی', col: 'col-md-3 col-12' },
- { type: 'select', name: 'unit', responseKey: 'unit', options: [], value: null, placeholder: ' ', label: 'درس', col: 'col-md-3 col-12' },
- { type: 'select', name: 'holding_type', responseKey: 'holding_type', options: Enums.classroomHoldingTypes, value: null, placeholder: ' ', label: 'نوع برگزاری', col: 'col-md-3 col-12' },
- { type: 'input', name: 'price', responseKey: 'price', placeholder: ' ', label: 'هزینه برگزاری', col: 'col-md-3 col-12' },
- { type: 'input', name: 'live_streaming_url', responseKey: 'live_streaming_url', placeholder: ' ', label: 'لینک مکان مجازی دوره', col: 'col-12' },
- { type: 'inputEditor', name: 'classroom_address', responseKey: 'classroom_address', placeholder: ' ', label: 'آدرس مکان فیزیکی دوره', col: 'col-12' },
- {
- type: 'select',
- name: 'holding_year',
- responseKey: 'holding_year',
- options: [1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410],
- value: null,
- label: 'انتخاب سال دوره',
- placeholder: ' ',
- col: 'col-md-3'
- },
- {
- type: 'select',
- name: 'holding_month',
- responseKey: 'holding_month',
- options: [
- 'فروردین',
- 'اردیبهشت',
- 'خرداد',
- 'تیر',
- 'مرداد',
- 'شهریور',
- 'مهر',
- 'آبان',
- 'آذر',
- 'دی',
- 'بهمن',
- 'اسفند'
- ],
- value: null,
- label: 'انتخاب ماه دوره',
- placeholder: ' ',
- col: 'col-md-3'
- },
- { type: 'input', name: 'sessions_frequency', responseKey: 'sessions_frequency', placeholder: ' ', label: 'دوره تناوب', col: 'col-12' },
- { type: 'select', name: 'professor', responseKey: 'professor', options: [], value: null, placeholder: ' ', label: 'استاد دوره', col: 'col-md-3 col-12' },
- { type: 'separator', name: 'space', label: 'مشخصات اندیشه جو', className: 'custom-separator', col: 'col-12' },
- { type: 'select', name: 'audience_status_wwwww', responseKey: 'audience_status_wwwww', options: [], placeholder: ' ', label: 'وضعیت(؟)', col: 'col-md-3 col-12' },
- { type: 'select', name: 'category', responseKey: 'category', options: [], placeholder: ' ', label: 'مجموعه(؟)', col: 'col-md-3 col-12' },
- { type: 'select', name: 'audience_gender_type', responseKey: 'audience_gender_type', options: Enums.genders, placeholder: ' ', label: 'جنسیت', col: 'col-md-3 col-12' },
- { type: 'select', name: 'audience_bashgah_wwwww', responseKey: 'audience_bashgah_wwwww', options: [], placeholder: ' ', label: 'باشگاه(؟)', col: 'col-md-3 col-12' },
- { type: 'separator', name: 'space', label: 'تنظیمات دوره', className: 'custom-separator', col: 'col-12' },
- { type: 'input', name: 'capacity', responseKey: 'capacity', placeholder: ' ', label: 'ظرفیت گروه درسی', col: 'col-md-3 col-12' },
- { type: 'input', name: 'allowed_absence_count', responseKey: 'allowed_absence_count', placeholder: ' ', label: 'تعداد مجاز غیبت', col: 'col-md-3 col-12' },
- { type: 'input', name: 'effective_absence_coefficient', responseKey: 'effective_absence_coefficient', placeholder: ' ', label: 'ضریب نمره حضور و غیاب', col: 'col-md-3 col-12' },
- { type: 'input', name: 'mandatory_assignment_count', responseKey: 'mandatory_assignment_count', placeholder: ' ', label: 'تعداد تکالیف اجباری', col: 'col-md-3 col-12' },
- { type: 'input', name: 'special_passing_mark', responseKey: 'special_passing_mark', placeholder: ' ', label: 'نمره قبولی مشروطی ها', col: 'col-md-3 col-12' },
- { type: 'input', name: 'minimum_conditional_passing_mark', responseKey: 'minimum_conditional_passing_mark', placeholder: ' ', label: 'نمره قبولی مشروط', col: 'col-md-3 col-12' },
- { type: 'input', name: 'minimum_clean_passing_mark', responseKey: 'minimum_clean_passing_mark', placeholder: ' ', label: 'نمره قبولی', col: 'col-md-3 col-12' },
- { type: 'separator', name: 'space', label: 'ثبت نام و حذف و اضافه', className: 'custom-separator', col: 'col-12' },
- { type: 'dateTime', name: 'beginning_enrollment_period', responseKey: 'beginning_enrollment_period', placeholder: ' ', label: 'تاریخ شروع پیش ثبت نام', col: 'col-md-6 col-12' },
- { type: 'dateTime', name: 'ending_enrollment_period', responseKey: 'ending_enrollment_period', placeholder: ' ', label: 'تاریخ پایان پیش ثبت نام', col: 'col-md-6 col-12' },
- { type: 'dateTime', name: 'beginning_registration_period', responseKey: 'beginning_registration_period', placeholder: ' ', label: 'تاریخ شروع ثبت نام', col: 'col-md-6 col-12' },
- { type: 'dateTime', name: 'ending_registration_period', responseKey: 'ending_registration_period', placeholder: ' ', label: 'تاریخ پایان ثبت نام', col: 'col-md-6 col-12' },
- { type: 'input', name: 'registration_period_refund_percent', responseKey: 'registration_period_refund_percent', placeholder: ' ', label: 'درصد برگشت هزینه انصراف در بازه ثبت نام', col: 'col-md-3 col-12' },
- { type: 'checkbox', name: 'allow_dropping_on_drop_add_period', responseKey: 'allow_dropping_on_drop_add_period', label: 'امکان انصراف در بازه ثبت نام', col: 'col-md-9 col-12' },
- { type: 'dateTime', name: 'beginning_drop_add_period', responseKey: 'beginning_drop_add_period', placeholder: ' ', label: 'تاریخ شروع حذف و اضافه', col: 'col-md-6 col-12' },
- { type: 'dateTime', name: 'ending_drop_add_period', responseKey: 'ending_drop_add_period', placeholder: ' ', label: 'تاریخ پایان حذف و اضافه', col: 'col-md-6 col-12' },
- { type: 'input', name: 'drop_add_period_refund_percent', responseKey: 'drop_add_period_refund_percent', placeholder: ' ', label: 'درصد برگشت هزینه انصراف در بازه حذف و اضافه', col: 'col-md-3 col-12' },
- { type: 'checkbox', name: 'allow_dropping_on_drop_add_period', responseKey: 'allow_dropping_on_drop_add_period', label: 'امکان انصراف در بازه ثبت نام', col: 'col-md-3 col-12' },
- { type: 'checkbox', name: 'allow_dropping_on_drop_add_period', responseKey: 'allow_dropping_on_drop_add_period', label: 'امکان انصراف در بازه ثبت نام', col: 'col-md-6 col-12' },
- { type: 'dateTime', name: 'publish_time', responseKey: 'publish_time', placeholder: ' ', label: 'تاریخ انتشار', col: 'col-md-6 col-12' },
- { type: 'separator', name: 'space', label: 'قوانین', className: 'custom-separator', col: 'col-12' },
- { type: 'inputEditor', name: 'rules', responseKey: 'rules', label: 'قوانین دوره آموزشی', col: 'col-12' },
- // -----------------------------------------------------------------------------------------------------------
- { type: 'separator', name: 'space', label: 'موارد زیر در طرح نبودند', className: 'custom-separator', col: 'col-12' },
- { type: 'select', name: 'audience_role', responseKey: 'audience_role', options: Enums.groups, placeholder: ' ', label: 'نقش', col: 'col-md-4 col-12' },
- { type: 'inputEditor', name: 'description', responseKey: 'description', label: '??توضیحات', col: 'col-12' },
- { type: 'hidden', name: 'id', responseKey: 'id', label: 'id', col: 'col-md-3 col-12' }
- ],
- classroom: new Classroom(),
- sessionListInputs: [
- { type: 'hidden', name: 'classroom', value: this.$route.params.id, label: 'نام دوره', col: 'col-12' }
- ],
- sessionListApi: APIGateway.session.APIAdresses.base,
- sessionListTable: {
- columns: [
- {
- name: 'id',
- required: true,
- label: 'شماره',
- align: 'left',
- field: row => row.id
- },
- {
- name: 'title',
- required: true,
- label: 'عنوان جلسه',
- align: 'left',
- field: row => row.title
- },
- {
- name: 'creation_time',
- required: true,
- label: 'زمان شروع جلسه',
- align: 'left',
- field: row => row.starting_time ? ShamsiDate.getDateTime(row.starting_time) : '-'
- },
- {
- name: 'last_modification_time',
- required: true,
- label: 'زمان پایان جلسه',
- align: 'left',
- field: row => row.ending_time ? ShamsiDate.getDateTime(row.ending_time) : '-'
- },
- {
- name: 'actions',
- required: true,
- label: 'عملیات',
- align: 'left',
- field: ''
- }
- ],
- data: []
- },
- sessionListTableKeys: {
- data: 'results',
- total: 'count',
- currentPage: 'current',
- perPage: 'per_page',
- pageKey: 'page'
- },
- membersListInputs: [
- { type: 'select', name: 'classroom', value: null, label: 'وضعیت', placeholder: ' ', col: 'col-md-3 col-12' },
- { type: BtnControlComp, name: 'btn', label: 'جستجو', placeholder: ' ', atClick: () => {}, col: 'col-md-2 col-12' }
- ],
- membersListApi: null,
- membersListTable: {
- columns: [
- {
- name: 'id',
- required: true,
- label: 'شماره',
- align: 'left',
- field: row => row.id
- },
- {
- name: 'owner_info.fullname',
- required: true,
- label: 'نام و نام خانوادگی',
- align: 'left',
- field: row => row.owner_info.firstname + ' ' + row.owner_info.lastname
- },
- {
- name: 'owner_info.fullname',
- required: true,
- label: 'کد ملی',
- align: 'left',
- field: row => row.owner_info.national_code
- },
- {
- name: 'is_project_done',
- required: true,
- label: 'پروژه',
- align: 'left',
- field: row => row.is_project_done
- },
- {
- name: 'done_assignment_count',
- required: true,
- label: 'تکالیف انجام شده',
- align: 'left',
- field: row => row.done_assignment_count
- },
- {
- name: 'is_allowed_absence_count',
- required: true,
- label: 'حضور و غیاب',
- align: 'left',
- field: row => row.is_allowed_absence_count // bool
- },
- {
- name: 'attendance_score',
- required: true,
- label: 'نمره حضور و غیاب',
- align: 'left',
- field: row => row.attendance_score
- },
- {
- name: 'final_test',
- required: true,
- label: 'آزمون',
- align: 'left',
- field: row => row.final_test // number - null
- },
- {
- name: 'final_status',
- required: true,
- label: 'وضعیت نهایی',
- align: 'left',
- field: row => row.final_status
- },
- {
- name: 'actions',
- required: true,
- label: 'سابقه آموزشی',
- align: 'left',
- field: ''
- }
- ],
- data: []
- },
- membersListTableKeys: {
- data: 'results',
- total: 'count',
- currentPage: 'current',
- perPage: 'per_page',
- pageKey: 'page'
- }
- }
- },
- computed: {
- selectedCategoryId () {
- return this.getInputValue('category')
- }
- },
- watch: {
- selectedCategoryId () {
- if (!this.mounted) {
- return
- }
- this.setInputValue('unit', null)
- this.getUnits(this.selectedCategoryId)
- }
- },
- mounted () {
- this.api = APIGateway.classroom.APIAdresses.byId(this.$route.params.id)
- this.membersListApi = APIGateway.classroom.APIAdresses.members(this.$route.params.id)
- this.preLoadData()
- .then(() => {
- this.mounted = true
- })
- .catch(() => {
- this.mounted = true
- })
- },
- methods: {
- setMembersListActionBtn () {
- FormBuilderAssist.setAttributeByName(this.membersListInputs, 'btn', 'atClick', this.searchMembersList)
- },
- searchMembersList () {
- this.$refs.membersList.search()
- },
- goToLiveStreamUrl () {
- window.open(this.classroom.live_streaming_url, '_blank')
- },
- afterLoadInputData (data) {
- this.classroom = new Classroom(data)
- // const gg = data.beginning_enrollment_period.replace('T', ' ')
- // this.setInputAttr('beginning_enrollment_period', 'value', gg)
- },
- setInputAttr (name, attr, value) {
- FormBuilderAssist.setAttributeByName(this.inputs, name, attr, value)
- // this.$refs.classroomEntityEdit.setInputAttributeByName(name, attr, value)
- },
- preLoadData () {
- return new Promise((resolve, reject) => {
- APIGateway.classroom.get(this.$route.params.id)
- .then((classroom) => {
- this.setInputAttr('category', 'value', classroom.unit_info.category_info.id)
- this.setInputAttr('unit', 'value', classroom.unit)
- this.beforeLoadInputData(classroom)
- .then((classroom) => {
- resolve()
- })
- .catch(() => {
- reject()
- })
- })
- .catch(() => {
- reject()
- })
- })
- },
- beforeLoadInputData (responseData) {
- return new Promise((resolve, reject) => {
- const promise1 = this.getProfessors()
- const promise2 = this.getCategories()
- const promise3 = this.getUnits(responseData.unit_info.category)
- this.$nextTick(() => {
- Promise.all([promise1, promise2, promise3])
- .then(() => {
- // this.setInputAttr('category', 'value', responseData.unit_info.category)
- // this.setInputAttr('unit', 'value', responseData.unit)
- this.classroomEntityEditKey = Date.now()
- resolve()
- })
- .catch(() => {
- reject()
- })
- })
- })
- },
- getProfessors () {
- return APIGateway.user.index({ per_page: 9999, role: 'professor' })
- .then((users) => {
- this.setInputAttr('professor', 'options', users.list.list.map(item => {
- return {
- value: item.id,
- label: this.getUserFullname(item)
- }
- }))
- })
- .catch(() => {})
- },
- getCategories () {
- return APIGateway.unitCategory.index({ per_page: 9999 })
- .then((categories) => {
- this.setInputAttr('category', 'options', categories.list.list.map(item => {
- return {
- value: item.id,
- label: item.title
- }
- }))
- })
- .catch(() => {})
- },
- getUnits (selectedcategoryId) {
- return APIGateway.unit.index({ per_page: 9999, category: selectedcategoryId })
- .then((units) => {
- this.setInputAttr('unit', 'options', units.list.list.map(item => {
- return {
- value: item.id,
- label: item.title
- }
- }))
- })
- .catch(() => {})
- },
- getUserFullname (user) {
- return user.firstname + ' ' + user.lastname
- },
- getSelectOptions (result, value, label) {
- return result.map(item => {
- return {
- value: item[value],
- label: item[label]
- }
- })
- },
- getInputValue (name) {
- const inputIndex = this.inputs.findIndex(input => input.name === name)
- return this.inputs[inputIndex].value
- },
- setInputValue (name, value) {
- const inputIndex = this.inputs.findIndex(input => input.name === name)
- this.inputs[inputIndex].value = value
- },
- loadSelectOptions (name, value, setNewInputData) {
- const inputIndex = this.inputs.findIndex(input => input.name === name)
- this.inputs[inputIndex].options = value
- if (typeof setNewInputData === 'function') {
- setNewInputData(this.inputs)
- }
- },
- updateClassroom () {
- this.$refs.classroomEntityEdit.editEntity()
- },
- getRemoveMessage (row) {
- return 'آیا از حذف ' + row.title + ' اطمینان دارید؟'
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .AdminClassroomShow {
- .action-column-entity-index {
- display: flex;
- align-items: center;
- justify-content: flex-start;
- }
- }
- </style>
|