Merge pull request #803 from pateljannat/issues-8
fix: certified participants page mobile layout
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
<ListView
|
<ListView
|
||||||
:columns="getCoursesColumns()"
|
:columns="getCoursesColumns()"
|
||||||
:rows="courses.data"
|
:rows="courses.data"
|
||||||
row-key="name"
|
row-key="batch_course"
|
||||||
:options="{ showTooltip: false }"
|
:options="{ showTooltip: false }"
|
||||||
>
|
>
|
||||||
<ListHeader
|
<ListHeader
|
||||||
@@ -49,7 +49,10 @@
|
|||||||
<ListSelectBanner>
|
<ListSelectBanner>
|
||||||
<template #actions="{ unselectAll, selections }">
|
<template #actions="{ unselectAll, selections }">
|
||||||
<div class="flex gap-2">
|
<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" />
|
<Trash2 class="h-4 w-4 stroke-1.5" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -133,11 +136,13 @@ const removeCourse = createResource({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const removeCourses = (selections) => {
|
const removeCourses = (selections, unselectAll) => {
|
||||||
selections.forEach(async (course) => {
|
selections.forEach(async (course) => {
|
||||||
removeCourse.submit({ course })
|
removeCourse.submit({ course })
|
||||||
await setTimeout(1000)
|
|
||||||
})
|
})
|
||||||
courses.reload()
|
setTimeout(() => {
|
||||||
|
courses.reload()
|
||||||
|
unselectAll()
|
||||||
|
}, 1000)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -52,7 +52,10 @@
|
|||||||
<ListSelectBanner>
|
<ListSelectBanner>
|
||||||
<template #actions="{ unselectAll, selections }">
|
<template #actions="{ unselectAll, selections }">
|
||||||
<div class="flex gap-2">
|
<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" />
|
<Trash2 class="h-4 w-4 stroke-1.5" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -142,11 +145,13 @@ const removeStudent = createResource({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const removeStudents = (selections) => {
|
const removeStudents = (selections, unselectAll) => {
|
||||||
selections.forEach(async (student) => {
|
selections.forEach(async (student) => {
|
||||||
removeStudent.submit({ student })
|
removeStudent.submit({ student })
|
||||||
await setTimeout(1000)
|
|
||||||
})
|
})
|
||||||
students.reload()
|
setTimeout(() => {
|
||||||
|
students.reload()
|
||||||
|
unselectAll()
|
||||||
|
}, 500)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</Button>
|
</Button>
|
||||||
</header>
|
</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">
|
<div class="border-r-2">
|
||||||
<Tabs v-model="tabIndex" :tabs="tabs" tablistClass="overflow-x-visible">
|
<Tabs v-model="tabIndex" :tabs="tabs" tablistClass="overflow-x-visible">
|
||||||
<template #tab="{ tab, selected }" class="overflow-x-hidden">
|
<template #tab="{ tab, selected }" class="overflow-x-hidden">
|
||||||
|
|||||||
@@ -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"
|
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" />
|
<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>
|
</header>
|
||||||
|
|
||||||
<div class="m-5">
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 m-5">
|
||||||
<FormControl
|
<div v-if="participants.data" v-for="participant in participants.data">
|
||||||
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">
|
|
||||||
<router-link
|
<router-link
|
||||||
:to="{
|
:to="{
|
||||||
name: 'Profile',
|
name: 'Profile',
|
||||||
@@ -62,6 +61,7 @@ const searchQuery = ref('')
|
|||||||
const participants = createResource({
|
const participants = createResource({
|
||||||
url: 'lms.lms.api.get_certified_participants',
|
url: 'lms.lms.api.get_certified_participants',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
cache: ['certified_participants'],
|
||||||
makeParams() {
|
makeParams() {
|
||||||
return {
|
return {
|
||||||
search_query: searchQuery.value,
|
search_query: searchQuery.value,
|
||||||
|
|||||||
@@ -34,13 +34,9 @@ const props = defineProps({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const certificates = createResource({
|
const certificates = createResource({
|
||||||
url: 'frappe.client.get_list',
|
url: 'lms.lms.api.get_certificates',
|
||||||
params: {
|
params: {
|
||||||
doctype: 'LMS Certificate',
|
member: props.profile.data.name,
|
||||||
fields: ['name', 'course', 'course_title', 'issue_date', 'template'],
|
|
||||||
filters: {
|
|
||||||
member: props.profile.data.name,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
auto: true,
|
auto: true,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -359,3 +359,14 @@ def get_certified_participants(search_query=""):
|
|||||||
details["courses"] = courses
|
details["courses"] = courses
|
||||||
participant_details.append(details)
|
participant_details.append(details)
|
||||||
return participant_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",
|
||||||
|
)
|
||||||
|
|||||||
@@ -1520,10 +1520,12 @@ def get_question_details(question):
|
|||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def get_batch_courses(batch):
|
def get_batch_courses(batch):
|
||||||
courses = []
|
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:
|
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
|
return courses
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ def get_meta(app_path):
|
|||||||
as_dict=True,
|
as_dict=True,
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
"title": job_opening.title,
|
"title": job_opening.job_title,
|
||||||
"image": job_opening.company_logo,
|
"image": job_opening.company_logo,
|
||||||
"description": job_opening.company_name,
|
"description": job_opening.company_name,
|
||||||
"keywords": "Job Openings, Jobs, Vacancies",
|
"keywords": "Job Openings, Jobs, Vacancies",
|
||||||
|
|||||||
Reference in New Issue
Block a user