<ul class="slides">
    {% for slide in slides %}
        {% set content = contents[slide.content_id] %}
        <li class="slide-item {{ 'disabled' if not slide.enabled }}" data-level="{{ slide.id }}"
            data-entity="{{ slide.to_json({"content": content}) }}">
            {% if not are_notifications %}
                <div class="head sort">
                    <a href="javascript:void(0);" class="item-sort slide-sort">
                        <i class="fa fa-bars icon-left"></i>
                    </a>
                </div>
            {% endif %}
            <a href="javascript:void(0);" class="infos item-edit slide-edit" data-modal="{% if are_notifications %}modal-slide-notification-edit{% else %}modal-slide-edit{% endif %}">
                <div class="type">
                    {% set icon = enum_content_type.get_fa_icon(content.type) %}
                    {% set color = enum_content_type.get_color_icon(content.type) %}
                    <i class="fa {{ icon }} {{ color }}"></i>
                </div>
                <div class="title" title="{{ content.name|default(l.common_empty) }}">
                    {{ truncate(content.name|default(l.common_empty), 30, '...') }}
                </div>
            </a>
            <div class="body">
                <div class="range">
                    <div class="start">
                        {% if slide.cron_schedule %}
                            {% set cron_desc = cron_descriptor(slide.cron_schedule) %}
                            {% if cron_desc %}
                                {% if is_cron_calendar_moment(slide.cron_schedule) %}
                                    {% if slide.is_notification %}
                                        🔔 <span class="prefix">{{ l.slideshow_slide_panel_td_cron_scheduled_notify }}</span>
                                        <span class="cron-description">{{ cron_desc }}</span>
                                    {% else %}
                                        🔄 <span class="prefix">{{ l.slideshow_slide_panel_td_cron_scheduled_loop }}</span>
                                        <span class="cron-description">{{ cron_desc }}</span>
                                    {% endif %}
                                {% else %}
                                    🔔 <span class="cron-description">{{ cron_desc }}</span>
                                {% endif %}
                            {% else %}
                                <span class="error"><i class="fa fa-warning danger"></i> {{ l.slideshow_slide_panel_td_cron_scheduled_bad_cron }}</span>
                            {% endif %}
                        {% else %}
                            🔄 <span class="prefix">{{ l.slideshow_slide_panel_td_cron_scheduled_loop }}</span>
                        {% endif %}
                    </div>
                    <div class="end">
                        {% if slide.cron_schedule_end %}
                            {% set cron_desc_end = cron_descriptor(slide.cron_schedule_end) %}
                            {% if cron_desc_end %}
                                {% if is_cron_calendar_moment(slide.cron_schedule_end) %}
                                    {% if slide.is_notification %}
                                        📆 <span class="prefix">{{ l.slideshow_slide_panel_td_cron_scheduled_date }}</span>
                                        <span class="cron-description">{{ cron_desc_end }}</span>
                                    {% else %}
                                        ⏱️ <span class="prefix">{{ slide.duration }} {{ l.slideshow_slide_panel_th_duration_unit }}</span>
                                        <span class="cron-description">{{ cron_desc_end }}</span>
                                    {% endif %}
                                {% else %}
                                    🔔 <span class="cron-description">{{ cron_desc_end }}</span>
                                {% endif %}
                            {% else %}
                                <span class="error"><i class="fa fa-warning danger"></i>️ {{ l.slideshow_slide_panel_td_cron_scheduled_bad_cron }}</span>
                            {% endif %}
                        {% else %}
                            {% if slide.delegate_duration %}
                                <i class="fa {{ icon }}"></i> <span class="prefix">{{ l.slideshow_slide_panel_th_delegate_duration_video }}</span>
                            {% else %}
                                ⏱️ <span class="prefix">{{ slide.duration }} {{ l.slideshow_slide_panel_th_duration_unit }}</span>
                            {% endif %}
                        {% endif %}
                    </div>
                </div>
            </div>

            <div class="tail">
                <a href="javascript:void(0);" class="item-delete slide-delete btn btn-naked"
                   data-route="{{ url_for('slideshow_slide_delete', slide_id=slide.id) }}">
                    <i class="fa fa-close"></i>
                </a>
            </div>
        </li>
    {% else %}
        <div class="inner-empty empty-flag">
            {% if are_notifications %}
                <i class="fa fa-bell"></i>
            {% else %}
                <i class="fa fa-image"></i>
            {% endif %}
        </div>
    {% endfor %}
</ul>