Merge pull request #1546 from pateljannat/issues-111

fix: misc issues
This commit is contained in:
Jannat Patel
2025-05-29 16:29:57 +05:30
committed by GitHub
12 changed files with 86 additions and 22 deletions

View File

@@ -9,16 +9,19 @@
<script setup> <script setup>
import { FrappeUIProvider } from 'frappe-ui' import { FrappeUIProvider } from 'frappe-ui'
import { Dialogs } from '@/utils/dialogs' import { Dialogs } from '@/utils/dialogs'
import { computed, onUnmounted, ref } from 'vue' import { computed, onUnmounted, ref, watch } from 'vue'
import { useScreenSize } from './utils/composables' import { useScreenSize } from './utils/composables'
import DesktopLayout from './components/DesktopLayout.vue' import DesktopLayout from './components/DesktopLayout.vue'
import MobileLayout from './components/MobileLayout.vue' import MobileLayout from './components/MobileLayout.vue'
import NoSidebarLayout from './components/NoSidebarLayout.vue' import NoSidebarLayout from './components/NoSidebarLayout.vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { usersStore } from '@/stores/user'
import { posthogSettings } from '@/telemetry'
const screenSize = useScreenSize() const screenSize = useScreenSize()
const router = useRouter() const router = useRouter()
const noSidebar = ref(false) const noSidebar = ref(false)
const { userResource } = usersStore()
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if (to.query.fromLesson || to.path === '/persona') { if (to.query.fromLesson || to.path === '/persona') {
@@ -44,4 +47,10 @@ onUnmounted(() => {
noSidebar.value = false noSidebar.value = false
stopSession() stopSession()
}) })
watch(userResource, () => {
if (userResource.data) {
posthogSettings.reload()
}
})
</script> </script>

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="flex flex-col justify-between min-h-0"> <div class="flex flex-col justify-between h-full">
<div> <div>
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<div class="font-semibold mb-1 text-ink-gray-9"> <div class="font-semibold mb-1 text-ink-gray-9">

View File

@@ -6,7 +6,7 @@
<div v-for="(column, index) in columns" :key="index"> <div v-for="(column, index) in columns" :key="index">
<div <div
class="flex flex-col space-y-5" class="flex flex-col space-y-5"
:class="columns.length > 1 ? 'w-[21rem]' : 'w-1/2'" :class="columns.length > 1 ? 'w-[21rem]' : 'w-full'"
> >
<div v-for="field in column"> <div v-for="field in column">
<Link <Link
@@ -55,11 +55,13 @@
<div v-else> <div v-else>
<div class="flex items-center text-sm space-x-2"> <div class="flex items-center text-sm space-x-2">
<div <div
class="flex items-center justify-center rounded border border-outline-gray-1 bg-surface-gray-2 px-20 py-5" class="flex items-center justify-center rounded border border-outline-gray-1 bg-surface-gray-2"
:class="field.size == 'lg' ? 'px-5 py-5' : 'px-20 py-8'"
> >
<img <img
:src="data[field.name]?.file_url || data[field.name]" :src="data[field.name]?.file_url || data[field.name]"
class="size-6 rounded" class="rounded"
:class="field.size == 'lg' ? 'w-36' : 'size-6'"
/> />
</div> </div>
<div class="flex flex-col flex-wrap"> <div class="flex flex-col flex-wrap">
@@ -101,6 +103,7 @@
:rows="field.rows" :rows="field.rows"
:options="field.options" :options="field.options"
:description="field.description" :description="field.description"
:class="columns.length > 1 ? 'w-full' : 'w-1/2'"
/> />
</div> </div>
</div> </div>

View File

@@ -335,6 +335,9 @@ const tabsStructure = computed(() => {
description: description:
'New users will have to be manually registered by Admins.', 'New users will have to be manually registered by Admins.',
}, },
{
type: 'Column Break',
},
{ {
label: 'Signup Consent HTML', label: 'Signup Consent HTML',
name: 'custom_signup_content', name: 'custom_signup_content',
@@ -364,10 +367,14 @@ const tabsStructure = computed(() => {
description: description:
'Keywords for search engines to find your website. Separated by commas.', 'Keywords for search engines to find your website. Separated by commas.',
}, },
{
type: 'Column Break',
},
{ {
label: 'Meta Image', label: 'Meta Image',
name: 'meta_image', name: 'meta_image',
type: 'Upload', type: 'Upload',
size: 'lg',
}, },
], ],
}, },

View File

