feat: reorder courses and students view for programs

This commit is contained in:
Jannat Patel
2024-11-20 19:32:49 +05:30
parent e1a78382c3
commit 582c7af12d
12 changed files with 575 additions and 137 deletions

View File

@@ -160,30 +160,45 @@
<script setup>
import {
Breadcrumbs,
Tabs,
Badge,
Breadcrumbs,
Button,
FormControl,
call,
createResource,
FormControl,
Tabs,
} from 'frappe-ui'
import CourseCard from '@/components/CourseCard.vue'
import { BookOpen, Plus, Search } from 'lucide-vue-next'
import { ref, computed, inject, onMounted, watch } from 'vue'
import { updateDocumentTitle } from '@/utils'
import { useRouter } from 'vue-router'
const user = inject('$user')
const searchQuery = ref('')
const currentCategory = ref(null)
const hasCourses = ref(false)
const router = useRouter()
onMounted(() => {
checkLearningPath()
let queries = new URLSearchParams(location.search)
if (queries.has('category')) {
currentCategory.value = queries.get('category')
}
})
const checkLearningPath = () => {
call('frappe.client.get_single_value', {
doctype: 'LMS Settings',
field: 'enable_learning_paths',
}).then((res) => {
if (res && !user.data?.is_moderator && !user.data?.is_instructor) {
router.push({ name: 'Programs' })
}
})
}
const courses = createResource({
url: 'lms.lms.utils.get_courses',
cache: ['courses', user.data?.email],