From 7ea2c36c5e7c84eddb9e89c88bb67d5417403659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 6 Oct 2021 12:30:18 +0200 Subject: [PATCH] crudification for thirdparty --- .../DataTransformer/CenterTransformer.php | 2 +- .../{CenterType.php => PickCenterType.php} | 12 +- .../views/CRUD/_edit_content.html.twig | 2 +- .../views/CRUD/_new_content.html.twig | 11 +- .../Resources/views/Form/fields.html.twig | 12 ++ .../ChillMainBundle/config/services/form.yaml | 2 +- .../Form/CreationPersonType.php | 20 ++- .../Controller/ThirdPartyController.php | 4 +- .../ChillThirdPartyExtension.php | 9 ++ .../Form/ThirdPartyType.php | 16 ++- .../views/ThirdParty/_form.html.twig | 53 ++++++++ .../views/ThirdParty/index.html.twig | 4 +- .../Resources/views/ThirdParty/new.html.twig | 87 ++----------- .../Resources/views/ThirdParty/show.html.twig | 122 ------------------ .../views/ThirdParty/update.html.twig | 51 +++++--- .../Resources/views/ThirdParty/view.html.twig | 110 ++++++++++++++++ 16 files changed, 275 insertions(+), 242 deletions(-) rename src/Bundle/ChillMainBundle/Form/Type/{CenterType.php => PickCenterType.php} (94%) create mode 100644 src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig delete mode 100644 src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig create mode 100644 src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/view.html.twig diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php index 88bc75e3a..c088edeba 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php @@ -67,7 +67,7 @@ class CenterTransformer implements DataTransformerInterface } if ($this->multiple) { - return new ArrayCollect($centers); + return new ArrayCollection($centers); } else { return $centers[0]; } diff --git a/src/Bundle/ChillMainBundle/Form/Type/CenterType.php b/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php similarity index 94% rename from src/Bundle/ChillMainBundle/Form/Type/CenterType.php rename to src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php index ce2978ebf..07c3d5c67 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/CenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php @@ -24,6 +24,8 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\CallbackTransformer; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; @@ -41,7 +43,7 @@ use Symfony\Component\Security\Core\Security; * * */ -class CenterType extends AbstractType +class PickCenterType extends AbstractType { protected AuthorizationHelperInterface $authorizationHelper; @@ -112,9 +114,8 @@ class CenterType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $centers = $this->getReachableCenters($options['role'], $options['scopes']); - dump($centers); + if (count($centers) <= 1) { - dump($centers); $multiple = $options['choice_options']['multiple'] ?? false; $builder->add('center', HiddenType::class); $builder->get('center')->addModelTransformer( @@ -165,4 +166,9 @@ class CenterType extends AbstractType } } + public function buildView(FormView $view, FormInterface $form, array $options) + { + $view->vars['is_hidden'] = count($this->getReachableCenters($options['role'], + $options['scopes'])) <= 1; + } } diff --git a/src/Bundle/ChillMainBundle/Resources/views/CRUD/_edit_content.html.twig b/src/Bundle/ChillMainBundle/Resources/views/CRUD/_edit_content.html.twig index 5e338d5fd..a26eb2e4a 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/CRUD/_edit_content.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/CRUD/_edit_content.html.twig @@ -1,5 +1,5 @@ {% set formId = crudMainFormId|default('crud_main_form') %} -
+
{% block crud_content_header %}

{{ ('crud.'~crud_name~'.title_edit')|trans }}

