chill-bundles/Resources/views/Task/index.html.twig
Julien Fastré eadaeaef35 add closed tasks
- the entity has a new column / property "closed" (boolean)
- An event listener in created during container compilation, which listen on tasks
  status changed
- The taskworkflow manager and task workflow definition indicate if the tasks is closed ;
- Add list for closed tasks in controller, and change parameter 'date_status' to 'status';
- and change query to allow to filter on closed tasks
2018-04-26 12:14:30 +02:00

151 lines
7.1 KiB
Twig

{#
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.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/>.
#}
{% extends "ChillPersonBundle::layout.html.twig" %}
{% set activeRouteKey = 'chill_task_single_task_new' %}
{% block title %}{{ 'Task list'|trans }}{% endblock %}
{% macro thead() %}
{% endmacro %}
{% macro row(task) %}
{% endmacro %}
{% macro date_status(title, tasks, count, paginator, status, isSingleStatus, person) %}
{% if tasks|length > 0 %}
<h2>{{ title|trans }}</h2>
<table class="records_list">
<thead>
<tr>
<th class="chill-red">{{ 'Title'|trans }}</th>
<th class="chill-green">{{ 'Task type'|trans }}</th>
<th class="chill-orange">{{ 'Task status'|trans }}</th>
<th>{{ 'Task start date'|trans }}</th>
<th>{{ 'Task warning date'|trans }}</th>
<th>{{ 'Task end date'|trans }}</th>
</tr>
</thead>
<tbody>
{% for task in tasks %}
<tr>
<td>{{ task.title }}</td>
<td>{{ task.type }}</td>
<td>
{% for transition in workflow_transitions(task) %}
<a href="{{ path('chill_task_task_transition', { 'taskId': task.id, 'transition': transition.name, 'kind': 'single-task', 'return_path': app.request.uri }) }}" style="background-color: {{ task_workflow_metadata(task, 'transition.background-color', transition)|e('html_attr') }}; color: {{ task_workflow_metadata(task, 'transition.text-color', transition)|e('html_attr') }}">{{ task_workflow_metadata(task, 'transition.verb', transition) }}</a>
{% endfor %}
</td>
<td>{% if task.startDate is not null %}{{ task.startDate|localizeddate('medium', 'none') }}{% endif %}</td>
<td>{% if task.warningDate is not null %}{{ task.warningDate|localizeddate('medium', 'none') }}{% endif %}</td>
<td>{% if task.endDate is not null %}{{ task.endDate|localizeddate('medium', 'none') }}{% endif %}</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ path('chill_task_single_task_show', { 'id': task.id }) }}" class="sc-button bt-show "></a>
</li>
{% if is_granted('CHILL_TASK_TASK_UPDATE', task) %}
<li>
<a href="{{ path('chill_task_single_task_edit', { 'id': task.id }) }}" class="sc-button bt-update "></a>
</li>
{% endif %}
{% if is_granted('CHILL_TASK_TASK_CREATE', task) %}
<li>
<a href="{{ path('chill_task_single_task_delete', { 'id': task.id } ) }}" class="sc-button bt-delete "></a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if isSingleStatus %}
{% if tasks|length > paginator.getTotalItems %}
{{ chill_pagination(paginator) }}
{% endif %}
<!-- lien retour -->
<ul class="record_actions">
<li>
<a href="{{ path('chill_task_task_list_by_person', {'personId': person.id}) }}" class="sc-button bt-cancel">
{{ 'Back to the list' | trans }}
</a>
</li>
<li>
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="sc-button bt-create">
{{ 'Add a new task' | trans }}
</a>
</li>
</ul>
{% else %}
<ul class="record_actions">
<li>
<a href="{{ path('chill_task_task_list_by_person', {'personId': person.id, 'status' : [ status ] }) }}" class="sc-button bt-cancel">
{{ 'See more' | trans }}
</a>
</li>
</ul>
{% endif %}
{% endif %}
{% endmacro %}
{% import _self as helper %}
{# filter tasks #}
{% block personcontent %}
<h1>{{ 'Task list'|trans }}</h1>
{% 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 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 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 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 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 isSingleStatus == false %}
<ul class="record_actions">
<li>
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="sc-button bt-create">
{{ 'Add a new task' | trans }}
</a>
</li>
</ul>
{% endif %}
{% endblock %}