mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-13 11:19:51 +00:00
Merge branch 'master' into privacyEvent
This commit is contained in:
commit
d8a77b5fdf
9
CHANGELOG.md
Normal file
9
CHANGELOG.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Branch master
|
||||||
|
=============
|
||||||
|
|
||||||
|
- fix bug in filter task form: allow to show the list of users, which was hidden when the user had access to multiple centers;
|
||||||
|
- add assignee in task list;
|
||||||
|
- fix some translation;
|
||||||
|
- add a filtering by center on list;
|
||||||
|
- add color in boxes for task statuses;
|
||||||
|
|
@ -26,6 +26,7 @@ use Chill\TaskBundle\Event\TaskEvent;
|
|||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\Translation\TranslatorInterface;
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
use Chill\TaskBundle\Event\UI\UIEvent;
|
use Chill\TaskBundle\Event\UI\UIEvent;
|
||||||
|
use Chill\MainBundle\Repository\CenterRepository;
|
||||||
|
|
||||||
|
|
||||||
class SingleTaskController extends Controller
|
class SingleTaskController extends Controller
|
||||||
@ -382,6 +383,7 @@ class SingleTaskController extends Controller
|
|||||||
PaginatorFactory $paginatorFactory,
|
PaginatorFactory $paginatorFactory,
|
||||||
SingleTaskRepository $taskRepository,
|
SingleTaskRepository $taskRepository,
|
||||||
PersonRepository $personRepository,
|
PersonRepository $personRepository,
|
||||||
|
CenterRepository $centerRepository,
|
||||||
FormFactoryInterface $formFactory
|
FormFactoryInterface $formFactory
|
||||||
) {
|
) {
|
||||||
/* @var $viewParams array The parameters for the view */
|
/* @var $viewParams array The parameters for the view */
|
||||||
@ -392,7 +394,6 @@ class SingleTaskController extends Controller
|
|||||||
$viewParams['user'] = null;
|
$viewParams['user'] = null;
|
||||||
$params['user'] = null;
|
$params['user'] = null;
|
||||||
$viewParams['center'] = null;
|
$viewParams['center'] = null;
|
||||||
$params['center'] = null;
|
|
||||||
$params['types'] = null;
|
$params['types'] = null;
|
||||||
|
|
||||||
// Get parameters from url
|
// Get parameters from url
|
||||||
@ -408,6 +409,14 @@ class SingleTaskController extends Controller
|
|||||||
|
|
||||||
$viewParams['person'] = $person;
|
$viewParams['person'] = $person;
|
||||||
$params['person'] = $person;
|
$params['person'] = $person;
|
||||||
|
} elseif (!empty($request->query->get('center_id', NULL))) {
|
||||||
|
$center = $centerRepository->find($request->query->getInt('center_id'));
|
||||||
|
dump($center);
|
||||||
|
if ($center === null) {
|
||||||
|
throw $this->createNotFoundException('center not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$params['center'] = $center;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($request->query->get('types', []))) {
|
if(!empty($request->query->get('types', []))) {
|
||||||
|
@ -136,6 +136,17 @@ class SingleTaskListType extends AbstractType
|
|||||||
'label' => 'Associated person'
|
'label' => 'Associated person'
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
|
$reachablesCenters = $this->getReachablesCenters();
|
||||||
|
if (count($reachablesCenters) > 1) {
|
||||||
|
$builder
|
||||||
|
->add('center_id', EntityType::class, [
|
||||||
|
'class' => \Chill\MainBundle\Entity\Center::class,
|
||||||
|
'choices' => $reachablesCenters,
|
||||||
|
'label' => 'Center',
|
||||||
|
'required' => false,
|
||||||
|
'placeholder' => 'All centers'
|
||||||
|
]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// add a hidden field
|
// add a hidden field
|
||||||
$builder
|
$builder
|
||||||
@ -144,6 +155,7 @@ class SingleTaskListType extends AbstractType
|
|||||||
->addModelTransformer(new PersonToIdTransformer($this->em))
|
->addModelTransformer(new PersonToIdTransformer($this->em))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getUserChoices($options)
|
protected function getUserChoices($options)
|
||||||
@ -237,10 +249,11 @@ class SingleTaskListType extends AbstractType
|
|||||||
}
|
}
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
$circleCenterCond = $qb->expr()->orX();
|
||||||
foreach ($centers as $center) {
|
foreach ($centers as $center) {
|
||||||
$circles = $this->authorizationHelper->getReachableCircles($user, $role, $center);
|
$circles = $this->authorizationHelper->getReachableCircles($user, $role, $center);
|
||||||
// add condition about person and circle
|
// add condition about person and circle
|
||||||
$qb->andWhere(
|
$circleCenterCond->add(
|
||||||
$qb->expr()->andX()
|
$qb->expr()->andX()
|
||||||
->add($qb->expr()->eq('person.center', ':center_'.$i))
|
->add($qb->expr()->eq('person.center', ':center_'.$i))
|
||||||
->add($qb->expr()->in('task.circle', ':circles_'.$i))
|
->add($qb->expr()->in('task.circle', ':circles_'.$i))
|
||||||
@ -252,10 +265,19 @@ class SingleTaskListType extends AbstractType
|
|||||||
// increase counter
|
// increase counter
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
$qb->andWhere($circleCenterCond);
|
||||||
|
|
||||||
return $qb->getQuery()->getResult();
|
return $qb->getQuery()->getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getReachablesCenters()
|
||||||
|
{
|
||||||
|
$user = $this->tokenStorage->getToken()->getUser();
|
||||||
|
$role = new Role(TaskVoter::SHOW);
|
||||||
|
|
||||||
|
return $this->authorizationHelper->getReachableCenters($user, $role);
|
||||||
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
{
|
{
|
||||||
$resolver
|
$resolver
|
||||||
|
@ -8,6 +8,7 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
|||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
use Chill\TaskBundle\Security\Authorization\TaskVoter;
|
use Chill\TaskBundle\Security\Authorization\TaskVoter;
|
||||||
use Doctrine\DBAL\Types\Type;
|
use Doctrine\DBAL\Types\Type;
|
||||||
|
use Chill\MainBundle\Entity\Center;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SingleTaskRepository
|
* SingleTaskRepository
|
||||||
@ -107,6 +108,14 @@ class SingleTaskRepository extends \Doctrine\ORM\EntityRepository
|
|||||||
if (\array_key_exists('person', $params) and !empty($params['person'])) {
|
if (\array_key_exists('person', $params) and !empty($params['person'])) {
|
||||||
$qb->andWhere($qb->expr()->eq('st.person', ':person'));
|
$qb->andWhere($qb->expr()->eq('st.person', ':person'));
|
||||||
$qb->setParameter('person', $params['person']);
|
$qb->setParameter('person', $params['person']);
|
||||||
|
} elseif (\array_key_exists('center', $params)) {
|
||||||
|
if ($params['center'] instanceof Center) {
|
||||||
|
$qb->join('st.person', 'person');
|
||||||
|
$qb->andWhere($qb->expr()->eq('person.center', ':center'));
|
||||||
|
$qb->setParameter('center', $params['center']);
|
||||||
|
} else {
|
||||||
|
throw new \UnexpectedValueException("params 'center' should be an instance of ".Center::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\array_key_exists('unassigned', $params) and $params['unassigned'] === true) {
|
if (\array_key_exists('unassigned', $params) and $params['unassigned'] === true) {
|
||||||
|
34
Resources/public/sass/_task-statuses.scss
Normal file
34
Resources/public/sass/_task-statuses.scss
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
.task-status {
|
||||||
|
&.box {
|
||||||
|
font-variant: small-caps;
|
||||||
|
display: inline;
|
||||||
|
padding: .2em .6em .3em;
|
||||||
|
font-size: 0.88rem;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 1;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: baseline;
|
||||||
|
border-radius: .25em;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.type-task_default {
|
||||||
|
// 'new', 'in_progress', 'closed', 'canceled'
|
||||||
|
&.place-new {
|
||||||
|
background-color: var(--chill-yellow);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.place-in_progress {
|
||||||
|
background-color: var(--chill-green);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.place-closed {
|
||||||
|
background-color: var(--chill-blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.place-canceled {
|
||||||
|
background-color: var(--chill-beige);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
@import '../../../../main/Resources/public/sass/custom/config/colors';
|
@import '../../../../main/Resources/public/sass/custom/config/colors';
|
||||||
|
@import "_task-statuses.scss";
|
||||||
|
|
||||||
div#single_task_warningInterval {
|
div#single_task_warningInterval {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -59,7 +59,7 @@ Any user: Tous les utilisateurs
|
|||||||
Unassigned: Non assigné
|
Unassigned: Non assigné
|
||||||
Associated person: Personne associée
|
Associated person: Personne associée
|
||||||
Default task: Tâche par défaut
|
Default task: Tâche par défaut
|
||||||
|
Not assigned: Aucun utilisateur assigné
|
||||||
|
|
||||||
# transitions - default task definition
|
# transitions - default task definition
|
||||||
'new': 'nouvelle'
|
'new': 'nouvelle'
|
||||||
@ -99,3 +99,5 @@ My tasks over deadline: Mes tâches à échéance dépassée
|
|||||||
|
|
||||||
#transition page
|
#transition page
|
||||||
Apply transition on task <em>%title%</em>: Appliquer la transition sur la tâche <em>%title%</em>
|
Apply transition on task <em>%title%</em>: Appliquer la transition sur la tâche <em>%title%</em>
|
||||||
|
|
||||||
|
All centers: Tous les centres
|
||||||
|
@ -24,8 +24,16 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<td>
|
<td>
|
||||||
{% for place in workflow_marked_places(task) %}
|
{% for place in workflow_marked_places(task) %}
|
||||||
<span class="">{{ place|trans }}</span>
|
<span class="task-status box type-{{ task.type }} place-{{ place }}">{{ place|trans }}</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if task.assignee is not null %}
|
||||||
|
<dl>
|
||||||
|
<dt>{{ 'Assignee'|trans }}</dt>
|
||||||
|
<dd>{{ task.assignee.username }}</dd>
|
||||||
|
</dl>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if task.startDate is null and task.warningDate is null and task.endDate is null %}
|
{% if task.startDate is null and task.warningDate is null and task.endDate is null %}
|
||||||
@ -160,6 +168,10 @@
|
|||||||
{{ form_row(form.person_id) }}
|
{{ form_row(form.person_id) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if form.center_id is defined %}
|
||||||
|
{{ form_row(form.center_id) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<button type="submit" class="sc-button">{{ 'Filter'|trans }}</button>
|
<button type="submit" class="sc-button">{{ 'Filter'|trans }}</button>
|
||||||
|
@ -25,17 +25,12 @@
|
|||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
<h1 class="chill-red">{{ 'Task'|trans }}</h1>
|
<h1 class="chill-red">{{ 'Task'|trans }}</h1>
|
||||||
|
|
||||||
<h2>{{ task.title }}</h2>
|
<h2>{{ task.title }} {% for place in workflow_marked_places(task) %}
|
||||||
|
<span class="task-status box type-{{ task.type }} place-{{ place }}">{{ place|trans }}</span>
|
||||||
|
{% endfor %}</h2>
|
||||||
|
|
||||||
<dl class="chill_view_data">
|
<dl class="chill_view_data">
|
||||||
|
|
||||||
<dt class="inline">{{ 'Task status'|trans }}</dt>
|
|
||||||
<dd>
|
|
||||||
{% for place in workflow_marked_places(task) %}
|
|
||||||
<span class="">{{ place|trans }}</span>
|
|
||||||
{% endfor %}
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dt class="inline">{{ 'Description'|trans }}</dt>
|
<dt class="inline">{{ 'Description'|trans }}</dt>
|
||||||
<dd>
|
<dd>
|
||||||
{% if task.description is empty %}
|
{% if task.description is empty %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user