
{% extends "templates/web.html" %}

{% block breadcrumbs %}
	{% include "templates/includes/breadcrumbs.html" %}
{% endblock %}

{% block header %}
<h1>{{ title }}</h1>
{% endblock %}

{% block page_content %}
	{% set today = frappe.utils.getdate(frappe.utils.nowdate()) %}
	<div class="row transaction-subheading">
	    <div class="col-xs-6">
	        <span class="indicator
				{% if frappe.utils.getdate(doc.admission_end_date) == today %}
					red"> Application will be closed soon
				{% elif frappe.utils.getdate(doc.admission_end_date) > today >= frappe.utils.getdate(doc.admission_start_date)%}
					green"> Application open
				{% elif frappe.utils.getdate(doc.admission_start_date) > today %}
					blue"> Application will open
				{% else %}
					gray
				{% endif  %}
	        </span>
		</div>
	    <div class="col-xs-6 text-muted text-right small">
	        {{ _("Start on") }}: {{ frappe.format_date(admission_start_date) }}<br>
	        {{ _("End on") }}: {{ frappe.format_date(admission_end_date) }}
	    </div>
	</div><br>

	{%- if introduction -%}
		<div>{{ introduction }}</div>
	{% endif %}

	{% if program_details %}
		<br>
		<div class="table-responsive">
			<h3 class="bold">Eligibility and Other Details:</h3>
			<table class="table table-bordered table-hover">
				<thead>
					<tr class="active">
						<th style="width: 90px">Program/Std.</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 %}

{% endblock %}
