From 7eeb2f2a7dc85a997c42749b8073af260ab454e1 Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 23 Nov 2021 10:57:43 +0100 Subject: [PATCH] main: LocationType: add new property defaultFor in the admin --- src/Bundle/ChillMainBundle/Entity/LocationType.php | 4 ++-- .../ChillMainBundle/Form/LocationTypeType.php | 13 ++++++++++++- .../Resources/views/LocationType/index.html.twig | 2 ++ .../ChillMainBundle/translations/messages.fr.yml | 4 ++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Entity/LocationType.php b/src/Bundle/ChillMainBundle/Entity/LocationType.php index a49bb6c1b..d3dff58b7 100644 --- a/src/Bundle/ChillMainBundle/Entity/LocationType.php +++ b/src/Bundle/ChillMainBundle/Entity/LocationType.php @@ -29,8 +29,8 @@ class LocationType public const STATUS_REQUIRED = 'required'; - const DEFAULT_FOR_PERSON = 'person'; - const DEFAULT_FOR_3PARTY = 'thirdparty'; + public const DEFAULT_FOR_PERSON = 'person'; + public const DEFAULT_FOR_3PARTY = 'thirdparty'; /** * @ORM\Column(type="boolean", nullable=true) diff --git a/src/Bundle/ChillMainBundle/Form/LocationTypeType.php b/src/Bundle/ChillMainBundle/Form/LocationTypeType.php index 1e4776f8f..93bc5ba0f 100644 --- a/src/Bundle/ChillMainBundle/Form/LocationTypeType.php +++ b/src/Bundle/ChillMainBundle/Form/LocationTypeType.php @@ -71,6 +71,17 @@ final class LocationTypeType extends AbstractType ], 'expanded' => true, ] - ); + ) + ->add( + 'defaultFor', + ChoiceType::class, + [ + 'choices' => [ + 'none' => null, + 'person' => LocationType::DEFAULT_FOR_PERSON, + 'thirdparty' => LocationType::DEFAULT_FOR_3PARTY, + ], + 'expanded' => true + ]); } } diff --git a/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig index ec617c6c0..5402d5e89 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig @@ -11,6 +11,7 @@ {{ 'Address required'|trans }} {{ 'Contact data'|trans }} {{ 'Active'|trans }} + {{ 'Default for'|trans }} @@ -33,6 +34,7 @@ {%- endif -%} + {{ entity.defaultFor|trans }}