work on render box and list

This commit is contained in:
Julien Fastré 2021-10-08 18:28:02 +02:00
parent 72e9346b6b
commit e465170c7b
6 changed files with 27 additions and 2 deletions

View File

@ -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;
}

View File

@ -81,6 +81,13 @@
<div class="item-row entity-bloc">
<div class="item-col">
{{ _self.label(thirdparty, options) }}
{% if thirdparty.kind == 'company' %}
<span class="badge bg-info">{{ 'thirdparty.company'|trans }}</span>
{% elseif thirdparty.kind == 'child' %}
<span class="badge bg-chill-red">{{ 'thirdparty.Child'|trans }}</span>
{% elseif thirdparty.kind == 'contact' %}
<span class="badge bg-secondary">{{ 'thirdparty.contact'|trans }}</span>
{% endif %}
</div>
<div class="item-col">
<ul class="list-content fa-ul">
@ -124,4 +131,17 @@
</ul>
</div>
</div>
{% if options['showContacts'] and thirdparty.activeChildren|length > 0 %}
<div class="item-row">
{{ 'thirdparty.Children'|trans }}&nbsp;:
{% 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 %}
</div>
{% endif %}
{%- endif -%}

View File

@ -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 %}
<h2>{{ 'Contacts'|trans }}</h2>

View File

@ -22,7 +22,7 @@
<div class="flex-table">
{% for tp in third_parties %}
<div class="item-bloc">
{{ tp|chill_entity_render_box({'render': 'bloc', 'addLink': false}) }}
{{ tp|chill_entity_render_box({'render': 'bloc', 'addLink': false, 'showContacts': true }) }}
<div class="item-row separator">
<ul class="record_actions">
{% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %}

View File

@ -55,6 +55,7 @@ class ThirdPartyRender extends AbstractChillEntityRender
'hLevel' => $options['hLevel'] ?? 3,
'customButtons' => $options['customButtons'] ?? [],
'customArea' => $options['customArea'] ?? [],
'showContacts' => $options['showContacts'] ?? [],
];
return

View File

@ -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.