Improve UX with better labeling in person resource form

This commit is contained in:
Julie Lenaerts 2025-06-17 19:26:23 +02:00
parent 10e4c7da23
commit c2842148c6
4 changed files with 20 additions and 12 deletions

View File

@ -0,0 +1,6 @@
kind: UX
body: Improve labeling of fields in person resource creation form
time: 2025-06-17T19:26:50.599703116+02:00
custom:
Issue: ""
SchemaChange: No schema change

View File

@ -16,10 +16,8 @@ use Chill\MainBundle\Form\Type\CommentType;
use Chill\PersonBundle\Entity\Person\PersonResource; use Chill\PersonBundle\Entity\Person\PersonResource;
use Chill\PersonBundle\Entity\Person\PersonResourceKind; use Chill\PersonBundle\Entity\Person\PersonResourceKind;
use Chill\PersonBundle\Form\Type\PickPersonDynamicType; use Chill\PersonBundle\Form\Type\PickPersonDynamicType;
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
use Chill\PersonBundle\Templating\Entity\ResourceKindRender; use Chill\PersonBundle\Templating\Entity\ResourceKindRender;
use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType; use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType;
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
@ -29,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
final class PersonResourceType extends AbstractType final class PersonResourceType extends AbstractType
{ {
public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatorInterface $translator) {} public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly TranslatorInterface $translator) {}
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
@ -52,13 +50,13 @@ final class PersonResourceType extends AbstractType
}, },
]) ])
->add('person', PickPersonDynamicType::class, [ ->add('person', PickPersonDynamicType::class, [
'label' => 'Usager', 'label' => $this->translator->trans('person_resource.person_non_prof'),
]) ])
->add('thirdparty', PickThirdpartyDynamicType::class, [ ->add('thirdparty', PickThirdpartyDynamicType::class, [
'label' => 'Tiers', 'label' => $this->translator->trans('person_resource.thirdparty_prof'),
]) ])
->add('freetext', ChillTextareaType::class, [ ->add('freetext', ChillTextareaType::class, [
'label' => 'Description libre', 'label' => $this->translator->trans('person_resource.freetext'),
'required' => false, 'required' => false,
]) ])
->add('comment', CommentType::class, [ ->add('comment', CommentType::class, [

View File

@ -10,28 +10,28 @@
<div class="form-check"> <div class="form-check">
{% if resource is defined and resource.person is not null %} {% if resource is defined and resource.person is not null %}
<input checked type="radio" id="chill_personbundle_person_resource_linkedEntity_0" name="linked-entity" class="form-check-input" value="person" {% if form.vars.submitted and app.request.request.get('linked-entity', null) == 'person' %}checked{% endif %}/> <input checked type="radio" id="chill_personbundle_person_resource_linkedEntity_0" name="linked-entity" class="form-check-input" value="person" {% if form.vars.submitted and app.request.request.get('linked-entity', null) == 'person' %}checked{% endif %}/>
<label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_0">Usager</label> <label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_0">{{ 'person_resource.person_non_prof'|trans }}</label>
{% else %} {% else %}
<input type="radio" id="chill_personbundle_person_resource_linkedEntity_0" name="linked-entity" class="form-check-input" value="person" /> <input type="radio" id="chill_personbundle_person_resource_linkedEntity_0" name="linked-entity" class="form-check-input" value="person" />
<label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_0">Usager</label> <label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_0">{{ 'person_resource.person_non_prof'|trans }}</label>
{% endif %} {% endif %}
</div> </div>
<div class="form-check"> <div class="form-check">
{% if resource is defined and resource.thirdparty is not null %} {% if resource is defined and resource.thirdparty is not null %}
<input checked type="radio" id="chill_personbundle_person_resource_linkedEntity_1" name="linked-entity" class="form-check-input" value="thirdparty" {% if form.vars.submitted and app.request.request.get('linked-entity', null) == 'thirdparty' %}checked{% endif %}/> <input checked type="radio" id="chill_personbundle_person_resource_linkedEntity_1" name="linked-entity" class="form-check-input" value="thirdparty" {% if form.vars.submitted and app.request.request.get('linked-entity', null) == 'thirdparty' %}checked{% endif %}/>
<label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_1">Tiers</label> <label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_1">{{ 'person_resource.thirdparty_prof'|trans }}</label>
{% else %} {% else %}
<input type="radio" id="chill_personbundle_person_resource_linkedEntity_1" name="linked-entity" class="form-check-input" value="thirdparty" /> <input type="radio" id="chill_personbundle_person_resource_linkedEntity_1" name="linked-entity" class="form-check-input" value="thirdparty" />
<label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_1">Tiers</label> <label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_1">{{ 'person_resource.thirdparty_prof'|trans }}</label>
{% endif %} {% endif %}
</div> </div>
<div class="form-check"> <div class="form-check">
{% if resource is defined and resource.freeText is not null %} {% if resource is defined and resource.freeText is not null %}
<input checked type="radio" id="chill_personbundle_person_resource_linkedEntity_2" name="linked-entity" class="form-check-input" value="freetext" {% if form.vars.submitted and app.request.request.get('linked-entity', null) == 'thirdparty' %}checked{% endif %}/> <input checked type="radio" id="chill_personbundle_person_resource_linkedEntity_2" name="linked-entity" class="form-check-input" value="freetext" {% if form.vars.submitted and app.request.request.get('linked-entity', null) == 'thirdparty' %}checked{% endif %}/>
<label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_2">Description libre</label> <label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_2">{{ 'person_resource.freetext'|trans }}</label>
{% else %} {% else %}
<input type="radio" id="chill_personbundle_person_resource_linkedEntity_2" name="linked-entity" class="form-check-input" value="freetext" /> <input type="radio" id="chill_personbundle_person_resource_linkedEntity_2" name="linked-entity" class="form-check-input" value="freetext" />
<label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_2">Description libre</label> <label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_2">{{ 'person_resource.freetext'|trans }}</label>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@ -265,6 +265,10 @@ no comment found: "Aucun commentaire"
Select a type: "Choisissez un type" Select a type: "Choisissez un type"
Select a person: "Choisissez un usager" Select a person: "Choisissez un usager"
Kind: "Type" Kind: "Type"
person_resource:
person_non_prof: "Usager/ Tiers non-professionnel"
thirdparty_prof: "Tiers professionnel"
freetext: "Description libre"
# pickAPersonType # pickAPersonType