|
|
@@ -2,6 +2,7 @@
|
|
|
<div class="AdminClassroomCreate">
|
|
|
<entity-create v-if="mounted"
|
|
|
ref="classroomEntityCreate"
|
|
|
+ :key="classroomEntityCreateKey"
|
|
|
v-model:value="inputs"
|
|
|
title="مشخصات دوره آموزشی"
|
|
|
:api="api"
|
|
|
@@ -37,6 +38,7 @@ export default {
|
|
|
data () {
|
|
|
return {
|
|
|
mounted: false,
|
|
|
+ classroomEntityCreateKey: Date.now(),
|
|
|
newUnitLoading: false,
|
|
|
newUnitName: null,
|
|
|
newUnitSessionCount: null,
|
|
|
@@ -45,87 +47,94 @@ export default {
|
|
|
entityParamKey: 'id',
|
|
|
showRouteName: 'Admin.Classroom.Show',
|
|
|
inputs: [
|
|
|
- { type: 'file', name: 'thumbnail', responseKey: 'thumbnail', label: 'آپلود عکس دوره', col: 'col-md-3' },
|
|
|
- { type: 'input', name: 'title', responseKey: 'title', label: 'نام دوره', col: 'col-md-12' },
|
|
|
+ { 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', 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: 'category',
|
|
|
- responseKey: 'category',
|
|
|
- options: [],
|
|
|
+ name: 'holding_year',
|
|
|
+ responseKey: 'holding_year',
|
|
|
+ options: [1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410],
|
|
|
value: null,
|
|
|
- label: 'دسته بندی',
|
|
|
+ label: 'انتخاب سال دوره',
|
|
|
+ placeholder: ' ',
|
|
|
col: 'col-md-3'
|
|
|
},
|
|
|
{
|
|
|
type: 'select',
|
|
|
- name: 'unit',
|
|
|
- responseKey: 'unit',
|
|
|
- options: [],
|
|
|
+ name: 'holding_month',
|
|
|
+ responseKey: 'holding_month',
|
|
|
+ options: [
|
|
|
+ 'فروردین',
|
|
|
+ 'اردیبهشت',
|
|
|
+ 'خرداد',
|
|
|
+ 'تیر',
|
|
|
+ 'مرداد',
|
|
|
+ 'شهریور',
|
|
|
+ 'مهر',
|
|
|
+ 'آبان',
|
|
|
+ 'آذر',
|
|
|
+ 'دی',
|
|
|
+ 'بهمن',
|
|
|
+ 'اسفند'
|
|
|
+ ],
|
|
|
value: null,
|
|
|
- label: 'درس',
|
|
|
+ label: 'انتخاب ماه دوره',
|
|
|
+ placeholder: ' ',
|
|
|
col: 'col-md-3'
|
|
|
},
|
|
|
- {
|
|
|
- type: 'select',
|
|
|
- name: 'audience_gender_type',
|
|
|
- responseKey: 'audience_gender_type',
|
|
|
- options: Enums.genders,
|
|
|
- value: null,
|
|
|
- label: 'جنسیت',
|
|
|
- col: 'col-md-3'
|
|
|
- },
|
|
|
- {
|
|
|
- type: 'select',
|
|
|
- name: 'audience_role',
|
|
|
- responseKey: 'audience_role',
|
|
|
- options: Enums.groups,
|
|
|
- value: null,
|
|
|
- label: 'نقش',
|
|
|
- col: 'col-md-3'
|
|
|
- },
|
|
|
- {
|
|
|
- type: 'select',
|
|
|
- name: 'category',
|
|
|
- responseKey: 'category',
|
|
|
- options: [],
|
|
|
- value: null,
|
|
|
- label: 'مجموعه',
|
|
|
- col: 'col-md-3'
|
|
|
- },
|
|
|
- {
|
|
|
- type: 'select',
|
|
|
- name: 'professor',
|
|
|
- responseKey: 'professor',
|
|
|
- options: [],
|
|
|
- value: null,
|
|
|
- label: 'استاد دوره',
|
|
|
- col: 'col-md-3'
|
|
|
- },
|
|
|
- { type: 'input', name: 'price', responseKey: 'price', label: 'هزینه برگزاری', col: 'col-md-3' },
|
|
|
- { type: 'input', name: 'capacity', responseKey: 'capacity', label: 'ظرفیت گروه درسی', col: 'col-md-3' },
|
|
|
- { type: 'input', name: 'allowed_absence_count', responseKey: 'allowed_absence_count', label: 'تعداد مجاز غیبت', col: 'col-md-3' },
|
|
|
- { type: 'input', name: 'effective_absence_coefficient', responseKey: 'effective_absence_coefficient', label: 'ضریب نمره حضور و غیاب', col: 'col-md-3' },
|
|
|
- { type: 'input', name: 'mandatory_assignment_count', responseKey: 'mandatory_assignment_count', label: 'تعداد تکالیف اجباری', col: 'col-md-3' },
|
|
|
- { type: 'input', name: 'maximum_failing_mark', responseKey: 'maximum_failing_mark', label: 'حداقل نمره قبولی', col: 'col-md-3' },
|
|
|
- { type: 'input', name: 'minimum_conditional_passing_mark', responseKey: 'minimum_conditional_passing_mark', label: 'حداقل نمره عدم مردودی', col: 'col-md-3' },
|
|
|
- { type: 'input', name: 'minimum_clean_passing_mark', responseKey: 'minimum_clean_passing_mark', label: 'حداقل نمره قبولی مشروط', col: 'col-md-3' },
|
|
|
- {
|
|
|
- type: 'select',
|
|
|
- name: 'holding_type',
|
|
|
- responseKey: 'holding_type',
|
|
|
- options: Enums.classroomHoldingTypes,
|
|
|
- value: null,
|
|
|
- label: 'نوع برگزاری',
|
|
|
- col: 'col-md-3'
|
|
|
- },
|
|
|
- { type: 'input', name: 'live_streaming_url', responseKey: 'live_streaming_url', label: 'لینک مکان برگزاری', col: 'col-md-12' },
|
|
|
- { type: 'inputEditor', name: 'classroom_address', responseKey: 'classroom_address', label: 'آدرس مکان برگزاری', col: 'col-md-12' },
|
|
|
- { type: 'dateTime', name: 'beginning_enrollment_period', responseKey: 'beginning_enrollment_period', label: 'تاریخ شروع پیش ثبت نام', col: 'col-md-6' },
|
|
|
- { type: 'dateTime', name: 'ending_enrollment_period', responseKey: 'ending_enrollment_period', label: 'تاریخ پایان پیش ثبت نام', col: 'col-md-6' },
|
|
|
- { type: 'dateTime', name: 'beginning_registration_period', responseKey: 'beginning_registration_period', label: 'تاریخ شروع ثبت نام', col: 'col-md-6' },
|
|
|
- { type: 'dateTime', name: 'ending_registration_period', responseKey: 'ending_registration_period', label: 'تاریخ پایان ثبت نام', col: 'col-md-6' },
|
|
|
- { type: 'inputEditor', name: 'rules', responseKey: 'rules', label: 'قوانین دوره آموزشی', col: 'col-md-12' },
|
|
|
- { type: 'dateTime', name: 'publish_time', responseKey: 'publish_time', label: 'تاریخ انتشار', col: 'col-md-6' }
|
|
|
+ { 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: 'maximum_failing_mark', responseKey: 'maximum_failing_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' }
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
@@ -142,47 +151,69 @@ export default {
|
|
|
},
|
|
|
mounted () {
|
|
|
this.mounted = true
|
|
|
- this.beforeLoadInputData()
|
|
|
+ this.preLoadData()
|
|
|
},
|
|
|
methods: {
|
|
|
- async beforeLoadInputData (responseData, setNewInputData) {
|
|
|
- this.getProfessors(setNewInputData)
|
|
|
- await this.getCategories(setNewInputData)
|
|
|
- await this.getUnits(responseData.unit_info.category, setNewInputData)
|
|
|
+ setInputAttr (name, attr, value) {
|
|
|
+ this.$refs.classroomEntityCreate.setInputAttributeByName(name, attr, value)
|
|
|
+ },
|
|
|
+ preLoadData () {
|
|
|
+ this.beforeLoadInputData()
|
|
|
+ },
|
|
|
+ beforeLoadInputData () {
|
|
|
+ const promise1 = this.getProfessors()
|
|
|
+ const promise2 = this.getCategories()
|
|
|
+ const promise3 = this.getUnits()
|
|
|
this.$nextTick(() => {
|
|
|
- this.setInputValue('category', responseData.unit_info.category)
|
|
|
- this.setInputValue('unit', responseData.unit)
|
|
|
+ Promise.all([promise1, promise2, promise3])
|
|
|
+ .then(() => {
|
|
|
+ // this.setInputAttr('category', 'value', responseData.unit_info.category)
|
|
|
+ // this.setInputAttr('unit', 'value', responseData.unit)
|
|
|
+ this.classroomEntityCreateKey = Date.now()
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
})
|
|
|
},
|
|
|
- async getProfessors (setNewInputData) {
|
|
|
- APIGateway.user.index({ per_page: 9999, role: 'professor' })
|
|
|
+ getProfessors () {
|
|
|
+ return APIGateway.user.index({ per_page: 9999, role: 'professor' })
|
|
|
.then((users) => {
|
|
|
- this.loadSelectOptions('professor', users.list.list.map(item => {
|
|
|
+ this.setInputAttr('professor', 'options', users.list.list.map(item => {
|
|
|
return {
|
|
|
value: item.id,
|
|
|
label: this.getUserFullname(item)
|
|
|
}
|
|
|
- }), setNewInputData)
|
|
|
+ }))
|
|
|
})
|
|
|
.catch(() => {})
|
|
|
},
|
|
|
- getUserFullname (user) {
|
|
|
- return user.firstname + ' ' + user.lastname
|
|
|
- },
|
|
|
- async getCategories (setNewInputData) {
|
|
|
- APIGateway.unitCategory.index({ per_page: 9999 })
|
|
|
+ getCategories () {
|
|
|
+ return APIGateway.unitCategory.index({ per_page: 9999 })
|
|
|
.then((categories) => {
|
|
|
- this.loadSelectOptions('category', this.getSelectOptions(categories.list.list, 'id', 'title'), setNewInputData)
|
|
|
+ this.setInputAttr('category', 'options', categories.list.list.map(item => {
|
|
|
+ return {
|
|
|
+ value: item.id,
|
|
|
+ label: item.title
|
|
|
+ }
|
|
|
+ }))
|
|
|
})
|
|
|
.catch(() => {})
|
|
|
},
|
|
|
- async getUnits (selectedcategoryId, setNewInputData) {
|
|
|
- APIGateway.unit.index({ per_page: 9999, category: selectedcategoryId })
|
|
|
+ getUnits (selectedcategoryId = null) {
|
|
|
+ return APIGateway.unit.index({ per_page: 9999, category: selectedcategoryId })
|
|
|
.then((units) => {
|
|
|
- this.loadSelectOptions('unit', this.getSelectOptions(units.list.list, 'id', 'title'), setNewInputData)
|
|
|
+ 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 {
|