
{% extends 'admin.html.twig' %}

{% block body %}

    <h3 class="text-primary mb-3 mt-5">Nuevo Plan</h3>

    <h4 class="mb-3 text-primary">Datos</h4>

    <form method="post" action="{{ path('plan_registrar') }}">

    <div class="row">
        <div class="col-md-12">

            {{ form_row(form._token) }}

            <div class="row">
                <div class="col-md-6 mb-3">
                    {{ form_label(form.nombre) }}
                    {{ form_widget(form.nombre) }}
                    {{ form_errors(form.nombre) }}
                </div>

                <div class="col-md-6 mb-3">
                    {{ form_label(form.descripcion) }}
                    {{ form_widget(form.descripcion) }}
                    {{ form_errors(form.descripcion) }}
                </div>
            </div>

            <h4 class="mb-3 text-primary">Precios</h4>

            <div class="row">

                {% set costos = plan.costos %}
                {% for index, costo in form.costos %}

                    <div class="col-md-6 mb-3">
                        {{ form_label(costo.costo, "Costo por #{costos[index].anio} año(s)") }}
                        {{ form_widget(costo.costo) }}
                        {{ form_errors(costo.costo) }}
                    </div>

                {% endfor %}

            </div>

            <h4 class="mb-3 text-primary">Caracteristicas</h4>

            <div class="row">

                    {% set detalles = plan.detalles %}
                    {% for index, detalle in form.detalles %}

                    <div class="col-md-6 mb-3">
                        {{ form_label(detalle.detalle, "#{detalles[index].caracteristica.nombre}") }}
                        {{ form_widget(detalle.detalle) }}
                        {{ form_errors(detalle.detalle) }}
                    </div>

                {% endfor %}

            </div>

        </div>
    </div>



    <button class="btn btn-primary" type="submit">Guardar</button>

    </form>

{% endblock %}