From f230d661d4ffeef1861ade891361732a1456bb28 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 2 May 2018 09:38:50 +0200 Subject: [PATCH 1/5] add links to person name in the table --- Resources/views/SingleTask/_list.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/SingleTask/_list.html.twig b/Resources/views/SingleTask/_list.html.twig index f3f5dfb3f..ccbf69ee8 100644 --- a/Resources/views/SingleTask/_list.html.twig +++ b/Resources/views/SingleTask/_list.html.twig @@ -20,7 +20,7 @@ {{ task.title }} {{ task.type }} {% if person is null %} - {{ task.person }} + {{ task.person}} {% endif %} {% for place in workflow_marked_places(task) %} From 92621f174f958cd6d05411bdf9053b2420b1c75b Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 2 May 2018 10:49:02 +0200 Subject: [PATCH 2/5] fix typo in flash messages --- Controller/TaskController.php | 4 ++-- Resources/translations/messages.fr.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Controller/TaskController.php b/Controller/TaskController.php index bd3ab33a2..578c2f857 100644 --- a/Controller/TaskController.php +++ b/Controller/TaskController.php @@ -71,10 +71,10 @@ class TaskController extends Controller $em->flush(); - $this->addFlash('success', 'The transition is sucessfully appliyed'); + $this->addFlash('success', 'The transition is successfully applied'); } else { - $this->addFlash('error', 'The transition could not be appliyed'); + $this->addFlash('error', 'The transition could not be applied'); } return $this->redirect($request->query->get('return_path', $defaultReturnPath)); diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index f9d54eb57..876741687 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -65,5 +65,5 @@ cancel: annuler 'The task has been successfully removed.': 'La tâche a bien été supprimée' 'This form contains errors': 'Ce formulaire contient des erreurs' 'The task has been updated': 'La tâche a été mise à jour' -'The transition is sucessfully applyed': 'La transition a bien été effectuée' -'The transition could not be applyed': "La transition n'a pas pu être appliquée" +'The transition is successfully applied': 'La transition a bien été effectuée' +'The transition could not be applied': "La transition n'a pas pu être appliquée" From 682f08dbbb1635e0acc91f8cce9f241a79f21652 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 2 May 2018 14:41:53 +0200 Subject: [PATCH 3/5] fix typo in translations --- Resources/translations/messages.fr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index 876741687..e69606967 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -26,9 +26,9 @@ User: Utilisateur 'Task start date': 'Date de début' 'Task warning date': "Date d'avertissement" 'Task end date': "Date d'échéance" -'Start': 'Début: ' -'Warning': 'Avertissement: ' -'End': 'Échéance: ' +'Start': 'Début' +'Warning': 'Avertissement' +'End': 'Échéance' 'Task type': 'Type' 'Task status': 'Statut' 'Edit the task': 'Éditer la tâche' From a3cc95784c1028ecc330661dd8d8a1f4619f229f Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 May 2018 22:41:03 +0200 Subject: [PATCH 4/5] fix issue with dropdown buttons --- Resources/public/sass/_task.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Resources/public/sass/_task.scss b/Resources/public/sass/_task.scss index b5973c012..0aa0a4c4a 100644 --- a/Resources/public/sass/_task.scss +++ b/Resources/public/sass/_task.scss @@ -73,8 +73,10 @@ div#single_task_warningInterval { position: absolute; background-color: #f9f9f9; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); - padding: 0.4em 0.7em; z-index: 1; + a { + margin: 0.4em; + } } .bt-dropdown:hover .bt-dropdown-content { From c2a5ab2e69ff3e01af45bb2d141580c968a72381 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 May 2018 22:43:53 +0200 Subject: [PATCH 5/5] add form for filtering - work in progress --- Controller/SingleTaskController.php | 64 +++++++++++++++++++++- Form/SingleTaskListType.php | 62 +++++++++++++++++++++ Resources/views/SingleTask/_list.html.twig | 47 +++++++++------- Resources/views/SingleTask/index.html.twig | 4 +- 4 files changed, 154 insertions(+), 23 deletions(-) create mode 100644 Form/SingleTaskListType.php diff --git a/Controller/SingleTaskController.php b/Controller/SingleTaskController.php index d5a460432..7e9cb4f59 100644 --- a/Controller/SingleTaskController.php +++ b/Controller/SingleTaskController.php @@ -10,6 +10,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Chill\TaskBundle\Entity\SingleTask; use Chill\TaskBundle\Form\SingleTaskType; +use Chill\TaskBundle\Form\SingleTaskListType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormFactoryInterface; use Chill\TaskBundle\Security\Authorization\TaskVoter; @@ -427,7 +428,68 @@ class SingleTaskController extends Controller $viewParams['layout'] = 'ChillMainBundle::layout.html.twig'; } - return $this->render('ChillTaskBundle:SingleTask:index.html.twig', $viewParams); + // Form for filtering tasks + $form = $this->createForm(SingleTaskListType::class, null, [ + //'center' => $task->getCenter() + ]); + + $form->add('submit', SubmitType::class); + + $form->handleRequest($request); + + if ($form->isSubmitted()) { + if ($form->isValid()) { + + $formData = $form->getData(); + + $status = $statuses[$formData['status']]; + $viewParamsForm['user'] = $formData['user']; + $viewParamsForm['isSingleStatus'] = $singleStatus = count($statuses) === 1; + + // herit some parameters from the page + $viewParamsForm['person'] = $viewParams['person']; + $viewParamsForm['layout'] = $viewParams['layout']; + + // different query if regarding to date or 'closed' + if (in_array($status, SingleTaskRepository::DATE_STATUSES)) { + $params['date_status'] = $status; + $params['is_closed'] = false; + } else { + $params['date_status'] = null; + $params['is_closed'] = true; + } + + $count = $taskRepository + ->countByParameters($params, $formData['user']) + ; + $paginator = $paginatorFactory->create($count); + + $viewParamsForm['single_task_'.$status.'_count'] = $count; + $viewParamsForm['single_task_'.$status.'_paginator'] = $paginator; + $viewParamsForm['single_task_'.$status.'_tasks'] = $taskRepository + ->findByParameters($params, $formData['user'], + $singleStatus ? $paginator->getCurrentPage()->getFirstItemNumber() : 0, + $singleStatus ? $paginator->getItemsPerPage() : 10) + ; + + // total number of tasks + $viewParamsForm['tasks_count'] = $count; + + return $this->render('ChillTaskBundle:SingleTask:index.html.twig', array( + 'view' => $viewParamsForm, + 'form' => $form->createView() + )); + + } else { + $this->addFlash('error', "wrong test"); + } + } + + dump($viewParams); + return $this->render('ChillTaskBundle:SingleTask:index.html.twig', array( + 'view' => $viewParams, + 'form' => $form->createView() + )); } diff --git a/Form/SingleTaskListType.php b/Form/SingleTaskListType.php new file mode 100644 index 000000000..b9e2ab9e2 --- /dev/null +++ b/Form/SingleTaskListType.php @@ -0,0 +1,62 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +namespace Chill\TaskBundle\Form; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Chill\MainBundle\Entity\Scope; +use Chill\MainBundle\Entity\Center; +use Chill\MainBundle\Entity\User; +use Chill\MainBundle\Form\Type\ScopePickerType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Chill\TaskBundle\Repository\SingleTaskRepository; + +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * + * + * @author Julien Fastré + */ +class SingleTaskListType extends AbstractType +{ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->add('user', EntityType::class, [ + 'class' => 'Chill\MainBundle\Entity\User' + ]) + ->add('status', ChoiceType::class, [ + 'choices' => array_flip(\array_merge(SingleTaskRepository::DATE_STATUSES, [ 'closed' ])), + 'expanded' => false, + 'multiple' => false + ]) + + ; + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver + // ->setRequired('center') + // ->setAllowedTypes('center', [ Center::class ]) + ; + } +} diff --git a/Resources/views/SingleTask/_list.html.twig b/Resources/views/SingleTask/_list.html.twig index ccbf69ee8..cb2aa71a7 100644 --- a/Resources/views/SingleTask/_list.html.twig +++ b/Resources/views/SingleTask/_list.html.twig @@ -56,9 +56,9 @@
 
