92 lines
4.0 KiB
Twig

{% extends "@ChillPerson/Person/layout.html.twig" %}
{% set activeRouteKey = 'chill_person_resource_list' %}
{% block title %}{{ 'Person resources'|trans|capitalize ~ ' ' ~ person|chill_entity_render_string }}{% endblock %}
{% block js %}
{{ encore_entry_script_tags('page_person_resource_showhide_input') }}
{{ encore_entry_script_tags('mod_pickentity_type') }}
{% endblock %}
{% block css %}
{{ encore_entry_link_tags('page_person_resource_showhide_input') }}
{{ encore_entry_link_tags('mod_pickentity_type') }}
{% endblock %}
{% block personcontent %}
<h1>{{ 'List of resources'|trans }}</h1>
{% if personResources|length > 0 %}
<div class="flex-table">
{% for resource in personResources %}
<div class="item-bloc">
<div class="item-row">
<div class="item-col">
{% if resource.person is not null %}
<div class="denomination h3">
<span class="name">{{ resource.person }}</span>
<span class="badge rounded-pill bg-person">{{ 'person'|trans|capitalize }}</span>
</div>
{% elseif resource.thirdparty is not null %}
<div class="denomination h3">
<span class="name">{{ resource.thirdparty }}</span>
<span class="badge rounded-pill bg-thirdparty">
{{ 'thirdparty'|trans|capitalize }}
<i class="fa fa-fw fa-user-md"></i>
</span>
</div>
{% else %}
<div class="denomination h3">
<span>{{ resource.freetext }}</span>
</div>
{% endif %}
</div>
<div class="item-col">
{% 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">
<section class="chill-entity entity-comment-embeddable">
<div>{{ resource.comment|chill_entity_render_box }}<div>
</section>
</div>
{% endif %}
{% if is_granted('CHILL_PERSON_UPDATE', resource.person) %}
<div class="item-row separator">
<div class="item-col">
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_person_resource_edit', {'resource_id': resource.id,
'person_id': person.id,}) }}"
class="btn btn-sm btn-edit"
title="{{ 'Edit'|trans }}"></a>
</li>
<li>
<a href="{{ chill_path_add_return_path('chill_person_resource_delete', {'person_id': person.id,
'resource_id': resource.id}) }}"
class="btn btn-sm btn-delete"
title="{{ 'Delete'|trans }}"></a>
</li>
</ul>
</div>
</div>
{% endif %}
</div>
{% endfor %}
</div>
{% else %}
<p class="chill-no-data-statement">{{ 'There are no available resources'|trans }}</p>
{% endif %}
<h1 style="margin-bottom: 2rem;">{{ 'Add a person resource'|trans }}</h1>
{% include "@ChillPerson/PersonResource/create.html.twig" %}
{% endblock %}