templates adjusted to allow use for person and household

This commit is contained in:
2022-02-24 15:45:35 +01:00
parent c546d23421
commit 81b42ef99a
10 changed files with 430 additions and 64 deletions

View File

@@ -1,12 +1,22 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% if element.person is not null %}
{% set template = '@ChillPerson/Person/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_index' %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% set title = 'Resource for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% else %}
{% set template = '@ChillPerson/Household/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_household_index' %}
{% set activeRouteKey = '' %}
{% set household = element.household %}
{% set title = 'Resource for household %household%'|trans({ '%household%' : household.id } ) %}
{% endif %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% set title = 'Resource for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% extends template %}
{% block title title %}
{% block personcontent %}
{% block content %}
<div class="budget-show">
<h1>{{ title }}</h1>
@@ -48,14 +58,14 @@
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path("chill_budget_elements_index", { 'id': person.id } ) }}" class="btn btn-cancel">
<a href="{{ path(indexPage, { 'id': person is defined ? person.id : household.id } ) }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
{# {% if is_granted(constant('Chill\\BudgetBundle\\Security\\Authorization\\BudgetElementVoter::UPDATE'), element) %} #}
{% if is_granted('CHILL_BUDGET_ELEMENT_UPDATE', element) %}
<li>
<a href="{{ path('chill_budget_resource_edit', { 'id': element.id } ) }}" class="btn btn-edit">{{ 'Edit'|trans }}</a>
</li>
{# {% endif %} #}
{% endif %}
</ul>
{% endblock %}