Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: misc issues #1232

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions frontend/src/pages/Badge.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<template>
<div v-if="badge.doc">
<div v-if="badge.data">
<div class="p-5 flex flex-col items-center mt-40">
<div class="text-3xl font-semibold">
{{ badge.doc.badge }}
{{ badge.data.badge }}
</div>
<img
:src="badge.doc.badge_image"
:alt="badge.doc.badge"
:src="badge.data.badge_image"
:alt="badge.data.badge"
class="h-60 mt-2"
/>
<div class="text-lg">
<div class="">
{{
__('This badge has been awarded to {0} on {1}.').format(
badge.doc.member_name,
dayjs(badge.doc.issued_on).format('DD MMM YYYY')
badge.data.member_name,
dayjs(badge.data.issued_on).format('DD MMM YYYY')
)
}}
</div>
<div class="text-lg mt-2">
{{ badge.doc.badge_description }}
<div class="mt-2">
{{ badge.data.badge_description }}
</div>
</div>
</div>
</template>
<script setup>
import { createDocumentResource } from 'frappe-ui'
import { createDocumentResource, createResource } from 'frappe-ui'
import { computed, inject } from 'vue'

const dayjs = inject('$dayjs')
Expand All @@ -40,12 +40,18 @@ const props = defineProps({
},
})

const badge = createDocumentResource({
doctype: 'LMS Badge Assignment',
filters: {
badge: props.badgeName,
member: props.email,
const badge = createResource({
url: 'frappe.client.get',
makeParams(values) {
return {
doctype: 'LMS Badge Assignment',
filters: {
badge: props.badgeName,
member: props.email,
},
}
},
auto: true,
})

const breadcrumbs = computed(() => {
Expand All @@ -54,11 +60,11 @@ const breadcrumbs = computed(() => {
label: 'Badges',
},
{
label: badge.doc.badge,
label: badge.data.badge,
route: {
name: 'Badge',
params: {
badge: badge.doc.badge,
badge: badge.data.badge,
},
},
},
Expand Down
6 changes: 6 additions & 0 deletions lms/lms/doctype/lms_badge_assignment/lms_badge_assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ frappe.ui.form.on("LMS Badge Assignment", {
},
};
});

if (frm.doc.name)
frm.add_web_link(
`/badges/${frm.doc.badge}/${frm.doc.member}`,
"See on Website"
);
},
});
1 change: 1 addition & 0 deletions lms/lms/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,7 @@ def get_batch_card_details(batchname):
"amount_usd",
"currency",
"start_date",
"end_date",
"start_time",
"end_time",
"timezone",
Expand Down
Loading