{% extends 'page.twig' %}

{% block header %}
    <script type="text/javascript">
        window.date_formats = {
            DATE: '{{__('Date', 'DATE')}}',
            DATEPICKER: '{{__('Date', 'datepicker')}}'
        };
    </script>
{% endblock %}
{% block main %}
    {#<form name="formulaire" method="POST" action="{{ path('new_date_poll_final') }}" class="form-horizontal" role="form">#}
    {{ form_start(form) }}
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="well summary">
                    <h4>{{__('Step 3', 'List of your choices')}}</h4>
                    <ul>
                        {% for choice in choices %}
                            <li>
                                {% if poll_type == 'date' %}
                                    {{ choice.name | localizeddate('none', 'none', locale, NULL, 'EEEE dd MMMM y') }}{% if choice.moments | length > 0 %}:{% endif %}
                                    {% for moment in choice.moments %}
                                        {% spaceless %}
                                            {{ moment }}{% if not loop.last %},{% endif %}
                                        {% endspaceless %}
                                    {% endfor %}
                                {% else %}
                                    {{ choice.name | markdown | raw }}
                                {% endif %}
                            </li>

                        {% endfor %}
                    </ul>
                </div>
                <div class="alert alert-info">
                    <p>{{__('Step 3', 'Your poll will automatically be archived')}} {{default_poll_duration}} {{__('Generic', 'days')}} {{__('Step 3', 'after the last date of your poll.')}}
                        <br />{{__('Step 3', 'You can set a closer archiving date for it.')}}</p>
                    <div class="form-group">
                        <label for="enddate" class="col-sm-5 control-label">{{__('Step 3', 'Archiving date:')}}</label>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="glyphicon glyphicon-calendar text-info"></i></span>
                                {#<input type="text" class="form-control" id="enddate" data-date-format="{{__('Date', 'dd/mm/yyyy')}}" aria-describedby="dateformat" name="enddate" value="{{ end_date_str }}" size="10" maxlength="10" placeholder="{{__('Date', 'dd/mm/yyyy')}}" />#}
                                {{ form_widget(form.end_date) }}
                            </div>
                        </div>
                        <span id="dateformat" class="sr-only">{{__('Date', 'dd/mm/yyyy')}}</span>
                    </div>
                </div>
                {% if not form.end_date.vars.valid %}
                    <div class="alert alert-danger">
                        {{ form_errors(form.end_date) }}
                    </div>
                {% endif %}
                <div class="alert alert-warning">
                    <p>{{__('Step 3', 'Once you have confirmed the creation of your poll, you will be automatically redirected on the administration page of your poll.')}}</p>
                    {% if use_smtp %}
                        <p>{{__('Step 3', 'Then, you will receive quickly two emails: one contening the link of your poll for sending it to the voters, the other contening the link to the administration page of your poll.')}}</p>
                    {% endif %}
                </div>
                <p class="text-right">
                    <button class="btn btn-default" onclick="javascript:window.history.back();" title="{{__('Step 3', 'Back to step 2')}}">{{__('Generic', 'Back')}}</button>
                    {{ form_widget(form.submit) }}
                </p>
                {{ form_widget(form._token) }}
            </div>
        </div>
    </form>
{% endblock %}
