Merge branch 'master' into 110_extend_thirdparty

This commit is contained in:
2021-07-30 22:56:41 +02:00
111 changed files with 3019 additions and 1974 deletions

View File

@@ -0,0 +1,108 @@
{#
Template to render a thirdparty
OPTIONS
* render string ['raw'|'label'|'bloc']
* with_valid_from bool
* addLink bool
* addEntity bool
* addId bool
* addInfo bool
* hLevel integer
* customButtons [
'before' Twig\Markup, (injected with macro)
'replace' Twig\Markup,
'after' Twig\Markup
]
#}
{% macro raw(thirdparty, options) %}
<span class="name">{{ thirdparty.name }}</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_3party_3party_show', { 'thirdparty_id': thirdparty.id }) }}">
{{ _self.raw(thirdparty, options) }}
</a>
{%- else -%}
{{ _self.raw(thirdparty, options) }}
{%- 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' -%}
{{ _self.raw(thirdparty, options) }}
{%- 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) }}
</div>
<div class="item-col">
<ul class="list-content fa-ul">
{{ thirdparty.getAddress|chill_entity_render_box({
'render': 'list',
'with_picto': true,
'multiline': false,
'with_valid_from': false
}) }}
<li><i class="fa fa-li fa-phone"></i>
{% if thirdparty.telephone %}
<a href="{{ 'tel:' ~ thirdparty.telephone }}">{{ thirdparty.telephone|chill_format_phonenumber }}</a>
{% 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>
<ul class="record_actions">
{% if options['customButtons']['before'] is defined %}
{{ options['customButtons']['before'] }}
{% endif %}
{%- if options['customButtons']['replace'] is not defined and is_granted('CHILL_3PARTY_3PARTY_SHOW', thirdparty) -%}
<li>
<a class="btn btn-show" target="_blank" title="{{ 'Show thirdparty'|trans }}"
href="{{ path('chill_3party_3party_show', { thirdparty_id: thirdparty.id }) }}"></a>
</li>
{%- else -%}
{{ options['customButtons']['replace'] }}
{%- endif -%}
{% if options['customButtons']['after'] is defined %}
{{ options['customButtons']['after'] }}
{% endif %}
</ul>
</div>
</div>
{%- endif -%}

View File

@@ -1,52 +0,0 @@
{# template to render a person #}
{%- if options['only_denomination'] == true -%}
<div class="chill_denomination">
{{ contact.name }}
</div>
{%- else -%}
<div class="chill_contact">
<div class="chill_contact_name">
{{ contact.name }}
</div>
<div class="chill_contact_category">
{% for type in contact.type %}
<span class="category">
{{ ('chill_3party.key_label.'~type)|trans }}
</span>
{% endfor %}
</div>
{% if contact.comment is not empty %}
<div class="chill_contact_comment">
{{ contact.comment }}
</div>
{% endif %}
{% if contact.address %}
<div class="chill_address">
<div class="chill_address_address">
{% if contact.address.streetAddress1 %}<p class="street street1">{{ contact.address.streetAddress1 }}</p>{% endif %}
{% if contact.address.streetAddress2 is not empty %}<p class="street street2">{{ contact.address.streetAddress2 }}</p>{% endif %}
{% if contact.address.postCode is not empty %}
<p class="postalCode"><span class="code">{{ contact.address.postCode.code }}</span> <span class="name">{{ contact.address.postCode.name }}</span></p>
<p class="country">{{ contact.address.postCode.country.name|localize_translatable_string }}</p>
{% endif %}
</div>
{%- if options['with_valid_from'] == true -%}
<span class="address_since">{{ 'Since %date%'|trans( { '%date%' : contact.address.validFrom|format_date('long') } ) }}</span>
{%- endif -%}
</div>
{% endif %}
{% if contact.email or contact.telephone is not empty %}
<div class="chill_contact_contact">
<span class="email">
<a href="mailto:{{ contact.email }}">{{ contact.email }}</a>
</span>
<span class="telephone">
<a href="tel:{{ contact.telephone }}">{{ contact.telephone|chill_format_phonenumber }}</a>
</span>
</div>
{% endif %}
</div>
{%- endif -%}

View File

@@ -1,7 +1,5 @@
{% extends "@ChillMain/layout.html.twig" %}
{% import '@ChillMain/Address/macro.html.twig' as address %}
{% set title_ = 'Show third party %name%'|trans({'%name%' : thirdParty.name }) %}
{% block title title_ %}
@@ -19,6 +17,7 @@
</span>
</h1>
<dl class="chill_view_data">
<dt>{{ 'Name'|trans }}</dt>