75 lines
2.3 KiB
PHP
75 lines
2.3 KiB
PHP
<?php
|
|
namespace App\Form;
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
|
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
|
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
|
|
|
|
class TimeextraType extends AbstractType
|
|
{
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
{
|
|
$builder->add('submit',
|
|
SubmitType::class, [
|
|
"label" => "Valider",
|
|
"attr" => ["class" => "btn btn-success no-print"],
|
|
]
|
|
);
|
|
|
|
$builder->add('name',
|
|
TextType::class, [
|
|
"label" =>"Description",
|
|
]
|
|
);
|
|
|
|
$builder->add('dateof',
|
|
DateType::class, [
|
|
"label" => "Date",
|
|
"required" => true,
|
|
"widget" => 'single_text',
|
|
]
|
|
);
|
|
|
|
$builder->add('hour',
|
|
IntegerType::class, [
|
|
"label" => "Nombre de Minutes",
|
|
"required" => true,
|
|
]
|
|
);
|
|
|
|
$builder->add('user',
|
|
Select2EntityType::class, [
|
|
"label" => "Utilisateurs",
|
|
"disabled" => false,
|
|
"required" => true,
|
|
"multiple" => false,
|
|
"remote_route" => "app_user_select",
|
|
"class" => "App:User",
|
|
"primary_key" => "id",
|
|
"text_property" => "displayname",
|
|
"minimum_input_length" => 0,
|
|
"page_limit" => 100,
|
|
"allow_clear" => true,
|
|
"delay" => 250,
|
|
"cache" => false,
|
|
"cache_timeout" => 60000,
|
|
"language" => "fr",
|
|
"placeholder" => "Selectionner un Utilisateur",
|
|
]
|
|
);
|
|
}
|
|
|
|
public function configureOptions(OptionsResolver $resolver)
|
|
{
|
|
$resolver->setDefaults(array(
|
|
'data_class' => 'App\Entity\Timeextra',
|
|
'mode' => 'string',
|
|
));
|
|
}
|
|
}
|