886 lines
34 KiB
HTML
886 lines
34 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Task List Mockup</title>
|
||
<style>
|
||
:root {
|
||
--page-bg: #f6f8fa;
|
||
--surface: #ffffff;
|
||
--text: #24292e;
|
||
--text-muted: #6a737d;
|
||
--border: #e1e4e8;
|
||
--primary: #0366d6;
|
||
--primary-hover: #0256b9;
|
||
--secondary-bg: #fafbfc;
|
||
--secondary-hover: #f3f4f6;
|
||
--demo-bg: #fff8c5;
|
||
--demo-border: #d4a72c;
|
||
}
|
||
|
||
* { box-sizing: border-box; }
|
||
|
||
body {
|
||
margin: 0;
|
||
background: var(--page-bg);
|
||
color: var(--text);
|
||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||
font-size: 14px;
|
||
line-height: 1.5;
|
||
}
|
||
|
||
/* ---------- Mockup-only controls (not part of the real UI) ---------- */
|
||
.demo-bar {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: center;
|
||
gap: 8px 16px;
|
||
padding: 8px 16px;
|
||
background: var(--demo-bg);
|
||
border-bottom: 1px solid var(--demo-border);
|
||
font-size: 13px;
|
||
}
|
||
.demo-bar strong { font-weight: 600; }
|
||
.demo-bar select { padding: 2px 6px; font-size: 13px; }
|
||
.demo-output {
|
||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||
word-break: break-all;
|
||
}
|
||
|
||
/* ---------- Page ---------- */
|
||
.page {
|
||
max-width: 1400px;
|
||
margin: 0 auto;
|
||
padding: 16px;
|
||
}
|
||
|
||
/* Header bar */
|
||
.page-header {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 16px;
|
||
padding-bottom: 16px;
|
||
margin-bottom: 16px;
|
||
border-bottom: 1px solid var(--border);
|
||
}
|
||
.page-header h1 {
|
||
margin: 0;
|
||
font-size: 24px;
|
||
font-weight: 600;
|
||
}
|
||
|
||
/* Two-column layout: sidebar left, table right; stacks below 1024px */
|
||
.layout {
|
||
display: grid;
|
||
grid-template-columns: 280px 1fr;
|
||
gap: 16px;
|
||
align-items: start;
|
||
}
|
||
@media (max-width: 1023.98px) {
|
||
.layout { grid-template-columns: 1fr; }
|
||
}
|
||
|
||
/* ---------- Buttons & form controls ---------- */
|
||
.btn {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 6px 16px;
|
||
border: 1px solid transparent;
|
||
border-radius: 6px;
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
line-height: 20px;
|
||
text-decoration: none;
|
||
cursor: pointer;
|
||
white-space: nowrap;
|
||
}
|
||
.btn-primary {
|
||
background: var(--primary);
|
||
border-color: var(--primary);
|
||
color: #fff;
|
||
}
|
||
.btn-primary:hover { background: var(--primary-hover); }
|
||
.btn-secondary {
|
||
background: var(--secondary-bg);
|
||
border-color: var(--border);
|
||
color: var(--text);
|
||
}
|
||
.btn-secondary:hover { background: var(--secondary-hover); }
|
||
|
||
.form-control {
|
||
display: block;
|
||
width: 100%;
|
||
padding: 6px 8px;
|
||
border: 1px solid var(--border);
|
||
border-radius: 6px;
|
||
background: var(--surface);
|
||
color: var(--text);
|
||
font-size: 14px;
|
||
font-family: inherit;
|
||
}
|
||
.form-control:focus {
|
||
outline: none;
|
||
border-color: var(--primary);
|
||
box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.2);
|
||
}
|
||
|
||
/* ---------- Sidebar filters ---------- */
|
||
.sidebar {
|
||
background: var(--surface);
|
||
border: 1px solid var(--border);
|
||
border-radius: 6px;
|
||
padding: 16px;
|
||
}
|
||
.filter-section + .filter-section {
|
||
margin-top: 16px;
|
||
padding-top: 16px;
|
||
border-top: 1px solid var(--border);
|
||
}
|
||
.filter-label {
|
||
display: block;
|
||
margin: 0 0 8px;
|
||
padding: 0;
|
||
font-size: 13px;
|
||
font-weight: 600;
|
||
}
|
||
fieldset.filter-section {
|
||
margin-left: 0;
|
||
margin-right: 0;
|
||
margin-bottom: 0;
|
||
border-left: 0;
|
||
border-right: 0;
|
||
border-bottom: 0;
|
||
padding-left: 0;
|
||
padding-right: 0;
|
||
padding-bottom: 0;
|
||
}
|
||
fieldset.filter-section:first-child { border-top: 0; padding-top: 0; }
|
||
.checkbox-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 4px;
|
||
}
|
||
.checkbox-list label {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
cursor: pointer;
|
||
}
|
||
.date-field + .date-field { margin-top: 8px; }
|
||
.date-field span {
|
||
display: block;
|
||
margin-bottom: 4px;
|
||
font-size: 12px;
|
||
color: var(--text-muted);
|
||
}
|
||
.filter-actions {
|
||
display: flex;
|
||
gap: 8px;
|
||
}
|
||
.filter-actions .btn { flex: 1; }
|
||
|
||
/* ---------- Main area (placeholder until specified) ---------- */
|
||
.main {
|
||
background: var(--surface);
|
||
border: 1px solid var(--border);
|
||
border-radius: 6px;
|
||
padding: 16px;
|
||
min-width: 0;
|
||
}
|
||
|
||
/* Results header: count left, page size right */
|
||
.results-header {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 8px 16px;
|
||
margin-bottom: 16px;
|
||
}
|
||
.results-count { color: var(--text-muted); }
|
||
.results-count strong { color: var(--text); font-weight: 600; }
|
||
.page-size {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
color: var(--text-muted);
|
||
}
|
||
.page-size .form-control { width: auto; }
|
||
|
||
/* ---------- Data table ---------- */
|
||
.table-wrap {
|
||
overflow-x: auto;
|
||
border: 1px solid var(--border);
|
||
border-radius: 6px;
|
||
margin-bottom: 16px;
|
||
}
|
||
.task-table {
|
||
width: 100%;
|
||
border-collapse: collapse;
|
||
white-space: nowrap;
|
||
}
|
||
.task-table th,
|
||
.task-table td {
|
||
padding: 12px 16px;
|
||
text-align: left;
|
||
vertical-align: middle;
|
||
border-bottom: 1px solid var(--border);
|
||
}
|
||
.task-table thead th {
|
||
background: var(--secondary-bg);
|
||
font-size: 12px;
|
||
font-weight: 600;
|
||
color: var(--text-muted);
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.03em;
|
||
}
|
||
.sort-link {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 4px;
|
||
color: inherit;
|
||
text-decoration: none;
|
||
}
|
||
.sort-link:hover { color: var(--primary); }
|
||
th[aria-sort="ascending"] .sort-link,
|
||
th[aria-sort="descending"] .sort-link { color: var(--text); }
|
||
.sort-indicator { font-size: 10px; }
|
||
.task-table tbody tr:last-child td { border-bottom: 0; }
|
||
.task-table tbody tr:hover { background: var(--secondary-bg); }
|
||
|
||
.task-title { font-weight: 600; white-space: normal; min-width: 200px; }
|
||
.task-id { display: block; font-size: 12px; color: var(--text-muted); }
|
||
|
||
/* Status badge: base + modifier from ListOfTaskStatus.task_higher_order_status (lowercased) */
|
||
.badge {
|
||
display: inline-block;
|
||
padding: 2px 8px;
|
||
border-radius: 12px;
|
||
font-size: 12px;
|
||
font-weight: 500;
|
||
background: #eaecef;
|
||
color: var(--text);
|
||
}
|
||
/* Higher-order Backlog: New, Backlog */
|
||
.badge-backlog { background: #f5efe0; color: #7a1f1f; }
|
||
/* Higher-order Normal: In Progress, Test/Review */
|
||
.badge-normal { background: #cff4fc; color: #000000; }
|
||
/* Higher-order Blocked: Blocked */
|
||
.badge-blocked { background: #f8d7da; color: #7a1f1f; }
|
||
/* Higher-order Closed: Closed */
|
||
.badge-closed { background: #d4edda; color: #155724; }
|
||
|
||
/* Priority: 8px dot + label */
|
||
.priority { display: inline-flex; align-items: center; gap: 6px; }
|
||
.priority-indicator {
|
||
width: 8px;
|
||
height: 8px;
|
||
border-radius: 50%;
|
||
flex-shrink: 0;
|
||
}
|
||
.priority-high .priority-indicator { background: #cb2431; }
|
||
.priority-medium .priority-indicator { background: #e67e22; }
|
||
.priority-low .priority-indicator { background: #28a745; }
|
||
|
||
.btn-sm { padding: 3px 12px; font-size: 12px; }
|
||
|
||
/* ---------- Pagination ---------- */
|
||
.pagination {
|
||
display: flex;
|
||
justify-content: center;
|
||
}
|
||
.pagination-list {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
justify-content: center;
|
||
gap: 4px;
|
||
margin: 0;
|
||
padding: 0;
|
||
list-style: none;
|
||
}
|
||
.page-link {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
min-width: 32px;
|
||
height: 32px;
|
||
padding: 0 10px;
|
||
border: 1px solid var(--border);
|
||
border-radius: 6px;
|
||
background: var(--surface);
|
||
color: var(--text);
|
||
text-decoration: none;
|
||
}
|
||
a.page-link:hover { background: var(--secondary-hover); }
|
||
.page-link.active {
|
||
background: var(--primary);
|
||
border-color: var(--primary);
|
||
color: #fff;
|
||
font-weight: 600;
|
||
}
|
||
.page-link.disabled {
|
||
color: var(--text-muted);
|
||
background: var(--secondary-bg);
|
||
opacity: 0.6;
|
||
cursor: not-allowed;
|
||
}
|
||
.page-ellipsis {
|
||
border-color: transparent;
|
||
background: none;
|
||
color: var(--text-muted);
|
||
}
|
||
|
||
/* Empty state: single row spanning all columns */
|
||
.empty-row td {
|
||
padding: 32px 16px;
|
||
text-align: center;
|
||
color: var(--text-muted);
|
||
}
|
||
|
||
.placeholder {
|
||
color: var(--text-muted);
|
||
text-align: center;
|
||
border: 2px dashed var(--border);
|
||
border-radius: 6px;
|
||
padding: 32px 16px;
|
||
width: 100%;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
|
||
<!-- =====================================================================
|
||
MOCKUP-ONLY CONTROLS — not part of the real UI. Remove when building.
|
||
===================================================================== -->
|
||
<div class="demo-bar" role="region" aria-label="Mockup controls">
|
||
<strong>Mockup controls</strong>
|
||
<label>
|
||
Simulated user_level:
|
||
<select id="demo-user-level">
|
||
<option value="0">0 – no access</option>
|
||
<option value="1">1 – read</option>
|
||
<option value="2">2 – edit</option>
|
||
<option value="3">3 – create</option>
|
||
<option value="4" selected>4 – full</option>
|
||
</select>
|
||
</label>
|
||
<label><input type="checkbox" id="demo-empty"> Show empty state</label>
|
||
<span>Last submitted query: <span class="demo-output" id="demo-query">(none)</span></span>
|
||
</div>
|
||
|
||
<div class="page">
|
||
|
||
<!-- Header bar -->
|
||
<header class="page-header">
|
||
<h1>All Tasks</h1>
|
||
|
||
<!-- {% if user_level >= 3 %} -->
|
||
<a href="/new_task/" class="btn btn-primary" id="new-task-btn" data-requires-user-level="3">+ New Task</a>
|
||
<!-- {% endif %} -->
|
||
</header>
|
||
|
||
<div class="layout">
|
||
|
||
<!-- ================= Sidebar filters ================= -->
|
||
<aside class="sidebar" aria-label="Filters">
|
||
<!-- All filters in a single GET form; selections appear in the URL query string. -->
|
||
<form method="get" action="/tasks/" id="task-filter-form">
|
||
<!-- Carries the active sort so Apply and page-size changes keep it. Default: -date_created -->
|
||
<input type="hidden" name="sort" id="sort-input" value="-date_created">
|
||
|
||
<!-- 1. Status — multi-select checkboxes; values come from ListOfTaskStatus -->
|
||
<fieldset class="filter-section">
|
||
<legend class="filter-label">Status</legend>
|
||
<div class="checkbox-list">
|
||
<!-- {% for status in status_options %}
|
||
<input type="checkbox" name="status" value="{{ status.task_status_id }}"> {{ status.task_status }} -->
|
||
<label><input type="checkbox" name="status" value="1"> New</label>
|
||
<label><input type="checkbox" name="status" value="2"> Backlog</label>
|
||
<label><input type="checkbox" name="status" value="3"> Blocked</label>
|
||
<label><input type="checkbox" name="status" value="4"> In Progress</label>
|
||
<label><input type="checkbox" name="status" value="5"> Test/Review</label>
|
||
<label><input type="checkbox" name="status" value="6"> Closed</label>
|
||
<!-- {% endfor %} -->
|
||
</div>
|
||
</fieldset>
|
||
|
||
<!-- 2. Assignee — "All Assignees" + users with task access in the
|
||
current user's accessible projects + "Unassigned" -->
|
||
<div class="filter-section">
|
||
<label class="filter-label" for="filter-assignee">Assignee</label>
|
||
<select class="form-control" id="filter-assignee" name="assignee">
|
||
<option value="">All Assignees</option>
|
||
<!-- {% for user in assignee_options %}
|
||
<option value="{{ user.id }}">{{ user.username }}</option> -->
|
||
<option value="2">alex.chen</option>
|
||
<option value="3">jordan.lee</option>
|
||
<option value="4">riley.ng</option>
|
||
<option value="5">sam.patel</option>
|
||
<option value="6">taylor.kim</option>
|
||
<!-- {% endfor %} -->
|
||
<option value="unassigned">Unassigned</option>
|
||
</select>
|
||
</div>
|
||
|
||
<!-- 3. Project — "All Projects" + projects the user has
|
||
ObjectAssignment access to (via their groups) -->
|
||
<div class="filter-section">
|
||
<label class="filter-label" for="filter-project">Project</label>
|
||
<select class="form-control" id="filter-project" name="project">
|
||
<option value="">All Projects</option>
|
||
<!-- {% for project in project_options %}
|
||
<option value="{{ project.project_id }}">{{ project.project_name }}</option> -->
|
||
<option value="1">Website Redesign</option>
|
||
<option value="2">Mobile App v2</option>
|
||
<option value="3">Data Migration</option>
|
||
<option value="4">Internal Tools</option>
|
||
<!-- {% endfor %} -->
|
||
</select>
|
||
</div>
|
||
|
||
<!-- 4. Date Range — both optional, independently
|
||
Start Date: task_start_date >= value
|
||
End Date: task_end_date <= value -->
|
||
<fieldset class="filter-section">
|
||
<legend class="filter-label">Date Range</legend>
|
||
<label class="date-field">
|
||
<span>Start Date</span>
|
||
<input class="form-control" type="date" name="start_date">
|
||
</label>
|
||
<label class="date-field">
|
||
<span>End Date</span>
|
||
<input class="form-control" type="date" name="end_date">
|
||
</label>
|
||
</fieldset>
|
||
|
||
<!-- 5. Actions -->
|
||
<div class="filter-section">
|
||
<div class="filter-actions">
|
||
<!-- Link (not a reset button) so all query params are cleared -->
|
||
<a href="/tasks/" class="btn btn-secondary" id="clear-filters">Clear Filters</a>
|
||
<button type="submit" class="btn btn-primary">Apply</button>
|
||
</div>
|
||
</div>
|
||
|
||
</form>
|
||
</aside>
|
||
|
||
<!-- ================= Main table area ================= -->
|
||
<main class="main">
|
||
|
||
<!-- Results header -->
|
||
<div class="results-header">
|
||
<!-- Uses paginator: page_obj.start_index, page_obj.end_index, paginator.count -->
|
||
<div class="results-count">
|
||
Showing <strong id="range-start">1</strong>–<strong id="range-end">25</strong>
|
||
of <strong id="total-count">142</strong> tasks
|
||
<!-- Showing {{ page_obj.start_index }}–{{ page_obj.end_index }} of {{ page_obj.paginator.count }} tasks -->
|
||
</div>
|
||
|
||
<!-- Belongs to the filter form (form= attribute) so changing it keeps all
|
||
active filters; auto-submits on change. Default 25. -->
|
||
<label class="page-size">
|
||
Page size
|
||
<select class="form-control" name="page_size" id="page-size" form="task-filter-form">
|
||
<option value="10">10</option>
|
||
<option value="25" selected>25</option>
|
||
<option value="50">50</option>
|
||
<option value="100">100</option>
|
||
</select>
|
||
</label>
|
||
</div>
|
||
|
||
<!-- Data table. Sample rows are a subset of one page; the real page renders page_obj.
|
||
Sorting: click a sortable header to toggle ASC/DESC.
|
||
?sort=field -> ascending (header shows ▲)
|
||
?sort=-field -> descending (header shows ▼)
|
||
Clicking a different column starts ascending. Default sort: -date_created (newest first).
|
||
Each header link keeps all other active query params (filters, page_size). -->
|
||
<div class="table-wrap">
|
||
<table class="task-table">
|
||
<thead>
|
||
<tr>
|
||
<th data-sort-field="task_short_description"><a class="sort-link" href="?sort=task_short_description">Title <span class="sort-indicator"></span></a></th>
|
||
<th data-sort-field="task_status__task_status"><a class="sort-link" href="?sort=task_status__task_status">Status <span class="sort-indicator"></span></a></th>
|
||
<th data-sort-field="task_priority"><a class="sort-link" href="?sort=task_priority">Priority <span class="sort-indicator"></span></a></th>
|
||
<th data-sort-field="task_assigned_to__username"><a class="sort-link" href="?sort=task_assigned_to__username">Assignee <span class="sort-indicator"></span></a></th>
|
||
<th data-sort-field="project"><a class="sort-link" href="?sort=project">Project <span class="sort-indicator"></span></a></th>
|
||
<th data-sort-field="task_start_date"><a class="sort-link" href="?sort=task_start_date">Start Date <span class="sort-indicator"></span></a></th>
|
||
<th data-sort-field="task_end_date"><a class="sort-link" href="?sort=task_end_date">End Date <span class="sort-indicator"></span></a></th>
|
||
<th data-sort-field="date_created" aria-sort="descending"><a class="sort-link" href="?sort=date_created">Created <span class="sort-indicator">▼</span></a></th>
|
||
<th>Actions</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<!-- {% for task in page_obj %}
|
||
<tr>
|
||
<td class="task-title">{{ task.task_short_description }}<span class="task-id">#T-{{ task.task_id }}</span></td>
|
||
<td><span class="badge badge-{{ task.task_status.task_higher_order_status|lower }}">{{ task.task_status.task_status }}</span></td>
|
||
<td><span class="priority priority-{high|medium|low}"><span class="priority-indicator"></span>{{ priority label }}</span></td>
|
||
<td>{{ assigned username|default:"-" }}</td>
|
||
<td>{{ project name }}</td>
|
||
<td>{{ task.task_start_date|date:"Y-m-d" }}</td>
|
||
<td>{{ task.task_end_date|date:"Y-m-d" }}</td>
|
||
<td>{{ task.date_created|date:"Y-m-d" }}</td>
|
||
<td><a class="btn btn-secondary btn-sm" href="{% url 'task_information' task.task_id %}">View</a></td>
|
||
</tr>
|
||
{% empty %}
|
||
<tr class="empty-row"><td colspan="9">No tasks found</td></tr>
|
||
{% endfor %} -->
|
||
<tr>
|
||
<td class="task-title">Migrate customer table to new schema<span class="task-id">#T-1287</span></td>
|
||
<td><span class="badge badge-normal">In Progress</span></td>
|
||
<td><span class="priority priority-high"><span class="priority-indicator"></span>High</span></td>
|
||
<td>sam.patel</td>
|
||
<td>Data Migration</td>
|
||
<td>2026-10-20</td>
|
||
<td>2026-11-14</td>
|
||
<td>2026-10-31</td>
|
||
<td><a class="btn btn-secondary btn-sm" href="/task_information/1287/">View</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="task-title">Design new pricing page layout<span class="task-id">#T-1284</span></td>
|
||
<td><span class="badge badge-backlog">New</span></td>
|
||
<td><span class="priority priority-medium"><span class="priority-indicator"></span>Medium</span></td>
|
||
<td>-</td>
|
||
<td>Website Redesign</td>
|
||
<td>2026-11-03</td>
|
||
<td>2026-11-21</td>
|
||
<td>2026-10-30</td>
|
||
<td><a class="btn btn-secondary btn-sm" href="/task_information/1284/">View</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="task-title">Push notification permissions on Android 15<span class="task-id">#T-1279</span></td>
|
||
<td><span class="badge badge-blocked">Blocked</span></td>
|
||
<td><span class="priority priority-high"><span class="priority-indicator"></span>High</span></td>
|
||
<td>jordan.lee</td>
|
||
<td>Mobile App v2</td>
|
||
<td>2026-10-13</td>
|
||
<td>2026-10-31</td>
|
||
<td>2026-10-28</td>
|
||
<td><a class="btn btn-secondary btn-sm" href="/task_information/1279/">View</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="task-title">Review accessibility audit findings<span class="task-id">#T-1275</span></td>
|
||
<td><span class="badge badge-normal">Test/Review</span></td>
|
||
<td><span class="priority priority-medium"><span class="priority-indicator"></span>Medium</span></td>
|
||
<td>alex.chen</td>
|
||
<td>Website Redesign</td>
|
||
<td>2026-10-06</td>
|
||
<td>2026-10-24</td>
|
||
<td>2026-10-25</td>
|
||
<td><a class="btn btn-secondary btn-sm" href="/task_information/1275/">View</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="task-title">Add CSV export to admin reports<span class="task-id">#T-1270</span></td>
|
||
<td><span class="badge badge-backlog">Backlog</span></td>
|
||
<td><span class="priority priority-low"><span class="priority-indicator"></span>Low</span></td>
|
||
<td>-</td>
|
||
<td>Internal Tools</td>
|
||
<td>2026-11-17</td>
|
||
<td>2026-12-05</td>
|
||
<td>2026-10-22</td>
|
||
<td><a class="btn btn-secondary btn-sm" href="/task_information/1270/">View</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="task-title">Set up staging environment for v2 beta<span class="task-id">#T-1266</span></td>
|
||
<td><span class="badge badge-closed">Closed</span></td>
|
||
<td><span class="priority priority-high"><span class="priority-indicator"></span>High</span></td>
|
||
<td>taylor.kim</td>
|
||
<td>Mobile App v2</td>
|
||
<td>2026-09-29</td>
|
||
<td>2026-10-10</td>
|
||
<td>2026-10-18</td>
|
||
<td><a class="btn btn-secondary btn-sm" href="/task_information/1266/">View</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="task-title">Validate migrated invoice totals<span class="task-id">#T-1261</span></td>
|
||
<td><span class="badge badge-normal">Test/Review</span></td>
|
||
<td><span class="priority priority-high"><span class="priority-indicator"></span>High</span></td>
|
||
<td>riley.ng</td>
|
||
<td>Data Migration</td>
|
||
<td>2026-10-01</td>
|
||
<td>2026-10-17</td>
|
||
<td>2026-10-15</td>
|
||
<td><a class="btn btn-secondary btn-sm" href="/task_information/1261/">View</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="task-title">Refresh onboarding illustrations<span class="task-id">#T-1258</span></td>
|
||
<td><span class="badge badge-normal">In Progress</span></td>
|
||
<td><span class="priority priority-low"><span class="priority-indicator"></span>Low</span></td>
|
||
<td>alex.chen</td>
|
||
<td>Website Redesign</td>
|
||
<td>2026-10-12</td>
|
||
<td>2026-11-07</td>
|
||
<td>2026-10-11</td>
|
||
<td><a class="btn btn-secondary btn-sm" href="/task_information/1258/">View</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="task-title">Clean up unused feature flags<span class="task-id">#T-1252</span></td>
|
||
<td><span class="badge badge-backlog">Backlog</span></td>
|
||
<td><span class="priority priority-medium"><span class="priority-indicator"></span>Medium</span></td>
|
||
<td>sam.patel</td>
|
||
<td>Internal Tools</td>
|
||
<td>2026-11-24</td>
|
||
<td>2026-12-12</td>
|
||
<td>2026-10-08</td>
|
||
<td><a class="btn btn-secondary btn-sm" href="/task_information/1252/">View</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="task-title">Offline mode for task checklist<span class="task-id">#T-1247</span></td>
|
||
<td><span class="badge badge-backlog">New</span></td>
|
||
<td><span class="priority priority-low"><span class="priority-indicator"></span>Low</span></td>
|
||
<td>-</td>
|
||
<td>Mobile App v2</td>
|
||
<td>2026-12-01</td>
|
||
<td>2026-12-19</td>
|
||
<td>2026-10-04</td>
|
||
<td><a class="btn btn-secondary btn-sm" href="/task_information/1247/">View</a></td>
|
||
</tr>
|
||
<!-- Empty state: rendered by {% empty %} when the queryset has no tasks -->
|
||
<tr class="empty-row" id="empty-row" hidden>
|
||
<td colspan="9">No tasks found</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
<!-- Pagination footer.
|
||
"◀ Prev" disabled on page 1, "Next ▶" disabled on the last page.
|
||
Page numbers come from paginator.get_elided_page_range(page_obj.number, on_each_side=2, on_ends=1),
|
||
e.g. 1 … 6 7 [8] 9 10 … 15; with 6 or fewer pages, all are shown.
|
||
Every link keeps all active filters, sort and page_size, changing only page
|
||
(e.g. {% querystring page=n %} on Django 5.1+, or rebuild from request.GET).
|
||
|
||
{% if page_obj.has_previous %}<a class="page-link" href="?{...}page={{ page_obj.previous_page_number }}">◀ Prev</a>
|
||
{% else %}<span class="page-link disabled" aria-disabled="true">◀ Prev</span>{% endif %}
|
||
{% for n in elided_page_range %}
|
||
{% if n == page_obj.paginator.ELLIPSIS %}<span class="page-link page-ellipsis">…</span>
|
||
{% elif n == page_obj.number %}<span class="page-link active" aria-current="page">{{ n }}</span>
|
||
{% else %}<a class="page-link" href="?{...}page={{ n }}">{{ n }}</a>{% endif %}
|
||
{% endfor %}
|
||
{% if page_obj.has_next %}<a class="page-link" href="?{...}page={{ page_obj.next_page_number }}">Next ▶</a>
|
||
{% else %}<span class="page-link disabled" aria-disabled="true">Next ▶</span>{% endif %} -->
|
||
<nav class="pagination" aria-label="Pagination">
|
||
<ul class="pagination-list" id="pagination">
|
||
<li><span class="page-link disabled" aria-disabled="true">◀ Prev</span></li>
|
||
<li><span class="page-link active" aria-current="page">1</span></li>
|
||
<li><a class="page-link" href="?sort=-date_created&page_size=25&page=2">2</a></li>
|
||
<li><a class="page-link" href="?sort=-date_created&page_size=25&page=3">3</a></li>
|
||
<li><a class="page-link" href="?sort=-date_created&page_size=25&page=4">4</a></li>
|
||
<li><a class="page-link" href="?sort=-date_created&page_size=25&page=5">5</a></li>
|
||
<li><a class="page-link" href="?sort=-date_created&page_size=25&page=6">6</a></li>
|
||
<li><a class="page-link" href="?sort=-date_created&page_size=25&page=2">Next ▶</a></li>
|
||
</ul>
|
||
</nav>
|
||
</main>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
// Mockup-only behaviour. The real page relies on the server for all of this.
|
||
(function () {
|
||
var levelSelect = document.getElementById('demo-user-level');
|
||
var newTaskBtn = document.getElementById('new-task-btn');
|
||
var form = document.getElementById('task-filter-form');
|
||
var clearLink = document.getElementById('clear-filters');
|
||
var queryOut = document.getElementById('demo-query');
|
||
|
||
// "+ New Task" visible only when user_level >= 3
|
||
function applyUserLevel() {
|
||
var required = Number(newTaskBtn.dataset.requiresUserLevel);
|
||
newTaskBtn.hidden = Number(levelSelect.value) < required;
|
||
}
|
||
levelSelect.addEventListener('change', applyUserLevel);
|
||
applyUserLevel();
|
||
|
||
// Standalone file has no server: show the GET URL instead of navigating.
|
||
function buildQuery(page) {
|
||
var params = new URLSearchParams();
|
||
new FormData(form).forEach(function (value, key) {
|
||
if (value !== '') params.append(key, value);
|
||
});
|
||
if (page) params.set('page', page);
|
||
return params.toString();
|
||
}
|
||
function showQuery(page) {
|
||
var qs = buildQuery(page);
|
||
queryOut.textContent = form.getAttribute('action') + (qs ? '?' + qs : '');
|
||
}
|
||
// Applying filters returns to page 1.
|
||
form.addEventListener('submit', function (e) {
|
||
e.preventDefault();
|
||
currentPage = 1;
|
||
renderPagination();
|
||
showQuery();
|
||
});
|
||
|
||
// Sorting: toggle ASC/DESC on the clicked column; a new column starts ASC.
|
||
var sortInput = document.getElementById('sort-input');
|
||
var tbody = document.querySelector('.task-table tbody');
|
||
var sortHeaders = Array.prototype.slice.call(document.querySelectorAll('.task-table th[data-sort-field]'));
|
||
var PRIORITY_RANK = { Low: 1, Medium: 2, High: 3 };
|
||
|
||
function renderSort() {
|
||
var sort = sortInput.value;
|
||
var desc = sort.charAt(0) === '-';
|
||
var field = desc ? sort.slice(1) : sort;
|
||
var activeIndex = -1;
|
||
|
||
sortHeaders.forEach(function (th) {
|
||
var active = th.dataset.sortField === field;
|
||
th.querySelector('.sort-indicator').textContent = active ? (desc ? '▼' : '▲') : '';
|
||
if (active) {
|
||
th.setAttribute('aria-sort', desc ? 'descending' : 'ascending');
|
||
activeIndex = th.cellIndex;
|
||
} else {
|
||
th.removeAttribute('aria-sort');
|
||
}
|
||
});
|
||
if (activeIndex < 0) return;
|
||
|
||
// Mockup-only: reorder sample rows. The real page sorts the queryset server-side.
|
||
var emptyRow = document.getElementById('empty-row');
|
||
var rows = Array.prototype.slice.call(tbody.querySelectorAll('tr:not(.empty-row)'));
|
||
rows.sort(function (a, b) {
|
||
var x = a.cells[activeIndex].textContent.trim();
|
||
var y = b.cells[activeIndex].textContent.trim();
|
||
var cmp = field === 'task_priority'
|
||
? PRIORITY_RANK[x] - PRIORITY_RANK[y]
|
||
: x.localeCompare(y);
|
||
return desc ? -cmp : cmp;
|
||
});
|
||
rows.forEach(function (row) { tbody.insertBefore(row, emptyRow); });
|
||
}
|
||
|
||
sortHeaders.forEach(function (th) {
|
||
th.querySelector('.sort-link').addEventListener('click', function (e) {
|
||
e.preventDefault();
|
||
var field = th.dataset.sortField;
|
||
sortInput.value = sortInput.value === field ? '-' + field : field;
|
||
renderSort();
|
||
currentPage = 1;
|
||
renderPagination();
|
||
showQuery();
|
||
});
|
||
});
|
||
|
||
// Pagination. Mockup has a fixed sample total; every page shows the same sample rows.
|
||
var SAMPLE_TOTAL = 142;
|
||
var currentPage = 1;
|
||
var pageSize = document.getElementById('page-size');
|
||
var demoEmpty = document.getElementById('demo-empty');
|
||
var pagination = document.getElementById('pagination');
|
||
|
||
function totalTasks() { return demoEmpty.checked ? 0 : SAMPLE_TOTAL; }
|
||
function numPages() { return Math.max(1, Math.ceil(totalTasks() / Number(pageSize.value))); }
|
||
|
||
// Same output as Django's Paginator.get_elided_page_range(number, on_each_side=2, on_ends=1).
|
||
function elidedPageRange(number, count) {
|
||
var onEachSide = 2, onEnds = 1, out = [], i;
|
||
if (count <= (onEachSide + onEnds) * 2) {
|
||
for (i = 1; i <= count; i++) out.push(i);
|
||
return out;
|
||
}
|
||
if (number > 1 + onEachSide + onEnds + 1) {
|
||
for (i = 1; i <= onEnds; i++) out.push(i);
|
||
out.push('…');
|
||
for (i = number - onEachSide; i <= number; i++) out.push(i);
|
||
} else {
|
||
for (i = 1; i <= number; i++) out.push(i);
|
||
}
|
||
if (number < count - onEachSide - onEnds - 1) {
|
||
for (i = number + 1; i <= number + onEachSide; i++) out.push(i);
|
||
out.push('…');
|
||
for (i = count - onEnds + 1; i <= count; i++) out.push(i);
|
||
} else {
|
||
for (i = number + 1; i <= count; i++) out.push(i);
|
||
}
|
||
return out;
|
||
}
|
||
|
||
function pageItem(label, page, kind) {
|
||
var li = document.createElement('li');
|
||
var el;
|
||
if (kind === 'link') {
|
||
el = document.createElement('a');
|
||
el.href = '?' + buildQuery(page);
|
||
el.dataset.page = page;
|
||
} else {
|
||
el = document.createElement('span');
|
||
if (kind === 'disabled') el.setAttribute('aria-disabled', 'true');
|
||
if (kind === 'active') el.setAttribute('aria-current', 'page');
|
||
}
|
||
el.className = 'page-link' + (kind === 'link' ? '' : ' ' + (kind === 'ellipsis' ? 'page-ellipsis' : kind));
|
||
el.textContent = label;
|
||
li.appendChild(el);
|
||
return li;
|
||
}
|
||
|
||
function renderPagination() {
|
||
var total = totalTasks();
|
||
var size = Number(pageSize.value);
|
||
var count = numPages();
|
||
if (currentPage > count) currentPage = count;
|
||
|
||
document.getElementById('range-start').textContent = total ? (currentPage - 1) * size + 1 : 0;
|
||
document.getElementById('range-end').textContent = Math.min(currentPage * size, total);
|
||
document.getElementById('total-count').textContent = total;
|
||
|
||
pagination.innerHTML = '';
|
||
pagination.appendChild(currentPage > 1
|
||
? pageItem('◀ Prev', currentPage - 1, 'link')
|
||
: pageItem('◀ Prev', null, 'disabled'));
|
||
elidedPageRange(currentPage, count).forEach(function (n) {
|
||
if (n === '…') pagination.appendChild(pageItem('…', null, 'ellipsis'));
|
||
else if (n === currentPage) pagination.appendChild(pageItem(String(n), null, 'active'));
|
||
else pagination.appendChild(pageItem(String(n), n, 'link'));
|
||
});
|
||
pagination.appendChild(currentPage < count
|
||
? pageItem('Next ▶', currentPage + 1, 'link')
|
||
: pageItem('Next ▶', null, 'disabled'));
|
||
}
|
||
|
||
pagination.addEventListener('click', function (e) {
|
||
var link = e.target.closest('a.page-link');
|
||
if (!link) return;
|
||
e.preventDefault();
|
||
currentPage = Number(link.dataset.page);
|
||
renderPagination();
|
||
showQuery(currentPage);
|
||
});
|
||
|
||
// Page size auto-submits on change and returns to page 1.
|
||
pageSize.addEventListener('change', function () {
|
||
form.requestSubmit();
|
||
});
|
||
|
||
// Mockup-only: preview the empty state (paginator gives 0–0 of 0, one page).
|
||
demoEmpty.addEventListener('change', function () {
|
||
tbody.querySelectorAll('tr:not(.empty-row)').forEach(function (row) { row.hidden = demoEmpty.checked; });
|
||
document.getElementById('empty-row').hidden = !demoEmpty.checked;
|
||
currentPage = 1;
|
||
renderPagination();
|
||
});
|
||
|
||
renderPagination();
|
||
|
||
clearLink.addEventListener('click', function (e) {
|
||
e.preventDefault();
|
||
form.reset();
|
||
sortInput.value = '-date_created';
|
||
renderSort();
|
||
currentPage = 1;
|
||
renderPagination();
|
||
queryOut.textContent = clearLink.getAttribute('href');
|
||
});
|
||
})();
|
||
</script>
|
||
|
||
</body>
|
||
</html>
|