{% extends 'SonataDoctrineORMAdminBundle:Form:form_admin_fields.html.twig' %}
{% import 'AppBundle:Admin:Form\\macro_form.html.twig' as macro_form %}
{% block percent_widget %}
{% spaceless %}
{% set type = type|default('text') %}
{{ block('form_widget_simple') }}
%
{% endspaceless %}
{% endblock percent_widget %}
{% block app_bundle_percent_widget %}
{{ block('percent_widget') }}
{% endblock app_bundle_percent_widget %}
{# Labels #}
{% block form_label %}
{% spaceless %}
{% set label_class = "control-label text-left text-muted" %}
{# Remove the padding for the checkbox #}
{% if form.vars.original_type == 'app_bundle_checkbox' %}
{% if label_attr.checkBoxWithPadding is not defined %}
{% set label_class = label_class~" no-padding" %}
{% endif %}
{% endif %}
{#{{ sonata_admin.admin.getConfigurationPool().getOption('form_type') }}#}
{% if label is not sameas(false) %}
{% set label_attr = label_attr|merge({'class': label_attr.class|default('') ~ label_class }) %}
{% if not compound %}
{% set label_attr = label_attr|merge({'for': id}) %}
{% endif %}
{% if required %}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %}
{% endif %}
{% if label is empty %}
{% set label = "form.label_"~name|camelCaseToUnderscore|lower %}
{% endif %}
{% if in_list_checkbox is defined and in_list_checkbox and widget is defined %}
{% else %}
{% endif %}
{% endif %}
{% endspaceless %}
{% endblock form_label %}
{% block repeated_row %}
{% spaceless %}
{% for child in form %}
{% set label_class = "" %}
{% set div_class = "" %}
{% if sonata_admin.admin and sonata_admin.admin.getConfigurationPool().getOption('form_type') == 'horizontal' %}
{% set label_class = "control-label col-sm-3" %}
{% set div_class = "col-sm-9 col-md-9 sonata-ba-field sonata-ba-field-standard-natural " %}
{% else %}
{% set label_class = "control-label col-sm-3" %}
{% endif %}
{% if sonata_admin is not defined or not sonata_admin_enabled or not sonata_admin.field_description %}
{{ form_label(child, label|default(null)) }}
{{ form_widget(child, {'horizontal': false, 'horizontal_input_wrapper_class': ''}) }} {# {'horizontal': false, 'horizontal_input_wrapper_class': ''} needed to avoid MopaBootstrapBundle messing with the DOM #}
{% if errors|length > 0 %}
{{ form_errors(child) }}
{% endif %}
{% else %}
{{ form_label(child, child.vars.label|default(null), { 'attr' : {'class' : "control-label col-md-3"} }) }}
{% set has_label = sonata_admin.field_description.options.name is defined or label is not sameas(false) %}
{{ form_widget(child, {'horizontal': false, 'horizontal_input_wrapper_class': ''}) }} {# {'horizontal': false, 'horizontal_input_wrapper_class': ''} needed to avoid MopaBootstrapBundle messing with the DOM #}
{% if errors|length > 0 %}
{% endblock %}
{% block form_row %}
{% set colLabel = 'col-md-3' %}
{% set colWidget = 'col-md-9' %}
{% if form.vars.label is not null and form.vars.label == false %}
{% set colWidget = 'col-md-12' %}
{% endif %}
{% if display is defined and display == 'mini' %}
{% set colLabel = 'col-md-12 col-lg-5' %}
{% set colWidget = 'col-md-12 col-lg-7' %}
{% endif %}
{% if display is defined and display == 'big' %}
{% set colLabel = 'col-md-2 col-lg-2 fix-label-size' %}
{% set colWidget = 'col-md-10 col-lg-10 fix-input-size' %}
{% endif %}
{% if form.vars.attr.class is defined and 'input-big' in form.vars.attr.class %}
{% set colWidget = 'col-md-12' %}
{% else %}
{{ form_label(form) }}
{% endif %}
{{ form_widget(form) }}
{% include 'AppBundle:Admin:CRUD\\Common\\Edit\\Template\\edit_form_row_error.html.twig' with {'field':form} %}
{% if attr['data-p-sign'] == 'p' %}
{% include 'AppBundle:Utility:currency_symbol.html.twig' %}
{% endif %}
{{ block('form_widget_simple') }}
{% if attr['data-p-sign'] == 's' %}
{% include 'AppBundle:Utility:currency_symbol.html.twig' %}
{% endif %}
{% endspaceless %}
{% endblock app_bundle_autonumeric_widget %}
{% block app_bundle_contact_selection_extend_row %}
{% set contactQuick = false %}
{% set invoice = false %}
{% set toggle = false %}
{% set displayContactInfo = true %}
{% if form.parent.vars.attr['contactQuick'] is defined %}
{% set contactQuick = form.parent.vars.attr['contactQuick'] %}
{% endif %}
{% if form.parent.vars.attr['invoice'] is defined %}
{% set invoice = true %}
{% endif %}
{% if form.parent.vars.attr['toggle'] is defined %}
{% set toggle = form.parent.vars.attr['toggle'] ? "true" : "false" %}
{% endif %}
{% if form.parent.vars.attr['notDisplayContactInfo'] is defined %}
{% set displayContactInfo = false %}
{% endif %}
{% if form.vars.label != false %}
{{ form_label(form) }}
{% endif %}
{{ form_widget(form) }}
{% if not form.vars.valid %}
{% for error in form.vars.errors %}
{{ error.message }}
{% endfor %}
{% endif %}