From 174019a8382742a2a4620a1744d0cf276cbf87e4 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Mon, 19 Oct 2020 17:00:56 +0530 Subject: [PATCH] fix: Student Admission and Student Applicant fixes (#23515) * fix: student admission list portal styling * fix: added basic validations to Student Admission DocType * fix: show program description and apply button for every program * fix: don't show apply now button if admissions have not started * fix: fetch admission details in student applicant web form Co-authored-by: Nabin Hait --- .../student_admission/student_admission.json | 5 +- .../student_admission/student_admission.py | 3 + .../templates/student_admission.html | 24 ++++---- .../templates/student_admission_row.html | 16 ++++-- .../student_admission_program.json | 34 +++++------ .../student_applicant/student_applicant.json | 3 +- .../student_applicant/student_applicant.json | 57 ++++++++++--------- 7 files changed, 79 insertions(+), 63 deletions(-) diff --git a/erpnext/education/doctype/student_admission/student_admission.json b/erpnext/education/doctype/student_admission/student_admission.json index 1096888d4d..75f21625b0 100644 --- a/erpnext/education/doctype/student_admission/student_admission.json +++ b/erpnext/education/doctype/student_admission/student_admission.json @@ -51,12 +51,14 @@ "fieldname": "admission_start_date", "fieldtype": "Date", "label": "Admission Start Date", + "mandatory_depends_on": "enable_admission_application", "no_copy": 1 }, { "fieldname": "admission_end_date", "fieldtype": "Date", "label": "Admission End Date", + "mandatory_depends_on": "enable_admission_application", "no_copy": 1 }, { @@ -83,6 +85,7 @@ }, { "default": "0", + "depends_on": "published", "fieldname": "enable_admission_application", "fieldtype": "Check", "label": "Enable Admission Application" @@ -91,7 +94,7 @@ "has_web_view": 1, "is_published_field": "published", "links": [], - "modified": "2020-06-15 20:18:38.591626", + "modified": "2020-09-18 00:14:54.615321", "modified_by": "Administrator", "module": "Education", "name": "Student Admission", diff --git a/erpnext/education/doctype/student_admission/student_admission.py b/erpnext/education/doctype/student_admission/student_admission.py index 2781c9c50c..0febb96aeb 100644 --- a/erpnext/education/doctype/student_admission/student_admission.py +++ b/erpnext/education/doctype/student_admission/student_admission.py @@ -19,6 +19,9 @@ class StudentAdmission(WebsiteGenerator): if not self.route: #pylint: disable=E0203 self.route = "admissions/" + "-".join(self.title.split(" ")) + if self.enable_admission_application and not self.program_details: + frappe.throw(_("Please add programs to enable admission application.")) + def get_context(self, context): context.no_cache = 1 context.show_sidebar = True diff --git a/erpnext/education/doctype/student_admission/templates/student_admission.html b/erpnext/education/doctype/student_admission/templates/student_admission.html index e5a9ead31e..7ff3906b34 100644 --- a/erpnext/education/doctype/student_admission/templates/student_admission.html +++ b/erpnext/education/doctype/student_admission/templates/student_admission.html @@ -43,31 +43,35 @@ Program/Std. - Minumum Age - Maximum Age + Description + Minumum Age + Maximum Age Application Fee + {%- if doc.enable_admission_application and frappe.utils.getdate(doc.admission_start_date) <= today -%} + + {% endif %} {% for row in program_details %} {{ row.program }} +
{{ row.description if row.description else '' }}
{{ row.min_age }} {{ row.max_age }} {{ row.application_fee }} + {%- if doc.enable_admission_application and frappe.utils.getdate(doc.admission_start_date) <= today -%} + + + {{ _("Apply Now") }} + + + {% endif %} {% endfor %} {% endif %} - {%- if doc.enable_admission_application -%} -
-

- - {{ _("Apply Now") }} -

- {% endif %} {% endblock %} diff --git a/erpnext/education/doctype/student_admission/templates/student_admission_row.html b/erpnext/education/doctype/student_admission/templates/student_admission_row.html index e049773037..cf22436ae6 100644 --- a/erpnext/education/doctype/student_admission/templates/student_admission_row.html +++ b/erpnext/education/doctype/student_admission/templates/student_admission_row.html @@ -1,8 +1,8 @@ -
+
{% set today = frappe.utils.getdate(frappe.utils.nowdate()) %} - +
-
+
{{ doc.title }}
+
+ + Academic Year + +
+ {{ doc.academic_year }} +
+
Starts on @@ -27,7 +35,7 @@ Ends on -
+
{{ frappe.format_date(doc.admission_end_date) }}
diff --git a/erpnext/education/doctype/student_admission_program/student_admission_program.json b/erpnext/education/doctype/student_admission_program/student_admission_program.json index e9f041e101..d14b9a4d91 100644 --- a/erpnext/education/doctype/student_admission_program/student_admission_program.json +++ b/erpnext/education/doctype/student_admission_program/student_admission_program.json @@ -8,6 +8,7 @@ "program", "min_age", "max_age", + "description", "column_break_4", "application_fee", "applicant_naming_series" @@ -18,52 +19,47 @@ "fieldtype": "Link", "in_list_view": 1, "label": "Program", - "options": "Program", - "show_days": 1, - "show_seconds": 1 + "options": "Program" }, { "fieldname": "column_break_4", - "fieldtype": "Column Break", - "show_days": 1, - "show_seconds": 1 + "fieldtype": "Column Break" }, { "fieldname": "application_fee", "fieldtype": "Currency", "in_list_view": 1, - "label": "Application Fee", - "show_days": 1, - "show_seconds": 1 + "label": "Application Fee" }, { "fieldname": "applicant_naming_series", "fieldtype": "Data", "in_list_view": 1, - "label": "Naming Series (for Student Applicant)", - "show_days": 1, - "show_seconds": 1 + "label": "Naming Series (for Student Applicant)" }, { "fieldname": "min_age", "fieldtype": "Int", "in_list_view": 1, - "label": "Minimum Age", - "show_days": 1, - "show_seconds": 1 + "label": "Minimum Age" }, { "fieldname": "max_age", "fieldtype": "Int", "in_list_view": 1, - "label": "Maximum Age", - "show_days": 1, - "show_seconds": 1 + "label": "Maximum Age" + }, + { + "fetch_from": "program.description", + "fetch_if_empty": 1, + "fieldname": "description", + "fieldtype": "Small Text", + "label": "Description" } ], "istable": 1, "links": [], - "modified": "2020-06-10 23:06:30.037404", + "modified": "2020-10-05 13:03:42.005985", "modified_by": "Administrator", "module": "Education", "name": "Student Admission Program", diff --git a/erpnext/education/doctype/student_applicant/student_applicant.json b/erpnext/education/doctype/student_applicant/student_applicant.json index bca38fb264..6df9b9a84f 100644 --- a/erpnext/education/doctype/student_applicant/student_applicant.json +++ b/erpnext/education/doctype/student_applicant/student_applicant.json @@ -168,6 +168,7 @@ "fieldname": "student_email_id", "fieldtype": "Data", "label": "Student Email Address", + "options": "Email", "unique": 1 }, { @@ -261,7 +262,7 @@ "image_field": "image", "is_submittable": 1, "links": [], - "modified": "2020-09-07 19:31:30.063563", + "modified": "2020-10-05 13:59:45.631647", "modified_by": "Administrator", "module": "Education", "name": "Student Applicant", diff --git a/erpnext/education/web_form/student_applicant/student_applicant.json b/erpnext/education/web_form/student_applicant/student_applicant.json index 2be564833a..7b4eaa18ff 100644 --- a/erpnext/education/web_form/student_applicant/student_applicant.json +++ b/erpnext/education/web_form/student_applicant/student_applicant.json @@ -70,19 +70,7 @@ "show_in_filter": 0 }, { - "allow_read_on_all_link_options": 0, - "fieldname": "image", - "fieldtype": "Data", - "hidden": 0, - "label": "Image", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, - "show_in_filter": 0 - }, - { - "allow_read_on_all_link_options": 0, + "allow_read_on_all_link_options": 1, "fieldname": "program", "fieldtype": "Link", "hidden": 0, @@ -95,7 +83,7 @@ "show_in_filter": 0 }, { - "allow_read_on_all_link_options": 0, + "allow_read_on_all_link_options": 1, "fieldname": "academic_year", "fieldtype": "Link", "hidden": 0, @@ -107,6 +95,19 @@ "reqd": 0, "show_in_filter": 0 }, + { + "allow_read_on_all_link_options": 1, + "fieldname": "academic_term", + "fieldtype": "Link", + "hidden": 0, + "label": "Academic Term", + "max_length": 0, + "max_value": 0, + "options": "Academic Term", + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, { "allow_read_on_all_link_options": 0, "fieldname": "date_of_birth", @@ -119,6 +120,19 @@ "reqd": 0, "show_in_filter": 0 }, + { + "allow_read_on_all_link_options": 1, + "fieldname": "gender", + "fieldtype": "Link", + "hidden": 0, + "label": "Gender", + "max_length": 0, + "max_value": 0, + "options": "Gender", + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, { "allow_read_on_all_link_options": 0, "fieldname": "blood_group", @@ -141,7 +155,7 @@ "max_length": 0, "max_value": 0, "read_only": 0, - "reqd": 0, + "reqd": 1, "show_in_filter": 0 }, { @@ -206,19 +220,6 @@ "reqd": 0, "show_in_filter": 0 }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "guardians", - "fieldtype": "Table", - "hidden": 0, - "label": "Guardians", - "max_length": 0, - "max_value": 0, - "options": "Student Guardian", - "read_only": 0, - "reqd": 0, - "show_in_filter": 0 - }, { "allow_read_on_all_link_options": 0, "fieldname": "siblings",