{#
 * Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
 * 
 * This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillPerson/Person/layout.html.twig"  %}

{% set activeRouteKey = 'report_select_type' %}

{% block title %}{{ 'Report view' |trans() }}{% endblock title %}

{% block content %}
    
    <h1>{{ 'Report view : %name%' | trans({ '%name%' : entity.cFGroup.getName|localize_translatable_string } ) }}</h1>

    <h2 class="chill-red">{{ 'Details'|trans }}</h2>

    <dl>
        <dt>{{ 'Person'|trans }}&nbsp;:</dt>
        <dd>{{ entity.person }}</dd>
        <dt>{{ 'Circle'|trans }}&nbsp;:</dt>
        <dd><span class="scope circle">{{ entity.scope.name|localize_translatable_string }}</span></dd>
        <dt>{{ 'Date'|trans }}&nbsp;:</dt>
        <dd>{{ entity.date|format_date('long') }}</dd>
        <dt>{{ 'User'|trans }}&nbsp;:</dt>
        <dd>{{ entity.user }}</dd>
        
    </dl>
    
    <h2 class="chill-red">{{ 'Report data'|trans }}</h2>
    
    <dl class="chill_report_view_data">
    {{ chill_custom_fields_group_widget(entity.cFData, entity.cFGroup) }}
    </dl>
    
    <ul class="record_actions">
        <li class="cancel">
            <a href="{{ path('report_list', { 'person_id': person.id } ) }}" class="btn btn-cancel">{{ 'Back to the list'|trans }}</a>
        <li>
        {% if is_granted('CHILL_REPORT_UPDATE', entity) %}
        <li>
        <a class="btn btn-edit" href="{{ path('report_edit', { 'person_id': entity.person.id, 'report_id': entity.id }) }}">{{ 'Update the report' | trans }}</a>
        </li>
        {% endif %}
    </ul>
{% endblock %}
