diff --git a/lms/lms/doctype/lms_certificate/lms_certificate.py b/lms/lms/doctype/lms_certificate/lms_certificate.py index 0a6e9b19..93487cad 100644 --- a/lms/lms/doctype/lms_certificate/lms_certificate.py +++ b/lms/lms/doctype/lms_certificate/lms_certificate.py @@ -10,16 +10,15 @@ from lms.lms.utils import is_certified class LMSCertificate(Document): - def validate(self): + def before_insert(self): certificates = frappe.get_all("LMS Certificate", { - "member": self.member, - "course": self.course, - "expiry_date": [">", nowdate()] - }) + "member": self.member, + "course": self.course + }) if len(certificates): full_name = frappe.db.get_value("User", self.member, "full_name") course_name = frappe.db.get_value("LMS Course", self.course, "title") - frappe.throw(_("There is already a valid certificate for user {0} for the course {1}").format(full_name, course_name)) + frappe.throw(_("{0} is already certified for the course {1}").format(full_name, course_name)) @frappe.whitelist() def create_certificate(course): @@ -35,11 +34,11 @@ def create_certificate(course): expiry_date = add_years(nowdate(), expires_after_yrs) certificate = frappe.get_doc({ - "doctype": "LMS Certificate", - "member": frappe.session.user, - "course": course, - "issue_date": nowdate(), - "expiry_date": expiry_date - }) + "doctype": "LMS Certificate", + "member": frappe.session.user, + "course": course, + "issue_date": nowdate(), + "expiry_date": expiry_date + }) certificate.save(ignore_permissions=True) return certificate diff --git a/lms/lms/doctype/lms_settings/lms_settings.json b/lms/lms/doctype/lms_settings/lms_settings.json index c2b8b03b..afbbbc1a 100644 --- a/lms/lms/doctype/lms_settings/lms_settings.json +++ b/lms/lms/doctype/lms_settings/lms_settings.json @@ -10,6 +10,7 @@ "force_profile_completion", "column_break_2", "search_placeholder", + "custom_certificate_template", "livecode_url", "signup_settings_section", "terms_of_use", @@ -63,7 +64,7 @@ "depends_on": "show_search", "fieldname": "search_placeholder", "fieldtype": "Data", - "label": "Search Field Placeholder" + "label": "Course List Search Bar Placeholder" }, { "default": "0", @@ -137,12 +138,18 @@ "fieldname": "user_category", "fieldtype": "Check", "label": "Ask User Category during Signup" + }, + { + "fieldname": "custom_certificate_template", + "fieldtype": "Link", + "label": "Custom Certificate Template", + "options": "Web Template" } ], "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2022-04-20 09:09:12.369728", + "modified": "2022-05-09 09:55:24.519269", "modified_by": "Administrator", "module": "LMS", "name": "LMS Settings", diff --git a/lms/public/css/style.css b/lms/public/css/style.css index 07a261f7..d3635b3d 100644 --- a/lms/public/css/style.css +++ b/lms/public/css/style.css @@ -836,15 +836,22 @@ pre { } .certificate-content { - padding: 2.5rem 3rem; - background-color: #FFFFFF; + background-color: #FFFFFF; + border-width: 100px; + border-style: solid; +} + +@media (max-width: 500px) { + .certificate-content { + border-width: 50px; + } } .certificate-footer { display: flex; justify-content: space-between; - width: 30%; - margin: 5rem auto 0; + margin: 4rem auto 0; + width: fit-content; } .certificate-price { @@ -862,6 +869,7 @@ pre { font-size: 1.5rem; font-weight: 500; color: var(--text-color); + margin-top: 0.5rem; } .certificate-para { @@ -875,24 +883,19 @@ pre { box-shadow: var(--shadow-sm); padding: 1rem; text-align: center; - margin: 0 6rem; } .certificate-footer-item { color: var(--text-color); - font-weight: 500; + font-weight: bold; + font-family: cursive; + font-size: 1.25rem; } .certificate-logo { height: 1.5rem; } -@media (max-width: 1050px) { - .certificate-footer { - width: 50%; - } -} - @media (max-width: 768px) { .certificate-card { margin: 0; @@ -903,10 +906,6 @@ pre { .certificate-content { padding: 1rem; } - - .certificate-footer { - width: 100%; - } } .profile-card { diff --git a/lms/public/images/border.png b/lms/public/images/border.png new file mode 100644 index 00000000..f3c6e63b Binary files /dev/null and b/lms/public/images/border.png differ diff --git a/lms/templates/certificate.html b/lms/templates/certificate.html index b16ff782..8064b42c 100644 --- a/lms/templates/certificate.html +++ b/lms/templates/certificate.html @@ -1,50 +1,33 @@