diff --git a/src/Bundle/ChillBudgetBundle/Resources/views/Charge/confirm_delete.html.twig b/src/Bundle/ChillBudgetBundle/Resources/views/Charge/confirm_delete.html.twig index 1f191eafd..f64184d6f 100644 --- a/src/Bundle/ChillBudgetBundle/Resources/views/Charge/confirm_delete.html.twig +++ b/src/Bundle/ChillBudgetBundle/Resources/views/Charge/confirm_delete.html.twig @@ -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 } ) }} diff --git a/src/Bundle/ChillBudgetBundle/Resources/views/Charge/edit.html.twig b/src/Bundle/ChillBudgetBundle/Resources/views/Charge/edit.html.twig index 5b1bc538a..6888c4df0 100644 --- a/src/Bundle/ChillBudgetBundle/Resources/views/Charge/edit.html.twig +++ b/src/Bundle/ChillBudgetBundle/Resources/views/Charge/edit.html.twig @@ -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 %}

{{ title }}

{{ 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) }} - + {{ form_end(form) }} {% endblock %} diff --git a/src/Bundle/ChillBudgetBundle/Resources/views/Charge/new.html.twig b/src/Bundle/ChillBudgetBundle/Resources/views/Charge/new.html.twig index e784b5bf7..80deec331 100644 --- a/src/Bundle/ChillBudgetBundle/Resources/views/Charge/new.html.twig +++ b/src/Bundle/ChillBudgetBundle/Resources/views/Charge/new.html.twig @@ -4,14 +4,14 @@ {% set title = 'New Charge for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %} {% block title title %} -{% block personcontent %} +{% block content %}

{{ title }}

{{ 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 @@ - + {{ form_end(form) }} {% endblock %} diff --git a/src/Bundle/ChillBudgetBundle/Resources/views/Charge/view.html.twig b/src/Bundle/ChillBudgetBundle/Resources/views/Charge/view.html.twig index ea0b6e9b7..df6fc41d1 100644 --- a/src/Bundle/ChillBudgetBundle/Resources/views/Charge/view.html.twig +++ b/src/Bundle/ChillBudgetBundle/Resources/views/Charge/view.html.twig @@ -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 %}

{{ title }}

@@ -48,11 +58,11 @@