martes, 15 de octubre de 2013

Maquetación con Bootstrap 3 - edit.html.twig - Parte IV

Esta plantilla es exáctamente igual que new.html.twig, sólo que en lugar de "form." es "edit_form." y en lugar de "(form" es "(edit_form"


{% extends 'PetramasMainBundle::layout.html.twig' %}

{% block content %}
<h4>Editar Cliente</h4>
{{ form_start(edit_form, {'attr': {'class': 'form-horizontal', 'role': 'form'}}) }}
    {{ form_errors(edit_form) }}
    <div class="form-group{% if edit_form.razonSocial.vars.errors[0].message is defined %} has-error{% endif %}">
        {{ form_label(edit_form.razonSocial, null, {'label_attr': {'class': 'col-sm-2 control-label'}}) }}
        <div class="col-sm-10">
            {{ form_widget(edit_form.razonSocial, {'attr': {'class': 'form-control'}}) }}
            {% if edit_form.razonSocial.vars.errors[0].message is defined %}
            <span class="help-block">
                {{ edit_form.razonSocial.vars.errors[0].message }}
            </span>
            {% endif %}
        </div>
    </div>
    <div class="form-group{% if edit_form.ruc.vars.errors[0].message is defined %} has-error{% endif %}">
        {{ form_label(edit_form.ruc, null, {'label_attr': {'class': 'col-sm-2 control-label'}}) }}
        <div class="col-sm-10">
            {{ form_widget(edit_form.ruc, {'attr': {'class': 'form-control'}}) }}
            {% if edit_form.ruc.vars.errors[0].message is defined %}
            <span class="help-block">
                {{ edit_form.ruc.vars.errors[0].message }}
            </span>
            {% endif %}
        </div>
    </div>
    <div class="form-group{% if edit_form.direccion.vars.errors[0].message is defined %} has-error{% endif %}">
        {{ form_label(edit_form.direccion, null, {'label_attr': {'class': 'col-sm-2 control-label'}}) }}
        <div class="col-sm-10">
            {{ form_widget(edit_form.direccion, {'attr': {'class': 'form-control'}}) }}
            {% if edit_form.direccion.vars.errors[0].message is defined %}
            <span class="help-block">
                {{ edit_form.direccion.vars.errors[0].message }}
            </span>
            {% endif %}
        </div>
    </div>
    <div class="form-group{% if edit_form.estado.vars.errors[0].message is defined %} has-error{% endif %}">
        {{ form_label(edit_form.estado, null, {'label_attr': {'class': 'col-sm-2 control-label'}}) }}
        <div class="col-sm-10">
            {{ form_widget(edit_form.estado, {'attr': {'class': 'form-control'}}) }}
            {% if edit_form.estado.vars.errors[0].message is defined %}
            <span class="help-block">
                {{ edit_form.estado.vars.errors[0].message }}
            </span>
            {% endif %}
        </div>
    </div>
{{ form_end(edit_form) }}
{{ form(delete_form) }}
<a class="btn btn-info pull-right" href="{{ path('cliente') }}">Volver</a>
{% endblock %}