mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
route and menu entry added in person menu + start of templates/controller
This commit is contained in:
parent
48c3432191
commit
b31cc460fa
@ -0,0 +1,43 @@
|
||||
<?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\PersonBundle\Controller;
|
||||
|
||||
use Chill\PersonBundle\Repository\PersonRepository;
|
||||
use Chill\PersonBundle\Repository\PersonResourceRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
final class PersonResourceController extends AbstractController
|
||||
{
|
||||
private PersonResourceRepository $personResourceRepository;
|
||||
|
||||
public function __construct(
|
||||
PersonResourceRepository $personResourceRepository,
|
||||
PersonRepository $personRepository
|
||||
)
|
||||
{
|
||||
$this->personResourceRepository = $personResourceRepository;
|
||||
$this->personRepository = $personRepository;
|
||||
}
|
||||
|
||||
public function listAction($person_id)
|
||||
{
|
||||
dump($person_id);
|
||||
$person = $this->personRepository->find($person_id);
|
||||
dump($person);
|
||||
return $this->render(
|
||||
'ChillPersonBundle:PersonResource:list.html.twig',
|
||||
[
|
||||
'person' => $person
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
@ -96,6 +96,16 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
|
||||
'order' => 100,
|
||||
]);
|
||||
}
|
||||
|
||||
$menu->addChild($this->translator->trans('person_resources_menu'), [
|
||||
'route' => 'chill_person_resource_list',
|
||||
'routeParameters' => [
|
||||
'person_id' => $parameters['person']->getId(),
|
||||
],
|
||||
])
|
||||
->setExtras([
|
||||
'order' => 99999,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
|
@ -0,0 +1,61 @@
|
||||
<?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\PersonBundle\Repository;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person\PersonResource;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class PersonResourceRepository implements ObjectRepository
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
$this->repository = $entityManager->getRepository(PersonResource::class);
|
||||
}
|
||||
|
||||
public function find($id): ?PersonResource
|
||||
{
|
||||
return $this->repository->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PersonResource[]
|
||||
*/
|
||||
public function findAll(): array
|
||||
{
|
||||
return $this->repository->findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed|null $limit
|
||||
* @param mixed|null $offset
|
||||
*
|
||||
* @return PersonResource[]
|
||||
*/
|
||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
|
||||
{
|
||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||
}
|
||||
|
||||
public function findOneBy(array $criteria): ?PersonResource
|
||||
{
|
||||
return $this->repository->findOneBy($criteria);
|
||||
}
|
||||
|
||||
public function getClassName(): string
|
||||
{
|
||||
return PersonResource::class;
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
{% extends "@ChillPerson/Person/layout.html.twig" %}
|
||||
|
||||
{% set activeRouteKey = 'chill_person_resource_list' %}
|
||||
|
||||
{% block title %}{{ 'Person resources'|trans|capitalize ~ ' ' ~ person|chill_entity_render_string }}{% endblock %}
|
||||
|
||||
{% block personcontent %}
|
||||
|
||||
{{ person }}
|
||||
<div class="flex-table">
|
||||
<div class="item-bloc">
|
||||
<div class="item-row">
|
||||
<div class="item-col">Hello</div>
|
||||
<div class="item-col">there</div>
|
||||
</div>
|
||||
<div class="item-row separator">
|
||||
<div class="item-col">How</div>
|
||||
<div class="item-col">are</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-bloc">
|
||||
<div class="item-row">
|
||||
<div class="item-col">you</div>
|
||||
<div class="item-col">doing</div>
|
||||
</div>
|
||||
<div class="item-row">
|
||||
<div class="item-col">today</div>
|
||||
<div class="item-col">?</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -55,6 +55,10 @@ chill_person_accompanying_period_re_open:
|
||||
path: /{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open
|
||||
controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::reOpenAction
|
||||
|
||||
chill_person_resource_list:
|
||||
path: /{_locale}/person/resource/{person_id}/general
|
||||
controller: Chill\PersonBundle\Controller\PersonResourceController::listAction
|
||||
|
||||
chill_person_address_list:
|
||||
path: /{_locale}/person/{person_id}/address/list
|
||||
controller: Chill\PersonBundle\Controller\PersonAddressController::listAction
|
||||
|
@ -223,6 +223,11 @@ Are you sure you want to remove the accompanying period "%id%" ?: Êtes-vous s
|
||||
The accompanying course has been successfully removed.: La période d'accompagnement a été supprimée.
|
||||
Concerned scopes: Services concernés
|
||||
|
||||
# person resource
|
||||
|
||||
person_resources_menu: "Ressources"
|
||||
Person resources: 'Réssources de la personne'
|
||||
|
||||
# pickAPersonType
|
||||
Pick a person: Choisir une personne
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user