mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Added budget link to household menu + created controller file
no content for controller yet
This commit is contained in:
parent
fd16222c51
commit
de0be15fff
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\BudgetBundle\Controller;
|
||||
|
||||
use Chill\BudgetBundle\Calculator\CalculatorManager;
|
||||
use Chill\BudgetBundle\Entity\Charge;
|
||||
use Chill\BudgetBundle\Entity\Resource;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use function array_merge;
|
||||
use function count;
|
||||
|
||||
class ElementHouseholdController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var CalculatorManager
|
||||
*/
|
||||
protected $calculator;
|
||||
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected $chillMainLogger;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
protected $em;
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
TranslatorInterface $translator,
|
||||
LoggerInterface $chillMainLogger,
|
||||
CalculatorManager $calculator
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->translator = $translator;
|
||||
$this->chillMainLogger = $chillMainLogger;
|
||||
$this->calculator = $calculator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "{_locale}/budget/elements/by-household/{household_id}",
|
||||
* name="chill_person_household_budget_index"
|
||||
* )
|
||||
*/
|
||||
public function indexAction(Household $household)
|
||||
{
|
||||
// $this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $household);
|
||||
|
||||
// $charges = $this->em
|
||||
// ->getRepository(Charge::class)
|
||||
// ->findByPerson($person);
|
||||
// $ressources = $this->em
|
||||
// ->getRepository(Resource::class)
|
||||
// ->findByPerson($person);
|
||||
|
||||
// $now = new DateTime('now');
|
||||
|
||||
// $actualCharges = $this->em
|
||||
// ->getRepository(Charge::class)
|
||||
// ->findByPersonAndDate($person, $now);
|
||||
// $actualResources = $this->em
|
||||
// ->getRepository(Resource::class)
|
||||
// ->findByPersonAndDate($person, $now);
|
||||
|
||||
// $elements = array_merge($actualCharges, $actualResources);
|
||||
|
||||
// if (count($elements) > 0) {
|
||||
// $results = $this->calculator->calculateDefault($elements);
|
||||
// }
|
||||
|
||||
// return $this->render('ChillBudgetBundle:Element:index.html.twig', [
|
||||
// 'person' => $person,
|
||||
// 'charges' => $charges,
|
||||
// 'resources' => $ressources,
|
||||
// 'results' => $results ?? [],
|
||||
// ]);
|
||||
|
||||
return 'hello world';
|
||||
}
|
||||
}
|
@ -66,6 +66,13 @@ class HouseholdMenuBuilder implements LocalMenuBuilderInterface
|
||||
'household_id' => $household->getId(),
|
||||
], ])
|
||||
->setExtras(['order' => 30]);
|
||||
|
||||
$menu->addChild($this->translator->trans('household.Budget'), [
|
||||
'route' => 'chill_person_household_budget_index',
|
||||
'routeParameters' => [
|
||||
'household_id' => $household->getId(),
|
||||
], ])
|
||||
->setExtras(['order' => 30]);
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
|
@ -67,6 +67,7 @@ household:
|
||||
Accompanying period: Parcours d'accompagnement
|
||||
Addresses: Historique adresse
|
||||
Relationship: Filiation
|
||||
Budget: Budget
|
||||
Household relationships: Filiations dans le ménage
|
||||
Current address: Adresse actuelle
|
||||
Household does not have any address currently: Le ménage n'a pas d'adresse renseignée actuellement
|
||||
|
@ -494,6 +494,7 @@ Remove household composition: Supprimer composition familiale
|
||||
Are you sure you want to remove this composition?: Etes-vous sûr de vouloir supprimer cette composition familiale ?
|
||||
Concerns household n°%id%: Concerne le ménage n°%id%
|
||||
Composition: Composition
|
||||
Budget: Budget
|
||||
|
||||
# accompanying course work
|
||||
Accompanying Course Actions: Actions d'accompagnements
|
||||
|
Loading…
x
Reference in New Issue
Block a user