fix: lesson editing
This commit is contained in:
@@ -145,9 +145,9 @@ const removeStudent = createResource({
|
||||
|
||||
const removeStudents = (selections) => {
|
||||
selections.forEach(async (student) => {
|
||||
console.log(student)
|
||||
removeStudent.submit({ student })
|
||||
await setTimeout(1000)
|
||||
})
|
||||
students.reload()
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -72,6 +72,7 @@ import { createToast, getFileSize } from '@/utils/'
|
||||
const resume = ref(null)
|
||||
const show = defineModel()
|
||||
const user = inject('$user')
|
||||
const application = defineModel('application')
|
||||
|
||||
const props = defineProps({
|
||||
job: {
|
||||
@@ -117,6 +118,8 @@ const submitResume = (close) => {
|
||||
icon: 'check',
|
||||
iconClasses: 'bg-green-600 text-white rounded-md p-px',
|
||||
})
|
||||
application.value.reload()
|
||||
close()
|
||||
},
|
||||
onError(err) {
|
||||
createToast({
|
||||
|
||||
@@ -8,12 +8,19 @@
|
||||
:items="[{ label: __('All Batches'), route: { name: 'Batches' } }]"
|
||||
/>
|
||||
<div class="flex">
|
||||
<Button variant="solid" @click="openBatchModal()">
|
||||
<template #prefix>
|
||||
<Plus class="h-4 w-4" />
|
||||
</template>
|
||||
{{ __('New Batch') }}
|
||||
</Button>
|
||||
<router-link
|
||||
:to="{
|
||||
name: 'CreateBatch',
|
||||
params: { batchName: 'new' },
|
||||
}"
|
||||
>
|
||||
<Button variant="solid">
|
||||
<template #prefix>
|
||||
<Plus class="h-4 w-4" />
|
||||
</template>
|
||||
{{ __('New Batch') }}
|
||||
</Button>
|
||||
</router-link>
|
||||
</div>
|
||||
</header>
|
||||
<div v-if="batches.data" class="pb-5">
|
||||
@@ -73,14 +80,12 @@
|
||||
</Tabs>
|
||||
</div>
|
||||
</div>
|
||||
<BatchCreation v-model="showBatchModal" />
|
||||
</template>
|
||||
<script setup>
|
||||
import { createListResource, Breadcrumbs, Button, Tabs, Badge } from 'frappe-ui'
|
||||
import { Plus } from 'lucide-vue-next'
|
||||
import BatchCard from '@/components/BatchCard.vue'
|
||||
import { inject, ref, computed } from 'vue'
|
||||
import BatchCreation from '@/components/Modals/BatchCreation.vue'
|
||||
|
||||
const user = inject('$user')
|
||||
const showBatchModal = ref(false)
|
||||
@@ -120,8 +125,4 @@ if (user.data) {
|
||||
count: computed(() => batches.data?.enrolled?.length),
|
||||
})
|
||||
}
|
||||
|
||||
const openBatchModal = () => {
|
||||
showBatchModal.value = true
|
||||
}
|
||||
</script>
|
||||
|
||||
37
frontend/src/pages/CreateBatch.vue
Normal file
37
frontend/src/pages/CreateBatch.vue
Normal file
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<div class="h-screen text-base">
|
||||
<header
|
||||
class="sticky top-0 z-10 flex items-center justify-between border-b bg-white px-3 py-2.5 sm:px-5"
|
||||
>
|
||||
<Breadcrumbs class="h-7" :items="breadcrumbs" />
|
||||
</header>
|
||||
<div>Batch creation</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { Breadcrumbs } from 'frappe-ui'
|
||||
|
||||
const props = defineProps({
|
||||
batchName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const breadcrumbs = computed(() => {
|
||||
let crumbs = [
|
||||
{
|
||||
label: 'Batches',
|
||||
route: {
|
||||
name: 'Batches',
|
||||
},
|
||||
},
|
||||
]
|
||||
crumbs.push({
|
||||
label: props.batchName == 'new' ? 'New Batch' : 'Edit Batch',
|
||||
route: { name: 'CreateBatch', params: { batchName: props.batchName } },
|
||||
})
|
||||
return crumbs
|
||||
})
|
||||
</script>
|
||||
@@ -43,7 +43,7 @@ import {
|
||||
Button,
|
||||
createDocumentResource,
|
||||
} from 'frappe-ui'
|
||||
import { computed, reactive, onMounted, onBeforeMount } from 'vue'
|
||||
import { computed, reactive, onMounted, inject } from 'vue'
|
||||
import EditorJS from '@editorjs/editorjs'
|
||||
import Header from '@editorjs/header'
|
||||
import Paragraph from '@editorjs/paragraph'
|
||||
@@ -54,6 +54,7 @@ import { createToast } from '../utils'
|
||||
|
||||
let editor
|
||||
let editLessonResource
|
||||
const user = inject('$user')
|
||||
|
||||
const props = defineProps({
|
||||
courseName: {
|
||||
@@ -71,8 +72,10 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
if (!user.data?.is_moderator || !user.data?.is_instructor) {
|
||||
window.location.href = '/login'
|
||||
}
|
||||
editor = renderEditor('content')
|
||||
/* renderEditor('instructor-notes') */
|
||||
})
|
||||
|
||||
const renderEditor = (holder) => {
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
</div>
|
||||
<JobApplicationModal
|
||||
v-model="showApplicationModal"
|
||||
v-model:application="jobApplication"
|
||||
:job="job.data.name"
|
||||
/>
|
||||
</div>
|
||||
@@ -112,25 +113,26 @@ const job = createResource({
|
||||
},
|
||||
cache: ['job', props.job],
|
||||
auto: true,
|
||||
onSuccess: (data) => {
|
||||
if (user.data?.name) {
|
||||
jobApplication.submit()
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
const jobApplication = createResource({
|
||||
url: 'frappe.client.get_list',
|
||||
params: {
|
||||
doctype: 'LMS Job Application',
|
||||
filters: {
|
||||
job: job.data?.name,
|
||||
user: user.data?.name,
|
||||
},
|
||||
makeParams(values) {
|
||||
return {
|
||||
doctype: 'LMS Job Application',
|
||||
filters: {
|
||||
job: job.data?.name,
|
||||
user: user.data?.name,
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
if (user.data?.name) {
|
||||
jobApplication.submit()
|
||||
}
|
||||
})
|
||||
|
||||
const openApplicationModal = () => {
|
||||
showApplicationModal.value = true
|
||||
}
|
||||
|
||||
@@ -82,6 +82,12 @@ const routes = [
|
||||
component: () => import('@/pages/CreateLesson.vue'),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/batches/:batchName/edit',
|
||||
name: 'CreateBatch',
|
||||
component: () => import('@/pages/CreateBatch.vue'),
|
||||
props: true,
|
||||
},
|
||||
]
|
||||
|
||||
let router = createRouter({
|
||||
|
||||
Reference in New Issue
Block a user