You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

244 lines
9.1 KiB

{% extends "base.html" %}
{% block title %}任务列表{% endblock %}
{% block staticcss %}
{% endblock %}
{% block staticjs %}
<script>
$(document).ready(function () {
$('#dataTable').DataTable({
responsive: true,
"language": {
"sProcessing": "处理中...",
"sLengthMenu": "显示 _MENU_ 项结果",
"sZeroRecords": "没有匹配结果",
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
"sInfoPostFix": "",
"sSearch": "搜索:",
"sUrl": "",
"sEmptyTable": "表中数据为空",
"sLoadingRecords": "载入中...",
"sInfoThousands": ",",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上页",
"sNext": "下页",
"sLast": "末页"
},
"oAria": {
"sSortAscending": ": 以升序排列此列",
"sSortDescending": ": 以降序排列此列"
}
}
});
});
</script>
{% endblock %}
{% block content %}
<!-- Page Content -->
<div id="page-wrapper">
<div class="container-fluid">
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800">计时任务</h1>
</div>
</div>
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li {% if message.tags %} class="alert-{{ message.tags }}" {% endif %}>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
<div class="card shadow mb-4">
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">任务列表</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in"
aria-labelledby="dropdownMenuLink">
<a class="dropdown-item" data-toggle="modal" data-target="#myModal">
添加任务
</a>
{% ifequal stat 'list'%}
<a class="dropdown-item" href="{% url 'mytodo' 'done' %}">已完成任务</a>
{% else %}
<a class="dropdown-item" href="{% url 'mytodo' 'list' %}">
未完成任务
</a>
{% endifequal %}
</div>
</div>
</div>
<div class="card-body">
<!--表单报错显示-->
{% if form.errors %}
{% for field, error in form.errors.items %}
<div class="alert alert-error">
{{ field }} <code>{{ error }}</code>
</div>
{% endfor %}
{% endif %}
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>选择</th>
<th>ID</th>
<th>任务名称</th>
<th>任务类型</th>
<th>权重</th>
<th>创建人</th>
<th>创建日期</th>
<th>截止日期</th>
<th>分配给</th>
<th>状态</th>
<th>评论</th>
<th>绩效值</th>
<th>绩效锁定</th>
<th>操作</th>
</tr>
</thead>
<tfoot>
<tr>
<th>选择</th>
<th>ID</th>
<th>任务名称</th>
<th>任务类型</th>
<th>权重</th>
<th>创建人</th>
<th>创建日期</th>
<th>截止日期</th>
<th>分配给</th>
<th>状态</th>
<th>次数</th>
<th>绩效值</th>
<th>绩效锁定</th>
<th>操作</th>
</tr>
</tfoot>
<tbody>
{% for list in latest %}
<tr class="odd gradeX {% if list.overdue_status %}danger{% endif %}">
<td><input class="checkbox" type="checkbox" value="{{ list.id }}" name="mark_done"></td>
<td>{{ forloop.counter }}
{% if list.overdue_status %}
<i class="fas fa-exclamation-triangle"></i>
{% endif %}
</td>
<td>{{ list.title|slice:'15' }}</td>
<td>{{ list.type }}</td>
<td>{{ list.get_priority_display }}</td>
<td>{{ list.created_by }}</td>
<td>{{ list.created_date }}</td>
<td>{{ list.due_date }}</td>
<td>{{ list.assigned_to }}</td>
<td>{{ list.get_status_display }}</td>
<td>{{ list.itemcomment_set.all.count }}</td>
<td>{{ list.per_value }}</td>
<td>
{% if list.lock %}
<i class="fa fa-lock"></i>
{% else %}
<i class="fa fa-unlock"></i>
{% endif %}
</td>
<td>
<a class="btn btn-outline btn-primary" href="{% url 'taskview' list.id %}">查看</a>
{% if not list.lock %}
<a class="btn btn-outline btn-info" href="{% url 'edittaskitem' list.id %}">编辑</a>
<a class="btn btn-outline btn-danger" href="#"
data-href="{% url 'delitem'%}?type=task&id={{ list.id }}" data-toggle="modal"
data-target="#confirm-delete">删除</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<button type="submit" class="btn btn-outline btn-danger" name="mark">批量删除</button>
</div>
</div>
</div>
</div>
<!--表单报错显示-->
{% if form.errors %}
{% for field, error in form.errors.items %}
<div class="alert alert-error">
{{ field }} <code>{{ error }}</code>
</div>
{% endfor %}
{% endif %}
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">新任务</h4>
</div>
<form role="form" onsubmit="return dosubmit()" method="post">
{% csrf_token %}
<div class="modal-body">
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
{% for field in form.visible_fields %}
<div class="form-group">
<label class="control-label">{{ field.label_tag }}</label>
<div class="controls">
{{ field.errors }}{{ field }}{{ field.help_text }}
</div>
</div>
{% endfor %}
</div>
<div class="modal-footer">
<button type="reset" class="btn btn-default" data-dismiss="modal">重设</button>
<button type="submit" class="btn btn-primary" name="addtask">保存</button>
</div>
</form>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
{% endblock %}