fix: certified participants page mobile layout

This commit is contained in:
Jannat Patel
2024-05-07 19:03:27 +05:30
parent 98c748359a
commit b4cc0c6807
8 changed files with 53 additions and 34 deletions

View File

@@ -19,7 +19,7 @@
<ListView
:columns="getCoursesColumns()"
:rows="courses.data"
row-key="name"
row-key="batch_course"
:options="{ showTooltip: false }"
>
<ListHeader
@@ -49,7 +49,10 @@
<ListSelectBanner>
<template #actions="{ unselectAll, selections }">
<div class="flex gap-2">
<Button variant="ghost" @click="removeCourses(selections)">
<Button
variant="ghost"
@click="removeCourses(selections, unselectAll)"
>
<Trash2 class="h-4 w-4 stroke-1.5" />
</Button>
</div>
@@ -133,11 +136,13 @@ const removeCourse = createResource({
},
})
const removeCourses = (selections) => {
const removeCourses = (selections, unselectAll) => {
selections.forEach(async (course) => {
removeCourse.submit({ course })
await setTimeout(1000)
})
courses.reload()
setTimeout(() => {
courses.reload()
unselectAll()
}, 1000)
}
</script>

View File

@@ -52,7 +52,10 @@
<ListSelectBanner>
<template #actions="{ unselectAll, selections }">
<div class="flex gap-2">
<Button variant="ghost" @click="removeStudents(selections)">
<Button
variant="ghost"
@click="removeStudents(selections, unselectAll)"
>
<Trash2 class="h-4 w-4 stroke-1.5" />
</Button>
</div>
@@ -142,11 +145,13 @@ const removeStudent = createResource({
},
})
const removeStudents = (selections) => {
const removeStudents = (selections, unselectAll) => {
selections.forEach(async (student) => {
removeStudent.submit({ student })
await setTimeout(1000)
})
students.reload()
setTimeout(() => {
students.reload()
unselectAll()
}, 500)
}
</script>

View File

@@ -13,7 +13,7 @@
</template>
</Button>
</header>
<div v-if="batch.data" class="grid grid-cols-[70%,30%] h-full">
<div v-if="batch.data" class="grid grid-cols-[70%,30%] h-screen">
<div class="border-r-2">
<Tabs v-model="tabIndex" :tabs="tabs" tablistClass="overflow-x-visible">
<template #tab="{ tab, selected }" class="overflow-x-hidden">

View File

@@ -3,23 +3,22 @@
class="sticky top-0 z-10 flex items-center justify-between border-b bg-white px-3 py-2.5 sm:px-5"
>
<Breadcrumbs :items="breadcrumbs" />
<div>
<FormControl
type="text"
placeholder="Search Participants"
v-model="searchQuery"
@input="participants.reload()"
>
<template #prefix>
<Search class="w-4" name="search" />
</template>
</FormControl>
</div>
</header>
<div class="m-5">
<FormControl
type="text"
placeholder="Search Participants"
v-model="searchQuery"
@input="participants.reload()"
size="md"
>
<template #prefix>
<Search class="w-4" name="search" />
</template>
</FormControl>
</div>
<div class="grid grid-cols-3 gap-4 m-5">
<div v-for="participant in participants.data">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 m-5">
<div v-if="participants.data" v-for="participant in participants.data">
<router-link
:to="{
name: 'Profile',
@@ -62,6 +61,7 @@ const searchQuery = ref('')
const participants = createResource({
url: 'lms.lms.api.get_certified_participants',
method: 'GET',
cache: ['certified_participants'],
makeParams() {
return {
search_query: searchQuery.value,

View File

@@ -34,13 +34,9 @@ const props = defineProps({
})
const certificates = createResource({
url: 'frappe.client.get_list',
url: 'lms.lms.api.get_certificates',
params: {
doctype: 'LMS Certificate',
fields: ['name', 'course', 'course_title', 'issue_date', 'template'],
filters: {
member: props.profile.data.name,
},
member: props.profile.data.name,
},
auto: true,
})

View File

@@ -359,3 +359,14 @@ def get_certified_participants(search_query=""):
details["courses"] = courses
participant_details.append(details)
return participant_details
@frappe.whitelist()
def get_certificates(member):
"""Get certificates for a member."""
return frappe.get_all(
"LMS Certificate",
filters={"member": member},
fields=["name", "course", "course_title", "issue_date", "template"],
order_by="creation desc",
)

View File

@@ -1520,10 +1520,12 @@ def get_question_details(question):
@frappe.whitelist(allow_guest=True)
def get_batch_courses(batch):
courses = []
course_list = frappe.get_all("Batch Course", {"parent": batch}, pluck="course")
course_list = frappe.get_all("Batch Course", {"parent": batch}, ["name", "course"])
for course in course_list:
courses.append(get_course_details(course))
details = get_course_details(course.course)
details.batch_course = course.name
courses.append(details)
return courses

View File

@@ -97,7 +97,7 @@ def get_meta(app_path):
as_dict=True,
)
return {
"title": job_opening.title,
"title": job_opening.job_title,
"image": job_opening.company_logo,
"description": job_opening.company_name,
"keywords": "Job Openings, Jobs, Vacancies",