Files
diary-family/core/templates/core/family_tasks.html
xiaji c123d03922 feat(家庭事项): 只显示未完成的事项,不按人过滤
- 修改家庭事项视图,排除已完成状态的事项
- 修改首页待处理事项查询逻辑,与家庭事项页面保持一致
- 更新家庭事项页面标题和空状态提示信息
2026-03-08 18:14:05 +08:00

93 lines
4.1 KiB
HTML

{% extends 'core/base.html' %}
{% block content %}
<!-- 页面标题 -->
<div class="d-flex justify-content-between align-items-center mb-4">
<h2 class="mb-0">
<i class="bi bi-list-check me-2 text-warning"></i>家庭事项 <small class="text-muted fs-5">(未完成)</small>
</h2>
<div>
<a href="{% url 'add_family_task' %}" class="btn btn-primary">
<i class="bi bi-plus-lg me-1"></i>添加家庭事项
</a>
</div>
</div>
<div class="card">
<div class="card-header bg-primary text-white d-flex justify-content-between align-items-center">
<h5 class="card-title mb-0">
<i class="bi bi-house-door me-2"></i>家庭事项列表
</h5>
<span class="badge bg-light text-primary">{{ tasks|length }} 项</span>
</div>
<div class="card-body">
{% if tasks %}
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th style="width: 100px;">类型</th>
<th>内容</th>
<th style="width: 100px;">优先级</th>
<th style="width: 100px;">状态</th>
<th style="width: 120px;">截止日期</th>
<th style="width: 100px;">操作</th>
</tr>
</thead>
<tbody>
{% for task in tasks %}
<tr class="{% if task.status == 'completed' %}table-success{% endif %}">
<td>
<span class="badge bg-secondary">{{ task.get_type_display }}</span>
</td>
<td>
<strong>{{ task.content }}</strong>
</td>
<td>
<span class="badge {% if task.priority == 'high' %}bg-danger{% elif task.priority == 'medium' %}bg-warning{% else %}bg-info{% endif %}">
{{ task.get_priority_display }}
</span>
</td>
<td>
<span class="badge {% if task.status == 'completed' %}bg-success{% else %}bg-warning{% endif %}">
{{ task.get_status_display }}
</span>
</td>
<td>
{% if task.deadline %}
<span class="{% if task.is_overdue %}text-danger{% else %}text-muted{% endif %}">
<i class="bi bi-calendar me-1"></i>{{ task.deadline }}
</span>
{% else %}
<span class="text-muted">-</span>
{% endif %}
</td>
<td>
<div class="btn-group">
<a href="{% url 'edit_family_task' task.id %}" class="btn btn-sm btn-warning" title="编辑">
<i class="bi bi-pencil"></i>
</a>
<a href="{% url 'delete_family_task' task.id %}" class="btn btn-sm btn-danger" title="删除">
<i class="bi bi-trash"></i>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="text-center py-5">
<i class="bi bi-check-all text-success" style="font-size: 5rem;"></i>
<h5 class="text-muted mt-3">太棒了!没有未完成的家庭事项</h5>
<p class="text-muted">所有家庭事项都已完成,可以添加新的家庭事项</p>
<a href="{% url 'add_family_task' %}" class="btn btn-primary">
<i class="bi bi-plus-lg me-1"></i>添加家庭事项
</a>
</div>
{% endif %}
</div>
</div>
{% endblock %}