mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-01-10 05:30:08 -06:00
feat(tasks): add draggable Kanban and make it the only view
- Add reusable Kanban partial (app/templates/tasks/_kanban.html) with HTML5 drag-and-drop and optimistic status updates via PUT /api/tasks/<id>/status - Tasks overview (app/templates/tasks/list.html): replace grid with Kanban and remove the List/Kanban toggle so Kanban is the sole view - Project page (templates/projects/view.html): replace task cards grid with the same Kanban board
This commit is contained in:
200
app/templates/tasks/_kanban.html
Normal file
200
app/templates/tasks/_kanban.html
Normal file
@@ -0,0 +1,200 @@
|
||||
{# Reusable Kanban board for tasks. Expects `tasks` in context. #}
|
||||
{% set kanban_statuses = [
|
||||
{'key': 'todo', 'label': 'To Do', 'icon': 'fas fa-list-check', 'accent': 'secondary'},
|
||||
{'key': 'in_progress', 'label': 'In Progress', 'icon': 'fas fa-spinner', 'accent': 'warning'},
|
||||
{'key': 'review', 'label': 'Review', 'icon': 'fas fa-user-check', 'accent': 'info'},
|
||||
{'key': 'done', 'label': 'Done', 'icon': 'fas fa-check-circle', 'accent': 'success'},
|
||||
{'key': 'cancelled', 'label': 'Cancelled', 'icon': 'fas fa-ban', 'accent': 'danger'}
|
||||
] %}
|
||||
|
||||
<div class="kanban-board-wrapper">
|
||||
<div class="kanban-toolbar d-flex justify-content-between align-items-center mb-3">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<i class="fas fa-columns text-primary"></i>
|
||||
<span class="fw-semibold">Kanban Board</span>
|
||||
</div>
|
||||
<div id="kanban-alert" class="d-none"></div>
|
||||
</div>
|
||||
|
||||
<div id="kanbanBoard" class="kanban-board">
|
||||
{% for col in kanban_statuses %}
|
||||
<div class="kanban-column" data-status="{{ col.key }}">
|
||||
<div class="kanban-column-header">
|
||||
<div class="d-flex align-items-center justify-content-between">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<div class="icon-circle bg-{{ col.accent }} bg-opacity-10 text-{{ col.accent }}">
|
||||
<i class="{{ col.icon }}"></i>
|
||||
</div>
|
||||
<span class="fw-semibold">{{ col.label }}</span>
|
||||
</div>
|
||||
<span class="badge rounded-pill bg-{{ col.accent }} kanban-column-count">
|
||||
{{ tasks|selectattr('status', 'equalto', col.key)|list|length }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="kanban-column-body" data-status="{{ col.key }}">
|
||||
{% for task in tasks if task.status == col.key %}
|
||||
<div class="kanban-card task-card {{ task.priority_class }}" draggable="true" data-task-id="{{ task.id }}" data-status="{{ task.status }}">
|
||||
<div class="card-header border-0 pb-0">
|
||||
<div class="d-flex justify-content-between align-items-start mb-2">
|
||||
<div class="d-flex align-items-center flex-wrap gap-2">
|
||||
<span class="status-badge status-{{ task.status }}">{{ task.status_display }}</span>
|
||||
<span class="priority-badge priority-{{ task.priority }}">{{ task.priority_display }}</span>
|
||||
{% if task.is_overdue %}
|
||||
<span class="badge bg-danger"><i class="fas fa-exclamation-triangle me-1"></i>Overdue</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<small class="text-muted">#{{ task.id }}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body pt-0">
|
||||
<h6 class="card-title mb-2">
|
||||
<a href="{{ url_for('tasks.view_task', task_id=task.id) }}" class="text-decoration-none task-title-link">{{ task.name }}</a>
|
||||
</h6>
|
||||
{% if task.description %}
|
||||
<p class="card-text text-muted small mb-2">{{ task.description[:90] }}{% if task.description|length > 90 %}...{% endif %}</p>
|
||||
{% endif %}
|
||||
<div class="d-flex align-items-center justify-content-between small text-muted">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
{% if task.assigned_user %}
|
||||
<span title="Assignee"><i class="fas fa-user text-info"></i> {{ task.assigned_user.display_name }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if task.due_date %}
|
||||
<span class="{% if task.is_overdue %}text-danger fw-semibold{% endif %}"><i class="fas fa-calendar me-1"></i>{{ task.due_date.strftime('%b %d') }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.kanban-board { display: grid; grid-template-columns: repeat(5, minmax(260px, 1fr)); gap: 16px; align-items: start; }
|
||||
.kanban-column { background: var(--card-bg, #fff); border: 1px solid var(--border-color); border-radius: 12px; display: flex; flex-direction: column; min-height: 120px; }
|
||||
.kanban-column-header { padding: 12px 12px 8px 12px; border-bottom: 1px solid var(--border-color); background: var(--light-color, #f8fafc); border-top-left-radius: 12px; border-top-right-radius: 12px; }
|
||||
.kanban-column-body { padding: 12px; min-height: 120px; max-height: 70vh; overflow-y: auto; }
|
||||
.kanban-card { margin-bottom: 12px; cursor: grab; }
|
||||
.kanban-card.dragging { opacity: 0.6; cursor: grabbing; }
|
||||
.kanban-column-body.drag-over { outline: 2px dashed var(--primary-color); outline-offset: -6px; background: rgba(59, 130, 246, 0.05); }
|
||||
.icon-circle { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
|
||||
#kanban-alert { width: 100%; }
|
||||
.alert-inline { margin: 0; padding: 6px 10px; }
|
||||
@media (max-width: 1200px) { .kanban-board { grid-template-columns: repeat(3, minmax(260px, 1fr)); } }
|
||||
@media (max-width: 768px) { .kanban-board { grid-template-columns: repeat(1, minmax(260px, 1fr)); } }
|
||||
[data-theme="dark"] .kanban-column { background: #0f172a; border-color: #1f2a44; }
|
||||
[data-theme="dark"] .kanban-column-header { background: #0b1220; border-color: #1f2a44; }
|
||||
</style>
|
||||
|
||||
<script>
|
||||
(function(){
|
||||
const board = document.getElementById('kanbanBoard');
|
||||
if (!board) return;
|
||||
|
||||
const statusLabels = { todo: 'To Do', in_progress: 'In Progress', review: 'Review', done: 'Done', cancelled: 'Cancelled' };
|
||||
const updateUrlTemplate = "{{ url_for('tasks.api_update_status', task_id=0) }}"; // will replace 0 with actual id
|
||||
|
||||
function showAlert(kind, msg) {
|
||||
const holder = document.getElementById('kanban-alert');
|
||||
if (!holder) return;
|
||||
holder.className = '';
|
||||
holder.classList.add('alert', 'alert-' + (kind === 'error' ? 'danger' : (kind === 'info' ? 'info' : 'success')), 'alert-inline');
|
||||
holder.textContent = msg;
|
||||
holder.classList.remove('d-none');
|
||||
window.clearTimeout(holder._t);
|
||||
holder._t = window.setTimeout(() => { holder.classList.add('d-none'); }, 2500);
|
||||
}
|
||||
|
||||
function updateCounts() {
|
||||
document.querySelectorAll('.kanban-column').forEach(col => {
|
||||
const body = col.querySelector('.kanban-column-body');
|
||||
const count = body ? body.querySelectorAll('.kanban-card').length : 0;
|
||||
const badge = col.querySelector('.kanban-column-count');
|
||||
if (badge) badge.textContent = count;
|
||||
});
|
||||
}
|
||||
|
||||
let dragCard = null;
|
||||
board.addEventListener('dragstart', (e) => {
|
||||
const card = e.target.closest('.kanban-card');
|
||||
if (!card) return;
|
||||
dragCard = card;
|
||||
card.classList.add('dragging');
|
||||
e.dataTransfer.effectAllowed = 'move';
|
||||
e.dataTransfer.setData('text/plain', card.dataset.taskId);
|
||||
});
|
||||
|
||||
board.addEventListener('dragend', () => {
|
||||
if (dragCard) dragCard.classList.remove('dragging');
|
||||
dragCard = null;
|
||||
document.querySelectorAll('.kanban-column-body').forEach(b => b.classList.remove('drag-over'));
|
||||
});
|
||||
|
||||
document.querySelectorAll('.kanban-column-body').forEach(body => {
|
||||
body.addEventListener('dragover', (e) => {
|
||||
e.preventDefault();
|
||||
e.dataTransfer.dropEffect = 'move';
|
||||
body.classList.add('drag-over');
|
||||
});
|
||||
body.addEventListener('dragleave', () => body.classList.remove('drag-over'));
|
||||
body.addEventListener('drop', async (e) => {
|
||||
e.preventDefault();
|
||||
body.classList.remove('drag-over');
|
||||
const targetStatus = body.dataset.status;
|
||||
const taskId = e.dataTransfer.getData('text/plain');
|
||||
const card = dragCard || board.querySelector(`.kanban-card[data-task-id="${taskId}"]`);
|
||||
if (!card) return;
|
||||
const originalParent = card.parentElement;
|
||||
const originalStatus = card.dataset.status;
|
||||
if (targetStatus === originalStatus) {
|
||||
body.appendChild(card);
|
||||
return;
|
||||
}
|
||||
body.appendChild(card);
|
||||
updateCounts();
|
||||
// optimistic UI: update badge
|
||||
const statusBadge = card.querySelector('.status-badge');
|
||||
if (statusBadge) {
|
||||
statusBadge.className = `status-badge status-${targetStatus}`;
|
||||
statusBadge.textContent = statusLabels[targetStatus] || targetStatus;
|
||||
}
|
||||
card.dataset.status = targetStatus;
|
||||
|
||||
const url = updateUrlTemplate.replace('/0/', `/${taskId}/`);
|
||||
try {
|
||||
const resp = await fetch(url, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest' },
|
||||
body: JSON.stringify({ status: targetStatus })
|
||||
});
|
||||
if (!resp.ok) {
|
||||
throw new Error('Failed to update status');
|
||||
}
|
||||
const data = await resp.json();
|
||||
if (!data.success) {
|
||||
throw new Error(data.error || 'Update rejected');
|
||||
}
|
||||
showAlert('success', 'Task moved to ' + (statusLabels[targetStatus] || targetStatus));
|
||||
} catch (err) {
|
||||
// revert
|
||||
if (originalParent) originalParent.appendChild(card);
|
||||
card.dataset.status = originalStatus;
|
||||
if (statusBadge) {
|
||||
statusBadge.className = `status-badge status-${originalStatus}`;
|
||||
statusBadge.textContent = statusLabels[originalStatus] || originalStatus;
|
||||
}
|
||||
updateCounts();
|
||||
showAlert('error', err.message || 'Could not update task');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
updateCounts();
|
||||
})();
|
||||
</script>
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Summary Cards (Invoices-style) -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-3 col-sm-6 mb-3">
|
||||
@@ -171,192 +173,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tasks Grid -->
|
||||
{% if tasks %}
|
||||
<div class="row g-4">
|
||||
{% for task in tasks %}
|
||||
<div class="col-xl-4 col-lg-6 col-md-6">
|
||||
<div class="card mobile-card task-card h-100 {{ task.priority_class }}">
|
||||
<!-- Card Header -->
|
||||
<div class="card-header border-0 pb-0">
|
||||
<div class="d-flex justify-content-between align-items-start mb-2">
|
||||
<div class="d-flex align-items-center flex-wrap gap-2">
|
||||
<span class="status-badge status-{{ task.status }}">
|
||||
{{ task.status_display }}
|
||||
</span>
|
||||
<span class="priority-badge priority-{{ task.priority }}">
|
||||
{{ task.priority_display }}
|
||||
</span>
|
||||
{% if task.is_overdue %}
|
||||
<span class="badge bg-danger">
|
||||
<i class="fas fa-exclamation-triangle me-1"></i>Overdue
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<small class="text-muted">#{{ task.id }}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Card Body -->
|
||||
<div class="card-body pt-0">
|
||||
<h5 class="card-title mb-3">
|
||||
<a href="{{ url_for('tasks.view_task', task_id=task.id) }}" class="text-decoration-none text-dark task-title-link">
|
||||
{{ task.name }}
|
||||
</a>
|
||||
</h5>
|
||||
|
||||
{% if task.description %}
|
||||
<div class="task-description mb-3">
|
||||
<p class="card-text text-muted small mb-0">
|
||||
{{ task.description[:100] }}{% if task.description|length > 100 %}...{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Project Info -->
|
||||
<div class="d-flex align-items-center mb-3 project-info">
|
||||
<div class="bg-primary bg-opacity-10 rounded-circle d-flex align-items-center justify-content-center me-2" style="width: 28px; height: 28px;">
|
||||
<i class="fas fa-project-diagram text-primary fa-sm"></i>
|
||||
</div>
|
||||
<div>
|
||||
<span class="text-muted small d-block">{{ task.project.name }}</span>
|
||||
<span class="text-muted" style="font-size: 0.75rem;">{{ task.project.client }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Task Meta -->
|
||||
<div class="task-meta mb-3">
|
||||
<div class="row g-2">
|
||||
{% if task.assigned_user %}
|
||||
<div class="col-12">
|
||||
<div class="d-flex align-items-center task-meta-item">
|
||||
<div class="bg-info bg-opacity-10 rounded-circle d-flex align-items-center justify-content-center me-2" style="width: 24px; height: 24px;">
|
||||
<i class="fas fa-user text-info fa-xs"></i>
|
||||
</div>
|
||||
<span class="text-muted small">{{ task.assigned_user.display_name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if task.due_date %}
|
||||
<div class="col-12">
|
||||
<div class="d-flex align-items-center task-meta-item">
|
||||
<div class="bg-{% if task.is_overdue %}danger{% else %}secondary{% endif %} bg-opacity-10 rounded-circle d-flex align-items-center justify-content-center me-2" style="width: 24px; height: 24px;">
|
||||
<i class="fas fa-calendar text-{% if task.is_overdue %}danger{% else %}secondary{% endif %} fa-xs"></i>
|
||||
</div>
|
||||
<span class="text-muted small {% if task.is_overdue %}text-danger fw-bold{% endif %}">
|
||||
Due: {{ task.due_date.strftime('%b %d') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="col-6">
|
||||
{% if task.estimated_hours %}
|
||||
<div class="d-flex align-items-center task-meta-item">
|
||||
<div class="bg-warning bg-opacity-10 rounded-circle d-flex align-items-center justify-content-center me-2" style="width: 20px; height: 20px;">
|
||||
<i class="fas fa-clock text-warning fa-xs"></i>
|
||||
</div>
|
||||
<span class="text-muted small">Est: {{ task.estimated_hours }}h</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
{% if task.total_hours > 0 %}
|
||||
<div class="d-flex align-items-center task-meta-item">
|
||||
<div class="bg-success bg-opacity-10 rounded-circle d-flex align-items-center justify-content-center me-2" style="width: 20px; height: 20px;">
|
||||
<i class="fas fa-stopwatch text-success fa-xs"></i>
|
||||
</div>
|
||||
<span class="text-muted small">{{ task.total_hours }}h</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Progress Bar -->
|
||||
{% if task.estimated_hours and task.total_hours > 0 %}
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-1">
|
||||
<small class="text-muted">Progress</small>
|
||||
<small class="text-muted fw-bold">{{ task.progress_percentage }}%</small>
|
||||
</div>
|
||||
<div class="progress" style="height: 6px;">
|
||||
<div class="progress-bar bg-primary" role="progressbar"
|
||||
style="width: {{ task.progress_percentage }}%"
|
||||
aria-valuenow="{{ task.progress_percentage }}"
|
||||
aria-valuemin="0" aria-valuemax="100">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Card Footer -->
|
||||
<div class="card-footer border-0 pt-0">
|
||||
<div class="d-grid gap-2">
|
||||
<a href="{{ url_for('tasks.view_task', task_id=task.id) }}" class="btn btn-outline-primary btn-sm">
|
||||
<i class="fas fa-eye me-2"></i>View Details
|
||||
</a>
|
||||
{% if current_user.active_timer and current_user.active_timer.task_id == task.id %}
|
||||
<form method="POST" action="{{ url_for('timer.stop_timer') }}" class="d-inline">
|
||||
<button type="submit" class="btn btn-danger btn-sm">
|
||||
<i class="fas fa-stop me-2"></i>Stop Timer
|
||||
</button>
|
||||
</form>
|
||||
{% elif not current_user.active_timer %}
|
||||
<a href="{{ url_for('timer.start_timer_for_project', project_id=task.project_id, task_id=task.id) }}" class="btn btn-success btn-sm">
|
||||
<i class="fas fa-play me-2"></i>Start Timer
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
{% if pagination.pages > 1 %}
|
||||
<nav aria-label="Task pagination" class="mt-5">
|
||||
<ul class="pagination justify-content-center">
|
||||
{% if pagination.has_prev %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ url_for('tasks.list_tasks', page=pagination.prev_num, **request.args) }}">
|
||||
<i class="fas fa-chevron-left"></i> Previous
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% for page_num in pagination.iter_pages() %}
|
||||
{% if page_num %}
|
||||
{% if page_num != pagination.page %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ url_for('tasks.list_tasks', page=page_num, **request.args) }}">{{ page_num }}</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="page-item active">
|
||||
<span class="page-link">{{ page_num }}</span>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link">...</span>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if pagination.has_next %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ url_for('tasks.list_tasks', page=pagination.next_num, **request.args) }}">
|
||||
Next <i class="fas fa-chevron-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
{% include 'tasks/_kanban.html' %}
|
||||
{% else %}
|
||||
<!-- Empty State -->
|
||||
<div class="row">
|
||||
|
||||
@@ -163,142 +163,8 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if tasks %}
|
||||
<div class="row g-3">
|
||||
{% for task in tasks[:6] %}
|
||||
<div class="col-md-6 col-lg-4">
|
||||
<div class="card h-100 task-card {{ task.priority_class }}">
|
||||
<div class="card-header border-0 pb-0">
|
||||
<div class="d-flex justify-content-between align-items-start mb-2">
|
||||
<div class="d-flex align-items-center flex-wrap gap-2">
|
||||
<span class="status-badge status-{{ task.status }}">
|
||||
{{ task.status_display }}
|
||||
</span>
|
||||
<span class="priority-badge priority-{{ task.priority }}">
|
||||
{{ task.priority_display }}
|
||||
</span>
|
||||
{% if task.is_overdue %}
|
||||
<span class="badge bg-danger">
|
||||
<i class="fas fa-exclamation-triangle me-1"></i>Overdue
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<small class="text-muted">#{{ task.id }}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body pt-0">
|
||||
<h6 class="card-title mb-3">
|
||||
<a href="{{ url_for('tasks.view_task', task_id=task.id) }}" class="text-decoration-none task-title-link">
|
||||
{{ task.name }}
|
||||
</a>
|
||||
</h6>
|
||||
|
||||
{% if task.description %}
|
||||
<div class="task-description mb-3">
|
||||
<p class="card-text text-muted small mb-0">{{ task.description[:80] }}{% if task.description|length > 80 %}...{% endif %}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="task-meta mb-3">
|
||||
<div class="row g-2">
|
||||
{% if task.assigned_user %}
|
||||
<div class="col-12">
|
||||
<div class="d-flex align-items-center task-meta-item">
|
||||
<div class="bg-info bg-opacity-10 rounded-circle d-flex align-items-center justify-content-center me-2" style="width: 20px; height: 20px;">
|
||||
<i class="fas fa-user text-info fa-xs"></i>
|
||||
</div>
|
||||
<span class="text-muted small">{{ task.assigned_user.display_name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if task.due_date %}
|
||||
<div class="col-12">
|
||||
<div class="d-flex align-items-center task-meta-item">
|
||||
<div class="bg-{% if task.is_overdue %}danger{% else %}secondary{% endif %} bg-opacity-10 rounded-circle d-flex align-items-center justify-content-center me-2" style="width: 20px; height: 20px;">
|
||||
<i class="fas fa-calendar text-{% if task.is_overdue %}danger{% else %}secondary{% endif %} fa-xs"></i>
|
||||
</div>
|
||||
<span class="text-muted small {% if task.is_overdue %}text-danger fw-bold{% endif %}">
|
||||
Due: {{ task.due_date.strftime('%b %d') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="col-6">
|
||||
{% if task.estimated_hours %}
|
||||
<div class="d-flex align-items-center task-meta-item">
|
||||
<div class="bg-warning bg-opacity-10 rounded-circle d-flex align-items-center justify-content-center me-2" style="width: 18px; height: 18px;">
|
||||
<i class="fas fa-clock text-warning fa-xs"></i>
|
||||
</div>
|
||||
<span class="text-muted small">Est: {{ task.estimated_hours }}h</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
{% if task.total_hours > 0 %}
|
||||
<div class="d-flex align-items-center task-meta-item">
|
||||
<div class="bg-success bg-opacity-10 rounded-circle d-flex align-items-center justify-content-center me-2" style="width: 18px; height: 18px;">
|
||||
<i class="fas fa-stopwatch text-success fa-xs"></i>
|
||||
</div>
|
||||
<span class="text-muted small">{{ task.total_hours }}h</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if task.estimated_hours and task.total_hours > 0 %}
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-1">
|
||||
<small class="text-muted">Progress</small>
|
||||
<small class="text-muted fw-bold">{{ task.progress_percentage }}%</small>
|
||||
</div>
|
||||
<div class="progress" style="height: 6px;">
|
||||
<div class="progress-bar bg-primary" role="progressbar"
|
||||
style="width: {{ task.progress_percentage }}%"
|
||||
aria-valuenow="{{ task.progress_percentage }}"
|
||||
aria-valuemin="0" aria-valuemax="100">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-footer border-0 pt-0">
|
||||
<div class="d-grid gap-2">
|
||||
<a href="{{ url_for('tasks.view_task', task_id=task.id) }}" class="btn btn-outline-primary btn-sm">
|
||||
<i class="fas fa-eye me-2"></i>View Details
|
||||
</a>
|
||||
{% if current_user.active_timer and current_user.active_timer.task_id == task.id %}
|
||||
<form method="POST" action="{{ url_for('timer.stop_timer') }}" class="d-inline">
|
||||
<button type="submit" class="btn btn-danger btn-sm">
|
||||
<i class="fas fa-stop me-2"></i>Stop Timer
|
||||
</button>
|
||||
</form>
|
||||
{% elif not current_user.active_timer %}
|
||||
<a href="{{ url_for('timer.start_timer_for_project', project_id=task.project.id, task_id=task.id) }}" class="btn btn-primary btn-sm" title="Start Timer">
|
||||
<i class="fas fa-play"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if current_user.is_admin or task.created_by == current_user.id %}
|
||||
<a href="{{ url_for('tasks.edit_task', task_id=task.id) }}" class="btn btn-outline-secondary btn-sm">
|
||||
<i class="fas fa-edit me-2"></i>Edit Task
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if tasks|length > 6 %}
|
||||
<div class="text-center mt-3">
|
||||
<a href="{{ url_for('tasks.list_tasks', project_id=project.id) }}" class="btn btn-outline-primary">
|
||||
View All {{ tasks|length }} Tasks
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% set project_tasks = tasks %}
|
||||
{% include 'tasks/_kanban.html' with context %}
|
||||
{% else %}
|
||||
{% from "_components.html" import empty_state %}
|
||||
{% set actions %}
|
||||
|
||||
Reference in New Issue
Block a user