|
|
@@ -1,169 +1,294 @@
|
|
|
<template>
|
|
|
- <div class="AdminPostCreate"
|
|
|
- :style="localOptions.style">
|
|
|
- <div class="flex justify-end">
|
|
|
- <q-btn flat
|
|
|
- color="grey"
|
|
|
- @click="$router.go(-1)">
|
|
|
- بازگشت
|
|
|
- >
|
|
|
- </q-btn>
|
|
|
- </div>
|
|
|
+ <div class="flex justify-end">
|
|
|
+ <q-btn flat
|
|
|
+ color="grey"
|
|
|
+ @click="$router.go(-1)">
|
|
|
+ بازگشت
|
|
|
+ >
|
|
|
+ </q-btn>
|
|
|
+ </div>
|
|
|
+ <div class="AdminClassroomCreate">
|
|
|
+ <q-linear-progress v-if="unitsLoading"
|
|
|
+ indeterminate />
|
|
|
<entity-create v-if="mounted"
|
|
|
- ref="entityCreate"
|
|
|
+ ref="classroomEntityCreate"
|
|
|
+ :key="classroomEntityCreateKey"
|
|
|
v-model:value="inputs"
|
|
|
- title="ایجاد پست"
|
|
|
+ :title="'مشخصات ' + classroomTypeTitle"
|
|
|
:api="api"
|
|
|
:entity-id-key="entityIdKey"
|
|
|
:entity-param-key="entityParamKey"
|
|
|
- :show-route-name="showRouteName"
|
|
|
+ :show-route-name="showPageRouteName"
|
|
|
:show-close-button="false"
|
|
|
:show-edit-button="false"
|
|
|
:show-expand-button="false"
|
|
|
:show-save-button="false"
|
|
|
- :show-reload-button="false" />
|
|
|
+ :show-reload-button="false">
|
|
|
+ <template #after-form-builder>
|
|
|
+ <div class="flex justify-end q-mt-md">
|
|
|
+ <q-btn color="primary"
|
|
|
+ :label="'ایجاد ' + classroomTypeTitle + 'جدید'"
|
|
|
+ @click="createClassroom" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </entity-create>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { shallowRef } from 'vue'
|
|
|
import { EntityCreate } from 'quasar-crud'
|
|
|
+import Enums from 'src/assets/Enums/Enums.js'
|
|
|
import { mixinWidget } from 'src/mixin/Mixins.js'
|
|
|
import { APIGateway } from 'src/api/APIGateway.js'
|
|
|
-import BtnControl from 'src/components/Control/btn.vue'
|
|
|
-import PostMixin from 'src/components/Widgets/Post/PostMixin.js'
|
|
|
-import PostCategorySelector from 'src/components/FormBuilderCustumComponents/PostCategorySelector.vue'
|
|
|
-import FormBuilderTiptapEditor from 'src/components/FormBuilderCustumComponents/FormBuilderTiptapEditor.vue'
|
|
|
-// import { FormBuilderAssist } from 'quasar-form-builder'
|
|
|
+import { FormBuilderAssist } from 'quasar-form-builder'
|
|
|
+import { UnitCategory } from 'src/models/UnitCategory.js'
|
|
|
+import FormBuilderInputEditor from 'src/components/FormBuilderCustumComponents/FormBuilderInputEditor.vue'
|
|
|
|
|
|
-const BtnControlComp = shallowRef(BtnControl)
|
|
|
-const PostCategorySelectorComp = shallowRef(PostCategorySelector)
|
|
|
-const FormBuilderTiptapEditorComp = shallowRef(FormBuilderTiptapEditor)
|
|
|
+const FormBuilderInputEditorComp = shallowRef(FormBuilderInputEditor)
|
|
|
|
|
|
export default {
|
|
|
- name: 'AdminPostCreate',
|
|
|
- components: { EntityCreate },
|
|
|
- mixins: [mixinWidget, PostMixin],
|
|
|
+ name: 'Admin.Classroom.Create',
|
|
|
+ components: {
|
|
|
+ EntityCreate
|
|
|
+ },
|
|
|
+ mixins: [mixinWidget],
|
|
|
data () {
|
|
|
- const authorization = 'Bearer ' + this.$store.getters['Auth/accessToken']
|
|
|
- const uploadVideo = this.uploadVideo
|
|
|
- const uploadAudio = this.uploadAudio
|
|
|
return {
|
|
|
mounted: false,
|
|
|
- entityLoading: false,
|
|
|
- api: APIGateway.post.APIAdresses.base,
|
|
|
+ unitsLoading: false,
|
|
|
+ classroomEntityCreateKey: Date.now(),
|
|
|
+ newUnitLoading: false,
|
|
|
+ newUnitName: null,
|
|
|
+ newUnitSessionCount: null,
|
|
|
+ api: APIGateway.classroom.APIAdresses.base,
|
|
|
entityIdKey: 'id',
|
|
|
entityParamKey: 'id',
|
|
|
- showRouteName: 'Admin.Post.Show',
|
|
|
inputs: [
|
|
|
- { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-12' },
|
|
|
- { type: 'input', name: 'order', responseKey: 'order', label: 'ترتیب', placeholder: ' ', col: 'col-md-6 col-12' },
|
|
|
- { type: 'file', name: 'thumbnail', responseKey: 'thumbnail', label: 'عکس', placeholder: ' ', col: 'col-md-6 col-12' },
|
|
|
- { type: PostCategorySelectorComp, name: 'category', responseKey: 'category', col: 'col-12' },
|
|
|
+ { type: 'separator', name: 'space1', label: 'مشخصات', className: 'custom-separator', col: 'col-12' },
|
|
|
+ { type: 'file', name: 'thumbnail', responseKey: 'thumbnail', label: 'آپلود عکس', col: 'col-md-3 col-12' },
|
|
|
+ { type: 'file', name: 'codes', responseKey: 'codes', label: 'آیین نامه', col: 'col-md-3 col-12' },
|
|
|
+ { type: 'separator', name: 'space', size: '0', col: 'col-md-12' },
|
|
|
+ { type: 'select', name: 'category', responseKey: '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: FormBuilderInputEditorComp, name: 'classroom_address', responseKey: 'classroom_address', placeholder: ' ', label: 'آدرس مکان فیزیکی', col: 'col-12' },
|
|
|
{
|
|
|
- // type: 'tiptap-editor',
|
|
|
- type: FormBuilderTiptapEditorComp,
|
|
|
- name: 'summary',
|
|
|
- responseKey: 'summary',
|
|
|
- label: 'خلاصه',
|
|
|
- options: {
|
|
|
- bubbleMenu: false,
|
|
|
- floatingMenu: false,
|
|
|
- poem: false,
|
|
|
- reading: false,
|
|
|
- loadBareHtml: true,
|
|
|
- persianKeyboard: true,
|
|
|
- mathliveOptions: { smartFence: false },
|
|
|
- uploadServer: {
|
|
|
- url: '/api' + APIGateway.media.APIAdresses.base,
|
|
|
- instantUpload: true,
|
|
|
- responseKey: 'file',
|
|
|
- headers: { Authorization: authorization }
|
|
|
- },
|
|
|
- uploadVideo,
|
|
|
- uploadAudio
|
|
|
- },
|
|
|
- col: 'col-md-12 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: 'tiptap-editor',
|
|
|
- type: FormBuilderTiptapEditorComp,
|
|
|
- name: 'text',
|
|
|
- responseKey: 'text',
|
|
|
- label: 'متن',
|
|
|
- options: {
|
|
|
- bubbleMenu: false,
|
|
|
- floatingMenu: false,
|
|
|
- poem: false,
|
|
|
- reading: false,
|
|
|
- loadBareHtml: true,
|
|
|
- persianKeyboard: true,
|
|
|
- mathliveOptions: { smartFence: false },
|
|
|
- uploadServer: {
|
|
|
- url: '/api' + APIGateway.media.APIAdresses.base,
|
|
|
- instantUpload: true,
|
|
|
- responseKey: 'file',
|
|
|
- headers: { Authorization: authorization }
|
|
|
- },
|
|
|
- uploadVideo,
|
|
|
- uploadAudio
|
|
|
- },
|
|
|
- col: 'col-md-12 col-12'
|
|
|
+ type: 'select',
|
|
|
+ name: 'holding_month',
|
|
|
+ responseKey: 'holding_month',
|
|
|
+ options: [
|
|
|
+ 'فروردین',
|
|
|
+ 'اردیبهشت',
|
|
|
+ 'خرداد',
|
|
|
+ 'تیر',
|
|
|
+ 'مرداد',
|
|
|
+ 'شهریور',
|
|
|
+ 'مهر',
|
|
|
+ 'آبان',
|
|
|
+ 'آذر',
|
|
|
+ 'دی',
|
|
|
+ 'بهمن',
|
|
|
+ 'اسفند'
|
|
|
+ ],
|
|
|
+ value: null,
|
|
|
+ label: 'انتخاب ماه',
|
|
|
+ placeholder: ' ',
|
|
|
+ col: 'col-md-3'
|
|
|
},
|
|
|
- { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'ایجاد محتوا', placeholder: ' ', atClick: () => {}, 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: 'category1', responseKey: 'category1', 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_enrollment_period', responseKey: 'allow_dropping_on_enrollment_period', label: 'امکان حذف در بازه پیش ثبت نام', value: false, col: 'col-md-3 col-12' },
|
|
|
+ { type: 'checkbox', name: 'allow_adding_on_registration_period', responseKey: 'allow_adding_on_registration_period', label: 'امکان اضافه کردن در بازه ثبت نام', value: false, col: 'col-md-3 col-12' },
|
|
|
+ { type: 'checkbox', name: 'allow_dropping_on_registration_period', responseKey: 'allow_dropping_on_registration_period', label: 'امکان حذف ثبت نام در بازه ثبت نام', value: false, col: 'col-md-3 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_adding_on_drop_add_period', responseKey: 'allow_adding_on_drop_add_period', label: 'امکان اضافه شدن در بازه حذف و اضافه', value: false, col: 'col-md-3 col-12' },
|
|
|
+ { type: 'checkbox', name: 'allow_dropping_on_drop_add_period', responseKey: 'allow_dropping_on_drop_add_period', label: 'امکان حذف در بازه حذف و اضافه', value: false, col: 'col-md-3 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: FormBuilderInputEditorComp, name: 'rules', responseKey: 'rules', label: 'قوانین', col: 'col-12' },
|
|
|
+
|
|
|
+ { type: FormBuilderInputEditorComp, name: 'description', responseKey: 'description', label: 'توضیحات', col: 'col-12' },
|
|
|
+ { type: FormBuilderInputEditorComp, name: 'specification', responseKey: 'specification', label: 'مشخصات', col: 'col-12' },
|
|
|
+ { type: FormBuilderInputEditorComp, name: 'bulletin', responseKey: 'bulletin', 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: 'hidden', name: 'id', responseKey: 'id', label: 'id', col: 'col-md-3 col-12' }
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ classroomTypeTitle () {
|
|
|
+ const unitCategory = new UnitCategory({ type: this.localOptions.classroomType })
|
|
|
+ return unitCategory.type_info.label
|
|
|
+ },
|
|
|
+ createPageRouteName () {
|
|
|
+ if (this.localOptions.classroomType === 'TRAINING') {
|
|
|
+ return 'Admin.Classroom.Create'
|
|
|
+ }
|
|
|
+ if (this.localOptions.classroomType === 'EVENT') {
|
|
|
+ return 'Admin.Event.Create'
|
|
|
+ }
|
|
|
+ return 'Admin.Classroom.Create'
|
|
|
+ },
|
|
|
+ showPageRouteName () {
|
|
|
+ if (this.localOptions.classroomType === 'TRAINING') {
|
|
|
+ return 'Admin.Classroom.Show'
|
|
|
+ }
|
|
|
+ if (this.localOptions.classroomType === 'EVENT') {
|
|
|
+ return 'Admin.Event.Show'
|
|
|
+ }
|
|
|
+ return 'Admin.Classroom.Show'
|
|
|
+ },
|
|
|
+ selectedCategoryId () {
|
|
|
+ return FormBuilderAssist.getInputsByName(this.inputs, 'category')?.value
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ selectedCategoryId () {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'space1', 'value', null)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'unit', 'options', [])
|
|
|
+ this.getUnits(this.selectedCategoryId)
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted () {
|
|
|
- this.setActionBtn()
|
|
|
- // const options = FormBuilderAssist.getInputsByName(this.inputs, 'text').options
|
|
|
- // options.uploadVideo = this.uploadVideo
|
|
|
- // FormBuilderAssist.setAttributeByName(this.inputs, 'text', 'options', options)
|
|
|
- this.mounted = true
|
|
|
+ this.setClassroomTypeOfInputs()
|
|
|
+ this.preLoadData()
|
|
|
+ .then(() => {
|
|
|
+ this.mounted = true
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
- setActionBtn () {
|
|
|
- this.inputs.forEach((item, index) => {
|
|
|
- if (item.name === 'btn') {
|
|
|
- this.inputs[index].atClick = this.onSubmit
|
|
|
- }
|
|
|
+ setClassroomTypeOfInputs () {
|
|
|
+ if (this.localOptions.classroomType === 'TRAINING') {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'professor', 'label', 'استاد')
|
|
|
+ }
|
|
|
+ if (this.localOptions.classroomType === 'EVENT') {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'professor', 'label', 'برگزار کننده')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'unit', 'label', 'دسته')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'category', 'type', 'hidden') // unit -> category__type filter
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'allowed_absence_count', 'type', 'hidden')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'effective_absence_coefficient', 'type', 'hidden')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'mandatory_assignment_count', 'type', 'hidden')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'special_passing_mark', 'type', 'hidden')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'minimum_conditional_passing_mark', 'type', 'hidden')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'minimum_clean_passing_mark', 'type', 'hidden')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setInputAttr (name, attr, value) {
|
|
|
+ this.$refs.classroomEntityCreate.setInputAttributeByName(name, attr, value)
|
|
|
+ },
|
|
|
+ preLoadData () {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ const promise1 = this.getProfessors()
|
|
|
+ const promise2 = this.getCategories()
|
|
|
+ const promise3 = (this.localOptions.classroomType === 'EVENT') ? this.getUnits(null, this.localOptions.classroomType) : (Promise.resolve())
|
|
|
+ this.$nextTick(() => {
|
|
|
+ Promise.all([promise1, promise2, promise3])
|
|
|
+ .then(() => {
|
|
|
+ resolve()
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ reject()
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
- onSubmit () {
|
|
|
- this.create()
|
|
|
+ getProfessors () {
|
|
|
+ return APIGateway.user.index({ per_page: 9999, role: 'professor' })
|
|
|
+ .then((users) => {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'professor', 'options', users.list.list.map(item => {
|
|
|
+ return {
|
|
|
+ value: item.id,
|
|
|
+ label: this.getUserFullname(item)
|
|
|
+ }
|
|
|
+ }))
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
},
|
|
|
- create() {
|
|
|
- this.entityLoading = true
|
|
|
- this.$refs.entityCreate.createEntity()
|
|
|
- .then(() => {
|
|
|
- this.entityLoading = false
|
|
|
+ getCategories () {
|
|
|
+ return APIGateway.unitCategory.index({ per_page: 9999, type: 'TRAINING' })
|
|
|
+ .then((categories) => {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'category', 'options', categories.list.list.map(item => {
|
|
|
+ return {
|
|
|
+ value: item.id,
|
|
|
+ label: item.title
|
|
|
+ }
|
|
|
+ }))
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ },
|
|
|
+ getUnits (selectedcategoryId = null, categoryType = null) {
|
|
|
+ this.unitsLoading = true
|
|
|
+ APIGateway.unit.index({ per_page: 9999, category: selectedcategoryId, category__typ: categoryType })
|
|
|
+ .then((units) => {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'unit', 'options', units.list.list.map(item => {
|
|
|
+ return {
|
|
|
+ value: item.id,
|
|
|
+ label: item.title
|
|
|
+ }
|
|
|
+ }))
|
|
|
+ this.unitsLoading = false
|
|
|
})
|
|
|
.catch(() => {
|
|
|
- this.entityLoading = false
|
|
|
+ this.unitsLoading = false
|
|
|
})
|
|
|
+ },
|
|
|
+ getUserFullname (user) {
|
|
|
+ return user.firstname + ' ' + user.lastname
|
|
|
+ },
|
|
|
+ createClassroom () {
|
|
|
+ this.$refs.classroomEntityCreate.createEntity()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
-
|
|
|
-<style scoped lang="scss">
|
|
|
-.AdminPostCreate {
|
|
|
- .title {
|
|
|
- font-style: normal;
|
|
|
- font-weight: 700;
|
|
|
- font-size: 24px;
|
|
|
- line-height: 140%;
|
|
|
- color: #424242;
|
|
|
- margin-bottom: 27px;
|
|
|
- position: relative;
|
|
|
- .back-action {
|
|
|
- position: absolute;
|
|
|
- right: 0;
|
|
|
- top: 0;
|
|
|
- }
|
|
|
- }
|
|
|
- :deep(.form) {
|
|
|
- padding: 24px;
|
|
|
- }
|
|
|
-}
|
|
|
-</style>
|