add placeholders for inputs

This commit is contained in:
Julie Lenaerts 2022-01-21 12:34:14 +01:00
parent 126bd1a4eb
commit ecae7dab44
3 changed files with 11 additions and 1 deletions

View File

@ -28,18 +28,21 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\RadioType; use Symfony\Component\Form\Extension\Core\Type\RadioType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Contracts\Translation\TranslatorInterface;
final class PersonResourceType extends AbstractType final class PersonResourceType extends AbstractType
{ {
private ResourceKindRender $resourceKindRender; private ResourceKindRender $resourceKindRender;
private PersonRender $personRender; private PersonRender $personRender;
private ThirdPartyRender $thirdPartyRender; private ThirdPartyRender $thirdPartyRender;
private TranslatorInterface $translator;
public function __construct(ResourceKindRender $resourceKindRender, PersonRender $personRender, ThirdPartyRender $thirdPartyRender) public function __construct(ResourceKindRender $resourceKindRender, PersonRender $personRender, ThirdPartyRender $thirdPartyRender, TranslatorInterface $translator)
{ {
$this->resourceKindRender = $resourceKindRender; $this->resourceKindRender = $resourceKindRender;
$this->personRender = $personRender; $this->personRender = $personRender;
$this->thirdPartyRender = $thirdPartyRender; $this->thirdPartyRender = $thirdPartyRender;
$this->translator = $translator;
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
@ -54,6 +57,7 @@ final class PersonResourceType extends AbstractType
$qb->where($qb->expr()->eq('pr.isActive', 'TRUE')); $qb->where($qb->expr()->eq('pr.isActive', 'TRUE'));
return $qb; return $qb;
}, },
'placeholder' => $this->translator->trans('Select a type'),
'choice_label' => function (PersonResourceKind $personResourceKind) { 'choice_label' => function (PersonResourceKind $personResourceKind) {
$options = []; $options = [];
return $this->resourceKindRender->renderString($personResourceKind, $options); return $this->resourceKindRender->renderString($personResourceKind, $options);
@ -62,6 +66,7 @@ final class PersonResourceType extends AbstractType
->add('person', EntityType::class, [ ->add('person', EntityType::class, [
'label' => 'Usager', 'label' => 'Usager',
'class' => Person::class, 'class' => Person::class,
'placeholder' => $this->translator->trans('Select a person'),
'required' => false, 'required' => false,
'choice_label' => function (Person $person) { 'choice_label' => function (Person $person) {
$options = []; $options = [];
@ -72,6 +77,7 @@ final class PersonResourceType extends AbstractType
'label' => 'Tiers', 'label' => 'Tiers',
'class' => ThirdParty::class, 'class' => ThirdParty::class,
'required' => false, 'required' => false,
'placeholder' => $this->translator->trans('Select a thirdparty'),
'choice_label' => function (ThirdParty $thirdParty) { 'choice_label' => function (ThirdParty $thirdParty) {
$options = []; $options = [];
return $this->thirdPartyRender->renderString($thirdParty, $options); return $this->thirdPartyRender->renderString($thirdParty, $options);

View File

@ -235,6 +235,10 @@ The resource has been successfully removed.: "La ressource a été supprimée."
List of resources: "Liste des ressources" List of resources: "Liste des ressources"
There are no available resources: "Il y aucun ressource" There are no available resources: "Il y aucun ressource"
no comment found: "Aucun commentaire" no comment found: "Aucun commentaire"
Select a type: "Choisissez un type"
Select a person: "Choisissez un usager"
Select a thirdparty: "Choisissez un tiers"
# pickAPersonType # pickAPersonType
Pick a person: Choisir une personne Pick a person: Choisir une personne