diff --git a/scipost_django/tasks/templates/tasks/tasklist_new.html b/scipost_django/tasks/templates/tasks/tasklist_new.html index 76e754e25aca7c52c675d95ec6e576762da9a750..5cc36aed3239c635aa90e2937be843178cc04d21 100644 --- a/scipost_django/tasks/templates/tasks/tasklist_new.html +++ b/scipost_django/tasks/templates/tasks/tasklist_new.html @@ -15,32 +15,55 @@ <div class="d-flex flex-column gap-3"> - {% for task_type, tasks in kinds_with_tasks.items %} - <details name="task-type" class="border border-primary border-1 rounded"> - <summary class="p-2 bg-primary bg-opacity-10 d-flex justify-content-between align-items-center"> - <div> - <h2>{{ task_type.name }}</h2> - <p class="m-0">{{ task_type.description }}</p> - </div> - <div class="d-flex flex-column"> - <span class="fs-4">{{ tasks|length }}</span> - </div> - </summary> - <div class="p-3"> - <ul class="list-unstyled d-flex flex-column align-items-stretch gap-4 m-0"> - - {% for task in tasks %} - <li>{{ task.as_html|safe }}</li> - {% empty %} - <li class="text-muted text-center fs-4">No tasks of this type</li> - {% endfor %} - - </ul> - </div> - </details> - {% empty %} - <p class="text-muted text-center fs-4">No tasks found</p> - {% endfor %} + <table class="table"> + <thead> + <tr> + <th scope="col">Type</th> + <th scope="col">Name</th> + <th scope="col">Due</th> + <th scope="col">Actions</th> + </tr> + </thead> + <tbody> + + {% for task_type, tasks in kinds_with_tasks.items %} + + {% for task in tasks %} + <tr> + <td>{{ task.kind.name }}</td> + <td>{{ task.title }}</td> + <td>{{ task.due_date }}</td> + <td> + + {% for action in task.actions|slice:":2" %}{{ action.as_html|safe }}{% endfor %} + + {% if task.actions|length > 2 %} + <div class="btn-group" role="group"> + <button class="btn btn-sm btn-light dropdown-toggle" + type="button" + data-bs-toggle="dropdown" + aria-expanded="false"> + <span>More</span> + </button> + <ul class="dropdown-menu dropdown-menu-end"> + + {% for action in task.actions|slice:"2:" %} + <li class="dropdown-item">{{ action.element|safe }}</li> + {% endfor %} + + + </ul> + </div> + {% endif %} + + </td> + </tr> + {% endfor %} + {% endfor %} + + </tbody> + + </table> </div> {% endblock %} diff --git a/scipost_django/tasks/views.py b/scipost_django/tasks/views.py index 254f36b2dc9a6c34bce34e8c51013a4e95980872..f29ff650bbc96bb3c6b7b3ea18c60b7e05fdac25 100644 --- a/scipost_django/tasks/views.py +++ b/scipost_django/tasks/views.py @@ -45,4 +45,10 @@ def tasklist_new_grouped(request): @login_required @user_passes_test(is_edadmin_or_active_fellow) def tasklist_new(request): - return HttpResponse("") + context = { + "kinds_with_tasks": { + task_type: task_type.get_tasks() + for task_type in get_all_task_kinds(request.user) + } + } + return render(request, "tasks/tasklist_new.html", context)