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


{% block preloader %}{% endblock %}

{% block title %}Registro de Usuario{% endblock %}


{% block body %}

    <div class="container mb-5 pb-5">

        {% for label, messages in app.flashes %}
            {% for message in messages %}
                <div class="flash-alerta alert alert-{{ label }} mt-5" role="alert">
                    {{ message }}
                </div>
            {% endfor %}
        {% endfor %}

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

            {{ form_row(form._token) }} 

            <h4 class="mb-3 mt-5">Datos de acceso</h4>

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

                    <div class="row">

                        <div class="mb-3 col-md-6">
                            {{ form_label(form.username, 'Usuario') }}
                            {{ form_widget(form.username, {'attr': {'placeholder': 'Nombre de usuario'} }) }}
                            {{ form_errors(form.username) }}
                        </div>

                        <div class="mb-3 col-md-6">
                            {{ form_label(form.email, 'Correo electronico') }}
                            {{ form_widget(form.email, {'attr': {'placeholder': 'Correo electronico'} }) }}
                            {{ form_errors(form.email) }}

                        </div>

                        <div class="mb-3 col-md-6">
                            {{ form_label(form.plainPassword.first, 'Contraseña') }}
                            {{ form_widget(form.plainPassword.first, {'attr': {'placeholder': 'Contraseña'} }) }}
                            {{ form_errors(form.plainPassword.first) }}
                        </div>

                        <div class="mb-3 col-md-6">
                            {{ form_label(form.plainPassword.second, 'Repetir Contraseña') }}
                            {{ form_widget(form.plainPassword.second, {'attr': {'placeholder': 'Repetir Contraseña'} }) }}
                            {{ form_errors(form.plainPassword.second) }}
                        </div>
                    </div>

                </div>
            </div>

            <h4 class="mb-3 mt-3">Datos personales</h4>

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

                    <div class="row">
                        <div class="mb-3 col-md-12">
                            {{ form_label(form.persona.nombre, 'Razon social') }}
                            {{ form_widget(form.persona.nombre, {'attr': {'placeholder': 'Razon social'} }) }}
                            {{ form_errors(form.persona.nombre) }}
                        </div>
                    </div>

                    <div class="row">
                        <div class="mb-3 col-md-6">
                            {{ form_label(form.persona.dni, 'RUT') }}
                            {{ form_widget(form.persona.dni, {'attr': {'placeholder': 'RUT'} }) }}
                            {{ form_errors(form.persona.dni) }}
                        </div>

                        <div class="mb-3 col-md-6">
                            {{ form_label(form.persona.telefono, 'Telefono') }}
                            {{ form_widget(form.persona.telefono, {'attr': {'placeholder': 'Telefono'} }) }}
                            {{ form_errors(form.persona.telefono) }}
                        </div>

                        <div class="mb-3 col-md-12">
                            {{ form_label(form.persona.direccion, 'Dirección') }}
                            {{ form_widget(form.persona.direccion, {'attr': {'placeholder': 'Dirección'} }) }}
                            {{ form_errors(form.persona.direccion) }}
                        </div>

                        <div class="mb-3 col-md-6">
                            {{ form_label(form.persona.ciudad, 'Ciudad') }}
                            {{ form_widget(form.persona.ciudad, {'attr': {'placeholder': 'Ciudad'} }) }}
                            {{ form_errors(form.persona.ciudad) }}
                        </div>

                        <div class="mb-3 col-md-6">
                            {{ form_label(form.persona.pais, 'Pais') }}
                            {{ form_widget(form.persona.pais, {'attr': {'placeholder': 'Pais'} }) }}
                            {{ form_errors(form.persona.pais) }}
                        </div>

                    </div>


                </div>
            </div>

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

        </form>

    </div>

{% endblock %}
