{% comment %} calendar A Calendar component to display a queryset in a calendar view with Apple-style simplicity. Parameters: - content_type_id (int): The content type ID for the model being displayed. - queryset (QuerySet): The Django queryset containing the records to be displayed. - preference (UserListViewPreference): The user's view preferences. - calendar_start_field (ApplicationField): The field representing the start date. - calendar_end_field (ApplicationField, optional): The field representing the end date. - calendar_view_mode (CalendarViewMode): The calendar view mode (DAY, WEEK, MONTH). - calendar_events_by_date (dict): Events grouped by date. - calendar_current_date (date): The current date being displayed. - calendar_page_offset (int): The page offset for navigation. - calendar_weeks (list): For month view, list of weeks with day data. - calendar_days (list): For week view, list of days. - calendar_hours (list): For day/week view, list of hours. {% endcomment %} {% load bloomerp %}
{% if not calendar_start_field %}

No date field selected

Please select a start field in the display options

{% else %}
{% if calendar_view_mode == 'day' %} {{ calendar_current_date|date:"l, F j, Y" }} {% elif calendar_view_mode == 'week' %} {{ calendar_date_range.start|date:"M j" }} – {{ calendar_date_range.end|date:"M j, Y" }} {% else %} {{ calendar_current_date|date:"F Y" }} {% endif %}
{% if calendar_view_mode == 'month' %}
{% for day_name in "Mon,Tue,Wed,Thu,Fri,Sat,Sun"|make_list_by_comma %}
{{ day_name }}
{% endfor %}
{% for week in calendar_weeks %} {% for day in week %}
{{ day.date.day }}
{% with events=calendar_events_by_date|get_item:day.date %} {% for event in events %} {% if event.time %} {{ event.time|time:"H:i" }} {% endif %} {{ event.object }} {% endfor %} {% endwith %}
{% endfor %} {% endfor %}
{% elif calendar_view_mode == 'week' %}
{% for day in calendar_days %}
{{ day|date:"D" }}
{{ day.day }}
{% endfor %}
{% for hour in calendar_hours %}
{{ hour }}:00
{% endfor %}
{% for day in calendar_days %}
{% for hour in calendar_hours %}
{% endfor %} {% with events=calendar_events_by_date|get_item:day %} {% for event in events %} {% if event.time %} {{ event.time|time:"H:i" }} {% endif %} {{ event.object }} {% endfor %} {% endwith %}
{% endfor %}
{% elif calendar_view_mode == 'day' %}
{% for hour in calendar_hours %}
{{ hour }}:00
{% with events=calendar_events_by_date|get_item:calendar_current_date %} {% for event in events %} {% if event.time.hour == hour %} {{ event.time|time:"H:i" }} {{ event.object }} {% endif %} {% endfor %} {% endwith %}
{% endfor %}
{% endif %}
{% endif %}