Compare commits

..

4 Commits

Author SHA1 Message Date
bb86d04e52 csfixes 2022-02-25 14:02:18 +01:00
4c704734cd Add ACL to edit membership 2022-02-17 16:53:11 +01:00
0ffd6a857c Rights added to all menu entries 2022-02-17 16:11:46 +01:00
aebb21935b fix page "my accompanying period" and do not show drafts periods in
homepage (+ ordering)
2022-02-16 19:57:35 +01:00
70 changed files with 490 additions and 587 deletions

View File

@@ -15,19 +15,13 @@ use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class PersonMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
protected AuthorizationCheckerInterface $authorizationChecker;
/**
* @var TranslatorInterface
*/
protected $translator;
protected TranslatorInterface $translator;
public function __construct(
AuthorizationCheckerInterface $authorizationChecker,

View File

@@ -109,11 +109,9 @@
{{ 'Cancel'|trans }}
</a>
</li>
{% if is_granted('CHILL_ACTIVITY_UPDATE', entity) %}
<li>
<button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
</li>
{% endif %}
<li>
<button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
</li>
</ul>
{{ form_end(edit_form) }}

View File

@@ -35,7 +35,7 @@
<ul class="record_actions sticky-form-buttons">
<li>
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}"
class="btn btn-create">{{ 'Create'|trans }}
class="btn btn-create">{{ 'Create'|trans }}
</a>
</li>
</ul>

View File

@@ -47,13 +47,13 @@
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %}
{% if is_granted('CHILL_ACTIVITY_CREATE', person) %}
<ul class="record_actions sticky-form-buttons">
<li>
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}"
class="btn btn-create" tabindex="-1" role="button" aria-disabled="true">{{ 'Create'|trans }}
</a>
</li>
</ul>
<ul class="record_actions sticky-form-buttons">
<li>
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}"
class="btn btn-create" tabindex="-1" role="button" aria-disabled="true">{{ 'Create'|trans }}
</a>
</li>
</ul>
{% endif %}
{% endblock %}

View File

@@ -16,29 +16,17 @@ use Chill\TaskBundle\Templating\UI\CountNotificationTask;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class UserMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
public $authorizationChecker;
public AuthorizationCheckerInterface $authorizationChecker;
/**
* @var CountNotificationTask
*/
public $counter;
public CountNotificationTask $counter;
/**
* @var TokenStorageInterface
*/
public $tokenStorage;
public TokenStorageInterface $tokenStorage;
/**
* @var TranslatorInterface
*/
public $translator;
public TranslatorInterface $translator;
public function __construct(
CountNotificationTask $counter,

View File

@@ -14,14 +14,18 @@ namespace Chill\CalendarBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
{
protected AuthorizationHelper $authorizationHelper;
protected Security $security;
protected TokenStorageInterface $tokenStorage;
protected TranslatorInterface $translator;
@@ -29,11 +33,13 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
public function __construct(
TokenStorageInterface $tokenStorage,
AuthorizationHelper $authorizationHelper,
TranslatorInterface $translator
TranslatorInterface $translator,
Security $security
) {
$this->translator = $translator;
$this->authorizationHelper = $authorizationHelper;
$this->tokenStorage = $tokenStorage;
$this->security = $security;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
@@ -41,12 +47,14 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
$period = $parameters['accompanyingCourse'];
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) {
$menu->addChild($this->translator->trans('Calendar'), [
'route' => 'chill_calendar_calendar_list',
'routeParameters' => [
'accompanying_period_id' => $period->getId(),
], ])
->setExtras(['order' => 35]);
if ($this->security->isGranted(AccompanyingPeriodVoter::SEE, $period)) {
$menu->addChild($this->translator->trans('Calendar'), [
'route' => 'chill_calendar_calendar_list',
'routeParameters' => [
'accompanying_period_id' => $period->getId(),
], ])
->setExtras(['order' => 35]);
}
}
}

View File

@@ -41,28 +41,24 @@
</a>
</li>
{% endif %}
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %}
<li>
{{ m.download_button(document.object, document.title) }}
</li>
{% endif %}
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
<li>
{% if chill_document_is_editable(document.object) %}
{% if not freezed %}
{{ document.object|chill_document_edit_button({'title': document.title|e('html') }) }}
{% else %}
<a class="btn btn-wopilink disabled" href="#" title="{{ 'workflow.freezed document'|trans }}">
{{ 'Update document'|trans }}
</a>
{% endif %}
<li>
{{ m.download_button(document.object, document.title) }}
</li>
<li>
{% if chill_document_is_editable(document.object) %}
{% if not freezed %}
{{ document.object|chill_document_edit_button({'title': document.title|e('html') }) }}
{% else %}
<a class="btn btn-wopilink disabled" href="#" title="{{ 'workflow.freezed document'|trans }}">
{{ 'Update document'|trans }}
</a>
{% endif %}
</li>
{% endif %}
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %}
<li>
<a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': document.course.id, 'id': document.id}) }}" class="btn btn-show"></a>
</li>
{% endif %}
</li>
</ul>
{% endif %}

View File

@@ -25,11 +25,9 @@
{{ 'Back to the list' | trans }}
</a>
</li>
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
<li class="edit">
<button class="btn btn-edit">{{ 'Edit'|trans }}</button>
</li>
{% endif %}
<li class="edit">
<button class="btn btn-edit">{{ 'Edit'|trans }}</button>
</li>
</ul>
{{ form_end(form) }}

View File

@@ -60,7 +60,7 @@
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
<li>
<a href="{{ path('accompanying_course_document_edit', {'id': document.id, 'course': accompanyingCourse.id}) }}"
class="btn btn-edit" title="{{ 'Edit attributes' | trans }}"></a>
class="btn btn-edit" title="{{ 'Edit attributes' | trans }}"></a>
</li>
{% endif %}
{% set workflows_frame = chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) %}

View File

