{% 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 = 'New 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 = 'New Resource for household %household%'|trans({ '%household%' : household.id } ) %}
{% endif %}

{% set title = 'New resource'|trans %}

{% extends template %}

{% block title title %}

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

{{ form_start(form) }}
{{ form_row(form.resource) }}
{{ form_row(form.amount) }}
{{ 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(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': 'Create' } ) }}
    </li>
</ul>

{{ form_end(form) }}
{% endblock %}
