using renderbox and adjusting style + show button if person or thirdparty

This commit is contained in:
Julie Lenaerts 2022-02-11 17:02:31 +01:00
parent 753a007172
commit f9154233e4
3 changed files with 37 additions and 57 deletions

View File

@ -172,7 +172,7 @@
{%- if options['customButtons']['replace'] is defined -%}
{{ options['customButtons']['replace'] }}
{%- elseif is_granted('CHILL_PERSON_SEE', person) -%}
{%- elseif is_granted('CHILL_PERSON_SEE', person) and options['addLink'] -%}
<li>
<a class="btn btn-sm btn-show" title="{{ 'Show person'|trans }}"
href="{{ path('chill_person_view', { person_id: person.id }) }}"></a>

View File

@ -56,6 +56,11 @@
{% if action is defined %}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path('chill_person_resource_list', { 'person_id': resource.personOwner.id } ) }}" class="btn btn-cancel">
{{ 'Cancel'|trans }}
</a>
</li>
<li class="edit">
<button class="btn btn-edit"
type="submit" id="newPersonResource">

View File

@ -14,25 +14,6 @@
{{ encore_entry_link_tags('mod_pickentity_type') }}
{% endblock %}
{% macro rowCustomButtons(tp) %}
{% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %}
<li>
<a href="{{ chill_path_add_return_path('chill_crud_3party_3party_edit',
{ 'id': (tp.isParent ? tp.id : tp.parent.id) }) }}"
title="{{ 'Edit'|trans }}"
class="btn btn-sm btn-update"></a>
</li>
{% endif %}
{% if is_granted('CHILL_3PARTY_3PARTY_SHOW', tp) %}
<li>
<a href="{{ chill_path_add_return_path('chill_crud_3party_3party_view',
{ 'id': (tp.isParent ? tp.id : tp.parent.id) }) }}"
title="{{ 'Show'|trans }}"
class="btn btn-sm btn-show"></a>
</li>
{% endif %}
{% endmacro %}
{% block personcontent %}
<h1>{{ 'List of resources'|trans }}</h1>
@ -41,50 +22,33 @@
<div class="flex-table">
{% for resource in personResources %}
<div class="item-bloc">
<div class="item-row">
<div class="item-col" style="width: 50%">
{% if resource.kind is not null %}
<div class="item-row">
<section>
<p>{{ resource.kind.title.fr|capitalize }}</p>
</section>
</div>
{% endif %}
<div class="{% if resource.kind is not null %} separator {% endif %}">
{% if resource.person is not null %}
<div>
{{ resource.person|chill_entity_render_box() }}
{# <span>
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
action: 'show', displayBadge: true,
targetEntity: { name: 'person', id: resource.person.id },
buttonText: resource.person|chill_entity_render_string,
isDead: resource.person.deathdate is not null
} %}
</span> #}
</div>
{{ resource.person|chill_entity_render_box({
'render': 'bloc',
'addLink': false,
'addInfo': true,
'addAge': true
}) }}
{% elseif resource.thirdparty is not null %}
<div>
{{ resource.thirdparty|chill_entity_render_box({
'render': 'bloc',
'showContacts': false,
'addLink': false,
'isConfidential': (resource.thirdparty.contactDataAnonymous ? true : false)
}) }}
</div>
{# <div class="denomination">
<span>
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
action: 'show', displayBadge: true,
targetEntity: { name: 'thirdparty', id: resource.thirdparty.id },
buttonText: resource.thirdParty|chill_entity_render_string,
parent: resource.thirdparty.parent
} %}
</span>
</div> #}
{{ resource.thirdparty|chill_entity_render_box({
'render': 'bloc',
'showContacts': false,
'addLink': false,
'isConfidential': (resource.thirdparty.contactDataAnonymous ? true : false)
}) }}
{% else %}
<div class="denomination h3">
<span>{{ resource.freetext }}</span>
</div>
{% endif %}
</div>
<div class="item-col" style="justify-content: flex-end; ">
{% if resource.kind %}
<span>{{ resource.kind.title.fr|capitalize }}</span>
{% endif %}
</div>
</div>
{% if resource.comment.comment is not empty %}
<div class="item-row separator">
@ -97,6 +61,17 @@
<div class="item-row separator">
<div class="item-col">
<ul class="record_actions">
{% if resource.person is not null and is_granted('CHILL_PERSON_SEE', resource.person) %}
<li>
<a class="btn btn-sm btn-show" title="{{ 'Show person'|trans }}"
href="{{ path('chill_person_view', { person_id: resource.person.id }) }}"></a>
</li>
{% elseif resource.thirdparty is not null and is_granted('CHILL_3PARTY_3PARTY_SHOW', resource.thirdparty) %}
<li>
<a class="btn btn-sm btn-show" target="_blank" title="{{ 'Show thirdparty'|trans }}"
href="{{ path('chill_crud_3party_3party_view', { id: resource.thirdparty.isChild ? resource.thirdparty.parent.id : resource.thirdparty.id }) }}"></a>
</li>
{% endif %}
<li>
<a href="{{ chill_path_add_return_path('chill_person_resource_edit', {'resource_id': resource.id,
'person_id': person.id,}) }}"