diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index 2bf83bbac..f2dd0301e 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -634,7 +634,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface public function addChild(ThirdParty $child): self { $this->children[] = $child; - $child->setParent($this); + $child->setParent($this)->setKind(ThirdParty::KIND_CHILD);; return $this; } diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig index 9d0269d3d..e49dd6a5c 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig @@ -81,6 +81,13 @@
{{ _self.label(thirdparty, options) }} + {% if thirdparty.kind == 'company' %} + {{ 'thirdparty.company'|trans }} + {% elseif thirdparty.kind == 'child' %} + {{ 'thirdparty.Child'|trans }} + {% elseif thirdparty.kind == 'contact' %} + {{ 'thirdparty.contact'|trans }} + {% endif %}
+ {% if options['showContacts'] and thirdparty.activeChildren|length > 0 %} +
+ {{ 'thirdparty.Children'|trans }} : + {% for c in thirdparty.activeChildren %} + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + targetEntity: { name: 'thirdparty', id: c.id }, + action: 'show', + displayBadge: true, + buttonText: c|chill_entity_render_string + } %} + {% endfor %} +
+ {% endif %} {%- endif -%} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig index 046e4db0f..ef347eb6d 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig @@ -20,7 +20,9 @@ {{ form_row(form.telephone) }} {{ form_row(form.email) }} +{% if form.contactDataAnonymous is defined %} {{ form_row(form.contactDataAnonymous) }} +{% endif %} {% if form.activeChildren is defined %}

{{ 'Contacts'|trans }}

diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig index a3d20f04f..bada91f4c 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig @@ -22,7 +22,7 @@
{% for tp in third_parties %}
- {{ tp|chill_entity_render_box({'render': 'bloc', 'addLink': false}) }} + {{ tp|chill_entity_render_box({'render': 'bloc', 'addLink': false, 'showContacts': true }) }}
    {% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %} diff --git a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php index 80450f7bb..bbc3fd7dc 100644 --- a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php +++ b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php @@ -55,6 +55,7 @@ class ThirdPartyRender extends AbstractChillEntityRender 'hLevel' => $options['hLevel'] ?? 3, 'customButtons' => $options['customButtons'] ?? [], 'customArea' => $options['customArea'] ?? [], + 'showContacts' => $options['showContacts'] ?? [], ]; return diff --git a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml index 938117cc1..744c49682 100644 --- a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml @@ -30,7 +30,9 @@ thirdparty.CreatedAt.long: Date de création thirdparty.UpdatedAt.long: Date de la dernière modification thirdparty.UpdateBy.long: Utilisateur qui a effectué la dernière modification thirdparty.A company: Une institution +thirdparty.company: Institution thirdparty.A contact: Une personne physique +thirdparty.contact: Personne physique thirdparty.a_company_explanation: >- Les institutions peuvent compter un ou plusieurs contacts, interne à l'instution. Il est également possible de leur associer un acronyme, et le nom d'un service.