diff --git a/frontend/src/pages/Billing.vue b/frontend/src/pages/Billing.vue index d44dfc00..b2a76737 100644 --- a/frontend/src/pages/Billing.vue +++ b/frontend/src/pages/Billing.vue @@ -161,7 +161,7 @@
diff --git a/frontend/src/pages/Courses.vue b/frontend/src/pages/Courses.vue index 936e3a9b..cb3f323c 100644 --- a/frontend/src/pages/Courses.vue +++ b/frontend/src/pages/Courses.vue @@ -126,6 +126,11 @@ const tabs = [ courses: computed(() => courses.data?.live || []), count: computed(() => courses.data?.live?.length), }, + { + label: 'New', + courses: computed(() => courses.data?.new), + count: computed(() => courses.data?.new?.length), + }, { label: 'Upcoming', courses: computed(() => courses.data?.upcoming), diff --git a/frontend/src/pages/ProfileCertificates.vue b/frontend/src/pages/ProfileCertificates.vue index ef56b643..5deb5ff7 100644 --- a/frontend/src/pages/ProfileCertificates.vue +++ b/frontend/src/pages/ProfileCertificates.vue @@ -8,6 +8,7 @@ v-for="certificate in certificates.data" :key="certificate.name" class="bg-white shadow rounded-lg p-3 cursor-pointer" + @click="openCertificate(certificate)" >
{{ certificate.course_title }} @@ -36,11 +37,19 @@ const certificates = createResource({ url: 'frappe.client.get_list', params: { doctype: 'LMS Certificate', - fields: ['name', 'course', 'course_title', 'issue_date'], + fields: ['name', 'course', 'course_title', 'issue_date', 'template'], filters: { member: props.profile.data.name, }, }, auto: true, }) + +const openCertificate = (certificate) => { + window.open( + `/api/method/frappe.utils.print_format.download_pdf?doctype=LMS+Certificate&name=${ + certificate.name + }&format=${encodeURIComponent(certificate.template)}` + ) +} diff --git a/lms/job/doctype/lms_job_application/lms_job_application.py b/lms/job/doctype/lms_job_application/lms_job_application.py index 0329bcd9..7b08039b 100644 --- a/lms/job/doctype/lms_job_application/lms_job_application.py +++ b/lms/job/doctype/lms_job_application/lms_job_application.py @@ -30,13 +30,23 @@ class LMSJobApplication(Document): "full_name": frappe.db.get_value("User", self.user, "full_name"), "job_title": self.job_title, } - + resume = frappe.get_doc( + "File", + { + "file_name": self.resume, + }, + ) frappe.sendmail( recipients=company_email, subject=subject, template="job_application", args=args, - attachments=[self.resume], + attachments=[ + { + "fname": resume.file_name, + "fcontent": resume.get_content(), + } + ], header=[subject, "green"], retry=3, ) diff --git a/lms/lms/doctype/lms_batch/lms_batch.json b/lms/lms/doctype/lms_batch/lms_batch.json index 82023f6f..925ac2a0 100644 --- a/lms/lms/doctype/lms_batch/lms_batch.json +++ b/lms/lms/doctype/lms_batch/lms_batch.json @@ -304,7 +304,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2024-01-22 10:42:42.872995", + "modified": "2024-04-17 10:35:21.957961", "modified_by": "Administrator", "module": "LMS", "name": "LMS Batch", @@ -334,6 +334,18 @@ "role": "Moderator", "share": 1, "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Batch Evaluator", + "share": 1, + "write": 1 } ], "show_title_field_in_link": 1, diff --git a/lms/lms/doctype/lms_course/lms_course.json b/lms/lms/doctype/lms_course/lms_course.json index 58f2275a..062c4f54 100644 --- a/lms/lms/doctype/lms_course/lms_course.json +++ b/lms/lms/doctype/lms_course/lms_course.json @@ -23,6 +23,7 @@ "status", "section_break_7", "published", + "published_on", "column_break_10", "upcoming", "column_break_12", @@ -242,6 +243,11 @@ "fieldname": "amount_usd", "fieldtype": "Currency", "label": "Amount (USD)" + }, + { + "fieldname": "published_on", + "fieldtype": "Date", + "label": "Published On" } ], "is_published_field": "published", @@ -268,7 +274,7 @@ } ], "make_attachments_public": 1, - "modified": "2024-02-28 11:20:47.700649", + "modified": "2024-04-16 17:40:50.899368", "modified_by": "Administrator", "module": "LMS", "name": "LMS Course", diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 459da21c..83b3e2c9 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -1208,6 +1208,7 @@ def get_course_details(course): "short_introduction", "published", "upcoming", + "published_on", "status", "paid_course", "course_price", @@ -1261,7 +1262,7 @@ def get_course_details(course): def get_categorized_courses(courses): - live, upcoming, enrolled, created, under_review = [], [], [], [], [] + live, upcoming, new, enrolled, created, under_review = [], [], [], [], [], [] for course in courses: if course.status == "Under Review": @@ -1271,6 +1272,13 @@ def get_categorized_courses(courses): elif course.published: live.append(course) + if ( + course.published + and not course.upcoming + and course.published_on > add_months(getdate(), -3) + ): + new.append(course) + if course.membership and course.published: enrolled.append(course) elif course.is_instructor: @@ -1282,6 +1290,7 @@ def get_categorized_courses(courses): return { "live": live, + "new": new, "upcoming": upcoming, "enrolled": enrolled, "created": created, diff --git a/lms/patches.txt b/lms/patches.txt index a274046d..6029128c 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -85,4 +85,5 @@ execute:frappe.delete_doc("Notification", "Assignment Submission Notification") lms.patches.v1_0.change_jobs_url #19-01-2024 lms.patches.v1_0.custom_perm_for_discussions #14-01-2024 lms.patches.v1_0.rename_evaluator_role -lms.patches.v1_0.change_navbar_urls \ No newline at end of file +lms.patches.v1_0.change_navbar_urls +lms.patches.v1_0.set_published_on \ No newline at end of file diff --git a/lms/patches/v1_0/set_published_on.py b/lms/patches/v1_0/set_published_on.py new file mode 100644 index 00000000..e884d614 --- /dev/null +++ b/lms/patches/v1_0/set_published_on.py @@ -0,0 +1,10 @@ +import frappe + + +def execute(): + courses = frappe.get_all( + "LMS Course", filters={"published": 1}, fields=["name", "creation"] + ) + + for course in courses: + frappe.db.set_value("LMS Course", course.name, "published_on", course.creation) diff --git a/lms/templates/emails/job_application.html b/lms/templates/emails/job_application.html index 23b17530..c7305ce9 100644 --- a/lms/templates/emails/job_application.html +++ b/lms/templates/emails/job_application.html @@ -1,14 +1,8 @@ -

- {{ _("New Job Applicant") }} -

-

{{ _("{0} has applied for the job position {1}").format(full_name, job_title) }}


- - {{ _("You can find their resume attached to this email.") }} - + {{ _("You can find their resume attached to this email.") }}