@@ -2,28 +2,23 @@
|
||||
<div
|
||||
v-if="course.title"
|
||||
class="flex flex-col h-full rounded-md shadow-md text-base overflow-auto"
|
||||
style="min-height: 320px"
|
||||
style="min-height: 350px"
|
||||
>
|
||||
<div
|
||||
class="course-image"
|
||||
:class="{ 'default-image': !course.image }"
|
||||
:style="{ backgroundImage: 'url(\'' + encodeURI(course.image) + '\')' }"
|
||||
>
|
||||
<div class="flex relative top-4 left-4 w-fit flex-wrap">
|
||||
<Badge
|
||||
v-if="course.featured"
|
||||
variant="subtle"
|
||||
theme="green"
|
||||
size="md"
|
||||
class="mr-2"
|
||||
>
|
||||
<div
|
||||
class="flex items-center flex-wrap space-y-1 space-x-1 relative top-4 px-2 w-fit"
|
||||
>
|
||||
<Badge v-if="course.featured" variant="subtle" theme="green" size="md">
|
||||
{{ __('Featured') }}
|
||||
</Badge>
|
||||
<Badge
|
||||
variant="outline"
|
||||
theme="gray"
|
||||
size="md"
|
||||
class="mr-2"
|
||||
v-for="tag in course.tags"
|
||||
>
|
||||
{{ tag }}
|
||||
|
||||
@@ -130,11 +130,14 @@ function submitEvaluation(close) {
|
||||
close()
|
||||
},
|
||||
onError(err) {
|
||||
let message = err.messages?.[0] || err
|
||||
let unavailabilityMessage = message.includes('unavailable')
|
||||
|
||||
createToast({
|
||||
title: 'Error',
|
||||
text: err.messages?.[0] || err,
|
||||
icon: 'x',
|
||||
iconClasses: 'bg-red-600 text-white rounded-md p-px',
|
||||
title: unavailabilityMessage ? 'Evaluator is Unavailable' : 'Error',
|
||||
text: message,
|
||||
icon: unavailabilityMessage ? 'alert-circle' : 'x',
|
||||
iconClasses: 'bg-yellow-600 text-white rounded-md p-px',
|
||||
position: 'top-center',
|
||||
timeout: 10,
|
||||
})
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
</header>
|
||||
|
||||
<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">
|
||||
<div
|
||||
v-if="participants.data?.length"
|
||||
v-for="participant in participantsList"
|
||||
>
|
||||
<router-link
|
||||
:to="{
|
||||
name: 'Profile',
|
||||
@@ -59,12 +62,7 @@ const searchQuery = ref('')
|
||||
const participants = createResource({
|
||||
url: 'lms.lms.api.get_certified_participants',
|
||||
method: 'GET',
|
||||
debounce: 300,
|
||||
makeParams(values) {
|
||||
return {
|
||||
search_query: searchQuery.value,
|
||||
}
|
||||
},
|
||||
cache: 'certified-participants',
|
||||
auto: true,
|
||||
})
|
||||
|
||||
@@ -79,5 +77,16 @@ const pageMeta = computed(() => {
|
||||
}
|
||||
})
|
||||
|
||||
const participantsList = computed(() => {
|
||||
if (searchQuery.value) {
|
||||
return participants.data.filter((participant) => {
|
||||
return participant.full_name
|
||||
.toLowerCase()
|
||||
.includes(searchQuery.value.toLowerCase())
|
||||
})
|
||||
}
|
||||
return participants.data
|
||||
})
|
||||
|
||||
updateDocumentTitle(pageMeta)
|
||||
</script>
|
||||
|
||||
@@ -79,15 +79,18 @@ export function getFileSize(file_size) {
|
||||
return value
|
||||
}
|
||||
|
||||
export function showToast(title, text, icon) {
|
||||
export function showToast(title, text, icon, iconClasses = null) {
|
||||
if (!iconClasses) {
|
||||
iconClasses =
|
||||
icon == 'check'
|
||||
? 'bg-green-600 text-white rounded-md p-px'
|
||||
: 'bg-red-600 text-white rounded-md p-px'
|
||||
}
|
||||
createToast({
|
||||
title: title,
|
||||
text: htmlToText(text),
|
||||
icon: icon,
|
||||
iconClasses:
|
||||
icon == 'check'
|
||||
? 'bg-green-600 text-white rounded-md p-px'
|
||||
: 'bg-red-600 text-white rounded-md p-px',
|
||||
iconClasses: iconClasses,
|
||||
position: icon == 'check' ? 'bottom-right' : 'top-center',
|
||||
timeout: 5,
|
||||
})
|
||||
|
||||
@@ -330,13 +330,12 @@ def get_evaluator_details(evaluator):
|
||||
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def get_certified_participants(search_query=""):
|
||||
def get_certified_participants():
|
||||
LMSCertificate = DocType("LMS Certificate")
|
||||
participants = (
|
||||
frappe.qb.from_(LMSCertificate)
|
||||
.select(LMSCertificate.member)
|
||||
.distinct()
|
||||
.where(LMSCertificate.member_name.like(f"%{search_query}%"))
|
||||
.where(LMSCertificate.published == 1)
|
||||
.orderby(LMSCertificate.creation, order=frappe.qb.desc)
|
||||
.run(as_dict=1)
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
"field_order": [
|
||||
"course",
|
||||
"course_title",
|
||||
"column_break_3",
|
||||
"member",
|
||||
"member_name",
|
||||
"published",
|
||||
"section_break_tnnm",
|
||||
"template",
|
||||
"batch_name",
|
||||
"column_break_qtzo",
|
||||
"column_break_vwbn",
|
||||
"issue_date",
|
||||
"expiry_date"
|
||||
"template",
|
||||
"published",
|
||||
"section_break_scyf",
|
||||
"expiry_date",
|
||||
"column_break_slaw",
|
||||
"batch_name"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -27,10 +27,6 @@
|
||||
"label": "Issue Date",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "course",
|
||||
"fieldtype": "Link",
|
||||
@@ -89,17 +85,21 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_tnnm",
|
||||
"fieldname": "column_break_vwbn",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_scyf",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_qtzo",
|
||||
"fieldname": "column_break_slaw",
|
||||
"fieldtype": "Column Break"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-07-12 12:39:50.076937",
|
||||
"modified": "2024-07-16 15:29:19.708888",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Certificate",
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
"fieldtype": "Rating",
|
||||
"in_list_view": 1,
|
||||
"label": "Rating",
|
||||
"mandatory_depends_on": "eval:doc.status != 'Pending' && doc.status != 'In Progress'"
|
||||
"mandatory_depends_on": "eval:doc.status == 'Pass'"
|
||||
},
|
||||
{
|
||||
"fieldname": "summary",
|
||||
@@ -107,7 +107,7 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-04-15 11:22:43.189908",
|
||||
"modified": "2024-07-16 14:06:11.977666",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Certificate Evaluation",
|
||||
|
||||
@@ -42,7 +42,7 @@ class LMSCertificateRequest(Document):
|
||||
):
|
||||
frappe.throw(
|
||||
_(
|
||||
"Evaluator is unavailable from {0} to {1}. Please select a date after {1}"
|
||||
"The evaluator of this course is unavailable from {0} to {1}. Please select a date after {1}"
|
||||
).format(
|
||||
format_date(unavailable.unavailable_from, "medium"),
|
||||
format_date(unavailable.unavailable_to, "medium"),
|
||||
|
||||
Reference in New Issue
Block a user