161 lines
7.7 KiB
Twig

{% extends "@ChillMain/layout.html.twig" %}
{% set thirdParty = entity %}
{% set name = thirdParty.firstname is not empty ? thirdParty.firstname ~ ' ' ~ thirdParty.name : thirdParty.name %}
{% set title_ = 'Show third party %name%'|trans({'%name%' : name }) %}
{% block title title_ %}
{% block content %}
<div class="thirdparty-show my-5">
<div class="row justify-content-center">
{% embed '@ChillMain/CRUD/_view_content.html.twig' %}
{% block crud_content_header %}
<h1>
{{ title_ }}
<span class="badge bg-{{ thirdParty.active ? 'success' : 'danger' }} float-end"
title="{{ (thirdParty.active ? 'shown to users' : 'not shown to users')|trans }}">
{{ (thirdParty.active ? 'Active' : 'Inactive')|trans }}
</span>
</h1>
{% endblock %}
{% block crud_content_view_details %}
<dl class="chill_view_data">
<dt>{{ 'Name'|trans }}</dt>
<dd>
{% if thirdParty.isLeaf == true and thirdParty.civility is not same as null %}{{ thirdParty.civility.name|localize_translatable_string }}{% endif %}
{{ thirdParty.firstname ~ ' ' ~ thirdParty.name }}
</dd>
{% if thirdParty.kind == 'company' %}
<dt>{{ 'thirdparty.NameCompany'|trans }}</dt>
<dd>
{% if thirdParty.nameCompany == null %}
<span class="chill-no-data-statement">{{ 'No nameCompany given'|trans }}</span>
{% else %}
{{ thirdParty.nameCompany }}
{% endif %}
</dd>
<dt>{{ 'thirdparty.Acronym'|trans }}</dt>
<dd>
{% if thirdParty.acronym == null %}
<span class="chill-no-data-statement">{{ 'No acronym given'|trans }}</span>
{% else %}
{{ thirdParty.acronym }}
{% endif %}
</dd>
{% endif %}
<dt>{{ 'thirdparty.Categories'|trans }}</dt>
{% set types = [] %}
{% for t in thirdParty.thirdPartyTypes %}
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
{% endfor %}
{% for c in thirdParty.categories %}
{% set types = types|merge([ c.name|localize_translatable_string ]) %}
{% endfor %}
<dd>
{% if types|length > 0 %}
{{ types|join(', ') }}
{% else %}
<p class="chill-no-data-statement">{{ 'thirdparty.no_categories'|trans }}</p>
{% endif %}
</dd>
<dt>{{ 'Phonenumber'|trans }}</dt>
<dd>
{% if thirdParty.telephone == null %}
<span class="chill-no-data-statement">{{ 'thirdparty.No_phonenumber'|trans }}</span>
{% else %}
<a href="{{ 'tel:' ~ thirdParty.telephone|phone_number_format('E164') }}">
{{ thirdParty.telephone|chill_format_phonenumber }}
</a>
{% endif %}
</dd>
<dt>{{ 'Phonenumber2'|trans }}</dt>
<dd>
{% if thirdParty.telephone2 == null %}
<span class="chill-no-data-statement">{{ 'thirdparty.No_phonenumber'|trans }}</span>
{% else %}
<a href="{{ 'tel:' ~ thirdParty.telephone2|phone_number_format('E164') }}">
{{ thirdParty.telephone2|chill_format_phonenumber }}
</a>
{% endif %}
</dd>
<dt>{{ 'email'|trans }}<dt>
<dd>
{% if thirdParty.email == null %}
<span class="chill-no-data-statement">{{ 'No email given'|trans }}</span>
{% else %}
<a href="{{ 'mailto:' ~ thirdParty.email }}">
{{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }}
</a>
{% endif %}
</dd>
<dt>{{ 'Address'|trans }}</dt>
<dd>
{% if thirdParty.address == null %}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{% else %}
{{ thirdParty.address|chill_entity_render_box({'with_valid_from': false, 'extended_infos': true }) }}
{% endif %}
</dd>
<dt>{{ 'Comment'|trans }}</dt>
<dd>
{% if thirdParty.comment is not empty %}
<blockquote class="chill-user-quote">
{{ thirdParty.comment|chill_markdown_to_html }}
</blockquote>
{% else %}
<span class="chill-no-data-statement">{{ 'Any comment'|trans }}</span>
{% endif %}
</dd>
{% if thirdParty.kind == 'company' %}
<dt>{{ 'Contacts'|trans }}</dt>
<dd>
{% if thirdParty.activeChildren|length == 0 %}
<p class="chill-no-data-statement">{{ 'No contacts associated'|trans }}</p>
{% else %}
<div class="flex-table">
{% for tp in thirdParty.activeChildren %}
<div class="item-bloc">
{{ tp|chill_entity_render_box({'render': 'bloc', 'addLink': false, 'isConfidential': tp.contactDataAnonymous ? true : false, 'showFusion': true }) }}
</div>
{% endfor %}
</div>
{% endif %}
</dd>
{% endif %}
{% if askCenter %}
<dt>{{ 'Centers'|trans }}</dt>
<dd>
{% set centers = thirdParty|chill_resolve_center %}
{% if centers is iterable %}
{{ 'The party is visible in those centers'|trans }}&nbsp;:
{{ centers|join(', ') }}
{% elseif centers is null %}
{{ 'The party is not visible in any center'|trans }}
{% else %}
{{ 'The party is visible in those centers'|trans }}&nbsp;: {{ centers }}
{% endif %}
</dd>
{% endif %}
</dl>
{% endblock %}
{% block content_form_actions_delete %}{% endblock %}
{% block content_view_actions_duplicate_link %}{% endblock %}
{% endembed %}
</div>
</div>
{% endblock %}