mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
add message when there is no task + improve when request with multiple input (user, scope and person)
This commit is contained in:
parent
bf0db0de3f
commit
fd2bee979a
@ -32,6 +32,7 @@ class SingleTaskController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function newAction(Request $request)
|
public function newAction(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
$personId = $request->query->getInt('person_id', null);
|
$personId = $request->query->getInt('person_id', null);
|
||||||
|
|
||||||
if ($personId === null) {
|
if ($personId === null) {
|
||||||
@ -47,8 +48,8 @@ class SingleTaskController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$task = (new SingleTask())
|
$task = (new SingleTask())
|
||||||
->setPerson($person)
|
|
||||||
->setAssignee($this->getUser())
|
->setAssignee($this->getUser())
|
||||||
|
->setPerson($person)
|
||||||
->setType('task_default')
|
->setType('task_default')
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ class SingleTaskController extends Controller
|
|||||||
$this->addFlash('success', "The task is created");
|
$this->addFlash('success', "The task is created");
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_task_task_list_by_person', [
|
return $this->redirectToRoute('chill_task_task_list_by_person', [
|
||||||
'personId' => $task->getPerson()->getId()
|
'person_id' => $task->getPerson()->getId()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -173,7 +174,7 @@ class SingleTaskController extends Controller
|
|||||||
$this->addFlash('success', "Success : task updated!");
|
$this->addFlash('success', "Success : task updated!");
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_task_task_list_by_person', [
|
return $this->redirectToRoute('chill_task_task_list_by_person', [
|
||||||
'personId' => $task->getPerson()->getId()
|
'person_id' => $task->getPerson()->getId()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -253,7 +254,7 @@ class SingleTaskController extends Controller
|
|||||||
|
|
||||||
return $this->redirect($this->generateUrl(
|
return $this->redirect($this->generateUrl(
|
||||||
'chill_task_task_list_by_person', array(
|
'chill_task_task_list_by_person', array(
|
||||||
'personId' => $personId
|
'person_id' => $personId
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -308,7 +309,7 @@ class SingleTaskController extends Controller
|
|||||||
|
|
||||||
// Get parameters from url
|
// Get parameters from url
|
||||||
if ($request->query->has('person_id')) {
|
if ($request->query->has('person_id')) {
|
||||||
$personId = $request->query->get('person_id');
|
$personId = $request->query->getInt('person_id', null);
|
||||||
$person = $personRepository->find($personId);
|
$person = $personRepository->find($personId);
|
||||||
|
|
||||||
if ($person === null) {
|
if ($person === null) {
|
||||||
@ -323,7 +324,7 @@ class SingleTaskController extends Controller
|
|||||||
|
|
||||||
if ($request->query->has('user_id')) {
|
if ($request->query->has('user_id')) {
|
||||||
|
|
||||||
$userId = $request->query->get('user_id');
|
$userId = $request->query->getInt('user_id', null);
|
||||||
$user = $this->getDoctrine()->getManager()
|
$user = $this->getDoctrine()->getManager()
|
||||||
->getRepository('ChillMainBundle:User')
|
->getRepository('ChillMainBundle:User')
|
||||||
->find($userId);
|
->find($userId);
|
||||||
@ -338,7 +339,7 @@ class SingleTaskController extends Controller
|
|||||||
|
|
||||||
if ($request->query->has('scope_id')) {
|
if ($request->query->has('scope_id')) {
|
||||||
|
|
||||||
$scopeId = $request->query->get('scope_id');
|
$scopeId = $request->query->getInt('scope_id', null);
|
||||||
$scope = $this->getDoctrine()->getManager()
|
$scope = $this->getDoctrine()->getManager()
|
||||||
->getRepository('ChillMainBundle:Scope')
|
->getRepository('ChillMainBundle:Scope')
|
||||||
->find($scopeId);
|
->find($scopeId);
|
||||||
@ -366,6 +367,8 @@ class SingleTaskController extends Controller
|
|||||||
|
|
||||||
$viewParams['isSingleStatus'] = $singleStatus = count($statuses) === 1;
|
$viewParams['isSingleStatus'] = $singleStatus = count($statuses) === 1;
|
||||||
|
|
||||||
|
$tasks_count = 0;
|
||||||
|
|
||||||
foreach($statuses as $status) {
|
foreach($statuses as $status) {
|
||||||
if($request->query->has('status')
|
if($request->query->has('status')
|
||||||
&& FALSE === \in_array($status, $statuses)) {
|
&& FALSE === \in_array($status, $statuses)) {
|
||||||
@ -393,8 +396,13 @@ class SingleTaskController extends Controller
|
|||||||
$singleStatus ? $paginator->getCurrentPage()->getFirstItemNumber() : 0,
|
$singleStatus ? $paginator->getCurrentPage()->getFirstItemNumber() : 0,
|
||||||
$singleStatus ? $paginator->getItemsPerPage() : 10)
|
$singleStatus ? $paginator->getItemsPerPage() : 10)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
$tasks_count = $tasks_count + $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// total number of tasks
|
||||||
|
$viewParams['tasks_count'] = $tasks_count;
|
||||||
|
|
||||||
if ($request->query->has('person_id')){
|
if ($request->query->has('person_id')){
|
||||||
$viewParams['layout'] = 'ChillPersonBundle::layout.html.twig';
|
$viewParams['layout'] = 'ChillPersonBundle::layout.html.twig';
|
||||||
} else {
|
} else {
|
||||||
@ -404,6 +412,7 @@ class SingleTaskController extends Controller
|
|||||||
return $this->render('ChillTaskBundle:SingleTask:index.html.twig', $viewParams);
|
return $this->render('ChillTaskBundle:SingleTask:index.html.twig', $viewParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function getPersonParam(Request $request, EntityManagerInterface $em)
|
protected function getPersonParam(Request $request, EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$person = $em->getRepository(Person::class)
|
$person = $em->getRepository(Person::class)
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
{% if person is not null %}
|
{% if person is not null %}
|
||||||
<a href="{{ path('chill_task_singletask_list', {'personId': person.id}) }}" class="sc-button bt-cancel">
|
<a href="{{ path('chill_task_singletask_list', {'person_id': person.id}) }}" class="sc-button bt-cancel">
|
||||||
{{ 'Back to the list' | trans }}
|
{{ 'Back to the list' | trans }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -89,7 +89,7 @@
|
|||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
{% if person is not null %}
|
{% if person is not null %}
|
||||||
<a href="{{ path('chill_task_singletask_list', {'personId': person.id, 'status' : [ status ] }) }}" class="sc-button bt-cancel">
|
<a href="{{ path('chill_task_singletask_list', {'person_id': person.id, 'status' : [ status ] }) }}" class="sc-button bt-cancel">
|
||||||
{{ 'See more' | trans }}
|
{{ 'See more' | trans }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -110,40 +110,57 @@
|
|||||||
|
|
||||||
|
|
||||||
<h1>{{ 'Task list'|trans }}</h1>
|
<h1>{{ 'Task list'|trans }}</h1>
|
||||||
|
{% if tasks_count == 0 %}
|
||||||
|
<p class="chill-no-data-statement">{{ "There is no tasks."|trans }}</p>
|
||||||
|
{% 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 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 single_task_ended_tasks is defined %}
|
{% 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) }}
|
{{ helper.date_status('Tasks with expired deadline', single_task_ended_tasks, single_task_ended_count, single_task_ended_paginator, 'ended', isSingleStatus, person) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if single_task_warning_tasks is defined %}
|
{% 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) }}
|
{{ helper.date_status('Tasks with warning deadline reached', single_task_warning_tasks, single_task_warning_count, single_task_warning_paginator, 'warning', isSingleStatus, person) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if single_task_current_tasks is defined %}
|
{% 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) }}
|
{{ helper.date_status('Current tasks', single_task_current_tasks, single_task_current_count, single_task_current_paginator, 'current', isSingleStatus, person) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if single_task_not_started_tasks is defined %}
|
{% 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) }}
|
{{ 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 %}
|
{% endif %}
|
||||||
|
|
||||||
{% if single_task_closed_tasks is defined %}
|
{% 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) }}
|
{{ helper.date_status('Closed', single_task_closed_tasks, single_task_closed_count, single_task_closed_paginator, 'closed', isSingleStatus, person) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if isSingleStatus == false %}
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
{% 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 person is null %}
|
||||||
|
<a href="{{ path('chill_task_single_task_new') }}" class="sc-button bt-create">
|
||||||
|
{{ 'Add a new task' | trans }}
|
||||||
|
</a>
|
||||||
|
{% endif %} -->
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if isSingleStatus == false %}
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
{% 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 %}
|
|
||||||
{% if user is not null %}
|
|
||||||
<a href="{{ path('chill_task_single_task_new') }}" class="sc-button bt-create">
|
|
||||||
{{ 'Add a new task' | trans }}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -32,11 +32,11 @@
|
|||||||
|
|
||||||
{# filter tasks #}
|
{# filter tasks #}
|
||||||
|
|
||||||
{% if person is not null and user is null %}
|
{% if person is not null %}
|
||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
|
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% elseif user is not null and person is null %}
|
{% else %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
|
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user