add list of task

This commit is contained in:
2018-04-17 21:57:56 +02:00
parent fd8b6490d0
commit 9dfa39ff07
6 changed files with 298 additions and 4 deletions

View File

@@ -0,0 +1,10 @@
services:
chill_task.single_task_repository:
class: Chill\TaskBundle\Repository\SingleTaskRepository
factory: ['@doctrine.orm.entity_manager', getRepository]
arguments:
- 'Chill\TaskBundle\Entity\SingleTask'
calls:
- method: setAuthorizationHelper
arguments:
- "@chill.main.security.authorization.helper"

View File

@@ -0,0 +1,106 @@
{#
* 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() %}
<thead>
<tr>
<th>{{ 'Title'|trans }}</th>
<th>{{ 'Task type'|trans }}</th>
<th>{{ 'Task status'|trans }}</th>
<th>{{ 'Task start date'|trans }}</th>
<th>{{ 'Task warning date'|trans }}</th>
<th>{{ 'Task end date'|trans }}</th>
</tr>
</thead>
{% endmacro %}
{% macro row(task) %}
<tr>
<td>{{ task.title }}</td>
<td>{{ task.type }}</td>
<td>todo</td>
<td>{{ task.startDate|localizeddate('medium', 'none') }}</td>
<td>{{ task.warningDate|localizeddate('medium', 'none') }}</td>
<td>{{ task.endDate|localizeddate('medium', 'none') }}</td>
</tr>
{% endmacro %}
{% import _self as helper %}
{# filter tasks #}
{% set ended_tasks = [] %}
{% for task in single_tasks if (task.endDate|date("U") > 'now'|date("U")) %}
{% set ended_tasks = ended_tasks|merge([ task ]) %}
{% endfor %}
{% set warning_tasks = [] %}
{% for task in single_tasks if (task.warningDate|date('U') > 'now'|date("U") and task not in ended_tasks) %}
{% set warning_tasks = warning_tasks|merge([ task ]) %}
{% endfor %}
{% set rest_tasks = [] %}
{% for task in single_tasks if (task not in ended_tasks and task not in warning_tasks) %}
{% set rest_tasks = rest_tasks|merge([ task ]) %}
{% endfor %}
{% block personcontent %}
<h1>{{ 'Task list'|trans }}</h1>
{% if ended_tasks|length > 0 %}
<h2>{{ 'Task with expired deadline'|trans }}</h2>
<table>
{{ helper.thead() }}
<tbody>
{% for task in ended_tasks %}
{{ helper.row(task) }}
{% endfor %}
</tbody>
</table>
{% endif %}
{% if warning_tasks|length > 0 %}
<h2>{{ 'Task with warning'|trans }}</h2>
<table>
{{ helper.thead() }}
<tbody>
{% for task in warning_tasks %}
{{ helper.row(task) }}
{% endfor %}
</tbody>
</table>
{% endif %}
{% if rest_tasks|length > 0 %}
<h2>{{ 'Task '|trans }}</h2>
<table>
{{ helper.thead() }}
<tbody>
{% for task in rest_tasks %}
{{ helper.row(task) }}
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}