Files
enlight-lms/lms/templates/onboarding_header.html
2022-12-20 11:34:56 +05:30

79 lines
2.5 KiB
HTML

{% set is_onboarding_complete = frappe.db.get_single_value("LMS Settings", "is_onboarding_complete") %}
{% if has_course_moderator_role() and not is_onboarding_complete %}
{% set course_created = frappe.db.count("LMS Course") %}
{% set first_course = frappe.db.get_all("LMS Course", order_by="creation", pluck="name")[0] %}
{% set chapter_created = frappe.db.count("Course Chapter") %}
{% set lesson_created = frappe.db.count("Course Lesson") %}
{% set quiz_created = frappe.db.count("LMS Quiz") %}
<div class="onboarding-parent">
<div class="container">
<div class="onboarding-skip">{{ _("Skip") }}</div>
<h3 class="mt-0"> {{ _("Welcome") }} 🎉</h3>
<div class="onboarding-subtitle">
{{ _("Lets start setting up your content on the LMS so that you can reclaim time and focus on growth.") }}
</div>
<div class="onboarding-steps">
<a class="onboarding-steps-link" href="/courses/new-course">
<svg class="icon icon-md">
<use href="{% if course_created %} #icon-green-check-circled {% else %} #icon-disabled-check {% endif %}">
</use>
</svg>
{{ _("Create a Course") }}
</a>
<a class="onboarding-steps-link" {% if course_created %} href="/courses/{{ first_course }}?edit=1" {% endif %}>
<svg class="icon icon-md">
<use href="{% if chapter_created %} #icon-green-check-circled {% else %} #icon-disabled-check {% endif %}">
</use>
</svg>
{{ _("Add a Chapter") }}
</a>
<a class="onboarding-steps-link" {% if chapter_created %} href="/courses/{{ first_course }}?edit=1" {% endif %}>
<svg class="icon icon-md">
<use href="{% if lesson_created %} #icon-green-check-circled {% else %} #icon-disabled-check {% endif %}">
</use>
</svg>
{{ _("Add a Lesson") }}
</a>
<a class="onboarding-steps-link" {% if lesson_created %} href="/quizzes/new-quiz" {% endif %}>
<svg class="icon icon-md">
<use href="{% if quiz_created %} #icon-green-check-circled {% else %} #icon-disabled-check {% endif %}">
</use>
</svg>
{{ _("Create a Quiz") }}
</a>
</div>
</div>
</div>
{% endif %}
<script>
frappe.ready(() => {
$(".onboarding-skip").click((e) => {
skip_onboarding(e);
});
});
const skip_onboarding = (e) => {
frappe.call({
method: "frappe.client.set_value",
args: {
doctype: "LMS Settings",
name: "LMS Settings",
fieldname: "is_onboarding_complete",
value: 1,
},
freeze: true,
callback: function (data) {
window.location.reload();
}
});
}
</script>