@@ -105,6 +105,7 @@ import {
|
|||||||
Select,
|
Select,
|
||||||
TabButtons,
|
TabButtons,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
|
import { useRouteQuery } from '@vueuse/router'
|
||||||
import { computed, inject, onMounted, ref, watch } from 'vue'
|
import { computed, inject, onMounted, ref, watch } from 'vue'
|
||||||
import { BookOpen, Plus } from 'lucide-vue-next'
|
import { BookOpen, Plus } from 'lucide-vue-next'
|
||||||
import { updateDocumentTitle } from '@/utils'
|
import { updateDocumentTitle } from '@/utils'
|
||||||
@@ -119,7 +120,10 @@ const currentCategory = ref(null)
|
|||||||
const title = ref('')
|
const title = ref('')
|
||||||
const certification = ref(false)
|
const certification = ref(false)
|
||||||
const filters = ref({})
|
const filters = ref({})
|
||||||
const currentTab = ref(user.data?.is_student ? 'All' : 'Upcoming')
|
const currentTab = useRouteQuery(
|
||||||
|
'tab',
|
||||||
|
user.data?.is_student ? 'All' : 'Upcoming'
|
||||||
|
)
|
||||||
const orderBy = ref('start_date')
|
const orderBy = ref('start_date')
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -250,7 +254,12 @@ const setQueryParams = () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
history.replaceState({}, '', `${location.pathname}?${queries.toString()}`)
|
let queryString = ''
|
||||||
|
if (queries.toString()) {
|
||||||
|
queryString = `?${queries.toString()}`
|
||||||
|
}
|
||||||
|
|
||||||
|
history.replaceState({}, '', `${location.pathname}${queryString}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateCategories = (data) => {
|
const updateCategories = (data) => {
|
||||||
@@ -270,18 +279,6 @@ watch(currentTab, () => {
|
|||||||
updateBatches()
|
updateBatches()
|
||||||
})
|
})
|
||||||
|
|
||||||
const batchType = computed(() => {
|
|
||||||
let types = [
|
|
||||||
{ label: __(''), value: null },
|
|
||||||
{ label: __('Upcoming'), value: 'Upcoming' },
|
|
||||||
{ label: __('Archived'), value: 'Archived' },
|
|
||||||
]
|
|
||||||
if (user.data?.is_moderator) {
|
|
||||||
types.push({ label: __('Unpublished'), value: 'Unpublished' })
|
|
||||||
}
|
|
||||||
return types
|
|
||||||
})
|
|
||||||
|
|
||||||
const batchTabs = computed(() => {
|
const batchTabs = computed(() => {
|
||||||
let tabs = [
|
let tabs = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ import {
|
|||||||
Select,
|
Select,
|
||||||
TabButtons,
|
TabButtons,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
|
import { useRouteQuery } from '@vueuse/router'
|
||||||
import { computed, inject, onMounted, ref, watch } from 'vue'
|
import { computed, inject, onMounted, ref, watch } from 'vue'
|
||||||
import { BookOpen, Plus } from 'lucide-vue-next'
|
import { BookOpen, Plus } from 'lucide-vue-next'
|
||||||
import { updateDocumentTitle } from '@/utils'
|
import { updateDocumentTitle } from '@/utils'
|
||||||
@@ -119,7 +120,7 @@ const currentCategory = ref(null)
|
|||||||
const title = ref('')
|
const title = ref('')
|
||||||
const certification = ref(false)
|
const certification = ref(false)
|
||||||
const filters = ref({})
|
const filters = ref({})
|
||||||
const currentTab = ref('Live')
|
const currentTab = useRouteQuery('tab', 'Live')
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setFiltersFromQuery()
|
setFiltersFromQuery()
|
||||||
@@ -255,7 +256,12 @@ const setQueryParams = () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
history.replaceState({}, '', `${location.pathname}?${queries.toString()}`)
|
let queryString = ''
|
||||||
|
if (queries.toString()) {
|
||||||
|
queryString = `?${queries.toString()}`
|
||||||
|
}
|
||||||
|
|
||||||
|
history.replaceState({}, '', `${location.pathname}${queryString}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateCategories = (data) => {
|
const updateCategories = (data) => {
|
||||||
@@ -275,21 +281,6 @@ watch(currentTab, () => {
|
|||||||
updateCourses()
|
updateCourses()
|
||||||
})
|
})
|
||||||
|
|
||||||
const courseType = computed(() => {
|
|
||||||
let types = [
|
|
||||||
{ label: __(''), value: null },
|
|
||||||
{ label: __('New'), value: 'New' },
|
|
||||||
{ label: __('Upcoming'), value: 'Upcoming' },
|
|
||||||
]
|
|
||||||
if (user.data?.is_student) {
|
|
||||||
types.push({ label: __('Enrolled'), value: 'Enrolled' })
|
|
||||||
}
|
|
||||||
if (user.data?.is_moderator || user.data?.is_instructor) {
|
|
||||||
types.push({ label: __('Created'), value: 'Created' })
|
|
||||||
}
|
|
||||||
return types
|
|
||||||
})
|
|
||||||
|
|
||||||
const courseTabs = computed(() => {
|
const courseTabs = computed(() => {
|
||||||
let tabs = [
|
let tabs = [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user