mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Revert "add form for filtering - work in progress" (temporarily)
This reverts commit c2a5ab2e69ff3e01af45bb2d141580c968a72381.
This commit is contained in:
parent
8542832ac6
commit
75bdbac81a
@ -10,7 +10,6 @@ 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;
|
||||
@ -434,68 +433,7 @@ class SingleTaskController extends Controller
|
||||
$viewParams['layout'] = 'ChillMainBundle::layout.html.twig';
|
||||
}
|
||||
|
||||
// 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()
|
||||
));
|
||||
return $this->render('ChillTaskBundle:SingleTask:index.html.twig', $viewParams);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,62 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2018 Champs Libres Cooperative <info@champs-libres.coop>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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é <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
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 ])
|
||||
;
|
||||
}
|
||||
}
|
@ -140,58 +140,51 @@
|
||||
|
||||
|
||||
<h1>{{ 'Task list'|trans }}</h1>
|
||||
|
||||
<p>Filter the tasks</p>
|
||||
{{ form_start(form) }}
|
||||
{{ form_row(form.user) }}
|
||||
{{ form_row(form.status) }}
|
||||
{{ form_end(form)}}
|
||||
|
||||
{% if view.tasks_count == 0 %}
|
||||
{% if tasks_count == 0 %}
|
||||
<p class="chill-no-data-statement">{{ "There is no tasks."|trans }}</p>
|
||||
{% if view.person is not null %}
|
||||
<a href="{{ path('chill_task_single_task_new', {'person_id': view.person.id}) }}" class="sc-button bt-create">
|
||||
{% if person is not null %}
|
||||
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="sc-button bt-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
<!-- Pour l'instant, il n'est pas encore possible d'ajouter une tache sans personne liée -->
|
||||
<!-- {% if view.person is null %}
|
||||
<!-- {% if person is null %}
|
||||
<a href="{{ path('chill_task_single_task_new') }}" class="sc-button bt-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %} -->
|
||||
{% else %}
|
||||
|
||||
{% 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) }}
|
||||
{% 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) }}
|
||||
{% endif %}
|
||||
|
||||
{% 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) }}
|
||||
{% 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) }}
|
||||
{% endif %}
|
||||
|
||||
{% 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) }}
|
||||
{% 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) }}
|
||||
{% endif %}
|
||||
|
||||
{% 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) }}
|
||||
{% 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) }}
|
||||
{% endif %}
|
||||
|
||||
{% 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) }}
|
||||
{% 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) }}
|
||||
{% endif %}
|
||||
|
||||
{% if view.isSingleStatus == false %}
|
||||
{% if isSingleStatus == false %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
{% if view.person is not null %}
|
||||
{% if person is not null %}
|
||||
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="sc-button bt-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
<!-- Pour l'instant, il n'est pas encore possible d'ajouter une tache sans personne liée -->
|
||||
<!-- {% if view.person is null %}
|
||||
<!-- {% if person is null %}
|
||||
<a href="{{ path('chill_task_single_task_new') }}" class="sc-button bt-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
|
@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
|
||||
{% extends view.layout %}
|
||||
{% extends layout %}
|
||||
|
||||
{% set activeRouteKey = 'chill_task_single_task_new' %}
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
{# filter tasks #}
|
||||
|
||||
{% if view.person is not null %}
|
||||
{% if person is not null %}
|
||||
{% block personcontent %}
|
||||
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
|
||||
{% endblock %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user