{% endblock crud_content_header %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/CRUD/_new_content.html.twig b/src/Bundle/ChillMainBundle/Resources/views/CRUD/_new_content.html.twig index 4c2003617..906a77d0d 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/CRUD/_new_content.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/CRUD/_new_content.html.twig @@ -1,10 +1,11 @@ +{% set formId = crudMainFormId|default('crud_main_form') %}
{% block crud_content_header %}

{{ ('crud.' ~ crud_name ~ '.title_new')|trans({'%crud_name%' : crud_name }) }}

{% endblock crud_content_header %} {% block crud_content_form %} - {{ form_start(form) }} + {{ form_start(form, { 'attr' : { 'id': formId } }) }} {% block crud_content_form_rows %} {% for f in form %}{% if f.vars.name != 'submit' %} @@ -14,6 +15,8 @@ {% block crud_content_after_form %}{% endblock %} + {{ form_end(form) }} + {% block crud_content_form_actions %}
    {% block content_form_actions_back %} @@ -25,21 +28,21 @@ {% endblock %} {% block content_form_actions_save_and_close %}
  • -
  • {% endblock %} {% block content_form_actions_save_and_show %}
  • -
  • {% endblock %} {% block content_form_actions_save_and_new %}
  • -
  • diff --git a/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig index ce406286b..2179d1366 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig @@ -198,3 +198,15 @@ {{ form_widget(entry) }} {% endfor %} {% endblock comment_widget %} + +{% block pick_center_widget %} + {{ form_widget(form.center) }} +{% endblock pick_center_widget %} + +{% block pick_center_row %} + {% if (not form.vars.is_hidden) %} + {{ block('form_row') }} + {% else %} + {{ form_widget(form.center) }} + {% endif %} +{% endblock %} diff --git a/src/Bundle/ChillMainBundle/config/services/form.yaml b/src/Bundle/ChillMainBundle/config/services/form.yaml index c5cde5da0..b28ced053 100644 --- a/src/Bundle/ChillMainBundle/config/services/form.yaml +++ b/src/Bundle/ChillMainBundle/config/services/form.yaml @@ -36,7 +36,7 @@ services: tags: - { name: form.type, alias: select2_chill_language } - Chill\MainBundle\Form\Type\CenterType: + Chill\MainBundle\Form\Type\PickCenterType: autowire: true autoconfigure: true diff --git a/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php b/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php index 36d088c25..8fa95fe4f 100644 --- a/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php @@ -22,7 +22,9 @@ namespace Chill\PersonBundle\Form; use Chill\MainBundle\Form\Event\CustomizeFormEvent; +use Chill\MainBundle\Repository\CenterRepository; use Chill\PersonBundle\Entity\Person; +use Chill\PersonBundle\Security\Authorization\PersonVoter; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; @@ -30,12 +32,11 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Chill\MainBundle\Form\Type\ChillDateType; -use Chill\MainBundle\Form\Type\CenterType; +use Chill\MainBundle\Form\Type\PickCenterType; use Chill\PersonBundle\Form\Type\GenderType; use Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; use Chill\PersonBundle\Form\Type\PersonAltNameType; -use Chill\MainBundle\Form\Type\Export\PickCenterType; final class CreationPersonType extends AbstractType { @@ -43,11 +44,7 @@ final class CreationPersonType extends AbstractType // TODO: See if this is still valid and update accordingly. const NAME = 'chill_personbundle_person_creation'; - /** - * - * @var CenterTransformer - */ - private $centerTransformer; + private CenterRepository $centerRepository; /** * @@ -58,11 +55,11 @@ final class CreationPersonType extends AbstractType private EventDispatcherInterface $dispatcher; public function __construct( - CenterTransformer $centerTransformer, + CenterRepository $centerRepository, ConfigPersonAltNamesHelper $configPersonAltNamesHelper, EventDispatcherInterface $dispatcher ) { - $this->centerTransformer = $centerTransformer; + $this->centerTransformer = $centerRepository; $this->configPersonAltNamesHelper = $configPersonAltNamesHelper; $this->dispatcher = $dispatcher; } @@ -82,8 +79,9 @@ final class CreationPersonType extends AbstractType ->add('gender', GenderType::class, array( 'required' => true, 'placeholder' => null )) - ->add('center', CenterType::class, [ - 'required' => false + ->add('center', PickCenterType::class, [ + 'required' => false, + 'role' => PersonVoter::CREATE, ]) ; diff --git a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php index 83df22991..224280d85 100644 --- a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php +++ b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php @@ -71,7 +71,7 @@ final class ThirdPartyController extends CRUDController /** * @Route("/new", name="chill_3party_3party_new") */ - public function newAction(Request $request) + public function newActionkk(Request $request) { $this->denyAccessUnlessGranted(ThirdPartyVoter::CREATE); @@ -115,7 +115,7 @@ final class ThirdPartyController extends CRUDController * @Route("/{thirdparty_id}/update", name="chill_3party_3party_update") * @ParamConverter("thirdParty", options={"id": "thirdparty_id"}) */ - public function updateAction(ThirdParty $thirdParty, Request $request) + public function updateActionkk(ThirdParty $thirdParty, Request $request) { $this->denyAccessUnlessGranted(ThirdPartyVoter::CREATE); diff --git a/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php b/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php index b6fa70130..bdf21c05a 100644 --- a/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php +++ b/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php @@ -71,7 +71,16 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte 'role' => ThirdPartyVoter::SHOW, ], 'new' => [ + 'template' => '@ChillThirdParty/ThirdParty/new.html.twig', 'role' => ThirdPartyVoter::CREATE, + ], + 'edit' => [ + 'template' => '@ChillThirdParty/ThirdParty/update.html.twig', + 'role' => ThirdPartyVoter::UPDATE, + ], + 'view' => [ + 'template' => '@ChillThirdParty/ThirdParty/view.html.twig', + 'role' => ThirdPartyVoter::SHOW, ] ] diff --git a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php index 8eae938f6..20c843e71 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php @@ -3,8 +3,10 @@ namespace Chill\ThirdPartyBundle\Form; use Chill\MainBundle\Entity\Address; +use Chill\MainBundle\Form\Type\PickCenterType; use Chill\MainBundle\Form\Type\ChillTextareaType; use Chill\MainBundle\Templating\TranslatableStringHelper; +use Chill\ThirdPartyBundle\Entity\ThirdParty; use Chill\ThirdPartyBundle\Entity\ThirdPartyCategory; use Chill\ThirdPartyBundle\Entity\ThirdPartyCivility; use Chill\ThirdPartyBundle\Entity\ThirdPartyProfession; @@ -129,12 +131,22 @@ class ThirdPartyType extends AbstractType ->add('comment', ChillTextareaType::class, [ 'required' => false ]) + ->add('centers', PickCenterType::class, [ + 'role' => $this->om->contains($options['data']) ? + ThirdPartyVoter::UPDATE : ThirdPartyVoter::CREATE, + 'choice_options' => [ + 'multiple' => true, + 'attr' => ['class' => 'select2'] + ] + ]) + /* ->add('centers', EntityType::class, [ 'choices' => $this->getReachableCenters($options), 'class' => \Chill\MainBundle\Entity\Center::class, 'multiple' => true, 'attr' => ['class' => 'select2'] ]) + */ ; $builder @@ -228,12 +240,14 @@ class ThirdPartyType extends AbstractType public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'data_class' => 'Chill\ThirdPartyBundle\Entity\ThirdParty' + 'data_class' => ThirdParty::class )); + /* $resolver->setRequired('usage') ->setAllowedValues('usage', ['create', 'update']) ; + */ } /** diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig new file mode 100644 index 000000000..9fb8fd56e --- /dev/null +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig @@ -0,0 +1,53 @@ +{% if form.civility is defined %} + {{ form_row(form.civility) }} +{% endif %} + + {{ form_row(form.name) }} + + {% if form.nameCompany is defined %} + {{ form_row(form.nameCompany) }} + {{ form_row(form.acronym) }} + {% endif %} + + {% if form.profession is defined %} + {{ form_row(form.profession) }} + {% endif %} + + {{ form_row(form.types) }} + {{ form_row(form.categories) }} + + {{ form_row(form.telephone) }} + {{ form_row(form.email) }} + +
    + {{ form_label(form.address) }} + {{ form_widget(form.address) }} +
    + {% if thirdParty.address %} + {# include vue_address component #} + {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { + targetEntity: { name: 'thirdparty', id: thirdParty.id }, + mode: 'edit', + addressId: thirdParty.address.id, + buttonSize: 'btn-sm', + } %} + {# + backUrl: path('chill_3party_3party_new'), + #} + {% else %} + {# include vue_address component #} + {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { + targetEntity: { name: 'thirdparty', id: thirdParty.id }, + mode: 'new', + buttonSize: 'btn-sm', + buttonText: 'Create a new address', + modalTitle: 'Create a new address', + } %} + {% endif %} +
    +
    + +{{ form_row(form.comment) }} + {{ form_row(form.centers) }} + + {{ form_row(form.active) }} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig index a7ddb0f3c..e59cdb451 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig @@ -77,12 +77,12 @@
      {% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %}
    • - +
    • {% endif %} {% if is_granted('CHILL_3PARTY_3PARTY_SHOW', tp) %}
    • - +
    • {% endif %}
    diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig index 319083649..fe326cc0d 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig @@ -1,87 +1,20 @@ {% extends "@ChillMain/layout.html.twig" %} +{% set thirdParty = entity %} + {% block title 'Create third party'|trans %} {% block content %}
    -
    - -

    {{ 'Create third party'|trans }}

    - - {{ form_start(form) }} - - {% if form.civility is defined %} - {{ form_row(form.civility) }} - {% endif %} - - {{ form_row(form.name) }} - - {% if form.nameCompany is defined %} - {{ form_row(form.nameCompany) }} - {{ form_row(form.acronym) }} - {% endif %} - - {% if form.profession is defined %} - {{ form_row(form.profession) }} - {% endif %} - - {{ form_row(form.types) }} - {{ form_row(form.categories) }} - - {{ form_row(form.telephone) }} - {{ form_row(form.email) }} - -
    - {{ form_label(form.address) }} - {{ form_widget(form.address) }} -
    - {% if thirdParty.address %} - {# include vue_address component #} - {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { - targetEntity: { name: 'thirdparty', id: thirdParty.id }, - mode: 'edit', - addressId: thirdParty.address.id, - buttonSize: 'btn-sm', - } %} - {# - backUrl: path('chill_3party_3party_new'), - #} - {% else %} - {# include vue_address component #} - {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { - targetEntity: { name: 'thirdparty', id: thirdParty.id }, - mode: 'new', - buttonSize: 'btn-sm', - buttonText: 'Create a new address', - modalTitle: 'Create a new address', - } %} - {% endif %} -
    -
    - - {{ form_row(form.comment) }} - {{ form_row(form.centers) }} - - {{ form_row(form.active) }} - - - - {{ form_end(form) }} - -
    + {% embed '@ChillMain/CRUD/_new_content.html.twig' %} + {% block crud_content_header %} +

    {{ 'Create third party'|trans }}

    + {% endblock %} + {% block crud_content_form_rows %} + {% include '@ChillThirdParty/ThirdParty/_form.html.twig' %} + {% endblock %} + {% endembed %}
    {% endblock %} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig deleted file mode 100644 index a8dc587d7..000000000 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig +++ /dev/null @@ -1,122 +0,0 @@ -{% extends "@ChillMain/layout.html.twig" %} - -{% set title_ = 'Show third party %name%'|trans({'%name%' : thirdParty.name }) %} - -{% block title title_ %} - -{% block content %} -
    -
    -
    - -

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

    - - -
    - -
    {{ 'Name'|trans }}
    -
    - {% if thirdParty.isLeaf == true %}{{ thirdParty.civility }}{% endif %} - {{ thirdParty.name }} -
    - - {% if thirdParty.isLeaf == false %} -
    {{ 'thirdparty.NameCompany'|trans }}
    -
    - {% if thirdParty.nameCompany == null %} - {{ 'No nameCompany given'|trans }} - {% else %} - {{ thirdParty.nameCompany }} - {% endif %} -
    - -
    {{ 'thirdparty.Acronym'|trans }}
    -
    - {% if thirdParty.acronym == null %} - {{ 'No acronym given'|trans }} - {% else %} - {{ thirdParty.acronym }} - {% endif %} -
    - {% endif %} - -
    {{ 'Type'|trans }}
    - {% set types = [] %} - {% for t in thirdParty.types %} - {% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %} - {% endfor %} -
    - {{ types|join(', ') }} -
    - -
    {{ 'Phonenumber'|trans }}
    -
    - {% if thirdParty.telephone == null %} - {{ 'No phone given'|trans }} - {% else %} - - {{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }} - - {% endif %} -
    - -
    {{ 'email'|trans }}
    -
    - {% if thirdParty.email == null %} - {{ 'No email given'|trans }} - {% else %} - - {{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }} - - {% endif %} -
    - -
    {{ 'Address'|trans }}
    -
    - {% if thirdParty.address == null %} - {{ 'No address given'|trans }} - {% else %} - {{ thirdParty.address|chill_entity_render_box({'with_valid_from': false, 'extended_infos': true }) }} - {% endif %} -
    - -
    {{ 'Comment'|trans }}
    -
    - {% if thirdParty.comment is not empty %} -
    - {{ thirdParty.comment|chill_markdown_to_html }} -
    - {% endif %} -
    - -
    {{ 'Centers'|trans }}
    -
    {{ 'The party is visible in those centers'|trans }} : {{ thirdParty.centers|join(', ') }}
    - -
    - - - -
    -
    -
    -{% endblock %} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig index 4433d934b..605d91c73 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig @@ -1,30 +1,47 @@ {% extends "@ChillMain/layout.html.twig" %} +{% set thirdParty = entity %} + {% block title 'Update third party %name%'|trans({ '%name%': thirdParty.name }) %} {% block content %} +
    +
    + {% embed '@ChillMain/CRUD/_edit_content.html.twig' %} + {% block crud_content_header %} +

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

    + {% endblock %} + {% block crud_content_form_rows %} +
    + {% if thirdParty.updatedAt != null %} + {{ 'thirdparty.UpdatedAt.short'|trans ~ thirdParty.updatedAt|format_date('short') }} + {% else %} + {{ 'thirdparty.CreatedAt.short'|trans ~ thirdParty.createdAt|format_date('short') }} + {% endif %} + {% if thirdParty.updatedBy != null %} + {{ 'thirdparty.UpdateBy.short'|trans ~ thirdParty.updatedBy.usernameCanonical }} + {% endif %} +
    + {% include '@ChillThirdParty/ThirdParty/_form.html.twig' %} + {% endblock %} + {% endembed %} +
    +
    +{% endblock %} + + +{% block content_not %}
    -

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

    -
    - {% if thirdParty.updatedAt != null %} - {{ 'thirdparty.UpdatedAt.short'|trans ~ thirdParty.updatedAt|format_date('short') }} - {% else %} - {{ 'thirdparty.CreatedAt.short'|trans ~ thirdParty.createdAt|format_date('short') }} - {% endif %} - {% if thirdParty.updatedBy != null %} - {{ 'thirdparty.UpdateBy.short'|trans ~ thirdParty.updatedBy.usernameCanonical }} - {% endif %} -
    {{ form_start(form) }} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/view.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/view.html.twig new file mode 100644 index 000000000..5209a5f30 --- /dev/null +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/view.html.twig @@ -0,0 +1,110 @@ +{% extends "@ChillMain/layout.html.twig" %} + +{% set thirdParty = entity %} +{% set title_ = 'Show third party %name%'|trans({'%name%' : thirdParty.name }) %} + +{% block title title_ %} + +{% block content %} +
    +
    + {% embed '@ChillMain/CRUD/_view_content.html.twig' %} + {% block crud_content_header %} +

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

    + {% endblock %} + + {% block crud_content_view_details %} +
    + +
    {{ 'Name'|trans }}
    +
    + {% if thirdParty.isLeaf == true %}{{ thirdParty.civility }}{% endif %} + {{ thirdParty.name }} +
    + + {% if thirdParty.isLeaf == false %} +
    {{ 'thirdparty.NameCompany'|trans }}
    +
    + {% if thirdParty.nameCompany == null %} + {{ 'No nameCompany given'|trans }} + {% else %} + {{ thirdParty.nameCompany }} + {% endif %} +
    + +
    {{ 'thirdparty.Acronym'|trans }}
    +
    + {% if thirdParty.acronym == null %} + {{ 'No acronym given'|trans }} + {% else %} + {{ thirdParty.acronym }} + {% endif %} +
    + {% endif %} + +
    {{ 'Type'|trans }}
    + {% set types = [] %} + {% for t in thirdParty.types %} + {% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %} + {% endfor %} +
    + {{ types|join(', ') }} +
    + +
    {{ 'Phonenumber'|trans }}
    +
    + {% if thirdParty.telephone == null %} + {{ 'No phone given'|trans }} + {% else %} + + {{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }} + + {% endif %} +
    + +
    {{ 'email'|trans }}
    +
    + {% if thirdParty.email == null %} + {{ 'No email given'|trans }} + {% else %} + + {{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }} + + {% endif %} +
    + +
    {{ 'Address'|trans }}
    +
    + {% if thirdParty.address == null %} + {{ 'No address given'|trans }} + {% else %} + {{ thirdParty.address|chill_entity_render_box({'with_valid_from': false, 'extended_infos': true }) }} + {% endif %} +
    + +
    {{ 'Comment'|trans }}
    +
    + {% if thirdParty.comment is not empty %} +
    + {{ thirdParty.comment|chill_markdown_to_html }} +
    + {% endif %} +
    + +
    {{ 'Centers'|trans }}
    +
    {{ 'The party is visible in those centers'|trans }} : {{ thirdParty.centers|join(', ') }}
    + +
    + {% endblock %} + {% block content_form_actions_delete %}{% endblock %} + {% block content_view_actions_duplicate_link %}{% endblock %} + {% endembed %} +
    +
    +{% endblock %}