@@ -42,11 +42,9 @@
{{ 'Back to the list' | trans }}
</a>
</li>
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
<li class="edit">
<button class="btn btn-edit">{{ 'Edit'|trans }}</button>
</li>
{% endif %}
<li class="edit">
<button class="btn btn-edit">{{ 'Edit'|trans }}</button>
</li>
{# {% if is_granted('CHILL_PERSON_DOCUMENT_DELETE', document) %}
<li class="delete">
{{ include('ChillDocStoreBundle:PersonDocument:_delete_form.html.twig') }}

View File

@@ -46,11 +46,9 @@
{{ 'Back to the list' | trans }}
</a>
</li>
{% if is_granted ('CHILL_PERSON_DOCUMENT_CREATE', person) %}
<li class="create">
<button class="btn btn-create">{{ 'Create'|trans }}</button>
</li>
{% endif %}
<li class="create">
<button class="btn btn-create">{{ 'Create'|trans }}</button>
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -15,19 +15,13 @@ use Chill\AMLI\FamilyMembersBundle\Security\Voter\FamilyMemberVoter;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class UserMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
protected AuthorizationCheckerInterface $authorizationChecker;
/**
* @var TranslatorInterface
*/
protected $translator;
protected TranslatorInterface $translator;
public function __construct(
AuthorizationCheckerInterface $authorizationChecker,

View File

@@ -12,11 +12,23 @@ declare(strict_types=1);
namespace Chill\MainBundle\Routing\MenuBuilder;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
class LocationMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
{
private AuthorizationCheckerInterface $authorizationChecker;
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
{
$this->authorizationChecker = $authorizationChecker;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) {
return;
}
$menu->addChild('Location type list', [
'route' => 'chill_crud_main_location_type_index',
])->setExtras(['order' => 205]);

View File

@@ -12,11 +12,23 @@ declare(strict_types=1);
namespace Chill\MainBundle\Routing\MenuBuilder;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
class PermissionMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
{
private AuthorizationCheckerInterface $authorizationChecker;
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
{
$this->authorizationChecker = $authorizationChecker;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) {
return;
}
$menu->addChild('Permissions group list', [
'route' => 'admin_permissionsgroup',
])->setExtras([

View File

@@ -15,22 +15,16 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\MainBundle\Security\Authorization\ChillExportVoter;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Class SectionMenuBuilder.
*/
class SectionMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
protected AuthorizationCheckerInterface $authorizationChecker;
/**
* @var TranslatorInterface
*/
protected $translator;
protected TranslatorInterface $translator;
/**
* SectionMenuBuilder constructor.
@@ -46,22 +40,24 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
*/
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
$menu->addChild($this->translator->trans('Homepage'), [
'route' => 'chill_main_homepage',
])
->setExtras([
'icons' => ['home'],
'order' => 0,
]);
if (!$this->authorizationChecker->isGranted('ROLE_USER')) {
$menu->addChild($this->translator->trans('Homepage'), [
'route' => 'chill_main_homepage',
])
->setExtras([
'icons' => ['home'],
'order' => 0,
]);
$menu->addChild($this->translator->trans('Global timeline'), [
'route' => 'chill_center_timeline',
])
->setExtras(
[
'order' => 10,
]
);
$menu->addChild($this->translator->trans('Global timeline'), [
'route' => 'chill_center_timeline',
])
->setExtras(
[
'order' => 10,
]
);
}
if ($this->authorizationChecker->isGranted(ChillExportVoter::EXPORT)) {
$menu->addChild($this->translator->trans('Export Menu'), [

View File

@@ -15,11 +15,14 @@ use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Notification\Counter\NotificationByUserCounter;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\MainBundle\Workflow\Counter\WorkflowByUserCounter;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
class UserMenuBuilder implements LocalMenuBuilderInterface
{
private AuthorizationCheckerInterface $authorizationChecker;
private NotificationByUserCounter $notificationByUserCounter;
private Security $security;
@@ -32,16 +35,22 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
NotificationByUserCounter $notificationByUserCounter,
WorkflowByUserCounter $workflowByUserCounter,
Security $security,
TranslatorInterface $translator
TranslatorInterface $translator,
AuthorizationCheckerInterface $authorizationChecker
) {
$this->notificationByUserCounter = $notificationByUserCounter;
$this->workflowByUserCounter = $workflowByUserCounter;
$this->security = $security;
$this->translator = $translator;
$this->authorizationChecker = $authorizationChecker;
}
public function buildMenu($menuId, \Knp\Menu\MenuItem $menu, array $parameters)
{
if (!$this->authorizationChecker->isGranted('ROLE_USER')) {
return;
}
$user = $this->security->getUser();
if ($user instanceof User) {

View File

@@ -19,6 +19,7 @@ use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Form\HouseholdMemberType;
use Chill\PersonBundle\Household\MembersEditor;
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
use Chill\PersonBundle\Security\Authorization\HouseholdVoter;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
use Symfony\Component\HttpFoundation\Request;
@@ -26,7 +27,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Serializer\Exception;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use function count;
@@ -56,7 +57,7 @@ class HouseholdMemberController extends ApiController
*/
public function editMembership(Request $request, HouseholdMember $member): Response
{
// TODO ACL
$this->denyAccessUnlessGranted(HouseholdVoter::EDIT, $member);
$form = $this->createForm(HouseholdMemberType::class, $member, [
'validation_groups' => ['household_memberships'],

View File

@@ -30,7 +30,7 @@ class UserAccompanyingPeriodController extends AbstractController
}
/**
* @Route("/{_locale}/accompanying-periods", name="chill_person_accompanying_period_user")
* @Route("/{_locale}/person/accompanying-periods/my", name="chill_person_accompanying_period_user")
*/
public function listAction(Request $request)
{
@@ -50,7 +50,7 @@ class UserAccompanyingPeriodController extends AbstractController
}
/**
* @Route("/{_locale}/accompanying-periods/drafts", name="chill_person_accompanying_period_draft_user")
* @Route("/{_locale}/person/accompanying-periods/my/drafts", name="chill_person_accompanying_period_draft_user")
*/
public function listDraftsAction(Request $request)
{

View File

@@ -29,10 +29,7 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
protected Security $security;
/**
* @var TranslatorInterface
*/
protected $translator;
protected TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator, Registry $registry, Security $security)
{
@@ -46,12 +43,14 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
/** @var AccompanyingPeriod $period */
$period = $parameters['accompanyingCourse'];
$menu->addChild($this->translator->trans('Resume Accompanying Course'), [
'route' => 'chill_person_accompanying_course_index',
'routeParameters' => [
'accompanying_period_id' => $period->getId(),
], ])
->setExtras(['order' => 10]);
if ($this->security->isGranted(AccompanyingPeriodVoter::SEE, $period)) {
$menu->addChild($this->translator->trans('Resume Accompanying Course'), [
'route' => 'chill_person_accompanying_course_index',
'routeParameters' => [
'accompanying_period_id' => $period->getId(),
], ])
->setExtras(['order' => 10]);
}
if ($this->security->isGranted(AccompanyingPeriodVoter::EDIT, $period)) {
$menu->addChild($this->translator->trans('Edit Accompanying Course'), [
@@ -94,22 +93,24 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
$workflow = $this->registry->get($period, 'accompanying_period_lifecycle');
if (null !== $period->getClosingDate()) {
$menu->addChild($this->translator->trans('Re-open accompanying course'), [
'route' => 'chill_person_accompanying_course_reopen',
'routeParameters' => [
'accompanying_period_id' => $period->getId(),
], ])
->setExtras(['order' => 99998]);
}
if ($this->security->isGranted(AccompanyingPeriodVoter::EDIT, $period)) {
if (null !== $period->getClosingDate()) {
$menu->addChild($this->translator->trans('Re-open accompanying course'), [
'route' => 'chill_person_accompanying_course_reopen',
'routeParameters' => [
'accompanying_period_id' => $period->getId(),
], ])
->setExtras(['order' => 99998]);
}
if ($workflow->can($period, 'close')) {
$menu->addChild($this->translator->trans('Close Accompanying Course'), [
'route' => 'chill_person_accompanying_course_close',
'routeParameters' => [
'accompanying_period_id' => $period->getId(),
], ])
->setExtras(['order' => 99999]);
if ($workflow->can($period, 'close')) {
$menu->addChild($this->translator->trans('Close Accompanying Course'), [
'route' => 'chill_person_accompanying_course_close',
'routeParameters' => [
'accompanying_period_id' => $period->getId(),
], ])
->setExtras(['order' => 99999]);
}
}
}

View File

@@ -12,7 +12,9 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\PersonBundle\Security\Authorization\HouseholdVoter;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
class HouseholdMenuBuilder implements LocalMenuBuilderInterface
@@ -22,9 +24,12 @@ class HouseholdMenuBuilder implements LocalMenuBuilderInterface
*/
protected $translator;
public function __construct(TranslatorInterface $translator)
private $security;
public function __construct(TranslatorInterface $translator, Security $security)
{
$this->translator = $translator;
$this->security = $security;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters): void
@@ -32,40 +37,46 @@ class HouseholdMenuBuilder implements LocalMenuBuilderInterface
/** @var \Chill\PersonBundle\Entity\Household\Household $household */
$household = $parameters['household'];
$menu->addChild($this->translator->trans('household.Household summary'), [
'route' => 'chill_person_household_summary',
'routeParameters' => [
'household_id' => $household->getId(),
], ])
->setExtras(['order' => 10]);
if ($this->security->isGranted(HouseholdVoter::SEE, $household)) {
$menu->addChild($this->translator->trans('household.Household summary'), [
'route' => 'chill_person_household_summary',
'routeParameters' => [
'household_id' => $household->getId(),
], ])
->setExtras(['order' => 10]);
$menu->addChild($this->translator->trans('household.Relationship'), [
'route' => 'chill_person_household_relationship',
'routeParameters' => [
'household_id' => $household->getId(),
], ])
->setExtras(['order' => 15]);
$menu->addChild($this->translator->trans('household.Relationship'), [
'route' => 'chill_person_household_relationship',
'routeParameters' => [
'household_id' => $household->getId(),
], ])
->setExtras(['order' => 15]);
}
$menu->addChild($this->translator->trans('household_composition.Compositions'), [
'route' => 'chill_person_household_composition_index',
'routeParameters' => [
'id' => $household->getId(),
], ])
->setExtras(['order' => 17]);
if ($this->security->isGranted(HouseholdVoter::EDIT, $household)) {
$menu->addChild($this->translator->trans('household_composition.Compositions'), [
'route' => 'chill_person_household_composition_index',
'routeParameters' => [
'id' => $household->getId(),
], ])
->setExtras(['order' => 17]);
}
$menu->addChild($this->translator->trans('household.Accompanying period'), [
'route' => 'chill_person_household_accompanying_period',
'routeParameters' => [
'household_id' => $household->getId(),
], ])
->setExtras(['order' => 20]);
if ($this->security->isGranted(HouseholdVoter::SEE, $household)) {
$menu->addChild($this->translator->trans('household.Accompanying period'), [
'route' => 'chill_person_household_accompanying_period',
'routeParameters' => [
'household_id' => $household->getId(),
], ])
->setExtras(['order' => 20]);
$menu->addChild($this->translator->trans('household.Addresses'), [
'route' => 'chill_person_household_addresses',
'routeParameters' => [
'household_id' => $household->getId(),
], ])
->setExtras(['order' => 30]);
$menu->addChild($this->translator->trans('household.Addresses'), [
'route' => 'chill_person_household_addresses',
'routeParameters' => [
'household_id' => $household->getId(),
], ])
->setExtras(['order' => 30]);
}
}
public static function getMenuIds(): array

View File

@@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Knp\Menu\MenuItem;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Security\Core\Security;
@@ -33,10 +34,7 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
*/
protected $showAccompanyingPeriod;
/**
* @var TranslatorInterface
*/
protected $translator;
protected TranslatorInterface $translator;
private Security $security;
@@ -52,45 +50,46 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
$menu->addChild($this->translator->trans('Person details'), [
'route' => 'chill_person_view',
'routeParameters' => [
'person_id' => $parameters['person']->getId(),
],
])
->setExtras([
'order' => 50,
]);
if ($this->security->isGranted(PersonVoter::SEE, $parameters['person'])) {
$menu->addChild($this->translator->trans('Person details'), [
'route' => 'chill_person_view',
'routeParameters' => [
'person_id' => $parameters['person']->getId(),
],
])
->setExtras([
'order' => 50,
]);
$menu->addChild($this->translator->trans('Residential addresses'), [
'route' => 'chill_person_residential_address_list',
'routeParameters' => [
'id' => $parameters['person']->getId(),
],
])
->setExtras([
'order' => 60,
]);
$menu->addChild($this->translator->trans('Residential addresses'), [
'route' => 'chill_person_residential_address_list',
'routeParameters' => [
'id' => $parameters['person']->getId(),
],
])
->setExtras([
'order' => 60,
]);
$menu->addChild($this->translator->trans('household.person history'), [
'route' => 'chill_person_household_person_history',
'routeParameters' => [
'person_id' => $parameters['person']->getId(),
],
])
->setExtras([
'order' => 99999,
]);
$menu->addChild($this->translator->trans('household.person history'), [
'route' => 'chill_person_household_person_history',
'routeParameters' => [
'person_id' => $parameters['person']->getId(),
],
])
->setExtras([
'order' => 99999,
]);
$menu->addChild($this->translator->trans('Person duplicate'), [
'route' => 'chill_person_duplicate_view',
'routeParameters' => [
'person_id' => $parameters['person']->getId(),
],
])
->setExtras([
'order' => 99999,
]);
$menu->addChild($this->translator->trans('Person duplicate'), [
'route' => 'chill_person_duplicate_view',
'routeParameters' => [
'person_id' => $parameters['person']->getId(),
],
])
->setExtras([
'order' => 99999,
]);
}
if (
'visible' === $this->showAccompanyingPeriod
@@ -107,15 +106,17 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
]);
}
$menu->addChild($this->translator->trans('person_resources_menu'), [
'route' => 'chill_person_resource_list',
'routeParameters' => [
'person_id' => $parameters['person']->getId(),
],
])
->setExtras([
'order' => 99999,
]);
if ($this->security->isGranted(PersonVoter::SEE, $parameters['person'])) {
$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

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
@@ -56,13 +57,15 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
]);
}
$menu->addChild($this->translator->trans('Create an accompanying course'), [
'route' => 'chill_person_accompanying_course_new',
])
->setExtras([
'order' => 11,
'icons' => ['plus'],
]);
if ($this->authorizationChecker->isGranted(AccompanyingPeriodVoter::CREATE)) {
$menu->addChild($this->translator->trans('Create an accompanying course'), [
'route' => 'chill_person_accompanying_course_new',
])
->setExtras([
'order' => 11,
'icons' => ['plus'],
]);
}
}
public static function getMenuIds(): array

View File

@@ -71,7 +71,7 @@ final class AccompanyingPeriodRepository implements ObjectRepository
$qb = $this->buildQueryByRecentUserHistory($user, $since);
return $qb->select('a')
->distinct(true)
->addOrderBy('userHistory.startDate', 'DESC')
->getQuery()
->setMaxResults($limit)
->setFirstResult($offset)
@@ -95,6 +95,7 @@ final class AccompanyingPeriodRepository implements ObjectRepository
$qb
->join('a.userHistories', 'userHistory')
->where($qb->expr()->eq('a.user', ':user'))
->andWhere($qb->expr()->neq('a.step', "'" . AccompanyingPeriod::STEP_DRAFT . "'"))
->andWhere($qb->expr()->gte('userHistory.startDate', ':since'))
->andWhere($qb->expr()->isNull('userHistory.endDate'))
->setParameter('user', $user)

View File

@@ -46,9 +46,7 @@
{% if type == 'new' %}
<button class="btn btn-create" type="submit">{{ 'Post a new comment'|trans }}</button>
{% elseif type == 'edit' %}
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_COMMENT_EDIT', comment) %}
<button class="btn btn-save" type="submit">{{ 'Save'|trans }}</button>
{% endif %}
<button class="btn btn-save" type="submit">{{ 'Save'|trans }}</button>
{% endif %}
</li>
</ul>

View File

@@ -4,13 +4,13 @@
<ul class="record_actions">
<li>
<a class="btn btn-sm btn-update change-icon"
href="{{ path('chill_person_accompanying_course_edit', { 'accompanying_period_id': accompanyingCourse.id, '_fragment': 'section-10' }) }}">
href="{{ path('chill_person_accompanying_course_edit', { 'accompanying_period_id': accompanyingCourse.id, '_fragment': 'section-10' }) }}">
<i class="fa fa-fw fa-crosshairs"></i>
{{ 'fix it'|trans }}
</a>
</li>
</ul>
</div>
{{ 'Some people currently do not belong to any household. Add them to a household soon'|trans }}
{{ 'Some peoples does not belong to any household currently. Add them to an household soon'|trans }}
</div></div>
</div>

View File

@@ -7,7 +7,7 @@
<ul class="record_actions">
<li>
<a class="btn btn-sm btn-update change-icon"
href="{{ path('chill_person_accompanying_course_edit', { 'accompanying_period_id': accompanyingCourse.id, '_fragment': 'section-20' }) }}">
href="{{ path('chill_person_accompanying_course_edit', { 'accompanying_period_id': accompanyingCourse.id, '_fragment': 'section-20' }) }}">
<i class="fa fa-fw fa-crosshairs"></i>
{{ 'fix it'|trans }}
</a>
@@ -15,10 +15,10 @@
</ul>
</div>
<p>
{{ 'This course is located at a temporary address. You should link this course to a user'|trans }}</p>
{{ 'This course is located at a temporarily address. You should locate this course to an user'|trans }}</p>
{% if not hasPersonLocation %}
<p>
{{ 'Associate at least one member with a household, and set an address to this household'|trans }}</p>
{{ 'Associate at least one member with an household, and set an address to this household'|trans }}</p>
{% endif %}
</div>
</div>

View File

@@ -21,11 +21,9 @@
{{ 'Return'|trans }}
</a>
</li>
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_UPDATE', accompanyingCourse) %}
<li>
<button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
</li>
{% endif %}
<li>
<button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
</li>
</ul>
{{ form_end(form) }}

View File

@@ -20,7 +20,6 @@
{{ 'Return'|trans }}
</a>
</li>
{# TODO: add a right here? Use 'CHILL_ACCOMPANYING_PERIOD_CREATE'? #}
<li>
<button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
</li>

View File

@@ -101,27 +101,25 @@
{% if notif_counter.total > 0 %}
{{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork', w.id) }}
{% endif %}
{% import '@ChillPerson/Macro/updatedBy.html.twig' as macro %}
{{ macro.updatedBy(w) }}
</div>
{% if displayAction is defined and displayAction == true %}
<div class="item-col">
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', w) %}
<ul class="record_actions">
<li>
<a class="btn btn-edit" title="{{ 'Edit'|trans }}"
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': w.id }) }}"
></a>
</li>
<li>
<a class="btn btn-edit" title="{{ 'Edit'|trans }}"
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': w.id }) }}"
></a>
</li>
<li>
<a class="btn btn-delete" title="{{ 'Delete'|trans }}"
href="{{ path('chill_person_accompanying_period_work_delete', { 'id': w.id } ) }}"
href="{{ path('chill_person_accompanying_period_work_delete', { 'id': w.id } ) }}"
></a>
</li>
</ul>
{% endif %}
</div>
{% endif %}
</div>

View File

@@ -9,12 +9,10 @@
{% if works|length == 0 %}
<p class="chill-no-data-statement">{{ 'accompanying_course_work.Any work'|trans }}
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_CREATE', accompanyingCourse) %}
<a class="btn btn-sm btn-create"
title="{{ 'accompanying_course_work.create'|trans }}"
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_new', { 'id': accompanyingCourse.id }) }}"
></a>
{% endif %}
<a class="btn btn-sm btn-create"
title="{{ 'accompanying_course_work.create'|trans }}"
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_new', { 'id': accompanyingCourse.id }) }}"
></a>
</p>
{% else %}
@@ -28,14 +26,12 @@
{{ chill_pagination(paginator) }}
<ul class="record_actions sticky-form-buttons">
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_CREATE', accompanyingCourse) %}
<li>
<a href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_new', { 'id': accompanyingCourse.id }) }}"
class="btn btn-new">
{{ 'accompanying_course_work.create'|trans }}
</a>
</li>
{% endif %}
<li>
<a href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_new', { 'id': accompanyingCourse.id }) }}"
class="btn btn-new">
{{ 'accompanying_course_work.create'|trans }}
</a>
</li>
</ul>
</div>

View File

@@ -5,20 +5,16 @@
{% macro recordAction(period, contextEntity) %}
{# TODO if enable_accompanying_course_with_multiple_persons is true ... #}
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE_DETAILS', period) %}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': period.id }) }}"
class="btn btn-show" title="{{ 'See accompanying period'|trans }}">{# {{ 'See this period'|trans }} #}</a>
</li>
{% endif %}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': period.id }) }}"
class="btn btn-show" title="{{ 'See accompanying period'|trans }}">{# {{ 'See this period'|trans }} #}</a>
</li>
{% if period.step == 'DRAFT' and contextEntity.type == 'person' %}
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_DELETE', period) %}
{% set person = contextEntity.entity %}
<li>
<a href="{{ path('chill_person_accompanying_course_delete', { 'accompanying_period_id': period.id, 'person_id' : person.id }) }}"
class="btn btn-delete" title="{{ 'Delete accompanying period'|trans }}">{# {{ 'Delete this period'|trans }} #}</a>
</li>
{% endif %}
{% set person = contextEntity.entity %}
<li>
<a href="{{ path('chill_person_accompanying_course_delete', { 'accompanying_period_id': period.id, 'person_id' : person.id }) }}"
class="btn btn-delete" title="{{ 'Delete accompanying period'|trans }}">{# {{ 'Delete this period'|trans }} #}</a>
</li>
{% endif %}
{# DISABLED if new accompanying course, this is not necessary

View File

@@ -50,7 +50,7 @@
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path('chill_person_accompanying_period_list', { 'person_id' : person.id } ) }}" class="btn btn-cancel">{{ 'Back to the list'|trans }}</a>
<a href="{{ path('chill_person_accompanying_period_list', { 'person_id' : person.id } ) }}" class="btn btn-cancel">{{ 'Back to the list'|trans }}</a>
</li>
<li>
<button type="submit" class="btn btn-save">

View File

@@ -12,22 +12,18 @@
{% include 'ChillPersonBundle:AccompanyingPeriod:_list.html.twig' %}
<ul class="record_actions sticky-form-buttons">
{% if is_granted('CHILL_PERSON_SEE', person) %}
<li class="cancel">
<a href="{{ path ('chill_person_view', {'person_id' : person.id } ) }}"
class="btn btn-cancel">{{ 'Person details'|trans }}
</a>
</li>
{% endif %}
{# TODO: which right to add here? #}
<li>
<a class="btn btn-create"
href="{{ path ('chill_person_accompanying_course_new', {'person_id' : [ person.id ] } ) }}" role="button">
{{ 'Create an accompanying period'|trans }}
</a>
</li>
<li class="cancel">
<a href="{{ path ('chill_person_view', {'person_id' : person.id } ) }}"
class="btn btn-cancel">{{ 'Person details'|trans }}
</a>
</li>
<li>
<a class="btn btn-create"
href="{{ path ('chill_person_accompanying_course_new', {'person_id' : [ person.id ] } ) }}" role="button">
{{ 'Create an accompanying period'|trans }}
</a>
</li>
{# TODO: should this commented section be deleted? #}
{# Disabled dropdown
<li class="dropdown">
<a class="btn btn-create change-icon dropdown-toggle"

View File

@@ -16,7 +16,6 @@
{{ 'Cancel'|trans }}
</a>
</li>
{# TODO: add a right here? Use 'CHILL_ACCOMPANYING_PERIOD_CREATE'? #}
<li>
<a href="{{ path('chill_person_accompanying_period_re_open', {'confirm' : true, 'person_id' : person.id, 'period_id' : period.id } ) }}" class="btn btn-create">
{{'Confirm'|trans }}

View File

@@ -5,12 +5,10 @@
{% block title %}{{ 'My accompanying periods in draft'|trans }}{% endblock title %}
{% macro recordAction(period) %}
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE_DETAILS', period) %}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': period.id }) }}"
class="btn btn-show" title="{{ 'See accompanying period'|trans }}"></a>
</li>
{% endif %}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': period.id }) }}"
class="btn btn-show" title="{{ 'See accompanying period'|trans }}"></a>
</li>
{% endmacro %}

View File

@@ -5,12 +5,10 @@
{% block title %}{{ 'My accompanying periods'|trans }}{% endblock title %}
{% macro recordAction(period) %}
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', period) %}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': period.id }) }}"
class="btn btn-show" title="{{ 'See accompanying period'|trans }}"></a>
</li>
{% endif %}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': period.id }) }}"
class="btn btn-show" title="{{ 'See accompanying period'|trans }}"></a>
</li>
{% endmacro %}
@@ -22,6 +20,8 @@
<div class="flex-table accompanyingcourse-list">
{% for period in accompanyingPeriods %}
{% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %}
{% else %}
<p class="chill-no-data-statement">{{ 'Any accompanying period'|trans }}</p>
{% endfor %}
</div>

View File

@@ -29,13 +29,13 @@
{% if customButtons['before'] is defined %}
{{ customButtons['before'] }}
{% endif %}
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', member.household) %}
<li>
<a class="btn btn-sm btn-edit"
title="{{ 'household.Edit member household'|trans }}"
href="{{ chill_path_add_return_path('chill_person_household_member_edit', { 'id': member.id }) }}"></a>
</li>
{% endif %}
<li>
<a class="btn btn-sm btn-edit"
title="{{ 'household.Edit member household'|trans }}"
href="{{ chill_path_add_return_path('chill_person_household_member_edit', { 'id': member.id }) }}"></a>
</li>
{% if customButtons['after'] is defined %}
{{ customButtons['after'] }}
{% endif %}

View File

@@ -41,13 +41,11 @@
{% endif %}
<ul class="record_actions sticky-form-buttons">
{% if is_granted('CHILL_PERSON_HOUSEHOLD_SEE', household) %}
<li class="cancel">
<a href="{{ path ('chill_person_household_summary', {'household_id' : household.id } ) }}" class="btn btn-cancel">
{{ 'Household summary'|trans }}
</a>
</li>
{% endif %}
<li class="cancel">
<a href="{{ path ('chill_person_household_summary', {'household_id' : household.id } ) }}" class="btn btn-cancel">
{{ 'Household summary'|trans }}
</a>
</li>
{#
<li>
<a href="{{ path ('chill_person_household_accompanying_course_new', {'household_id' : [ household.id ] } ) }}" class="btn btn-create">

View File

@@ -63,13 +63,11 @@
'has_no_address': true
}) }}
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', household) %}
<li>
<a href="{{ path('chill_person_household_address_edit', { 'household_id': household.id, 'address_id' : address.id } ) }}"
class="btn btn-edit"></a>
</li>
{% endif %}
</ul>
</div>

View File

@@ -26,13 +26,11 @@
{{ 'Cancel'|trans }}
</a>
</li>
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', household) %}
<li>
<button type="submit" class="btn btn-save">
{{ 'Save'|trans }}
</button>
</li>
{% endif %}
<li>
<button type="submit" class="btn btn-save">
{{ 'Save'|trans }}
</button>
</li>
</ul>
{{ form_end(form) }}

View File

@@ -64,14 +64,12 @@
{{ 'household_composition.Since'|trans({'startDate': currentComposition.startDate}) }}
</p>
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', household) %}
<li>
<a class="btn btn-sm btn-update change-icon"
href="{{ path('chill_person_household_composition_index', {'id': household.id}) }}">
{{ 'household_composition.Update composition'|trans }}
</a>
</li>
{% endif %}
</ul>
</div>
{% else %}
@@ -80,14 +78,12 @@
{{ 'household_composition.Currently no composition'|trans }}
</p>
<ul class="record_actions" style="margin-bottom: 0">
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', household) %}
<li>
<a class="btn btn-sm btn-update change-icon"
href="{{ path('chill_person_household_composition_index', {'id': household.id}) }}">
{{ 'household_composition.Add a composition'|trans }}
</a>
</li>
{% endif %}
</ul>
</div>
{% endif %}
@@ -109,19 +105,15 @@
{% endif %}
{% if not household.commentMembers.isEmpty() %}
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', household) %}
<a href="{{ chill_path_add_return_path('chill_person_household_summary', { 'household_id': household.id, 'edit': 1 }) }}"
class="btn btn-edit btn-block">
{{ 'household.Edit comment and expecting birth'|trans }}
</a>
{% endif %}
<a href="{{ chill_path_add_return_path('chill_person_household_summary', { 'household_id': household.id, 'edit': 1 }) }}"
class="btn btn-edit btn-block">
{{ 'household.Edit comment and expecting birth'|trans }}
</a>
{% else %}
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', household) %}
<a href="{{ chill_path_add_return_path('chill_person_household_summary', { 'household_id': household.id, 'edit': 1 }) }}"
class="btn btn-create btn-block">
{{ 'household.New comment and expecting birth'|trans }}
</a>
{% endif %}
<a href="{{ chill_path_add_return_path('chill_person_household_summary', { 'household_id': household.id, 'edit': 1 }) }}"
class="btn btn-create btn-block">
{{ 'household.New comment and expecting birth'|trans }}
</a>
{% endif %}
{% else %}
@@ -137,13 +129,11 @@
{{ form_widget(form.commentMembers) }}
</div>
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', household) %}
<li>
<button type="submit" class="btn btn-save" id="form_household_comment_confirm">
{{ 'Save'|trans }}
</button>
</li>
{% endif %}
<li>
<button type="submit" class="btn btn-save" id="form_household_comment_confirm">
{{ 'Save'|trans }}
</button>
</li>
</ul>
{{ form_end(form) }}
{% endif %}
@@ -255,14 +245,12 @@
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', household) %}
<li>
<a href="{{ chill_path_add_return_path('chill_person_household_members_editor', {'household': household.id }) }}"
class="btn btn-create">
{{ 'household.Add a member'|trans }}
</a>
</li>
{% endif %}
<li>
<a href="{{ chill_path_add_return_path('chill_person_household_members_editor', {'household': household.id }) }}"
class="btn btn-create">
{{ 'household.Add a member'|trans }}
</a>
</li>
</ul>
</div>

View File

@@ -63,11 +63,9 @@
<li class="cancel" style="margin-right: auto;">
<a class="btn btn-cancel" href="{{ path('chill_person_household_composition_index', {'id': c.household.id}) }}">{{ 'Cancel'|trans }}</a>
</li>
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', c.household) %}
<li>
<button type="submit" class="btn btn-create">{{ 'Save'|trans }}</button>
</li>
{% endif %}
<li>
<button type="submit" class="btn btn-create">{{ 'Save'|trans }}</button>
</li>
</ul>
{{ form_end(form) }}
{% endif %}
@@ -81,24 +79,20 @@
{{ form_widget(form) }}
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', household) %}
<li>
<button type="submit" class="btn btn-create">{{ 'Save'|trans }}</button>
</li>
{% endif %}
<li>
<button type="submit" class="btn btn-create">{{ 'Save'|trans }}</button>
</li>
</ul>
{{ form_end(form) }}
</div>
{% if editId == -1 %}
<ul class="record_actions sticky-form-buttons">
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', household) %}
<li>
<button class="btn btn-primary btn-create change-icon" type="button" data-bs-toggle="collapse" data-bs-target="#collapseForm" aria-expanded="false" aria-controls="collapseForm">
{{ 'Create'|trans }}
</button>
</li>
{% endif %}
</ul>
{% endif %}
</div>

View File

@@ -107,24 +107,21 @@
<ul class="record_actions sticky-form-buttons">
<li class="dropdown">
{% if is_granted('CHILL_PERSON_CREATE') %}
<a class="btn btn-create dropdown-toggle"
href="#" role="button" id="newPersonMore" data-bs-toggle="dropdown" aria-expanded="false">
{{ 'Add the person'|trans }}
</a>
{% endif %}
<ul class="dropdown-menu" aria-labelledby="newPersonMore">
<li>
{{ form_widget(form.editPerson, { 'attr': { 'class': 'dropdown-item' }}) }}
</li>
<li>
{{ form_widget(form.createHousehold, { 'attr': { 'class': 'dropdown-item' }}) }}
</li>
<li>
{{ form_widget(form.createPeriod, { 'attr': { 'class': 'dropdown-item' }}) }}
</li>
</ul>
{# {% endif %} #}
<a class="btn btn-create dropdown-toggle"
href="#" role="button" id="newPersonMore" data-bs-toggle="dropdown" aria-expanded="false">
{{ 'Add the person'|trans }}
</a>
<ul class="dropdown-menu" aria-labelledby="newPersonMore">
<li>
{{ form_widget(form.editPerson, { 'attr': { 'class': 'dropdown-item' }}) }}
</li>
<li>
{{ form_widget(form.createHousehold, { 'attr': { 'class': 'dropdown-item' }}) }}
</li>
<li>
{{ form_widget(form.createPeriod, { 'attr': { 'class': 'dropdown-item' }}) }}
</li>
</ul>
</li>
</ul>

View File

@@ -136,13 +136,11 @@
{{ 'Return'|trans }}
</a>
</li>
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
<li>
<button class="btn btn-save" type="submit">
{{ 'Save'|trans }}
</button>
</li>
{% endif %}
<li>
<button class="btn btn-save" type="submit">
{{ 'Save'|trans }}
</button>
</li>
</ul>
{{ form_end(form) }}

View File

@@ -113,18 +113,14 @@
<div class="item-row separator">
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_HOUSEHOLD_SEE', p.household) %}
<li>
<a href="{{ chill_path_add_return_path('chill_person_household_summary',{ 'household_id': p.household.id }) }}"
class="btn btn-show" title="{{ 'Show'|trans }}"></a>
</li>
{% endif %}
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', p.household) %}
<li>
<a href="{{ chill_path_add_return_path('chill_person_household_member_edit', { id: p.id }) }}"
class="btn btn-edit" title="{{ 'Edit'|trans }}"></a>
class="btn btn-edit" title="{{ 'Edit'|trans }}"></a>
</li>
{% endif %}
{% if p.isCurrent() %}
<li>
<a class="btn btn-misc" href="{{ chill_path_add_return_path( 'chill_person_household_members_editor', { 'persons': [ person.id ], 'allow_leave_without_household': true }) }}">
@@ -168,12 +164,10 @@
<div class="item-row separator">
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', p.household) %}
<li>
<a href="{{ chill_path_add_return_path('chill_person_household_member_edit', { id: p.id }) }}"
class="btn btn-edit" title="{{ 'Edit'|trans }}"></a>
</li>
{% endif %}
<li>
<a href="{{ chill_path_add_return_path('chill_person_household_member_edit', { id: p.id }) }}"
class="btn btn-edit" title="{{ 'Edit'|trans }}"></a>
</li>
</ul>
</div>

View File

@@ -69,9 +69,7 @@
</td>
<td>
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_SEE', person) %}
<li><a class="btn btn-show" href="{{ path('chill_person_view', { person_id : person.getId }) }}"></a></li>
{% endif %}
<li><a class="btn btn-show" href="{{ path('chill_person_view', { person_id : person.getId }) }}"></a></li>
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
<li><a class="btn btn-update" href="{{ path('chill_person_general_edit', { person_id : person.getId }) }}"></a></li>
{% endif %}

View File

@@ -74,11 +74,9 @@
</td>
<td>
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_SEE', person) %}
<li><a class="btn btn-show" href="{{ path('chill_person_view', { person_id : person.getId }) }}"></a></li>
{% endif %}
<li><a class="btn btn-show" href="{{ path('chill_person_view', { person_id : person.getId }) }}"></a></li>
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
<li><a class="btn btn-update" href="{{ path('chill_person_general_edit', { person_id : person.getId }) }}"></a></li>
<li><a class="btn btn-update" href="{{ path('chill_person_general_edit', { person_id : person.getId }) }}"></a></li>
{% endif %}
</ul>
</td>

View File

@@ -214,14 +214,12 @@
{% endif %}
<ul class="record_actions record_actions_column">
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', acp) %}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': acp.id }) }}"
class="btn btn-sm btn-outline-primary" title="{{ 'See accompanying period'|trans }}">
<i class="fa fa-random fa-fw"></i>
</a>
</li>
{% endif %}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': acp.id }) }}"
class="btn btn-sm btn-outline-primary" title="{{ 'See accompanying period'|trans }}">
<i class="fa fa-random fa-fw"></i>
</a>
</li>
</ul>
</div>

View File

@@ -8,26 +8,24 @@
{% block personcontent %}
<div class="person-duplicate">
<h1>{{ 'Désigner un dossier doublon'|trans }}</h1>
{{ form_start(form) }}
{{ form_rest(form) }}
<h1>{{ 'Désigner un dossier doublon'|trans }}</h1>
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path('chill_person_duplicate_view', {'person_id' : person.id}) }}" class="btn btn-cancel">
{{ 'Return'|trans }}
</a>
</li>
<li>
<button class="btn btn-save" type="submit">{{ 'Next'|trans }}</button>
</li>
</ul>
{{ form_start(form) }}
{{ form_rest(form) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path('chill_person_duplicate_view', {'person_id' : person.id}) }}" class="btn btn-cancel">
{{ 'Return'|trans }}
</a>
</li>
{% if is_granted('CHILL_PERSON_CREATE') %}
<li>
<button class="btn btn-save" type="submit">{{ 'Next'|trans }}</button>
</li>
{% endif %}
</ul>
{{ form_end(form) }}
{{ form_end(form) }}
</div>
{% endblock %}

View File

@@ -56,11 +56,9 @@
</td>
<td>
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_SEE', duplicatePerson) %}
<li>
<a class="btn btn-show" target="_blank" href="{{ path('chill_person_view', { person_id : duplicatePerson.id }) }}"></a>
</li>
{% endif %}
<li>
<a class="btn btn-show" target="_blank" href="{{ path('chill_person_view', { person_id : duplicatePerson.id }) }}"></a>
</li>
<li>
<a class="btn btn-action" href="{{ path('chill_person_duplicate_confirm', { person1_id : person.id, person2_id : duplicatePerson.id }) }}">
<i class="fa fa-cog fa-fw"></i>{{ 'Merge'|trans }}</a>
@@ -126,17 +124,15 @@
</td>
<td>
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_SEE', notDuplicatePerson) %}
<li>
<a class="btn btn-show" target="_blank" href="{{ path('chill_person_view', { person_id : notDuplicatePerson.id }) }}"></a>
</li>
{% endif %}
<li>
<a class="btn btn-misc" title="{{ 'Switch to duplicate'|trans }}"
href="{{ path('chill_person_remove_duplicate_not_duplicate', {person1_id : person.id, person2_id : notDuplicatePerson.id}) }}">
<i class="fa fa-toggle-off fa-fw"></i>
{{ 'not-duplicate'|trans }}
</a>
href="{{ path('chill_person_remove_duplicate_not_duplicate', {person1_id : person.id, person2_id : notDuplicatePerson.id}) }}">
<i class="fa fa-toggle-off fa-fw"></i>
{{ 'not-duplicate'|trans }}
</a>
</li>
</ul>
</td>

View File

@@ -65,14 +65,12 @@
</ul>
{% else %}
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
<li>
<button class="btn btn-create"
type="submit" id="newPersonResource">
{{ 'Save'|trans }}
</button>
</li>
{% endif %}
<li>
<button class="btn btn-create"
type="submit" id="newPersonResource">
{{ 'Save'|trans }}
</button>
</li>
</ul>
{% endif %}

View File

@@ -38,11 +38,9 @@
{{ 'Cancel'|trans|chill_return_path_label }}
</a>
</li>
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
<li>
<button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
</li>
{% endif %}
<li>
<button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
</li>
</ul>
{{ form_end(form) }}

View File

@@ -104,12 +104,12 @@
</a>
</li>
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
<li>
<a class="btn btn-create"
href="{{ path('chill_person_residential_address_new', { 'id' : person.id } ) }}">
{{ 'Add a residential address'|trans }}
</a>
</li>
<li>
<a class="btn btn-create"
href="{{ path('chill_person_residential_address_new', { 'id' : person.id } ) }}">
{{ 'Add a residential address'|trans }}
</a>
</li>
{% endif %}
</ul>
</div>

View File

@@ -8,16 +8,16 @@
<div class="container" style="margin-top: 2rem;">
<div class="row">
<div class="col-md-4 mb-4">
<a
href="{{ chill_path_forward_return_path('chill_person_residential_address_new', {'id': person.id, 'kind': 'person'}) }}"
class="btn btn-outline-chill-green-dark">
{{ 'The address of another person'|trans }}
</a>
</div>
<div class="col-md-8">
<p>{{ 'residential_address_person_explanation'|trans }}</p>
</div>
<div class="col-md-4 mb-4">
<a
href="{{ chill_path_forward_return_path('chill_person_residential_address_new', {'id': person.id, 'kind': 'person'}) }}"
class="btn btn-outline-chill-green-dark">
{{ 'The address of another person'|trans }}
</a>
</div>
<div class="col-md-8">
<p>{{ 'residential_address_person_explanation'|trans }}</p>
</div>
</div>
<div class="row">
<div class="col-md-4 mb-4">

View File

@@ -14,13 +14,11 @@
<td>{{ entity.id }}</td>
<td>{{ entity.title|localize_translatable_string }}</td>
<td>
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', entity) %}
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_social_evaluation_edit', { 'id': entity.id }) }}" class="sc-button bt-edit"></a>
</li>
</ul>
{% endif %}
</td>
</tr>
{% endfor %}

View File

@@ -14,13 +14,11 @@
<td>{{ entity.id }}</td>
<td>{{ entity.title|localize_translatable_string }}</td>
<td>
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', entity) %}
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_social_goal_edit', { 'id': entity.id }) }}" class="sc-button bt-edit"></a>
</li>
</ul>
{% endif %}
</td>
</tr>
{% endfor %}

View File

@@ -14,13 +14,11 @@
<td>{{ entity.id }}</td>
<td>{{ entity.title|localize_translatable_string }}</td>
<td>
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', entity) %}
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_social_result_edit', { 'id': entity.id }) }}" class="sc-button bt-edit"></a>
</li>
</ul>
{% endif %}
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_social_result_edit', { 'id': entity.id }) }}" class="sc-button bt-edit"></a>
</li>
</ul>
</td>
</tr>
{% endfor %}

View File

@@ -14,13 +14,11 @@
<td>{{ entity.id }}</td>
<td>{{ entity.title|localize_translatable_string }}</td>
<td>
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', entity) %}
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_social_action_edit', { 'id': entity.id }) }}" class="sc-button bt-edit"></a>
</li>
</ul>
{% endif %}
</td>
</tr>
{% endfor %}

View File

@@ -14,13 +14,11 @@
<td>{{ entity.id }}</td>
<td>{{ entity.title|localize_translatable_string }}</td>
<td>
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', entity) %}
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_social_issue_edit', { 'id': entity.id }) }}" class="sc-button bt-edit"></a>
</li>
</ul>
{% endif %}
</td>
</tr>
{% endfor %}

View File

@@ -14,11 +14,11 @@
<dl class="chill_view_data">
<dd>{{ 'Participants'|trans }}&nbsp;:</dd>
<dt>
<ul>
{% for p in period.participations %}
<li>{{ p.person|chill_entity_render_box({ 'addLink': true }) }}: {{ 'since %date%'|trans({'%date%': p.startDate|format_date("long") } ) }}, {{ 'until %date%'|trans({'%date%': (p.endDate is not null ? p.endDate : period.closingDate)|format_date("long") }) }}</li>
{% endfor %}
</ul>
<ul>
{% for p in period.participations %}
<li>{{ p.person|chill_entity_render_box({ 'addLink': true }) }}: {{ 'since %date%'|trans({'%date%': p.startDate|format_date("long") } ) }}, {{ 'until %date%'|trans({'%date%': (p.endDate is not null ? p.endDate : period.closingDate)|format_date("long") }) }}</li>
{% endfor %}
</ul>
</dt>
</div>
</div>

View File

@@ -28,10 +28,12 @@ This view should receive those arguments:
{% block personcontent %}
<div class="timeline">
{{ timeline|raw }}
{% if nb_items > paginator.getItemsPerPage %}
{{ chill_pagination(paginator) }}
{% endif %}
</div>
{{ timeline|raw }}
{% if nb_items > paginator.getItemsPerPage %}
{{ chill_pagination(paginator) }}
{% endif %}
</div>
{% endblock %}

View File

@@ -14,11 +14,11 @@
<dl class="chill_view_data">
<dd>{{ 'Participants'|trans }}&nbsp;:</dd>
<dt>
<ul>
{% for p in period.participations %}
<li>{{ 'Since %date%'|trans( {'%date%': p.startDate|format_date("long") } ) }}&nbsp;: {{ p.person|chill_entity_render_box({ 'addLink': true }) }}</li>
{% endfor %}
</ul>
<ul>
{% for p in period.participations %}
<li>{{ 'Since %date%'|trans( {'%date%': p.startDate|format_date("long") } ) }}&nbsp;: {{ p.person|chill_entity_render_box({ 'addLink': true }) }}</li>
{% endfor %}
</ul>
</dt>
</div>
</div>

View File

@@ -6,14 +6,12 @@
</div>
{% if display_action is defined and display_action == true %}
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', work) %}
<ul class="record_actions">
<li>
<a class="btn btn-update"
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': work.id }) }}">
{{ 'Edit'|trans }}
</a>
</li>
</ul>
{% endif %}
<ul class="record_actions">
<li>
<a class="btn btn-update"
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': work.id }) }}">
{{ 'Edit'|trans }}
</a>
</li>
</ul>
{% endif %}

View File

@@ -88,13 +88,12 @@
</div>
{% if display_action is defined and display_action == true %}
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_SEE', evaluation.accompanyingPeriodWork) %}
<ul class="record_actions">
<li>
<a class="btn btn-show" href="{{ path('chill_person_accompanying_period_work_edit', {'id': evaluation.accompanyingPeriodWork.id}) }}">
{{ 'Show'|trans }}
</a>
</li>
</ul>
{% endif %}
{# TODO add acl #}
<ul class="record_actions">
<li>
<a class="btn btn-show" href="{{ path('chill_person_accompanying_period_work_edit', {'id': evaluation.accompanyingPeriodWork.id}) }}">
{{ 'Show'|trans }}
</a>
</li>
</ul>
{% endif %}

View File

@@ -213,7 +213,7 @@ No requestor: Pas de demandeur
No resources: "Pas d'interlocuteurs privilégiés"
Persons associated: Usagers concernés
Referrer: Référent
Some people currently do not belong to any household. Add them to a household soon: Certaines personnes n'appartiennent à aucun ménage actuellement. Renseignez leur ménage dès que possible.
Some peoples does not belong to any household currently. Add them to an household soon: Certaines personnes n'appartiennent à aucun ménage actuellement. Renseignez leur ménage dès que possible.
Add to household now: Ajouter à un ménage
Any resource for this accompanying course: Aucun interlocuteur privilégié pour ce parcours
course.draft: Brouillon
@@ -451,12 +451,12 @@ Edit Accompanying Course: Modifier le parcours
Close Accompanying Course: Clôturer le parcours
Create Accompanying Course: Créer un nouveau parcours
Drop Accompanying Course: Supprimer le parcours
This course is located at a temporary address. You should link this course to a user: Le parcours est localisé à une adresse temporaire. Il devrait être localisé auprès d'une personne concernée.
This course is located at a temporarily address. You should locate this course to an user: Le parcours est localisé à une adresse temporaire. Il devrait être localisé auprès d'une personne concernée.
Accompanying course location: Localisation du parcours
This course is located by: Localisé auprès de
This course has a temporarily location: Localisation temporaire
Choose a person to locate by: Localiser auprès d'un usager concerné
Associate at least one member with a household, and set an address to this household: Associez au moins un membre du parcours à un ménage, et indiquez une adresse à ce ménage.
Associate at least one member with an household, and set an address to this household: Associez au moins un membre du parcours à un ménage, et indiquez une adresse à ce ménage.
Locate by: Localiser auprès de
fix it: Compléter
accompanying_course:

View File

@@ -16,19 +16,13 @@ use Chill\TaskBundle\Security\Authorization\TaskVoter;
use Knp\Menu\MenuItem;
use LogicException;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class MenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
protected AuthorizationCheckerInterface $authorizationChecker;
/**
* @var TranslatorInterface
*/
protected $translator;
protected TranslatorInterface $translator;
public function __construct(
AuthorizationCheckerInterface $authorizationChecker,

View File

@@ -15,19 +15,13 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\TaskBundle\Security\Authorization\TaskVoter;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class SectionMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
public $authorizationChecker;
public AuthorizationCheckerInterface $authorizationChecker;
/**
* @var TranslatorInterface
*/
public $translator;
public TranslatorInterface $translator;
public function __construct(
AuthorizationCheckerInterface $authorizationChecker,

View File

@@ -17,29 +17,17 @@ use Chill\TaskBundle\Templating\UI\CountNotificationTask;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class UserMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
public $authorizationChecker;
public AuthorizationCheckerInterface $authorizationChecker;
/**
* @var CountNotificationTask
*/
public $counter;
public CountNotificationTask $counter;
/**
* @var TokenStorageInterface
*/
public $tokenStorage;
public TokenStorageInterface $tokenStorage;
/**
* @var TranslatorInterface
*/
public $translator;
public TranslatorInterface $translator;
public function __construct(
CountNotificationTask $counter,

View File

@@ -19,11 +19,9 @@
<a class="btn btn-cancel" href={% if task.person is not null %}"{{ chill_return_path_or('chill_task_singletask_list', { 'person_id': task.person.id } ) }}"{% else %}"{{ chill_return_path_or('chill_task_singletask_courselist', {'course_id': task.course.id}) }}" {% endif %}>
{{ 'Cancel'|trans }}</a>
</li>
{% if is_granted('CHILL_TASK_TASK_UPDATE', task) %}
<li>
{{ form_widget(form.submit, { 'label': 'Save task', 'attr': {'class' : 'btn btn-update'}})}}
</li>
{% endif %}
<li>
{{ form_widget(form.submit, { 'label': 'Save task', 'attr': {'class' : 'btn btn-update'}})}}
</li>
</ul>
{{ form_end(form) }}
</div>

View File

@@ -15,22 +15,16 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Add an entry in section to go to third party index page.
*/
class MenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
protected AuthorizationCheckerInterface $authorizationChecker;
/**
* @var TranslatorInterface
*/
protected $translator;
protected TranslatorInterface $translator;
public function __construct(
AuthorizationCheckerInterface $authorizationChecker,