<table class="{{ tclass }}-slides">
    <thead>
    <tr>
        <th>{{ l.slideshow_slide_panel_th_name }}</th>
        {% if AUTH_ENABLED %}
            <th class="tac">
                <i class="fa fa-user"></i>
            </th>
        {% endif %}
        <th class="tac">{{ l.slideshow_slide_panel_th_enabled }}</th>
        <th class="">{{ l.slideshow_slide_panel_th_cron_scheduled }}</th>
        <th class="">{{ l.slideshow_slide_panel_th_duration }}</th>
        <th class="tac">{{ l.slideshow_slide_panel_th_activity }}</th>
    </tr>
    </thead>
    <tbody>
    <tr class="empty-tr {% if slides|length != 0 %}hidden{% endif %}">
        <td colspan="4">
            {{ l.slideshow_slide_panel_empty|replace(
                '%link%',
                ('<a href="javascript:void(0);" class="item-add slide-add">'~l.slideshow_slide_button_add~'</a>')|safe
            ) }}
        </td>
    </tr>
    {% for slide in slides %}
        <tr class="slide-item" data-level="{{ slide.id }}" data-entity="{{ slide.to_json({
                "created_by": track_created(slide).username,
                "updated_by": track_updated(slide).username
            }) }}">
            <td class="infos">
                <div class="inner">
                    <a href="javascript:void(0);" class="item-sort slide-sort">
                        <i class="fa fa-sort icon-left"></i>
                    </a>
                    {% set icon_type = 'globe' %}
                    {% if slide.type == enum_slide_type.VIDEO %}
                        {% set icon_type = 'film' %}
                    {% elif slide.type == enum_slide_type.PICTURE %}
                        {% set icon_type = 'image' %}
                    {% elif slide.type == enum_slide_type.YOUTUBE %}
                        {% set icon_type = 'video' %}
                    {% endif %}

                    <i class="fa fa-{{ icon_type }} icon-left"></i>
                    {{ slide.name }}
                </div>
            </td>
            {% if AUTH_ENABLED %}
                <td class="tac">
                    {% set creator = track_created(slide) %}
                    <a href="javascript:void(0);" class="badge item-utrack slide-utrack {% if not creator.enabled %}anonymous{% endif %}">
                        {{ creator.username }}
                    </a>
                </td>
            {% endif %}
            <td class="tac">
                <label class="pure-material-switch">
                    <input type="checkbox" {% if slide.enabled %}checked="checked"{% endif %}><span></span>
                </label>
            </td>
            <td class="">
                {% if slide.cron_schedule %}
                    {% set cron_desc = cron_descriptor(slide.cron_schedule)  %}
                    {% if cron_desc %}
                        {% if is_validate_cron_date_time(slide.cron_schedule) %}
                        📆 {{ cron_desc }}
                        {% else %}
                        ⏳ {{ cron_desc }}
                        {% endif %}
                    {% else %}
                        <span class="error">⚠️ {{ l.slideshow_slide_panel_td_cron_scheduled_bad_cron }}</span>
                    {% endif %}
                {% else %}
                    🔄 {{ l.slideshow_slide_panel_td_cron_scheduled_loop }}
                {% endif %}
            </td>
            <td class="">
                {% if slide.cron_schedule_end %}
                    {% set cron_desc_end = cron_descriptor(slide.cron_schedule_end)  %}
                    {% if cron_desc_end %}
                        {% if is_validate_cron_date_time(slide.cron_schedule_end) %}
                        📆 {{ cron_desc_end }}
                        {% else %}
                        ⏳ {{ cron_desc_end }}
                        {% endif %}
                    {% else %}
                        <span class="error">⚠️ {{ l.slideshow_slide_panel_td_cron_scheduled_bad_cron }}</span>
                    {% endif %}
                {% else %}
                    ⏱️ {{ slide.duration }} {{ l.slideshow_slide_panel_th_duration_unit }}
                {% endif %}
            </td>
            <td class="actions tac">
                <a href="javascript:void(0);" class="item-edit slide-edit">
                    <i class="fa fa-pencil"></i>
                </a>

                {% set location = slide.location %}

                {% if var_external_url.as_string().strip()|length > 0 and slide.has_file() %}
                    {% set location = var_external_url.value ~ '/' ~ slide.location %}
                {% elif slide.has_file() %}
                    {% set location ='/' ~ slide.location %}
                {% endif %}

                {% if slide.type == enum_slide_type.YOUTUBE %}
                    {% set location = 'https://www.youtube.com/watch?v=' ~ slide.location %}
                {% endif %}

                <a href="{{ location }}" class="item-download slide-download" target="_blank">
                    <i class="fa fa-eye"></i>
                </a>

                <a href="javascript:void(0);" class="item-delete slide-delete">
                    <i class="fa fa-trash"></i>
                </a>
            </td>
        </tr>
    {% endfor %}
    </tbody>
</table>