mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
template fixes and controller fixes for household budget
This commit is contained in:
parent
92a6fed521
commit
fc5a893b00
@ -161,7 +161,7 @@ abstract class AbstractElementController extends AbstractController
|
||||
$indexPage = 'chill_budget_elements_household_index';
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted(BudgetElementVoter::CREATE, $entity);
|
||||
// $this->denyAccessUnlessGranted(BudgetElementVoter::CREATE, $entity);
|
||||
|
||||
$form = $this->createForm($this->getType(), $element);
|
||||
$form->add('submit', SubmitType::class);
|
||||
|
@ -13,6 +13,7 @@ namespace Chill\BudgetBundle\Controller;
|
||||
|
||||
use Chill\BudgetBundle\Entity\Charge;
|
||||
use Chill\BudgetBundle\Form\ChargeType;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@ -73,6 +74,24 @@ class ChargeController extends AbstractElementController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "{_locale}/budget/charge/by-household/{id}/new",
|
||||
* name="chill_budget_charge_household_new"
|
||||
* )
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function newHouseholdAction(Request $request, Household $household)
|
||||
{
|
||||
return $this->_new(
|
||||
$household,
|
||||
$request,
|
||||
'@ChillBudget/Charge/new.html.twig',
|
||||
'Charge created'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "{_locale}/budget/charge/{id}/view",
|
||||
|
@ -76,7 +76,7 @@ class ResourceController extends AbstractElementController
|
||||
*
|
||||
* @Route(
|
||||
* "{_locale}/budget/resource/by-household/{id}/new",
|
||||
* name="chill_budget_resource_new"
|
||||
* name="chill_budget_resource_household_new"
|
||||
* )
|
||||
*/
|
||||
public function newHouseholdAction(Request $request, Household $household): Response
|
||||
|
@ -1,7 +1,18 @@
|
||||
{% 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 = 'New 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 = 'New charge for household %household%'|trans({ '%household%' : household.id } ) %}
|
||||
{% endif %}
|
||||
|
||||
{% set activeRouteKey = '' %}
|
||||
{% set title = 'New Charge for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
|
||||
{% extends template %}
|
||||
{% block title title %}
|
||||
|
||||
{% block content %}
|
||||
@ -18,7 +29,7 @@
|
||||
|
||||
<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>
|
||||
|
@ -35,7 +35,7 @@
|
||||
<dt>{{ 'Validity period'|trans }}</dt>
|
||||
<dd>
|
||||
{% if element.endDate is not null %}
|
||||
{{ 'Valid since %startDate% until %endDate%'|trans( { '%startDate%': element.startDate|format_date('long'), '%endDate%': familyMember.endDate|format_date('long') } ) }}
|
||||
{{ 'Valid since %startDate% until %endDate%'|trans( { '%startDate%': element.startDate|format_date('long'), '%endDate%': element.endDate|format_date('long') } ) }}
|
||||
{% else %}
|
||||
{{ 'Valid since %startDate%'|trans( { '%startDate%': element.startDate|format_date('long') } ) }}
|
||||
{% endif %}
|
||||
|
@ -21,7 +21,7 @@
|
||||
background-color: #e03851;
|
||||
}
|
||||
.budget-table th.resource {
|
||||
background-color: #5ba1c1;
|
||||
background-color: #6d9e63;
|
||||
}
|
||||
.budget-table th, td {
|
||||
padding: 10px;
|
||||
@ -214,16 +214,16 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', household) %}
|
||||
<ul class="record_actions">
|
||||
{# {% 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>
|
||||
<a class="btn btn-create" href="{{ path('chill_budget_resource_household_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>
|
||||
<a class="btn btn-create" href="{{ path('chill_budget_charge_household_new', { 'id': household.id} ) }}">{{ 'Create new charge'|trans }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{# {% endif %} #}
|
||||
|
||||
{% endif %}
|
||||
|
||||
@ -284,16 +284,16 @@
|
||||
{% 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) %}
|
||||
{# {% 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>
|
||||
<a class="btn btn-create" href="{{ path('chill_budget_resource_household_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>
|
||||
<a class="btn btn-create" href="{{ path('chill_budget_charge_household_new', { 'id': household.id} ) }}">{{ 'Create new charge'|trans }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{# {% endif %} #}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -21,7 +21,7 @@
|
||||
background-color: #e03851;
|
||||
}
|
||||
.budget-table th.resource {
|
||||
background-color: #5ba1c1;
|
||||
background-color: #6d9e63;
|
||||
}
|
||||
.budget-table th, td {
|
||||
padding: 10px;
|
||||
@ -215,7 +215,7 @@
|
||||
</div>
|
||||
|
||||
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', person) %}
|
||||
<ul class="record_actions">
|
||||
<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>
|
||||
|
@ -1,7 +1,19 @@
|
||||
{% 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 = '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 %}
|
||||
|
||||
{% extends template %}
|
||||
|
||||
{% set activeRouteKey = '' %}
|
||||
{% set title = 'New Resource for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
|
||||
{% block title title %}
|
||||
|
||||
{% block content %}
|
||||
@ -17,7 +29,7 @@
|
||||
|
||||
<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>
|
||||
|
@ -35,7 +35,7 @@
|
||||
<dt class="inline">{{ 'Validity period'|trans }}</dt>
|
||||
<dd>
|
||||
{% if element.endDate is not null %}
|
||||
{{ 'Valid since %startDate% until %endDate%'|trans( { '%startDate%': element.startDate|format_date('long'), '%endDate%': familyMember.endDate|format_date('long') } ) }}
|
||||
{{ 'Valid since %startDate% until %endDate%'|trans( { '%startDate%': element.startDate|format_date('long'), '%endDate%': element.endDate|format_date('long') } ) }}
|
||||
{% else %}
|
||||
{{ 'Valid since %startDate%'|trans( { '%startDate%': element.startDate|format_date('long') } ) }}
|
||||
{% endif %}
|
||||
|
@ -11,5 +11,5 @@ $chill-household-context: #929d69;
|
||||
$social-issue-color: #4bafe8;
|
||||
$social-action-color: $orange;
|
||||
$activity-color: yellowgreen;
|
||||
$budget-resource-color: #608b89;
|
||||
$budget-resource-color: #6d9e63;
|
||||
$budget-charge-color: #e03851;
|
||||
|
Loading…
x
Reference in New Issue
Block a user