{% extends app['twig_theme'] ~ '/' ~ 'layout.twig' %}

{% set title = 'Advertising'|trans ~ ': ' ~ 'Settings'|trans %}


{% block footer %}
    {{ parent() }}

    <script type="text/javascript" defer>
       
        {% include (app.twig_theme ~ "/ExternalAdvertising/settings/settings.js.twig") %}

    </script>
{% endblock %}


{% block content %}

    <div id="add_channel">
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <div class="box">
                    <div class="box-content">
                        <div class="row">
                            <div class="col-sm-12">
                                <h4><strong>{{ 'Source ID'|trans }}</strong></h4>
                                <hr style="margin-top: 0;">
                            </div>
                            <div class="col-sm-5">
                                <p>
                                    {{ 'To configure your ad displays, you need to register a Source ID in the administrative panel.'|trans }}
                                </p>
                                <p>
                                    {{ 'The Source ID is a unique identifier for your advertising campaign which you can use to track statistics.'|trans }}
                                    {{ 'To request Source ID'|trans }} - <a href="{{ (app.request_context.baseUrl ~ '/' ~ app.controller_alias  ~ '/register') }}">{{ 'fill in and send the application'|trans }}.</a>
                                </p>
                                <p>
                                    {{ 'If your region and number of subscribers meet the conditions, a Adtelligent representative will contact you with your personal Source ID.'|trans }}
                                </p>
                                <p>
                                    {{ 'If you do not receive a timely response from a manager, please email us'|trans }}:
                                    <a href="mailto:ministra@infomir.com">ministra@infomir.com</a>
                                </p>
                                <p>
                                    {{ 'To get an additional Source ID, write to'|trans }}:
                                    <a href="mailto:adexchange@adtelligent.com">adexchange@adtelligent.com</a>
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {{ form_start(app['form'], {'method': 'POST', 'action': (app.request_context.baseUrl ~ '/' ~ app.controller_alias  ~ '/' ~ app.action_alias) | trans, 'attr': {'class': 'form-horizontal', 'role': 'form', 'id': 'form_'}}) }}
        <div class="bg-danger">
            <div class="bg-danger">
                {{ form_errors(app['form']) }}
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <div class="box">
                    <div class="box-content" id="form_container">
                        <div class="row">
                        {% set lastKey = 0 %}
                        {% if attribute(app['form'], 'source') is defined %}
                        {% for sourceField in app['form'].source %}
                            {% set lastKey = lastKey + 1 %}
                            <div class="form-group">
                                <label class="col-sm-2 control-label ">{{ 'Source ID'|trans }} # {{ lastKey }}</label>
                                <div class="col-xs-10 col-sm-8">
                                    <div class=" col-xs-10 col-sm-5">
                                        {{ form_widget(sourceField, {'attr': {}}) }}
                                        <div class="bg-danger">
                                            {{ form_errors(sourceField) }}
                                        </div>
                                    </div>
                                    <div class="col-sm-12"></div>
                                    <span class="help-inline col-xs-10 col-sm-5">
                                        <span class="small txt-default">{{ 'Enter your Source ID'|trans }}</span>
                                    </span>
                                </div>
                            </div>
                            {% endfor %}
                        {% endif %}
                        {% for newSourceField in app['form'].new_source %}
                            {% set lastKey = lastKey + 1 %}
                            <div class="form-group">
                                <label class="col-sm-2 control-label ">{{ 'Source ID'|trans }} # {{ lastKey }}</label>
                                <div class="col-xs-10 col-sm-8">
                                    <div class=" col-xs-10 col-sm-5">
                                        {{ form_widget(newSourceField, {'attr': {}}) }}
                                        <div class="bg-danger">
                                            {{ form_errors(newSourceField) }}
                                        </div>
                                    </div>
                                    {% if loop.last %}
                                    <div class=" col-xs-10 col-sm-5 add_new_source_container">
                                        <div class="pull-left">
                                            <a id="add_new_source" href="#" class="no_context_menu" data-prototype="{{ form_widget(app['form'].new_source.vars.prototype)|e }}">{{ 'Add'|trans }} {{ 'Source ID'|trans }}</a>
                                        </div>
                                    </div>
                                    {% endif %}
                                    <div class="col-sm-12"></div>
                                    <span class="help-inline col-xs-10 col-sm-5">
                                        <span class="small txt-default">{{ 'Enter your Source ID'|trans }}</span>
                                    </span>
                                </div>
                            </div>
                        {% endfor %}
                            <div class="form-group">
                                <label class="col-sm-2 control-label ">&nbsp;</label>
                                <div class="col-xs-10 col-sm-8">
                                    <div class=" col-xs-10 col-sm-5">
                                        {{ form_widget(app['form'].save, { 'label': 'Save'|trans , attr: {'class': 'btn btn-success green pull-left'}}) }}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div style="">
            {{ form_rest(app.form) }}
        </div>
        {{ form_end(app['form']) }}
    </div>

{% endblock %}