mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
add notification service for AccompanyingPeriodWork in show
This commit is contained in:
parent
4a30f310b8
commit
ecb8ef0146
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Notification;
|
||||
|
||||
use Chill\MainBundle\Entity\Notification;
|
||||
use Chill\MainBundle\Notification\NotificationHandlerInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
||||
|
||||
final class AccompanyingPeriodWorkNotificationHandler implements NotificationHandlerInterface
|
||||
{
|
||||
private AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository;
|
||||
|
||||
public function __construct(AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository)
|
||||
{
|
||||
$this->accompanyingPeriodWorkRepository = $accompanyingPeriodWorkRepository;
|
||||
}
|
||||
|
||||
public function getTemplate(Notification $notification, array $options = []): string
|
||||
{
|
||||
return 'ChillPersonBundle:AccompanyingCourseWork:showInNotification.html.twig';
|
||||
}
|
||||
|
||||
public function getTemplateData(Notification $notification, array $options = []): array
|
||||
{
|
||||
return [
|
||||
'notification' => $notification,
|
||||
'work' => $this->accompanyingPeriodWorkRepository->find($notification->getRelatedEntityId()),
|
||||
];
|
||||
}
|
||||
|
||||
public function supports(Notification $notification, array $options = []): bool
|
||||
{
|
||||
return $notification->getRelatedEntityClass() === AccompanyingPeriodWork::class;
|
||||
}
|
||||
}
|
@ -129,6 +129,13 @@
|
||||
|
||||
{% if displayAction is defined and displayAction == true %}
|
||||
<ul class="item-col record_actions">
|
||||
|
||||
<li>
|
||||
<a class="btn btn-notify" title="{{ 'notification.Notify'|trans }}"
|
||||
href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork', 'entityId': w.id}) }}">
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li>{{ macro.workflowButton(w) }}</li>
|
||||
<li>
|
||||
<a class="btn btn-show" title="{{ 'Show'|trans }}"
|
||||
|
@ -36,18 +36,39 @@
|
||||
class="btn btn-cancel">{{ 'Back to the list'|trans }}</a>
|
||||
</li>
|
||||
<li>{{ macro.workflowButton(work) }}</li>
|
||||
<li>
|
||||
<div class="d-grid gap-2 {% if accompanyingCourse.hasUser and accompanyingCourse.user is not same as(app.user) %}btn-group{% endif %}" {% if accompanyingCourse.hasUser and accompanyingCourse.user is not same as(app.user) %}role="group"{% endif %}>
|
||||
{% if accompanyingCourse.hasUser and accompanyingCourse.user is not same as(app.user) %}
|
||||
<button id="btnGroupNotifyButtons" type="button" class="btn btn-notify dropdown-toggle" title="{{ 'notification.Notify'|trans }}" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="btnGroupNotifyButtons">
|
||||
<li>
|
||||
<a class="dropdown-item" title="{{ 'notification.Notify referrer'|trans }}" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork', 'entityId': work.id, 'tos': [accompanyingCourse.user.id]}) }}"></a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item" title="{{ 'notification.Notify any'|trans }}" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork', 'entityId': work.id}) }}"></a>
|
||||
</li>
|
||||
</ul>
|
||||
{% else %}
|
||||
<a class="btn btn-notify" title="{{ 'notification.Notify'|trans }}" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork', 'entityId': work.id}) }}">
|
||||
</a>
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>{{ work.id }}
|
||||
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', work) %}
|
||||
<li>
|
||||
<a class="btn btn-edit"
|
||||
<a class="btn btn-edit" title="{{ 'Edit'|trans }}"
|
||||
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': work.id }) }}"
|
||||
>{{ 'Edit'|trans }}</a>
|
||||
></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_DELETE', work) %}
|
||||
<li>
|
||||
<a class="btn btn-delete"
|
||||
href="{{ path('chill_person_accompanying_period_work_delete', { 'id': work.id } ) }}"
|
||||
>{{ 'Delete'|trans }}</a>
|
||||
title = "{{ 'Delete'|trans }}"
|
||||
></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
@ -0,0 +1,28 @@
|
||||
{% macro recordAction(work) %}
|
||||
<li>
|
||||
<a href={{ path('chill_person_accompanying_period_work_list', { 'id': accompanyingCourse.id }) }}""
|
||||
class="btn btn-show" title="{{ 'See accompanying period'|trans }}"></a>
|
||||
</li>
|
||||
{% endmacro %}
|
||||
{% if work is not null %}
|
||||
<div class="flex-table">
|
||||
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', work) %}
|
||||
{% else %}
|
||||
{% endif %}
|
||||
{% include 'ChillPersonBundle:AccompanyingCourseWork:_item.html.twig' with {
|
||||
'itemBlocClass': 'bg-chill-llight-gray',
|
||||
'displayAction': true,
|
||||
'displayContent': 'short',
|
||||
'displayFontSmall': true,
|
||||
'w': work
|
||||
} %}
|
||||
<div class="alert alert-warning border-warning border-1">
|
||||
{{ 'This is the minimal period details'|trans ~ ': ' ~ work.id }}<br>
|
||||
{{ 'You are getting a notification for a period you are not allowed to see'|trans }}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-warning border-warning border-1">
|
||||
{{ 'You are getting a notification for a period which does not exists any more'|trans }}
|
||||
</div>
|
||||
{% endif %}
|
@ -6,6 +6,7 @@
|
||||
{% endmacro %}
|
||||
|
||||
{% if period is not null %}
|
||||
{{ dump(period) }}
|
||||
<div class="flex-table">
|
||||
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', period) %}
|
||||
{% include 'ChillPersonBundle:AccompanyingPeriod:_list_item.html.twig' with {
|
||||
|
@ -2,3 +2,6 @@ services:
|
||||
Chill\PersonBundle\Notification\AccompanyingPeriodNotificationHandler:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
Chill\PersonBundle\Notification\AccompanyingPeriodWorkNotificationHandler:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user