|
@@ -3,7 +3,7 @@
|
|
|
<div class="all-classroom-title">
|
|
<div class="all-classroom-title">
|
|
|
<div>
|
|
<div>
|
|
|
<q-banner class="banner">
|
|
<q-banner class="banner">
|
|
|
- دوره های آموزشی
|
|
|
|
|
|
|
+ {{ classroomTypeTitle }}
|
|
|
</q-banner>
|
|
</q-banner>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="all-classroom-filter">
|
|
<div class="all-classroom-filter">
|
|
@@ -68,7 +68,10 @@
|
|
|
<div v-for="classroom in classrooms.list"
|
|
<div v-for="classroom in classrooms.list"
|
|
|
:key="classroom.id"
|
|
:key="classroom.id"
|
|
|
class="classroom-col col-md-4">
|
|
class="classroom-col col-md-4">
|
|
|
- <classroom-item :classroom="classroom" />
|
|
|
|
|
|
|
+ <classroom-item v-if="localOptions.classroomType === 'TRAINING'"
|
|
|
|
|
+ :classroom="classroom" />
|
|
|
|
|
+ <event-item v-else-if="localOptions.classroomType === 'EVENT'"
|
|
|
|
|
+ :event="classroom" />
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div v-else-if="!classrooms.loading && classrooms.list.length === 0">
|
|
<div v-else-if="!classrooms.loading && classrooms.list.length === 0">
|
|
@@ -84,6 +87,7 @@
|
|
|
:units="units"
|
|
:units="units"
|
|
|
:professors="professors"
|
|
:professors="professors"
|
|
|
:categories="categories"
|
|
:categories="categories"
|
|
|
|
|
+ :classroom-type="localOptions.classroomType"
|
|
|
@doFilter="doFilter"
|
|
@doFilter="doFilter"
|
|
|
@cancelFilter="cancelFilter"
|
|
@cancelFilter="cancelFilter"
|
|
|
@onChangeCategory="onChangeCategory" />
|
|
@onChangeCategory="onChangeCategory" />
|
|
@@ -94,17 +98,18 @@
|
|
|
<script>
|
|
<script>
|
|
|
import { UnitList } from 'src/models/Unit.js'
|
|
import { UnitList } from 'src/models/Unit.js'
|
|
|
import Filters from './components/Filters.vue'
|
|
import Filters from './components/Filters.vue'
|
|
|
-import { mixinAuth } from 'src/mixin/Mixins.js'
|
|
|
|
|
import { APIGateway } from 'src/api/APIGateway.js'
|
|
import { APIGateway } from 'src/api/APIGateway.js'
|
|
|
-import { Classroom, ClassroomList } from 'src/models/Classroom.js'
|
|
|
|
|
|
|
+import { mixinAuth, mixinWidget } from 'src/mixin/Mixins.js'
|
|
|
import ClassroomItem from 'src/components/ClassroomItem.vue'
|
|
import ClassroomItem from 'src/components/ClassroomItem.vue'
|
|
|
import { UnitCategoryList } from 'src/models/UnitCategory.js'
|
|
import { UnitCategoryList } from 'src/models/UnitCategory.js'
|
|
|
|
|
+import EventItem from 'src/components/EventItem.vue'
|
|
|
|
|
+import { Classroom, ClassroomList } from 'src/models/Classroom.js'
|
|
|
import { ClassroomRegistrationList } from 'src/models/ClassroomRegistration.js'
|
|
import { ClassroomRegistrationList } from 'src/models/ClassroomRegistration.js'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'AllClassrooms',
|
|
name: 'AllClassrooms',
|
|
|
- components: { ClassroomItem, Filters },
|
|
|
|
|
- mixins: [mixinAuth],
|
|
|
|
|
|
|
+ components: { ClassroomItem, EventItem, Filters },
|
|
|
|
|
+ mixins: [mixinAuth, mixinWidget],
|
|
|
data: () => ({
|
|
data: () => ({
|
|
|
loading: false,
|
|
loading: false,
|
|
|
units: new UnitList(),
|
|
units: new UnitList(),
|
|
@@ -121,9 +126,21 @@ export default {
|
|
|
professor: null
|
|
professor: null
|
|
|
},
|
|
},
|
|
|
filterDialog: false,
|
|
filterDialog: false,
|
|
|
- classrooms: new ClassroomList()
|
|
|
|
|
|
|
+ classrooms: new ClassroomList(),
|
|
|
|
|
+ defaultOptions: {
|
|
|
|
|
+ classroomType: 'TRAINING'
|
|
|
|
|
+ }
|
|
|
}),
|
|
}),
|
|
|
computed: {
|
|
computed: {
|
|
|
|
|
+ classroomTypeTitle () {
|
|
|
|
|
+ if (this.localOptions.classroomType === 'TRAINING') {
|
|
|
|
|
+ return 'دوره های آموزشی'
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.localOptions.classroomType === 'EVENT') {
|
|
|
|
|
+ return 'رویدادها'
|
|
|
|
|
+ }
|
|
|
|
|
+ return 'دوره های آموزشی'
|
|
|
|
|
+ },
|
|
|
classroomStatuses () {
|
|
classroomStatuses () {
|
|
|
return (new Classroom()).statusEnums
|
|
return (new Classroom()).statusEnums
|
|
|
},
|
|
},
|
|
@@ -206,6 +223,7 @@ export default {
|
|
|
getClassrooms () {
|
|
getClassrooms () {
|
|
|
this.classrooms.loading = true
|
|
this.classrooms.loading = true
|
|
|
this.filter.per_page = 9999
|
|
this.filter.per_page = 9999
|
|
|
|
|
+ this.filter.unit__category__type = this.localOptions.classroomType
|
|
|
APIGateway.classroom.index(this.filter)
|
|
APIGateway.classroom.index(this.filter)
|
|
|
.then(classroomList => {
|
|
.then(classroomList => {
|
|
|
this.classrooms = new ClassroomList(classroomList.list)
|
|
this.classrooms = new ClassroomList(classroomList.list)
|
|
@@ -217,7 +235,9 @@ export default {
|
|
|
},
|
|
},
|
|
|
getCategories () {
|
|
getCategories () {
|
|
|
this.categories.loading = true
|
|
this.categories.loading = true
|
|
|
- APIGateway.unitCategory.index()
|
|
|
|
|
|
|
+ APIGateway.unitCategory.index({
|
|
|
|
|
+ type: this.localOptions.classroomType
|
|
|
|
|
+ })
|
|
|
.then(unitCategoryList => {
|
|
.then(unitCategoryList => {
|
|
|
this.categories.loading = false
|
|
this.categories.loading = false
|
|
|
this.categories = new UnitCategoryList(unitCategoryList.list)
|
|
this.categories = new UnitCategoryList(unitCategoryList.list)
|
|
@@ -240,9 +260,12 @@ export default {
|
|
|
getUserFullname (user) {
|
|
getUserFullname (user) {
|
|
|
return user.firstname + ' ' + user.lastname
|
|
return user.firstname + ' ' + user.lastname
|
|
|
},
|
|
},
|
|
|
- getUnits (categoryId) {
|
|
|
|
|
|
|
+ getUnits (categoryId = null) {
|
|
|
this.units.loading = true
|
|
this.units.loading = true
|
|
|
- APIGateway.unit.index({ category: categoryId })
|
|
|
|
|
|
|
+ APIGateway.unit.index({
|
|
|
|
|
+ category: categoryId,
|
|
|
|
|
+ category__type: this.localOptions.classroomType
|
|
|
|
|
+ })
|
|
|
.then(unitList => {
|
|
.then(unitList => {
|
|
|
this.units.loading = false
|
|
this.units.loading = false
|
|
|
this.units = new UnitList(unitList.list)
|
|
this.units = new UnitList(unitList.list)
|