Merge pull request #794 from arunmathaisk/develop
feat: CertifiedParticipants.vue page is now searchable
This commit is contained in:
@@ -4,6 +4,20 @@
|
|||||||
>
|
>
|
||||||
<Breadcrumbs :items="breadcrumbs" />
|
<Breadcrumbs :items="breadcrumbs" />
|
||||||
</header>
|
</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 class="grid grid-cols-3 gap-4 m-5">
|
||||||
<div v-for="participant in participants.data">
|
<div v-for="participant in participants.data">
|
||||||
<router-link
|
<router-link
|
||||||
@@ -38,14 +52,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { Breadcrumbs, createResource } from 'frappe-ui'
|
import { Breadcrumbs, FormControl, createResource } from 'frappe-ui'
|
||||||
import { computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import UserAvatar from '@/components/UserAvatar.vue'
|
import UserAvatar from '@/components/UserAvatar.vue'
|
||||||
|
import { Search } from 'lucide-vue-next'
|
||||||
|
|
||||||
|
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',
|
||||||
|
makeParams() {
|
||||||
|
return {
|
||||||
|
search_query: searchQuery.value,
|
||||||
|
}
|
||||||
|
},
|
||||||
auto: true,
|
auto: true,
|
||||||
cache: ['certified-participants'],
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const breadcrumbs = computed(() => {
|
const breadcrumbs = computed(() => {
|
||||||
|
|||||||
@@ -330,12 +330,13 @@ def get_evaluator_details(evaluator):
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def get_certified_participants():
|
def get_certified_participants(search_query=""):
|
||||||
LMSCertificate = DocType("LMS Certificate")
|
LMSCertificate = DocType("LMS Certificate")
|
||||||
participants = (
|
participants = (
|
||||||
frappe.qb.from_(LMSCertificate)
|
frappe.qb.from_(LMSCertificate)
|
||||||
.select(LMSCertificate.member)
|
.select(LMSCertificate.member)
|
||||||
.distinct()
|
.distinct()
|
||||||
|
.where(LMSCertificate.member_name.like(f"%{search_query}%"))
|
||||||
.where(LMSCertificate.published == 1)
|
.where(LMSCertificate.published == 1)
|
||||||
.orderby(LMSCertificate.creation, order=frappe.qb.desc)
|
.orderby(LMSCertificate.creation, order=frappe.qb.desc)
|
||||||
.run(as_dict=1)
|
.run(as_dict=1)
|
||||||
@@ -355,7 +356,6 @@ def get_certified_participants():
|
|||||||
courses = []
|
courses = []
|
||||||
for course in course_names:
|
for course in course_names:
|
||||||
courses.append(frappe.db.get_value("LMS Course", course, "title"))
|
courses.append(frappe.db.get_value("LMS Course", course, "title"))
|
||||||
details.courses = courses
|
details["courses"] = courses
|
||||||
participant_details.append(details)
|
participant_details.append(details)
|
||||||
|
|
||||||
return participant_details
|
return participant_details
|
||||||
|
|||||||
Reference in New Issue
Block a user