mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
216 lines
9.1 KiB
Twig
216 lines
9.1 KiB
Twig
{#
|
|
Template to render a thirdparty
|
|
OPTIONS
|
|
* render string ['raw'|'label'|'bloc']
|
|
* with_valid_from bool
|
|
* addLink bool
|
|
* addEntity bool
|
|
* addId bool
|
|
* addInfo bool
|
|
* isConfidential bool
|
|
* hLevel integer
|
|
* customButtons [
|
|
'before' Twig\Markup, (injected with macro)
|
|
'replace' Twig\Markup,
|
|
'after' Twig\Markup
|
|
]
|
|
* customArea [
|
|
'beforeLabel' Twig\Markup,
|
|
'afterLabel' Twig\Markup,
|
|
]
|
|
#}
|
|
|
|
{% macro raw(thirdparty, options) %}
|
|
<span class="name">{{ thirdparty|chill_entity_render_string }}</span>
|
|
{% endmacro raw %}
|
|
|
|
{% macro label(thirdparty, options) %}
|
|
<div class="entity-label">
|
|
|
|
<div class="denomination {{ 'h' ~ options['hLevel'] }}">
|
|
|
|
{%- if options['addLink'] and is_granted('CHILL_3PARTY_3PARTY_SHOW', thirdparty) -%}
|
|
<a href="{{ chill_path_add_return_path('chill_crud_3party_3party_view', { 'id': thirdparty.isChild ? thirdparty.parent.id : thirdparty.id }) }}">
|
|
{%- endif -%}
|
|
|
|
{% if options['customArea']['beforeLabel'] is defined %}
|
|
{{ options['customArea']['beforeLabel'] }}
|
|
{% endif %}
|
|
|
|
{{ _self.raw(thirdparty, options) }}
|
|
|
|
{% if options['customArea']['afterLabel'] is defined %}
|
|
{{ options['customArea']['afterLabel'] }}
|
|
{% endif %}
|
|
|
|
{%- if options['addLink'] and is_granted('CHILL_3PARTY_3PARTY_SHOW', thirdparty) -%}
|
|
</a>
|
|
{%- endif -%}
|
|
|
|
{%- if options['addEntity'] -%}
|
|
<span class="badge rounded-pill bg-secondary">{{ 'Third party'|trans }}</span>
|
|
{%- endif -%}
|
|
{%- if options['addId'] -%}
|
|
<span class="id-number" title="{{ 'Third party'|trans ~ ' n° ' ~ thirdparty.id }}">
|
|
{{ thirdparty.id|upper }}
|
|
</span>
|
|
{%- endif -%}
|
|
</div>
|
|
{%- if options['addInfo'] -%}
|
|
<p class="moreinfo">{#
|
|
<span class="company">{{ thirdparty.nameCompany }}</span>
|
|
<span class="acronym">{{ thirdparty.acronym }}</span>
|
|
#} plus d'infos
|
|
</p>
|
|
{%- endif -%}
|
|
|
|
{#- tricks to remove easily whitespace after template -#}
|
|
{%- if true -%}</div>{%- endif -%}
|
|
{% endmacro label %}
|
|
|
|
{%- if render == 'raw' -%}
|
|
<span class="entity-raw">
|
|
{{ _self.raw(thirdparty, options) }}
|
|
</span>
|
|
{%- endif -%}
|
|
|
|
{%- if render == 'label' -%}
|
|
{{ _self.label(thirdparty, options) }}
|
|
{%- endif -%}
|
|
|
|
{%- if render == 'bloc' -%}
|
|
<div class="item-row entity-bloc">
|
|
<div class="item-col">
|
|
{{ _self.label(thirdparty, options) }}
|
|
{% if thirdparty.kind == 'child' %}
|
|
<span class="badge rounded-pill bg-thirdparty">
|
|
<i class="fa fa-fw fa-user"></i>{{ 'thirdparty.child'|trans }}
|
|
</span>
|
|
{% elseif thirdparty.kind == 'company' %}
|
|
<span class="badge rounded-pill bg-thirdparty">
|
|
<i class="fa fa-fw fa-hospital-o"></i>{{ 'thirdparty.company'|trans }}
|
|
</span>
|
|
{% else %}
|
|
<span class="badge rounded-pill bg-thirdparty">
|
|
<i class="fa fa-fw fa-user-md"></i>{{ 'thirdparty.contact'|trans }}
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
<div class="item-col">
|
|
{% if options['isConfidential'] %}
|
|
<div class="confidential">
|
|
<div class="confidential-content">
|
|
<ul class="list-content fa-ul">
|
|
<li>
|
|
{{ thirdparty.getAddress|chill_entity_render_box({
|
|
'render': 'list',
|
|
'with_picto': true,
|
|
'multiline': false,
|
|
'with_valid_from': false
|
|
}) }}
|
|
</li>
|
|
<li><i class="fa fa-li fa-phone"></i>
|
|
{% if thirdparty.telephone is not null %}
|
|
<a href="{{ 'tel:' ~ thirdparty.telephone|phone_number_format('E164') }}">{{ thirdparty.telephone|chill_format_phonenumber }}</a>
|
|
{% else %}
|
|
<span class="chill-no-data-statement">{{ 'thirdparty.No_phonenumber'|trans }}</span>
|
|
{% endif %}
|
|
{% if thirdparty.telephone2 is not null %}
|
|
{% if thirdparty.telephone is not null %}, {% endif %}
|
|
<a href="{{ 'tel:' ~ thirdparty.telephone2|phone_number_format('E164') }}">{{ thirdparty.telephone2|chill_format_phonenumber }}</a>
|
|
{% endif %}
|
|
</li>
|
|
<li><i class="fa fa-li fa-envelope-o"></i>
|
|
<a href="{{ 'mailto:' ~ thirdparty.email }}">
|
|
{{ thirdparty.email|chill_print_or_message("thirdparty.No_email") }}
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
<ul class="list-content fa-ul">
|
|
<li>
|
|
{{ thirdparty.getAddress|chill_entity_render_box({
|
|
'render': 'list',
|
|
'with_picto': true,
|
|
'multiline': false,
|
|
'with_valid_from': false
|
|
}) }}
|
|
</li>
|
|
<li><i class="fa fa-li fa-phone"></i>
|
|
{% if thirdparty.telephone or thirdparty.telephone2 %}
|
|
{% if thirdparty.telephone is not null %}
|
|
<a href="{{ 'tel:' ~ thirdparty.telephone|phone_number_format('E164') }}">{{ thirdparty.telephone|chill_format_phonenumber }}</a>
|
|
{% endif %}
|
|
{% if thirdparty.telephone2 is not null %}
|
|
{% if thirdparty.telephone is not null %}, {% endif %}
|
|
<a href="{{ 'tel:' ~ thirdparty.telephone2|phone_number_format('E164') }}">{{ thirdparty.telephone2|chill_format_phonenumber }}</a>
|
|
{% endif %}
|
|
{% else %}
|
|
<span class="chill-no-data-statement">{{ 'thirdparty.No_phonenumber'|trans }}</span>
|
|
{% endif %}
|
|
</li>
|
|
<li><i class="fa fa-li fa-envelope-o"></i>
|
|
<a href="{{ 'mailto:' ~ thirdparty.email }}">
|
|
{{ thirdparty.email|chill_print_or_message("thirdparty.No_email") }}
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
{%- endif -%}
|
|
|
|
<ul class="record_actions">
|
|
{% if options['customButtons']['before'] is defined %}
|
|
{{ options['customButtons']['before'] }}
|
|
{% endif %}
|
|
|
|
{% if options['customButtons']['replace'] is defined %}
|
|
{{ options['customButtons']['replace'] }}
|
|
{% elseif is_granted('CHILL_3PARTY_3PARTY_SHOW', thirdparty) and options['addLink'] %}
|
|
<li>
|
|
<a class="btn btn-sm btn-show" target="_blank" title="{{ 'Show thirdparty'|trans }}"
|
|
href="{{ path('chill_crud_3party_3party_view', { id: thirdparty.isChild ? thirdparty.parent.id : thirdparty.id }) }}"></a>
|
|
</li>
|
|
{% else %}
|
|
{% endif %}
|
|
|
|
{% if options['customButtons']['after'] is defined %}
|
|
{{ options['customButtons']['after'] }}
|
|
{% endif %}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
{% if options['showContacts'] and thirdparty.activeChildren|length > 0 %}
|
|
<div class="item-row">
|
|
<div class="item-col"></div>
|
|
<div class="item-col wrap">
|
|
<h5 class="me-2">{{ 'thirdparty.Children'|trans ~ ': ' }}</h5>
|
|
{% 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>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if options['showParent'] and thirdparty.isChild %}
|
|
<div class="item-row">
|
|
<div class="item-col"></div>
|
|
<div class="item-col">
|
|
<h5 class="me-2">{{ 'thirdparty.Contact of'|trans ~ ': ' }}</h5>
|
|
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
|
|
targetEntity: { name: 'thirdparty', id: thirdparty.parent.id },
|
|
action: 'show',
|
|
displayBadge: true,
|
|
buttonText: thirdparty.parent|chill_entity_render_string
|
|
} %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{%- endif -%}
|