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

{% set title = 'Video club'|trans ~ ': ' ~ (app.adsEdit ? ('Edit commercial'|trans ~ " '"~ app.adsTitle ~ "'"): 'Add commercial'|trans) %}
{% set active_alias = 'video-advertise' %}


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

{% endblock %}
{% block footer %}

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

        </script>
        
{% endblock %}


{% block content %}
    <div id="add_channel">
        {{ 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">
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Title'|trans }}<span class="icon-required">*</span></label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-6">
                                    {{ form_widget(app['form'].id, {'attr': {'class': 'form-control'}}) }}
                                    {{ form_widget(app['form'].title, {'attr': {'class': 'form-control', 'data-validation':'required'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].title) }}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'You can use letters, digits'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Address'|trans }}<span class="icon-required">*</span></label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-6">
                                    {{ form_widget(app['form'].url, {'attr': {'class': 'form-control', 'data-validation':'required'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].url) }}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Format: solution+URL. Example: ffmpeg http://example_of_link'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Weight'|trans }}<span class="icon-required">*</span></label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-6">
                                    {{ form_widget(app['form'].weight, {'attr': {'class': 'form-control', 'data-validation':'required', 'value':'1'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].weight) }}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Display frequency rate'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Forbidden for categories'|trans }}</label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-6">
                                    {{ form_widget(app['form'].denied_categories, {'attr': {'class': 'populate placeholder'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].denied_categories) }}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ "Show categories that won't see the advertising"|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Necessary to see'|trans }}</label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-2">
                                    {{ form_widget(app['form'].must_watch, {'attr': {'class': 'populate placeholder'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].must_watch) }}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Percentage of the total length of video that user has to watch to skip commercials.'|trans }}</span>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="box">
                    <div class="box-content">
                        <div class="row">
                            <div class=" pull-right">
                                {{ form_widget(app['form'].save, { 'label': 'Save'|trans , attr: {'class': 'btn btn-success pull-right'}}) }}
                                <a href="{{app.request_context.baseUrl}}/{{app.controller_alias}}/video-advertise" class="btn btn-default pull-right">{{ 'Cancel'|trans }}</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div style="">
            {{ form_rest(app.form) }}
        </div>

        {{ form_end(app['form']) }}  

    </div>

{% endblock %}
