feat: certificates section in profile

This commit is contained in:
Jannat Patel
2022-09-13 12:47:01 +05:30
parent d959cacd15
commit 7d18215bc9
12 changed files with 158 additions and 115 deletions

View File

@@ -1,18 +1,25 @@
<div id="certificate-card" style="background: #FFFFFF; border-radius: 0.5rem; position: relative;
box-shadow: 0px 1px 2px rgba(25, 39, 52, 0.05), 0px 0px 4px rgba(25, 39, 52, 0.1); padding: 1rem;">
<div style="border: 10px solid var(--primary-color); display: flex; flex-direction: column; align-items: center; padding: 4rem;
justify-content: center; background-color: #FFFFFF;">
<img src="{{ logo }}" style="height: 1.5rem;">
<div style="margin-top: 4rem;">
{{ _("This certifies that") }}
</div>
<div style="font-size: 2rem; font-weight: 500; color: #192734;"> {{ member.full_name }} </div>
<div style="margin-top: 0.5rem;"> {{ _("has successfully completed the course on") }}
<b> {{ course.title }} </b> on {{ frappe.utils.format_date(certificate.issue_date, "medium") }}. </div>
<div style="font-size: 2rem; font-weight: 500; color: #192734;">
{{ member.full_name }}
</div>
<div style="margin-top: 0.5rem;">
{{ _("has successfully completed the course on") }}
<b> {{ course.title }} </b>
on {{ frappe.utils.format_date(certificate.issue_date, "medium") }}.
</div>
<div style="display: flex; justify-content: center; margin: 4rem auto 0; width: fit-content;">
{% if instructors %}
<div>
<div style="color: #192734; font-weight: bold; font-family: cursive; font-size: 1.25rem;">
@@ -25,14 +32,13 @@
{% if certificate.expiry_date %}
<div style="margin-left: 2rem;">
<div style="color: #192734; font-weight: bold; font-family: cursive; font-size: 1.25rem;">
{{ frappe.utils.format_date(certificate.expiry_date, "medium") }}
</div>
<hr style="margin: 0.5rem 0;">
<div> {{ _("Expiry date") }} </div>
<div style="color: #192734; font-weight: bold; font-family: cursive; font-size: 1.25rem;">
{{ frappe.utils.format_date(certificate.expiry_date, "medium") }}
</div>
<hr style="margin: 0.5rem 0;">
<div> {{ _("Expiry date") }} </div>
</div>
{% endif %}
</div>
</div>
</div>

View File

@@ -0,0 +1,30 @@
{% set certificates = get_certificates(user) %}
{% if certificates | length %}
<div class="cards-parent">
{% for certificate in certificates %}
{% set course = frappe.db.get_value("LMS Course", certificate.course, ["title", "name", "image"], as_dict=True) %}
<div class="common-card-style column-card">
<div class="font-weight-bold">
{{ course.title }}
</div>
<div>
{{ _("Issued on") }} : {{ frappe.utils.format_date(certificate.issue_date, "medium") }}
</div>
<a class="stretched-link" href="/courses/{{ course.name }}/{{ certificate.name }}"></a>
</div>
{% endfor %}
</div>
{% else %}
{% set course_list_link = "<a href='/courses'> course list </a>" %}
<div class="empty-state">
<img class="icon icon-xl" src="/assets/lms/icons/comment.svg">
<div class="empty-state-text">
<div class="empty-state-heading">{{ _("No certificates") }}</div>
<div class="course-meta">{{ _("Check out the {0} to know more about certification.").format(course_list_link) }}</div>
</div>
</div>
{% endif %}

View File

@@ -1,4 +1,4 @@
{% set courses = get_authored_courses(None, only_published=False) %}
{% set courses = get_authored_courses(user or None, only_published=False) %}
{% if courses | length %}
<div class="cards-parent">