diff --git a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php index e6ecb4b26..ccc9b8bf5 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php @@ -2,6 +2,7 @@ namespace Chill\ThirdPartyBundle\Form; +use Chill\MainBundle\Form\Type\ChillTextareaType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -25,21 +26,21 @@ class ThirdPartyType extends AbstractType * @var AuthorizationHelper */ protected $authorizationHelper; - + /** * * @var TokenStorageInterface */ protected $tokenStorage; - + /** * * @var ThirdPartyTypeManager */ protected $typesManager; - + public function __construct( - AuthorizationHelper $authorizationHelper, + AuthorizationHelper $authorizationHelper, TokenStorageInterface $tokenStorage, ThirdPartyTypeManager $typesManager ) { @@ -47,7 +48,7 @@ class ThirdPartyType extends AbstractType $this->tokenStorage = $tokenStorage; $this->typesManager = $typesManager; } - + /** * {@inheritdoc} */ @@ -57,7 +58,7 @@ class ThirdPartyType extends AbstractType foreach ($this->typesManager->getProviders() as $key => $provider) { $types['chill_3party.key_label.'.$key] = $key; } - + $builder ->add('name', TextType::class, [ 'required' => true @@ -69,7 +70,7 @@ class ThirdPartyType extends AbstractType ->add('email', EmailType::class, [ 'required' => false ]) - ->add('comment', TextareaType::class, [ + ->add('comment', ChillTextareaType::class, [ 'required' => false ]) ->add('type', ChoiceType::class, [ @@ -99,9 +100,9 @@ class ThirdPartyType extends AbstractType ]) ; } - + /** - * + * * @param array $options * @return \Chill\MainBundle\Entity\Center[] */ @@ -113,11 +114,11 @@ class ThirdPartyType extends AbstractType case 'update': $role = new Role(ThirdPartyVoter::UPDATE); break; } - + return $this->authorizationHelper->getReachableCenters( $this->tokenStorage->getToken()->getUser(), $role); } - + /** * {@inheritdoc} */ @@ -126,7 +127,7 @@ class ThirdPartyType extends AbstractType $resolver->setDefaults(array( 'data_class' => 'Chill\ThirdPartyBundle\Entity\ThirdParty' )); - + $resolver->setRequired('usage') ->setAllowedValues('usage', ['create', 'update']) ; diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig index 992aaecca..aa3f61088 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig @@ -15,6 +15,7 @@ diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig index 958d82b3a..ac78361c6 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig @@ -3,32 +3,38 @@ {% block title 'Create third party'|trans %} {% block content %} -
-

{{ 'Create third party'|trans }}

+
+
+
- {{ form_start(form) }} - {{ form_row(form.name) }} - {{ form_row(form.type) }} - {{ form_row(form.telephone) }} - {{ form_row(form.email) }} - {{ form_row(form.address) }} - - {{ form_row(form.active) }} - {{ form_row(form.centers) }} - {{ form_row(form.comment) }} +

{{ 'Create third party'|trans }}

+ + {{ form_start(form) }} + {{ form_row(form.name) }} + {{ form_row(form.type) }} + {{ form_row(form.telephone) }} + {{ form_row(form.email) }} + {{ form_row(form.address) }} + + {{ form_row(form.active) }} + {{ form_row(form.centers) }} + {{ form_row(form.comment) }} - - - {{ form_end(form) }} + + + {{ form_end(form) }} + +
+
{% endblock %} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig index 19956d2ce..56a8276fa 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig @@ -7,61 +7,75 @@ {% block title title_ %} {% block content %} -
-

- {{ title_ }} - {{ (thirdParty.active ? 'Active, shown to users' : 'Inactive, not shown to users')|trans }} -

- -
-
{{ 'Name'|trans }}
-
{{ thirdParty.name }}
- -
{{ 'Type'|trans }}
- {% set types = [] %} - {% for t in thirdParty.type %} - {% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %} - {% endfor %} -
{{ types|join(', ') }}
- -
{{ 'Centers'|trans }}
-
{{ 'The party is visible in those centers'|trans }} : {{ thirdParty.centers|join(', ') }}
- -
{{ 'Phonenumber'|trans }}
-
{{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}
- -
{{ 'email'|trans }}
-
{{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }}
- -
{{ 'Address'|trans }}
-
- {% if thirdParty.address == null %} - {{ 'No address given'|trans }} - {% else %} - {{ address._render(thirdParty.address, {'with_valid_from': false }) }} - {% endif %} -
- -
{{ 'Comment'|trans }}
-
{{ thirdParty.comment|chill_print_or_message("thirdparty.No_comment") }}
- -
- - - +
+
+
+ +

+ {{ title_ }} + + {{ (thirdParty.active ? 'Active' : 'Inactive')|trans }} + +

+ +
+
{{ 'Name'|trans }}
+
{{ thirdParty.name }}
+ +
{{ 'Type'|trans }}
+ {% set types = [] %} + {% for t in thirdParty.type %} + {% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %} + {% endfor %} +
{{ types|join(', ') }}
+ +
{{ 'Centers'|trans }}
+
{{ 'The party is visible in those centers'|trans }} : {{ thirdParty.centers|join(', ') }}
+ +
{{ 'Phonenumber'|trans }}
+
{{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}
+ +
{{ 'email'|trans }}
+
{{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }}
+ +
{{ 'Address'|trans }}
+
+ {% if thirdParty.address == null %} + {{ 'No address given'|trans }} + {% else %} + {{ address._render(thirdParty.address, {'with_valid_from': false }) }} + {% endif %} +
+ +
{{ 'Comment'|trans }}
+
+ {% if thirdParty.comment is not empty %} +
+ {{ thirdParty.comment|chill_markdown_to_html }} +
+ {% endif %} +
+ +
+ + + +
+
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig index af5f11450..2f9d9c48d 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig @@ -3,35 +3,44 @@ {% block title 'Update third party %name%'|trans({ '%name%': thirdParty.name }) %} {% block content %} -
-

- {{ 'Update third party %name%'|trans({ '%name%': thirdParty.name }) }} - {{ (thirdParty.active ? 'Active, shown to users' : 'Inactive, not shown to users')|trans }} +
+
+
-

- - {{ form_start(form) }} - {{ form_row(form.name) }} - {{ form_row(form.type) }} - {{ form_row(form.telephone) }} - {{ form_row(form.email) }} - {{ form_row(form.address) }} - - {{ form_row(form.active) }} - {{ form_row(form.centers) }} - {{ form_row(form.comment) }} +

+ {{ 'Update third party %name%'|trans({ '%name%': thirdParty.name }) }} + + {{ (thirdParty.active ? 'Active' : 'Inactive')|trans }} + +

- - - {{ form_end(form) }} + {{ form_start(form) }} + {{ form_row(form.name) }} + {{ form_row(form.type) }} + {{ form_row(form.telephone) }} + {{ form_row(form.email) }} + {{ form_row(form.address) }} + + {{ form_row(form.active) }} + {{ form_row(form.centers) }} + {{ form_row(form.comment) }} + + + + + {{ form_end(form) }} + +
+
{% endblock %} diff --git a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml index 808c37d19..4d5461877 100644 --- a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml @@ -19,8 +19,12 @@ Update third party %name%: Mettre à jour "%name%" List of third parties: Liste des tiers Third party updated: Le tiers a été mis à jour Third party created: Le tiers a été créé -Active, shown to users: Actif, visible par les utilisateurs -Inactive, not shown to users: Inactif, invisible par les utilisateurs +Active, shown to users: Actif, visible pour les utilisateurs +Active: Actif +shown to users: visible pour les utilisateurs +Inactive, not shown to users: Inactif, invisible pour les utilisateurs +Inactive: Inactif +not shown to users: invisible pour les utilisateurs The party is visible in those centers: Le tiers est visible dans ces centres