- {% for transition in workflow_transitions(task) %} - {{ task_workflow_metadata(task, 'transition.verb', transition)|trans }} - {% endfor %} + {% for transition in workflow_transitions(task) %} + {{ task_workflow_metadata(task, 'transition.verb', transition)|trans }} + {% endfor %}
@@ -140,51 +140,58 @@

{{ 'Task list'|trans }}

- {% if tasks_count == 0 %} + +

Filter the tasks

+ {{ form_start(form) }} + {{ form_row(form.user) }} + {{ form_row(form.status) }} + {{ form_end(form)}} + + {% if view.tasks_count == 0 %}

{{ "There is no tasks."|trans }}

- {% if person is not null %} - + {% if view.person is not null %} + {{ 'Add a new task' | trans }} {% endif %} - {% else %} - {% if single_task_ended_tasks is defined %} - {{ helper.date_status('Tasks with expired deadline', single_task_ended_tasks, single_task_ended_count, single_task_ended_paginator, 'ended', isSingleStatus, person) }} + {% if view.single_task_ended_tasks is defined %} + {{ helper.date_status('Tasks with expired deadline', view.single_task_ended_tasks, view.single_task_ended_count, view.single_task_ended_paginator, 'ended', view.isSingleStatus, view.person) }} {% endif %} - {% if single_task_warning_tasks is defined %} - {{ helper.date_status('Tasks with warning deadline reached', single_task_warning_tasks, single_task_warning_count, single_task_warning_paginator, 'warning', isSingleStatus, person) }} + {% if view.single_task_warning_tasks is defined %} + {{ helper.date_status('Tasks with warning deadline reached', view.single_task_warning_tasks, view.single_task_warning_count, view.single_task_warning_paginator, 'warning', view.isSingleStatus, view.person) }} {% endif %} - {% if single_task_current_tasks is defined %} - {{ helper.date_status('Current tasks', single_task_current_tasks, single_task_current_count, single_task_current_paginator, 'current', isSingleStatus, person) }} + {% if view.single_task_current_tasks is defined %} + {{ helper.date_status('Current tasks', view.single_task_current_tasks, view.single_task_current_count, view.single_task_current_paginator, 'current', view.isSingleStatus, view.person) }} {% endif %} - {% if single_task_not_started_tasks is defined %} - {{ helper.date_status('Tasks not started', single_task_not_started_tasks, single_task_not_started_count, single_task_not_started_paginator, 'not_started', isSingleStatus, person) }} + {% if view.single_task_not_started_tasks is defined %} + {{ helper.date_status('Tasks not started', view.single_task_not_started_tasks, view.single_task_not_started_count, view.single_task_not_started_paginator, 'not_started', view.isSingleStatus, view.person) }} {% endif %} - {% if single_task_closed_tasks is defined %} - {{ helper.date_status('Closed', single_task_closed_tasks, single_task_closed_count, single_task_closed_paginator, 'closed', isSingleStatus, person) }} + {% if view.single_task_closed_tasks is defined %} + {{ helper.date_status('Closed', view.single_task_closed_tasks, view.single_task_closed_count, view.single_task_closed_paginator, 'closed', view.isSingleStatus, view.person) }} {% endif %} - {% if isSingleStatus == false %} + {% if view.isSingleStatus == false %}