Merge branch 'main' into main

This commit is contained in:
Md Hussain Nagaria
2024-02-12 04:46:28 +03:00
committed by GitHub
28 changed files with 129 additions and 40 deletions

View File

@@ -1,6 +1,6 @@
<p align="center">
<a href="https://www.frappelms.com/">
<img src="https://frappelms.com/files/lms-logo-medium.png" alt="Frappe LMS" width="120px" height="25px">
<img src="https://frappe.io/files/lms.png" alt="Frappe LMS" width="50px" height="50px">
</a>
<p align="center">Easy to use, open source, learning management system.</p>
</p>

View File

@@ -4,6 +4,8 @@
$ git clone https://github.com/frappe/lms.git
$ cd lms
$ cd docker
```
**Step 2:** Run docker-compose

View File

@@ -173,7 +173,8 @@ website_route_rules = [
"to_route": "cohorts/join",
},
{"from_route": "/users", "to_route": "profiles/profile"},
{"from_route": "/jobs/<job>", "to_route": "jobs/job"},
{"from_route": "/job-openings", "to_route": "jobs_openings/index"},
{"from_route": "/job-openings/<job>", "to_route": "jobs_openings/job"},
{
"from_route": "/batches/<batchname>/students/<username>",
"to_route": "/batches/progress",

View File

@@ -19,7 +19,7 @@ def add_pages_to_nav():
{"label": "Courses", "url": "/courses", "parent": "Explore", "idx": 2},
{"label": "Batches", "url": "/batches", "parent": "Explore", "idx": 3},
{"label": "Statistics", "url": "/statistics", "parent": "Explore", "idx": 4},
{"label": "Jobs", "url": "/jobs", "parent": "Explore", "idx": 5},
{"label": "Jobs", "url": "/job-openings", "parent": "Explore", "idx": 5},
{"label": "People", "url": "/community", "parent": "Explore", "idx": 6},
]

View File

@@ -4,6 +4,6 @@
frappe.ui.form.on("Job Opportunity", {
refresh: (frm) => {
if (frm.doc.name)
frm.add_web_link(`/jobs/${frm.doc.name}`, "See on Website");
frm.add_web_link(`/job-openings/${frm.doc.name}`, "See on Website");
},
});

View File

@@ -1,7 +1,7 @@
frappe.ready(function () {
frappe.web_form.after_save = () => {
setTimeout(() => {
window.location.href = `/jobs`;
window.location.href = `/job-openings`;
});
};
});

View File

@@ -20,7 +20,7 @@
"list_columns": [],
"login_required": 1,
"max_attachment_size": 0,
"modified": "2022-09-15 17:22:43.957184",
"modified": "2022-09-15 17:22:43.957185",
"modified_by": "Administrator",
"module": "Job",
"name": "job-opportunity",
@@ -32,7 +32,7 @@
"show_list": 1,
"show_sidebar": 0,
"success_message": "",
"success_url": "/jobs",
"success_url": "/job-openings",
"title": "Job Opportunity",
"web_form_fields": [
{

View File

@@ -1,9 +1,23 @@
# Copyright (c) 2022, Frappe and contributors
# For license information, please see license.txt
# import frappe
import frappe
from frappe.model.document import Document
class BatchStudent(Document):
pass
@frappe.whitelist()
def enroll_batch(batch_name):
if frappe.db.exists(
"Batch Student", {"student": frappe.session.user, "parent": batch_name}
):
frappe.throw("You are already enrolled in this batch")
enrollment = frappe.new_doc("Batch Student")
enrollment.student = frappe.session.user
enrollment.parent = batch_name
enrollment.parentfield = "students"
enrollment.parenttype = "LMS Batch"
enrollment.save(ignore_permissions=True)

View File

@@ -15,6 +15,7 @@
"start_time",
"end_time",
"published",
"allow_self_enrollment",
"section_break_rgfj",
"medium",
"category",
@@ -293,11 +294,17 @@
"fieldname": "amount_usd",
"fieldtype": "Currency",
"label": "Amount (USD)"
},
{
"default": "0",
"fieldname": "allow_self_enrollment",
"fieldtype": "Check",
"label": "Allow Self Enrollment"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-12-21 12:27:16.849362",
"modified": "2024-01-22 10:42:42.872995",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Batch",

View File

@@ -11,7 +11,7 @@
"event": "Days Before",
"idx": 0,
"is_standard": 1,
"message": "{% set title = frappe.db.get_value(\"LMS Course\", doc.course, \"title\") %}\n\n<p> {{ _('Your evaluation for the course ${0} has been scheduled on ${1} at ${2}.').format(title, frappe.utils.format_date(doc.date, \"medium\"), frappe.utils.format_time(doc.start_time, \"short\")) }}</p>\n\n<p> {{ _(\"Please prepare well and be on time for the evaluations.\") }} </p>\n",
"message": "{% set title = frappe.db.get_value(\"LMS Course\", doc.course, \"title\") %}\n\n<p> {{ _('Your evaluation for the course {0} has been scheduled on {1} at {2}.').format(title, frappe.utils.format_date(doc.date, \"medium\"), frappe.utils.format_time(doc.start_time, \"short\")) }}</p>\n\n<p> {{ _(\"Please prepare well and be on time for the evaluations.\") }} </p>\n",
"message_type": "HTML",
"modified": "2023-11-29 17:26:53.355501",
"modified_by": "Administrator",
@@ -29,4 +29,4 @@
"send_system_notification": 0,
"send_to_all_assignees": 0,
"subject": "Reminder for Certificate Evaluation"
}
}

View File

@@ -81,4 +81,5 @@ lms.patches.v1_0.create_batch_source
[post_model_sync]
lms.patches.v1_0.batch_tabs_settings
execute:frappe.delete_doc("Notification", "Assignment Submission Notification")
execute:frappe.delete_doc("Notification", "Assignment Submission Notification")
lms.patches.v1_0.change_jobs_url #17-01-2024

View File

@@ -0,0 +1,15 @@
import frappe
def execute():
jobs_link = frappe.db.exists(
"Top Bar Item",
{
"label": "Jobs",
"url": "/jobs",
"parent_label": "Explore",
},
)
if jobs_link:
frappe.db.set_value("Top Bar Item", jobs_link, "url", "/job-openings")

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View File

@@ -49,11 +49,14 @@
<use href="#icon-calendar"></use>
</svg>
<span>
{{ frappe.utils.format_date(batch_info.start_date, "long") }} -
{{ frappe.utils.format_date(batch_info.start_date, "long") }}
</span>
{% if batch_info.start_date != batch_info.end_date %}
<span>
{{ frappe.utils.format_date(batch_info.end_date, "long") }}
- {{ frappe.utils.format_date(batch_info.end_date, "long") }}
</span>
{% endif %}
</div>
<span class="seperator"></span>
@@ -646,4 +649,4 @@
<link rel="stylesheet" href="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.css" />
<script src="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.js"></script>
{% endblock %}
{% endblock %}

View File

@@ -57,11 +57,13 @@
<use href="#icon-calendar"></use>
</svg>
<span>
{{ frappe.utils.format_date(batch_info.start_date, "long") }} -
</span>
<span>
{{ frappe.utils.format_date(batch_info.end_date, "long") }}
{{ frappe.utils.format_date(batch_info.start_date, "long") }}
</span>
{% if batch_info.start_date != batch_info.end_date %}
<span>
- {{ frappe.utils.format_date(batch_info.end_date, "long") }}
</span>
{% endif %}
</div>
{% if batch_info.start_time and batch_info.end_time %}
@@ -115,11 +117,13 @@
<use href="#icon-calendar"></use>
</svg>
<span>
{{ frappe.utils.format_date(batch_info.start_date, "long") }} -
</span>
<span>
{{ frappe.utils.format_date(batch_info.end_date, "long") }}
{{ frappe.utils.format_date(batch_info.start_date, "long") }}
</span>
{% if batch_info.start_date != batch_info.end_date %}
<span>
- {{ frappe.utils.format_date(batch_info.end_date, "long") }}
</span>
{% endif %}
</div>
{% if batch_info.start_time and batch_info.end_time %}
@@ -146,6 +150,10 @@
href="/billing/batch/{{ batch_info.name }}">
{{ _("Register Now") }}
</a>
{% elif batch_info.allow_self_enrollment and batch_info.seat_count and seats_left %}
<button class="btn btn-primary wide-button enroll-batch">
{{ _("Enroll Now") }}
</button>
{% else %}
<div class="alert alert-info">
{{ _("To join this batch, please contact the Administrator.") }}
@@ -235,4 +243,4 @@
let batch_info = {{ batch_info | json }};
</script>
{% endif %}
{% endblock %}
{% endblock %}

View File

@@ -12,6 +12,10 @@ frappe.ready(() => {
$(".btn-remove-course").click((e) => {
remove_course(e);
});
$(".enroll-batch").click((e) => {
enroll_batch(e);
});
});
const show_course_modal = (e) => {
@@ -54,6 +58,30 @@ const show_course_modal = (e) => {
}, 1000);
};
const enroll_batch = (e) => {
let batch_name = $(".class-details").data("batch");
if (frappe.session.user == "Guest") {
window.location.href =
"/login?redirect-to=/batches/details/" + batch_name;
}
frappe.call({
method: "lms.lms.doctype.batch_student.batch_student.enroll_batch",
args: {
batch_name: batch_name,
},
callback(r) {
frappe.show_alert(
{
message: __("Successfully Enrolled"),
indicator: "green",
},
2000
);
window.location.href = `/batches/${batch_name}`;
},
});
};
const add_course = (values, course_name) => {
frappe.call({
method: "lms.lms.doctype.lms_batch.lms_batch.add_course",

View File

@@ -35,6 +35,7 @@ def get_context(context):
"batch_details_raw",
"evaluation_end_date",
"amount_usd",
"allow_self_enrollment",
],
as_dict=1,
)

View File

@@ -140,14 +140,16 @@
<use href="#icon-calendar"></use>
</svg>
<span>
{{ frappe.utils.format_date(batch.start_date, "medium") }} -
{{ frappe.utils.format_date(batch.start_date, "medium") }}
</span>
{% if batch.start_date != batch.end_date %}
<span>
{{ frappe.utils.format_date(batch.end_date, "medium") }}
- {{ frappe.utils.format_date(batch.end_date, "long") }}
</span>
{% endif %}
</div>
<div class="mt-auto mb-2">
<div class="mb-2">
<svg class="icon icon-sm">
<use href="#icon-clock"></use>
</svg>
@@ -204,4 +206,4 @@
let batch_info = null;
</script>
{% endif %}
{% endblock %}
{% endblock %}

View File

@@ -38,7 +38,7 @@
<div class="flex">
<div class="field-label">
{{ _("Total Price: ") }}
<span class="total-price">{{ frappe.utils.fmt_money(amount, 2, currency) }}</span>
<span class="total-price">{{ frappe.utils.fmt_money(amount_with_gst, 2, currency) if gst_applied else frappe.utils.fmt_money(amount, 2, currency) }}</span>
</div>
</div>
{% if gst_applied %}

View File

@@ -17,9 +17,7 @@ def get_context(context):
context.original_currency = context.currency
context.original_amount = (
apply_gst(context.amount, None)[0]
if context.original_currency == "INR"
else context.amount
(context.amount * 1.18) if context.original_currency == "INR" else context.amount
)
context.exception_country = frappe.get_all(
@@ -32,7 +30,7 @@ def get_context(context):
context.address = get_address()
if context.currency == "INR":
context.amount, context.gst_applied = apply_gst(context.amount, None)
context.amount_with_gst, context.gst_applied = apply_gst(context.amount, None)
def validate_access(doctype, docname, module):

View File

@@ -1,6 +1,11 @@
{% extends "www/cohorts/base.html" %} {% block title %} {{ _("Manage") }} {{
course.title }} {% endblock %} {% block page_content %}
<div class="course-home-headings">{{ cohort.title }}</div>
{% if cohort.description %}
<div>
{{ frappe.utils.md_to_html(cohort.description) }}
</div>
{% endif %}
<p>
{{ frappe.db.count("Cohort Subgroup", {"cohort": cohort.name}) }} {{

View File

@@ -10,9 +10,11 @@ from lms.lms.utils import (
has_course_instructor_role,
)
from lms.overrides.user import get_enrolled_courses, get_authored_courses
from frappe.utils.telemetry import capture
def get_context(context):
capture("active_site", "lms")
context.no_cache = 1
context.live_courses, context.upcoming_courses = get_courses()
context.enrolled_courses = (

View File

@@ -17,7 +17,8 @@
<div class="job-cards-parent">
{% for job in jobs %}
<div class="common-card-style job-card">
<span title="{{ job.company_name}}" style="background-image: url( {{ job.company_logo | urlencode }} );"
{% set company_logo = job.company_logo.replace(' ', '%20') %}
<span title="{{ job.company_name}}" style="background-image: url( {{ company_logo }} );"
class="company-logo"></span>
<div class="job-card-info">
<div class="card-heading">{{ _(job.job_title) }}</div>
@@ -37,7 +38,7 @@
<div class="text-muted">{{ frappe.utils.format_date(job.creation, "medium") }}</div>
</div>
</div>
<a class="stretched-link" href="/jobs/{{ job.name }}"></a>
<a class="stretched-link" href="/job-openings/{{ job.name }}"></a>
</div>
{% endfor %}
</div>

View File

@@ -11,7 +11,8 @@
<div class="common-card-style job-detail-card">
<div class="job-detail-header">
<span title="{{ job.company_name}}" style="background-image: url( {{ job.company_logo | urlencode }} );"
{% set company_logo = job.company_logo.replace(' ', '%20') %}
<span title="{{ job.company_name}}" style="background-image: url( {{ company_logo }} );"
class="company-logo"></span>
<div class="job-card-info">
@@ -33,7 +34,7 @@
</div>
</div>
{% set application_link = job.application_link if frappe.session.user != 'Guest' else '/login?redirect-to=/jobs/' + job.name %}
{% set application_link = job.application_link if frappe.session.user != 'Guest' else '/login?redirect-to=/job-openings/' + job.name %}
<div class="job-actions">
<a class="btn btn-primary btn-sm mr-2" href="{{ application_link }}"> {{ _("Apply") }} </a>
<div class="btn btn-default btn-sm mr-2" id="report" data-job="{{ job.name }}"> {{ _("Report") }} </div>
@@ -94,7 +95,7 @@
{% macro BreadCrumb(job) %}
<div class="breadcrumb">
<a class="dark-links" href="/jobs">{{ _("Job Openings") }}</a>
<a class="dark-links" href="/job-openings">{{ _("Job Openings") }}</a>
<img class="ml-1 mr-1" src="/assets/lms/icons/chevron-right.svg">
<span class="breadcrumb-destination">{{ job.job_title }}</span>
</div>

View File

@@ -11,7 +11,7 @@ frappe.ready(() => {
const open_report_dialog = (e) => {
e.preventDefault();
if (frappe.session.user == "Guest") {
window.location.href = `/login?redirect-to=/jobs/${$(
window.location.href = `/login?redirect-to=/job-openings/${$(
e.currentTarget
).data("job")}`;
return;

View File

@@ -5,7 +5,7 @@ def get_context(context):
try:
job = frappe.form_dict["job"]
except KeyError:
frappe.local.flags.redirect_location = "/jobs"
frappe.local.flags.redirect_location = "/job-openings"
raise frappe.Redirect
context.job = frappe.get_doc("Job Opportunity", job)