<?php
namespace App\Form\Account;
use App\Form\AbstractFrontType;
use EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaType;
use EWZ\Bundle\RecaptchaBundle\Validator\Constraints\IsTrue;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use App\Actimage\CaptchaBundle\Form\Type\ActimageCaptchaType;
class CreationType extends AbstractFrontType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('connexionId', TextType::class, [
'label' => 'account_creation.step1.form.connexion_id.label',
'required' => true,
'constraints' => [new NotBlank()],
])
->add('customerNumber', IntegerType::class, [
'label' => 'account_creation.step1.form.customer_number.label',
'empty_data' => null,
'required' => true,
'constraints' => [new NotBlank()],
])
->add('email', RepeatedType::class, [
'type' => EmailType::class,
'translation_domain' => 'front',
'invalid_message' => 'account_creation.step1.form.emails_not_matching',
'first_name' => 'email1',
'required' => true,
'first_options' => ['label' => 'account_creation.step1.form.email1'],
'second_name' => 'email2',
'second_options' => ['label' => 'account_creation.step1.form.email2'],
'constraints' => [new NotBlank()],
])
->add('rgpd', CheckboxType::class, [
'label' => 'account_creation.form.rgpd.label',
'mapped' => false,
'required' => true,
'constraints' => [new NotBlank()],
])
// ->add('recaptcha', EWZRecaptchaType::class, [
// 'label' => false,
// 'mapped' => false,
// 'required' => true,
// 'constraints' => [new IsTrue()],
// ]);
->add('captcha', ActimageCaptchaType::class, [
'label' => false,
'mapped' => false,
'required' => true,
]);
}
}