From 0a7162004696849f4828e6c4967245e08ba4d7cb Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Tue, 13 May 2025 20:04:06 +0530 Subject: [PATCH] fix: misc ui issues --- frontend/src/components/AppSidebar.vue | 2 +- frontend/src/components/BatchStudents.vue | 15 +- .../src/components/Controls/Autocomplete.vue | 2 +- .../components/Modals/AnnouncementModal.vue | 8 +- .../src/components/Modals/AssessmentModal.vue | 17 + .../components/Modals/BatchCourseModal.vue | 22 +- .../Modals/BatchStudentProgress.vue | 6 +- .../src/components/Modals/StudentModal.vue | 6 + frontend/src/pages/Batch.vue | 8 +- frontend/src/pages/BatchForm.vue | 9 +- frontend/src/pages/Batches.vue | 15 +- frontend/src/pages/CertifiedParticipants.vue | 2 +- frontend/src/pages/CourseForm.vue | 11 +- frontend/src/pages/Courses.vue | 30 +- frontend/src/pages/JobForm.vue | 24 +- frontend/src/pages/Jobs.vue | 2 +- frontend/src/pages/ProgramForm.vue | 9 +- frontend/src/utils/index.js | 10 +- lms/lms/doctype/lms_batch/lms_batch.py | 6 + lms/templates/emails/batch_confirmation.html | 2 + package.json | 2 +- frontend/yarn.lock => yarn.lock | 2862 ++++++++++++++++- 22 files changed, 2904 insertions(+), 166 deletions(-) rename frontend/yarn.lock => yarn.lock (52%) diff --git a/frontend/src/components/AppSidebar.vue b/frontend/src/components/AppSidebar.vue index 05ed106d..94a5b8f6 100644 --- a/frontend/src/components/AppSidebar.vue +++ b/frontend/src/components/AppSidebar.vue @@ -125,7 +125,7 @@ @click="redirectToWebsite()" /> - + +
{{ __('Statistics') }} @@ -46,7 +46,7 @@
- {{ batch.courses?.length }} + {{ batch.data.courses?.length }} {{ __('Courses') }} @@ -201,9 +201,10 @@
{ { onSuccess(data) { students.reload() + props.batch.reload() toast.success(__('Students deleted successfully')) unselectAll() }, @@ -434,7 +435,7 @@ const certificationCount = createResource({ params: { doctype: 'LMS Certificate', filters: { - batch_name: props.batch.name, + batch_name: props.batch?.data?.name, }, }, auto: true, diff --git a/frontend/src/components/Controls/Autocomplete.vue b/frontend/src/components/Controls/Autocomplete.vue index 856b8304..63368668 100644 --- a/frontend/src/components/Controls/Autocomplete.vue +++ b/frontend/src/components/Controls/Autocomplete.vue @@ -92,7 +92,7 @@ {{ option.label }}
diff --git a/frontend/src/components/Modals/AnnouncementModal.vue b/frontend/src/components/Modals/AnnouncementModal.vue index 439a9d69..01bfa983 100644 --- a/frontend/src/components/Modals/AnnouncementModal.vue +++ b/frontend/src/components/Modals/AnnouncementModal.vue @@ -31,6 +31,7 @@
{{ __('Announcement') }} + *
{ { validate() { if (!props.students.length) { - return 'No students in this batch' + return __('No students in this batch') } if (!announcement.subject) { - return 'Subject is required' + return __('Subject is required') + } + if (!announcement.announcement) { + return __('Announcement is required') } }, onSuccess() { diff --git a/frontend/src/components/Modals/AssessmentModal.vue b/frontend/src/components/Modals/AssessmentModal.vue index 24bfbb4e..3ff4ed19 100644 --- a/frontend/src/components/Modals/AssessmentModal.vue +++ b/frontend/src/components/Modals/AssessmentModal.vue @@ -25,6 +25,21 @@ v-model="assessment" :doctype="assessmentType" :label="__('Assessment')" + :onCreate="(value, close) => { + close() + if (assessmentType === 'LMS Quiz') { + router.push({ + name: 'QuizForm', + params: { + quizID: 'new', + }, + }) + } else if (assessmentType === 'LMS Assignment') { + router.push({ + name: 'Assignments' + }) + } + }" />
@@ -34,11 +49,13 @@ import { Dialog, FormControl, createResource, toast } from 'frappe-ui' import Link from '@/components/Controls/Link.vue' import { computed, ref } from 'vue' +import { useRouter } from 'vue-router' const show = defineModel() const assessmentType = ref(null) const assessment = ref(null) const assessments = defineModel('assessments') +const router = useRouter() const props = defineProps({ batch: { diff --git a/frontend/src/components/Modals/BatchCourseModal.vue b/frontend/src/components/Modals/BatchCourseModal.vue index 814d1e4a..6eb4471a 100644 --- a/frontend/src/components/Modals/BatchCourseModal.vue +++ b/frontend/src/components/Modals/BatchCourseModal.vue @@ -19,12 +19,21 @@ v-model="course" :label="__('Course')" :required="true" + :onCreate="(value, close) => { + close() + router.push({ + name: 'CourseForm', + params: { + courseName: 'new' + } + }) + }" /> @@ -35,15 +44,16 @@ import { Dialog, createResource, toast } from 'frappe-ui' import { ref, inject } from 'vue' import Link from '@/components/Controls/Link.vue' import { useOnboarding } from 'frappe-ui/frappe' -import { useSettings } from '@/stores/settings' +import { openSettings } from '@/utils' +import { useRouter } from 'vue-router' const show = defineModel() const course = ref(null) const evaluator = ref(null) const user = inject('$user') const courses = defineModel('courses') +const router = useRouter() const { updateOnboardingStep } = useOnboarding('learning') -const settingsStore = useSettings() const props = defineProps({ batch: { @@ -87,10 +97,4 @@ const addCourse = (close) => { } ) } - -const openSettings = (close) => { - close() - settingsStore.activeTab = 'Evaluators' - settingsStore.isSettingsOpen = true -} diff --git a/frontend/src/components/Modals/BatchStudentProgress.vue b/frontend/src/components/Modals/BatchStudentProgress.vue index e2bf3add..abbac984 100644 --- a/frontend/src/components/Modals/BatchStudentProgress.vue +++ b/frontend/src/components/Modals/BatchStudentProgress.vue @@ -14,7 +14,7 @@
{{ student.full_name }}
- + {{ student.progress }}% {{ __('Complete') }}
@@ -26,7 +26,7 @@
-
+
{{ __('Assessment') }} @@ -73,7 +73,7 @@
-
+
{{ __('Courses') }} diff --git a/frontend/src/components/Modals/StudentModal.vue b/frontend/src/components/Modals/StudentModal.vue index 5627cc0f..ba355f38 100644 --- a/frontend/src/components/Modals/StudentModal.vue +++ b/frontend/src/components/Modals/StudentModal.vue @@ -19,6 +19,9 @@ doctype="User" v-model="student" :filters="{ ignore_user_type: 1 }" + :onCreate="(value, close) => { + openSettings('Members', close) + }" />
@@ -29,8 +32,10 @@ import { Dialog, createResource, toast } from 'frappe-ui' import { ref, inject } from 'vue' import Link from '@/components/Controls/Link.vue' import { useOnboarding } from 'frappe-ui/frappe' +import { openSettings } from '@/utils' const students = defineModel('reloadStudents') +const batchModal = defineModel('batchModal') const student = ref() const user = inject('$user') const { updateOnboardingStep } = useOnboarding('learning') @@ -65,6 +70,7 @@ const addStudent = (close) => { updateOnboardingStep('add_batch_student') students.value.reload() + batchModal.value.reload() student.value = null close() }, diff --git a/frontend/src/pages/Batch.vue b/frontend/src/pages/Batch.vue index 19857eef..b07aa13a 100644 --- a/frontend/src/pages/Batch.vue +++ b/frontend/src/pages/Batch.vue @@ -67,7 +67,7 @@
- +
@@ -357,7 +357,11 @@ watch(tabIndex, () => { const canMakeAnnouncement = () => { if (readOnlyMode) return false - if (batch.data) return user.data?.is_moderator || user.data?.is_evaluator + + if (!batch.data?.students?.length) + return false + + return user.data?.is_moderator || user.data?.is_evaluator } usePageMeta(() => { diff --git a/frontend/src/pages/BatchForm.vue b/frontend/src/pages/BatchForm.vue index b6769276..044af154 100644 --- a/frontend/src/pages/BatchForm.vue +++ b/frontend/src/pages/BatchForm.vue @@ -285,15 +285,14 @@ import { Image } from 'lucide-vue-next' import { capture } from '@/telemetry' import { useOnboarding } from 'frappe-ui/frappe' import { sessionStore } from '../stores/session' -import { useSettings } from '@/stores/settings' import MultiSelect from '@/components/Controls/MultiSelect.vue' import Link from '@/components/Controls/Link.vue' +import { openSettings } from '@/utils' const router = useRouter() const user = inject('$user') const { brand } = sessionStore() const { updateOnboardingStep } = useOnboarding('learning') -const settingsStore = useSettings() const props = defineProps({ batchName: { @@ -500,11 +499,7 @@ const validateFile = (file) => { } } -const openSettings = (category, close) => { - close() - settingsStore.activeTab = category - settingsStore.isSettingsOpen = true -} + const breadcrumbs = computed(() => { let crumbs = [ diff --git a/frontend/src/pages/Batches.vue b/frontend/src/pages/Batches.vue index d5f6ba19..fc636188 100644 --- a/frontend/src/pages/Batches.vue +++ b/frontend/src/pages/Batches.vue @@ -20,12 +20,14 @@
{{ __('All Batches') }}
user.data?.is_student) const currentTab = ref(is_student.value ? 'All' : 'Upcoming') const orderBy = ref('start_date') const readOnlyMode = window.read_only_mode +const batchCount = ref(0) onMounted(() => { setFiltersFromQuery() updateBatches() + getBatchCount() categories.value = [ { label: '', @@ -293,6 +298,14 @@ const canCreateBatch = () => { return false } +const getBatchCount = () => { + call('frappe.client.get_count', { + doctype: 'LMS Batch', + }).then((data) => { + batchCount.value = data + }) +} + const breadcrumbs = computed(() => [ { label: __('Batches'), diff --git a/frontend/src/pages/CertifiedParticipants.vue b/frontend/src/pages/CertifiedParticipants.vue index ddf793ee..7767dc94 100644 --- a/frontend/src/pages/CertifiedParticipants.vue +++ b/frontend/src/pages/CertifiedParticipants.vue @@ -3,7 +3,7 @@ class="sticky flex items-center justify-between top-0 z-10 border-b bg-surface-white px-3 py-2.5 sm:px-5" > - +