mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
list for workflows: previous and old workflows
This commit is contained in:
parent
18836f312a
commit
bf25740098
@ -166,6 +166,66 @@ class WorkflowController extends AbstractController
|
|||||||
return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflowStep->getEntityWorkflow()->getId()]);
|
return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflowStep->getEntityWorkflow()->getId()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Previous workflows where the user has applyed a transition.
|
||||||
|
*
|
||||||
|
* @Route("/{_locale}/main/workflow/list/previous_transitionned", name="chill_main_workflow_list_previous_transitionned")
|
||||||
|
*/
|
||||||
|
public function myPreviousWorkflowsTransitionned(Request $request): Response
|
||||||
|
{
|
||||||
|
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||||
|
|
||||||
|
$total = $this->entityWorkflowRepository->countByPreviousTransitionned($this->getUser());
|
||||||
|
$paginator = $this->paginatorFactory->create($total);
|
||||||
|
|
||||||
|
$workflows = $this->entityWorkflowRepository->findByPreviousTransitionned(
|
||||||
|
$this->getUser(),
|
||||||
|
['createdAt' => 'DESC'],
|
||||||
|
$paginator->getItemsPerPage(),
|
||||||
|
$paginator->getCurrentPageFirstItemNumber()
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this->render(
|
||||||
|
'@ChillMain/Workflow/list.html.twig',
|
||||||
|
[
|
||||||
|
'help' => 'workflow.Previous workflow transitionned help',
|
||||||
|
'workflows' => $this->buildHandler($workflows),
|
||||||
|
'paginator' => $paginator,
|
||||||
|
'step' => 'previous_transitionned',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Previous workflows where the user was mentioned, but did not give any reaction.
|
||||||
|
*
|
||||||
|
* @Route("/{_locale}/main/workflow/list/previous_without_reaction", name="chill_main_workflow_list_previous_without_reaction")
|
||||||
|
*/
|
||||||
|
public function myPreviousWorkflowsWithoutReaction(Request $request): Response
|
||||||
|
{
|
||||||
|
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||||
|
|
||||||
|
$total = $this->entityWorkflowRepository->countByPreviousDestWithoutReaction($this->getUser());
|
||||||
|
$paginator = $this->paginatorFactory->create($total);
|
||||||
|
|
||||||
|
$workflows = $this->entityWorkflowRepository->findByPreviousDestWithoutReaction(
|
||||||
|
$this->getUser(),
|
||||||
|
['createdAt' => 'DESC'],
|
||||||
|
$paginator->getItemsPerPage(),
|
||||||
|
$paginator->getCurrentPageFirstItemNumber()
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this->render(
|
||||||
|
'@ChillMain/Workflow/list.html.twig',
|
||||||
|
[
|
||||||
|
'help' => 'workflow.Previous workflow without reaction help',
|
||||||
|
'workflows' => $this->buildHandler($workflows),
|
||||||
|
'paginator' => $paginator,
|
||||||
|
'step' => 'previous_without_reaction',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{_locale}/main/workflow/list/dest", name="chill_main_workflow_list_dest")
|
* @Route("/{_locale}/main/workflow/list/dest", name="chill_main_workflow_list_dest")
|
||||||
*/
|
*/
|
||||||
|
@ -34,6 +34,20 @@ class EntityWorkflowRepository implements ObjectRepository
|
|||||||
return (int) $qb->getQuery()->getSingleScalarResult();
|
return (int) $qb->getQuery()->getSingleScalarResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countByPreviousDestWithoutReaction(User $user): int
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryByPreviousDestWithoutReaction($user)->select('count(ew)');
|
||||||
|
|
||||||
|
return (int) $qb->getQuery()->getSingleScalarResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countByPreviousTransitionned(User $user): int
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryByPreviousTransitionned($user)->select('count(ew)');
|
||||||
|
|
||||||
|
return (int) $qb->getQuery()->getSingleScalarResult();
|
||||||
|
}
|
||||||
|
|
||||||
public function countBySubscriber(User $user): int
|
public function countBySubscriber(User $user): int
|
||||||
{
|
{
|
||||||
$qb = $this->buildQueryBySubscriber($user)->select('count(ew)');
|
$qb = $this->buildQueryBySubscriber($user)->select('count(ew)');
|
||||||
@ -78,6 +92,32 @@ class EntityWorkflowRepository implements ObjectRepository
|
|||||||
return $qb->getQuery()->getResult();
|
return $qb->getQuery()->getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function findByPreviousDestWithoutReaction(User $user, ?array $orderBy = null, $limit = null, $offset = null): array
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryByPreviousDestWithoutReaction($user)->select('ew');
|
||||||
|
|
||||||
|
foreach ($orderBy as $key => $sort) {
|
||||||
|
$qb->addOrderBy('ew.' . $key, $sort);
|
||||||
|
}
|
||||||
|
|
||||||
|
$qb->setMaxResults($limit)->setFirstResult($offset);
|
||||||
|
|
||||||
|
return $qb->getQuery()->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findByPreviousTransitionned(User $user, ?array $orderBy = null, $limit = null, $offset = null): array
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryByPreviousTransitionned($user)->select('ew')->distinct(true);
|
||||||
|
|
||||||
|
foreach ($orderBy as $key => $sort) {
|
||||||
|
$qb->addOrderBy('ew.' . $key, $sort);
|
||||||
|
}
|
||||||
|
|
||||||
|
$qb->setMaxResults($limit)->setFirstResult($offset);
|
||||||
|
|
||||||
|
return $qb->getQuery()->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
public function findBySubscriber(User $user, ?array $orderBy = null, $limit = null, $offset = null): array
|
public function findBySubscriber(User $user, ?array $orderBy = null, $limit = null, $offset = null): array
|
||||||
{
|
{
|
||||||
$qb = $this->buildQueryBySubscriber($user)->select('ew');
|
$qb = $this->buildQueryBySubscriber($user)->select('ew');
|
||||||
@ -120,6 +160,41 @@ class EntityWorkflowRepository implements ObjectRepository
|
|||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function buildQueryByPreviousDestWithoutReaction(User $user): QueryBuilder
|
||||||
|
{
|
||||||
|
$qb = $this->repository->createQueryBuilder('ew');
|
||||||
|
|
||||||
|
$qb->join('ew.steps', 'step');
|
||||||
|
|
||||||
|
$qb->where(
|
||||||
|
$qb->expr()->andX(
|
||||||
|
$qb->expr()->isMemberOf(':user', 'step.destUser'),
|
||||||
|
$qb->expr()->neq('step.transitionBy', ':user'),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$qb->setParameter('user', $user);
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildQueryByPreviousTransitionned(User $user): QueryBuilder
|
||||||
|
{
|
||||||
|
$qb = $this->repository->createQueryBuilder('ew');
|
||||||
|
|
||||||
|
$qb->join('ew.steps', 'step');
|
||||||
|
|
||||||
|
$qb->where(
|
||||||
|
$qb->expr()->andX(
|
||||||
|
$qb->expr()->eq('step.transitionBy', ':user'),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$qb->setParameter('user', $user);
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
|
|
||||||
private function buildQueryBySubscriber(User $user): QueryBuilder
|
private function buildQueryBySubscriber(User $user): QueryBuilder
|
||||||
{
|
{
|
||||||
$qb = $this->repository->createQueryBuilder('ew');
|
$qb = $this->repository->createQueryBuilder('ew');
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
<h1 class="mb-5">{{ block('title') }}</h1>
|
<h1 class="mb-5">{{ block('title') }}</h1>
|
||||||
|
|
||||||
|
|
||||||
<ul class="nav nav-pills justify-content-center">
|
<ul class="nav nav-pills justify-content-center">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{ path('chill_main_workflow_list_subscribed') }}"
|
<a href="{{ path('chill_main_workflow_list_subscribed') }}"
|
||||||
@ -24,8 +25,24 @@
|
|||||||
{{ 'workflow.dest'|trans }}
|
{{ 'workflow.dest'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="{{ path('chill_main_workflow_list_previous_without_reaction') }}"
|
||||||
|
class="nav-link {% if step == 'previous_without_reaction' %}active{% endif %}">
|
||||||
|
{{ 'workflow.Previous dest without reaction'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="{{ path('chill_main_workflow_list_previous_transitionned') }}"
|
||||||
|
class="nav-link {% if step == 'previous_transitionned' %}active{% endif %}">
|
||||||
|
{{ 'workflow.Previous transitionned'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
{% if help is defined %}
|
||||||
|
<p style="margin-top: 2rem;">{{ help|trans }}</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if workflows|length == 0 %}
|
{% if workflows|length == 0 %}
|
||||||
<p class="chill-no-data-statement">{{ 'workflow.No workflow'|trans }}</p>
|
<p class="chill-no-data-statement">{{ 'workflow.No workflow'|trans }}</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -408,6 +408,10 @@ workflow:
|
|||||||
Add an email: Ajouter une adresse email
|
Add an email: Ajouter une adresse email
|
||||||
Remove an email: Enlever cette adresse email
|
Remove an email: Enlever cette adresse email
|
||||||
Any email: Aucune adresse email
|
Any email: Aucune adresse email
|
||||||
|
Previous dest without reaction: Workflows clotûrés après action d'un autre utilisateur
|
||||||
|
Previous workflow without reaction help: Liste des workflows où vous avez été cité comme pouvant réagir à une étape, mais où un autre utilisateur a exécuté une action avant vous.
|
||||||
|
Previous transitionned: Anciens workflows
|
||||||
|
Previous workflow transitionned help: Workflows où vous avez exécuté une action.
|
||||||
|
|
||||||
|
|
||||||
Subscribe final: Recevoir une notification à l'étape finale
|
Subscribe final: Recevoir une notification à l'étape finale
|
||||||
|
Loading…
x
Reference in New Issue
Block a user