fix: lesson editing
This commit is contained in:
@@ -145,9 +145,9 @@ const removeStudent = createResource({
|
|||||||
|
|
||||||
const removeStudents = (selections) => {
|
const removeStudents = (selections) => {
|
||||||
selections.forEach(async (student) => {
|
selections.forEach(async (student) => {
|
||||||
console.log(student)
|
|
||||||
removeStudent.submit({ student })
|
removeStudent.submit({ student })
|
||||||
await setTimeout(1000)
|
await setTimeout(1000)
|
||||||
})
|
})
|
||||||
|
students.reload()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ import { createToast, getFileSize } from '@/utils/'
|
|||||||
const resume = ref(null)
|
const resume = ref(null)
|
||||||
const show = defineModel()
|
const show = defineModel()
|
||||||
const user = inject('$user')
|
const user = inject('$user')
|
||||||
|
const application = defineModel('application')
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
job: {
|
job: {
|
||||||
@@ -117,6 +118,8 @@ const submitResume = (close) => {
|
|||||||
icon: 'check',
|
icon: 'check',
|
||||||
iconClasses: 'bg-green-600 text-white rounded-md p-px',
|
iconClasses: 'bg-green-600 text-white rounded-md p-px',
|
||||||
})
|
})
|
||||||
|
application.value.reload()
|
||||||
|
close()
|
||||||
},
|
},
|
||||||
onError(err) {
|
onError(err) {
|
||||||
createToast({
|
createToast({
|
||||||
|
|||||||
@@ -8,12 +8,19 @@
|
|||||||
:items="[{ label: __('All Batches'), route: { name: 'Batches' } }]"
|
:items="[{ label: __('All Batches'), route: { name: 'Batches' } }]"
|
||||||
/>
|
/>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<Button variant="solid" @click="openBatchModal()">
|
<router-link
|
||||||
<template #prefix>
|
:to="{
|
||||||
<Plus class="h-4 w-4" />
|
name: 'CreateBatch',
|
||||||
</template>
|
params: { batchName: 'new' },
|
||||||
{{ __('New Batch') }}
|
}"
|
||||||
</Button>
|
>
|
||||||
|
<Button variant="solid">
|
||||||
|
<template #prefix>
|
||||||
|
<Plus class="h-4 w-4" />
|
||||||
|
</template>
|
||||||
|
{{ __('New Batch') }}
|
||||||
|
</Button>
|
||||||
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div v-if="batches.data" class="pb-5">
|
<div v-if="batches.data" class="pb-5">
|
||||||
@@ -73,14 +80,12 @@
|
|||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<BatchCreation v-model="showBatchModal" />
|
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { createListResource, Breadcrumbs, Button, Tabs, Badge } from 'frappe-ui'
|
import { createListResource, Breadcrumbs, Button, Tabs, Badge } from 'frappe-ui'
|
||||||
import { Plus } from 'lucide-vue-next'
|
import { Plus } from 'lucide-vue-next'
|
||||||
import BatchCard from '@/components/BatchCard.vue'
|
import BatchCard from '@/components/BatchCard.vue'
|
||||||
import { inject, ref, computed } from 'vue'
|
import { inject, ref, computed } from 'vue'
|
||||||
import BatchCreation from '@/components/Modals/BatchCreation.vue'
|
|
||||||
|
|
||||||
const user = inject('$user')
|
const user = inject('$user')
|
||||||
const showBatchModal = ref(false)
|
const showBatchModal = ref(false)
|
||||||
@@ -120,8 +125,4 @@ if (user.data) {
|
|||||||
count: computed(() => batches.data?.enrolled?.length),
|
count: computed(() => batches.data?.enrolled?.length),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const openBatchModal = () => {
|
|
||||||
showBatchModal.value = true
|
|
||||||
}
|
|
||||||
</script>
|
</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,
|
Button,
|
||||||
createDocumentResource,
|
createDocumentResource,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { computed, reactive, onMounted, onBeforeMount } from 'vue'
|
import { computed, reactive, onMounted, inject } from 'vue'
|
||||||
import EditorJS from '@editorjs/editorjs'
|
import EditorJS from '@editorjs/editorjs'
|
||||||
import Header from '@editorjs/header'
|
import Header from '@editorjs/header'
|
||||||
import Paragraph from '@editorjs/paragraph'
|
import Paragraph from '@editorjs/paragraph'
|
||||||
@@ -54,6 +54,7 @@ import { createToast } from '../utils'
|
|||||||
|
|
||||||
let editor
|
let editor
|
||||||
let editLessonResource
|
let editLessonResource
|
||||||
|
const user = inject('$user')
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
courseName: {
|
courseName: {
|
||||||
@@ -71,8 +72,10 @@ const props = defineProps({
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
if (!user.data?.is_moderator || !user.data?.is_instructor) {
|
||||||
|
window.location.href = '/login'
|
||||||
|
}
|
||||||
editor = renderEditor('content')
|
editor = renderEditor('content')
|
||||||
/* renderEditor('instructor-notes') */
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const renderEditor = (holder) => {
|
const renderEditor = (holder) => {
|
||||||
|
|||||||
@@ -83,6 +83,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<JobApplicationModal
|
<JobApplicationModal
|
||||||
v-model="showApplicationModal"
|
v-model="showApplicationModal"
|
||||||
|
v-model:application="jobApplication"
|
||||||
:job="job.data.name"
|
:job="job.data.name"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -112,25 +113,26 @@ const job = createResource({
|
|||||||
},
|
},
|
||||||
cache: ['job', props.job],
|
cache: ['job', props.job],
|
||||||
auto: true,
|
auto: true,
|
||||||
|
onSuccess: (data) => {
|
||||||
|
if (user.data?.name) {
|
||||||
|
jobApplication.submit()
|
||||||
|
}
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const jobApplication = createResource({
|
const jobApplication = createResource({
|
||||||
url: 'frappe.client.get_list',
|
url: 'frappe.client.get_list',
|
||||||
params: {
|
makeParams(values) {
|
||||||
doctype: 'LMS Job Application',
|
return {
|
||||||
filters: {
|
doctype: 'LMS Job Application',
|
||||||
job: job.data?.name,
|
filters: {
|
||||||
user: user.data?.name,
|
job: job.data?.name,
|
||||||
},
|
user: user.data?.name,
|
||||||
|
},
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
if (user.data?.name) {
|
|
||||||
jobApplication.submit()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const openApplicationModal = () => {
|
const openApplicationModal = () => {
|
||||||
showApplicationModal.value = true
|
showApplicationModal.value = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,12 @@ const routes = [
|
|||||||
component: () => import('@/pages/CreateLesson.vue'),
|
component: () => import('@/pages/CreateLesson.vue'),
|
||||||
props: true,
|
props: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/batches/:batchName/edit',
|
||||||
|
name: 'CreateBatch',
|
||||||
|
component: () => import('@/pages/CreateBatch.vue'),
|
||||||
|
props: true,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
let router = createRouter({
|
let router = createRouter({
|
||||||
|
|||||||
@@ -11,7 +11,11 @@ class LMSJobApplication(Document):
|
|||||||
self.validate_duplicate()
|
self.validate_duplicate()
|
||||||
|
|
||||||
def after_insert(self):
|
def after_insert(self):
|
||||||
self.send_email_to_employer()
|
outgoing_email_account = frappe.get_cached_value(
|
||||||
|
"Email Account", {"default_outgoing": 1, "enable_outgoing": 1}, "name"
|
||||||
|
)
|
||||||
|
if outgoing_email_account:
|
||||||
|
self.send_email_to_employer()
|
||||||
|
|
||||||
def validate_duplicate(self):
|
def validate_duplicate(self):
|
||||||
if frappe.db.exists("LMS Job Application", {"job": self.job, "user": self.user}):
|
if frappe.db.exists("LMS Job Application", {"job": self.job, "user": self.user}):
|
||||||
|
|||||||
@@ -1757,6 +1757,9 @@ def get_lesson_creation_details(course, chapter, lesson):
|
|||||||
"Lesson Reference", {"parent": chapter_name, "idx": lesson}, "lesson"
|
"Lesson Reference", {"parent": chapter_name, "idx": lesson}, "lesson"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if lesson_name:
|
||||||
|
lesson_details = frappe.db.get_value("Course Lesson", lesson_name, [""])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"course_title": frappe.db.get_value("LMS Course", course, "title"),
|
"course_title": frappe.db.get_value("LMS Course", course, "title"),
|
||||||
"chapter": frappe.db.get_value(
|
"chapter": frappe.db.get_value(
|
||||||
|
|||||||
Reference in New Issue
Block a user