{% extends "lms/templates/lms_base.html" %} {% block title %} {{ _("All Batches") }} {% endblock %} {% block page_content %}
{{ Header() }} {% if past_batches | length or upcoming_batches | length or private_batches | length %} {{ BatchTabs(past_batches, upcoming_batches, private_batches, my_batches) }} {% else %} {{ EmptyState() }} {% endif %}
{% endblock %} {% macro Header() %}
{{ _("All Batches") }}
{% if is_moderator %} {% endif %}
{% endmacro %} {% macro BatchTabs(past_batches, upcoming_batches, private_batches, my_batches) %}
{{ BatchCard(upcoming_batches, show_price=True, label="Upcoming") }}
{% if is_moderator %}
{{ BatchCard(past_batches, show_price=False, label="Archived") }}
{{ BatchCard(private_batches, show_price=False, label="Private") }}
{% endif %} {% if frappe.session.user != "Guest" %}
{{ BatchCard(my_batches, show_price=False, label="Enrolled") }}
{% endif %}
{% endmacro %} {% macro BatchCard(batches, show_price=False, label="") %} {% if batches | length %}
{% for batch in batches %}
{% if batch.seat_count %} {% if batch.seats_left > 0 %}
{{ _("Seats Available") }}: {{ batch.seats_left }}
{% else %}
{{ _("No Seats Left") }}
{% endif %} {% endif %}
{{ batch.title }}
{% if batch.description %}
{{ batch.description }}
{% endif %} {% if show_price and batch.paid_batch %}
{{ frappe.utils.fmt_money(batch.amount, 0, batch.currency) }}
{% endif %}
{{ frappe.utils.format_date(batch.start_date, "medium") }} - {{ frappe.utils.format_date(batch.end_date, "medium") }}
{{ frappe.utils.format_time(batch.start_time, "HH:mm a") }} - {{ frappe.utils.format_time(batch.end_time, "HH:mm a") }}
{{ batch.course_count }} {{ _("Courses") }}
{% if is_student(batch.name) %} {% else %} {% endif %}
{% endfor %}
{% else %}

{{ _("No {0} batches").format(label|lower) }}

{% endif %} {% endmacro %} {% macro EmptyState() %}
{{ _("No Batches") }}
{{ _("Please contact the Administrator for more information.") }}
{% endmacro %} {%- block script %} {{ super() }} {{ include_script('controls.bundle.js') }} {% if is_moderator %} {% endif %} {% endblock %}