@@ -179,7 +179,7 @@ const columns = computed(() => {
key: 'member_name', key: 'member_name',
}, },
{ {
label: __('Enabled'), label: __('Status'),
key: 'enabled', key: 'enabled',
align: 'center', align: 'center',
}, },

View File

@@ -127,6 +127,7 @@ const memberCount = ref(0)
const dayjs = inject('$dayjs') const dayjs = inject('$dayjs')
onMounted(() => { onMounted(() => {
getMemberCount()
updateParticipants() updateParticipants()
}) })
@@ -138,11 +139,13 @@ const participants = createListResource({
pageLength: 30, pageLength: 30,
}) })
const count = call('lms.lms.api.get_count_of_certified_members').then( const getMemberCount = () => {
(data) => { call('lms.lms.api.get_count_of_certified_members', {
filters: filters.value,
}).then((data) => {
memberCount.value = data memberCount.value = data
} })
) }
const categories = createListResource({ const categories = createListResource({
doctype: 'LMS Certificate', doctype: 'LMS Certificate',
@@ -157,6 +160,7 @@ const categories = createListResource({
const updateParticipants = () => { const updateParticipants = () => {
updateFilters() updateFilters()
getMemberCount()
participants.update({ participants.update({
filters: filters.value, filters: filters.value,
}) })

View File

@@ -284,7 +284,7 @@ import {
} from 'vue' } from 'vue'
import { Image, Trash2, X } from 'lucide-vue-next' import { Image, Trash2, X } from 'lucide-vue-next'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { capture } from '@/telemetry' import { capture, startRecording, stopRecording } from '@/telemetry'
import { useOnboarding } from 'frappe-ui/frappe' import { useOnboarding } from 'frappe-ui/frappe'
import { sessionStore } from '../stores/session' import { sessionStore } from '../stores/session'
import { openSettings } from '@/utils' import { openSettings } from '@/utils'
@@ -337,6 +337,7 @@ onMounted(() => {
courseResource.reload() courseResource.reload()
} else { } else {
capture('course_form_opened') capture('course_form_opened')
startRecording()
} }
window.addEventListener('keydown', keyboardShortcut) window.addEventListener('keydown', keyboardShortcut)
}) })
@@ -354,6 +355,7 @@ const keyboardShortcut = (e) => {
onBeforeUnmount(() => { onBeforeUnmount(() => {
window.removeEventListener('keydown', keyboardShortcut) window.removeEventListener('keydown', keyboardShortcut)
stopRecording()
}) })
const courseCreationResource = createResource({ const courseCreationResource = createResource({

View File

@@ -240,7 +240,6 @@ const updateTabFilter = () => {
filters.value['live'] = 1 filters.value['live'] = 1
} else if (currentTab.value == 'Upcoming') { } else if (currentTab.value == 'Upcoming') {
filters.value['upcoming'] = 1 filters.value['upcoming'] = 1
filters.value['published'] = 1
} else if (currentTab.value == 'New') { } else if (currentTab.value == 'New') {
filters.value['published'] = 1 filters.value['published'] = 1
filters.value['published_on'] = [ filters.value['published_on'] = [
@@ -249,6 +248,8 @@ const updateTabFilter = () => {
] ]
} else if (currentTab.value == 'Created') { } else if (currentTab.value == 'Created') {
filters.value['created'] = 1 filters.value['created'] = 1
} else if (currentTab.value == 'Unpublished') {
filters.value['published'] = 0
} }
} }
} }
@@ -318,6 +319,7 @@ const courseTabs = computed(() => {
user.data?.is_evaluator user.data?.is_evaluator
) { ) {
tabs.push({ label: __('Created') }) tabs.push({ label: __('Created') })
tabs.push({ label: __('Unpublished') })
} else if (user.data) { } else if (user.data) {
tabs.push({ label: __('Enrolled') }) tabs.push({ label: __('Enrolled') })
} }

View File

@@ -99,7 +99,7 @@ import EditorJS from '@editorjs/editorjs'
import LessonHelp from '@/components/LessonHelp.vue' import LessonHelp from '@/components/LessonHelp.vue'
import { ChevronRight } from 'lucide-vue-next' import { ChevronRight } from 'lucide-vue-next'
import { getEditorTools, enablePlyr } from '@/utils' import { getEditorTools, enablePlyr } from '@/utils'
import { capture } from '@/telemetry' import { capture, startRecording, stopRecording } from '@/telemetry'
import { useOnboarding } from 'frappe-ui/frappe' import { useOnboarding } from 'frappe-ui/frappe'
const { brand } = sessionStore() const { brand } = sessionStore()
@@ -131,6 +131,7 @@ onMounted(() => {
window.location.href = '/login' window.location.href = '/login'
} }
capture('lesson_form_opened') capture('lesson_form_opened')
startRecording()
editor.value = renderEditor('content') editor.value = renderEditor('content')
instructorEditor.value = renderEditor('instructor-notes') instructorEditor.value = renderEditor('instructor-notes')
window.addEventListener('keydown', keyboardShortcut) window.addEventListener('keydown', keyboardShortcut)
@@ -226,6 +227,7 @@ const keyboardShortcut = (e) => {
onBeforeUnmount(() => { onBeforeUnmount(() => {
clearInterval(autoSaveInterval) clearInterval(autoSaveInterval)
window.removeEventListener('keydown', keyboardShortcut) window.removeEventListener('keydown', keyboardShortcut)
stopRecording()
}) })
const newLessonResource = createResource({ const newLessonResource = createResource({

View File

@@ -457,7 +457,7 @@ class CountDistinct(DistinctOptionFunction):
@frappe.whitelist(allow_guest=True) @frappe.whitelist(allow_guest=True)
def get_count_of_certified_members(): def get_count_of_certified_members(filters=None):
Certificate = DocType("LMS Certificate") Certificate = DocType("LMS Certificate")
query = ( query = (
@@ -466,6 +466,14 @@ def get_count_of_certified_members():
.where(Certificate.published == 1) .where(Certificate.published == 1)
) )
if filters:
for field, value in filters.items():
if field == "category":
query = query.where(
Certificate.course_title.like(f"%{value}%")
| Certificate.batch_title.like(f"%{value}%")
)
result = query.run(as_dict=True) result = query.run(as_dict=True)
return result[0]["total"] if result else 0 return result[0]["total"] if result else 0
@@ -691,13 +699,13 @@ def get_categories(doctype, filters):
@frappe.whitelist() @frappe.whitelist()
def get_members(start=0, search=""): def get_members(start=0, search=""):
"""Get members for the given search term and start index. """Get members for the given search term and start index.
Args: start (int): Start index for the query. Args: start (int): Start index for the query.
<<<<<<< HEAD <<<<<<< HEAD
search (str): Search term to filter the results. search (str): Search term to filter the results.
======= =======
search (str): Search term to filter the results. search (str): Search term to filter the results.
>>>>>>> 4869bba7bbb2fb38477d6fc29fb3b5838e075577 >>>>>>> 4869bba7bbb2fb38477d6fc29fb3b5838e075577
Returns: List of members. Returns: List of members.
""" """
filters = {"enabled": 1, "name": ["not in", ["Administrator", "Guest"]]} filters = {"enabled": 1, "name": ["not in", ["Administrator", "Guest"]]}

View File

@@ -103,6 +103,7 @@
"read_only": 1 "read_only": 1
} }
], ],
"grid_page_length": 50,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [ "links": [
{ {
@@ -111,7 +112,7 @@
"link_fieldname": "chapter" "link_fieldname": "chapter"
} }
], ],
"modified": "2025-02-03 15:23:17.125617", "modified": "2025-05-29 12:38:26.266673",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "LMS", "module": "LMS",
"name": "Course Chapter", "name": "Course Chapter",
@@ -151,8 +152,21 @@
"role": "Course Creator", "role": "Course Creator",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Moderator",
"share": 1,
"write": 1
} }
], ],
"row_format": "Dynamic",
"search_fields": "title", "search_fields": "title",
"show_title_field_in_link": 1, "show_title_field_in_link": 1,
"sort_field": "modified", "sort_field": "modified",
@@ -160,4 +174,4 @@
"states": [], "states": [],
"title_field": "title", "title_field": "title",
"track_changes": 1 "track_changes": 1
} }

View File

@@ -290,7 +290,7 @@
} }
], ],
"make_attachments_public": 1, "make_attachments_public": 1,
"modified": "2025-03-13 16:01:19.105212", "modified": "2025-05-29 12:38:01.002898",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "LMS", "module": "LMS",
"name": "LMS Course", "name": "LMS Course",
@@ -319,12 +319,25 @@
"role": "Course Creator", "role": "Course Creator",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Moderator",
"share": 1,
"write": 1
} }
], ],
"row_format": "Dynamic",
"show_title_field_in_link": 1, "show_title_field_in_link": 1,
"sort_field": "creation", "sort_field": "creation",
"sort_order": "DESC", "sort_order": "DESC",
"states": [], "states": [],
"title_field": "title", "title_field": "title",
"track_changes": 1 "track_changes": 1
} }