mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
templates adjusted to allow use for person and household
This commit is contained in:
parent
c546d23421
commit
81b42ef99a
@ -1,18 +1,29 @@
|
||||
{% 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 confirm_question = 'Are you sure you want to remove the charge "%type%" associated to "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%type%': element.type|budget_element_type_display('charge') } ) %}
|
||||
{% else %}
|
||||
{% set template = '@ChillPerson/Household/layout.html.twig' %}
|
||||
{% set indexPage = 'chill_budget_elements_household_index' %}
|
||||
{% set activeRouteKey = '' %}
|
||||
{% set household = element.household %}
|
||||
{% set confirm_question = 'Are you sure you want to remove the charge "%type%" associated to household "%household%" ?'|trans({ '%household%' : household.id, '%type%': element.type|budget_element_type_display('charge') } ) %}
|
||||
{% endif %}
|
||||
|
||||
{% set activeRouteKey = '' %}
|
||||
{% set person = element.person %}
|
||||
{% extends template %}
|
||||
|
||||
{% block title 'Remove resource'|trans %}
|
||||
{% block title 'Remove charge'|trans %}
|
||||
|
||||
{% block personcontent %}
|
||||
{% block content %}
|
||||
|
||||
{{ include('ChillMainBundle:Util:confirmation_template.html.twig',
|
||||
{
|
||||
'title' : 'Remove charge'|trans,
|
||||
'confirm_question' : 'Are you sure you want to remove the charge "%type%" associated to "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%type%': element.type|budget_element_type_display('charge') } ),
|
||||
'cancel_route' : 'chill_budget_elements_index',
|
||||
'cancel_parameters' : { 'id' : element.person.id },
|
||||
'confirm_question' : confirm_question,
|
||||
'cancel_route' : indexPage,
|
||||
'cancel_parameters' : { 'id': person is defined ? person.id : household.id },
|
||||
'form' : delete_form
|
||||
} ) }}
|
||||
|
||||
|
@ -1,31 +1,43 @@
|
||||
{% 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 = 'Edit charge 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 = 'Edit charge for household %household%'|trans({ '%household%' : household.id } ) %}
|
||||
{% endif %}
|
||||
|
||||
{% extends template %}
|
||||
|
||||
{% set activeRouteKey = '' %}
|
||||
{% set title = 'Edit Charge for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
|
||||
{% block title title %}
|
||||
|
||||
{% block personcontent %}
|
||||
{% block content %}
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
{{ form_start(form) }}
|
||||
|
||||
{{ form_row(form.type) }}
|
||||
{{ form_row(form.amount) }}
|
||||
{{ form_row(form.help) }}
|
||||
{{ form_row(form.help) }}
|
||||
{{ form_row(form.comment) }}
|
||||
{{ form_row(form.startDate) }}
|
||||
{{ form_row(form.endDate) }}
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ path("chill_budget_elements_index", { 'id': person.id } ) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list'|trans }}
|
||||
<a href="{{ path(indexPage, { 'id': person is defined ? person.id : household.id } ) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
{{ form_widget(form.submit, { 'attr' : { 'class': 'btn btn-create' }, 'label': 'Edit' } ) }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
|
@ -4,14 +4,14 @@
|
||||
{% set title = 'New Charge for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
|
||||
{% block title title %}
|
||||
|
||||
{% block personcontent %}
|
||||
{% block content %}
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
{{ form_start(form) }}
|
||||
|
||||
{{ form_row(form.type) }}
|
||||
{{ form_row(form.amount) }}
|
||||
{{ form_row(form.help) }}
|
||||
{{ form_row(form.help) }}
|
||||
{{ form_row(form.comment) }}
|
||||
{{ form_row(form.startDate) }}
|
||||
{{ form_row(form.endDate) }}
|
||||
@ -19,13 +19,13 @@
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ path("chill_budget_elements_index", { 'id': person.id } ) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list'|trans }}
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
{{ form_widget(form.submit, { 'attr' : { 'class': 'btn btn-create' }, 'label': 'Create' } ) }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
|
@ -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 = 'Charge 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 = 'Charge for household %household%'|trans({ '%household%' : household.id } ) %}
|
||||
{% endif %}
|
||||
|
||||
{% set activeRouteKey = '' %}
|
||||
{% set person = element.person %}
|
||||
{% set title = 'Charge 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,11 +58,11 @@
|
||||
|
||||
<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_charge_edit', { 'id': element.id } ) }}" class="btn btn-edit">{{ 'Edit'|trans }}</a>
|
||||
</li>
|
||||
|
@ -0,0 +1,300 @@
|
||||
{% extends "@ChillPerson/Household/layout.html.twig" %}
|
||||
|
||||
{% set activeRouteKey = '' %}
|
||||
{% set title = 'Budget for household %household%'|trans({ '%household%' : household.id } ) %}
|
||||
{% block title title %}
|
||||
|
||||
{% block css %}
|
||||
<style>
|
||||
.subtitle {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
.family-title {
|
||||
margin-bottom: 1rem !important;
|
||||
}
|
||||
.budget-table th {
|
||||
color: white;
|
||||
}
|
||||
.budget-table th.charge {
|
||||
background-color: #e03851;
|
||||
}
|
||||
.budget-table th.resource {
|
||||
background-color: #5ba1c1;
|
||||
}
|
||||
.budget-table th, td {
|
||||
padding: 10px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.budget-table td.column-wide {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.budget-table td.column-small {
|
||||
width: 15%;
|
||||
}
|
||||
|
||||
.bold {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.total {
|
||||
margin-top: 1rem;
|
||||
border-top: 1px dashed black;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% set actualResources = [] %}
|
||||
{% set futureResources = [] %}
|
||||
{% set pastResources = [] %}
|
||||
|
||||
{% for r in resources %}
|
||||
{% if r.startDate|date('U') <= 'now'|date('U') %}
|
||||
{% if r.endDate is null or r.endDate|date('U') >= 'now'|date('U') %}
|
||||
{% set actualResources = actualResources|merge([ r ]) %}
|
||||
{% else %}
|
||||
{% set pastResources = pastResources|merge([ r ]) %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% set futureResources = futureResources|merge([ r ]) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% set actualCharges = [] %}
|
||||
{% set futureCharges = [] %}
|
||||
{% set pastCharges = [] %}
|
||||
|
||||
{% for c in charges %}
|
||||
{% if c.startDate|date('U') <= 'now'|date('U') %}
|
||||
{% if c.endDate is null or c.endDate|date('U') >= 'now'|date('U') %}
|
||||
{% set actualCharges = actualCharges|merge([ c ]) %}
|
||||
{% else %}
|
||||
{% set pastCharges = pastCharges|merge([ c ]) %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% set futureCharges = futureCharges|merge([ c ]) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% macro table_elements(elements, family) %}
|
||||
<table class="budget-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="{{ family }}">{{ 'Budget element type'|trans }}</th>
|
||||
<th class="{{ family }}">{{ 'Amount'|trans }}</th>
|
||||
<th class="{{ family }}">{{ 'Validity period'|trans }}</th>
|
||||
<th class="{{ family }}"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set total = 0 %}
|
||||
{% for f in elements %}
|
||||
{% set total = total + f.amount %}
|
||||
<tr>
|
||||
<td class="column-wide bold">
|
||||
{{ f.type|budget_element_type_display(family) }}
|
||||
</td>
|
||||
<td class="column-small">{{ f.amount|format_currency('EUR') }}</td>
|
||||
<td class="column-small">
|
||||
{% if f.endDate is not null %}
|
||||
{{ 'Valid since %startDate% until %endDate%'|trans( { '%startDate%': f.startDate|format_date('short'), '%endDate%': f.endDate|format_date('short') } ) }}
|
||||
{% else %}
|
||||
{{ 'Valid since %startDate%'|trans( { '%startDate%': f.startDate|format_date('short') } ) }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="column-small">
|
||||
<ul class="record_actions">
|
||||
{% if is_granted('CHILL_BUDGET_ELEMENT_SEE', f) %}
|
||||
<li>
|
||||
<a href="{{ path('chill_budget_' ~ family ~ '_view', { 'id': f.id } ) }}" class="btn btn-sm btn-show"></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_BUDGET_ELEMENT_UPDATE', f) %}
|
||||
<li>
|
||||
<a href="{{ path('chill_budget_' ~ family ~'_edit', { 'id': f.id } ) }}" class="btn btn-sm btn-edit"></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_BUDGET_ELEMENT_DELETE', f) %}
|
||||
<li>
|
||||
<a href="{{ path('chill_budget_' ~ family ~ '_delete', { 'id': f.id } ) }}" class="btn btn-sm btn-delete"></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr class="total">
|
||||
<td>
|
||||
{{ 'Total'|trans }}
|
||||
</td>
|
||||
<td>
|
||||
{{ total|format_currency('EUR') }}
|
||||
</td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro table_results(results) %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>{{ 'Budget calculator result'|trans }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for result in results %}
|
||||
<tr>
|
||||
<td>{{ result.label }}</td>
|
||||
<td>
|
||||
{% if result.type == constant('CHILL\\BudgetBundle\\Calculator\\CalculatorResult::TYPE_CURRENCY') %}
|
||||
{{ result.result|format_currency('EUR') }}
|
||||
{% elseif result.type == constant('CHILL\\BudgetBundle\\Calculator\\CalculatorResult::TYPE_PERCENTAGE') %}
|
||||
{{ result.result|round(2, 'ceil') ~ '%' }}
|
||||
{% else %}
|
||||
{{ result.result|round(2, 'common') }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endmacro %}
|
||||
|
||||
{% import _self as m %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
<h2 class="subtitle">{{ 'Actual budget'|trans }}</h2>
|
||||
|
||||
{% if resources|length == 0 and charges|length == 0 %}
|
||||
<p><span class="chill-no-data-statement">{{ "There isn't any element recorded"|trans }}</span></p>
|
||||
{% else %}
|
||||
|
||||
<div class="flex-table">
|
||||
<h3 class="family-title">{{ 'Actual resources'|trans }}</h3>
|
||||
|
||||
{% if actualResources|length > 0 %}
|
||||
<div class="item-bloc">
|
||||
{{ m.table_elements(actualResources, 'resource') }}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="item-bloc">
|
||||
<span class="chill-no-data-statement">{{ 'No resources registered'|trans }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="flex-table">
|
||||
<h3 class="family-title">{{ 'Actual charges'|trans }}</h3>
|
||||
|
||||
{% if actualCharges|length > 0 %}
|
||||
<div class="item-bloc">
|
||||
{{ m.table_elements(actualCharges, 'charge') }}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="item-bloc">
|
||||
<span class="chill-no-data-statement">{{ 'No charges registered'|trans }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if results|length > 0 %}
|
||||
<h2>{{ 'Budget calculator'|trans }}</h2>
|
||||
<div class="item-bloc">
|
||||
{{ m.table_results(results) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', household) %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a class="btn btn-create" href="{{ path('chill_budget_resource_new', { 'id': household.id} ) }}">{{ 'Create new resource'|trans }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-create" href="{{ path('chill_budget_charge_new', { 'id': household.id} ) }}">{{ 'Create new charge'|trans }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if pastCharges|length > 0 or pastResources|length > 0 %}
|
||||
<h2 class="subtitle">{{ 'Past budget'|trans }}</h2>
|
||||
|
||||
<h3 class="family-title">{{ 'Past resources'|trans }}</h3>
|
||||
|
||||
{% if pastResources|length > 0 %}
|
||||
<div class="item-bloc">
|
||||
{{ m.table_elements(pastResources, 'resource') }}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="item-bloc">
|
||||
<span class="chill-no-data-statement">{{ 'No past resources registered'|trans }}</span>
|
||||
<div class="item-bloc">
|
||||
{% endif %}
|
||||
|
||||
<h3 class="family-title">{{ 'Past charges'|trans }}</h3>
|
||||
|
||||
{% if pastCharges|length > 0 %}
|
||||
<div class="item-bloc">
|
||||
{{ m.table_elements(pastCharges, 'charge') }}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="item-bloc">
|
||||
<span class="chill-no-data-statement">{{ 'No past charges registered'|trans }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if futureCharges|length > 0 or futureResources|length > 0 %}
|
||||
<h2 class="subtitle">{{ 'Future budget'|trans }}</h2>
|
||||
|
||||
<h3 class="family-title">{{ 'Future resources'|trans }}</h3>
|
||||
|
||||
{% if futureResources|length > 0 %}
|
||||
<div class="item-bloc">
|
||||
{{ m.table_elements(futureResources, 'resource') }}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="item-bloc">
|
||||
<span class="chill-no-data-statement">{{ 'No future resources registered'|trans }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<h3 class="family-title">{{ 'Future charges'|trans }}</h3>
|
||||
|
||||
{% if futureCharges|length > 0 %}
|
||||
<div class="item-bloc">
|
||||
{{ m.table_elements(futureCharges, 'charge') }}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="item-bloc">
|
||||
<span class="chill-no-data-statement">{{ 'No future charges registered'|trans }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if (resources|length + charges|length) == 0 or futureCharges|length > 0 or futureResources|length > 0 or pastCharges|length > 0 or pastResources|length > 0 %}
|
||||
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', household) %}
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li>
|
||||
<a class="btn btn-create" href="{{ path('chill_budget_resource_new', { 'id': household.id} ) }}">{{ 'Create new resource'|trans }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-create" href="{{ path('chill_budget_charge_new', { 'id': household.id} ) }}">{{ 'Create new charge'|trans }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -108,21 +108,21 @@
|
||||
</td>
|
||||
<td class="column-small">
|
||||
<ul class="record_actions">
|
||||
{# {% if is_granted(constant('Chill\\BudgetBundle\\Security\\Authorization\\BudgetElementVoter::SHOW'), f) %} #}
|
||||
{% if is_granted('CHILL_BUDGET_ELEMENT_SEE', f) %}
|
||||
<li>
|
||||
<a href="{{ path('chill_budget_' ~ family ~ '_view', { 'id': f.id } ) }}" class="btn btn-sm btn-show"></a>
|
||||
</li>
|
||||
{# {% endif %} #}
|
||||
{# {% if is_granted(constant('Chill\\BudgetBundle\\Security\\Authorization\\BudgetElementVoter::UPDATE'), f) %} #}
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_BUDGET_ELEMENT_UPDATE', f) %}
|
||||
<li>
|
||||
<a href="{{ path('chill_budget_' ~ family ~'_edit', { 'id': f.id } ) }}" class="btn btn-sm btn-edit"></a>
|
||||
</li>
|
||||
{# {% endif %} #}
|
||||
{# {% if is_granted(constant('Chill\\BudgetBundle\\Security\\Authorization\\BudgetElementVoter::DELETE'), f) %} #}
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_BUDGET_ELEMENT_DELETE', f) %}
|
||||
<li>
|
||||
<a href="{{ path('chill_budget_' ~ family ~ '_delete', { 'id': f.id } ) }}" class="btn btn-sm btn-delete"></a>
|
||||
</li>
|
||||
{# {% endif %} #}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -170,7 +170,7 @@
|
||||
|
||||
{% import _self as m %}
|
||||
|
||||
{% block personcontent %}
|
||||
{% block content %}
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
<h2 class="subtitle">{{ 'Actual budget'|trans }}</h2>
|
||||
@ -214,7 +214,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{# {% if is_granted(constant('Chill\\BudgetBundle\\Security\\Authorization\\BudgetElementVoter::CREATE'), person) %} #}
|
||||
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', person) %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a class="btn btn-create" href="{{ path('chill_budget_resource_new', { 'id': person.id} ) }}">{{ 'Create new resource'|trans }}</a>
|
||||
@ -223,7 +223,7 @@
|
||||
<a class="btn btn-create" href="{{ path('chill_budget_charge_new', { 'id': person.id} ) }}">{{ 'Create new charge'|trans }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{# {% endif %} #}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
@ -284,8 +284,8 @@
|
||||
{% endif %}
|
||||
|
||||
{% if (resources|length + charges|length) == 0 or futureCharges|length > 0 or futureResources|length > 0 or pastCharges|length > 0 or pastResources|length > 0 %}
|
||||
{# {% if is_granted(constant('Chill\\BudgetBundle\\Security\\Authorization\\BudgetElementVoter::CREATE'), person) %} #}
|
||||
<ul class="record_actions">
|
||||
{% 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>
|
||||
@ -293,7 +293,7 @@
|
||||
<a class="btn btn-create" href="{{ path('chill_budget_charge_new', { 'id': person.id} ) }}">{{ 'Create new charge'|trans }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{# {% endif %} #}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
@ -1,18 +1,29 @@
|
||||
{% 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 confirm_question = 'Are you sure you want to remove the ressource "%type%" associated to "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%type%': element.type|budget_element_type_display('resource') } ) %}
|
||||
{% else %}
|
||||
{% set template = '@ChillPerson/Household/layout.html.twig' %}
|
||||
{% set indexPage = 'chill_budget_elements_household_index' %}
|
||||
{% set activeRouteKey = '' %}
|
||||
{% set household = element.household %}
|
||||
{% set confirm_question = 'Are you sure you want to remove the ressource "%type%" associated to household "%household%" ?'|trans({ '%household%' : household.id, '%type%': element.type|budget_element_type_display('resource') } ) %}
|
||||
{% endif %}
|
||||
|
||||
{% set activeRouteKey = '' %}
|
||||
{% set person = element.person %}
|
||||
{% extends template %}
|
||||
|
||||
{% block title 'Remove resource'|trans %}
|
||||
|
||||
{% block personcontent %}
|
||||
{% block content %}
|
||||
|
||||
{{ include('ChillMainBundle:Util:confirmation_template.html.twig',
|
||||
{
|
||||
'title' : 'Remove resource'|trans,
|
||||
'confirm_question' : 'Are you sure you want to remove the ressource "%type%" associated to "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%type%': element.type|budget_element_type_display('resource') } ),
|
||||
'cancel_route' : 'chill_budget_elements_index',
|
||||
'cancel_parameters' : { 'id' : element.person.id },
|
||||
'confirm_question' : confirm_question,
|
||||
'cancel_route' : indexPage,
|
||||
'cancel_parameters' : { 'id': person is defined ? person.id : household.id },
|
||||
'form' : delete_form
|
||||
} ) }}
|
||||
|
||||
|
@ -1,10 +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 = 'Edit 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 = 'Edit resource for household %household%'|trans({ '%household%' : household.id } ) %}
|
||||
{% endif %}
|
||||
|
||||
{% extends template %}
|
||||
|
||||
{% set activeRouteKey = '' %}
|
||||
{% set title = 'Edit Resource for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
|
||||
{% block title title %}
|
||||
|
||||
{% block personcontent %}
|
||||
{% block content %}
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
{{ form_start(form) }}
|
||||
@ -17,14 +29,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">
|
||||
{{ 'Back to the list'|trans }}
|
||||
<a href="{{ path(indexPage, { 'id': person is defined ? person.id : household.id } ) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
{{ form_widget(form.submit, { 'attr' : { 'class': 'btn btn-create' }, 'label': 'Edit' } ) }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
|
@ -4,7 +4,7 @@
|
||||
{% set title = 'New Resource for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
|
||||
{% block title title %}
|
||||
|
||||
{% block personcontent %}
|
||||
{% block content %}
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
{{ form_start(form) }}
|
||||
@ -18,13 +18,13 @@
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ path("chill_budget_elements_index", { 'id': person.id } ) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list'|trans }}
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
{{ form_widget(form.submit, { 'attr' : { 'class': 'btn btn-create' }, 'label': 'Create' } ) }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
|
@ -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 %}
|
Loading…
x
Reference in New Issue
Block a user