# -*- coding: utf-8 -*- 
<%inherit file="jm2l:templates/layout.mako"/>

<h3>Liste des tâches JM2L Staff</h3>


<div class="tabbable" id="main_tab">
    <ul class="nav nav-tabs" style="margin-bottom: 5px;">
        % for Num, Entity_Type in enumerate(tasks.keys()):
        <li class="${["","active"][Num==0]}">
            <a href="#${Entity_Type}" id="Map_${Entity_Type}" data-toggle="tab">${Entity_Type}</a>
        </li>
        % endfor
    </ul>

    <div class="tab-content" style="padding:0 10px">

% for Num, Entity_Type in enumerate(tasks.keys()):
        <div class="tab-pane fade ${["","active "][Num==0]} in" id="${Entity_Type}">

<table width="100%" class="table table-striped table-bordered table-hover">
  <thead>
    <tr>
        <th colspan="2" style="text-align:center;">Nom
            <a style="float:right;" class="btn btn-mini btn-info" role="button" href="/Staff/tasks">
                <i class="icon-plus-sign icon-white"></i> Ajouter une tâche
            </a>
        </th>
    </tr>
  </thead>
  <tbody>
    % for task in tasks[Entity_Type]:
        <tr> 
            <td>
                % if task.closed:
                    <span class="name" style="text-decoration: line-through;">${task.name}</span>
                % else:
                    <a href="/Staff/tasks/${task.uid}">
                        <span class="name">${task.name}</span>
                    </a>
                    <span style="float:right;">${task.due_date.strftime("%d %b").decode("utf-8")}</a>
                % endif
            </td>
            <td style="position: relative;width:70px;">
                <div class="actions">
                % if task.closed:
                [ <a href="/Staff/open/${task.uid}">ré-ouvrir</a> ]
                % else:
                [ <a href="/Staff/close/${task.uid}">c'est fait</a> ]
                % endif
                </div>
            </td>
        </tr>
        % if task.description and not task.closed:
        <tr>
            <td colspan="2"><div>${task.description | n}</div></td>
        </tr>
        % endif
    % endfor
  </tbody>
</table>
            </div>
% endfor
    </div>

%if 0:
<ul id="tasks">
% if tasks:
  % for task in tasks:
  <li>
    <span class="name">${task.name}</span>
    <div class="actions">
      [ <a href="/Staff/tasks/${task.uid}">edit</a> - <a href="/Staff/close/${task.uid}">close</a> ]
    </div>
    %if task.description:
        ${task.description | n}
    %endif
  </li>
  % endfor
% else:
  <li>Il n'y a pas de tâches ouverte.</li>
% endif
  <li class="last">
    <a href="/Staff/new">Créer une nouvelle tâche</a>
  </li>
</ul>
%endif