{% extends app['twig_theme'] ~ '/' ~ 'layout.twig' %}
{% import  app['twig_theme'] ~ '/macro/iptw_macro.twig' as main_macro %}

{% set title = 'Events'|trans ~ ': ' ~ 'list of filters of users'|trans %}


{% block footer_js %}
    
        {{ parent() }}
        {% include app.twig_theme ~ "/basic_templates/scripts-datatables.twig" %}

{% endblock %}
{% block footer %}
    
        {{ parent() }}
        <script type="text/javascript" defer>
            {% include (app.twig_theme ~ "/Events/message_templates/message_templates.js.twig") %}
        </script>
        
{% endblock %}


{% block content %}
    <div id="iptv_list">
        <div class="row  filters-actions-pannel">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                {{ main_macro.get_filter('admin_id', 'Author'|trans, 'id', 'login', app['allAdmins'], 2) }}
                <div class="pull-right">
                    <a href="#" class="btn btn-action pull-right no_context_menu" id="msg_tpl_create"><i class="fa fa-plus"></i>{{ 'Create new message template'|trans }}</a>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="box">
                {% if attribute(app, 'dropdownAttribute') is defined %}
                    {{ main_macro.get_dropdown_attribute(app['dropdownAttribute']) }}
                {% endif %}
                <div class="box-content">
                    <div class="box-content no-padding">
                        <div class="dataTables_processing"></div>
                        <table class="table  table-hover table-datatable" id="datatable-1">
                            {% if attribute(app, 'dropdownAttribute') is defined %}
                                {{ main_macro.get_datatable_head(app['dropdownAttribute']) }}
                            {% endif %}
                            <tbody>

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>


    {# The tamplates for javascript #}

    <script type="text/template" id="modal_form_body">
        <div class="box-content">
            <form class="form-horizontal" id="save_message_template" role="form" action="{{ app.request_context.baseUrl }}/{{ app.controller_alias }}/save-message-template">
                <div class="form-group">
                    <label class="col-sm-3 control-label col-sm-offset-1">{{ 'Template name'|trans }}<span class="icon-required">*</span></label>
                    <div class="col-xs-10 col-sm-6">
                        <span class="col-xs-12 col-sm-12">
                            <input type="hidden" class="own_fields" name="msg_tpl[id]" value="">
                            <input type="hidden" class="own_fields" name="msg_tpl[admin_id]" value="{% if attribute(app, 'user_id') is defined %}{{ app.user_id }}{% endif %}">
                            <input type="text" class="own_fields form-control" name="msg_tpl[title]" value="" data-validation="required">
                        </span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label col-sm-offset-1">{{ 'Header'|trans }}<span class="icon-required">*</span></label>
                    <div class="col-xs-10 col-sm-6">
                        <span class="col-xs-12 col-sm-12">
                            <input type="text" class="own_fields form-control" name="msg_tpl[header]" value="" data-validation="required">
                        </span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label col-sm-offset-1">{{ 'Text'|trans }}<span class="icon-required">*</span></label>
                    <div class="col-xs-10 col-sm-6">
                        <span class="col-xs-12 col-sm-12">
                            <textarea class="own_fields form-control" name="msg_tpl[body]" data-validation="required" ></textarea>
                        </span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label col-sm-offset-1">{{ 'URL'|trans }}</label>
                    <div class="col-xs-10 col-sm-6">
                        <span class="col-xs-12 col-sm-12">
                            <input type="text" class="own_fields form-control" name="msg_tpl[url]" value="">
                        </span>
                    </div>
                </div>
            </form>
        </div>
    </script>

    <script type="text/template" id="modal_form_buttons">
        <div class="col-xs-12">
            <button type="submit" class="btn btn-success col-sm-2 pull-right">{{ 'Save'|trans }}</button>
            <button type="reset"  class="btn btn-default col-sm-2 pull-right">{{ 'Cancel'|trans }}</button>
        </div>
    </script>
{% endblock %}