mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 10:33:49 +00:00
add list of task
This commit is contained in:
10
Resources/config/services/repositories.yml
Normal file
10
Resources/config/services/repositories.yml
Normal 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"
|
106
Resources/views/Task/index.html.twig
Normal file
106
Resources/views/Task/index.html.twig
Normal 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 %}
|
Reference in New Issue
Block a user