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

{% set title = 'Video club'|trans ~ ': ' ~ (app.videoEdit ? ('Edit movie'|trans ~ " '"~ app.videoName ~ "'"): 'Add movie'|trans) %}
{% set active_alias = 'video-list' %}


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

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


    <script type="text/javascript" src="./plugins/scrollTo/jquery.scrollTo.min.js" defer=""></script>
    <script type="text/javascript" src="./plugins/placeholders/placeholders.min.js" defer=""></script>

    
    <script type="text/javascript" defer>
       
        {% include app.twig_theme ~ "/VideoClub/add_video/add_video.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="">
                <div class="box"> <a class="collapse-link">
                    <div class="box-header">
                        <div class="box-name">
                            <div class="row">
                                <div class="col-xs-10 col-sm-2">
                                    <span>{{ 'Basic'|trans }}</span>
                                </div>
                            </div>
                        </div>
                        <div class="box-icons">
                            <i class="fa fa-chevron-up"></i>
                        </div>
                        <div class="no-move"></div>
                    </div> </a>
                    <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) }}
                                    {{ form_widget(app['form'].rating_count_kinopoisk) }}
                                    {{ form_widget(app['form'].rating_imdb) }}
                                    {{ form_widget(app['form'].rating_count_imdb) }}
                                    {{ form_widget(app['form'].name, {'attr': {'class': 'form-control', 'data-validation':'required'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].name) }}
                                        {% if app['error_local'] and attribute(app['error_local'], 'name') is defined %}<span> {{ app['error_local']['name'] }}</span> {% endif %}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'You can use letters, digits and symbols from the list: ! @ # $ % ^ & * ( ) _ - + : ; , .'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Category'|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'].category_id, {'attr': {'class': 'populate placeholder', 'data-validation':'required'} }) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].category_id) }}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Genre'|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'].cat_genre_id, {'attr': {'class': 'populate placeholder', 'data-validation':'required'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].cat_genre_id) }}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'You can choose up to 4 genres'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Old genre'|trans }}</label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-6">
                                    {{ form_widget(app['form'].genres, {'attr': {'class': 'populate placeholder'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].genres) }}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Used only for MAG100 compatibility with the portal. You may choose up to 4 genres.'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Cover'|trans }}</label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-4 pull-right" id="cover_container">
                                    {{form_widget(app['form'].cover_big) }}
                                    {{form_widget(app['form'].cover_id) }}
                                    <img class="img-rounded channel-logo" src="{% if app['form'].cover_id.vars.value%}{{app['curr_cover_dir']}}/{{app['form'].cover_id.vars.value}}{% if attribute(app, 'cover_ext') is defined %}{{ app['cover_ext'] }}{% endif %}{% endif %}" alt="" style="max-width: 100%;">
                                    <a href="{{app.request_context.baseUrl}}/{{app.controller_alias}}/delete-cover" data-cover_id="{% if app['form'].cover_id.vars.value %}{{app['form'].cover_id.vars.value}}{% endif %}"><span class="txt-primary">{{ 'Delete cover'|trans }}</span></a>
                                </div>
                                <!-- The file upload form used as target for the file upload widget -->
                                <div id="fileupload" class="pull-left">
                                    <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
                                    <div class="fileupload-buttonbar">
                                        <div class="fileupload-buttons">
                                            <!-- The fileinput-button span is used to style the file input field as button -->
                                            <span class="fileinput-button btn btn-success">
                                                <span>{{ 'Add a picture'|trans }}</span>
                                                <input type="file" name="files" style="opacity: 0;">
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">HD</label>
                            <div class="col-xs-10 col-sm-9">
                                <div class=" col-xs-10 col-sm-9">
                                    <div class="checkbox">
                                        <label>
                                            {{ form_widget(app['form'].hd) }}      
                                            <i class="fa fa-square-o small"></i>
                                        </label>
                                        <div class="bg-danger">
                                            {{ form_errors(app['form'].hd) }}
                                        </div>
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Adds "HD" sign in catalogue'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Age restriction'|trans }}</label>
                            <div class="col-xs-10 col-sm-9">
                                <div class=" col-xs-10 col-sm-9">
                                    <div class="checkbox">
                                        <label>
                                            {{ form_widget(app['form'].censored) }}      
                                            <i class="fa fa-square-o small"></i>
                                        </label>
                                        <div class="bg-danger">
                                            {{ form_errors(app['form'].censored) }}
                                        </div>
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Adds the restriction for movie access (password set in the "Parental advisory"). Default password 0000'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Protocol'|trans }}</label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-3">
                                    {{ form_widget(app['form'].protocol, {'attr': {'class': 'populate placeholder' } }) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].protocol) }}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Select the content delivery type (http,custom url, nfs). When using HTTP NFS the link to the content is not used, but the content is stored on the server.'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">URL<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'].rtsp_url, {'attr': {'class': 'form-control', 'data-validation' : 'custom', 'data-validation-regexp' : '^(\\w+\\s)?\\w+\\:\\/\\/.+$', 'data-validation-error-msg' : 'Invalid format links'|trans }}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].rtsp_url) }}
                                        {% if app['error_local'] and attribute(app['error_local'], 'rtsp_url') is defined %}<span> {{ app['error_local']['rtsp_url'] }}</span> {% endif %}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Example: ffmpeg http://anon.nasa-global.edgesuite.net/HD_downloads/135_launch_720p.wmv'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Volume'|trans }}</label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-3">
                                    {{ form_widget(app['form'].volume_correction, {'attr': {'class': 'populate placeholder'} }) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].volume_correction) }}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Video volume adjustment'|trans }}</span>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="box"><a class="collapse-link">
                    <div class="box-header">
                        <div class="box-name">
                            <div class="row">
                                <div class="col-xs-10 col-sm-2">
                                    <span>{{ 'Movie information'|trans }}</span>
                                </div>
                            </div>
                        </div>
                        <div class="box-icons">
                            <i class="fa fa-chevron-up"></i>
                        </div>
                        <div class="no-move"></div>
                    </div></a>
                    <div class="box-content" >
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Original title'|trans }}</label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-6">
                                    {{ form_widget(app['form'].o_name, {'attr': {'class': 'form-control'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].o_name) }}
                                        {% if app['error_local'] and attribute(app['error_local'], 'o_name') is defined %}<span> {{ app['error_local']['o_name'] }}</span> {% endif %}
                                    </div>
                                    <div>
                                        <a href="" id="kinopoisk_url"></a>
                                    </div>
                                </div>
                                <div class="col-xs-10 col-sm-6">
                                    <span class="col-xs-10 col-sm-1 no-padding"><i class="txt-success fa fa-check"></i></span>
                                    <button class="btn btn-success" id="autocomplete_name" type="button">{{ 'Autocomplete'|trans }}</button>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Title on the native language. Autocomplete is available'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Kinopoisk ID'|trans }}</label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-6">
                                    {{ form_widget(app['form'].kinopoisk_id, {'attr': {'class': 'form-control'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].kinopoisk_id) }}
                                    </div>
                                </div>
                                <div class="col-xs-10 col-sm-6">
                                    <span class="col-xs-10 col-sm-1 no-padding"><i class="txt-success fa fa-check"></i></span>
                                    <button class="btn btn-success" id="autocomplete_id" type="button">{{ 'Autocomplete'|trans }}</button>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'ID of movie on the Kinopoisk'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Kinopoisk rating'|trans }}</label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-6">
                                    {{ form_widget(app['form'].rating_kinopoisk, {'attr': {'class': 'form-control', 'readonly': 'readonly'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].rating_kinopoisk) }}
                                    </div>
                                </div>
                                    <div class="col-xs-10 col-sm-6">
                                        <button class="btn btn-default btn-app-mini btn-circle" type="button" id="update_rating_kinopoisk"><i class="fa fa-refresh"></i></button>
                                    </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Film rating on the Kinopoisk. Autocomplete only'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Year'|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'].year, {'attr': {'class': 'form-control', 'data-validation':'required'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].year) }}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Year of the film creation Example: 2014'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Length'|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'].duration, {'attr': {'class': 'form-control', 'data-validation':'required'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].duration) }}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Film length in minutes Example: 102'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Country'|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'].country, {'attr': {'class': 'form-control', 'data-validation':'required'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].country) }}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Director'|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'].director, {'attr': {'class': 'form-control', 'data-validation':'required'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].director) }}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Stars'|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'].actors, {'attr': {'class': 'form-control', 'data-validation':'required'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].actors) }}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Movie description'|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'].description, {'attr': {'class': 'form-control', 'data-validation':'required'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].description) }}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Comments'|trans }}:</label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-6">
                                    {{ form_widget(app['form'].comments, {'attr': {'class': 'form-control'}}) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].comments) }}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'MPAA rating'|trans }}</label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-3">
                                    {{ form_widget(app['form'].rating_mpaa, {'attr': {'class': 'populate placeholder'} }) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].rating_mpaa) }}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'MPAA age restriction'|trans }}</span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label ">{{ 'Age restriction'|trans }}</label>
                            <div class="col-xs-10 col-sm-6">
                                <div class=" col-xs-10 col-sm-3">
                                    {{ form_widget(app['form'].age, {'attr': {'class': 'populate placeholder'} }) }}
                                    <div class="bg-danger">
                                        {{ form_errors(app['form'].age) }}
                                    </div>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-12">
                                    <span class="small txt-default">{{ 'Recommended viewer age'|trans }}</span>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
				<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=" 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-list" class="btn btn-default  pull-right"> {{ 'Cancel'|trans }} </a>
                            </div>
                        </div></div>
                    </div>
                </div>
            </div>
        </div>
        
        <div style="">
            {{ form_rest(app.form) }}
        </div>
        
        {{ form_end(app['form']) }}  

    </div>

{% endblock %}
