Commit 4033b073 authored by Mat's avatar Mat
Browse files

mise en forme twig/bootstrap du formulaire

parent 3beeba35
......@@ -22,47 +22,65 @@ class LegumeType extends AbstractType
parent::buildForm($builder, $options);
$builder->add('nom', TextType::class, array(
'label' => "Nom",
'label_attr' => array(),
'attr' => array(),
'label_attr' => array('class' => 'col-sm-4 col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
'autofocus' => true,
),
));
$builder->add('description', TextareaType::class, array(
'label' => "Description",
'label_attr' => array(),
'attr' => array(),
'label_attr' => array('class' => 'col-sm-4 col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
),
));
$builder->add('logoPath', TextType::class, array(
'required' => false,
'label' => "Chemin du logo",
'label_attr' => array(),
'attr' => array(),
'label_attr' => array('class' => 'col-sm-4 col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
),
));
$builder->add('unite', TextType::class, array(
'label' => "Unité",
'label_attr' => array(),
'attr' => array(),
'label_attr' => array('class' => 'col-sm-4 col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
),
));
$builder->add('quantiteMin', IntegerType::class, array(
'label' => "Quantité minimale",
'label_attr' => array(),
'attr' => array(),
'label_attr' => array('class' => 'col-sm-4 col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
),
));
$builder->add('quantiteMax', IntegerType::class, array(
'label' => "Quantité maximale",
'label_attr' => array(),
'attr' => array(),
'label_attr' => array('class' => 'col-sm-4 col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
),
));
$builder->add('quantiteStep', IntegerType::class, array(
'label' => "Écart (step)",
'label_attr' => array(),
'attr' => array(),
'label_attr' => array('class' => 'col-sm-4 col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
),
));
$builder->add('prixUnitaire', MoneyType::class, array(
'label' => "Prix unitaire",
'label_attr' => array(),
'attr' => array(),
'label_attr' => array('class' => 'col-sm-4 col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
),
));
$builder->add('sauver', SubmitType::class, array(
'label' => 'Enregistrer',
'attr' => array('class' => 'btn btn-primary mb-2')
));
}
......@@ -74,7 +92,7 @@ class LegumeType extends AbstractType
parent::configureOptions($resolver);
$resolver->setDefault('data_class', Legume::class);
$resolver->setDefault('attr', array(
'class' => 'custom_input',
'class' => 'formulaire formulaire_legume',
'novalidate' => true
));
......
......@@ -10,6 +10,50 @@
<h1>{{ block('title') }}</h1>
{{ form(formLegume) }}
<div class="row">
<div class="col-9">
{{ form_start(formLegume) }}
{{ form_errors(formLegume) }}
<div class="form-group row">{{ form_label(formLegume.nom) }}
<div class="col-sm-8">{{ form_widget(formLegume.nom) }}</div>
{{ form_errors(formLegume.nom) }}</div>
<div class="form-group row">{{ form_label(formLegume.description) }}
<div class="col-sm-8">{{ form_widget(formLegume.description) }}</div>
{{ form_errors(formLegume.description) }}</div>
<div class="form-group row">{{ form_label(formLegume.logoPath) }}
<div class="col-sm-8">{{ form_widget(formLegume.logoPath) }}</div>
{{ form_errors(formLegume.logoPath) }}</div>
<div class="form-group row">{{ form_label(formLegume.unite) }}
<div class="col-sm-8">{{ form_widget(formLegume.unite) }}</div>
{{ form_errors(formLegume.unite) }}</div>
<div class="form-group row">{{ form_label(formLegume.quantiteMin) }}
<div class="col-sm-8">{{ form_widget(formLegume.quantiteMin) }}</div>
{{ form_errors(formLegume.quantiteMin) }}</div>
<div class="form-group row">{{ form_label(formLegume.quantiteMax) }}
<div class="col-sm-8">{{ form_widget(formLegume.quantiteMax) }}</div>
{{ form_errors(formLegume.quantiteMax) }}</div>
<div class="form-group row">{{ form_label(formLegume.quantiteStep) }}
<div class="col-sm-8">{{ form_widget(formLegume.quantiteStep) }}</div>
{{ form_errors(formLegume.quantiteStep) }}</div>
<div class="form-group row">{{ form_label(formLegume.prixUnitaire) }}
<div class="col-sm-8">{{ form_widget(formLegume.prixUnitaire) }}</div>
{{ form_errors(formLegume.prixUnitaire) }}</div>
<div class="form-group row">{{ form_label(formLegume.sauver) }}
<div class="col-sm-8">{{ form_widget(formLegume.sauver) }}</div>
</div>
{{ form_end(formLegume) }}
</div>
</div>
{% endblock %}
......@@ -7,3 +7,8 @@ body {
font-family: 'Open Sans', sans-serif;
font-size: 12pt;
}
form.formulaire {
margin: 1em auto;
padding: 2em;
border: 1px solid #ececec;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment