{% extends "@ChillPerson/Person/layout.html.twig" %}

{% from '@ChillBudget/Budget/_macros.html.twig' import table_results %}

{% set activeRouteKey = '' %}
{% set title = 'Budget for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% block title title %}

{% block js %}
{{ encore_entry_script_tags('page_budget') }}
{% endblock %}

{% block css %}
    {{ encore_entry_link_tags('page_budget') }}
{% endblock %}

{% block content %}
<h1>{{ title }}</h1>

{% include '@ChillBudget/Budget/_budget.html.twig' with {
    'resources': resources,
    'charges': charges,
    'person': person
} %}

<div class="mt-5">
    <h3 class="subtitle">{{ 'Budget calculator'|trans }}</h3>
    {{ table_results(charges, resources, results) }}
</div>

{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', person) %}
    <ul class="record_actions sticky-form-buttons">
        <li>
            <a class="btn btn-create" href="{{ path('chill_budget_resource_new', { 'id': person.id} ) }}">{{ 'Create new resource'|trans }}</a>
        </li>
        <li>
            <a class="btn btn-create" href="{{ path('chill_budget_charge_new', { 'id': person.id} ) }}">{{ 'Create new charge'|trans }}</a>
        </li>
    </ul>
{% endif %}


{% endblock %}

