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 <nabinhait@gmail.com>
This commit is contained in:
Rucha Mahabal 2020-10-19 17:00:56 +05:30 committed by GitHub
parent 8859b71956
commit 174019a838
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 79 additions and 63 deletions

View File

@ -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",

View File

@ -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

View File

@ -43,31 +43,35 @@
<thead>
<tr class="active">
<th style="width: 90px">Program/Std.</th>
<th style="width: 170px">Minumum Age</th>
<th style="width: 170px">Maximum Age</th>
<th style="width: 180px">Description</th>
<th style="width: 100px">Minumum Age</th>
<th style="width: 100px">Maximum Age</th>
<th style="width: 100px">Application Fee</th>
{%- if doc.enable_admission_application and frappe.utils.getdate(doc.admission_start_date) <= today -%}
<th style="width: 120px"></th>
{% endif %}
</tr>
</thead>
<tbody>
{% for row in program_details %}
<tr>
<td>{{ row.program }}</td>
<td><div class="text-muted">{{ row.description if row.description else '' }}</div></td>
<td>{{ row.min_age }}</td>
<td>{{ row.max_age }}</td>
<td>{{ row.application_fee }}</td>
{%- if doc.enable_admission_application and frappe.utils.getdate(doc.admission_start_date) <= today -%}
<td>
<a class='btn btn-sm btn-primary' href='/student-applicant?new=1&student_admission={{doc.name}}&program={{row.program}}&academic_year={{academic_year}}'>
{{ _("Apply Now") }}
</a>
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{%- if doc.enable_admission_application -%}
<br>
<p>
<a class='btn btn-primary'
href='/student-applicant?new=1&student_admission={{doc.name}}'>
{{ _("Apply Now") }}</a>
</p>
{% endif %}
{% endblock %}

View File

@ -1,8 +1,8 @@
<div class="web-list-item">
<div class="web-list-item transaction-list-item">
{% set today = frappe.utils.getdate(frappe.utils.nowdate()) %}
<a href = "{{ doc.route }}/">
<a href = "{{ doc.route }}/" class="no-underline">
<div class="row">
<div class="col-sm-6 text-left small bold" style="margin-top: -3px;"">
<div class="col-sm-4 bold">
<span class="indicator
{% if frappe.utils.getdate(doc.admission_end_date) == today %}
red
@ -15,6 +15,14 @@
{% endif %}
">{{ doc.title }}</span>
</div>
<div class="col-sm-2 small">
<span class="text-muted">
Academic Year
</span>
<div class="text-muted bold">
{{ doc.academic_year }}
</div>
</div>
<div class="col-sm-3 small">
<span class="text-muted">
Starts on
@ -27,7 +35,7 @@
<span class="text-muted">
Ends on
</span>
<div class="bold">
<div class=" text-muted bold">
{{ frappe.format_date(doc.admission_end_date) }}
</div>
</div>

View File

@ -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",

View File

@ -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",

View File

@ -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",