mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
basic context for household
This commit is contained in:
parent
cd52f7e6e8
commit
fa556bbba1
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/person/household")
|
||||
*/
|
||||
class HouseholdController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route(
|
||||
* "/{household_id}/summary",
|
||||
* name="chill_person_household_summary",
|
||||
* methods={"GET", "HEAD"}
|
||||
* )
|
||||
* @ParamConverter("household", options={"id" = "household_id"})
|
||||
*/
|
||||
public function summary(Request $request, Household $household)
|
||||
{
|
||||
// TODO ACL
|
||||
return $this->render('@ChillPerson/Household/summary.html.twig',
|
||||
[
|
||||
'household' => $household
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
42
src/Bundle/ChillPersonBundle/Menu/HouseholdMenuBuilder.php
Normal file
42
src/Bundle/ChillPersonBundle/Menu/HouseholdMenuBuilder.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Menu;
|
||||
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class HouseholdMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return [ 'household' ];
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters): void
|
||||
{
|
||||
$household = $parameters['household'];
|
||||
|
||||
$menu->addChild($this->translator->trans('Summary'), [
|
||||
'route' => 'chill_person_household_summary',
|
||||
'routeParameters' => [
|
||||
'household_id' => $household->getId()
|
||||
]])
|
||||
->setExtras(['order' => 10]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<div class="subheader">
|
||||
<div class="grid-12 parent" id="header-accompanying_course-name" >
|
||||
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
|
||||
|
||||
<div class="grid-6">{% set title = title %}
|
||||
<h1>
|
||||
<i class="fa fa-child"></i>
|
||||
{{ 'Household'|trans }}
|
||||
<span style="font-weight: lighter; font-size: 50%;">(n°{{ household.id }})</span>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="grid-3" id="banner-flags"></div>
|
||||
|
||||
<div class="grid-3" id="banner-status"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid-12 parent" id="header-accompanying_course-details" >
|
||||
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
|
||||
|
||||
<div id="banner-misc"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,17 @@
|
||||
{% extends "ChillMainBundle::layoutWithVerticalMenu.html.twig" %}
|
||||
|
||||
{% block top_banner %}
|
||||
{{ include('@ChillPerson/Household/banner.html.twig', { title: block('title') }) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block layout_wvm_content %}
|
||||
{% block content %}{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block vertical_menu_content %}
|
||||
{{ chill_menu('household', {
|
||||
'layout': '@ChillPerson/Household/menu.html.twig',
|
||||
'args' : { 'household': household }
|
||||
}) }}
|
||||
{% endblock %}
|
||||
|
@ -0,0 +1,7 @@
|
||||
<ul class="tab-nav">
|
||||
{% for menu in menus %}
|
||||
<li class="">
|
||||
<a href="{{ menu.uri }}" >{{ menu.label|upper }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
@ -0,0 +1,14 @@
|
||||
{% extends '@ChillPerson/Household/layout.html.twig' %}
|
||||
|
||||
{% block title 'Household summary'|trans %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ block('title') }}</h1>
|
||||
|
||||
<p>Household with id {{ household.id }}</p>
|
||||
|
||||
<h2>{{ 'Actual household members'|trans }}</h2>
|
||||
|
||||
<p>TODO</p>
|
||||
|
||||
{% endblock %}
|
@ -1,17 +1,23 @@
|
||||
services:
|
||||
Chill\PersonBundle\Menu\SectionMenuBuilder:
|
||||
arguments:
|
||||
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
||||
$translator: '@Symfony\Component\Translation\TranslatorInterface'
|
||||
tags:
|
||||
- { name: 'chill.menu_builder' }
|
||||
|
||||
Chill\PersonBundle\Menu\AdminMenuBuilder:
|
||||
arguments:
|
||||
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
||||
Chill\PersonBundle\Menu\:
|
||||
resource: './../../Menu'
|
||||
autowire: true
|
||||
tags:
|
||||
- { name: 'chill.menu_builder' }
|
||||
|
||||
# Chill\PersonBundle\Menu\SectionMenuBuilder:
|
||||
# arguments:
|
||||
# $authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
||||
# $translator: '@Symfony\Component\Translation\TranslatorInterface'
|
||||
# tags:
|
||||
# - { name: 'chill.menu_builder' }
|
||||
#
|
||||
# Chill\PersonBundle\Menu\AdminMenuBuilder:
|
||||
# arguments:
|
||||
# $authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
||||
# tags:
|
||||
# - { name: 'chill.menu_builder' }
|
||||
#
|
||||
Chill\PersonBundle\Menu\PersonMenuBuilder:
|
||||
arguments:
|
||||
$showAccompanyingPeriod: '%chill_person.accompanying_period%'
|
||||
@ -19,8 +25,8 @@ services:
|
||||
tags:
|
||||
- { name: 'chill.menu_builder' }
|
||||
|
||||
Chill\PersonBundle\Menu\AccompanyingCourseMenuBuilder:
|
||||
arguments:
|
||||
$translator: '@Symfony\Contracts\Translation\TranslatorInterface'
|
||||
tags:
|
||||
- { name: 'chill.menu_builder' }
|
||||
# Chill\PersonBundle\Menu\AccompanyingCourseMenuBuilder:
|
||||
# arguments:
|
||||
# $translator: '@Symfony\Contracts\Translation\TranslatorInterface'
|
||||
# tags:
|
||||
# - { name: 'chill.menu_builder' }
|
||||
|
Loading…
x
Reference in New Issue
Block a user