<?php
namespace App\Form;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\BirthdayType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class RecCandidatType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('nom', TextType::class, ['label' => 'Nom :', 'attr' => ['class' => 'form-control']]);
$builder->add('prenom', TextType::class, ['label' => 'Prénom :', 'attr' => ['class' => 'form-control']]);
$builder->add('genre', ChoiceType::class, ['choices' => ['M' => 'M', 'F' => 'F'],'empty_data'=>"-", 'attr' => ['class' => 'form-select']]);
$builder->add('date_naissance',BirthdayType::class, ['label' => 'Date de Naissance :','placeholder' => '-','format' => 'dd-MM-yyyy','years'=> range(date('Y')-66, date('Y')-18), 'attr' => ['class' => '']]);
$builder->add('lieu_naissance',TextType::class, ['label' => 'Lieu de naissance :', 'attr' => ['class' => 'form-control']]);
$builder->add('adresse', TextareaType::class, ['attr' => ['class' => 'form-control']]);
$builder->add('cp',TextType::class, ['label' => 'CP :', 'attr' => ['class' => 'form-control']]);
$builder->add('ville',TextType::class, ['label' => 'Ville :', 'attr' => ['class' => 'form-control']]);
$builder->add('pays',TextType::class, ['label' => 'Pays :', 'attr' => ['class' => 'form-control']]);
$builder->add('tel',TextType::class, ['label' => 'Tel :', 'attr' => ['class' => 'form-control']]);
$builder->add('email', EmailType::class, ['label' => 'Courriel :', 'attr' => ['class' => 'form-control']]);
$builder->add('password', RepeatedType::class, [
'type' => PasswordType::class,
'first_name' => "password",
'second_name' => 'confirmation',
'options' => ['attr' => ['class' => 'form-control']],
'required' => true,
'first_options' => ['label' => 'Mot de passe :'],
'second_options' => ['label' => 'Confirmation :'],
'invalid_message' => 'Les mots de passe doivent correspondre',
]);
$builder->add('terms', CheckboxType::class, ['property_path' => 'termsAccepted','label' => 'Termes :','attr'=>["class"=>"TermsCandidat"]]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(['data_class' => 'App\Entity\RecCandidat']);
}
/**
* @return string
*/
public function getName()
{
return 'rec_candidat';
}
}